From de229d2dd4fb8bc3003da3c6ab304e6e3d429912 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20=C4=86wirko?= Date: Sun, 16 Jul 2023 17:57:32 +0200 Subject: [PATCH] allow triggering transactions before the previous ones are finished --- CHANGELOG.md | 6 + build/elven.js | 42 +- build/types/types.d.ts | 3 +- example/demo-styles.css | 21 +- example/demo-ui-tools.js | 5 +- example/elven.js | 42 +- example/index.html | 9 +- package-lock.json | 5263 ++++++++++----------- package.json | 30 +- src/auth/init-web-wallet-provider.ts | 1 + src/auth/login-with-extension.ts | 10 +- src/auth/login-with-mobile.ts | 5 +- src/auth/qr-code-and-pairings-builder.ts | 5 +- src/interaction/post-send-tx.ts | 1 - src/interaction/web-wallet-tx-finalize.ts | 9 + src/main.ts | 27 +- src/types.ts | 1 + 17 files changed, 2508 insertions(+), 2972 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3089dc2..9b1d747 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +### [0.11.0](https://github.com/elven-js/elven.js/releases/tag/v0.11.0) (2023-07-16) +- allow triggering transactions before the previous ones are finished +- updated dependencies +- adjust the code for newest versions of Multiversx tools +- run login pending state when native auth is fetching + ### [0.10.2](https://github.com/elven-js/elven.js/releases/tag/v0.10.2) (2023-05-29) - fix native auth when signing using browser extension diff --git a/build/elven.js b/build/elven.js index 9f7bc6b..0f660a7 100644 --- a/build/elven.js +++ b/build/elven.js @@ -1,9 +1,9 @@ -var a5=Object.create;var _c=Object.defineProperty,u5=Object.defineProperties,c5=Object.getOwnPropertyDescriptor,l5=Object.getOwnPropertyDescriptors,f5=Object.getOwnPropertyNames,O_=Object.getOwnPropertySymbols,h5=Object.getPrototypeOf,P_=Object.prototype.hasOwnProperty,d5=Object.prototype.propertyIsEnumerable;var D_=(t,e,r)=>e in t?_c(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xf=(t,e)=>{for(var r in e||={})P_.call(e,r)&&D_(t,r,e[r]);if(O_)for(var r of O_(e))d5.call(e,r)&&D_(t,r,e[r]);return t},R_=(t,e)=>u5(t,l5(e));var B_=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+t+'" is not supported')});var ge=(t,e)=>()=>(t&&(e=t(t=0)),e);var w=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),at=(t,e)=>{for(var r in e)_c(t,r,{get:e[r],enumerable:!0})},Tf=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of f5(e))!P_.call(t,i)&&i!==r&&_c(t,i,{get:()=>e[i],enumerable:!(n=c5(e,i))||n.enumerable});return t},Mt=(t,e,r)=>(Tf(t,e,"default"),r&&Tf(r,e,"default")),_e=(t,e,r)=>(r=t!=null?a5(h5(t)):{},Tf(e||!t||!t.__esModule?_c(r,"default",{value:t,enumerable:!0}):r,t)),nt=t=>Tf(_c({},"__esModule",{value:!0}),t);var Te=(t,e,r)=>new Promise((n,i)=>{var s=u=>{try{a(r.next(u))}catch(l){i(l)}},o=u=>{try{a(r.throw(u))}catch(l){i(l)}},a=u=>u.done?n(u.value):Promise.resolve(u.value).then(s,o);a((r=r.apply(t,e)).next())});var hy=w(Nf=>{"use strict";c();Nf.byteLength=g5;Nf.toByteArray=m5;Nf.fromByteArray=v5;var Kr=[],pr=[],p5=typeof Uint8Array<"u"?Uint8Array:Array,fy="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(ms=0,L_=fy.length;ms0)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 g5(t){var e=F_(t),r=e[0],n=e[1];return(r+n)*3/4-n}function y5(t,e,r){return(e+r)*3/4-r}function m5(t){var e,r=F_(t),n=r[0],i=r[1],s=new p5(y5(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=pr[t.charCodeAt(u)]<<2|pr[t.charCodeAt(u+1)]>>4,s[o++]=e&255),i===1&&(e=pr[t.charCodeAt(u)]<<10|pr[t.charCodeAt(u+1)]<<4|pr[t.charCodeAt(u+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function w5(t){return Kr[t>>18&63]+Kr[t>>12&63]+Kr[t>>6&63]+Kr[t&63]}function E5(t,e,r){for(var n,i=[],s=e;sa?a:o+s));return n===1?(e=t[r-1],i.push(Kr[e>>2]+Kr[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(Kr[e>>10]+Kr[e>>4&63]+Kr[e<<2&63]+"=")),i.join("")}});var py=w(dy=>{c();dy.read=function(t,e,r,n,i){var s,o,a=i*8-n-1,u=(1<>1,f=-7,d=r?i-1:0,y=r?-1:1,m=t[e+d];for(d+=y,s=m&(1<<-f)-1,m>>=-f,f+=a;f>0;s=s*256+t[e+d],d+=y,f-=8);for(o=s&(1<<-f)-1,s>>=-f,f+=n;f>0;o=o*256+t[e+d],d+=y,f-=8);if(s===0)s=1-l;else{if(s===u)return o?NaN:(m?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-l}return(m?-1:1)*o*Math.pow(2,s-n)};dy.write=function(t,e,r,n,i,s){var o,a,u,l=s*8-i-1,f=(1<>1,y=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,m=n?0:s-1,v=n?1:-1,T=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=f):(o=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-o))<1&&(o--,u*=2),o+d>=1?e+=y/u:e+=y*Math.pow(2,1-d),e*u>=2&&(o++,u/=2),o+d>=f?(a=0,o=f):o+d>=1?(a=(e*u-1)*Math.pow(2,i),o=o+d):(a=e*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;t[r+m]=a&255,m+=v,a/=256,i-=8);for(o=o<0;t[r+m]=o&255,m+=v,o/=256,l-=8);t[r+m-v]|=T*128}});var $_=w(jo=>{"use strict";c();var gy=hy(),Vo=py(),M_=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;jo.Buffer=K;jo.SlowBuffer=C5;jo.INSPECT_MAX_BYTES=50;var Of=2147483647;jo.kMaxLength=Of;K.TYPED_ARRAY_SUPPORT=A5();!K.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 A5(){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(K.prototype,"parent",{enumerable:!0,get:function(){if(K.isBuffer(this))return this.buffer}});Object.defineProperty(K.prototype,"offset",{enumerable:!0,get:function(){if(K.isBuffer(this))return this.byteOffset}});function Fn(t){if(t>Of)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,K.prototype),e}function K(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 Ey(t)}return V_(t,e,r)}K.poolSize=8192;function V_(t,e,r){if(typeof t=="string")return _5(t,e);if(ArrayBuffer.isView(t))return I5(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($r(t,ArrayBuffer)||t&&$r(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&($r(t,SharedArrayBuffer)||t&&$r(t.buffer,SharedArrayBuffer)))return my(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 K.from(n,e,r);var i=S5(t);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return K.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)}K.from=function(t,e,r){return V_(t,e,r)};Object.setPrototypeOf(K.prototype,Uint8Array.prototype);Object.setPrototypeOf(K,Uint8Array);function j_(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 b5(t,e,r){return j_(t),t<=0?Fn(t):e!==void 0?typeof r=="string"?Fn(t).fill(e,r):Fn(t).fill(e):Fn(t)}K.alloc=function(t,e,r){return b5(t,e,r)};function Ey(t){return j_(t),Fn(t<0?0:vy(t)|0)}K.allocUnsafe=function(t){return Ey(t)};K.allocUnsafeSlow=function(t){return Ey(t)};function _5(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!K.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=H_(t,e)|0,n=Fn(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function yy(t){for(var e=t.length<0?0:vy(t.length)|0,r=Fn(e),n=0;n=Of)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Of.toString(16)+" bytes");return t|0}function C5(t){return+t!=t&&(t=0),K.alloc(+t)}K.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==K.prototype};K.compare=function(e,r){if($r(e,Uint8Array)&&(e=K.from(e,e.offset,e.byteLength)),$r(r,Uint8Array)&&(r=K.from(r,r.offset,r.byteLength)),!K.isBuffer(e)||!K.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?K.from(o).copy(i,s):Uint8Array.prototype.set.call(i,o,s);else if(K.isBuffer(o))o.copy(i,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return i};function H_(t,e){if(K.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||$r(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 wy(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return K_(t).length;default:if(i)return n?-1:wy(t).length;e=(""+e).toLowerCase(),i=!0}}K.byteLength=H_;function T5(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 M5(this,e,r);case"utf8":case"utf-8":return Q_(this,e,r);case"ascii":return L5(this,e,r);case"latin1":case"binary":return F5(this,e,r);case"base64":return R5(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return U5(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}K.prototype._isBuffer=!0;function ws(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}K.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+=" ... "),""};M_&&(K.prototype[M_]=K.prototype.inspect);K.prototype.compare=function(e,r,n,i,s){if($r(e,Uint8Array)&&(e=K.from(e,e.offset,e.byteLength)),!K.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),r<0||n>e.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&r>=n)return 0;if(i>=s)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,s>>>=0,this===e)return 0;for(var o=s-i,a=n-r,u=Math.min(o,a),l=this.slice(i,s),f=e.slice(r,n),d=0;d2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,Ay(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=K.from(e,n)),K.isBuffer(e))return e.length===0?-1:U_(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):U_(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function U_(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,v){return s===1?m[v]:m.readUInt16BE(v*s)}var l;if(i){var f=-1;for(l=r;lo&&(r=o-a),l=r;l>=0;l--){for(var d=!0,y=0;yi&&(n=i)):n=i;var s=e.length;n>s/2&&(n=s/2);for(var o=0;o>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var s=this.length-r;if((n===void 0||n>s)&&(n=s),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var o=!1;;)switch(i){case"hex":return x5(this,e,r,n);case"utf8":case"utf-8":return N5(this,e,r,n);case"ascii":case"latin1":case"binary":return O5(this,e,r,n);case"base64":return D5(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P5(this,e,r,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};K.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function R5(t,e,r){return e===0&&r===t.length?gy.fromByteArray(t):gy.fromByteArray(t.slice(e,r))}function Q_(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i239?4:s>223?3:s>191?2:1;if(i+a<=r){var u,l,f,d;switch(a){case 1:s<128&&(o=s);break;case 2:u=t[i+1],(u&192)===128&&(d=(s&31)<<6|u&63,d>127&&(o=d));break;case 3:u=t[i+1],l=t[i+2],(u&192)===128&&(l&192)===128&&(d=(s&15)<<12|(u&63)<<6|l&63,d>2047&&(d<55296||d>57343)&&(o=d));break;case 4:u=t[i+1],l=t[i+2],f=t[i+3],(u&192)===128&&(l&192)===128&&(f&192)===128&&(d=(s&15)<<18|(u&63)<<12|(l&63)<<6|f&63,d>65535&&d<1114112&&(o=d))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),i+=a}return B5(n)}var q_=4096;function B5(t){var e=t.length;if(e<=q_)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")}K.prototype.readUintLE=K.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Ct(e,r,this.length);for(var i=this[e],s=1,o=0;++o>>0,r=r>>>0,n||Ct(e,r,this.length);for(var i=this[e+--r],s=1;r>0&&(s*=256);)i+=this[e+--r]*s;return i};K.prototype.readUint8=K.prototype.readUInt8=function(e,r){return e=e>>>0,r||Ct(e,1,this.length),this[e]};K.prototype.readUint16LE=K.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||Ct(e,2,this.length),this[e]|this[e+1]<<8};K.prototype.readUint16BE=K.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||Ct(e,2,this.length),this[e]<<8|this[e+1]};K.prototype.readUint32LE=K.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||Ct(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};K.prototype.readUint32BE=K.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||Ct(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};K.prototype.readIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Ct(e,r,this.length);for(var i=this[e],s=1,o=0;++o=s&&(i-=Math.pow(2,8*r)),i};K.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||Ct(e,r,this.length);for(var i=r,s=1,o=this[e+--i];i>0&&(s*=256);)o+=this[e+--i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*r)),o};K.prototype.readInt8=function(e,r){return e=e>>>0,r||Ct(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};K.prototype.readInt16LE=function(e,r){e=e>>>0,r||Ct(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};K.prototype.readInt16BE=function(e,r){e=e>>>0,r||Ct(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};K.prototype.readInt32LE=function(e,r){return e=e>>>0,r||Ct(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};K.prototype.readInt32BE=function(e,r){return e=e>>>0,r||Ct(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};K.prototype.readFloatLE=function(e,r){return e=e>>>0,r||Ct(e,4,this.length),Vo.read(this,e,!0,23,4)};K.prototype.readFloatBE=function(e,r){return e=e>>>0,r||Ct(e,4,this.length),Vo.read(this,e,!1,23,4)};K.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||Ct(e,8,this.length),Vo.read(this,e,!0,52,8)};K.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||Ct(e,8,this.length),Vo.read(this,e,!1,52,8)};function Zt(t,e,r,n,i,s){if(!K.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}K.prototype.writeUintLE=K.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;Zt(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;Zt(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};K.prototype.writeUint8=K.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||Zt(this,e,r,1,255,0),this[r]=e&255,r+1};K.prototype.writeUint16LE=K.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||Zt(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};K.prototype.writeUint16BE=K.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||Zt(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};K.prototype.writeUint32LE=K.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||Zt(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};K.prototype.writeUint32BE=K.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||Zt(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};K.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){var s=Math.pow(2,8*n-1);Zt(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};K.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){var s=Math.pow(2,8*n-1);Zt(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};K.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||Zt(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};K.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||Zt(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};K.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||Zt(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};K.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||Zt(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};K.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||Zt(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 k_(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 z_(t,e,r,n,i){return e=+e,r=r>>>0,i||k_(t,e,r,4,34028234663852886e22,-34028234663852886e22),Vo.write(t,e,r,n,23,4),r+4}K.prototype.writeFloatLE=function(e,r,n){return z_(this,e,r,!0,n)};K.prototype.writeFloatBE=function(e,r,n){return z_(this,e,r,!1,n)};function W_(t,e,r,n,i){return e=+e,r=r>>>0,i||k_(t,e,r,8,17976931348623157e292,-17976931348623157e292),Vo.write(t,e,r,n,52,8),r+8}K.prototype.writeDoubleLE=function(e,r,n){return W_(this,e,r,!0,n)};K.prototype.writeDoubleBE=function(e,r,n){return W_(this,e,r,!1,n)};K.prototype.copy=function(e,r,n,i){if(!K.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 j5(t){for(var e=[],r=0;r>8,i=r%256,s.push(i),s.push(n);return s}function K_(t){return gy.toByteArray(V5(t))}function Df(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function $r(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function Ay(t){return t!==t}var G5=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 eI=w((Mte,Z_)=>{c();var ft=Z_.exports={},Yr,Jr;function by(){throw new Error("setTimeout has not been defined")}function _y(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?Yr=setTimeout:Yr=by}catch{Yr=by}try{typeof clearTimeout=="function"?Jr=clearTimeout:Jr=_y}catch{Jr=_y}})();function Y_(t){if(Yr===setTimeout)return setTimeout(t,0);if((Yr===by||!Yr)&&setTimeout)return Yr=setTimeout,setTimeout(t,0);try{return Yr(t,0)}catch{try{return Yr.call(null,t,0)}catch{return Yr.call(this,t,0)}}}function Q5(t){if(Jr===clearTimeout)return clearTimeout(t);if((Jr===_y||!Jr)&&clearTimeout)return Jr=clearTimeout,clearTimeout(t);try{return Jr(t)}catch{try{return Jr.call(null,t)}catch{return Jr.call(this,t)}}}var Mn=[],Ho=!1,Es,Pf=-1;function k5(){!Ho||!Es||(Ho=!1,Es.length?Mn=Es.concat(Mn):Pf=-1,Mn.length&&J_())}function J_(){if(!Ho){var t=Y_(k5);Ho=!0;for(var e=Mn.length;e;){for(Es=Mn,Mn=[];++Pf1)for(var r=1;r{h=_e($_()),p=_e(eI()),z5=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=z5});var Yt=w((tI,Rf)=>{c();(function(t){"use strict";var e,r=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,n=Math.ceil,i=Math.floor,s="[BigNumber Error] ",o=s+"Number primitive has more than 15 significant digits: ",a=1e14,u=14,l=9007199254740991,f=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],d=1e7,y=1e9;function m(P){var L,_,C,M=q.prototype={constructor:q,toString:null,valueOf:null},Z=new q(1),z=20,H=4,G=-7,$=21,de=-1e7,ae=1e7,re=!1,Y=1,ie=0,te={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},ne="0123456789abcdefghijklmnopqrstuvwxyz";function q(g,E){var b,O,I,N,F,S,U,j,V=this;if(!(V instanceof q))return new q(g,E);if(E==null){if(g&&g._isBigNumber===!0){V.s=g.s,!g.c||g.e>ae?V.c=V.e=null:g.e=10;F/=10,N++);N>ae?V.c=V.e=null:(V.e=N,V.c=[g]);return}j=String(g)}else{if(!r.test(j=String(g)))return C(V,j,S);V.s=j.charCodeAt(0)==45?(j=j.slice(1),-1):1}(N=j.indexOf("."))>-1&&(j=j.replace(".","")),(F=j.search(/e/i))>0?(N<0&&(N=F),N+=+j.slice(F+1),j=j.substring(0,F)):N<0&&(N=j.length)}else{if(A(E,2,ne.length,"Base"),E==10)return V=new q(g),se(V,z+V.e+1,H);if(j=String(g),S=typeof g=="number"){if(g*0!=0)return C(V,j,S,E);if(V.s=1/g<0?(j=j.slice(1),-1):1,q.DEBUG&&j.replace(/^0\.0*|\./,"").length>15)throw Error(o+g)}else V.s=j.charCodeAt(0)===45?(j=j.slice(1),-1):1;for(b=ne.slice(0,E),N=F=0,U=j.length;FN){N=U;continue}}else if(!I&&(j==j.toUpperCase()&&(j=j.toLowerCase())||j==j.toLowerCase()&&(j=j.toUpperCase()))){I=!0,F=-1,N=0;continue}return C(V,String(g),S,E)}S=!1,j=_(j,E,10,V.s),(N=j.indexOf("."))>-1?j=j.replace(".",""):N=j.length}for(F=0;j.charCodeAt(F)===48;F++);for(U=j.length;j.charCodeAt(--U)===48;);if(j=j.slice(F,++U)){if(U-=F,S&&q.DEBUG&&U>15&&(g>l||g!==i(g)))throw Error(o+V.s*g);if((N=N-F-1)>ae)V.c=V.e=null;else if(N=-y&&I<=y&&I===i(I)){if(O[0]===0){if(I===0&&O.length===1)return!0;break e}if(E=(I+1)%u,E<1&&(E+=u),String(O[0]).length==E){for(E=0;E=a||b!==i(b))break e;if(b!==0)return!0}}}else if(O===null&&I===null&&(N===null||N===1||N===-1))return!0;throw Error(s+"Invalid BigNumber: "+g)},q.maximum=q.max=function(){return oe(arguments,M.lt)},q.minimum=q.min=function(){return oe(arguments,M.gt)},q.random=function(){var g=9007199254740992,E=Math.random()*g&2097151?function(){return i(Math.random()*g)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(b){var O,I,N,F,S,U=0,j=[],V=new q(Z);if(b==null?b=z:A(b,0,y),F=n(b/u),re)if(crypto.getRandomValues){for(O=crypto.getRandomValues(new Uint32Array(F*=2));U>>11),S>=9e15?(I=crypto.getRandomValues(new Uint32Array(2)),O[U]=I[0],O[U+1]=I[1]):(j.push(S%1e14),U+=2);U=F/2}else if(crypto.randomBytes){for(O=crypto.randomBytes(F*=7);U=9e15?crypto.randomBytes(7).copy(O,U):(j.push(S%1e14),U+=7);U=F/7}else throw re=!1,Error(s+"crypto unavailable");if(!re)for(;U=10;S/=10,U++);UI-1&&(S[F+1]==null&&(S[F+1]=0),S[F+1]+=S[F]/I|0,S[F]%=I)}return S.reverse()}return function(b,O,I,N,F){var S,U,j,V,X,ye,we,Pe,$e=b.indexOf("."),ot=z,Oe=H;for($e>=0&&(V=ie,ie=0,b=b.replace(".",""),Pe=new q(O),ye=Pe.pow(b.length-$e),ie=V,Pe.c=E(R(T(ye.c),ye.e,"0"),10,I,g),Pe.e=Pe.c.length),we=E(b,O,I,F?(S=ne,g):(S=g,ne)),j=V=we.length;we[--V]==0;we.pop());if(!we[0])return S.charAt(0);if($e<0?--j:(ye.c=we,ye.e=j,ye.s=N,ye=L(ye,Pe,ot,Oe,I),we=ye.c,X=ye.r,j=ye.e),U=j+ot+1,$e=we[U],V=I/2,X=X||U<0||we[U+1]!=null,X=Oe<4?($e!=null||X)&&(Oe==0||Oe==(ye.s<0?3:2)):$e>V||$e==V&&(Oe==4||X||Oe==6&&we[U-1]&1||Oe==(ye.s<0?8:7)),U<1||!we[0])b=X?R(S.charAt(1),-ot,S.charAt(0)):S.charAt(0);else{if(we.length=U,X)for(--I;++we[--U]>I;)we[U]=0,U||(++j,we=[1].concat(we));for(V=we.length;!we[--V];);for($e=0,b="";$e<=V;b+=S.charAt(we[$e++]));b=R(b,j,S.charAt(0))}return b}}(),L=function(){function g(O,I,N){var F,S,U,j,V=0,X=O.length,ye=I%d,we=I/d|0;for(O=O.slice();X--;)U=O[X]%d,j=O[X]/d|0,F=we*U+j*ye,S=ye*U+F%d*d+V,V=(S/N|0)+(F/d|0)+we*j,O[X]=S%N;return V&&(O=[V].concat(O)),O}function E(O,I,N,F){var S,U;if(N!=F)U=N>F?1:-1;else for(S=U=0;SI[S]?1:-1;break}return U}function b(O,I,N,F){for(var S=0;N--;)O[N]-=S,S=O[N]1;O.splice(0,1));}return function(O,I,N,F,S){var U,j,V,X,ye,we,Pe,$e,ot,Oe,Me,vt,ci,gs,ys,Xt,Ln,jt=O.s==I.s?1:-1,At=O.c,Qe=I.c;if(!At||!At[0]||!Qe||!Qe[0])return new q(!O.s||!I.s||(At?Qe&&At[0]==Qe[0]:!Qe)?NaN:At&&At[0]==0||!Qe?jt*0:jt/0);for($e=new q(jt),ot=$e.c=[],j=O.e-I.e,jt=N+j+1,S||(S=a,j=v(O.e/u)-v(I.e/u),jt=jt/u|0),V=0;Qe[V]==(At[V]||0);V++);if(Qe[V]>(At[V]||0)&&j--,jt<0)ot.push(1),X=!0;else{for(gs=At.length,Xt=Qe.length,V=0,jt+=2,ye=i(S/(Qe[0]+1)),ye>1&&(Qe=g(Qe,ye,S),At=g(At,ye,S),Xt=Qe.length,gs=At.length),ci=Xt,Oe=At.slice(0,Xt),Me=Oe.length;Me=S/2&&ys++;do{if(ye=0,U=E(Qe,Oe,Xt,Me),U<0){if(vt=Oe[0],Xt!=Me&&(vt=vt*S+(Oe[1]||0)),ye=i(vt/ys),ye>1)for(ye>=S&&(ye=S-1),we=g(Qe,ye,S),Pe=we.length,Me=Oe.length;E(we,Oe,Pe,Me)==1;)ye--,b(we,Xt=10;jt/=10,V++);se($e,N+($e.e=V+j*u-1)+1,F,X)}else $e.e=j,$e.r=+X;return $e}}();function ce(g,E,b,O){var I,N,F,S,U;if(b==null?b=H:A(b,0,8),!g.c)return g.toString();if(I=g.c[0],F=g.e,E==null)U=T(g.c),U=O==1||O==2&&(F<=G||F>=$)?x(U,F):R(U,F,"0");else if(g=se(new q(g),E,b),N=g.e,U=T(g.c),S=U.length,O==1||O==2&&(E<=N||N<=G)){for(;SS){if(--E>0)for(U+=".";E--;U+="0");}else if(E+=N-S,E>0)for(N+1==S&&(U+=".");E--;U+="0");return g.s<0&&I?"-"+U:U}function oe(g,E){for(var b,O=1,I=new q(g[0]);O=10;I/=10,O++);return(b=O+b*u-1)>ae?g.c=g.e=null:b=10;S/=10,I++);if(N=E-I,N<0)N+=u,F=E,U=X[j=0],V=U/ye[I-F-1]%10|0;else if(j=n((N+1)/u),j>=X.length)if(O){for(;X.length<=j;X.push(0));U=V=0,I=1,N%=u,F=N-u+1}else break e;else{for(U=S=X[j],I=1;S>=10;S/=10,I++);N%=u,F=N-u+I,V=F<0?0:U/ye[I-F-1]%10|0}if(O=O||E<0||X[j+1]!=null||(F<0?U:U%ye[I-F-1]),O=b<4?(V||O)&&(b==0||b==(g.s<0?3:2)):V>5||V==5&&(b==4||O||b==6&&(N>0?F>0?U/ye[I-F]:0:X[j-1])%10&1||b==(g.s<0?8:7)),E<1||!X[0])return X.length=0,O?(E-=g.e+1,X[0]=ye[(u-E%u)%u],g.e=-E||0):X[0]=g.e=0,g;if(N==0?(X.length=j,S=1,j--):(X.length=j+1,S=ye[u-N],X[j]=F>0?i(U/ye[I-F]%ye[F])*S:0),O)for(;;)if(j==0){for(N=1,F=X[0];F>=10;F/=10,N++);for(F=X[0]+=S,S=1;F>=10;F/=10,S++);N!=S&&(g.e++,X[0]==a&&(X[0]=1));break}else{if(X[j]+=S,X[j]!=a)break;X[j--]=0,S=1}for(N=X.length;X[--N]===0;X.pop());}g.e>ae?g.c=g.e=null:g.e=$?x(E,b):R(E,b,"0"),g.s<0?"-"+E:E)}return M.absoluteValue=M.abs=function(){var g=new q(this);return g.s<0&&(g.s=1),g},M.comparedTo=function(g,E){return B(this,new q(g,E))},M.decimalPlaces=M.dp=function(g,E){var b,O,I,N=this;if(g!=null)return A(g,0,y),E==null?E=H:A(E,0,8),se(new q(N),g+N.e+1,E);if(!(b=N.c))return null;if(O=((I=b.length-1)-v(this.e/u))*u,I=b[I])for(;I%10==0;I/=10,O--);return O<0&&(O=0),O},M.dividedBy=M.div=function(g,E){return L(this,new q(g,E),z,H)},M.dividedToIntegerBy=M.idiv=function(g,E){return L(this,new q(g,E),0,1)},M.exponentiatedBy=M.pow=function(g,E){var b,O,I,N,F,S,U,j,V,X=this;if(g=new q(g),g.c&&!g.isInteger())throw Error(s+"Exponent not an integer: "+ue(g));if(E!=null&&(E=new q(E)),S=g.e>14,!X.c||!X.c[0]||X.c[0]==1&&!X.e&&X.c.length==1||!g.c||!g.c[0])return V=new q(Math.pow(+ue(X),S?2-D(g):+ue(g))),E?V.mod(E):V;if(U=g.s<0,E){if(E.c?!E.c[0]:!E.s)return new q(NaN);O=!U&&X.isInteger()&&E.isInteger(),O&&(X=X.mod(E))}else{if(g.e>9&&(X.e>0||X.e<-1||(X.e==0?X.c[0]>1||S&&X.c[1]>=24e7:X.c[0]<8e13||S&&X.c[0]<=9999975e7)))return N=X.s<0&&D(g)?-0:0,X.e>-1&&(N=1/N),new q(U?1/N:N);ie&&(N=n(ie/u+2))}for(S?(b=new q(.5),U&&(g.s=1),j=D(g)):(I=Math.abs(+ue(g)),j=I%2),V=new q(Z);;){if(j){if(V=V.times(X),!V.c)break;N?V.c.length>N&&(V.c.length=N):O&&(V=V.mod(E))}if(I){if(I=i(I/2),I===0)break;j=I%2}else if(g=g.times(b),se(g,g.e+1,1),g.e>14)j=D(g);else{if(I=+ue(g),I===0)break;j=I%2}X=X.times(X),N?X.c&&X.c.length>N&&(X.c.length=N):O&&(X=X.mod(E))}return O?V:(U&&(V=Z.div(V)),E?V.mod(E):N?se(V,ie,H,F):V)},M.integerValue=function(g){var E=new q(this);return g==null?g=H:A(g,0,8),se(E,E.e+1,g)},M.isEqualTo=M.eq=function(g,E){return B(this,new q(g,E))===0},M.isFinite=function(){return!!this.c},M.isGreaterThan=M.gt=function(g,E){return B(this,new q(g,E))>0},M.isGreaterThanOrEqualTo=M.gte=function(g,E){return(E=B(this,new q(g,E)))===1||E===0},M.isInteger=function(){return!!this.c&&v(this.e/u)>this.c.length-2},M.isLessThan=M.lt=function(g,E){return B(this,new q(g,E))<0},M.isLessThanOrEqualTo=M.lte=function(g,E){return(E=B(this,new q(g,E)))===-1||E===0},M.isNaN=function(){return!this.s},M.isNegative=function(){return this.s<0},M.isPositive=function(){return this.s>0},M.isZero=function(){return!!this.c&&this.c[0]==0},M.minus=function(g,E){var b,O,I,N,F=this,S=F.s;if(g=new q(g,E),E=g.s,!S||!E)return new q(NaN);if(S!=E)return g.s=-E,F.plus(g);var U=F.e/u,j=g.e/u,V=F.c,X=g.c;if(!U||!j){if(!V||!X)return V?(g.s=-E,g):new q(X?F:NaN);if(!V[0]||!X[0])return X[0]?(g.s=-E,g):new q(V[0]?F:H==3?-0:0)}if(U=v(U),j=v(j),V=V.slice(),S=U-j){for((N=S<0)?(S=-S,I=V):(j=U,I=X),I.reverse(),E=S;E--;I.push(0));I.reverse()}else for(O=(N=(S=V.length)<(E=X.length))?S:E,S=E=0;E0)for(;E--;V[b++]=0);for(E=a-1;O>S;){if(V[--O]=0;){for(b=0,ye=vt[I]%ot,we=vt[I]/ot|0,F=U,N=I+F;N>I;)j=Me[--F]%ot,V=Me[F]/ot|0,S=we*j+V*ye,j=ye*j+S%ot*ot+Pe[N]+b,b=(j/$e|0)+(S/ot|0)+we*V,Pe[N--]=j%$e;Pe[N]=b}return b?++O:Pe.splice(0,1),le(g,Pe,O)},M.negated=function(){var g=new q(this);return g.s=-g.s||null,g},M.plus=function(g,E){var b,O=this,I=O.s;if(g=new q(g,E),E=g.s,!I||!E)return new q(NaN);if(I!=E)return g.s=-E,O.minus(g);var N=O.e/u,F=g.e/u,S=O.c,U=g.c;if(!N||!F){if(!S||!U)return new q(I/0);if(!S[0]||!U[0])return U[0]?g:new q(S[0]?O:I*0)}if(N=v(N),F=v(F),S=S.slice(),I=N-F){for(I>0?(F=N,b=U):(I=-I,b=S),b.reverse();I--;b.push(0));b.reverse()}for(I=S.length,E=U.length,I-E<0&&(b=U,U=S,S=b,E=I),I=0;E;)I=(S[--E]=S[E]+U[E]+I)/a|0,S[E]=a===S[E]?0:S[E]%a;return I&&(S=[I].concat(S),++F),le(g,S,F)},M.precision=M.sd=function(g,E){var b,O,I,N=this;if(g!=null&&g!==!!g)return A(g,1,y),E==null?E=H:A(E,0,8),se(new q(N),g,E);if(!(b=N.c))return null;if(I=b.length-1,O=I*u+1,I=b[I]){for(;I%10==0;I/=10,O--);for(I=b[0];I>=10;I/=10,O++);}return g&&N.e+1>O&&(O=N.e+1),O},M.shiftedBy=function(g){return A(g,-l,l),this.times("1e"+g)},M.squareRoot=M.sqrt=function(){var g,E,b,O,I,N=this,F=N.c,S=N.s,U=N.e,j=z+4,V=new q("0.5");if(S!==1||!F||!F[0])return new q(!S||S<0&&(!F||F[0])?NaN:F?N:1/0);if(S=Math.sqrt(+ue(N)),S==0||S==1/0?(E=T(F),(E.length+U)%2==0&&(E+="0"),S=Math.sqrt(+E),U=v((U+1)/2)-(U<0||U%2),S==1/0?E="5e"+U:(E=S.toExponential(),E=E.slice(0,E.indexOf("e")+1)+U),b=new q(E)):b=new q(S+""),b.c[0]){for(U=b.e,S=U+j,S<3&&(S=0);;)if(I=b,b=V.times(I.plus(L(N,I,j,1))),T(I.c).slice(0,S)===(E=T(b.c)).slice(0,S))if(b.e0&&Pe>0){for(N=Pe%S||S,V=we.substr(0,N);N0&&(V+=j+we.slice(N)),ye&&(V="-"+V)}O=X?V+(b.decimalSeparator||"")+((U=+b.fractionGroupSize)?X.replace(new RegExp("\\d{"+U+"}\\B","g"),"$&"+(b.fractionGroupSeparator||"")):X):V}return(b.prefix||"")+O+(b.suffix||"")},M.toFraction=function(g){var E,b,O,I,N,F,S,U,j,V,X,ye,we=this,Pe=we.c;if(g!=null&&(S=new q(g),!S.isInteger()&&(S.c||S.s!==1)||S.lt(Z)))throw Error(s+"Argument "+(S.isInteger()?"out of range: ":"not an integer: ")+ue(S));if(!Pe)return new q(we);for(E=new q(Z),j=b=new q(Z),O=U=new q(Z),ye=T(Pe),N=E.e=ye.length-we.e-1,E.c[0]=f[(F=N%u)<0?u+F:F],g=!g||S.comparedTo(E)>0?N>0?E:j:S,F=ae,ae=1/0,S=new q(ye),U.c[0]=0;V=L(S,E,0,1),I=b.plus(V.times(O)),I.comparedTo(g)!=1;)b=O,O=I,j=U.plus(V.times(I=j)),U=I,E=S.minus(V.times(I=E)),S=I;return I=L(g.minus(b),O,0,1),U=U.plus(I.times(j)),b=b.plus(I.times(O)),U.s=j.s=we.s,N=N*2,X=L(j,O,N,H).minus(we).abs().comparedTo(L(U,b,N,H).minus(we).abs())<1?[j,O]:[U,b],ae=F,X},M.toNumber=function(){return+ue(this)},M.toPrecision=function(g,E){return g!=null&&A(g,1,y),ce(this,g,E,2)},M.toString=function(g){var E,b=this,O=b.s,I=b.e;return I===null?O?(E="Infinity",O<0&&(E="-"+E)):E="NaN":(g==null?E=I<=G||I>=$?x(T(b.c),I):R(T(b.c),I,"0"):g===10?(b=se(new q(b),z+I+1,H),E=R(T(b.c),b.e,"0")):(A(g,2,ne.length,"Base"),E=_(R(T(b.c),I,"0"),10,g,O,!0)),O<0&&b.c[0]&&(E="-"+E)),E},M.valueOf=M.toJSON=function(){return ue(this)},M._isBigNumber=!0,P!=null&&q.set(P),q}function v(P){var L=P|0;return P>0||P===L?L:L-1}function T(P){for(var L,_,C=1,M=P.length,Z=P[0]+"";C$^_?1:-1;for(H=(G=M.length)<($=Z.length)?G:$,z=0;zZ[z]^_?1:-1;return G==$?0:G>$^_?1:-1}function A(P,L,_,C){if(P_||P!==i(P))throw Error(s+(C||"Argument")+(typeof P=="number"?P_?" out of range: ":" not an integer: ":" not a primitive number: ")+String(P))}function D(P){var L=P.c.length-1;return v(P.e/u)==L&&P.c[L]%2!=0}function x(P,L){return(P.length>1?P.charAt(0)+"."+P.slice(1):P)+(L<0?"e":"e+")+L}function R(P,L,_){var C,M;if(L<0){for(M=_+".";++L;M+=_);P=M+P}else if(C=P.length,++L>C){for(M=_,L-=C;--L;M+=_);P+=M}else L{"use strict";c();Object.defineProperty(pe,"__esModule",{value:!0});pe.ErrGasLimitShouldBe0ForInnerTransaction=pe.ErrInvalidRelayedV2BuilderArguments=pe.ErrInvalidRelayedV1BuilderArguments=pe.ErrNotImplemented=pe.ErrContractInteraction=pe.ErrCodec=pe.ErrCannotParseTransactionOutcome=pe.ErrCannotParseContractResults=pe.ErrMissingFieldOnEnum=pe.ErrMissingFieldOnStruct=pe.ErrTypingSystem=pe.ErrMock=pe.ErrContractHasNoAddress=pe.ErrContract=pe.ErrExpectedTransactionEventsNotFound=pe.ErrExpectedTransactionStatusNotReached=pe.ErrTransactionWatcherTimeout=pe.ErrAsyncTimerAborted=pe.ErrAsyncTimerAlreadyRunning=pe.ErrInvalidFunctionName=pe.ErrSignatureCannotCreate=pe.ErrTransactionOptionsInvalid=pe.ErrTransactionVersionInvalid=pe.ErrNonceInvalid=pe.ErrNotEnoughGas=pe.ErrAddressEmpty=pe.ErrAddressBadHrp=pe.ErrAddressCannotCreate=pe.ErrUnexpectedCondition=pe.ErrInvariantFailed=pe.ErrBadType=pe.ErrUnsupportedOperation=pe.ErrInvalidArgument=pe.Err=void 0;var Re=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=Re;var Iy=class extends Re{constructor(e,r){super(`Invalid argument: ${e}`,r)}};pe.ErrInvalidArgument=Iy;var Sy=class extends Re{constructor(e,r="not specified"){super(`Operation "${e}" not supported. Reason: ${r}`)}};pe.ErrUnsupportedOperation=Sy;var Cy=class extends Re{constructor(e,r,n){super(`Bad type of "${e}": ${n}. Expected type: ${r}`)}};pe.ErrBadType=Cy;var Ty=class extends Re{constructor(e){super(`Invariant failed: [${e}]`)}};pe.ErrInvariantFailed=Ty;var xy=class extends Re{constructor(e){super(`Unexpected condition: [${e}]`)}};pe.ErrUnexpectedCondition=xy;var Ny=class extends Re{constructor(e,r){let n=`Cannot create address from: ${e}`;super(n,r)}};pe.ErrAddressCannotCreate=Ny;var Oy=class extends Re{constructor(e,r){super(`Wrong address HRP. Expected: ${e}, got ${r}`)}};pe.ErrAddressBadHrp=Oy;var Dy=class extends Re{constructor(){super("Address is empty")}};pe.ErrAddressEmpty=Dy;var Py=class extends Re{constructor(e){super(`Not enough gas provided: ${e}`)}};pe.ErrNotEnoughGas=Py;var Ry=class extends Re{constructor(e){super(`Invalid nonce: ${e}`)}};pe.ErrNonceInvalid=Ry;var By=class extends Re{constructor(e){super(`Invalid transaction version: ${e}`)}};pe.ErrTransactionVersionInvalid=By;var Ly=class extends Re{constructor(e){super(`Invalid transaction options: ${e}`)}};pe.ErrTransactionOptionsInvalid=Ly;var Fy=class extends Re{constructor(e,r){let n=`Cannot create signature from: ${e}`;super(n,r)}};pe.ErrSignatureCannotCreate=Fy;var My=class extends Re{constructor(){super("Invalid function name")}};pe.ErrInvalidFunctionName=My;var Uy=class extends Re{constructor(){super("Async timer already running")}};pe.ErrAsyncTimerAlreadyRunning=Uy;var qy=class extends Re{constructor(){super("Async timer aborted")}};pe.ErrAsyncTimerAborted=qy;var Vy=class extends Re{constructor(){super("TransactionWatcher has timed out")}};pe.ErrTransactionWatcherTimeout=Vy;var jy=class extends Re{constructor(){super("Expected transaction status not reached")}};pe.ErrExpectedTransactionStatusNotReached=jy;var Hy=class extends Re{constructor(){super("Expected transaction events not found")}};pe.ErrExpectedTransactionEventsNotFound=Hy;var Bf=class extends Re{constructor(e){super(e)}};pe.ErrContract=Bf;var Gy=class extends Bf{constructor(){super(` +var bU=Object.create;var ql=Object.defineProperty;var _U=Object.getOwnPropertyDescriptor;var IU=Object.getOwnPropertyNames;var SU=Object.getPrototypeOf,CU=Object.prototype.hasOwnProperty;var xI=(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 ge=(t,e)=>()=>(t&&(e=t(t=0)),e);var m=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),ft=(t,e)=>{for(var r in e)ql(t,r,{get:e[r],enumerable:!0})},Ul=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of IU(e))!CU.call(t,i)&&i!==r&&ql(t,i,{get:()=>e[i],enumerable:!(n=_U(e,i))||n.enumerable});return t},Ht=(t,e,r)=>(Ul(t,e,"default"),r&&Ul(r,e,"default")),Ie=(t,e,r)=>(r=t!=null?bU(SU(t)):{},Ul(e||!t||!t.__esModule?ql(r,"default",{value:t,enumerable:!0}):r,t)),ut=t=>Ul(ql({},"__esModule",{value:!0}),t);var p0=m(Vl=>{"use strict";c();Vl.byteLength=xU;Vl.toByteArray=OU;Vl.fromByteArray=RU;var Yr=[],br=[],TU=typeof Uint8Array<"u"?Uint8Array:Array,d0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(fs=0,NI=d0.length;fs0)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 xU(t){var e=OI(t),r=e[0],n=e[1];return(r+n)*3/4-n}function NU(t,e,r){return(e+r)*3/4-r}function OU(t){var e,r=OI(t),n=r[0],i=r[1],s=new TU(NU(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=br[t.charCodeAt(u)]<<2|br[t.charCodeAt(u+1)]>>4,s[o++]=e&255),i===1&&(e=br[t.charCodeAt(u)]<<10|br[t.charCodeAt(u+1)]<<4|br[t.charCodeAt(u+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function DU(t){return Yr[t>>18&63]+Yr[t>>12&63]+Yr[t>>6&63]+Yr[t&63]}function PU(t,e,r){for(var n,i=[],s=e;sa?a:o+s));return n===1?(e=t[r-1],i.push(Yr[e>>2]+Yr[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(Yr[e>>10]+Yr[e>>4&63]+Yr[e<<2&63]+"=")),i.join("")}});var y0=m(g0=>{c();g0.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,E=t[e+d];for(d+=g,s=E&(1<<-f)-1,E>>=-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-l;else{if(s===u)return o?NaN:(E?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-l}return(E?-1:1)*o*Math.pow(2,s-n)};g0.write=function(t,e,r,n,i,s){var o,a,u,l=s*8-i-1,f=(1<>1,g=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,E=n?0:s-1,v=n?1:-1,N=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=f):(o=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-o))<1&&(o--,u*=2),o+d>=1?e+=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+E]=a&255,E+=v,a/=256,i-=8);for(o=o<0;t[r+E]=o&255,E+=v,o/=256,l-=8);t[r+E-v]|=N*128}});var GI=m(ho=>{"use strict";c();var m0=p0(),fo=y0(),DI=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;ho.Buffer=$;ho.SlowBuffer=qU;ho.INSPECT_MAX_BYTES=50;var Hl=2147483647;ho.kMaxLength=Hl;$.TYPED_ARRAY_SUPPORT=BU();!$.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 BU(){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 Ln(t){if(t>Hl)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 A0(t)}return BI(t,e,r)}$.poolSize=8192;function BI(t,e,r){if(typeof t=="string")return FU(t,e);if(ArrayBuffer.isView(t))return MU(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(Jr(t,ArrayBuffer)||t&&Jr(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Jr(t,SharedArrayBuffer)||t&&Jr(t.buffer,SharedArrayBuffer)))return w0(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=UU(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 BI(t,e,r)};Object.setPrototypeOf($.prototype,Uint8Array.prototype);Object.setPrototypeOf($,Uint8Array);function LI(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 LU(t,e,r){return LI(t),t<=0?Ln(t):e!==void 0?typeof r=="string"?Ln(t).fill(e,r):Ln(t).fill(e):Ln(t)}$.alloc=function(t,e,r){return LU(t,e,r)};function A0(t){return LI(t),Ln(t<0?0:b0(t)|0)}$.allocUnsafe=function(t){return A0(t)};$.allocUnsafeSlow=function(t){return A0(t)};function FU(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!$.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=FI(t,e)|0,n=Ln(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function E0(t){for(var e=t.length<0?0:b0(t.length)|0,r=Ln(e),n=0;n=Hl)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Hl.toString(16)+" bytes");return t|0}function qU(t){return+t!=t&&(t=0),$.alloc(+t)}$.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==$.prototype};$.compare=function(e,r){if(Jr(e,Uint8Array)&&(e=$.from(e,e.offset,e.byteLength)),Jr(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 FI(t,e){if($.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Jr(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 v0(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return jI(t).length;default:if(i)return n?-1:v0(t).length;e=(""+e).toLowerCase(),i=!0}}$.byteLength=FI;function VU(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 YU(this,e,r);case"utf8":case"utf-8":return UI(this,e,r);case"ascii":return $U(this,e,r);case"latin1":case"binary":return KU(this,e,r);case"base64":return WU(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return JU(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}$.prototype._isBuffer=!0;function hs(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+=" ... "),""};DI&&($.prototype[DI]=$.prototype.inspect);$.prototype.compare=function(e,r,n,i,s){if(Jr(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),l=this.slice(i,s),f=e.slice(r,n),d=0;d2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,_0(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:PI(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):PI(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function PI(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(E,v){return s===1?E[v]:E.readUInt16BE(v*s)}var l;if(i){var f=-1;for(l=r;lo&&(r=o-a),l=r;l>=0;l--){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 HU(this,e,r,n);case"utf8":case"utf-8":return jU(this,e,r,n);case"ascii":case"latin1":case"binary":return GU(this,e,r,n);case"base64":return kU(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return QU(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 WU(t,e,r){return e===0&&r===t.length?m0.fromByteArray(t):m0.fromByteArray(t.slice(e,r))}function UI(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i239?4:s>223?3:s>191?2:1;if(i+a<=r){var u,l,f,d;switch(a){case 1:s<128&&(o=s);break;case 2:u=t[i+1],(u&192)===128&&(d=(s&31)<<6|u&63,d>127&&(o=d));break;case 3:u=t[i+1],l=t[i+2],(u&192)===128&&(l&192)===128&&(d=(s&15)<<12|(u&63)<<6|l&63,d>2047&&(d<55296||d>57343)&&(o=d));break;case 4:u=t[i+1],l=t[i+2],f=t[i+3],(u&192)===128&&(l&192)===128&&(f&192)===128&&(d=(s&15)<<18|(u&63)<<12|(l&63)<<6|f&63,d>65535&&d<1114112&&(o=d))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),i+=a}return zU(n)}var RI=4096;function zU(t){var e=t.length;if(e<=RI)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||Rt(e,r,this.length);for(var i=this[e],s=1,o=0;++o>>0,r=r>>>0,n||Rt(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||Rt(e,1,this.length),this[e]};$.prototype.readUint16LE=$.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||Rt(e,2,this.length),this[e]|this[e+1]<<8};$.prototype.readUint16BE=$.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||Rt(e,2,this.length),this[e]<<8|this[e+1]};$.prototype.readUint32LE=$.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||Rt(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||Rt(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||Rt(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||Rt(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||Rt(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};$.prototype.readInt16LE=function(e,r){e=e>>>0,r||Rt(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||Rt(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||Rt(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||Rt(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||Rt(e,4,this.length),fo.read(this,e,!0,23,4)};$.prototype.readFloatBE=function(e,r){return e=e>>>0,r||Rt(e,4,this.length),fo.read(this,e,!1,23,4)};$.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||Rt(e,8,this.length),fo.read(this,e,!0,52,8)};$.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||Rt(e,8,this.length),fo.read(this,e,!1,52,8)};function ir(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;ir(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;ir(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||ir(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||ir(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||ir(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||ir(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||ir(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);ir(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);ir(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||ir(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||ir(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||ir(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||ir(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||ir(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 qI(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 VI(t,e,r,n,i){return e=+e,r=r>>>0,i||qI(t,e,r,4,34028234663852886e22,-34028234663852886e22),fo.write(t,e,r,n,23,4),r+4}$.prototype.writeFloatLE=function(e,r,n){return VI(this,e,r,!0,n)};$.prototype.writeFloatBE=function(e,r,n){return VI(this,e,r,!1,n)};function HI(t,e,r,n,i){return e=+e,r=r>>>0,i||qI(t,e,r,8,17976931348623157e292,-17976931348623157e292),fo.write(t,e,r,n,52,8),r+8}$.prototype.writeDoubleLE=function(e,r,n){return HI(this,e,r,!0,n)};$.prototype.writeDoubleBE=function(e,r,n){return HI(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 e5(t){for(var e=[],r=0;r>8,i=r%256,s.push(i),s.push(n);return s}function jI(t){return m0.toByteArray(ZU(t))}function jl(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function Jr(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function _0(t){return t!==t}var r5=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 $I=m((Ine,zI)=>{c();var gt=zI.exports={},Xr,Zr;function I0(){throw new Error("setTimeout has not been defined")}function S0(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?Xr=setTimeout:Xr=I0}catch{Xr=I0}try{typeof clearTimeout=="function"?Zr=clearTimeout:Zr=S0}catch{Zr=S0}})();function kI(t){if(Xr===setTimeout)return setTimeout(t,0);if((Xr===I0||!Xr)&&setTimeout)return Xr=setTimeout,setTimeout(t,0);try{return Xr(t,0)}catch{try{return Xr.call(null,t,0)}catch{return Xr.call(this,t,0)}}}function n5(t){if(Zr===clearTimeout)return clearTimeout(t);if((Zr===S0||!Zr)&&clearTimeout)return Zr=clearTimeout,clearTimeout(t);try{return Zr(t)}catch{try{return Zr.call(null,t)}catch{return Zr.call(this,t)}}}var Fn=[],po=!1,ds,Gl=-1;function i5(){!po||!ds||(po=!1,ds.length?Fn=ds.concat(Fn):Gl=-1,Fn.length&&QI())}function QI(){if(!po){var t=kI(i5);po=!0;for(var e=Fn.length;e;){for(ds=Fn,Fn=[];++Gl1)for(var r=1;r{h=Ie(GI()),p=Ie($I()),s5=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=s5});var jt=m((KI,kl)=>{c();(function(t){"use strict";var e,r=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,n=Math.ceil,i=Math.floor,s="[BigNumber Error] ",o=s+"Number primitive has more than 15 significant digits: ",a=1e14,u=14,l=9007199254740991,f=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],d=1e7,g=1e9;function E(R){var B,b,C,L=q.prototype={constructor:q,toString:null,valueOf:null},X=new q(1),W=20,j=4,G=-7,K=21,de=-1e7,ue=1e7,re=!1,Y=1,se=0,te={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},ie="0123456789abcdefghijklmnopqrstuvwxyz";function q(y,w){var A,P,T,D,M,x,U,H,V=this;if(!(V instanceof q))return new q(y,w);if(w==null){if(y&&y._isBigNumber===!0){V.s=y.s,!y.c||y.e>ue?V.c=V.e=null:y.e=10;M/=10,D++);D>ue?V.c=V.e=null:(V.e=D,V.c=[y]);return}H=String(y)}else{if(!r.test(H=String(y)))return C(V,H,x);V.s=H.charCodeAt(0)==45?(H=H.slice(1),-1):1}(D=H.indexOf("."))>-1&&(H=H.replace(".","")),(M=H.search(/e/i))>0?(D<0&&(D=M),D+=+H.slice(M+1),H=H.substring(0,M)):D<0&&(D=H.length)}else{if(F(w,2,ie.length,"Base"),w==10)return V=new q(y),oe(V,W+V.e+1,j);if(H=String(y),x=typeof y=="number"){if(y*0!=0)return C(V,H,x,w);if(V.s=1/y<0?(H=H.slice(1),-1):1,q.DEBUG&&H.replace(/^0\.0*|\./,"").length>15)throw Error(o+y)}else V.s=H.charCodeAt(0)===45?(H=H.slice(1),-1):1;for(A=ie.slice(0,w),D=M=0,U=H.length;MD){D=U;continue}}else if(!T&&(H==H.toUpperCase()&&(H=H.toLowerCase())||H==H.toLowerCase()&&(H=H.toUpperCase()))){T=!0,M=-1,D=0;continue}return C(V,String(y),x,w)}x=!1,H=b(H,w,10,V.s),(D=H.indexOf("."))>-1?H=H.replace(".",""):D=H.length}for(M=0;H.charCodeAt(M)===48;M++);for(U=H.length;H.charCodeAt(--U)===48;);if(H=H.slice(M,++U)){if(U-=M,x&&q.DEBUG&&U>15&&(y>l||y!==i(y)))throw Error(o+V.s*y);if((D=D-M-1)>ue)V.c=V.e=null;else if(D=-g&&T<=g&&T===i(T)){if(P[0]===0){if(T===0&&P.length===1)return!0;break e}if(w=(T+1)%u,w<1&&(w+=u),String(P[0]).length==w){for(w=0;w=a||A!==i(A))break e;if(A!==0)return!0}}}else if(P===null&&T===null&&(D===null||D===1||D===-1))return!0;throw Error(s+"Invalid BigNumber: "+y)},q.maximum=q.max=function(){return ae(arguments,L.lt)},q.minimum=q.min=function(){return ae(arguments,L.gt)},q.random=function(){var y=9007199254740992,w=Math.random()*y&2097151?function(){return i(Math.random()*y)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(A){var P,T,D,M,x,U=0,H=[],V=new q(X);if(A==null?A=W:F(A,0,g),M=n(A/u),re)if(crypto.getRandomValues){for(P=crypto.getRandomValues(new Uint32Array(M*=2));U>>11),x>=9e15?(T=crypto.getRandomValues(new Uint32Array(2)),P[U]=T[0],P[U+1]=T[1]):(H.push(x%1e14),U+=2);U=M/2}else if(crypto.randomBytes){for(P=crypto.randomBytes(M*=7);U=9e15?crypto.randomBytes(7).copy(P,U):(H.push(x%1e14),U+=7);U=M/7}else throw re=!1,Error(s+"crypto unavailable");if(!re)for(;U=10;x/=10,U++);UT-1&&(x[M+1]==null&&(x[M+1]=0),x[M+1]+=x[M]/T|0,x[M]%=T)}return x.reverse()}return function(A,P,T,D,M){var x,U,H,V,Z,Ee,ve,Pe,Ze=A.indexOf("."),lt=W,Oe=j;for(Ze>=0&&(V=se,se=0,A=A.replace(".",""),Pe=new q(P),Ee=Pe.pow(A.length-Ze),se=V,Pe.c=w(S(N(Ee.c),Ee.e,"0"),10,T,y),Pe.e=Pe.c.length),ve=w(A,P,T,M?(x=ie,y):(x=y,ie)),H=V=ve.length;ve[--V]==0;ve.pop());if(!ve[0])return x.charAt(0);if(Ze<0?--H:(Ee.c=ve,Ee.e=H,Ee.s=D,Ee=B(Ee,Pe,lt,Oe,T),ve=Ee.c,Z=Ee.r,H=Ee.e),U=H+lt+1,Ze=ve[U],V=T/2,Z=Z||U<0||ve[U+1]!=null,Z=Oe<4?(Ze!=null||Z)&&(Oe==0||Oe==(Ee.s<0?3:2)):Ze>V||Ze==V&&(Oe==4||Z||Oe==6&&ve[U-1]&1||Oe==(Ee.s<0?8:7)),U<1||!ve[0])A=Z?S(x.charAt(1),-lt,x.charAt(0)):x.charAt(0);else{if(ve.length=U,Z)for(--T;++ve[--U]>T;)ve[U]=0,U||(++H,ve=[1].concat(ve));for(V=ve.length;!ve[--V];);for(Ze=0,A="";Ze<=V;A+=x.charAt(ve[Ze++]));A=S(A,H,x.charAt(0))}return A}}(),B=function(){function y(P,T,D){var M,x,U,H,V=0,Z=P.length,Ee=T%d,ve=T/d|0;for(P=P.slice();Z--;)U=P[Z]%d,H=P[Z]/d|0,M=ve*U+H*Ee,x=Ee*U+M%d*d+V,V=(x/D|0)+(M/d|0)+ve*H,P[Z]=x%D;return V&&(P=[V].concat(P)),P}function w(P,T,D,M){var x,U;if(D!=M)U=D>M?1:-1;else for(x=U=0;xT[x]?1:-1;break}return U}function A(P,T,D,M){for(var x=0;D--;)P[D]-=x,x=P[D]1;P.splice(0,1));}return function(P,T,D,M,x){var U,H,V,Z,Ee,ve,Pe,Ze,lt,Oe,Ue,xt,ui,cs,ls,nr,Bn,Wt=P.s==T.s?1:-1,Nt=P.c,ze=T.c;if(!Nt||!Nt[0]||!ze||!ze[0])return new q(!P.s||!T.s||(Nt?ze&&Nt[0]==ze[0]:!ze)?NaN:Nt&&Nt[0]==0||!ze?Wt*0:Wt/0);for(Ze=new q(Wt),lt=Ze.c=[],H=P.e-T.e,Wt=D+H+1,x||(x=a,H=v(P.e/u)-v(T.e/u),Wt=Wt/u|0),V=0;ze[V]==(Nt[V]||0);V++);if(ze[V]>(Nt[V]||0)&&H--,Wt<0)lt.push(1),Z=!0;else{for(cs=Nt.length,nr=ze.length,V=0,Wt+=2,Ee=i(x/(ze[0]+1)),Ee>1&&(ze=y(ze,Ee,x),Nt=y(Nt,Ee,x),nr=ze.length,cs=Nt.length),ui=nr,Oe=Nt.slice(0,nr),Ue=Oe.length;Ue=x/2&&ls++;do{if(Ee=0,U=w(ze,Oe,nr,Ue),U<0){if(xt=Oe[0],nr!=Ue&&(xt=xt*x+(Oe[1]||0)),Ee=i(xt/ls),Ee>1)for(Ee>=x&&(Ee=x-1),ve=y(ze,Ee,x),Pe=ve.length,Ue=Oe.length;w(ve,Oe,Pe,Ue)==1;)Ee--,A(ve,nr=10;Wt/=10,V++);oe(Ze,D+(Ze.e=V+H*u-1)+1,M,Z)}else Ze.e=H,Ze.r=+Z;return Ze}}();function le(y,w,A,P){var T,D,M,x,U;if(A==null?A=j:F(A,0,8),!y.c)return y.toString();if(T=y.c[0],M=y.e,w==null)U=N(y.c),U=P==1||P==2&&(M<=G||M>=K)?I(U,M):S(U,M,"0");else if(y=oe(new q(y),w,A),D=y.e,U=N(y.c),x=U.length,P==1||P==2&&(w<=D||D<=G)){for(;xx){if(--w>0)for(U+=".";w--;U+="0");}else if(w+=D-x,w>0)for(D+1==x&&(U+=".");w--;U+="0");return y.s<0&&T?"-"+U:U}function ae(y,w){for(var A,P=1,T=new q(y[0]);P=10;T/=10,P++);return(A=P+A*u-1)>ue?y.c=y.e=null:A=10;x/=10,T++);if(D=w-T,D<0)D+=u,M=w,U=Z[H=0],V=U/Ee[T-M-1]%10|0;else if(H=n((D+1)/u),H>=Z.length)if(P){for(;Z.length<=H;Z.push(0));U=V=0,T=1,D%=u,M=D-u+1}else break e;else{for(U=x=Z[H],T=1;x>=10;x/=10,T++);D%=u,M=D-u+T,V=M<0?0:U/Ee[T-M-1]%10|0}if(P=P||w<0||Z[H+1]!=null||(M<0?U:U%Ee[T-M-1]),P=A<4?(V||P)&&(A==0||A==(y.s<0?3:2)):V>5||V==5&&(A==4||P||A==6&&(D>0?M>0?U/Ee[T-M]:0:Z[H-1])%10&1||A==(y.s<0?8:7)),w<1||!Z[0])return Z.length=0,P?(w-=y.e+1,Z[0]=Ee[(u-w%u)%u],y.e=-w||0):Z[0]=y.e=0,y;if(D==0?(Z.length=H,x=1,H--):(Z.length=H+1,x=Ee[u-D],Z[H]=M>0?i(U/Ee[T-M]%Ee[M])*x:0),P)for(;;)if(H==0){for(D=1,M=Z[0];M>=10;M/=10,D++);for(M=Z[0]+=x,x=1;M>=10;M/=10,x++);D!=x&&(y.e++,Z[0]==a&&(Z[0]=1));break}else{if(Z[H]+=x,Z[H]!=a)break;Z[H--]=0,x=1}for(D=Z.length;Z[--D]===0;Z.pop());}y.e>ue?y.c=y.e=null:y.e=K?I(w,A):S(w,A,"0"),y.s<0?"-"+w:w)}return L.absoluteValue=L.abs=function(){var y=new q(this);return y.s<0&&(y.s=1),y},L.comparedTo=function(y,w){return O(this,new q(y,w))},L.decimalPlaces=L.dp=function(y,w){var A,P,T,D=this;if(y!=null)return F(y,0,g),w==null?w=j:F(w,0,8),oe(new q(D),y+D.e+1,w);if(!(A=D.c))return null;if(P=((T=A.length-1)-v(this.e/u))*u,T=A[T])for(;T%10==0;T/=10,P--);return P<0&&(P=0),P},L.dividedBy=L.div=function(y,w){return B(this,new q(y,w),W,j)},L.dividedToIntegerBy=L.idiv=function(y,w){return B(this,new q(y,w),0,1)},L.exponentiatedBy=L.pow=function(y,w){var A,P,T,D,M,x,U,H,V,Z=this;if(y=new q(y),y.c&&!y.isInteger())throw Error(s+"Exponent not an integer: "+ce(y));if(w!=null&&(w=new q(w)),x=y.e>14,!Z.c||!Z.c[0]||Z.c[0]==1&&!Z.e&&Z.c.length==1||!y.c||!y.c[0])return V=new q(Math.pow(+ce(Z),x?2-_(y):+ce(y))),w?V.mod(w):V;if(U=y.s<0,w){if(w.c?!w.c[0]:!w.s)return new q(NaN);P=!U&&Z.isInteger()&&w.isInteger(),P&&(Z=Z.mod(w))}else{if(y.e>9&&(Z.e>0||Z.e<-1||(Z.e==0?Z.c[0]>1||x&&Z.c[1]>=24e7:Z.c[0]<8e13||x&&Z.c[0]<=9999975e7)))return D=Z.s<0&&_(y)?-0:0,Z.e>-1&&(D=1/D),new q(U?1/D:D);se&&(D=n(se/u+2))}for(x?(A=new q(.5),U&&(y.s=1),H=_(y)):(T=Math.abs(+ce(y)),H=T%2),V=new q(X);;){if(H){if(V=V.times(Z),!V.c)break;D?V.c.length>D&&(V.c.length=D):P&&(V=V.mod(w))}if(T){if(T=i(T/2),T===0)break;H=T%2}else if(y=y.times(A),oe(y,y.e+1,1),y.e>14)H=_(y);else{if(T=+ce(y),T===0)break;H=T%2}Z=Z.times(Z),D?Z.c&&Z.c.length>D&&(Z.c.length=D):P&&(Z=Z.mod(w))}return P?V:(U&&(V=X.div(V)),w?V.mod(w):D?oe(V,se,j,M):V)},L.integerValue=function(y){var w=new q(this);return y==null?y=j:F(y,0,8),oe(w,w.e+1,y)},L.isEqualTo=L.eq=function(y,w){return O(this,new q(y,w))===0},L.isFinite=function(){return!!this.c},L.isGreaterThan=L.gt=function(y,w){return O(this,new q(y,w))>0},L.isGreaterThanOrEqualTo=L.gte=function(y,w){return(w=O(this,new q(y,w)))===1||w===0},L.isInteger=function(){return!!this.c&&v(this.e/u)>this.c.length-2},L.isLessThan=L.lt=function(y,w){return O(this,new q(y,w))<0},L.isLessThanOrEqualTo=L.lte=function(y,w){return(w=O(this,new q(y,w)))===-1||w===0},L.isNaN=function(){return!this.s},L.isNegative=function(){return this.s<0},L.isPositive=function(){return this.s>0},L.isZero=function(){return!!this.c&&this.c[0]==0},L.minus=function(y,w){var A,P,T,D,M=this,x=M.s;if(y=new q(y,w),w=y.s,!x||!w)return new q(NaN);if(x!=w)return y.s=-w,M.plus(y);var U=M.e/u,H=y.e/u,V=M.c,Z=y.c;if(!U||!H){if(!V||!Z)return V?(y.s=-w,y):new q(Z?M:NaN);if(!V[0]||!Z[0])return Z[0]?(y.s=-w,y):new q(V[0]?M:j==3?-0:0)}if(U=v(U),H=v(H),V=V.slice(),x=U-H){for((D=x<0)?(x=-x,T=V):(H=U,T=Z),T.reverse(),w=x;w--;T.push(0));T.reverse()}else for(P=(D=(x=V.length)<(w=Z.length))?x:w,x=w=0;w0)for(;w--;V[A++]=0);for(w=a-1;P>x;){if(V[--P]=0;){for(A=0,Ee=xt[T]%lt,ve=xt[T]/lt|0,M=U,D=T+M;D>T;)H=Ue[--M]%lt,V=Ue[M]/lt|0,x=ve*H+V*Ee,H=Ee*H+x%lt*lt+Pe[D]+A,A=(H/Ze|0)+(x/lt|0)+ve*V,Pe[D--]=H%Ze;Pe[D]=A}return A?++P:Pe.splice(0,1),fe(y,Pe,P)},L.negated=function(){var y=new q(this);return y.s=-y.s||null,y},L.plus=function(y,w){var A,P=this,T=P.s;if(y=new q(y,w),w=y.s,!T||!w)return new q(NaN);if(T!=w)return y.s=-w,P.minus(y);var D=P.e/u,M=y.e/u,x=P.c,U=y.c;if(!D||!M){if(!x||!U)return new q(T/0);if(!x[0]||!U[0])return U[0]?y:new q(x[0]?P:T*0)}if(D=v(D),M=v(M),x=x.slice(),T=D-M){for(T>0?(M=D,A=U):(T=-T,A=x),A.reverse();T--;A.push(0));A.reverse()}for(T=x.length,w=U.length,T-w<0&&(A=U,U=x,x=A,w=T),T=0;w;)T=(x[--w]=x[w]+U[w]+T)/a|0,x[w]=a===x[w]?0:x[w]%a;return T&&(x=[T].concat(x),++M),fe(y,x,M)},L.precision=L.sd=function(y,w){var A,P,T,D=this;if(y!=null&&y!==!!y)return F(y,1,g),w==null?w=j:F(w,0,8),oe(new q(D),y,w);if(!(A=D.c))return null;if(T=A.length-1,P=T*u+1,T=A[T]){for(;T%10==0;T/=10,P--);for(T=A[0];T>=10;T/=10,P++);}return y&&D.e+1>P&&(P=D.e+1),P},L.shiftedBy=function(y){return F(y,-l,l),this.times("1e"+y)},L.squareRoot=L.sqrt=function(){var y,w,A,P,T,D=this,M=D.c,x=D.s,U=D.e,H=W+4,V=new q("0.5");if(x!==1||!M||!M[0])return new q(!x||x<0&&(!M||M[0])?NaN:M?D:1/0);if(x=Math.sqrt(+ce(D)),x==0||x==1/0?(w=N(M),(w.length+U)%2==0&&(w+="0"),x=Math.sqrt(+w),U=v((U+1)/2)-(U<0||U%2),x==1/0?w="5e"+U:(w=x.toExponential(),w=w.slice(0,w.indexOf("e")+1)+U),A=new q(w)):A=new q(x+""),A.c[0]){for(U=A.e,x=U+H,x<3&&(x=0);;)if(T=A,A=V.times(T.plus(B(D,T,H,1))),N(T.c).slice(0,x)===(w=N(A.c)).slice(0,x))if(A.e0&&Pe>0){for(D=Pe%x||x,V=ve.substr(0,D);D0&&(V+=H+ve.slice(D)),Ee&&(V="-"+V)}P=Z?V+(A.decimalSeparator||"")+((U=+A.fractionGroupSize)?Z.replace(new RegExp("\\d{"+U+"}\\B","g"),"$&"+(A.fractionGroupSeparator||"")):Z):V}return(A.prefix||"")+P+(A.suffix||"")},L.toFraction=function(y){var w,A,P,T,D,M,x,U,H,V,Z,Ee,ve=this,Pe=ve.c;if(y!=null&&(x=new q(y),!x.isInteger()&&(x.c||x.s!==1)||x.lt(X)))throw Error(s+"Argument "+(x.isInteger()?"out of range: ":"not an integer: ")+ce(x));if(!Pe)return new q(ve);for(w=new q(X),H=A=new q(X),P=U=new q(X),Ee=N(Pe),D=w.e=Ee.length-ve.e-1,w.c[0]=f[(M=D%u)<0?u+M:M],y=!y||x.comparedTo(w)>0?D>0?w:H:x,M=ue,ue=1/0,x=new q(Ee),U.c[0]=0;V=B(x,w,0,1),T=A.plus(V.times(P)),T.comparedTo(y)!=1;)A=P,P=T,H=U.plus(V.times(T=H)),U=T,w=x.minus(V.times(T=w)),x=T;return T=B(y.minus(A),P,0,1),U=U.plus(T.times(H)),A=A.plus(T.times(P)),U.s=H.s=ve.s,D=D*2,Z=B(H,P,D,j).minus(ve).abs().comparedTo(B(U,A,D,j).minus(ve).abs())<1?[H,P]:[U,A],ue=M,Z},L.toNumber=function(){return+ce(this)},L.toPrecision=function(y,w){return y!=null&&F(y,1,g),le(this,y,w,2)},L.toString=function(y){var w,A=this,P=A.s,T=A.e;return T===null?P?(w="Infinity",P<0&&(w="-"+w)):w="NaN":(y==null?w=T<=G||T>=K?I(N(A.c),T):S(N(A.c),T,"0"):y===10?(A=oe(new q(A),W+T+1,j),w=S(N(A.c),A.e,"0")):(F(y,2,ie.length,"Base"),w=b(S(N(A.c),T,"0"),10,y,P,!0)),P<0&&A.c[0]&&(w="-"+w)),w},L.valueOf=L.toJSON=function(){return ce(this)},L._isBigNumber=!0,R!=null&&q.set(R),q}function v(R){var B=R|0;return R>0||R===B?B:B-1}function N(R){for(var B,b,C=1,L=R.length,X=R[0]+"";CK^b?1:-1;for(j=(G=L.length)<(K=X.length)?G:K,W=0;WX[W]^b?1:-1;return G==K?0:G>K^b?1:-1}function F(R,B,b,C){if(Rb||R!==i(R))throw Error(s+(C||"Argument")+(typeof R=="number"?Rb?" out of range: ":" not an integer: ":" not a primitive number: ")+String(R))}function _(R){var B=R.c.length-1;return v(R.e/u)==B&&R.c[B]%2!=0}function I(R,B){return(R.length>1?R.charAt(0)+"."+R.slice(1):R)+(B<0?"e":"e+")+B}function S(R,B,b){var C,L;if(B<0){for(L=b+".";++B;L+=b);R=L+R}else if(C=R.length,++B>C){for(L=b,B-=C;--B;L+=b);R+=L}else B{"use strict";c();Object.defineProperty(pe,"__esModule",{value:!0});pe.ErrGasLimitShouldBe0ForInnerTransaction=pe.ErrInvalidRelayedV2BuilderArguments=pe.ErrInvalidRelayedV1BuilderArguments=pe.ErrNotImplemented=pe.ErrContractInteraction=pe.ErrCodec=pe.ErrCannotParseTransactionOutcome=pe.ErrCannotParseContractResults=pe.ErrMissingFieldOnEnum=pe.ErrMissingFieldOnStruct=pe.ErrTypingSystem=pe.ErrMock=pe.ErrContractHasNoAddress=pe.ErrContract=pe.ErrExpectedTransactionEventsNotFound=pe.ErrExpectedTransactionStatusNotReached=pe.ErrTransactionWatcherTimeout=pe.ErrAsyncTimerAborted=pe.ErrAsyncTimerAlreadyRunning=pe.ErrInvalidFunctionName=pe.ErrSignatureCannotCreate=pe.ErrTransactionOptionsInvalid=pe.ErrTransactionVersionInvalid=pe.ErrNonceInvalid=pe.ErrNotEnoughGas=pe.ErrAddressEmpty=pe.ErrAddressBadHrp=pe.ErrAddressCannotCreate=pe.ErrUnexpectedCondition=pe.ErrInvariantFailed=pe.ErrBadType=pe.ErrUnsupportedOperation=pe.ErrInvalidArgument=pe.Err=void 0;var Re=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=Re;var C0=class extends Re{constructor(e,r){super(`Invalid argument: ${e}`,r)}};pe.ErrInvalidArgument=C0;var T0=class extends Re{constructor(e,r="not specified"){super(`Operation "${e}" not supported. Reason: ${r}`)}};pe.ErrUnsupportedOperation=T0;var x0=class extends Re{constructor(e,r,n){super(`Bad type of "${e}": ${n}. Expected type: ${r}`)}};pe.ErrBadType=x0;var N0=class extends Re{constructor(e){super(`Invariant failed: [${e}]`)}};pe.ErrInvariantFailed=N0;var O0=class extends Re{constructor(e){super(`Unexpected condition: [${e}]`)}};pe.ErrUnexpectedCondition=O0;var D0=class extends Re{constructor(e,r){let n=`Cannot create address from: ${e}`;super(n,r)}};pe.ErrAddressCannotCreate=D0;var P0=class extends Re{constructor(e,r){super(`Wrong address HRP. Expected: ${e}, got ${r}`)}};pe.ErrAddressBadHrp=P0;var R0=class extends Re{constructor(){super("Address is empty")}};pe.ErrAddressEmpty=R0;var B0=class extends Re{constructor(e){super(`Not enough gas provided: ${e}`)}};pe.ErrNotEnoughGas=B0;var L0=class extends Re{constructor(e){super(`Invalid nonce: ${e}`)}};pe.ErrNonceInvalid=L0;var F0=class extends Re{constructor(e){super(`Invalid transaction version: ${e}`)}};pe.ErrTransactionVersionInvalid=F0;var M0=class extends Re{constructor(e){super(`Invalid transaction options: ${e}`)}};pe.ErrTransactionOptionsInvalid=M0;var U0=class extends Re{constructor(e,r){let n=`Cannot create signature from: ${e}`;super(n,r)}};pe.ErrSignatureCannotCreate=U0;var q0=class extends Re{constructor(){super("Invalid function name")}};pe.ErrInvalidFunctionName=q0;var V0=class extends Re{constructor(){super("Async timer already running")}};pe.ErrAsyncTimerAlreadyRunning=V0;var H0=class extends Re{constructor(){super("Async timer aborted")}};pe.ErrAsyncTimerAborted=H0;var j0=class extends Re{constructor(){super("TransactionWatcher has timed out")}};pe.ErrTransactionWatcherTimeout=j0;var G0=class extends Re{constructor(){super("Expected transaction status not reached")}};pe.ErrExpectedTransactionStatusNotReached=G0;var k0=class extends Re{constructor(){super("Expected transaction events not found")}};pe.ErrExpectedTransactionEventsNotFound=k0;var Ql=class extends Re{constructor(e){super(e)}};pe.ErrContract=Ql;var Q0=class extends Ql{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=Gy;var Qy=class extends Re{constructor(e){super(e)}};pe.ErrMock=Qy;var ky=class extends Re{constructor(e){super(e)}};pe.ErrTypingSystem=ky;var zy=class extends Re{constructor(e,r){super(`field ${e} does not exist on struct ${r}`)}};pe.ErrMissingFieldOnStruct=zy;var Wy=class extends Re{constructor(e,r){super(`field ${e} does not exist on enum ${r}`)}};pe.ErrMissingFieldOnEnum=Wy;var Ky=class extends Re{constructor(e){super(`cannot parse contract results: ${e}`)}};pe.ErrCannotParseContractResults=Ky;var $y=class extends Re{constructor(e,r){super(`cannot parse outcome of transaction ${e}: ${r}`)}};pe.ErrCannotParseTransactionOutcome=$y;var Yy=class extends Re{constructor(e){super(e)}};pe.ErrCodec=Yy;var Jy=class extends Re{constructor(e){super(e)}};pe.ErrContractInteraction=Jy;var Xy=class extends Re{constructor(){super("Method not yet implemented")}};pe.ErrNotImplemented=Xy;var Zy=class extends Re{constructor(){super("invalid arguments for relayed v1 builder")}};pe.ErrInvalidRelayedV1BuilderArguments=Zy;var em=class extends Re{constructor(){super("invalid arguments for relayed v2 builder")}};pe.ErrInvalidRelayedV2BuilderArguments=em;var tm=class extends Re{constructor(){super("gas limit must be 0 for the inner transaction for relayed v2")}};pe.ErrGasLimitShouldBe0ForInnerTransaction=tm});var iI=w(li=>{"use strict";c();var W5=li&&li.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(li,"__esModule",{value:!0});li.TokenPayment=li.TokenTransfer=void 0;var Ic=W5(Yt()),K5=je(),rI="EGLD",nI=18;Ic.default.set({ROUNDING_MODE:1});var Xr=class{constructor(e){let r=new Ic.default(e.amountAsBigInteger);if(!r.isInteger()||r.isNegative())throw new K5.ErrInvalidArgument(`bad amountAsBigInteger: ${e.amountAsBigInteger}`);this.tokenIdentifier=e.tokenIdentifier,this.nonce=e.nonce,this.amountAsBigInteger=r,this.numDecimals=e.numDecimals}static egldFromAmount(e){let r=new Ic.default(e).shiftedBy(nI).decimalPlaces(0);return this.egldFromBigInteger(r)}static egldFromBigInteger(e){return new Xr({tokenIdentifier:rI,nonce:0,amountAsBigInteger:e,numDecimals:nI})}static fungibleFromAmount(e,r,n){let i=new Ic.default(r).shiftedBy(n).decimalPlaces(0);return this.fungibleFromBigInteger(e,i,n)}static fungibleFromBigInteger(e,r,n=0){return new Xr({tokenIdentifier:e,nonce:0,amountAsBigInteger:r,numDecimals:n})}static nonFungible(e,r){return new Xr({tokenIdentifier:e,nonce:r,amountAsBigInteger:1,numDecimals:0})}static semiFungible(e,r,n){return new Xr({tokenIdentifier:e,nonce:r,amountAsBigInteger:n,numDecimals:0})}static metaEsdtFromAmount(e,r,n,i){let s=new Ic.default(n).shiftedBy(i).decimalPlaces(0);return this.metaEsdtFromBigInteger(e,r,s,i)}static metaEsdtFromBigInteger(e,r,n,i=0){return new Xr({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==rI}isFungible(){return this.nonce==0}};li.TokenTransfer=Xr;var rm=class extends Xr{constructor(e,r,n,i){super({tokenIdentifier:e,nonce:r,amountAsBigInteger:n,numDecimals:i})}};li.TokenPayment=rm});var Go=w(ke=>{"use strict";c();Object.defineProperty(ke,"__esModule",{value:!0});ke.ARGUMENTS_SEPARATOR=ke.ESDT_TRANSFER_VALUE=ke.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME=ke.ESDTNFT_TRANSFER_FUNCTION_NAME=ke.ESDT_TRANSFER_FUNCTION_NAME=ke.ESDT_TRANSFER_GAS_LIMIT=ke.TRANSACTION_VERSION_WITH_OPTIONS=ke.TRANSACTION_VERSION_DEFAULT=ke.TRANSACTION_OPTIONS_TX_GUARDED=ke.TRANSACTION_OPTIONS_TX_HASH_SIGN=ke.TRANSACTION_OPTIONS_DEFAULT=ke.TRANSACTION_MIN_GAS_PRICE=void 0;ke.TRANSACTION_MIN_GAS_PRICE=1e9;ke.TRANSACTION_OPTIONS_DEFAULT=0;ke.TRANSACTION_OPTIONS_TX_HASH_SIGN=1;ke.TRANSACTION_OPTIONS_TX_GUARDED=2;ke.TRANSACTION_VERSION_DEFAULT=1;ke.TRANSACTION_VERSION_WITH_OPTIONS=2;ke.ESDT_TRANSFER_GAS_LIMIT=5e5;ke.ESDT_TRANSFER_FUNCTION_NAME="ESDTTransfer";ke.ESDTNFT_TRANSFER_FUNCTION_NAME="ESDTNFTTransfer";ke.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME="MultiESDTNFTTransfer";ke.ESDT_TRANSFER_VALUE="0";ke.ARGUMENTS_SEPARATOR="@"});var gr=w(Je=>{"use strict";c();var $5=Je&&Je.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Y5=Je&&Je.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),J5=Je&&Je.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&$5(e,t,r);return Y5(e,t),e};Object.defineProperty(Je,"__esModule",{value:!0});Je.isEmpty=Je.guardEmpty=Je.guardNotEmpty=Je.guardLength=Je.guardSameLength=Je.guardValueIsSetWithMessage=Je.guardValueIsSet=Je.guardTrue=void 0;var Qo=J5(je());function X5(t,e){if(!t)throw new Qo.ErrInvariantFailed(`[<${e}>] isn't true`)}Je.guardTrue=X5;function Z5(t,e){sI(`${t} isn't set (null or undefined)`,e)}Je.guardValueIsSet=Z5;function sI(t,e){if(e==null||e===void 0)throw new Qo.ErrInvariantFailed(t)}Je.guardValueIsSetWithMessage=sI;function eM(t,e){if(t=t||[],e=e||[],t.length!=e.length)throw new Qo.ErrInvariantFailed("arrays do not have the same length")}Je.guardSameLength=eM;function tM(t,e){let r=t.length||0;if(r!=e)throw new Qo.ErrInvariantFailed(`wrong length, expected: ${e}, actual: ${r}`)}Je.guardLength=tM;function rM(t,e){if(nm(t))throw new Qo.ErrInvariantFailed(`${e} is empty`)}Je.guardNotEmpty=rM;function nM(t,e){if(!nm(t))throw new Qo.ErrInvariantFailed(`${e} is not empty`)}Je.guardEmpty=nM;function nm(t){return t.isEmpty?t.isEmpty():t.length===0}Je.isEmpty=nm});var oI=w(Lf=>{"use strict";c();Object.defineProperty(Lf,"__esModule",{value:!0});Lf.getJavascriptPrototypesInHierarchy=void 0;function iM(t,e){let r=[],n=Object.getPrototypeOf(t);for(;n&&e(n);)r.push(n),n=Object.getPrototypeOf(n);return r}Lf.getJavascriptPrototypesInHierarchy=iM});var mt=w(yt=>{"use strict";c();Object.defineProperty(yt,"__esModule",{value:!0});yt.NullType=yt.TypePlaceholder=yt.isTyped=yt.PrimitiveValue=yt.TypedValue=yt.CustomType=yt.PrimitiveType=yt.TypeCardinality=yt.Type=void 0;var im=oI(),aI=gr(),ur=class{constructor(e,r=[],n=qn.fixed(1)){aI.guardValueIsSet("name",e),this.name=e,this.typeParameters=r,this.cardinality=n}getName(){return this.name}getClassName(){return ur.ClassName}getClassHierarchy(){return im.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 aI.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 ur.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(!ur.equalsMany(this.getTypeParameters(),e.getTypeParameters()))return!1;let n=this.getFullyQualifiedName();return ur.getFullyQualifiedNamesInHierarchy(e).includes(n)?!0:e.hasClassOrSuperclass(this.getClassName())}static getFullyQualifiedNamesInHierarchy(e){return im.getJavascriptPrototypesInHierarchy(e,i=>i.belongsToTypesystem).map(i=>i.getFullyQualifiedName.call(e))}getNamesOfDependencies(){let e=[];for(let r of this.typeParameters)e.push(r.getName()),e.push(...r.getNamesOfDependencies());return[...new Set(e)]}toJSON(){return{name:this.name,typeParameters:this.typeParameters.map(e=>e.toJSON())}}getCardinality(){return this.cardinality}belongsToTypesystem(){}};yt.Type=ur;ur.ClassName="Type";var qn=class{constructor(e,r){this.lowerBound=e,this.upperBound=r}static fixed(e){return new qn(e,e)}static variable(e){return new qn(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||qn.MaxCardinality}};yt.TypeCardinality=qn;qn.MaxCardinality=4096;var ko=class extends ur{constructor(e){super(e)}getClassName(){return ko.ClassName}};yt.PrimitiveType=ko;ko.ClassName="PrimitiveType";var zo=class extends ur{getClassName(){return zo.ClassName}};yt.CustomType=zo;zo.ClassName="CustomType";var vs=class{constructor(e){this.type=e}getClassName(){return vs.ClassName}getClassHierarchy(){return im.getJavascriptPrototypesInHierarchy(this,n=>n.belongsToTypesystem).map(n=>n.getClassName()).reverse()}getType(){return this.type}hasExactClass(e){return this.getClassName()==e}hasClassOrSuperclass(e){return this.getClassHierarchy().includes(e)}belongsToTypesystem(){}};yt.TypedValue=vs;vs.ClassName="TypedValue";var Wo=class extends vs{constructor(e){super(e)}getClassName(){return Wo.ClassName}};yt.PrimitiveValue=Wo;Wo.ClassName="PrimitiveValue";function sM(t){return t.belongsToTypesystem!==void 0}yt.isTyped=sM;var Ko=class extends ur{constructor(){super("...")}getClassName(){return Ko.ClassName}};yt.TypePlaceholder=Ko;Ko.ClassName="TypePlaceholder";var $o=class extends ur{constructor(){super("?")}getClassName(){return $o.ClassName}};yt.NullType=$o;$o.ClassName="NullType"});var uI=w((Yo,Jo)=>{c();(function(t){var e=typeof Yo=="object"&&Yo&&!Yo.nodeType&&Yo,r=typeof Jo=="object"&&Jo&&!Jo.nodeType&&Jo,n=typeof global=="object"&&global;(n.global===n||n.window===n||n.self===n)&&(t=n);var i,s=2147483647,o=36,a=1,u=26,l=38,f=700,d=72,y=128,m="-",v=/^xn--/,T=/[^\x20-\x7E]/,B=/[\x2E\u3002\uFF0E\uFF61]/g,A={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},D=o-a,x=Math.floor,R=String.fromCharCode,P;function L(Y){throw new RangeError(A[Y])}function _(Y,ie){for(var te=Y.length,ne=[];te--;)ne[te]=ie(Y[te]);return ne}function C(Y,ie){var te=Y.split("@"),ne="";te.length>1&&(ne=te[0]+"@",Y=te[1]),Y=Y.replace(B,".");var q=Y.split("."),ce=_(q,ie).join(".");return ne+ce}function M(Y){for(var ie=[],te=0,ne=Y.length,q,ce;te=55296&&q<=56319&&te65535&&(ie-=65536,te+=R(ie>>>10&1023|55296),ie=56320|ie&1023),te+=R(ie),te}).join("")}function z(Y){return Y-48<10?Y-22:Y-65<26?Y-65:Y-97<26?Y-97:o}function H(Y,ie){return Y+22+75*(Y<26)-((ie!=0)<<5)}function G(Y,ie,te){var ne=0;for(Y=te?x(Y/f):Y>>1,Y+=x(Y/ie);Y>D*u>>1;ne+=o)Y=x(Y/D);return x(ne+(D+1)*Y/(Y+l))}function $(Y){var ie=[],te=Y.length,ne,q=0,ce=y,oe=d,le,se,ue,g,E,b,O,I,N;for(le=Y.lastIndexOf(m),le<0&&(le=0),se=0;se=128&&L("not-basic"),ie.push(Y.charCodeAt(se));for(ue=le>0?le+1:0;ue=te&&L("invalid-input"),O=z(Y.charCodeAt(ue++)),(O>=o||O>x((s-q)/E))&&L("overflow"),q+=O*E,I=b<=oe?a:b>=oe+u?u:b-oe,!(Ox(s/N)&&L("overflow"),E*=N;ne=ie.length+1,oe=G(q-g,ne,g==0),x(q/ne)>s-ce&&L("overflow"),ce+=x(q/ne),q%=ne,ie.splice(q++,0,ce)}return Z(ie)}function de(Y){var ie,te,ne,q,ce,oe,le,se,ue,g,E,b=[],O,I,N,F;for(Y=M(Y),O=Y.length,ie=y,te=0,ce=d,oe=0;oe=ie&&Ex((s-te)/I)&&L("overflow"),te+=(le-ie)*I,ie=le,oe=0;oes&&L("overflow"),E==ie){for(se=te,ue=o;g=ue<=ce?a:ue>=ce+u?u:ue-ce,!(se{"use strict";c();var lI=uI();function oM(t,e){this.__proto__=new Error(e),this.__proto__.name="BackslashError",this.offset=t}function sm(t){return t>="0"&&t<="7"}function aM(t){return t>="0"&&t<="9"||t>="a"&&t<="f"||t>="A"&&t<="F"}function cI(t){return t=parseInt(t,16),lI.ucs2.encode([t])}function fI(t,e,r){var n=!1,i=[];function s(u){var l=t[u];if(!aM(l))throw new oM(u,"Unexpected token ILLEGAL");return l}for(;e{c();var gI=hI();wI.exports={validate:uM,parse:cM};function uM(t,e){var r;if(e=e||!1,typeof t!="string")r="Input must be a string";else try{Ff(t,0,e,!1)}catch(n){r=n.message}return r}function cM(t,e){if(typeof t!="string")throw new Error("Input must be a string");e=e||!1;var r=Ff(t,0,e,!0);return r.value}function yI(t,e){for(var r=t.length,n=e,i,s=e;s-1&&t[r]==="\\";)n++,r--;return n%2===0}function dM(t,e,r,n){for(var i=e,s=",",o=[],a=e;As(t[a]);)a++;if(t[a]==="]")return{start:e,end:a,value:o};for(;s===",";){var u=Ff(t,i,r,n),l=yI(t,u.end);n&&o.push(u.value),i=l.end,s=l.value}return{start:e,end:i,value:o}}function pM(t,e){return t.substr(e,4)==="true"}function gM(t,e){return t.substr(e,5)==="false"}function yM(t,e){return t.substr(e,4)==="null"}var mM=new RegExp(/^\s$/);function As(t){return mM.test(t)}var wM=new RegExp(/^\d$/);function dI(t){return wM.test(t)}function Vn(t,e,r){var n=10,i;t.length{"use strict";c();var EM=Zr&&Zr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),vM=Zr&&Zr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),AM=Zr&&Zr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&EM(e,t,r);return vM(e,t),e};Object.defineProperty(Zr,"__esModule",{value:!0});Zr.TypeExpressionParser=void 0;var vI=AM(je()),bM=mt(),_M=EI(),am=class{parse(e){let r=this.doParse(e),n=Object.keys(r);if(n.length!=1)throw new vI.ErrTypingSystem(`bad type expression: ${e}`);let i=n[0];return this.nodeToType(i,r[i])}doParse(e){let r=this.getJsonedString(e);try{return _M.parse(r)}catch{throw new vI.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 bM.Type(e,n)}};Zr.TypeExpressionParser=am});var um=w(fi=>{"use strict";c();Object.defineProperty(fi,"__esModule",{value:!0});fi.EndpointParameterDefinition=fi.EndpointModifiers=fi.EndpointDefinition=void 0;var IM=Mf(),AI="?",SM="N / A",Sc=class{constructor(e,r,n,i){this.input=[],this.output=[],this.name=e,this.input=r||[],this.output=n||[],this.modifiers=i}isConstructor(){return this.name=="constructor"}static fromJSON(e){e.name=e.name==null?AI:e.name,e.payableInTokens=e.payableInTokens||[],e.inputs=e.inputs||[],e.outputs=e.outputs||[];let r=e.inputs.map(s=>bs.fromJSON(s)),n=e.outputs.map(s=>bs.fromJSON(s)),i=new Uf(e.mutability,e.payableInTokens);return new Sc(e.name,r,n,i)}};fi.EndpointDefinition=Sc;var Uf=class{constructor(e,r){this.mutability=e||"",this.payableInTokens=r||[]}isPayableInEGLD(){return this.isPayableInToken("EGLD")}isPayableInToken(e){return this.payableInTokens.includes(e)?!0:this.payableInTokens.includes(`!${e}`)?!1:!!this.payableInTokens.includes("*")}isPayable(){return this.payableInTokens.length!=0}isReadonly(){return this.mutability=="readonly"}};fi.EndpointModifiers=Uf;var bs=class{constructor(e,r,n){this.name=e,this.description=r,this.type=n}static fromJSON(e){let r=new IM.TypeExpressionParser().parse(e.type);return new bs(e.name||AI,e.description||SM,r)}};fi.EndpointParameterDefinition=bs});var Xo=w(er=>{"use strict";c();var CM=er&&er.__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]}),TM=er&&er.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xM=er&&er.__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)&&CM(e,t,r);return TM(e,t),e};Object.defineProperty(er,"__esModule",{value:!0});er.Fields=er.Field=er.FieldDefinition=void 0;var cm=xM(je()),NM=Mf(),Cc=class{constructor(e,r,n){this.name=e,this.description=r,this.type=n}static fromJSON(e){let r=new NM.TypeExpressionParser().parse(e.type);return new Cc(e.name,e.description,r)}};er.FieldDefinition=Cc;var lm=class{constructor(e,r=""){this.value=e,this.name=r}checkTyping(e){let r=this.value.getType();if(!r.equals(e.type))throw new cm.ErrTypingSystem(`check type of field "${e.name}; expected: ${e.type}, actual: ${r}"`);if(this.name!=e.name)throw new cm.ErrTypingSystem(`check name of field "${e.name}"`)}equals(e){return this.name==e.name&&this.value.equals(e.value)}};er.Field=lm;var fm=class{static checkTyping(e,r){if(e.length!=r.length)throw new cm.ErrTypingSystem("fields length vs. field definitions length");for(let n=0;n{"use strict";c();Object.defineProperty(di,"__esModule",{value:!0});di.EnumValue=di.EnumVariantDefinition=di.EnumType=void 0;var OM=je(),hm=gr(),qf=Xo(),_I=mt(),bI=256,_s=class extends _I.CustomType{constructor(e,r){super(e),this.variants=[],this.variants=r}getClassName(){return _s.ClassName}static fromJSON(e){let r=(e.variants||[]).map(n=>Zo.fromJSON(n));return new _s(e.name,r)}getVariantByDiscriminant(e){let r=this.variants.find(n=>n.discriminant==e);return hm.guardValueIsSet(`variant by discriminant (${e})`,r),r}getVariantByName(e){let r=this.variants.find(n=>n.name==e);return hm.guardValueIsSet(`variant by name (${e})`,r),r}getNamesOfDependencies(){let e=[];for(let r of this.variants)e.push(...r.getNamesOfDependencies());return[...new Set(e)]}};di.EnumType=_s;_s.ClassName="EnumType";var Zo=class{constructor(e,r,n=[]){this.fieldsDefinitions=[],hm.guardTrue(rqf.FieldDefinition.fromJSON(n));return new Zo(e.name,e.discriminant,r)}getFieldsDefinitions(){return this.fieldsDefinitions}getFieldDefinition(e){return this.fieldsDefinitions.find(r=>r.name==e)}getNamesOfDependencies(){return qf.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};di.EnumVariantDefinition=Zo;var hi=class extends _I.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();qf.Fields.checkTyping(this.fields,i)}getClassName(){return hi.ClassName}static fromName(e,r){let n=e.getVariantByName(r);return new hi(e,n,[])}static fromDiscriminant(e,r){let n=e.getVariantByDiscriminant(r);return new hi(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=qf.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 OM.ErrMissingFieldOnEnum(e,this.getType().getName())}valueOf(){let e={name:this.name,fields:[]};return this.fields.forEach(r=>e.fields[r.name]=r.value.valueOf()),e}};di.EnumValue=hi;hi.ClassName="EnumValue"});var ra=w(ta=>{"use strict";c();Object.defineProperty(ta,"__esModule",{value:!0});ta.Struct=ta.StructType=void 0;var DM=je(),Vf=Xo(),II=mt(),Is=class extends II.CustomType{constructor(e,r){super(e),this.fieldsDefinitions=[],this.fieldsDefinitions=r}getClassName(){return Is.ClassName}static fromJSON(e){let r=(e.fields||[]).map(n=>Vf.FieldDefinition.fromJSON(n));return new Is(e.name,r)}getFieldsDefinitions(){return this.fieldsDefinitions}getFieldDefinition(e){return this.fieldsDefinitions.find(r=>r.name==e)}getNamesOfDependencies(){return Vf.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};ta.StructType=Is;Is.ClassName="StructType";var ea=class extends II.TypedValue{constructor(e,r){super(e),this.fields=r,this.fieldsByName=new Map(r.map(n=>[n.name,n])),this.checkTyping()}getClassName(){return ea.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 DM.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)}};ta.Struct=ea;ea.ClassName="Struct"});var Qf=w((pre,TI)=>{"use strict";c();var Hf="qpzry9x8gf2tvdw0s3jn54khce6mua7l",dm={};for(xc=0;xc>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 SI(t){for(var e=1,r=0;r126)return"Invalid prefix ("+t+")";e=na(e)^n>>5}for(e=na(e),r=0;rr)throw new TypeError("Exceeds length limit");t=t.toLowerCase();var n=SI(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=na(n)^o,i+=Hf.charAt(o)}for(s=0;s<6;++s)n=na(n);for(n^=1,s=0;s<6;++s){var a=n>>(5-s)*5&31;i+=Hf.charAt(a)}return i}function CI(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=SI(s);if(typeof a=="string")return a;for(var u=[],l=0;l=o.length)&&u.push(d)}return a!==1?"Invalid checksum for "+t:{prefix:s,words:u}}function RM(){var t=CI.apply(null,arguments);if(typeof t=="object")return t}function BM(t){var e=CI.apply(null,arguments);if(typeof e=="object")return e;throw new Error(e)}function Gf(t,e,r,n){for(var i=0,s=0,o=(1<=r;)s-=r,a.push(i>>s&o);if(n)s>0&&a.push(i<=e)return"Excess padding";if(i<{"use strict";c();var qM=en&&en.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),VM=en&&en.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xI=en&&en.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&qM(e,t,r);return VM(e,t),e};Object.defineProperty(en,"__esModule",{value:!0});en.Address=void 0;var kf=xI(Qf()),ia=xI(je()),pm="erd",gm=32,jM="0".repeat(16),bt=class{constructor(e){if(this.valueHex="",!!e){if(e instanceof bt)return bt.fromAddress(e);if(e instanceof h.Buffer)return bt.fromBuffer(e);if(typeof e=="string")return bt.fromString(e);throw new ia.ErrAddressCannotCreate(e)}}static fromAddress(e){return bt.fromValidHex(e.valueHex)}static fromValidHex(e){let r=new bt;return r.valueHex=e,r}static fromBuffer(e){if(e.length!=gm)throw new ia.ErrAddressCannotCreate(e);return bt.fromValidHex(e.toString("hex"))}static fromString(e){return bt.isValidHex(e)?bt.fromValidHex(e):bt.fromBech32(e)}static isValidHex(e){return h.Buffer.from(e,"hex").length==gm}static fromHex(e){if(!bt.isValidHex(e))throw new ia.ErrAddressCannotCreate(e);return bt.fromValidHex(e)}static empty(){return new bt}static fromBech32(e){let r;try{r=kf.decode(e)}catch(s){throw new ia.ErrAddressCannotCreate(e,s)}let n=r.prefix;if(n!=pm)throw new ia.ErrAddressBadHrp(pm,n);let i=h.Buffer.from(kf.fromWords(r.words));if(i.length!=gm)throw new ia.ErrAddressCannotCreate(e);return bt.fromValidHex(i.toString("hex"))}hex(){return this.isEmpty()?"":this.valueHex}bech32(){if(this.isEmpty())return"";let e=kf.toWords(this.pubkey());return kf.encode(pm,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 bt("0".repeat(64))}isContractAddress(){return this.hex().startsWith(jM)}};en.Address=bt});var aa=w(oa=>{"use strict";c();Object.defineProperty(oa,"__esModule",{value:!0});oa.AddressValue=oa.AddressType=void 0;var HM=tr(),NI=mt(),Ss=class extends NI.PrimitiveType{constructor(){super("Address")}getClassName(){return Ss.ClassName}};oa.AddressType=Ss;Ss.ClassName="AddressType";var sa=class extends NI.PrimitiveValue{constructor(e){super(new Ss),this.value=new HM.Address(e.bech32())}getClassName(){return sa.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};oa.AddressValue=sa;sa.ClassName="AddressValue"});var zf=w(ua=>{"use strict";c();Object.defineProperty(ua,"__esModule",{value:!0});ua.OptionalValue=ua.OptionalType=void 0;var GM=gr(),Nc=mt(),pi=class extends Nc.Type{constructor(e){super("Optional",[e],Nc.TypeCardinality.variable(1))}getClassName(){return pi.ClassName}isAssignableFrom(e){if(!e.hasExactClass(pi.ClassName))return!1;let r=this.getFirstTypeParameter().equals(e.getFirstTypeParameter()),n=e.getFirstTypeParameter().hasExactClass(Nc.NullType.ClassName);return r||n}};ua.OptionalType=pi;pi.ClassName="OptionalType";var Cs=class extends Nc.TypedValue{constructor(e,r=null){super(e),this.value=r}getClassName(){return Cs.ClassName}static newMissing(){let e=new pi(new Nc.NullType);return new Cs(e)}isSet(){return!!this.value}getTypedValue(){return GM.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}};ua.OptionalValue=Cs;Cs.ClassName="OptionalValue"});var Oc=w(la=>{"use strict";c();Object.defineProperty(la,"__esModule",{value:!0});la.BooleanValue=la.BooleanType=void 0;var OI=mt(),Ts=class extends OI.PrimitiveType{constructor(){super("bool")}getClassName(){return Ts.ClassName}};la.BooleanType=Ts;Ts.ClassName="BooleanType";var ca=class extends OI.PrimitiveValue{constructor(e){super(new Ts),this.value=e}getClassName(){return ca.ClassName}equals(e){return this.value===e.value}isTrue(){return this.value===!0}isFalse(){return!this.isTrue()}valueOf(){return this.value}};la.BooleanValue=ca;ca.ClassName="BooleanValue"});var yi=w(fa=>{"use strict";c();Object.defineProperty(fa,"__esModule",{value:!0});fa.BytesValue=fa.BytesType=void 0;var DI=mt(),xs=class extends DI.PrimitiveType{constructor(){super("bytes")}getClassName(){return xs.ClassName}};fa.BytesType=xs;xs.ClassName="BytesType";var gi=class extends DI.PrimitiveValue{constructor(e){super(new xs),this.value=e}getClassName(){return gi.ClassName}static fromUTF8(e){let r=h.Buffer.from(e,"utf-8");return new gi(r)}static fromHex(e){let r=h.Buffer.from(e,"hex");return new gi(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()}};fa.BytesValue=gi;gi.ClassName="BytesValue"});var RI=w(ha=>{"use strict";c();Object.defineProperty(ha,"__esModule",{value:!0});ha.CodeMetadataValue=ha.CodeMetadataType=void 0;var PI=mt(),Wf=class extends PI.PrimitiveType{constructor(){super("CodeMetadata")}};ha.CodeMetadataType=Wf;var ym=class extends PI.PrimitiveValue{constructor(e){super(new Wf),this.value=e}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};ha.CodeMetadataValue=ym});var Kf=w(da=>{"use strict";c();Object.defineProperty(da,"__esModule",{value:!0});da.CompositeValue=da.CompositeType=void 0;var QM=gr(),mm=mt(),Ns=class extends mm.Type{constructor(...e){super("Composite",e,mm.TypeCardinality.variable(e.length))}getClassName(){return Ns.ClassName}};da.CompositeType=Ns;Ns.ClassName="CompositeType";var Os=class extends mm.TypedValue{constructor(e,r){super(e),QM.guardLength(r,e.getTypeParameters().length),this.items=r}getClassName(){return Os.ClassName}static fromItems(...e){let r=e.map(i=>i.getType()),n=new Ns(...r);return new Os(n,e)}getItems(){return this.items}valueOf(){return this.items.map(e=>e?.valueOf())}equals(e){if(this.getType().differs(e.getType()))return!1;for(let r=0;r{"use strict";c();Object.defineProperty($f,"__esModule",{value:!0});$f.CollectionOfTypedValues=void 0;var wm=class{constructor(e){this.items=e}getLength(){return this.items.length}getItems(){return this.items}valueOf(){return this.items.map(e=>e.valueOf())}equals(e){if(this.getLength()!=e.getLength())return!1;for(let r=0;r{"use strict";c();Object.defineProperty(tn,"__esModule",{value:!0});tn.List=tn.OptionValue=tn.ListType=tn.OptionType=void 0;var kM=gr(),zM=Em(),Ds=mt(),rn=class extends Ds.Type{constructor(e){super("Option",[e])}getClassName(){return rn.ClassName}isAssignableFrom(e){if(!e.hasExactClass(rn.ClassName))return!1;let r=this.getFirstTypeParameter().equals(e.getFirstTypeParameter()),n=e.getFirstTypeParameter().hasExactClass(Ds.NullType.ClassName);return r||n}};tn.OptionType=rn;rn.ClassName="OptionType";var Ps=class extends Ds.Type{constructor(e){super("List",[e])}getClassName(){return Ps.ClassName}};tn.ListType=Ps;Ps.ClassName="ListType";var jn=class extends Ds.TypedValue{constructor(e,r=null){super(e),this.value=r}getClassName(){return jn.ClassName}static newMissing(){let e=new rn(new Ds.NullType);return new jn(e)}static newMissingTyped(e){return new jn(new rn(e))}static newProvided(e){let r=new rn(e.getType());return new jn(r,e)}isSet(){return!!this.value}getTypedValue(){return kM.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}};tn.OptionValue=jn;jn.ClassName="OptionValue";var mi=class extends Ds.TypedValue{constructor(e,r){super(e),this.backingCollection=new zM.CollectionOfTypedValues(r)}getClassName(){return mi.ClassName}static fromItems(e){if(e.length==0)return new mi(new Ds.TypePlaceholder,[]);let r=e[0].getType(),n=new Ps(r);return new mi(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)}};tn.List=mi;mi.ClassName="List"});var Yf=w(ya=>{"use strict";c();Object.defineProperty(ya,"__esModule",{value:!0});ya.ArrayVec=ya.ArrayVecType=void 0;var BI=gr(),WM=Em(),LI=mt(),pa=class extends LI.Type{constructor(e,r){super("Array",[r]),BI.guardTrue(e>0,"array length > 0"),this.length=e}getClassName(){return pa.ClassName}};ya.ArrayVecType=pa;pa.ClassName="ArrayVecType";var ga=class extends LI.TypedValue{constructor(e,r){super(e),BI.guardLength(r,e.length),this.backingCollection=new WM.CollectionOfTypedValues(r)}getClassName(){return ga.ClassName}getLength(){return this.backingCollection.getLength()}getItems(){return this.backingCollection.getItems()}valueOf(){return this.backingCollection.valueOf()}equals(e){return this.backingCollection.equals(e.backingCollection)}};ya.ArrayVec=ga;ga.ClassName="ArrayVec"});var Pc=w(wa=>{"use strict";c();Object.defineProperty(wa,"__esModule",{value:!0});wa.H256Value=wa.H256Type=void 0;var FI=mt(),Rs=class extends FI.PrimitiveType{constructor(){super("H256")}getClassName(){return Rs.ClassName}};wa.H256Type=Rs;Rs.ClassName="H256Type";var ma=class extends FI.PrimitiveValue{constructor(e){super(new Rs),this.value=e}getClassName(){return ma.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};wa.H256Value=ma;ma.ClassName="H256Value"});var Jf=w(va=>{"use strict";c();Object.defineProperty(va,"__esModule",{value:!0});va.NothingValue=va.NothingType=void 0;var MI=mt(),Bs=class extends MI.PrimitiveType{constructor(){super("nothing")}getClassName(){return Bs.ClassName}};va.NothingType=Bs;Bs.ClassName="NothingType";var Ea=class extends MI.PrimitiveValue{constructor(){super(new Bs)}getClassName(){return Ea.ClassName}equals(e){return!1}valueOf(){return{}}};va.NothingValue=Ea;Ea.ClassName="NothingValue"});var Rc=w(Ae=>{"use strict";c();var KM=Ae&&Ae.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$M=Ae&&Ae.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YM=Ae&&Ae.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&KM(e,t,r);return $M(e,t),e},JM=Ae&&Ae.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ae,"__esModule",{value:!0});Ae.BigIntValue=Ae.BigUIntValue=Ae.I64Value=Ae.U64Value=Ae.I32Value=Ae.U32Value=Ae.I16Value=Ae.U16Value=Ae.I8Value=Ae.U8Value=Ae.NumericalValue=Ae.BigIntType=Ae.BigUIntType=Ae.I64Type=Ae.U64Type=Ae.I32Type=Ae.U32Type=Ae.I16Type=Ae.U16Type=Ae.I8Type=Ae.U8Type=Ae.NumericalType=void 0;var UI=YM(je()),qI=mt(),ks=JM(Yt()),Ht=class extends qI.PrimitiveType{constructor(e,r,n){super(e),this.sizeInBytes=r,this.withSign=n}getClassName(){return Ht.ClassName}hasFixedSize(){return!!this.sizeInBytes}hasArbitrarySize(){return!this.hasFixedSize()}};Ae.NumericalType=Ht;Ht.ClassName="NumericalType";var Ls=class extends Ht{constructor(){super("u8",1,!1)}getClassName(){return Ls.ClassName}};Ae.U8Type=Ls;Ls.ClassName="U8Type";var Fs=class extends Ht{constructor(){super("i8",1,!0)}getClassName(){return Fs.ClassName}};Ae.I8Type=Fs;Fs.ClassName="I8Type";var Ms=class extends Ht{constructor(){super("u16",2,!1)}getClassName(){return Ms.ClassName}};Ae.U16Type=Ms;Ms.ClassName="U16Type";var Us=class extends Ht{constructor(){super("i16",2,!0)}getClassName(){return Us.ClassName}};Ae.I16Type=Us;Us.ClassName="I16Type";var qs=class extends Ht{constructor(){super("u32",4,!1)}getClassName(){return qs.ClassName}};Ae.U32Type=qs;qs.ClassName="U32Type";var Vs=class extends Ht{constructor(){super("i32",4,!0)}getClassName(){return Vs.ClassName}};Ae.I32Type=Vs;Vs.ClassName="I32Type";var js=class extends Ht{constructor(){super("u64",8,!1)}getClassName(){return js.ClassName}};Ae.U64Type=js;js.ClassName="U64Type";var Hs=class extends Ht{constructor(){super("i64",8,!0)}getClassName(){return Hs.ClassName}};Ae.I64Type=Hs;Hs.ClassName="I64Type";var Gs=class extends Ht{constructor(){super("BigUint",0,!1)}getClassName(){return Gs.ClassName}};Ae.BigUIntType=Gs;Gs.ClassName="BigUIntType";var Qs=class extends Ht{constructor(){super("Bigint",0,!0)}getClassName(){return Qs.ClassName}};Ae.BigIntType=Qs;Qs.ClassName="BigIntType";var Gt=class extends qI.PrimitiveValue{constructor(e,r){if(super(e),this.value=new ks.default(r),this.sizeInBytes=e.sizeInBytes,this.withSign=e.withSign,this.value.isNaN())throw new UI.ErrInvalidArgument(`not a number: ${r}`);if(!this.withSign&&this.value.isNegative())throw new UI.ErrInvalidArgument(`negative, but type is unsigned: ${r}`)}getClassName(){return Gt.ClassName}equals(e){return this.value.isEqualTo(e.value)}valueOf(){return this.value}toString(){return this.value.toString()}};Ae.NumericalValue=Gt;Gt.ClassName="NumericalValue";var Aa=class extends Gt{constructor(e){super(new Ls,new ks.default(e))}getClassName(){return Aa.ClassName}};Ae.U8Value=Aa;Aa.ClassName="U8Value";var ba=class extends Gt{constructor(e){super(new Fs,new ks.default(e))}getClassName(){return ba.ClassName}};Ae.I8Value=ba;ba.ClassName="I8Value";var _a=class extends Gt{constructor(e){super(new Ms,new ks.default(e))}getClassName(){return _a.ClassName}};Ae.U16Value=_a;_a.ClassName="U16Value";var Ia=class extends Gt{constructor(e){super(new Us,new ks.default(e))}getClassName(){return Ia.ClassName}};Ae.I16Value=Ia;Ia.ClassName="I16Value";var Sa=class extends Gt{constructor(e){super(new qs,new ks.default(e))}getClassName(){return Sa.ClassName}};Ae.U32Value=Sa;Sa.ClassName="U32Value";var Ca=class extends Gt{constructor(e){super(new Vs,new ks.default(e))}getClassName(){return Ca.ClassName}};Ae.I32Value=Ca;Ca.ClassName="I32Value";var Ta=class extends Gt{constructor(e){super(new js,e)}getClassName(){return Ta.ClassName}};Ae.U64Value=Ta;Ta.ClassName="U64Value";var xa=class extends Gt{constructor(e){super(new Hs,e)}getClassName(){return xa.ClassName}};Ae.I64Value=xa;xa.ClassName="I64Value";var Na=class extends Gt{constructor(e){super(new Gs,e)}getClassName(){return Na.ClassName}};Ae.BigUIntValue=Na;Na.ClassName="BigUIntValue";var Oa=class extends Gt{constructor(e){super(new Qs,e)}getClassName(){return Oa.ClassName}};Ae.BigIntValue=Oa;Oa.ClassName="BigIntValue"});var Xf=w(Da=>{"use strict";c();Object.defineProperty(Da,"__esModule",{value:!0});Da.StringValue=Da.StringType=void 0;var VI=mt(),zs=class extends VI.PrimitiveType{constructor(){super("utf-8 string")}getClassName(){return zs.ClassName}};Da.StringType=zs;zs.ClassName="StringType";var wi=class extends VI.PrimitiveValue{constructor(e){super(new zs),this.value=e}getClassName(){return wi.ClassName}static fromUTF8(e){return new wi(e)}static fromHex(e){let r=h.Buffer.from(e,"hex").toString();return new wi(r)}getLength(){return this.value.length}equals(e){return this.value===e.value}valueOf(){return this.value}};Da.StringValue=wi;wi.ClassName="StringValue"});var Ra=w(Pa=>{"use strict";c();Object.defineProperty(Pa,"__esModule",{value:!0});Pa.TokenIdentifierValue=Pa.TokenIdentifierType=void 0;var jI=mt(),XM="EGLD",Ws=class extends jI.PrimitiveType{constructor(){super("TokenIdentifier")}getClassName(){return Ws.ClassName}};Pa.TokenIdentifierType=Ws;Ws.ClassName="TokenIdentifierType";var Ei=class extends jI.PrimitiveValue{constructor(e){super(new Ws),this.value=e}static egld(){return new Ei(XM)}static esdtTokenIdentifier(e){return new Ei(e)}getClassName(){return Ei.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()}};Pa.TokenIdentifierValue=Ei;Ei.ClassName="TokenIdentifierValue"});var Zf=w(yr=>{"use strict";c();var ZM=yr&&yr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),e4=yr&&yr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),t4=yr&&yr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ZM(e,t,r);return e4(e,t),e};Object.defineProperty(yr,"__esModule",{value:!0});yr.Tuple=yr.TupleType=void 0;var r4=t4(je()),HI=Xo(),GI=ra(),Hn=class extends GI.StructType{constructor(...e){super(Hn.prepareName(e),Hn.prepareFieldDefinitions(e))}getClassName(){return Hn.ClassName}static prepareName(e){return`tuple<${e.map(i=>i.toString()).join(", ")}>`}static prepareFieldDefinitions(e){return e.map((n,i)=>new HI.FieldDefinition(QI(i),"anonymous tuple field",n))}};yr.TupleType=Hn;Hn.ClassName="TupleType";function QI(t){return`field${t}`}var Ks=class extends GI.Struct{constructor(e,r){super(e,r)}getClassName(){return Ks.ClassName}static fromItems(e){if(e.length<1)throw new r4.ErrTypingSystem("bad tuple items");let r=e.map(s=>s.getType()),n=new Hn(...r),i=e.map((s,o)=>new HI.Field(s,QI(o)));return new Ks(n,i)}};yr.Tuple=Ks;Ks.ClassName="Tuple"});var th=w(Ba=>{"use strict";c();Object.defineProperty(Ba,"__esModule",{value:!0});Ba.VariadicValue=Ba.VariadicType=void 0;var eh=mt(),Ai=class extends eh.Type{constructor(e){super("Variadic",[e],eh.TypeCardinality.variable())}getClassName(){return Ai.ClassName}};Ba.VariadicType=Ai;Ai.ClassName="VariadicType";var vi=class extends eh.TypedValue{constructor(e,r){super(e),this.items=r}getClassName(){return vi.ClassName}static fromItems(...e){if(e.length==0)return new vi(new Ai(new eh.TypePlaceholder),[]);let r=e[0].getType();return new vi(new Ai(r),e)}getItems(){return this.items}valueOf(){return this.items.map(e=>e.valueOf())}equals(e){if(this.getType().differs(e.getType()))return!1;for(let r=0;r{"use strict";c();var n4=nn&&nn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),i4=nn&&nn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),s4=nn&&nn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&n4(e,t,r);return i4(e,t),e};Object.defineProperty(nn,"__esModule",{value:!0});nn.TypeMapper=void 0;var kI=s4(je()),o4=aa(),vm=zf(),a4=Oc(),u4=yi(),c4=RI(),rh=Kf(),Am=Tc(),l4=Xo(),zI=Dc(),nh=Yf(),f4=Pc(),WI=Jf(),mr=Rc(),h4=Xf(),KI=ra(),$I=Ra(),bi=Zf(),bm=th(),_m=class{constructor(e=[]){this.openTypesFactories=new Map([["Option",(...r)=>new zI.OptionType(r[0])],["List",(...r)=>new zI.ListType(r[0])],["VarArgs",(...r)=>new bm.VariadicType(r[0])],["MultiResultVec",(...r)=>new bm.VariadicType(r[0])],["variadic",(...r)=>new bm.VariadicType(r[0])],["OptionalArg",(...r)=>new vm.OptionalType(r[0])],["optional",(...r)=>new vm.OptionalType(r[0])],["OptionalResult",(...r)=>new vm.OptionalType(r[0])],["multi",(...r)=>new rh.CompositeType(...r)],["MultiArg",(...r)=>new rh.CompositeType(...r)],["MultiResult",(...r)=>new rh.CompositeType(...r)],["multi",(...r)=>new rh.CompositeType(...r)],["tuple",(...r)=>new bi.TupleType(...r)],["tuple2",(...r)=>new bi.TupleType(...r)],["tuple3",(...r)=>new bi.TupleType(...r)],["tuple4",(...r)=>new bi.TupleType(...r)],["tuple5",(...r)=>new bi.TupleType(...r)],["tuple6",(...r)=>new bi.TupleType(...r)],["tuple7",(...r)=>new bi.TupleType(...r)],["tuple8",(...r)=>new bi.TupleType(...r)],["array20",(...r)=>new nh.ArrayVecType(20,r[0])],["array32",(...r)=>new nh.ArrayVecType(32,r[0])],["array46",(...r)=>new nh.ArrayVecType(46,r[0])],["array64",(...r)=>new nh.ArrayVecType(64,r[0])]]),this.closedTypesMap=new Map([["u8",new mr.U8Type],["u16",new mr.U16Type],["u32",new mr.U32Type],["u64",new mr.U64Type],["U64",new mr.U64Type],["BigUint",new mr.BigUIntType],["i8",new mr.I8Type],["i16",new mr.I16Type],["i32",new mr.I32Type],["i64",new mr.I64Type],["Bigint",new mr.BigIntType],["BigInt",new mr.BigIntType],["bool",new a4.BooleanType],["bytes",new u4.BytesType],["Address",new o4.AddressType],["H256",new f4.H256Type],["utf-8 string",new h4.StringType],["TokenIdentifier",new $I.TokenIdentifierType],["EgldOrEsdtTokenIdentifier",new $I.TokenIdentifierType],["CodeMetadata",new c4.CodeMetadataType],["nothing",new WI.NothingType],["AsyncCall",new WI.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 kI.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(Am.EnumType.ClassName)?this.mapEnumType(e):e.hasExactClass(KI.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 KI.StructType(e.getName(),r)}mapEnumType(e){let r=e.variants.map(i=>new Am.EnumVariantDefinition(i.name,i.discriminant,this.mappedFields(i.getFieldsDefinitions())));return new Am.EnumType(e.getName(),r)}mappedFields(e){return e.map(r=>new l4.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 kI.ErrTypingSystem(`Cannot map the generic type "${e.getName()}" to a known type`);return i(...n)}};nn.TypeMapper=_m});var eS=w(sn=>{"use strict";c();var d4=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]}),p4=sn&&sn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),g4=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)&&d4(e,t,r);return p4(e,t),e};Object.defineProperty(sn,"__esModule",{value:!0});sn.AbiRegistry=void 0;var YI=g4(je()),Sm=gr(),Bc=um(),JI=Tc(),XI=ra(),y4=Im(),m4="?",La=class{constructor(e){this.endpoints=[],this.customTypes=[],this.name=e.name,this.constructorDefinition=e.constructorDefinition,this.endpoints=e.endpoints,this.customTypes=e.customTypes}static create(e){let r=e.name||m4,n=e.constructor||{},i=e.endpoints||[],s=e.types||{},o=Bc.EndpointDefinition.fromJSON(Object.assign({name:"constructor"},n)),a=i.map(d=>Bc.EndpointDefinition.fromJSON(d)),u=[];for(let d in s){let y=s[d];if(y.type=="struct")u.push(XI.StructType.fromJSON({name:d,fields:y.fields}));else if(y.type=="enum")u.push(JI.EnumType.fromJSON({name:d,variants:y.variants}));else throw new YI.ErrTypingSystem(`Cannot handle custom type: ${d}`)}return new La({name:r,constructorDefinition:o,endpoints:a,customTypes:u}).remapToKnownTypes()}getStruct(e){let r=this.customTypes.find(n=>n.getName()==e&&n.hasExactClass(XI.StructType.ClassName));return Sm.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(JI.EnumType.ClassName));return Sm.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 Sm.guardValueIsSetWithMessage(`endpoint [${e}] not found`,r),r}remapToKnownTypes(){let e=new y4.TypeMapper([]),r=[];for(let o of this.customTypes)this.mapCustomTypeDepthFirst(o,this.customTypes,e,r);if(this.customTypes.length!=r.length)throw new YI.ErrTypingSystem("Did not re-map all custom types");let n=ZI(this.constructorDefinition,e),i=[];for(let o of this.endpoints)i.push(ZI(o,e));return new La({name:this.name,constructorDefinition:n,endpoints:i,customTypes:r})}mapCustomTypeDepthFirst(e,r,n,i){if(i.findIndex(a=>a.getName()==e.getName())>=0)return;for(let a of e.getNamesOfDependencies()){let u=r.find(l=>l.getName()==a);u&&this.mapCustomTypeDepthFirst(u,r,n,i)}let o=n.mapType(e);i.push(o)}};sn.AbiRegistry=La;function ZI(t,e){let r=t.input.map(i=>new Bc.EndpointParameterDefinition(i.name,i.description,e.mapType(i.type))),n=t.output.map(i=>new Bc.EndpointParameterDefinition(i.name,i.description,e.mapType(i.type)));return new Bc.EndpointDefinition(t.name,r,n,t.modifiers)}});var rS=w(Fa=>{"use strict";c();Object.defineProperty(Fa,"__esModule",{value:!0});Fa.createListOfTokenIdentifiers=Fa.createListOfAddresses=void 0;var w4=aa(),tS=Dc(),E4=Ra();function v4(t){let e=t.map(n=>new w4.AddressValue(n));return tS.List.fromItems(e)}Fa.createListOfAddresses=v4;function A4(t){let e=t.map(n=>new E4.TokenIdentifierValue(n));return tS.List.fromItems(e)}Fa.createListOfTokenIdentifiers=A4});var yS=w(Qt=>{"use strict";c();var b4=Qt&&Qt.__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]}),_4=Qt&&Qt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),I4=Qt&&Qt.__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)&&b4(e,t,r);return _4(e,t),e};Object.defineProperty(Qt,"__esModule",{value:!0});Qt.onPrimitiveTypeSelect=Qt.onPrimitiveValueSelect=Qt.onTypedValueSelect=Qt.onTypeSelect=void 0;var sh=I4(je()),nS=aa(),iS=Oc(),sS=yi(),oS=Tc(),ih=Dc(),aS=Pc(),uS=Rc(),cS=Jf(),lS=ra(),fS=Ra(),hS=Zf(),dS=mt(),pS=Yf(),gS=Xf();function S4(t,e){if(t.hasExactClass(ih.OptionType.ClassName))return e.onOption();if(t.hasExactClass(ih.ListType.ClassName))return e.onList();if(t.hasExactClass(pS.ArrayVecType.ClassName))return e.onArray();if(t.hasClassOrSuperclass(dS.PrimitiveType.ClassName))return e.onPrimitive();if(t.hasExactClass(lS.StructType.ClassName))return e.onStruct();if(t.hasExactClass(hS.TupleType.ClassName))return e.onTuple();if(t.hasExactClass(oS.EnumType.ClassName))return e.onEnum();if(e.onOther)return e.onOther();throw new sh.ErrTypingSystem(`type isn't known: ${t}`)}Qt.onTypeSelect=S4;function C4(t,e){if(t.hasClassOrSuperclass(dS.PrimitiveValue.ClassName))return e.onPrimitive();if(t.hasExactClass(ih.OptionValue.ClassName))return e.onOption();if(t.hasExactClass(ih.List.ClassName))return e.onList();if(t.hasExactClass(pS.ArrayVec.ClassName))return e.onArray();if(t.hasExactClass(lS.Struct.ClassName))return e.onStruct();if(t.hasExactClass(hS.Tuple.ClassName))return e.onTuple();if(t.hasExactClass(oS.EnumValue.ClassName))return e.onEnum();if(e.onOther)return e.onOther();throw new sh.ErrTypingSystem(`value isn't typed: ${t}`)}Qt.onTypedValueSelect=C4;function T4(t,e){if(t.hasExactClass(iS.BooleanValue.ClassName))return e.onBoolean();if(t.hasClassOrSuperclass(uS.NumericalValue.ClassName))return e.onNumerical();if(t.hasExactClass(nS.AddressValue.ClassName))return e.onAddress();if(t.hasExactClass(sS.BytesValue.ClassName))return e.onBytes();if(t.hasExactClass(gS.StringValue.ClassName))return e.onString();if(t.hasExactClass(aS.H256Value.ClassName))return e.onH256();if(t.hasExactClass(fS.TokenIdentifierValue.ClassName))return e.onTypeIdentifier();if(t.hasExactClass(cS.NothingValue.ClassName))return e.onNothing();if(e.onOther)return e.onOther();throw new sh.ErrTypingSystem(`value isn't a primitive: ${t.getType()}`)}Qt.onPrimitiveValueSelect=T4;function x4(t,e){if(t.hasExactClass(iS.BooleanType.ClassName))return e.onBoolean();if(t.hasClassOrSuperclass(uS.NumericalType.ClassName))return e.onNumerical();if(t.hasExactClass(nS.AddressType.ClassName))return e.onAddress();if(t.hasExactClass(sS.BytesType.ClassName))return e.onBytes();if(t.hasExactClass(gS.StringType.ClassName))return e.onString();if(t.hasExactClass(aS.H256Type.ClassName))return e.onH256();if(t.hasExactClass(fS.TokenIdentifierType.ClassName))return e.onTokenIndetifier();if(t.hasExactClass(cS.NothingType.ClassName))return e.onNothing();if(e.onOther)return e.onOther();throw new sh.ErrTypingSystem(`type isn't a known primitive: ${t}`)}Qt.onPrimitiveTypeSelect=x4});var Tt=w(Ue=>{"use strict";c();var N4=Ue&&Ue.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Xe=Ue&&Ue.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&N4(e,t,r)};Object.defineProperty(Ue,"__esModule",{value:!0});Xe(eS(),Ue);Xe(aa(),Ue);Xe(zf(),Ue);Xe(Oc(),Ue);Xe(yi(),Ue);Xe(Kf(),Ue);Xe(um(),Ue);Xe(Tc(),Ue);Xe(rS(),Ue);Xe(Xo(),Ue);Xe(Dc(),Ue);Xe(Yf(),Ue);Xe(Pc(),Ue);Xe(yS(),Ue);Xe(Jf(),Ue);Xe(Rc(),Ue);Xe(Xf(),Ue);Xe(ra(),Ue);Xe(Ra(),Ue);Xe(Zf(),Ue);Xe(Mf(),Ue);Xe(Im(),Ue);Xe(mt(),Ue);Xe(th(),Ue)});var wS=w(on=>{"use strict";c();var O4=on&&on.__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]}),D4=on&&on.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),P4=on&&on.__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)&&O4(e,t,r);return D4(e,t),e};Object.defineProperty(on,"__esModule",{value:!0});on.OptionValueBinaryCodec=void 0;var mS=P4(je()),oh=Tt(),Cm=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){if(e[0]==0)return[oh.OptionValue.newMissingTyped(r),1];if(e[0]!=1)throw new mS.ErrCodec("invalid buffer for optional value");let[n,i]=this.binaryCodec.decodeNested(e.slice(1),r);return[oh.OptionValue.newProvided(n),i+1]}decodeTopLevel(e,r){if(e.length==0)return new oh.OptionValue(r);if(e[0]!=1)throw new mS.ErrCodec("invalid buffer for optional value");let[n,i]=this.binaryCodec.decodeNested(e.slice(1),r);return new oh.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([])}};on.OptionValueBinaryCodec=Cm});var ES=w(ah=>{"use strict";c();Object.defineProperty(ah,"__esModule",{value:!0});ah.AddressBinaryCodec=void 0;var R4=tr(),B4=Tt(),Tm=class{decodeNested(e){let r=e.slice(0,32),n=new R4.Address(r);return[new B4.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()}};ah.AddressBinaryCodec=Tm});var AS=w(an=>{"use strict";c();var L4=an&&an.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),F4=an&&an.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),M4=an&&an.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&L4(e,t,r);return F4(e,t),e};Object.defineProperty(an,"__esModule",{value:!0});an.BooleanBinaryCodec=void 0;var U4=M4(je()),vS=Tt(),Br=class{decodeNested(e){let r=e.readUInt8(0);return[new vS.BooleanValue(r==Br.TRUE),1]}decodeTopLevel(e){if(e.length>1)throw new U4.ErrInvalidArgument("buffer should be of size <= 1");let r=e[0];return new vS.BooleanValue(r==Br.TRUE)}encodeNested(e){return e.isTrue()?h.Buffer.from([Br.TRUE]):h.Buffer.from([Br.FALSE])}encodeTopLevel(e){return e.isTrue()?h.Buffer.from([Br.TRUE]):h.Buffer.from([])}};an.BooleanBinaryCodec=Br;Br.TRUE=1;Br.FALSE=0});var ch=w(uh=>{"use strict";c();Object.defineProperty(uh,"__esModule",{value:!0});uh.SizeOfU32=void 0;uh.SizeOfU32=4});var xm=w(un=>{"use strict";c();var q4=un&&un.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(un,"__esModule",{value:!0});un.zeroPadStringIfOddLength=un.isPaddedHex=un.numberToPaddedHex=void 0;var V4=q4(Yt());function j4(t){let e=new V4.default(t).toString(16);return bS(e)}un.numberToPaddedHex=j4;function H4(t){t=t||"";let e=h.Buffer.from(t,"hex").toString("hex");return t.toUpperCase()==e.toUpperCase()}un.isPaddedHex=H4;function bS(t){return t=t||"",t.length%2==1?"0"+t:t}un.zeroPadStringIfOddLength=bS});var lh=w(wt=>{"use strict";c();var G4=wt&&wt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(wt,"__esModule",{value:!0});wt.prependByteToBuffer=wt.flipBufferBitsInPlace=wt.getHexMagnitudeOfBigInt=wt.bigIntToBuffer=wt.bufferToBigInt=wt.cloneBuffer=wt.isMsbZero=wt.isMsbOne=void 0;var Nm=G4(Yt()),Q4=xm();function _S(t,e=0){return t[e]>>7==1}wt.isMsbOne=_S;function k4(t,e=0){return!_S(t,e)}wt.isMsbZero=k4;function z4(t){let e=h.Buffer.alloc(t.length);return t.copy(e),e}wt.cloneBuffer=z4;function W4(t){let e=t.toString("hex");return new Nm.default(`0x${e}`,16)}wt.bufferToBigInt=W4;function K4(t){let e=IS(t);return h.Buffer.from(e,"hex")}wt.bigIntToBuffer=K4;function IS(t){return t=new Nm.default(t),t?(t.isNegative()&&(t=t.multipliedBy(new Nm.default(-1))),Q4.numberToPaddedHex(t)):""}wt.getHexMagnitudeOfBigInt=IS;function $4(t){for(let e=0;e{"use strict";c();var J4=Ma&&Ma.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ma,"__esModule",{value:!0});Ma.NumericalBinaryCodec=void 0;var Lc=J4(Yt()),Om=Tt(),SS=ch(),ht=lh(),Dm=class{decodeNested(e,r){let n=0,i=r.sizeInBytes;i||(n=SS.SizeOfU32,i=e.readUInt32BE(0));let s=e.slice(n,n+i),o=this.decodeTopLevel(s,r),a=i+n;return[o,a]}decodeTopLevel(e,r){let n=ht.cloneBuffer(e);if(e.length==0)return new Om.NumericalValue(r,new Lc.default(0));if(!r.withSign||ht.isMsbZero(n)){let l=ht.bufferToBigInt(n);return new Om.NumericalValue(r,l)}ht.flipBufferBitsInPlace(n);let u=ht.bufferToBigInt(n).multipliedBy(new Lc.default(-1)).minus(new Lc.default(1));return new Om.NumericalValue(r,u)}encodeNested(e){if(e.sizeInBytes)return this.encodeNestedFixedSize(e,e.sizeInBytes);let r=this.encodeTopLevel(e),n=h.Buffer.alloc(SS.SizeOfU32);return n.writeUInt32BE(r.length),h.Buffer.concat([n,r])}encodeNestedFixedSize(e,r){if(e.value.isZero())return h.Buffer.alloc(r,0);if(!e.withSign){let o=ht.bigIntToBuffer(e.value),a=h.Buffer.alloc(r-o.length,0);return h.Buffer.concat([a,o])}if(e.value.isPositive()){let o=ht.bigIntToBuffer(e.value);ht.isMsbOne(o)&&(o=ht.prependByteToBuffer(o,0));let a=h.Buffer.alloc(r-o.length,0);return h.Buffer.concat([a,o])}let n=e.value.plus(new Lc.default(1)),i=ht.bigIntToBuffer(n);ht.flipBufferBitsInPlace(i),ht.isMsbZero(i)&&(i=ht.prependByteToBuffer(i,255));let s=h.Buffer.alloc(r-i.length,255);return h.Buffer.concat([s,i])}encodeTopLevel(e){let r=e.withSign;return e.value.isZero()?h.Buffer.alloc(0):r?this.encodePrimitive(e):ht.bigIntToBuffer(e.value)}encodePrimitive(e){if(e.value.isPositive()){let i=ht.bigIntToBuffer(e.value);return ht.isMsbOne(i)&&(i=ht.prependByteToBuffer(i,0)),i}let r=e.value.plus(new Lc.default(1)),n=ht.bigIntToBuffer(r);return ht.flipBufferBitsInPlace(n),ht.isMsbZero(n)&&(n=ht.prependByteToBuffer(n,255)),n}};Ma.NumericalBinaryCodec=Dm});var TS=w(fh=>{"use strict";c();Object.defineProperty(fh,"__esModule",{value:!0});fh.H256BinaryCodec=void 0;var X4=Pc(),Pm=class{decodeNested(e){let r=e.slice(0,32);return[new X4.H256Value(r),32]}decodeTopLevel(e){let[r,n]=this.decodeNested(e);return r}encodeNested(e){return e.valueOf()}encodeTopLevel(e){return e.valueOf()}};fh.H256BinaryCodec=Pm});var ph=w(dh=>{"use strict";c();Object.defineProperty(dh,"__esModule",{value:!0});dh.BytesBinaryCodec=void 0;var xS=yi(),hh=ch(),Rm=class{decodeNested(e){let r=e.readUInt32BE(0),n=e.slice(hh.SizeOfU32,hh.SizeOfU32+r);return[new xS.BytesValue(n),hh.SizeOfU32+r]}decodeTopLevel(e){return new xS.BytesValue(e)}encodeNested(e){let r=h.Buffer.alloc(hh.SizeOfU32);return r.writeUInt32BE(e.getLength()),h.Buffer.concat([r,e.valueOf()])}encodeTopLevel(e){return e.valueOf()}};dh.BytesBinaryCodec=Rm});var OS=w(gh=>{"use strict";c();Object.defineProperty(gh,"__esModule",{value:!0});gh.TokenIdentifierCodec=void 0;var Z4=yi(),NS=Ra(),eU=ph(),Bm=class{constructor(){this.bytesCodec=new eU.BytesBinaryCodec}decodeNested(e){let[r,n]=this.bytesCodec.decodeNested(e);return[new NS.TokenIdentifierValue(r.toString()),n]}decodeTopLevel(e){let r=this.bytesCodec.decodeTopLevel(e);return new NS.TokenIdentifierValue(r.toString())}encodeNested(e){let r=Z4.BytesValue.fromUTF8(e.valueOf());return this.bytesCodec.encodeNested(r)}encodeTopLevel(e){return h.Buffer.from(e.valueOf())}};gh.TokenIdentifierCodec=Bm});var PS=w(yh=>{"use strict";c();Object.defineProperty(yh,"__esModule",{value:!0});yh.NothingCodec=void 0;var DS=Tt(),Lm=class{decodeNested(){return[new DS.NothingValue,0]}decodeTopLevel(){return new DS.NothingValue}encodeNested(){return h.Buffer.from([])}encodeTopLevel(){return h.Buffer.from([])}};yh.NothingCodec=Lm});var BS=w(mh=>{"use strict";c();Object.defineProperty(mh,"__esModule",{value:!0});mh.StringBinaryCodec=void 0;var RS=Tt(),tU=yi(),rU=ph(),Fm=class{constructor(){this.bytesBinaryCodec=new rU.BytesBinaryCodec}decodeNested(e){let[r,n]=this.bytesBinaryCodec.decodeNested(e);return[new RS.StringValue(r.valueOf().toString()),n]}decodeTopLevel(e){return new RS.StringValue(e.toString())}encodeNested(e){let r=tU.BytesValue.fromUTF8(e.valueOf());return this.bytesBinaryCodec.encodeNested(r)}encodeTopLevel(e){return h.Buffer.from(e.valueOf())}};mh.StringBinaryCodec=Fm});var LS=w(Eh=>{"use strict";c();Object.defineProperty(Eh,"__esModule",{value:!0});Eh.PrimitiveBinaryCodec=void 0;var wh=Tt(),nU=ES(),iU=AS(),sU=CS(),oU=TS(),aU=ph(),uU=OS(),cU=PS(),lU=BS(),Mm=class{constructor(e){this.binaryCodec=e,this.booleanCodec=new iU.BooleanBinaryCodec,this.numericalCodec=new sU.NumericalBinaryCodec,this.addressCodec=new nU.AddressBinaryCodec,this.h256Codec=new oU.H256BinaryCodec,this.bytesCodec=new aU.BytesBinaryCodec,this.stringCodec=new lU.StringBinaryCodec,this.tokenIdentifierCodec=new uU.TokenIdentifierCodec,this.nothingCodec=new cU.NothingCodec}decodeNested(e,r){return wh.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 wh.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 wh.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 wh.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()})}};Eh.PrimitiveBinaryCodec=Mm});var US=w(vh=>{"use strict";c();Object.defineProperty(vh,"__esModule",{value:!0});vh.ListBinaryCodec=void 0;var FS=Tt(),MS=ch(),Um=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=MS.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 FS.List(r,i)}encodeNested(e){this.binaryCodec.constraints.checkListLength(e.getLength());let r=h.Buffer.alloc(MS.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)}};vh.ListBinaryCodec=Um});var Vm=w(Ah=>{"use strict";c();Object.defineProperty(Ah,"__esModule",{value:!0});Ah.FieldsBinaryCodec=void 0;var fU=Tt(),qm=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 fU.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)}};Ah.FieldsBinaryCodec=qm});var Hm=w(bh=>{"use strict";c();Object.defineProperty(bh,"__esModule",{value:!0});bh.StructBinaryCodec=void 0;var hU=Tt(),dU=Vm(),jm=class{constructor(e){this.fieldsCodec=new dU.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 hU.Struct(r,i),s]}encodeNested(e){let r=e.getFields();return this.fieldsCodec.encodeNested(r)}encodeTopLevel(e){return this.encodeNested(e)}};bh.StructBinaryCodec=jm});var qS=w(Ih=>{"use strict";c();Object.defineProperty(Ih,"__esModule",{value:!0});Ih.EnumBinaryCodec=void 0;var _h=Tt(),pU=Vm(),Gm=class{constructor(e){this.binaryCodec=e,this.fieldsCodec=new pU.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 _h.EnumValue(r,s,a),i+u]}readDiscriminant(e){let[r,n]=this.binaryCodec.decodeNested(e,new _h.U8Type);return[r.valueOf(),n]}encodeNested(e){let r=new _h.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 _h.U8Value(e.discriminant),o=n?this.binaryCodec.encodeNested(s):this.binaryCodec.encodeTopLevel(s);return h.Buffer.concat([o,i])}};Ih.EnumBinaryCodec=Gm});var VS=w(Sh=>{"use strict";c();Object.defineProperty(Sh,"__esModule",{value:!0});Sh.TupleBinaryCodec=void 0;var gU=Hm(),Qm=class{constructor(e){this.structCodec=new gU.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)}};Sh.TupleBinaryCodec=Qm});var jS=w(Ch=>{"use strict";c();Object.defineProperty(Ch,"__esModule",{value:!0});Ch.ArrayVecBinaryCodec=void 0;var yU=Tt(),km=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){let n=r.length,i=r.getFirstTypeParameter(),s=[],o=0;for(let a=0;a{"use strict";c();var mU=wr&&wr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),wU=wr&&wr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),EU=wr&&wr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&mU(e,t,r);return wU(e,t),e};Object.defineProperty(wr,"__esModule",{value:!0});wr.BinaryCodecConstraints=wr.BinaryCodec=void 0;var HS=EU(je()),Th=Tt(),GS=gr(),vU=wS(),AU=LS(),bU=US(),_U=Hm(),IU=qS(),SU=VS(),CU=jS(),zm=class{constructor(e=null){this.constraints=e||new xh,this.optionCodec=new vU.OptionValueBinaryCodec(this),this.listCodec=new bU.ListBinaryCodec(this),this.arrayCodec=new CU.ArrayVecBinaryCodec(this),this.primitiveCodec=new AU.PrimitiveBinaryCodec(this),this.structCodec=new _U.StructBinaryCodec(this),this.tupleCodec=new SU.TupleBinaryCodec(this),this.enumCodec=new IU.EnumBinaryCodec(this)}decodeTopLevel(e,r){return this.constraints.checkBufferLength(e),Th.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]=Th.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 GS.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),Th.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 GS.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),Th.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)})}};wr.BinaryCodec=zm;var xh=class{constructor(e){this.maxBufferLength=e?.maxBufferLength||256e3,this.maxListLength=e?.maxListLength||128e3}checkBufferLength(e){if(e.length>this.maxBufferLength)throw new HS.ErrCodec(`Buffer too large: ${e.length} > ${this.maxBufferLength}`)}checkListLength(e){if(e>this.maxListLength)throw new HS.ErrCodec(`List too large: ${e} > ${this.maxListLength}`)}};wr.BinaryCodecConstraints=xh});var QS=w(Er=>{"use strict";c();var TU=Er&&Er.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Er,"__esModule",{value:!0});Er.decodeBigNumber=Er.decodeString=Er.decodeBool=Er.decodeUnsignedNumber=void 0;var xU=TU(Yt()),Nh=Tt(),NU=Wm(),Oh=new NU.BinaryCodec;function OU(t){let e=Oh.decodeTopLevel(t,new Nh.BigUIntType);return Number(e.valueOf())}Er.decodeUnsignedNumber=OU;function DU(t){return!!Oh.decodeTopLevel(t,new Nh.BooleanType).valueOf()}Er.decodeBool=DU;function PU(t){let e=Oh.decodeTopLevel(t,new Nh.BytesType);return String(e.valueOf())}Er.decodeString=PU;function RU(t){let e=Oh.decodeTopLevel(t,new Nh.BigUIntType);return new xU.default(e.valueOf())}Er.decodeBigNumber=RU});var zS=w(_i=>{"use strict";c();var BU=_i&&_i.__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]}),kS=_i&&_i.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&BU(e,t,r)};Object.defineProperty(_i,"__esModule",{value:!0});kS(Wm(),_i);kS(QS(),_i)});var Ph=w(Dh=>{"use strict";c();Object.defineProperty(Dh,"__esModule",{value:!0});Dh.ArgSerializer=void 0;var WS=Go(),LU=zS(),Km=zf(),$m=Kf(),Ym=th(),FU={codec:new LU.BinaryCodec},Jm=class{constructor(e){e=Object.assign(Object.assign({},FU),e),this.codec=e.codec}stringToValues(e,r){let n=this.stringToBuffers(e);return this.buffersToValues(n,r)}stringToBuffers(e){return e.split(WS.ARGUMENTS_SEPARATOR).map(r=>h.Buffer.from(r,"hex"))}buffersToValues(e,r){let n=this;e=e||[];let i=[],s=0,o=e.length;for(let f=0;f=o}return i}valuesToString(e){let r=this.valuesToStrings(e),n=r.join(WS.ARGUMENTS_SEPARATOR),i=r.length;return{argumentsString:n,count:i}}valuesToStrings(e){return this.valuesToBuffers(e).map(i=>i.toString("hex"))}valuesToBuffers(e){let r=this,n=[];for(let s of e)i(s);function i(s){if(s.hasExactClass(Km.OptionalValue.ClassName)){let o=s;o.isSet()&&i(o.getTypedValue())}else if(s.hasExactClass(Ym.VariadicValue.ClassName)){let o=s;for(let a of o.getItems())i(a)}else if(s.hasExactClass($m.CompositeValue.ClassName)){let o=s;for(let a of o.getItems())i(a)}else{let o=r.codec.encodeTopLevel(s);n.push(o)}}return n}};Dh.ArgSerializer=Jm});var Lh=w(Bh=>{"use strict";c();Object.defineProperty(Bh,"__esModule",{value:!0});Bh.Compatibility=void 0;var MU=tr(),Rh=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()==MU.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.`))}};Bh.Compatibility=Rh;Rh.areWarningsEnabled=!0});var KS=w(cn=>{"use strict";c();var UU=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]}),qU=cn&&cn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VU=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)&&UU(e,t,r);return qU(e,t),e};Object.defineProperty(cn,"__esModule",{value:!0});cn.Hash=void 0;var jU=VU(je()),Fc=class{constructor(e){if(!e)this.hash=h.Buffer.from([]);else if(e instanceof h.Buffer)this.hash=e;else if(typeof e=="string")this.hash=h.Buffer.from(e,"hex");else throw new jU.ErrBadType("hash","buffer | string",e)}static empty(){return new Fc(h.Buffer.from([]))}isEmpty(){return this.hash.length==0}toString(){return this.hex()}hex(){return this.hash.toString("hex")}valueOf(){return this.hash}};cn.Hash=Fc});var YS=w(vr=>{"use strict";c();var HU=vr&&vr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),GU=vr&&vr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QU=vr&&vr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&HU(e,t,r);return GU(e,t),e};Object.defineProperty(vr,"__esModule",{value:!0});vr.TransactionOptions=vr.TransactionVersion=void 0;var Lr=Go(),$S=QU(je()),Ua=class{constructor(e){if(e=Number(e),e<1)throw new $S.ErrTransactionVersionInvalid(e);this.value=e}static withDefaultVersion(){return new Ua(Lr.TRANSACTION_VERSION_DEFAULT)}static withTxOptions(){return new Ua(Lr.TRANSACTION_VERSION_WITH_OPTIONS)}valueOf(){return this.value}};vr.TransactionVersion=Ua;var qa=class{constructor(e){if(e=Number(e),e<0)throw new $S.ErrTransactionOptionsInvalid(e);this.value=e}static withDefaultOptions(){return new qa(Lr.TRANSACTION_OPTIONS_DEFAULT)}static withOptions(e){let r=0;return e.hashSign&&(r|=Lr.TRANSACTION_OPTIONS_TX_HASH_SIGN),e.guarded&&(r|=Lr.TRANSACTION_OPTIONS_TX_GUARDED),new qa(r)}isWithHashSign(){return(this.value&Lr.TRANSACTION_OPTIONS_TX_HASH_SIGN)==Lr.TRANSACTION_OPTIONS_TX_HASH_SIGN}isWithGuardian(){return(this.value&Lr.TRANSACTION_OPTIONS_TX_GUARDED)==Lr.TRANSACTION_OPTIONS_TX_GUARDED}setWithHashSign(){this.value|=Lr.TRANSACTION_OPTIONS_TX_HASH_SIGN}setWithGuardian(){this.value|=Lr.TRANSACTION_OPTIONS_TX_GUARDED}valueOf(){return this.value}};vr.TransactionOptions=qa});var XS=w((iie,JS)=>{"use strict";c();JS.exports=kU;function kU(t,e){for(var r=new Array(arguments.length-1),n=0,i=2,s=!0;i{"use strict";c();var Fh=tC;Fh.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 Va=new Array(64),eC=new Array(123);for(Fr=0;Fr<64;)eC[Va[Fr]=Fr<26?Fr+65:Fr<52?Fr+71:Fr<62?Fr-4:Fr-59|43]=Fr++;var Fr;Fh.encode=function(e,r,n){for(var i=null,s=[],o=0,a=0,u;r>2],u=(l&3)<<4,a=1;break;case 1:s[o++]=Va[u|l>>4],u=(l&15)<<2,a=2;break;case 2:s[o++]=Va[u|l>>6],s[o++]=Va[l&63],a=0;break}o>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,s)),o=0)}return a&&(s[o++]=Va[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 ZS="invalid encoding";Fh.decode=function(e,r,n){for(var i=n,s=0,o,a=0;a1)break;if((u=eC[u])===void 0)throw Error(ZS);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(ZS);return n-i};Fh.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var iC=w((uie,nC)=>{"use strict";c();nC.exports=Mh;function Mh(){this._listeners={}}Mh.prototype.on=function(e,r,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:r,ctx:n||this}),this};Mh.prototype.off=function(e,r){if(e===void 0)this._listeners={};else if(r===void 0)this._listeners[e]=[];else for(var n=this._listeners[e],i=0;i{"use strict";c();lC.exports=sC(sC);function sC(t){return typeof Float32Array<"u"?function(){var e=new Float32Array([-0]),r=new Uint8Array(e.buffer),n=r[3]===128;function i(u,l,f){e[0]=u,l[f]=r[0],l[f+1]=r[1],l[f+2]=r[2],l[f+3]=r[3]}function s(u,l,f){e[0]=u,l[f]=r[3],l[f+1]=r[2],l[f+2]=r[1],l[f+3]=r[0]}t.writeFloatLE=n?i:s,t.writeFloatBE=n?s:i;function o(u,l){return r[0]=u[l],r[1]=u[l+1],r[2]=u[l+2],r[3]=u[l+3],e[0]}function a(u,l){return r[3]=u[l],r[2]=u[l+1],r[1]=u[l+2],r[0]=u[l+3],e[0]}t.readFloatLE=n?o:a,t.readFloatBE=n?a:o}():function(){function e(n,i,s,o){var a=i<0?1:0;if(a&&(i=-i),i===0)n(1/i>0?0:2147483648,s,o);else if(isNaN(i))n(2143289344,s,o);else if(i>34028234663852886e22)n((a<<31|2139095040)>>>0,s,o);else if(i<11754943508222875e-54)n((a<<31|Math.round(i/1401298464324817e-60))>>>0,s,o);else{var u=Math.floor(Math.log(i)/Math.LN2),l=Math.round(i*Math.pow(2,-u)*8388608)&8388607;n((a<<31|u+127<<23|l)>>>0,s,o)}}t.writeFloatLE=e.bind(null,oC),t.writeFloatBE=e.bind(null,aC);function r(n,i,s){var o=n(i,s),a=(o>>31)*2+1,u=o>>>23&255,l=o&8388607;return u===255?l?NaN:a*(1/0):u===0?a*1401298464324817e-60*l:a*Math.pow(2,u-150)*(l+8388608)}t.readFloatLE=r.bind(null,uC),t.readFloatBE=r.bind(null,cC)}(),typeof Float64Array<"u"?function(){var e=new Float64Array([-0]),r=new Uint8Array(e.buffer),n=r[7]===128;function i(u,l,f){e[0]=u,l[f]=r[0],l[f+1]=r[1],l[f+2]=r[2],l[f+3]=r[3],l[f+4]=r[4],l[f+5]=r[5],l[f+6]=r[6],l[f+7]=r[7]}function s(u,l,f){e[0]=u,l[f]=r[7],l[f+1]=r[6],l[f+2]=r[5],l[f+3]=r[4],l[f+4]=r[3],l[f+5]=r[2],l[f+6]=r[1],l[f+7]=r[0]}t.writeDoubleLE=n?i:s,t.writeDoubleBE=n?s:i;function o(u,l){return r[0]=u[l],r[1]=u[l+1],r[2]=u[l+2],r[3]=u[l+3],r[4]=u[l+4],r[5]=u[l+5],r[6]=u[l+6],r[7]=u[l+7],e[0]}function a(u,l){return r[7]=u[l],r[6]=u[l+1],r[5]=u[l+2],r[4]=u[l+3],r[3]=u[l+4],r[2]=u[l+5],r[1]=u[l+6],r[0]=u[l+7],e[0]}t.readDoubleLE=n?o:a,t.readDoubleBE=n?a:o}():function(){function e(n,i,s,o,a,u){var l=o<0?1:0;if(l&&(o=-o),o===0)n(0,a,u+i),n(1/o>0?0:2147483648,a,u+s);else if(isNaN(o))n(0,a,u+i),n(2146959360,a,u+s);else if(o>17976931348623157e292)n(0,a,u+i),n((l<<31|2146435072)>>>0,a,u+s);else{var f;if(o<22250738585072014e-324)f=o/5e-324,n(f>>>0,a,u+i),n((l<<31|f/4294967296)>>>0,a,u+s);else{var d=Math.floor(Math.log(o)/Math.LN2);d===1024&&(d=1023),f=o*Math.pow(2,-d),n(f*4503599627370496>>>0,a,u+i),n((l<<31|d+1023<<20|f*1048576&1048575)>>>0,a,u+s)}}}t.writeDoubleLE=e.bind(null,oC,0,4),t.writeDoubleBE=e.bind(null,aC,4,0);function r(n,i,s,o,a){var u=n(o,a+i),l=n(o,a+s),f=(l>>31)*2+1,d=l>>>20&2047,y=4294967296*(l&1048575)+u;return d===2047?y?NaN:f*(1/0):d===0?f*5e-324*y:f*Math.pow(2,d-1075)*(y+4503599627370496)}t.readDoubleLE=r.bind(null,uC,0,4),t.readDoubleBE=r.bind(null,cC,4,0)}(),t}function oC(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 aC(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 uC(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0}function cC(t,e){return(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}});var hC=w((exports,module)=>{"use strict";c();module.exports=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(t){}return null}});var pC=w(dC=>{"use strict";c();var Xm=dC;Xm.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))};Xm.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 yC=w((gie,gC)=>{"use strict";c();gC.exports=zU;function zU(t,e,r){var n=r||8192,i=n>>>1,s=null,o=n;return function(u){if(u<1||u>i)return t(u);o+u>n&&(s=t(n),o=0);var l=e.call(s,o,o+=u);return o&7&&(o=(o|7)+1),l}}});var wC=w((mie,mC)=>{"use strict";c();mC.exports=xt;var Mc=Si();function xt(t,e){this.lo=t>>>0,this.hi=e>>>0}var $s=xt.zero=new xt(0,0);$s.toNumber=function(){return 0};$s.zzEncode=$s.zzDecode=function(){return this};$s.length=function(){return 1};var WU=xt.zeroHash="\0\0\0\0\0\0\0\0";xt.fromNumber=function(e){if(e===0)return $s;var r=e<0;r&&(e=-e);var n=e>>>0,i=(e-n)/4294967296>>>0;return r&&(i=~i>>>0,n=~n>>>0,++n>4294967295&&(n=0,++i>4294967295&&(i=0))),new xt(n,i)};xt.from=function(e){if(typeof e=="number")return xt.fromNumber(e);if(Mc.isString(e))if(Mc.Long)e=Mc.Long.fromString(e);else return xt.fromNumber(parseInt(e,10));return e.low||e.high?new xt(e.low>>>0,e.high>>>0):$s};xt.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var r=~this.lo+1>>>0,n=~this.hi>>>0;return r||(n=n+1>>>0),-(r+n*4294967296)}return this.lo+this.hi*4294967296};xt.prototype.toLong=function(e){return Mc.Long?new Mc.Long(this.lo|0,this.hi|0,!!e):{low:this.lo|0,high:this.hi|0,unsigned:!!e}};var Ii=String.prototype.charCodeAt;xt.fromHash=function(e){return e===WU?$s:new xt((Ii.call(e,0)|Ii.call(e,1)<<8|Ii.call(e,2)<<16|Ii.call(e,3)<<24)>>>0,(Ii.call(e,4)|Ii.call(e,5)<<8|Ii.call(e,6)<<16|Ii.call(e,7)<<24)>>>0)};xt.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)};xt.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this};xt.prototype.zzDecode=function(){var e=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this};xt.prototype.length=function(){var e=this.lo,r=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?r===0?e<16384?e<128?1:2:e<2097152?3:4:r<16384?r<128?5:6:r<2097152?7:8:n<128?9:10}});var Si=w(Zm=>{"use strict";c();var me=Zm;me.asPromise=XS();me.base64=rC();me.EventEmitter=iC();me.float=fC();me.inquire=hC();me.utf8=pC();me.pool=yC();me.LongBits=wC();me.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);me.global=me.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||Zm;me.emptyArray=Object.freeze?Object.freeze([]):[];me.emptyObject=Object.freeze?Object.freeze({}):{};me.isInteger=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};me.isString=function(e){return typeof e=="string"||e instanceof String};me.isObject=function(e){return e&&typeof e=="object"};me.isset=me.isSet=function(e,r){var n=e[r];return n!=null&&e.hasOwnProperty(r)?typeof n!="object"||(Array.isArray(n)?n.length:Object.keys(n).length)>0:!1};me.Buffer=function(){try{var t=me.inquire("buffer").Buffer;return t.prototype.utf8Write?t:null}catch{return null}}();me._Buffer_from=null;me._Buffer_allocUnsafe=null;me.newBuffer=function(e){return typeof e=="number"?me.Buffer?me._Buffer_allocUnsafe(e):new me.Array(e):me.Buffer?me._Buffer_from(e):typeof Uint8Array>"u"?e:new Uint8Array(e)};me.Array=typeof Uint8Array<"u"?Uint8Array:Array;me.Long=me.global.dcodeIO&&me.global.dcodeIO.Long||me.global.Long||me.inquire("long");me.key2Re=/^true|false|0|1$/;me.key32Re=/^-?(?:0|[1-9][0-9]*)$/;me.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;me.longToHash=function(e){return e?me.LongBits.from(e).toHash():me.LongBits.zeroHash};me.longFromHash=function(e,r){var n=me.LongBits.fromHash(e);return me.Long?me.Long.fromBits(n.lo,n.hi,r):n.toNumber(!!r)};function EC(t,e,r){for(var n=Object.keys(e),i=0;i-1;--s)if(r[i[s]]===1&&this[i[s]]!==void 0&&this[i[s]]!==null)return i[s]}};me.oneOfSetter=function(e){return function(r){for(var n=0;n{"use strict";c();IC.exports=Le;var Ar=Si(),ew,Uh=Ar.LongBits,AC=Ar.base64,bC=Ar.utf8;function Uc(t,e,r){this.fn=t,this.len=e,this.next=void 0,this.val=r}function rw(){}function KU(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}function Le(){this.len=0,this.head=new Uc(rw,0,0),this.tail=this.head,this.states=null}var _C=function(){return Ar.Buffer?function(){return(Le.create=function(){return new ew})()}:function(){return new Le}};Le.create=_C();Le.alloc=function(e){return new Ar.Array(e)};Ar.Array!==Array&&(Le.alloc=Ar.pool(Le.alloc,Ar.Array.prototype.subarray));Le.prototype._push=function(e,r,n){return this.tail=this.tail.next=new Uc(e,r,n),this.len+=r,this};function nw(t,e,r){e[r]=t&255}function $U(t,e,r){for(;t>127;)e[r++]=t&127|128,t>>>=7;e[r]=t}function iw(t,e){this.len=t,this.next=void 0,this.val=e}iw.prototype=Object.create(Uc.prototype);iw.prototype.fn=$U;Le.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new iw((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this};Le.prototype.int32=function(e){return e<0?this._push(sw,10,Uh.fromNumber(e)):this.uint32(e)};Le.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function sw(t,e,r){for(;t.hi;)e[r++]=t.lo&127|128,t.lo=(t.lo>>>7|t.hi<<25)>>>0,t.hi>>>=7;for(;t.lo>127;)e[r++]=t.lo&127|128,t.lo=t.lo>>>7;e[r++]=t.lo}Le.prototype.uint64=function(e){var r=Uh.from(e);return this._push(sw,r.length(),r)};Le.prototype.int64=Le.prototype.uint64;Le.prototype.sint64=function(e){var r=Uh.from(e).zzEncode();return this._push(sw,r.length(),r)};Le.prototype.bool=function(e){return this._push(nw,1,e?1:0)};function tw(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}Le.prototype.fixed32=function(e){return this._push(tw,4,e>>>0)};Le.prototype.sfixed32=Le.prototype.fixed32;Le.prototype.fixed64=function(e){var r=Uh.from(e);return this._push(tw,4,r.lo)._push(tw,4,r.hi)};Le.prototype.sfixed64=Le.prototype.fixed64;Le.prototype.float=function(e){return this._push(Ar.float.writeFloatLE,4,e)};Le.prototype.double=function(e){return this._push(Ar.float.writeDoubleLE,8,e)};var YU=Ar.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(nw,1,0);if(Ar.isString(e)){var n=Le.alloc(r=AC.length(e));AC.decode(e,n,0),e=n}return this.uint32(r)._push(YU,r,e)};Le.prototype.string=function(e){var r=bC.length(e);return r?this.uint32(r)._push(bC.write,r,e):this._push(nw,1,0)};Le.prototype.fork=function(){return this.states=new KU(this),this.head=this.tail=new Uc(rw,0,0),this.len=0,this};Le.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new Uc(rw,0,0),this.len=0),this};Le.prototype.ldelim=function(){var e=this.head,r=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=e.next,this.tail=r,this.len+=n),this};Le.prototype.finish=function(){for(var e=this.head.next,r=this.constructor.alloc(this.len),n=0;e;)e.fn(e.val,r,n),n+=e.len,e=e.next;return r};Le._configure=function(t){ew=t,Le.create=_C(),ew._configure()}});var TC=w((_ie,CC)=>{"use strict";c();CC.exports=ln;var SC=ow();(ln.prototype=Object.create(SC.prototype)).constructor=ln;var Ci=Si();function ln(){SC.call(this)}ln._configure=function(){ln.alloc=Ci._Buffer_allocUnsafe,ln.writeBytesBuffer=Ci.Buffer&&Ci.Buffer.prototype instanceof Uint8Array&&Ci.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(ln.writeBytesBuffer,r,e),this};function JU(t,e,r){t.length<40?Ci.utf8.write(t,e,r):e.utf8Write?e.utf8Write(t,r):e.write(t,r)}ln.prototype.string=function(e){var r=Ci.Buffer.byteLength(e);return this.uint32(r),r&&this._push(JU,r,e),this};ln._configure()});var cw=w((Sie,PC)=>{"use strict";c();PC.exports=dt;var fn=Si(),uw,OC=fn.LongBits,XU=fn.utf8;function Mr(t,e){return RangeError("index out of range: "+t.pos+" + "+(e||1)+" > "+t.len)}function dt(t){this.buf=t,this.pos=0,this.len=t.length}var xC=typeof Uint8Array<"u"?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new dt(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new dt(e);throw Error("illegal buffer")},DC=function(){return fn.Buffer?function(r){return(dt.create=function(i){return fn.Buffer.isBuffer(i)?new uw(i):xC(i)})(r)}:xC};dt.create=DC();dt.prototype._slice=fn.Array.prototype.subarray||fn.Array.prototype.slice;dt.prototype.uint32=function(){var e=4294967295;return function(){if(e=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(e=(e|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,Mr(this,10);return e}}();dt.prototype.int32=function(){return this.uint32()|0};dt.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(e&1)|0};function aw(){var t=new OC(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 Mr(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 Mr(this);if(t.hi=(t.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}dt.prototype.bool=function(){return this.uint32()!==0};function qh(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}dt.prototype.fixed32=function(){if(this.pos+4>this.len)throw Mr(this,4);return qh(this.buf,this.pos+=4)};dt.prototype.sfixed32=function(){if(this.pos+4>this.len)throw Mr(this,4);return qh(this.buf,this.pos+=4)|0};function NC(){if(this.pos+8>this.len)throw Mr(this,8);return new OC(qh(this.buf,this.pos+=4),qh(this.buf,this.pos+=4))}dt.prototype.float=function(){if(this.pos+4>this.len)throw Mr(this,4);var e=fn.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};dt.prototype.double=function(){if(this.pos+8>this.len)throw Mr(this,4);var e=fn.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e};dt.prototype.bytes=function(){var e=this.uint32(),r=this.pos,n=this.pos+e;if(n>this.len)throw Mr(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(r,n):r===n?new this.buf.constructor(0):this._slice.call(this.buf,r,n)};dt.prototype.string=function(){var e=this.bytes();return XU.read(e,0,e.length)};dt.prototype.skip=function(e){if(typeof e=="number"){if(this.pos+e>this.len)throw Mr(this,e);this.pos+=e}else do if(this.pos>=this.len)throw Mr(this);while(this.buf[this.pos++]&128);return this};dt.prototype.skipType=function(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(t=this.uint32()&7)!==4;)this.skipType(t);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+t+" at offset "+this.pos)}return this};dt._configure=function(t){uw=t,dt.create=DC(),uw._configure();var e=fn.Long?"toLong":"toNumber";fn.merge(dt.prototype,{int64:function(){return aw.call(this)[e](!1)},uint64:function(){return aw.call(this)[e](!0)},sint64:function(){return aw.call(this).zzDecode()[e](!1)},fixed64:function(){return NC.call(this)[e](!0)},sfixed64:function(){return NC.call(this)[e](!1)}})}});var FC=w((Tie,LC)=>{"use strict";c();LC.exports=Ys;var BC=cw();(Ys.prototype=Object.create(BC.prototype)).constructor=Ys;var RC=Si();function Ys(t){BC.call(this,t)}Ys._configure=function(){RC.Buffer&&(Ys.prototype._slice=RC.Buffer.prototype.slice)};Ys.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))};Ys._configure()});var UC=w((Nie,MC)=>{"use strict";c();MC.exports=qc;var lw=Si();(qc.prototype=Object.create(lw.EventEmitter.prototype)).constructor=qc;function qc(t,e,r){if(typeof t!="function")throw TypeError("rpcImpl must be a function");lw.EventEmitter.call(this),this.rpcImpl=t,this.requestDelimited=!!e,this.responseDelimited=!!r}qc.prototype.rpcCall=function t(e,r,n,i,s){if(!i)throw TypeError("request must be specified");var o=this;if(!s)return lw.asPromise(t,o,e,r,n,i);if(!o.rpcImpl){setTimeout(function(){s(Error("already ended"))},0);return}try{return o.rpcImpl(e,r[o.requestDelimited?"encodeDelimited":"encode"](i).finish(),function(u,l){if(u)return o.emit("error",u,e),s(u);if(l===null){o.end(!0);return}if(!(l instanceof n))try{l=n[o.responseDelimited?"decodeDelimited":"decode"](l)}catch(f){return o.emit("error",f,e),s(f)}return o.emit("data",l,e),s(null,l)})}catch(a){o.emit("error",a,e),setTimeout(function(){s(a)},0);return}};qc.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var VC=w(qC=>{"use strict";c();var ZU=qC;ZU.Service=UC()});var HC=w((Rie,jC)=>{"use strict";c();jC.exports={}});var kC=w(QC=>{"use strict";c();var rr=QC;rr.build="minimal";rr.Writer=ow();rr.BufferWriter=TC();rr.Reader=cw();rr.BufferReader=FC();rr.util=Si();rr.rpc=VC();rr.roots=HC();rr.configure=GC;function GC(){rr.util._configure(),rr.Writer._configure(rr.BufferWriter),rr.Reader._configure(rr.BufferReader)}GC()});var WC=w((Mie,zC)=>{"use strict";c();zC.exports=kC()});var $C=w((qie,KC)=>{"use strict";c();var ja=WC(),Vh=ja.Reader,eq=ja.Writer,J=ja.util,Vc=ja.roots.default||(ja.roots.default={});Vc.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 Vh||(n=new Vh(n)),this.decode(n,n.uint32())},e.verify=function(n){return typeof n!="object"||n===null?"object expected":n.Nonce!=null&&n.hasOwnProperty("Nonce")&&!J.isInteger(n.Nonce)&&!(n.Nonce&&J.isInteger(n.Nonce.low)&&J.isInteger(n.Nonce.high))?"Nonce: integer|Long expected":n.Value!=null&&n.hasOwnProperty("Value")&&!(n.Value&&typeof n.Value.length=="number"||J.isString(n.Value))?"Value: buffer expected":n.RcvAddr!=null&&n.hasOwnProperty("RcvAddr")&&!(n.RcvAddr&&typeof n.RcvAddr.length=="number"||J.isString(n.RcvAddr))?"RcvAddr: buffer expected":n.RcvUserName!=null&&n.hasOwnProperty("RcvUserName")&&!(n.RcvUserName&&typeof n.RcvUserName.length=="number"||J.isString(n.RcvUserName))?"RcvUserName: buffer expected":n.SndAddr!=null&&n.hasOwnProperty("SndAddr")&&!(n.SndAddr&&typeof n.SndAddr.length=="number"||J.isString(n.SndAddr))?"SndAddr: buffer expected":n.SndUserName!=null&&n.hasOwnProperty("SndUserName")&&!(n.SndUserName&&typeof n.SndUserName.length=="number"||J.isString(n.SndUserName))?"SndUserName: buffer expected":n.GasPrice!=null&&n.hasOwnProperty("GasPrice")&&!J.isInteger(n.GasPrice)&&!(n.GasPrice&&J.isInteger(n.GasPrice.low)&&J.isInteger(n.GasPrice.high))?"GasPrice: integer|Long expected":n.GasLimit!=null&&n.hasOwnProperty("GasLimit")&&!J.isInteger(n.GasLimit)&&!(n.GasLimit&&J.isInteger(n.GasLimit.low)&&J.isInteger(n.GasLimit.high))?"GasLimit: integer|Long expected":n.Data!=null&&n.hasOwnProperty("Data")&&!(n.Data&&typeof n.Data.length=="number"||J.isString(n.Data))?"Data: buffer expected":n.ChainID!=null&&n.hasOwnProperty("ChainID")&&!(n.ChainID&&typeof n.ChainID.length=="number"||J.isString(n.ChainID))?"ChainID: buffer expected":n.Version!=null&&n.hasOwnProperty("Version")&&!J.isInteger(n.Version)?"Version: integer expected":n.Signature!=null&&n.hasOwnProperty("Signature")&&!(n.Signature&&typeof n.Signature.length=="number"||J.isString(n.Signature))?"Signature: buffer expected":n.Options!=null&&n.hasOwnProperty("Options")&&!J.isInteger(n.Options)?"Options: integer expected":n.GuardAddr!=null&&n.hasOwnProperty("GuardAddr")&&!(n.GuardAddr&&typeof n.GuardAddr.length=="number"||J.isString(n.GuardAddr))?"GuardAddr: buffer expected":n.GuardSignature!=null&&n.hasOwnProperty("GuardSignature")&&!(n.GuardSignature&&typeof n.GuardSignature.length=="number"||J.isString(n.GuardSignature))?"GuardSignature: buffer expected":null},e.fromObject=function(n){if(n instanceof Vc.proto.Transaction)return n;var i=new Vc.proto.Transaction;return n.Nonce!=null&&(J.Long?(i.Nonce=J.Long.fromValue(n.Nonce)).unsigned=!0:typeof n.Nonce=="string"?i.Nonce=parseInt(n.Nonce,10):typeof n.Nonce=="number"?i.Nonce=n.Nonce:typeof n.Nonce=="object"&&(i.Nonce=new J.LongBits(n.Nonce.low>>>0,n.Nonce.high>>>0).toNumber(!0))),n.Value!=null&&(typeof n.Value=="string"?J.base64.decode(n.Value,i.Value=J.newBuffer(J.base64.length(n.Value)),0):n.Value.length&&(i.Value=n.Value)),n.RcvAddr!=null&&(typeof n.RcvAddr=="string"?J.base64.decode(n.RcvAddr,i.RcvAddr=J.newBuffer(J.base64.length(n.RcvAddr)),0):n.RcvAddr.length&&(i.RcvAddr=n.RcvAddr)),n.RcvUserName!=null&&(typeof n.RcvUserName=="string"?J.base64.decode(n.RcvUserName,i.RcvUserName=J.newBuffer(J.base64.length(n.RcvUserName)),0):n.RcvUserName.length&&(i.RcvUserName=n.RcvUserName)),n.SndAddr!=null&&(typeof n.SndAddr=="string"?J.base64.decode(n.SndAddr,i.SndAddr=J.newBuffer(J.base64.length(n.SndAddr)),0):n.SndAddr.length&&(i.SndAddr=n.SndAddr)),n.SndUserName!=null&&(typeof n.SndUserName=="string"?J.base64.decode(n.SndUserName,i.SndUserName=J.newBuffer(J.base64.length(n.SndUserName)),0):n.SndUserName.length&&(i.SndUserName=n.SndUserName)),n.GasPrice!=null&&(J.Long?(i.GasPrice=J.Long.fromValue(n.GasPrice)).unsigned=!0:typeof n.GasPrice=="string"?i.GasPrice=parseInt(n.GasPrice,10):typeof n.GasPrice=="number"?i.GasPrice=n.GasPrice:typeof n.GasPrice=="object"&&(i.GasPrice=new J.LongBits(n.GasPrice.low>>>0,n.GasPrice.high>>>0).toNumber(!0))),n.GasLimit!=null&&(J.Long?(i.GasLimit=J.Long.fromValue(n.GasLimit)).unsigned=!0:typeof n.GasLimit=="string"?i.GasLimit=parseInt(n.GasLimit,10):typeof n.GasLimit=="number"?i.GasLimit=n.GasLimit:typeof n.GasLimit=="object"&&(i.GasLimit=new J.LongBits(n.GasLimit.low>>>0,n.GasLimit.high>>>0).toNumber(!0))),n.Data!=null&&(typeof n.Data=="string"?J.base64.decode(n.Data,i.Data=J.newBuffer(J.base64.length(n.Data)),0):n.Data.length&&(i.Data=n.Data)),n.ChainID!=null&&(typeof n.ChainID=="string"?J.base64.decode(n.ChainID,i.ChainID=J.newBuffer(J.base64.length(n.ChainID)),0):n.ChainID.length&&(i.ChainID=n.ChainID)),n.Version!=null&&(i.Version=n.Version>>>0),n.Signature!=null&&(typeof n.Signature=="string"?J.base64.decode(n.Signature,i.Signature=J.newBuffer(J.base64.length(n.Signature)),0):n.Signature.length&&(i.Signature=n.Signature)),n.Options!=null&&(i.Options=n.Options>>>0),n.GuardAddr!=null&&(typeof n.GuardAddr=="string"?J.base64.decode(n.GuardAddr,i.GuardAddr=J.newBuffer(J.base64.length(n.GuardAddr)),0):n.GuardAddr.length&&(i.GuardAddr=n.GuardAddr)),n.GuardSignature!=null&&(typeof n.GuardSignature=="string"?J.base64.decode(n.GuardSignature,i.GuardSignature=J.newBuffer(J.base64.length(n.GuardSignature)),0):n.GuardSignature.length&&(i.GuardSignature=n.GuardSignature)),i},e.toObject=function(n,i){i||(i={});var s={};if(i.defaults){if(J.Long){var o=new J.Long(0,0,!0);s.Nonce=i.longs===String?o.toString():i.longs===Number?o.toNumber():o}else s.Nonce=i.longs===String?"0":0;if(i.bytes===String?s.Value="":(s.Value=[],i.bytes!==Array&&(s.Value=J.newBuffer(s.Value))),i.bytes===String?s.RcvAddr="":(s.RcvAddr=[],i.bytes!==Array&&(s.RcvAddr=J.newBuffer(s.RcvAddr))),i.bytes===String?s.RcvUserName="":(s.RcvUserName=[],i.bytes!==Array&&(s.RcvUserName=J.newBuffer(s.RcvUserName))),i.bytes===String?s.SndAddr="":(s.SndAddr=[],i.bytes!==Array&&(s.SndAddr=J.newBuffer(s.SndAddr))),i.bytes===String?s.SndUserName="":(s.SndUserName=[],i.bytes!==Array&&(s.SndUserName=J.newBuffer(s.SndUserName))),J.Long){var o=new J.Long(0,0,!0);s.GasPrice=i.longs===String?o.toString():i.longs===Number?o.toNumber():o}else s.GasPrice=i.longs===String?"0":0;if(J.Long){var o=new J.Long(0,0,!0);s.GasLimit=i.longs===String?o.toString():i.longs===Number?o.toNumber():o}else s.GasLimit=i.longs===String?"0":0;i.bytes===String?s.Data="":(s.Data=[],i.bytes!==Array&&(s.Data=J.newBuffer(s.Data))),i.bytes===String?s.ChainID="":(s.ChainID=[],i.bytes!==Array&&(s.ChainID=J.newBuffer(s.ChainID))),s.Version=0,i.bytes===String?s.Signature="":(s.Signature=[],i.bytes!==Array&&(s.Signature=J.newBuffer(s.Signature))),s.Options=0,i.bytes===String?s.GuardAddr="":(s.GuardAddr=[],i.bytes!==Array&&(s.GuardAddr=J.newBuffer(s.GuardAddr))),i.bytes===String?s.GuardSignature="":(s.GuardSignature=[],i.bytes!==Array&&(s.GuardSignature=J.newBuffer(s.GuardSignature)))}return n.Nonce!=null&&n.hasOwnProperty("Nonce")&&(typeof n.Nonce=="number"?s.Nonce=i.longs===String?String(n.Nonce):n.Nonce:s.Nonce=i.longs===String?J.Long.prototype.toString.call(n.Nonce):i.longs===Number?new J.LongBits(n.Nonce.low>>>0,n.Nonce.high>>>0).toNumber(!0):n.Nonce),n.Value!=null&&n.hasOwnProperty("Value")&&(s.Value=i.bytes===String?J.base64.encode(n.Value,0,n.Value.length):i.bytes===Array?Array.prototype.slice.call(n.Value):n.Value),n.RcvAddr!=null&&n.hasOwnProperty("RcvAddr")&&(s.RcvAddr=i.bytes===String?J.base64.encode(n.RcvAddr,0,n.RcvAddr.length):i.bytes===Array?Array.prototype.slice.call(n.RcvAddr):n.RcvAddr),n.RcvUserName!=null&&n.hasOwnProperty("RcvUserName")&&(s.RcvUserName=i.bytes===String?J.base64.encode(n.RcvUserName,0,n.RcvUserName.length):i.bytes===Array?Array.prototype.slice.call(n.RcvUserName):n.RcvUserName),n.SndAddr!=null&&n.hasOwnProperty("SndAddr")&&(s.SndAddr=i.bytes===String?J.base64.encode(n.SndAddr,0,n.SndAddr.length):i.bytes===Array?Array.prototype.slice.call(n.SndAddr):n.SndAddr),n.SndUserName!=null&&n.hasOwnProperty("SndUserName")&&(s.SndUserName=i.bytes===String?J.base64.encode(n.SndUserName,0,n.SndUserName.length):i.bytes===Array?Array.prototype.slice.call(n.SndUserName):n.SndUserName),n.GasPrice!=null&&n.hasOwnProperty("GasPrice")&&(typeof n.GasPrice=="number"?s.GasPrice=i.longs===String?String(n.GasPrice):n.GasPrice:s.GasPrice=i.longs===String?J.Long.prototype.toString.call(n.GasPrice):i.longs===Number?new J.LongBits(n.GasPrice.low>>>0,n.GasPrice.high>>>0).toNumber(!0):n.GasPrice),n.GasLimit!=null&&n.hasOwnProperty("GasLimit")&&(typeof n.GasLimit=="number"?s.GasLimit=i.longs===String?String(n.GasLimit):n.GasLimit:s.GasLimit=i.longs===String?J.Long.prototype.toString.call(n.GasLimit):i.longs===Number?new J.LongBits(n.GasLimit.low>>>0,n.GasLimit.high>>>0).toNumber(!0):n.GasLimit),n.Data!=null&&n.hasOwnProperty("Data")&&(s.Data=i.bytes===String?J.base64.encode(n.Data,0,n.Data.length):i.bytes===Array?Array.prototype.slice.call(n.Data):n.Data),n.ChainID!=null&&n.hasOwnProperty("ChainID")&&(s.ChainID=i.bytes===String?J.base64.encode(n.ChainID,0,n.ChainID.length):i.bytes===Array?Array.prototype.slice.call(n.ChainID):n.ChainID),n.Version!=null&&n.hasOwnProperty("Version")&&(s.Version=n.Version),n.Signature!=null&&n.hasOwnProperty("Signature")&&(s.Signature=i.bytes===String?J.base64.encode(n.Signature,0,n.Signature.length):i.bytes===Array?Array.prototype.slice.call(n.Signature):n.Signature),n.Options!=null&&n.hasOwnProperty("Options")&&(s.Options=n.Options),n.GuardAddr!=null&&n.hasOwnProperty("GuardAddr")&&(s.GuardAddr=i.bytes===String?J.base64.encode(n.GuardAddr,0,n.GuardAddr.length):i.bytes===Array?Array.prototype.slice.call(n.GuardAddr):n.GuardAddr),n.GuardSignature!=null&&n.hasOwnProperty("GuardSignature")&&(s.GuardSignature=i.bytes===String?J.base64.encode(n.GuardSignature,0,n.GuardSignature.length):i.bytes===Array?Array.prototype.slice.call(n.GuardSignature):n.GuardSignature),s},e.prototype.toJSON=function(){return this.constructor.toObject(this,ja.util.toJSONOptions)},e}(),t}();KC.exports=Vc});var YC=w(br=>{"use strict";c();var tq=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]}),rq=br&&br.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nq=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)&&tq(e,t,r);return rq(e,t),e},iq=br&&br.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(br,"__esModule",{value:!0});br.ProtoSerializer=void 0;var sq=iq(Yt()),fw=tr(),oq=Go(),aq=nq(je()),uq=lh(),hw=class{serializeTransaction(e){let r=$C().proto,n=new fw.Address(e.getReceiver().bech32()).pubkey(),i=new fw.Address(e.getSender().bech32()).pubkey(),s=new r.Transaction({Nonce:e.getNonce().valueOf()?e.getNonce().valueOf():void 0,Value:this.serializeTransactionValue(e.getValue()),RcvAddr:n,RcvUserName:null,SndAddr:i,SndUserName:null,GasPrice:e.getGasPrice().valueOf(),GasLimit:e.getGasLimit().valueOf(),Data:e.getData().length()==0?null:e.getData().valueOf(),ChainID:h.Buffer.from(e.getChainID().valueOf()),Version:e.getVersion().valueOf(),Signature:e.getSignature()});if(e.getOptions().valueOf()!==oq.TRANSACTION_OPTIONS_DEFAULT&&(s.Options=e.getOptions().valueOf()),e.isGuardedTransaction()){let u=e.getGuardian();s.GuardAddr=new fw.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 sq.default(e.toString());if(r.isZero())return h.Buffer.from([0,0]);let n=uq.bigIntToBuffer(r);return n=h.Buffer.concat([h.Buffer.from([0]),n]),n}deserializeTransaction(e){throw new aq.ErrUnsupportedOperation("deserializeTransaction")}};br.ProtoSerializer=hw});var JC=w(Js=>{"use strict";c();var cq=Js&&Js.__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]}),lq=Js&&Js.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&cq(e,t,r)};Object.defineProperty(Js,"__esModule",{value:!0});lq(YC(),Js)});var eT=w(hn=>{"use strict";c();var fq=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]}),hq=hn&&hn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dq=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)&&fq(e,t,r);return hq(e,t),e};Object.defineProperty(hn,"__esModule",{value:!0});hn.Signature=void 0;var XC=dq(je()),ZC=64,Ur=class{constructor(e){if(this.valueHex="",!!e){if(typeof e=="string")return Ur.fromHex(e);if(e instanceof h.Buffer)return Ur.fromBuffer(e)}}static empty(){return new Ur}static fromHex(e){if(e.startsWith("0x")&&(e=e.slice(2)),!Ur.isValidHex(e))throw new XC.ErrSignatureCannotCreate(e);return Ur.fromValidHex(e)}static isValidHex(e){return h.Buffer.from(e,"hex").length==ZC}static fromValidHex(e){let r=new Ur;return r.valueHex=e,r}static fromBuffer(e){if(e.length!=ZC)throw new XC.ErrSignatureCannotCreate(e);return Ur.fromValidHex(e.toString("hex"))}hex(){return this.valueHex}};hn.Signature=Ur});var jc=w(jh=>{"use strict";c();Object.defineProperty(jh,"__esModule",{value:!0});jh.TransactionPayload=void 0;var Ha=class{constructor(e){this.data=h.Buffer.from(e||[])}static fromEncoded(e){if(!e)return new Ha("");let r=h.Buffer.from(e,"base64").toString();return new Ha(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}};jh.TransactionPayload=Ha});var dw=w(($ie,tT)=>{c();Gn.notEqual=gq;Gn.notOk=yq;Gn.equal=pq;Gn.ok=Gn;tT.exports=Gn;function pq(t,e,r){Gn(t==e,r)}function gq(t,e,r){Gn(t!=e,r)}function yq(t,e){Gn(!t,e)}function Gn(t,e){if(!t)throw new Error(e||"AssertionError")}});var Wa=w(za=>{"use strict";c();var pw=hy(),Qa=py(),rT=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;za.Buffer=W;za.SlowBuffer=bq;za.INSPECT_MAX_BYTES=50;var Hh=2147483647;za.kMaxLength=Hh;W.TYPED_ARRAY_SUPPORT=mq();!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 mq(){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 Qn(t){if(t>Hh)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 ww(t)}return oT(t,e,r)}W.poolSize=8192;function oT(t,e,r){if(typeof t=="string")return Eq(t,e);if(ArrayBuffer.isView(t))return vq(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(dn(t,ArrayBuffer)||t&&dn(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(dn(t,SharedArrayBuffer)||t&&dn(t.buffer,SharedArrayBuffer)))return yw(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=Aq(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 oT(t,e,r)};Object.setPrototypeOf(W.prototype,Uint8Array.prototype);Object.setPrototypeOf(W,Uint8Array);function aT(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 wq(t,e,r){return aT(t),t<=0?Qn(t):e!==void 0?typeof r=="string"?Qn(t).fill(e,r):Qn(t).fill(e):Qn(t)}W.alloc=function(t,e,r){return wq(t,e,r)};function ww(t){return aT(t),Qn(t<0?0:Ew(t)|0)}W.allocUnsafe=function(t){return ww(t)};W.allocUnsafeSlow=function(t){return ww(t)};function Eq(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!W.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=uT(t,e)|0,n=Qn(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function gw(t){let e=t.length<0?0:Ew(t.length)|0,r=Qn(e);for(let n=0;n=Hh)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Hh.toString(16)+" bytes");return t|0}function bq(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(dn(e,Uint8Array)&&(e=W.from(e,e.offset,e.byteLength)),dn(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 uT(t,e){if(W.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||dn(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 mw(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return mT(t).length;default:if(i)return n?-1:mw(t).length;e=(""+e).toLowerCase(),i=!0}}W.byteLength=uT;function _q(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 Rq(this,e,r);case"utf8":case"utf-8":return lT(this,e,r);case"ascii":return Dq(this,e,r);case"latin1":case"binary":return Pq(this,e,r);case"base64":return Nq(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Bq(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}W.prototype._isBuffer=!0;function Xs(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+=" ... "),""};rT&&(W.prototype[rT]=W.prototype.inspect);W.prototype.compare=function(e,r,n,i,s){if(dn(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),l=this.slice(i,s),f=e.slice(r,n);for(let d=0;d2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,Aw(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:nT(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):nT(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function nT(t,e,r,n,i){let s=1,o=t.length,a=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;s=2,o/=2,a/=2,r/=2}function u(f,d){return s===1?f[d]:f.readUInt16BE(d*s)}let l;if(i){let f=-1;for(l=r;lo&&(r=o-a),l=r;l>=0;l--){let f=!0;for(let d=0;di&&(n=i)):n=i;let s=e.length;n>s/2&&(n=s/2);let o;for(o=0;o>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let s=this.length-r;if((n===void 0||n>s)&&(n=s),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let o=!1;for(;;)switch(i){case"hex":return Iq(this,e,r,n);case"utf8":case"utf-8":return Sq(this,e,r,n);case"ascii":case"latin1":case"binary":return Cq(this,e,r,n);case"base64":return Tq(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return xq(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 Nq(t,e,r){return e===0&&r===t.length?pw.fromByteArray(t):pw.fromByteArray(t.slice(e,r))}function lT(t,e,r){r=Math.min(t.length,r);let n=[],i=e;for(;i239?4:s>223?3:s>191?2:1;if(i+a<=r){let u,l,f,d;switch(a){case 1:s<128&&(o=s);break;case 2:u=t[i+1],(u&192)===128&&(d=(s&31)<<6|u&63,d>127&&(o=d));break;case 3:u=t[i+1],l=t[i+2],(u&192)===128&&(l&192)===128&&(d=(s&15)<<12|(u&63)<<6|l&63,d>2047&&(d<55296||d>57343)&&(o=d));break;case 4:u=t[i+1],l=t[i+2],f=t[i+3],(u&192)===128&&(l&192)===128&&(f&192)===128&&(d=(s&15)<<18|(u&63)<<12|(l&63)<<6|f&63,d>65535&&d<1114112&&(o=d))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),i+=a}return Oq(n)}var iT=4096;function Oq(t){let e=t.length;if(e<=iT)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||Nt(e,r,this.length);let i=this[e],s=1,o=0;for(;++o>>0,r=r>>>0,n||Nt(e,r,this.length);let i=this[e+--r],s=1;for(;r>0&&(s*=256);)i+=this[e+--r]*s;return i};W.prototype.readUint8=W.prototype.readUInt8=function(e,r){return e=e>>>0,r||Nt(e,1,this.length),this[e]};W.prototype.readUint16LE=W.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||Nt(e,2,this.length),this[e]|this[e+1]<<8};W.prototype.readUint16BE=W.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||Nt(e,2,this.length),this[e]<<8|this[e+1]};W.prototype.readUint32LE=W.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||Nt(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};W.prototype.readUint32BE=W.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||Nt(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};W.prototype.readBigUInt64LE=Ti(function(e){e=e>>>0,ka(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Hc(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,ka(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Hc(e,this.length-8);let i=r*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],s=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt(i)<>>0,r=r>>>0,n||Nt(e,r,this.length);let i=this[e],s=1,o=0;for(;++o=s&&(i-=Math.pow(2,8*r)),i};W.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||Nt(e,r,this.length);let i=r,s=1,o=this[e+--i];for(;i>0&&(s*=256);)o+=this[e+--i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*r)),o};W.prototype.readInt8=function(e,r){return e=e>>>0,r||Nt(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};W.prototype.readInt16LE=function(e,r){e=e>>>0,r||Nt(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};W.prototype.readInt16BE=function(e,r){e=e>>>0,r||Nt(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};W.prototype.readInt32LE=function(e,r){return e=e>>>0,r||Nt(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};W.prototype.readInt32BE=function(e,r){return e=e>>>0,r||Nt(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};W.prototype.readBigInt64LE=Ti(function(e){e=e>>>0,ka(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Hc(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,ka(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Hc(e,this.length-8);let i=(r<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(i)<>>0,r||Nt(e,4,this.length),Qa.read(this,e,!0,23,4)};W.prototype.readFloatBE=function(e,r){return e=e>>>0,r||Nt(e,4,this.length),Qa.read(this,e,!1,23,4)};W.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||Nt(e,8,this.length),Qa.read(this,e,!0,52,8)};W.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||Nt(e,8,this.length),Qa.read(this,e,!1,52,8)};function nr(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;nr(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;nr(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||nr(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||nr(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||nr(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||nr(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||nr(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 fT(t,e,r,n,i){yT(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 hT(t,e,r,n,i){yT(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=Ti(function(e,r=0){return fT(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});W.prototype.writeBigUInt64BE=Ti(function(e,r=0){return hT(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);nr(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);nr(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||nr(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||nr(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||nr(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||nr(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||nr(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=Ti(function(e,r=0){return fT(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});W.prototype.writeBigInt64BE=Ti(function(e,r=0){return hT(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function dT(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 pT(t,e,r,n,i){return e=+e,r=r>>>0,i||dT(t,e,r,4,34028234663852886e22,-34028234663852886e22),Qa.write(t,e,r,n,23,4),r+4}W.prototype.writeFloatLE=function(e,r,n){return pT(this,e,r,!0,n)};W.prototype.writeFloatBE=function(e,r,n){return pT(this,e,r,!1,n)};function gT(t,e,r,n,i){return e=+e,r=r>>>0,i||dT(t,e,r,8,17976931348623157e292,-17976931348623157e292),Qa.write(t,e,r,n,52,8),r+8}W.prototype.writeDoubleLE=function(e,r,n){return gT(this,e,r,!0,n)};W.prototype.writeDoubleBE=function(e,r,n){return gT(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=sT(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=sT(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);function sT(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 Lq(t,e,r){ka(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&Hc(e,t.length-(r+1))}function yT(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 Ga.ERR_OUT_OF_RANGE("value",a,t)}Lq(n,i,s)}function ka(t,e){if(typeof t!="number")throw new Ga.ERR_INVALID_ARG_TYPE(e,"number",t)}function Hc(t,e,r){throw Math.floor(t)!==t?(ka(t,r),new Ga.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new Ga.ERR_BUFFER_OUT_OF_BOUNDS:new Ga.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var Fq=/[^+/0-9A-Za-z-_]/g;function Mq(t){if(t=t.split("=")[0],t=t.trim().replace(Fq,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function mw(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 Uq(t){let e=[];for(let r=0;r>8,i=r%256,s.push(i),s.push(n);return s}function mT(t){return pw.toByteArray(Mq(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 dn(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function Aw(t){return t!==t}var Vq=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 Ti(t){return typeof BigInt>"u"?jq:t}function jq(){throw new Error("BigInt not supported")}});var ET=w((ese,wT)=>{c();wT.exports=bw;bw.supported=typeof WebAssembly<"u";function bw(t){if(!bw.supported)return null;var e=t&&t.imports,r=Hq("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 Hq(t){return typeof atob=="function"?new Uint8Array(atob(t).split("").map(Gq)):new(Wa()).Buffer(t,"base64")}function Gq(t){return t.charCodeAt(0)}});var CT=w((ise,gn)=>{c();var pn=dw(),ze=ET()(),kn=64,Qh=[];gn.exports=_r;var vT=gn.exports.BYTES_MIN=16,AT=gn.exports.BYTES_MAX=64,rse=gn.exports.BYTES=32,bT=gn.exports.KEYBYTES_MIN=16,_T=gn.exports.KEYBYTES_MAX=64,nse=gn.exports.KEYBYTES=32,IT=gn.exports.SALTBYTES=16,ST=gn.exports.PERSONALBYTES=16;function _r(t,e,r,n,i){if(!(this instanceof _r))return new _r(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&&(pn(t>=vT,"digestLength must be at least "+vT+", was given "+t),pn(t<=AT,"digestLength must be at most "+AT+", was given "+t),e!=null&&pn(e.length>=bT,"key must be at least "+bT+", was given "+e.length),e!=null&&pn(e.length<=_T,"key must be at least "+_T+", was given "+e.length),r!=null&&pn(r.length===IT,"salt must be exactly "+IT+", was given "+r.length),n!=null&&pn(n.length===ST,"personal must be exactly "+ST+", was given "+n.length)),Qh.length||(Qh.push(kn),kn+=216),this.digestLength=t,this.finalized=!1,this.pointer=Qh.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,kn,kn+e.length),ze.memory[this.pointer+200]=128)}_r.prototype.update=function(t){return pn(this.finalized===!1,"Hash instance finalized"),pn(t,"input must be TypedArray or Buffer"),kn+t.length>ze.memory.length&&ze.realloc(kn+t.length),ze.memory.set(t,kn),ze.exports.blake2b_update(this.pointer,kn,kn+t.length),this};_r.prototype.digest=function(t){if(pn(this.finalized===!1,"Hash instance finalized"),this.finalized=!0,Qh.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 kq(ze.memory,this.pointer+128,this.digestLength);pn(t.length>=this.digestLength,"input must be TypedArray or Buffer");for(var e=0;e{c();var Oi=dw(),Qc=CT();function kh(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 TT(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 BT(t,e){return t[e]^t[e+1]<<8^t[e+2]<<16^t[e+3]<<24}function xi(t,e,r,n,i,s){var o=Gc[i],a=Gc[i+1],u=Gc[s],l=Gc[s+1];kh(Se,t,e),TT(Se,t,o,a);var f=Se[n]^Se[t],d=Se[n+1]^Se[t+1];Se[n]=d,Se[n+1]=f,kh(Se,r,n),f=Se[e]^Se[r],d=Se[e+1]^Se[r+1],Se[e]=f>>>24^d<<8,Se[e+1]=d>>>24^f<<8,kh(Se,t,e),TT(Se,t,u,l),f=Se[n]^Se[t],d=Se[n+1]^Se[t+1],Se[n]=f>>>16^d<<16,Se[n+1]=d>>>16^f<<16,kh(Se,r,n),f=Se[e]^Se[r],d=Se[e+1]^Se[r+1],Se[e]=d>>>31^f<<1,Se[e+1]=f>>>31^d<<1}var LT=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),Wq=[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],kt=new Uint8Array(Wq.map(function(t){return t*2})),Se=new Uint32Array(32),Gc=new Uint32Array(32);function FT(t,e){var r=0;for(r=0;r<16;r++)Se[r]=t.h[r],Se[r+16]=LT[r];for(Se[24]=Se[24]^t.t,Se[25]=Se[25]^t.t/4294967296,e&&(Se[28]=~Se[28],Se[29]=~Se[29]),r=0;r<32;r++)Gc[r]=BT(t.b,4*r);for(r=0;r<12;r++)xi(0,8,16,24,kt[r*16+0],kt[r*16+1]),xi(2,10,18,26,kt[r*16+2],kt[r*16+3]),xi(4,12,20,28,kt[r*16+4],kt[r*16+5]),xi(6,14,22,30,kt[r*16+6],kt[r*16+7]),xi(0,10,20,30,kt[r*16+8],kt[r*16+9]),xi(2,12,22,24,kt[r*16+10],kt[r*16+11]),xi(4,14,16,26,kt[r*16+12],kt[r*16+13]),xi(6,8,18,28,kt[r*16+14],kt[r*16+15]);for(r=0;r<16;r++)t.h[r]=t.h[r]^Se[r]^Se[r+16]}var Ni=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 Ka(t,e,r,n){Ni.fill(0),this.b=new Uint8Array(128),this.h=new Uint32Array(16),this.t=0,this.c=0,this.outlen=t,Ni[0]=t,e&&(Ni[1]=e.length),Ni[2]=1,Ni[3]=1,r&&Ni.set(r,32),n&&Ni.set(n,48);for(var i=0;i<16;i++)this.h[i]=LT[i]^BT(Ni,i*4);e&&(MT(this,e),this.c=128)}Ka.prototype.update=function(t){return Oi(t!=null,"input must be Uint8Array or Buffer"),MT(this,t),this};Ka.prototype.digest=function(t){var e=!t||t==="binary"||t==="hex"?new Uint8Array(this.outlen):t;return Oi(e.length>=this.outlen,"out must have at least outlen bytes of space"),Kq(this,e),t==="hex"?$q(e):e};Ka.prototype.final=Ka.prototype.digest;Ka.ready=function(t){Qc.ready(function(){t()})};function MT(t,e){for(var r=0;r>2]>>8*(r&3);return e}function $q(t){for(var e="",r=0;r=xT,"outlen must be at least "+xT+", was given "+e),Oi(e<=NT,"outlen must be at most "+NT+", was given "+e),r!=null&&Oi(r.length>=OT,"key must be at least "+OT+", was given "+r.length),r!=null&&Oi(r.length<=DT,"key must be at most "+DT+", was given "+r.length),n!=null&&Oi(n.length===PT,"salt must be exactly "+PT+", was given "+n.length),i!=null&&Oi(i.length===RT,"personal must be exactly "+RT+", was given "+i.length)),new UT(e,r,n,i)};ir.exports.ready=function(t){Qc.ready(function(){t()})};ir.exports.WASM_SUPPORTED=Qc.SUPPORTED;ir.exports.WASM_LOADED=!1;var xT=ir.exports.BYTES_MIN=16,NT=ir.exports.BYTES_MAX=64,ose=ir.exports.BYTES=32,OT=ir.exports.KEYBYTES_MIN=16,DT=ir.exports.KEYBYTES_MAX=64,ase=ir.exports.KEYBYTES=32,PT=ir.exports.SALTBYTES=16,RT=ir.exports.PERSONALBYTES=16;Qc.ready(function(t){t||(ir.exports.WASM_LOADED=!0,UT=Qc)})});var Wc=w(Ir=>{"use strict";c();var Jq=Ir&&Ir.__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]}),Xq=Ir&&Ir.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Zq=Ir&&Ir.__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)&&Jq(e,t,r);return Xq(e,t),e};Object.defineProperty(Ir,"__esModule",{value:!0});Ir.TransactionHash=Ir.Transaction=void 0;var $a=Yt(),kc=tr(),eV=Lh(),tV=Go(),rV=Zq(je()),nV=KS(),zn=YS(),iV=JC(),VT=eT(),jT=jc(),sV=gr(),oV=qT(),aV=32,zc=class{constructor({nonce:e,value:r,receiver:n,sender:i,gasPrice:s,gasLimit:o,data:a,chainID:u,version:l,options:f,guardian:d}){this.nonce=e||0,this.value=r?new $a.BigNumber(r.toString()).toFixed(0):0,this.sender=i,this.receiver=n,this.gasPrice=s||tV.TRANSACTION_MIN_GAS_PRICE,this.gasLimit=o,this.data=a||new jT.TransactionPayload,this.chainID=u,this.version=l?new zn.TransactionVersion(l.valueOf()):zn.TransactionVersion.withDefaultVersion(),this.options=f?new zn.TransactionOptions(f.valueOf()):zn.TransactionOptions.withDefaultOptions(),this.guardian=d||kc.Address.empty(),this.signature=h.Buffer.from([]),this.guardianSignature=h.Buffer.from([]),this.hash=Di.empty()}getNonce(){return this.nonce}setNonce(e){this.nonce=e}getValue(){return this.value}setValue(e){this.value=e}getSender(){return this.sender}setSender(e){this.sender=e}getReceiver(){return this.receiver}getGuardian(){return this.guardian}getGasPrice(){return this.gasPrice}setGasPrice(e){this.gasPrice=e}getGasLimit(){return this.gasLimit}setGasLimit(e){this.gasLimit=e}getData(){return this.data}getChainID(){return this.chainID}setChainID(e){this.chainID=e}getVersion(){return this.version}setVersion(e){this.version=new zn.TransactionVersion(e.valueOf())}getOptions(){return new zn.TransactionOptions(this.options.valueOf())}setOptions(e){this.options=new zn.TransactionOptions(e.valueOf())}getSignature(){return this.signature}getGuardianSignature(){return this.guardianSignature}setGuardian(e){this.guardian=e}getHash(){return sV.guardNotEmpty(this.hash,"hash"),this.hash}serializeForSigning(){let e=this.toPlainObject();e.signature&&delete e.signature,e.guardianSignature&&delete e.guardianSignature,e.guardian||delete e.guardian;let r=JSON.stringify(e);return h.Buffer.from(r)}isGuardedTransaction(){let e=this.guardian.bech32().length>0,r=this.guardianSignature.length>0;return this.getOptions().isWithGuardian()&&e&&r}toPlainObject(){var e;let r={nonce:this.nonce.valueOf(),value:this.value.toString(),receiver:this.receiver.bech32(),sender:this.sender.bech32(),gasPrice:this.gasPrice.valueOf(),gasLimit:this.gasLimit.valueOf(),data:this.data.length()==0?void 0:this.data.encoded(),chainID:this.chainID.valueOf(),version:this.version.valueOf(),options:this.options.valueOf()==0?void 0:this.options.valueOf(),guardian:!((e=this.guardian)===null||e===void 0)&&e.bech32()?this.guardian.bech32()==""?void 0:this.guardian.bech32():void 0,signature:this.signature.toString("hex")?this.signature.toString("hex"):void 0,guardianSignature:this.guardianSignature.toString("hex")?this.guardianSignature.toString("hex"):void 0};return eV.Compatibility.guardAddressIsSetAndNonZero(new kc.Address(r.sender),"'sender' of transaction","pass the actual sender to the Transaction constructor"),r}static fromPlainObject(e){let r=new zc({nonce:Number(e.nonce),value:new $a.BigNumber(e.value).toFixed(0),receiver:kc.Address.fromString(e.receiver),sender:kc.Address.fromString(e.sender),guardian:e.guardian==null?void 0:kc.Address.fromString(e.guardian||""),gasPrice:Number(e.gasPrice),gasLimit:Number(e.gasLimit),data:new jT.TransactionPayload(h.Buffer.from(e.data||"","base64")),chainID:String(e.chainID),version:new zn.TransactionVersion(e.version),options:e.options==null?void 0:new zn.TransactionOptions(e.options)});return e.signature&&r.applySignature(new VT.Signature(e.signature)),e.guardianSignature&&r.applyGuardianSignature(new VT.Signature(e.guardianSignature)),r}applySignature(e){e instanceof h.Buffer?this.signature=e:this.signature=h.Buffer.from(e.hex(),"hex"),this.hash=Di.compute(this)}applyGuardianSignature(e){e instanceof h.Buffer?this.guardianSignature=e:this.guardianSignature=h.Buffer.from(e.hex(),"hex"),this.hash=Di.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 rV.ErrNotEnoughGas(this.gasLimit.valueOf());let n=new $a.BigNumber(this.gasPrice.valueOf()),i=new $a.BigNumber(r).multipliedBy(n);if(r===this.gasLimit.valueOf())return i;let s=new $a.BigNumber(this.gasLimit.valueOf()-r),o=n.multipliedBy(new $a.BigNumber(e.GasPriceModifier.valueOf())),a=s.multipliedBy(o);return i.plus(a)}};Ir.Transaction=zc;var Di=class extends nV.Hash{constructor(e){super(e)}static compute(e){let n=new iV.ProtoSerializer().serializeTransaction(e),i=oV(aV).update(n).digest("hex");return new Di(i)}};Ir.TransactionHash=Di});var HT=w(Wh=>{"use strict";c();Object.defineProperty(Wh,"__esModule",{value:!0});Wh.TransferTransactionsFactory=void 0;var _w=Ph(),qr=Tt(),zh=Wc(),Iw=jc(),Sw=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 zh.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 _w.ArgSerializer().valuesToString([qr.BytesValue.fromUTF8(e.tokenTransfer.tokenIdentifier),new qr.BigUIntValue(e.tokenTransfer.valueOf())]),n=`ESDTTransfer@${r}`,i=new Iw.TransactionPayload(n),s=i.length()||0,o=this.gasEstimator.forESDTTransfer(s);return new zh.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 _w.ArgSerializer().valuesToString([qr.BytesValue.fromUTF8(e.tokenTransfer.tokenIdentifier),new qr.U64Value(e.tokenTransfer.nonce),new qr.BigUIntValue(e.tokenTransfer.valueOf()),new qr.AddressValue(e.destination)]),n=`ESDTNFTTransfer@${r}`,i=new Iw.TransactionPayload(n),s=i.length()||0,o=this.gasEstimator.forESDTNFTTransfer(s);return new zh.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 qr.AddressValue(e.destination),new qr.U16Value(e.tokenTransfers.length)];for(let u of e.tokenTransfers)r.push(qr.BytesValue.fromUTF8(u.tokenIdentifier),new qr.U64Value(u.nonce),new qr.BigUIntValue(u.valueOf()));let{argumentsString:n}=new _w.ArgSerializer().valuesToString(r),i=`MultiESDTNFTTransfer@${n}`,s=new Iw.TransactionPayload(i),o=s.length()||0,a=this.gasEstimator.forMultiESDTNFTTransfer(o,e.tokenTransfers.length);return new zh.Transaction({nonce:e.nonce,receiver:e.sender,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||a,data:s,chainID:e.chainID})}};Wh.TransferTransactionsFactory=Sw});var QT=w(Zs=>{"use strict";c();Object.defineProperty(Zs,"__esModule",{value:!0});Zs.GasEstimator=Zs.DefaultGasConfiguration=void 0;Zs.DefaultGasConfiguration={minGasLimit:5e4,gasPerDataByte:1500,gasCostESDTTransfer:2e5,gasCostESDTNFTTransfer:2e5,gasCostESDTNFTMultiTransfer:2e5};var uV=1e5,GT=8e5,Cw=class{constructor(e){this.gasConfiguration=e||Zs.DefaultGasConfiguration}forEGLDTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasPerDataByte*e}forESDTTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasCostESDTTransfer+this.gasConfiguration.gasPerDataByte*e+uV}forESDTNFTTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasCostESDTNFTTransfer+this.gasConfiguration.gasPerDataByte*e+GT}forMultiESDTNFTTransfer(e,r){return this.gasConfiguration.minGasLimit+(this.gasConfiguration.gasCostESDTNFTMultiTransfer+GT)*r+this.gasConfiguration.gasPerDataByte*e}};Zs.GasEstimator=Cw});var $h=w(Kh=>{"use strict";c();Object.defineProperty(Kh,"__esModule",{value:!0});Kh.Account=void 0;var cV=tr(),Tw=class{constructor(e){this.address=new cV.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()}}};Kh.Account=Tw});var xw=w(to=>{"use strict";c();Object.defineProperty(to,"__esModule",{value:!0});to.Logger=to.LogLevel=void 0;var eo;(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"})(eo=to.LogLevel||(to.LogLevel={}));var Vr=class{static setLevel(e){Vr.logLevel=e}static trace(e,...r){Vr.logLevel>=eo.Debug||console.debug(e,r)}static debug(e,...r){Vr.logLevel>=eo.Debug||console.debug(e,r)}static info(e,...r){Vr.logLevel>=eo.Info||console.log(e,r)}static warn(e,...r){Vr.logLevel>=eo.Warn||console.warn(e,r)}static error(e,...r){Vr.logLevel>=eo.Error||console.error(e,r)}};to.Logger=Vr;Vr.logLevel=eo.Debug});var kT=w(yn=>{"use strict";c();var lV=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]}),fV=yn&&yn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hV=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)&&lV(e,t,r);return fV(e,t),e};Object.defineProperty(yn,"__esModule",{value:!0});yn.AsyncTimer=void 0;var dV=hV(je()),pV=je(),Nw=xw(),Ow=class{constructor(e){this.timeoutHandle=null,this.rejectionFunc=null,this.name=e,this.correlationTag=0}start(e){if(this.timeoutHandle)throw new dV.ErrAsyncTimerAlreadyRunning;return this.correlationTag++,Nw.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(){Nw.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].abort()`),this.rejectionFunc&&(this.rejectionFunc(new pV.ErrAsyncTimerAborted),this.rejectionFunc=null),this.stop()}stop(){this.isStopped()||(Nw.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].stop()`),this.timeoutHandle&&(clearTimeout(this.timeoutHandle),this.timeoutHandle=null))}isStopped(){return!this.timeoutHandle}};yn.AsyncTimer=Ow});var Rw=w(Ja=>{"use strict";c();var Sr=Ja&&Ja.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(Ja,"__esModule",{value:!0});Ja.TransactionWatcher=void 0;var Dw=kT(),Ya=je(),zT=xw(),Cr=class{constructor(e,r={}){this.fetcher=new Pw(e),this.pollingIntervalMilliseconds=r.pollingIntervalMilliseconds||Cr.DefaultPollingInterval,this.timeoutMilliseconds=r.timeoutMilliseconds||Cr.DefaultTimeout,this.patienceMilliseconds=r.patienceMilliseconds||Cr.DefaultPatience}awaitPending(e){return Sr(this,void 0,void 0,function*(){let r=s=>s.status.isPending(),n=()=>Sr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),i=()=>new Ya.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)})}awaitCompleted(e){return Sr(this,void 0,void 0,function*(){let r=s=>s.isCompleted,n=()=>Sr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),i=()=>new Ya.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)})}awaitAllEvents(e,r){return Sr(this,void 0,void 0,function*(){let n=o=>{let a=this.getAllTransactionEvents(o).map(l=>l.identifier);return r.every(l=>a.includes(l))},i=()=>Sr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),s=()=>new Ya.ErrExpectedTransactionEventsNotFound;return this.awaitConditionally(n,i,s)})}awaitAnyEvent(e,r){return Sr(this,void 0,void 0,function*(){let n=o=>{let a=this.getAllTransactionEvents(o).map(l=>l.identifier);return r.find(l=>a.includes(l))!=null},i=()=>Sr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),s=()=>new Ya.ErrExpectedTransactionEventsNotFound;return this.awaitConditionally(n,i,s)})}awaitOnCondition(e,r){return Sr(this,void 0,void 0,function*(){let n=()=>Sr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),i=()=>new Ya.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)})}awaitConditionally(e,r,n){return Sr(this,void 0,void 0,function*(){let i=new Dw.AsyncTimer("watcher:periodic"),s=new Dw.AsyncTimer("watcher:patience"),o=new Dw.AsyncTimer("watcher:timeout"),a=!1,u,l=!1;for(o.start(this.timeoutMilliseconds).finally(()=>{o.stop(),a=!0});!a;){yield i.start(this.pollingIntervalMilliseconds);try{if(u=yield r(),l=e(u),l||a)break}catch(f){if(zT.Logger.debug("TransactionWatcher.awaitConditionally(): cannot (yet) fetch data."),!(f instanceof Ya.Err))throw f}}if(l&&(yield s.start(this.patienceMilliseconds)),o.isStopped()||o.stop(),!u||!l)throw n();return u})}getAllTransactionEvents(e){let r=[...e.logs.events];for(let n of e.contractResults.items)r.push(...n.logs.events);return r}};Ja.TransactionWatcher=Cr;Cr.DefaultPollingInterval=6e3;Cr.DefaultTimeout=Cr.DefaultPollingInterval*15;Cr.DefaultPatience=0;Cr.NoopOnStatusReceived=t=>{};var Pw=class{constructor(e){this.fetcher=e}getTransaction(e){return Sr(this,void 0,void 0,function*(){return zT.Logger.debug(`transactionWatcher, getTransaction(${e})`),yield this.fetcher.getTransaction(e)})}}});var WT=w(Xh=>{"use strict";c();Object.defineProperty(Xh,"__esModule",{value:!0});Xh.CodeMetadata=void 0;var Bw=class{constructor(e=!0,r=!1,n=!1,i=!1){this.upgradeable=e,this.readable=r,this.payable=n,this.payableBySc=i}toggleUpgradeable(e){this.upgradeable=e}toggleReadable(e){this.readable=e}togglePayable(e){this.payable=e}togglePayableBySc(e){this.payableBySc=e}toBuffer(){let e=0,r=0;return this.upgradeable&&(e|=Yh.Upgradeable),this.readable&&(e|=Yh.Readable),this.payable&&(r|=Jh.Payable),this.payableBySc&&(r|=Jh.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}};Xh.CodeMetadata=Bw;var Yh;(function(t){t[t.Upgradeable=1]="Upgradeable",t[t.Reserved2=2]="Reserved2",t[t.Readable=4]="Readable"})(Yh||(Yh={}));var Jh;(function(t){t[t.Reserved1=1]="Reserved1",t[t.Payable=2]="Payable",t[t.PayableBySc=4]="PayableBySc"})(Jh||(Jh={}))});var Zh=w(mn=>{"use strict";c();var gV=mn&&mn.__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]}),yV=mn&&mn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mV=mn&&mn.__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)&&gV(e,t,r);return yV(e,t),e};Object.defineProperty(mn,"__esModule",{value:!0});mn.ContractFunction=void 0;var wV=mV(je()),Kc=class{constructor(e){if(this.name=e,e==null)throw new wV.ErrInvalidFunctionName}static none(){return new Kc("untitled")}toString(){return this.name}valueOf(){return this.name}};mn.ContractFunction=Kc});var KT=w(Tr=>{"use strict";c();var EV=Tr&&Tr.__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]}),vV=Tr&&Tr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),AV=Tr&&Tr.__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 vV(e,t),e},bV=Tr&&Tr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Tr,"__esModule",{value:!0});Tr.InteractionChecker=void 0;var Lw=AV(je()),_V=bV(Yt()),Fw=class{checkInteraction(e,r){this.checkPayable(e,r),this.checkArguments(e,r)}checkPayable(e,r){let n=!new _V.default(e.getValue().toString()).isZero(),i=r.modifiers.isPayableInEGLD();if(n&&!i)throw new Lw.ErrContractInteraction("cannot send EGLD value to non-payable")}checkArguments(e,r){let n=r.input,i=e.getArguments(),s=n.length,o=i.length;if(s!=o)throw new Lw.ErrContractInteraction(`bad arguments, expected: ${s}, got: ${o}`);for(let a=0;a{"use strict";c();Object.defineProperty(ed,"__esModule",{value:!0});ed.Query=void 0;var IV=tr(),SV=Ph(),Mw=class{constructor(e){this.caller=e.caller||new IV.Address,this.address=e.address,this.func=e.func,this.args=e.args||[],this.value=e.value||0}getEncodedArguments(){return new SV.ArgSerializer().valuesToStrings(this.args)}};ed.Query=Mw});var YT=w(rd=>{"use strict";c();Object.defineProperty(rd,"__esModule",{value:!0});rd.Interaction=void 0;var $T=tr(),CV=Lh(),Uw=Go(),qw=Zh(),TV=KT(),xV=td(),Xa=Tt(),Vw=class{constructor(e,r,n){this.nonce=0,this.value="0",this.gasLimit=0,this.gasPrice=void 0,this.chainID="",this.querent=new $T.Address,this.sender=new $T.Address,this.isWithSingleESDTTransfer=!1,this.isWithSingleESDTNFTTransfer=!1,this.isWithMultiESDTNFTTransfer=!1,this.contract=e,this.function=r,this.args=n,this.tokenTransfers=new Za([],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(){CV.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 qw.ContractFunction(Uw.ESDT_TRANSFER_FUNCTION_NAME),n=this.tokenTransfers.buildArgsForSingleESDTTransfer()):this.isWithSingleESDTNFTTransfer?(e=this.sender,r=new qw.ContractFunction(Uw.ESDTNFT_TRANSFER_FUNCTION_NAME),n=this.tokenTransfers.buildArgsForSingleESDTNFTTransfer()):this.isWithMultiESDTNFTTransfer&&(e=this.sender,r=new qw.ContractFunction(Uw.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 xV.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 Za([e],this),this}withSingleESDTNFTTransfer(e,r){return this.isWithSingleESDTNFTTransfer=!0,this.tokenTransfers=new Za([e],this),r&&(this.sender=r),this}withMultiESDTNFTTransfer(e,r){return this.isWithMultiESDTNFTTransfer=!0,this.tokenTransfers=new Za(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 TV.InteractionChecker().checkInteraction(this,this.getEndpoint()),this}};rd.Interaction=Vw;var Za=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 Xa.U8Value(this.transfers.length)}getTypedTokenIdentifier(e){return Xa.BytesValue.fromUTF8(e.tokenIdentifier)}getTypedTokenNonce(e){return new Xa.U64Value(e.nonce)}getTypedTokenQuantity(e){return new Xa.BigUIntValue(e.amountAsBigInteger)}getTypedTokensReceiver(){return new Xa.AddressValue(this.interaction.getContractAddress())}getTypedInteractionFunction(){return Xa.BytesValue.fromUTF8(this.interaction.getFunction().valueOf())}getInteractionArguments(){return this.interaction.getArguments()}}});var JT=w(nd=>{"use strict";c();Object.defineProperty(nd,"__esModule",{value:!0});nd.ArgumentErrorContext=void 0;var NV=je(),jw=class{constructor(e,r,n){this.endpointName=e,this.argumentIndex=r,this.parameterDefinition=n}throwError(e){throw new NV.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)})`)}};nd.ArgumentErrorContext=jw});var ZT=w(ro=>{"use strict";c();var OV=ro&&ro.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ro,"__esModule",{value:!0});ro.NativeSerializer=void 0;var DV=OV(Yt()),PV=tr(),XT=je(),RV=xm(),BV=JT(),be=Tt(),LV;(function(t){function e(A,D){A=A||[],A=r(A,D);let x=D.input,R=[];for(let P=0;P0&&D[0].type.getCardinality().isComposite()&&(R=1/0,P=!0);for(let L of D){if(L.type.getCardinality().isSingular())break;x-=1}return{min:x,max:R,variadic:P}}function i(A,D,x){if(A&&A.belongsToTypesystem)return A;if(D instanceof be.OptionType)return s(A,D,x);if(D instanceof be.OptionalType)return o(A,D,x);if(D instanceof be.VariadicType)return a(A,D,x);if(D instanceof be.CompositeType)return l(A,D,x);if(D instanceof be.TupleType)return f(A,D,x);if(D instanceof be.StructType)return d(A,D,x);if(D instanceof be.ListType)return u(A,D,x);if(D instanceof be.PrimitiveType)return y(A,D,x);x.throwError(`convertToTypedValue: unhandled type ${D}`)}function s(A,D,x){if(A==null)return be.OptionValue.newMissing();let R=i(A,D.getFirstTypeParameter(),x);return be.OptionValue.newProvided(R)}function o(A,D,x){if(A==null)return new be.OptionalValue(D);let R=i(A,D.getFirstTypeParameter(),x);return new be.OptionalValue(D,R)}function a(A,D,x){A==null&&(A=[]),A.map===void 0&&x.convertError(A,"Variadic");let R=A.map(function(P){return i(P,D.getFirstTypeParameter(),x)});return new be.VariadicValue(D,R)}function u(A,D,x){A.map===void 0&&x.convertError(A,"List");let R=A.map(function(P){return i(P,D.getFirstTypeParameter(),x)});return new be.List(D,R)}function l(A,D,x){let R=[],P=D.getTypeParameters();x.guardSameLength(A,P);for(let L=0;L{"use strict";c();Object.defineProperty(jr,"__esModule",{value:!0});jr.ContractCallPayloadBuilder=jr.ContractUpgradePayloadBuilder=jr.ContractDeployPayloadBuilder=jr.ArwenVirtualMachine=void 0;var kw=jc(),zw=gr(),FV=Ph();jr.ArwenVirtualMachine="0500";var Hw=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(){zw.guardValueIsSet("code",this.code);let e=this.code.toString(),r=this.codeMetadata.toString(),n=`${e}@${jr.ArwenVirtualMachine}@${r}`;return n=Ww(n,this.arguments),new kw.TransactionPayload(n)}};jr.ContractDeployPayloadBuilder=Hw;var Gw=class{constructor(){this.code=null,this.codeMetadata="",this.arguments=[]}setCode(e){return this.code=e,this}setCodeMetadata(e){return this.codeMetadata=e,this}addInitArg(e){return this.arguments.push(e),this}setInitArgs(e){return this.arguments=e,this}build(){zw.guardValueIsSet("code",this.code);let e=this.code.toString(),r=this.codeMetadata.toString(),n=`upgradeContract@${e}@${r}`;return n=Ww(n,this.arguments),new kw.TransactionPayload(n)}};jr.ContractUpgradePayloadBuilder=Gw;var Qw=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(){zw.guardValueIsSet("calledFunction",this.contractFunction);let e=this.contractFunction.name;return e=Ww(e,this.arguments),new kw.TransactionPayload(e)}};jr.ContractCallPayloadBuilder=Qw;function Ww(t,e){let{argumentsString:r,count:n}=new FV.ArgSerializer().valuesToString(e);return n==0?t:`${t}@${r}`}});var Wn=w((Vse,Kw)=>{"use strict";c();var eu=typeof Reflect=="object"?Reflect:null,tx=eu&&typeof eu.apply=="function"?eu.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},id;eu&&typeof eu.ownKeys=="function"?id=eu.ownKeys:Object.getOwnPropertySymbols?id=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:id=function(e){return Object.getOwnPropertyNames(e)};function MV(t){console&&console.warn&&console.warn(t)}var nx=Number.isNaN||function(e){return e!==e};function He(){He.init.call(this)}Kw.exports=He;Kw.exports.once=jV;He.EventEmitter=He;He.prototype._events=void 0;He.prototype._eventsCount=0;He.prototype._maxListeners=void 0;var rx=10;function sd(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(He,"defaultMaxListeners",{enumerable:!0,get:function(){return rx},set:function(t){if(typeof t!="number"||t<0||nx(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");rx=t}});He.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};He.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||nx(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 ix(t){return t._maxListeners===void 0?He.defaultMaxListeners:t._maxListeners}He.prototype.getMaxListeners=function(){return ix(this)};He.prototype.emit=function(e){for(var r=[],n=1;n0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var u=s[e];if(u===void 0)return!1;if(typeof u=="function")tx(u,this,r);else for(var l=u.length,f=cx(u,l),n=0;n0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,MV(a)}return t}He.prototype.addListener=function(e,r){return sx(this,e,r,!1)};He.prototype.on=He.prototype.addListener;He.prototype.prependListener=function(e,r){return sx(this,e,r,!0)};function UV(){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 ox(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=UV.bind(n);return i.listener=r,n.wrapFn=i,i}He.prototype.once=function(e,r){return sd(r),this.on(e,ox(this,e,r)),this};He.prototype.prependOnceListener=function(e,r){return sd(r),this.prependListener(e,ox(this,e,r)),this};He.prototype.removeListener=function(e,r){var n,i,s,o,a;if(sd(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():qV(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};He.prototype.off=He.prototype.removeListener;He.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i=0;i--)this.removeListener(e,r[i]);return this};function ax(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?VV(i):cx(i,i.length)}He.prototype.listeners=function(e){return ax(this,e,!0)};He.prototype.rawListeners=function(e){return ax(this,e,!1)};He.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):ux.call(t,e)};He.prototype.listenerCount=ux;function ux(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}He.prototype.eventNames=function(){return this._eventsCount>0?id(this._events):[]};function cx(t,e){for(var r=new Array(e),n=0;n{c();fx.exports=Wn().EventEmitter});var Yw=w(()=>{c()});var mx=w((Wse,yx)=>{"use strict";c();function hx(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 dx(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 od.alloc(0);for(var n=od.allocUnsafe(r>>>0),i=this.head,s=0;i;)YV(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=od.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:$V,value:function(r,n){return Jw(this,dx(dx({},n),{},{depth:0,customInspect:!1}))}}]),t}()});var Zw=w(($se,Ex)=>{"use strict";c();function JV(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(Xw,this,t)):p.default.nextTick(Xw,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(ad,r):(r._writableState.errorEmitted=!0,p.default.nextTick(wx,r,s)):p.default.nextTick(wx,r,s):e?(p.default.nextTick(ad,r),e(s)):p.default.nextTick(ad,r)}),this)}function wx(t,e){Xw(t,e),ad(t)}function ad(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function XV(){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 Xw(t,e){t.emit("error",e)}function ZV(t,e){var r=t._readableState,n=t._writableState;r&&r.autoDestroy||n&&n.autoDestroy?t.destroy(e):t.emit("error",e)}Ex.exports={destroy:JV,undestroy:XV,errorOrDestroy:ZV}});var no=w((Jse,bx)=>{"use strict";c();function ej(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var Ax={};function xr(t,e,r){r||(r=Error);function n(s,o,a){return typeof e=="string"?e:e(s,o,a)}var i=function(s){ej(o,s);function o(a,u,l){return s.call(this,n(a,u,l))||this}return o}(r);i.prototype.name=r.name,i.prototype.code=t,Ax[t]=i}function vx(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 tj(t,e,r){return t.substr(!r||r<0?0:+r,e.length)===e}function rj(t,e,r){return(r===void 0||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}function nj(t,e,r){return typeof r!="number"&&(r=0),r+e.length>t.length?!1:t.indexOf(e,r)!==-1}xr("ERR_INVALID_OPT_VALUE",function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'},TypeError);xr("ERR_INVALID_ARG_TYPE",function(t,e,r){var n;typeof e=="string"&&tj(e,"not ")?(n="must not be",e=e.replace(/^not /,"")):n="must be";var i;if(rj(t," argument"))i="The ".concat(t," ").concat(n," ").concat(vx(e,"type"));else{var s=nj(t,".")?"property":"argument";i='The "'.concat(t,'" ').concat(s," ").concat(n," ").concat(vx(e,"type"))}return i+=". Received type ".concat(typeof r),i},TypeError);xr("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");xr("ERR_METHOD_NOT_IMPLEMENTED",function(t){return"The "+t+" method is not implemented"});xr("ERR_STREAM_PREMATURE_CLOSE","Premature close");xr("ERR_STREAM_DESTROYED",function(t){return"Cannot call "+t+" after a stream was destroyed"});xr("ERR_MULTIPLE_CALLBACK","Callback called multiple times");xr("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");xr("ERR_STREAM_WRITE_AFTER_END","write after end");xr("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);xr("ERR_UNKNOWN_ENCODING",function(t){return"Unknown encoding: "+t},TypeError);xr("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");bx.exports.codes=Ax});var eE=w((Zse,_x)=>{"use strict";c();var ij=no().codes.ERR_INVALID_OPT_VALUE;function sj(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function oj(t,e,r,n){var i=sj(e,n,r);if(i!=null){if(!(isFinite(i)&&Math.floor(i)===i)||i<0){var s=n?r:"highWaterMark";throw new ij(s,i)}return Math.floor(i)}return t.objectMode?16:16*1024}_x.exports={getHighWaterMark:oj}});var tu=w((toe,tE)=>{c();typeof Object.create=="function"?tE.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:tE.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 Sx=w((noe,Ix)=>{c();Ix.exports=aj;function aj(t,e){if(rE("noDeprecation"))return t;var r=!1;function n(){if(!r){if(rE("throwDeprecation"))throw new Error(e);rE("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}return n}function rE(t){try{if(!global.localStorage)return!1}catch{return!1}var e=global.localStorage[t];return e==null?!1:String(e).toLowerCase()==="true"}});var sE=w((soe,Dx)=>{"use strict";c();Dx.exports=ut;function Tx(t){var e=this;this.next=null,this.entry=null,this.finish=function(){Bj(e,t)}}var ru;ut.WritableState=Yc;var uj={deprecate:Sx()},xx=$w(),cd=Wa().Buffer,cj=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function lj(t){return cd.from(t)}function fj(t){return cd.isBuffer(t)||t instanceof cj}var iE=Zw(),hj=eE(),dj=hj.getHighWaterMark,Pi=no().codes,pj=Pi.ERR_INVALID_ARG_TYPE,gj=Pi.ERR_METHOD_NOT_IMPLEMENTED,yj=Pi.ERR_MULTIPLE_CALLBACK,mj=Pi.ERR_STREAM_CANNOT_PIPE,wj=Pi.ERR_STREAM_DESTROYED,Ej=Pi.ERR_STREAM_NULL_VALUES,vj=Pi.ERR_STREAM_WRITE_AFTER_END,Aj=Pi.ERR_UNKNOWN_ENCODING,nu=iE.errorOrDestroy;tu()(ut,xx);function bj(){}function Yc(t,e,r){ru=ru||io(),t=t||{},typeof r!="boolean"&&(r=e instanceof ru),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=dj(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){Nj(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 Tx(this)}Yc.prototype.getBuffer=function(){for(var e=this.bufferedRequest,r=[];e;)r.push(e),e=e.next;return r};(function(){try{Object.defineProperty(Yc.prototype,"buffer",{get:uj.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var ud;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(ud=Function.prototype[Symbol.hasInstance],Object.defineProperty(ut,Symbol.hasInstance,{value:function(e){return ud.call(this,e)?!0:this!==ut?!1:e&&e._writableState instanceof Yc}})):ud=function(e){return e instanceof this};function ut(t){ru=ru||io();var e=this instanceof ru;if(!e&&!ud.call(ut,this))return new ut(t);this._writableState=new Yc(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)),xx.call(this)}ut.prototype.pipe=function(){nu(this,new mj)};function _j(t,e){var r=new vj;nu(t,r),p.default.nextTick(e,r)}function Ij(t,e,r,n){var i;return r===null?i=new Ej:typeof r!="string"&&!e.objectMode&&(i=new pj("chunk",["string","Buffer"],r)),i?(nu(t,i),p.default.nextTick(n,i),!1):!0}ut.prototype.write=function(t,e,r){var n=this._writableState,i=!1,s=!n.objectMode&&fj(t);return s&&!cd.isBuffer(t)&&(t=lj(t)),typeof e=="function"&&(r=e,e=null),s?e="buffer":e||(e=n.defaultEncoding),typeof r!="function"&&(r=bj),n.ending?_j(this,r):(s||Ij(this,n,t,r))&&(n.pendingcb++,i=Cj(this,n,s,t,e,r)),i};ut.prototype.cork=function(){this._writableState.corked++};ut.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,!t.writing&&!t.corked&&!t.bufferProcessing&&t.bufferedRequest&&Nx(this,t))};ut.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new Aj(e);return this._writableState.defaultEncoding=e,this};Object.defineProperty(ut.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function Sj(t,e,r){return!t.objectMode&&t.decodeStrings!==!1&&typeof e=="string"&&(e=cd.from(e,r)),e}Object.defineProperty(ut.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function Cj(t,e,r,n,i,s){if(!r){var o=Sj(e,n,i);n!==o&&(r=!0,i="buffer",n=o)}var a=e.objectMode?1:n.length;e.length+=a;var u=e.length{"use strict";c();var Lj=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};Rx.exports=wn;var Px=uE(),aE=sE();tu()(wn,Px);for(oE=Lj(aE.prototype),ld=0;ld{c();var hd=Wa(),En=hd.Buffer;function Bx(t,e){for(var r in t)e[r]=t[r]}En.from&&En.alloc&&En.allocUnsafe&&En.allocUnsafeSlow?Lx.exports=hd:(Bx(hd,cE),cE.Buffer=so);function so(t,e,r){return En(t,e,r)}so.prototype=Object.create(En.prototype);Bx(En,so);so.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return En(t,e,r)};so.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=En(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};so.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return En(t)};so.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return hd.SlowBuffer(t)}});var hE=w(Ux=>{"use strict";c();var fE=Fx().Buffer,Mx=fE.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 qj(t){var e=Uj(t);if(typeof e!="string"&&(fE.isEncoding===Mx||!Mx(t)))throw new Error("Unknown encoding: "+t);return e||t}Ux.StringDecoder=Jc;function Jc(t){this.encoding=qj(t);var e;switch(this.encoding){case"utf16le":this.text=kj,this.end=zj,e=4;break;case"utf8":this.fillLast=Hj,e=4;break;case"base64":this.text=Wj,this.end=Kj,e=3;break;default:this.write=$j,this.end=Yj;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=fE.allocUnsafe(e)}Jc.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 Vj(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 jj(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=jj(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 Gj(t,e){var r=Vj(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 Qj(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function kj(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 zj(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 Kj(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function $j(t){return t.toString(this.encoding)}function Yj(t){return t&&t.length?this.write(t):""}});var dd=w((hoe,jx)=>{"use strict";c();var qx=no().codes.ERR_STREAM_PREMATURE_CLOSE;function Jj(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,n=new Array(r),i=0;i{"use strict";c();var pd;function Ri(t,e,r){return e=eH(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function eH(t){var e=tH(t,"string");return typeof e=="symbol"?e:String(e)}function tH(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 rH=dd(),Bi=Symbol("lastResolve"),oo=Symbol("lastReject"),Xc=Symbol("error"),gd=Symbol("ended"),ao=Symbol("lastPromise"),dE=Symbol("handlePromise"),uo=Symbol("stream");function Li(t,e){return{value:t,done:e}}function nH(t){var e=t[Bi];if(e!==null){var r=t[uo].read();r!==null&&(t[ao]=null,t[Bi]=null,t[oo]=null,e(Li(r,!1)))}}function iH(t){p.default.nextTick(nH,t)}function sH(t,e){return function(r,n){t.then(function(){if(e[gd]){r(Li(void 0,!0));return}e[dE](r,n)},n)}}var oH=Object.getPrototypeOf(function(){}),aH=Object.setPrototypeOf((pd={get stream(){return this[uo]},next:function(){var e=this,r=this[Xc];if(r!==null)return Promise.reject(r);if(this[gd])return Promise.resolve(Li(void 0,!0));if(this[uo].destroyed)return new Promise(function(o,a){p.default.nextTick(function(){e[Xc]?a(e[Xc]):o(Li(void 0,!0))})});var n=this[ao],i;if(n)i=new Promise(sH(n,this));else{var s=this[uo].read();if(s!==null)return Promise.resolve(Li(s,!1));i=new Promise(this[dE])}return this[ao]=i,i}},Ri(pd,Symbol.asyncIterator,function(){return this}),Ri(pd,"return",function(){var e=this;return new Promise(function(r,n){e[uo].destroy(null,function(i){if(i){n(i);return}r(Li(void 0,!0))})})}),pd),oH),uH=function(e){var r,n=Object.create(aH,(r={},Ri(r,uo,{value:e,writable:!0}),Ri(r,Bi,{value:null,writable:!0}),Ri(r,oo,{value:null,writable:!0}),Ri(r,Xc,{value:null,writable:!0}),Ri(r,gd,{value:e._readableState.endEmitted,writable:!0}),Ri(r,dE,{value:function(s,o){var a=n[uo].read();a?(n[ao]=null,n[Bi]=null,n[oo]=null,s(Li(a,!1))):(n[Bi]=s,n[oo]=o)},writable:!0}),r));return n[ao]=null,rH(e,function(i){if(i&&i.code!=="ERR_STREAM_PREMATURE_CLOSE"){var s=n[oo];s!==null&&(n[ao]=null,n[Bi]=null,n[oo]=null,s(i)),n[Xc]=i;return}var o=n[Bi];o!==null&&(n[ao]=null,n[Bi]=null,n[oo]=null,o(Li(void 0,!0))),n[gd]=!0}),e.on("readable",iH.bind(null,n)),n};Hx.exports=uH});var kx=w((yoe,Qx)=>{c();Qx.exports=function(){throw new Error("Readable.from is not available in the browser")}});var uE=w((Eoe,t2)=>{"use strict";c();t2.exports=Fe;var iu;Fe.ReadableState=$x;var woe=Wn().EventEmitter,Kx=function(e,r){return e.listeners(r).length},el=$w(),yd=Wa().Buffer,cH=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function lH(t){return yd.from(t)}function fH(t){return yd.isBuffer(t)||t instanceof cH}var pE=Yw(),xe;pE&&pE.debuglog?xe=pE.debuglog("stream"):xe=function(){};var hH=mx(),AE=Zw(),dH=eE(),pH=dH.getHighWaterMark,md=no().codes,gH=md.ERR_INVALID_ARG_TYPE,yH=md.ERR_STREAM_PUSH_AFTER_EOF,mH=md.ERR_METHOD_NOT_IMPLEMENTED,wH=md.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,su,gE,yE;tu()(Fe,el);var Zc=AE.errorOrDestroy,mE=["error","close","destroy","pause","resume"];function EH(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 $x(t,e,r){iu=iu||io(),t=t||{},typeof r!="boolean"&&(r=e instanceof iu),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=pH(this,t,"readableHighWaterMark",r),this.buffer=new hH,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&&(su||(su=hE().StringDecoder),this.decoder=new su(t.encoding),this.encoding=t.encoding)}function Fe(t){if(iu=iu||io(),!(this instanceof Fe))return new Fe(t);var e=this instanceof iu;this._readableState=new $x(t,this,e),this.readable=!0,t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy)),el.call(this)}Object.defineProperty(Fe.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}});Fe.prototype.destroy=AE.destroy;Fe.prototype._undestroy=AE.undestroy;Fe.prototype._destroy=function(t,e){e(t)};Fe.prototype.push=function(t,e){var r=this._readableState,n;return r.objectMode?n=!0:typeof t=="string"&&(e=e||r.defaultEncoding,e!==r.encoding&&(t=yd.from(t,e),e=""),n=!0),Yx(this,t,e,!1,n)};Fe.prototype.unshift=function(t){return Yx(this,t,null,!0,!1)};function Yx(t,e,r,n,i){xe("readableAddChunk",e);var s=t._readableState;if(e===null)s.reading=!1,bH(t,s);else{var o;if(i||(o=vH(s,e)),o)Zc(t,o);else if(s.objectMode||e&&e.length>0)if(typeof e!="string"&&!s.objectMode&&Object.getPrototypeOf(e)!==yd.prototype&&(e=lH(e)),n)s.endEmitted?Zc(t,new wH):wE(t,s,e,!0);else if(s.ended)Zc(t,new yH);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(e=s.decoder.write(e),s.objectMode||e.length!==0?wE(t,s,e,!1):vE(t,s)):wE(t,s,e,!1)}else n||(s.reading=!1,vE(t,s))}return!s.ended&&(s.length=zx?t=zx:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}function Wx(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=AH(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}Fe.prototype.read=function(t){xe("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(t!==0&&(e.emittedReadable=!1),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return xe("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?EE(this):wd(this),null;if(t=Wx(t,e),t===0&&e.ended)return e.length===0&&EE(this),null;var n=e.needReadable;xe("need readable",n),(e.length===0||e.length-t0?i=Zx(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&&EE(this)),i!==null&&this.emit("data",i),i};function bH(t,e){if(xe("onEofChunk"),!e.ended){if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?wd(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,Jx(t)))}}function wd(t){var e=t._readableState;xe("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(xe("emitReadable",e.flowing),e.emittedReadable=!0,p.default.nextTick(Jx,t))}function Jx(t){var e=t._readableState;xe("emitReadable_",e.destroyed,e.length,e.ended),!e.destroyed&&(e.length||e.ended)&&(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,bE(t)}function vE(t,e){e.readingMore||(e.readingMore=!0,p.default.nextTick(_H,t,e))}function _H(t,e){for(;!e.reading&&!e.ended&&(e.length1&&e2(n.pipes,t)!==-1)&&!l&&(xe("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function y(B){xe("onerror",B),T(),t.removeListener("error",y),Kx(t,"error")===0&&Zc(t,B)}EH(t,"error",y);function m(){t.removeListener("finish",v),T()}t.once("close",m);function v(){xe("onfinish"),t.removeListener("close",m),T()}t.once("finish",v);function T(){xe("unpipe"),r.unpipe(t)}return t.emit("pipe",r),n.flowing||(xe("pipe resume"),r.resume()),t};function IH(t){return function(){var r=t._readableState;xe("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,r.awaitDrain===0&&Kx(t,"data")&&(r.flowing=!0,bE(t))}}Fe.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(e.pipesCount===0)return this;if(e.pipesCount===1)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r),this);if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var s=0;s0,n.flowing!==!1&&this.resume()):t==="readable"&&!n.endEmitted&&!n.readableListening&&(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,xe("on readable",n.length,n.reading),n.length?wd(this):n.reading||p.default.nextTick(SH,this)),r};Fe.prototype.addListener=Fe.prototype.on;Fe.prototype.removeListener=function(t,e){var r=el.prototype.removeListener.call(this,t,e);return t==="readable"&&p.default.nextTick(Xx,this),r};Fe.prototype.removeAllListeners=function(t){var e=el.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&p.default.nextTick(Xx,this),e};function Xx(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 SH(t){xe("readable nexttick read 0"),t.read(0)}Fe.prototype.resume=function(){var t=this._readableState;return t.flowing||(xe("resume"),t.flowing=!t.readableListening,CH(this,t)),t.paused=!1,this};function CH(t,e){e.resumeScheduled||(e.resumeScheduled=!0,p.default.nextTick(TH,t,e))}function TH(t,e){xe("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),bE(t),e.flowing&&!e.reading&&t.read(0)}Fe.prototype.pause=function(){return xe("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(xe("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function bE(t){var e=t._readableState;for(xe("flow",e.flowing);e.flowing&&t.read()!==null;);}Fe.prototype.wrap=function(t){var e=this,r=this._readableState,n=!1;t.on("end",function(){if(xe("wrapped end"),r.decoder&&!r.ended){var o=r.decoder.end();o&&o.length&&e.push(o)}e.push(null)}),t.on("data",function(o){if(xe("wrapped data"),r.decoder&&(o=r.decoder.write(o)),!(r.objectMode&&o==null)&&!(!r.objectMode&&(!o||!o.length))){var a=e.push(o);a||(n=!0,t.pause())}});for(var i in t)this[i]===void 0&&typeof t[i]=="function"&&(this[i]=function(a){return function(){return t[a].apply(t,arguments)}}(i));for(var s=0;s=e.length?(e.decoder?r=e.buffer.join(""):e.buffer.length===1?r=e.buffer.first():r=e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r}function EE(t){var e=t._readableState;xe("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,p.default.nextTick(xH,e,t))}function xH(t,e){if(xe("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&t.length===0&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}typeof Symbol=="function"&&(Fe.from=function(t,e){return yE===void 0&&(yE=kx()),yE(Fe,t,e)});function e2(t,e){for(var r=0,n=t.length;r{"use strict";c();n2.exports=Kn;var Ed=no().codes,NH=Ed.ERR_METHOD_NOT_IMPLEMENTED,OH=Ed.ERR_MULTIPLE_CALLBACK,DH=Ed.ERR_TRANSFORM_ALREADY_TRANSFORMING,PH=Ed.ERR_TRANSFORM_WITH_LENGTH_0,vd=io();tu()(Kn,vd);function RH(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(n===null)return this.emit("error",new OH);r.writechunk=null,r.writecb=null,e!=null&&this.push(e),n(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length{"use strict";c();s2.exports=tl;var i2=_E();tu()(tl,i2);function tl(t){if(!(this instanceof tl))return new tl(t);i2.call(this,t)}tl.prototype._transform=function(t,e,r){r(null,t)}});var f2=w((Soe,l2)=>{"use strict";c();var IE;function LH(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}var c2=no().codes,FH=c2.ERR_MISSING_ARGS,MH=c2.ERR_STREAM_DESTROYED;function a2(t){if(t)throw t}function UH(t){return t.setHeader&&typeof t.abort=="function"}function qH(t,e,r,n){n=LH(n);var i=!1;t.on("close",function(){i=!0}),IE===void 0&&(IE=dd()),IE(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,UH(t))return t.abort();if(typeof t.destroy=="function")return t.destroy();n(o||new MH("pipe"))}}}function u2(t){t()}function VH(t,e){return t.pipe(e)}function jH(t){return!t.length||typeof t[t.length-1]!="function"?a2:t.pop()}function HH(){for(var t=arguments.length,e=new Array(t),r=0;r0;return qH(o,u,l,function(f){i||(i=f),f&&s.forEach(u2),!u&&(s.forEach(u2),n(i))})});return e.reduce(VH)}l2.exports=HH});var SE=w((Nr,h2)=>{c();Nr=h2.exports=uE();Nr.Stream=Nr;Nr.Readable=Nr;Nr.Writable=sE();Nr.Duplex=io();Nr.Transform=_E();Nr.PassThrough=o2();Nr.finished=dd();Nr.pipeline=f2()});var g2=w((xoe,p2)=>{c();var{Transform:GH}=SE();p2.exports=t=>class d2 extends GH{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 d2(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}}});var w2=w((Ooe,m2)=>{c();var{Transform:QH}=SE();m2.exports=t=>class y2 extends QH{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 y2(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}}});var v2=w((Poe,E2)=>{c();var kH=g2(),zH=w2();E2.exports=function(t){let e=kH(t),r=zH(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 _2=w(b2=>{c();var A2=[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];b2.p1600=function(t){for(let e=0;e<24;++e){let r=t[0]^t[10]^t[20]^t[30]^t[40],n=t[1]^t[11]^t[21]^t[31]^t[41],i=t[2]^t[12]^t[22]^t[32]^t[42],s=t[3]^t[13]^t[23]^t[33]^t[43],o=t[4]^t[14]^t[24]^t[34]^t[44],a=t[5]^t[15]^t[25]^t[35]^t[45],u=t[6]^t[16]^t[26]^t[36]^t[46],l=t[7]^t[17]^t[27]^t[37]^t[47],f=t[8]^t[18]^t[28]^t[38]^t[48],d=t[9]^t[19]^t[29]^t[39]^t[49],y=f^(i<<1|s>>>31),m=d^(s<<1|i>>>31),v=t[0]^y,T=t[1]^m,B=t[10]^y,A=t[11]^m,D=t[20]^y,x=t[21]^m,R=t[30]^y,P=t[31]^m,L=t[40]^y,_=t[41]^m;y=r^(o<<1|a>>>31),m=n^(a<<1|o>>>31);let C=t[2]^y,M=t[3]^m,Z=t[12]^y,z=t[13]^m,H=t[22]^y,G=t[23]^m,$=t[32]^y,de=t[33]^m,ae=t[42]^y,re=t[43]^m;y=i^(u<<1|l>>>31),m=s^(l<<1|u>>>31);let Y=t[4]^y,ie=t[5]^m,te=t[14]^y,ne=t[15]^m,q=t[24]^y,ce=t[25]^m,oe=t[34]^y,le=t[35]^m,se=t[44]^y,ue=t[45]^m;y=o^(f<<1|d>>>31),m=a^(d<<1|f>>>31);let g=t[6]^y,E=t[7]^m,b=t[16]^y,O=t[17]^m,I=t[26]^y,N=t[27]^m,F=t[36]^y,S=t[37]^m,U=t[46]^y,j=t[47]^m;y=u^(r<<1|n>>>31),m=l^(n<<1|r>>>31);let V=t[8]^y,X=t[9]^m,ye=t[18]^y,we=t[19]^m,Pe=t[28]^y,$e=t[29]^m,ot=t[38]^y,Oe=t[39]^m,Me=t[48]^y,vt=t[49]^m,ci=v,gs=T,ys=A<<4|B>>>28,Xt=B<<4|A>>>28,Ln=D<<3|x>>>29,jt=x<<3|D>>>29,At=P<<9|R>>>23,Qe=R<<9|P>>>23,_0=L<<18|_>>>14,I0=_<<18|L>>>14,S0=C<<1|M>>>31,C0=M<<1|C>>>31,T0=z<<12|Z>>>20,x0=Z<<12|z>>>20,N0=H<<10|G>>>22,O0=G<<10|H>>>22,D0=de<<13|$>>>19,P0=$<<13|de>>>19,R0=ae<<2|re>>>30,B0=re<<2|ae>>>30,L0=ie<<30|Y>>>2,F0=Y<<30|ie>>>2,M0=te<<6|ne>>>26,U0=ne<<6|te>>>26,q0=ce<<11|q>>>21,V0=q<<11|ce>>>21,j0=oe<<15|le>>>17,H0=le<<15|oe>>>17,G0=ue<<29|se>>>3,Q0=se<<29|ue>>>3,k0=g<<28|E>>>4,z0=E<<28|g>>>4,W0=O<<23|b>>>9,K0=b<<23|O>>>9,$0=I<<25|N>>>7,Y0=N<<25|I>>>7,J0=F<<21|S>>>11,X0=S<<21|F>>>11,Z0=j<<24|U>>>8,ey=U<<24|j>>>8,ty=V<<27|X>>>5,ry=X<<27|V>>>5,ny=ye<<20|we>>>12,iy=we<<20|ye>>>12,sy=$e<<7|Pe>>>25,oy=Pe<<7|$e>>>25,ay=ot<<8|Oe>>>24,uy=Oe<<8|ot>>>24,cy=Me<<14|vt>>>18,ly=vt<<14|Me>>>18;t[0]=ci^~T0&q0,t[1]=gs^~x0&V0,t[10]=k0^~ny&Ln,t[11]=z0^~iy&jt,t[20]=S0^~M0&$0,t[21]=C0^~U0&Y0,t[30]=ty^~ys&N0,t[31]=ry^~Xt&O0,t[40]=L0^~W0&sy,t[41]=F0^~K0&oy,t[2]=T0^~q0&J0,t[3]=x0^~V0&X0,t[12]=ny^~Ln&D0,t[13]=iy^~jt&P0,t[22]=M0^~$0&ay,t[23]=U0^~Y0&uy,t[32]=ys^~N0&j0,t[33]=Xt^~O0&H0,t[42]=W0^~sy&At,t[43]=K0^~oy&Qe,t[4]=q0^~J0&cy,t[5]=V0^~X0&ly,t[14]=Ln^~D0&G0,t[15]=jt^~P0&Q0,t[24]=$0^~ay&_0,t[25]=Y0^~uy&I0,t[34]=N0^~j0&Z0,t[35]=O0^~H0&ey,t[44]=sy^~At&R0,t[45]=oy^~Qe&B0,t[6]=J0^~cy&ci,t[7]=X0^~ly&gs,t[16]=D0^~G0&k0,t[17]=P0^~Q0&z0,t[26]=ay^~_0&S0,t[27]=uy^~I0&C0,t[36]=j0^~Z0&ty,t[37]=H0^~ey&ry,t[46]=At^~R0&L0,t[47]=Qe^~B0&F0,t[8]=cy^~ci&T0,t[9]=ly^~gs&x0,t[18]=G0^~k0&ny,t[19]=Q0^~z0&iy,t[28]=_0^~S0&M0,t[29]=I0^~C0&U0,t[38]=Z0^~ty&ys,t[39]=ey^~ry&Xt,t[48]=R0^~L0&W0,t[49]=B0^~F0&K0,t[0]^=A2[e*2],t[1]^=A2[e*2+1]}}});var S2=w((Foe,I2)=>{c();var Ad=_2();function ou(){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}ou.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};ou.prototype.absorb=function(t){for(let e=0;e>>8*(this.count%4)&255,this.count+=1,this.count===this.blockSize&&(Ad.p1600(this.state),this.count=0);return e};ou.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=ou});var T2=w((Uoe,C2)=>{c();C2.exports=v2()(S2())});var D2=w(au=>{"use strict";c();var WH=au&&au.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(au,"__esModule",{value:!0});au.SmartContract=void 0;var KH=WH(Yt()),rl=tr(),CE=Lh(),$H=je(),TE=Wc(),YH=gr(),JH=lh(),x2=WT(),N2=Zh(),O2=YT(),XH=ZT(),ZH=td(),bd=ex(),e7=T2(),xE=class{constructor(e={}){this.address=new rl.Address,this.methodsExplicit={},this.methods={},this.address=e.address||new rl.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 N2.ContractFunction(i);return new O2.Interaction(e,o,s||[])},this.methods[i]=function(s){let o=new N2.ContractFunction(i),a=XH.NativeSerializer.nativeToTypedValues(s||[],n);return new O2.Interaction(e,o,a||[])}}}setAddress(e){this.address=e}getAddress(){return this.address}getAbi(){return YH.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}){CE.Compatibility.guardAddressIsSetAndNonZero(e,"'deployer' of SmartContract.deploy()","pass the actual address to deploy()"),n=n||new x2.CodeMetadata,i=i||[],s=s||0;let l=new bd.ContractDeployPayloadBuilder().setCode(r).setCodeMetadata(n).setInitArgs(i).build();return new TE.Transaction({receiver:rl.Address.Zero(),sender:e,value:s,gasLimit:o,gasPrice:a,data:l,chainID:u})}upgrade({caller:e,code:r,codeMetadata:n,initArguments:i,value:s,gasLimit:o,gasPrice:a,chainID:u}){CE.Compatibility.guardAddressIsSetAndNonZero(e,"'caller' of SmartContract.upgrade()","pass the actual address to upgrade()"),this.ensureHasAddress(),n=n||new x2.CodeMetadata,i=i||[],s=s||0;let l=new bd.ContractUpgradePayloadBuilder().setCode(r).setCodeMetadata(n).setInitArgs(i).build();return new TE.Transaction({sender:e,receiver:this.getAddress(),value:s,gasLimit:o,gasPrice:a,data:l,chainID:u})}call({func:e,args:r,value:n,gasLimit:i,receiver:s,gasPrice:o,chainID:a,caller:u}){CE.Compatibility.guardAddressIsSetAndNonZero(u,"'caller' of SmartContract.call()","pass the actual address to call()"),this.ensureHasAddress(),r=r||[],n=n||0;let l=new bd.ContractCallPayloadBuilder().setFunction(e).setArgs(r).build();return new TE.Transaction({sender:u,receiver:s||this.getAddress(),value:n,gasLimit:i,gasPrice:o,data:l,chainID:a})}createQuery({func:e,args:r,value:n,caller:i}){return this.ensureHasAddress(),new ZH.Query({address:this.getAddress(),func:e,args:r,value:n,caller:i})}ensureHasAddress(){if(!this.getAddress().bech32())throw new $H.ErrContractHasNoAddress}static computeAddress(e,r){let n=h.Buffer.alloc(8,0),i=new rl.Address(e.bech32()).pubkey(),s=i.slice(30),o=h.Buffer.alloc(8),a=new KH.default(r.valueOf().toString(10)),u=JH.bigIntToBuffer(a);o.write(u.reverse().toString("hex"),"hex");let l=h.Buffer.concat([i,o]),f=e7("keccak256").update(l).digest(),d=h.Buffer.from(bd.ArwenVirtualMachine,"hex"),y=h.Buffer.concat([n,d,f.slice(10,30),s]);return new rl.Address(y)}};au.SmartContract=xE});var P2=w(uu=>{"use strict";c();Object.defineProperty(uu,"__esModule",{value:!0});uu.Signature=uu.Address=void 0;var NE=class{constructor(e){this.value=e}bech32(){return this.value}};uu.Address=NE;var OE=class{constructor(e){this.value=e}hex(){return this.value}};uu.Signature=OE});var R2=w(nl=>{"use strict";c();Object.defineProperty(nl,"__esModule",{value:!0});nl.Operation=void 0;var t7;(function(t){t.Connect="connect",t.Logout="logout",t.SignTransactions="signTransactions",t.SignMessage="signMessage",t.CancelAction="cancelAction"})(t7=nl.Operation||(nl.Operation={}))});var B2=w(Fi=>{"use strict";c();Object.defineProperty(Fi,"__esModule",{value:!0});Fi.ErrAccountNotConnected=Fi.ErrCannotSignSingleTransaction=Fi.Err=void 0;var il=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};Fi.Err=il;var DE=class extends il{constructor(){super("Cannot sign single transaction.")}};Fi.ErrCannotSignSingleTransaction=DE;var PE=class extends il{constructor(){super("Account is not connected.")}};Fi.ErrAccountNotConnected=PE});var RE=w(cu=>{"use strict";c();var Mi=cu&&cu.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(cu,"__esModule",{value:!0});cu.ExtensionProvider=void 0;var _d=P2(),sl=R2(),L2=B2(),vn=class{constructor(){if(this.account={address:""},this.initialized=!1,vn._instance)throw new Error("Error: Instantiation failed: Use ExtensionProvider.getInstance() instead of new.");vn._instance=this}static getInstance(){return vn._instance}setAddress(e){return this.account.address=e,vn._instance}init(){return Mi(this,void 0,void 0,function*(){return window&&window.elrondWallet&&(this.initialized=!0),this.initialized})}login(e={}){return Mi(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(sl.Operation.Connect,n),this.account.address})}logout(){return Mi(this,void 0,void 0,function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");try{yield this.startBgrMsgChannel(sl.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 Mi(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 Mi(this,void 0,void 0,function*(){return!!this.account.address})}signTransaction(e){return Mi(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 Mi(this,void 0,void 0,function*(){this.ensureConnected();let r=yield this.startBgrMsgChannel(sl.Operation.SignTransactions,{from:this.account.address,transactions:e.map(n=>n.toPlainObject())});try{for(let n=0;n{window.postMessage({target:"erdw-inpage",type:e,data:r},window.origin);let i=s=>{s.isTrusted&&s.data.target==="erdw-contentScript"&&(s.data.type==="connectResponse"?(s.data.data&&s.data.data.address&&(this.account=s.data.data),window.removeEventListener("message",i),n(s.data.data)):(window.removeEventListener("message",i),n(s.data.data)))};window.addEventListener("message",i,!1)})}};cu.ExtensionProvider=vn;vn._instance=new vn});var j2=w((sae,V2)=>{"use strict";c();function r7(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}V2.exports=n7;function n7(t,e,r){var n=r&&r.stringify||r7,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}l+=n(e[f]),d=m+2,m++;break;case 115:if(f>=u)break;d{"use strict";c();var H2=j2();k2.exports=bn;var ol=d7().console||{},i7={mapHttpRequest:xd,mapHttpResponse:xd,wrapRequestSerializer:BE,wrapResponseSerializer:BE,wrapErrorSerializer:BE,req:xd,res:xd,err:c7};function s7(t,e){return Array.isArray(t)?t.filter(function(n){return n!=="!stdSerializers.err"}):t===!0?Object.keys(e):!1}function bn(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||ol;t.browser.write&&(t.browser.asObject=!0);let n=t.serializers||{},i=s7(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=al),Object.defineProperty(u,"levelVal",{get:f}),Object.defineProperty(u,"level",{get:d,set:y});let l={transmit:e,serialize:i,asObject:t.browser.asObject,levels:o,timestamp:l7(t)};u.levels=bn.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=al,u.serializers=n,u._serialize=i,u._stdErrSerialize=s,u.child=m,e&&(u._logEvent=LE());function f(){return this.level==="silent"?1/0:this.levels.values[this.level]}function d(){return this._level}function y(v){if(v!=="silent"&&!this.levels.values[v])throw Error("unknown level "+v);this._level=v,lu(l,u,"error","log"),lu(l,u,"fatal","error"),lu(l,u,"warn","error"),lu(l,u,"info","log"),lu(l,u,"debug","log"),lu(l,u,"trace","log")}function m(v,T){if(!v)throw new Error("missing bindings for child Pino");T=T||{},i&&v.serializers&&(T.serializers=v.serializers);let B=T.serializers;if(i&&B){var A=Object.assign({},n,B),D=t.browser.serialize===!0?Object.keys(A):i;delete v.serializers,Nd([v],D,A,this._stdErrSerialize)}function x(R){this._childLevel=(R._childLevel|0)+1,this.error=fu(R,v,"error"),this.fatal=fu(R,v,"fatal"),this.warn=fu(R,v,"warn"),this.info=fu(R,v,"info"),this.debug=fu(R,v,"debug"),this.trace=fu(R,v,"trace"),A&&(this.serializers=A,this._serialize=D),e&&(this._logEvent=LE([].concat(R._logEvent.bindings,v)))}return x.prototype=this,new x(this)}return u}bn.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"}};bn.stdSerializers=i7;bn.stdTimeFunctions=Object.assign({},{nullTime:G2,epochTime:Q2,unixTime:f7,isoTime:h7});function lu(t,e,r,n){let i=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?al:i[r]?i[r]:ol[r]||ol[n]||al,o7(t,e,r)}function o7(t,e,r){!t.transmit&&e[r]===al||(e[r]=function(n){return function(){let s=t.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===ol?ol:this;for(var u=0;u-1&&s in r&&(t[i][s]=r[s](t[i][s]))}function fu(t,e,r){return function(){let n=new Array(1+arguments.length);n[0]=e;for(var i=1;iME,__asyncDelegator:()=>C7,__asyncGenerator:()=>S7,__asyncValues:()=>T7,__await:()=>ul,__awaiter:()=>E7,__classPrivateFieldGet:()=>D7,__classPrivateFieldSet:()=>P7,__createBinding:()=>A7,__decorate:()=>y7,__exportStar:()=>b7,__extends:()=>p7,__generator:()=>v7,__importDefault:()=>O7,__importStar:()=>N7,__makeTemplateObject:()=>x7,__metadata:()=>w7,__param:()=>m7,__read:()=>z2,__rest:()=>g7,__spread:()=>_7,__spreadArrays:()=>I7,__values:()=>UE});function p7(t,e){FE(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function g7(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 m7(t,e){return function(r,n){e(r,n,t)}}function w7(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function E7(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})}function v7(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(f){return u([l,f])}}function u(l){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=l[0]&2?i.return:l[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,l[1])).done)return s;switch(i=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,i=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function z2(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 _7(){for(var t=[],e=0;e1||a(y,m)})})}function a(y,m){try{u(n[y](m))}catch(v){d(s[0][3],v)}}function u(y){y.value instanceof ul?Promise.resolve(y.value.v).then(l,f):d(s[0][2],y)}function l(y){a("next",y)}function f(y){a("throw",y)}function d(y,m){y(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:ul(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function T7(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 UE=="function"?UE(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(a,u){o=t[s](o),i(a,u,o.done,o.value)})}}function i(s,o,a,u){Promise.resolve(u).then(function(l){s({value:l,done:a})},o)}}function x7(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function N7(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 O7(t){return t&&t.__esModule?t:{default:t}}function D7(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function P7(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}var FE,ME,lr=ge(()=>{c();FE=function(t,e){return FE=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},FE(t,e)};ME=function(){return ME=Object.assign||function(e){for(var r,n=1,i=arguments.length;n{"use strict";c();Object.defineProperty(Dd,"__esModule",{value:!0});function R7(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return JSON.parse(t)}catch{return t}}Dd.safeJsonParse=R7;function B7(t){return typeof t=="string"?t:JSON.stringify(t,(e,r)=>typeof r>"u"?null:r)}Dd.safeJsonStringify=B7});var W2=w((hae,Pd)=>{"use strict";c();(function(){"use strict";let t;function e(){}t=e,t.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},t.prototype.setItem=function(r,n){this[r]=String(n)},t.prototype.removeItem=function(r){delete this[r]},t.prototype.clear=function(){let r=this;Object.keys(r).forEach(function(n){r[n]=void 0,delete r[n]})},t.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof global<"u"&&global.localStorage?Pd.exports=global.localStorage:typeof window<"u"&&window.localStorage?Pd.exports=window.localStorage:Pd.exports=new e})()});var K2=w(Rd=>{"use strict";c();Object.defineProperty(Rd,"__esModule",{value:!0});Rd.IKeyValueStorage=void 0;var VE=class{};Rd.IKeyValueStorage=VE});var $2=w(Bd=>{"use strict";c();Object.defineProperty(Bd,"__esModule",{value:!0});Bd.parseEntry=void 0;var L7=qE();function F7(t){var e;return[t[0],L7.safeJsonParse((e=t[1])!==null&&e!==void 0?e:"")]}Bd.parseEntry=F7});var J2=w(Ld=>{"use strict";c();Object.defineProperty(Ld,"__esModule",{value:!0});var Y2=(lr(),nt(cr));Y2.__exportStar(K2(),Ld);Y2.__exportStar($2(),Ld)});var Z2=w(cl=>{"use strict";c();Object.defineProperty(cl,"__esModule",{value:!0});cl.KeyValueStorage=void 0;var hu=(lr(),nt(cr)),X2=qE(),M7=hu.__importDefault(W2()),U7=J2(),Fd=class{constructor(){this.localStorage=M7.default}getKeys(){return hu.__awaiter(this,void 0,void 0,function*(){return Object.keys(this.localStorage)})}getEntries(){return hu.__awaiter(this,void 0,void 0,function*(){return Object.entries(this.localStorage).map(U7.parseEntry)})}getItem(e){return hu.__awaiter(this,void 0,void 0,function*(){let r=this.localStorage.getItem(e);if(r!==null)return X2.safeJsonParse(r)})}setItem(e,r){return hu.__awaiter(this,void 0,void 0,function*(){this.localStorage.setItem(e,X2.safeJsonStringify(r))})}removeItem(e){return hu.__awaiter(this,void 0,void 0,function*(){this.localStorage.removeItem(e)})}};cl.KeyValueStorage=Fd;cl.default=Fd});var eN=w(Md=>{"use strict";c();Object.defineProperty(Md,"__esModule",{value:!0});Md.delay=void 0;function q7(t){return new Promise(e=>{setTimeout(()=>{e(!0)},t)})}Md.delay=q7});var tN=w(du=>{"use strict";c();Object.defineProperty(du,"__esModule",{value:!0});du.ONE_THOUSAND=du.ONE_HUNDRED=void 0;du.ONE_HUNDRED=100;du.ONE_THOUSAND=1e3});var rN=w(fe=>{"use strict";c();Object.defineProperty(fe,"__esModule",{value:!0});fe.ONE_YEAR=fe.FOUR_WEEKS=fe.THREE_WEEKS=fe.TWO_WEEKS=fe.ONE_WEEK=fe.THIRTY_DAYS=fe.SEVEN_DAYS=fe.FIVE_DAYS=fe.THREE_DAYS=fe.ONE_DAY=fe.TWENTY_FOUR_HOURS=fe.TWELVE_HOURS=fe.SIX_HOURS=fe.THREE_HOURS=fe.ONE_HOUR=fe.SIXTY_MINUTES=fe.THIRTY_MINUTES=fe.TEN_MINUTES=fe.FIVE_MINUTES=fe.ONE_MINUTE=fe.SIXTY_SECONDS=fe.THIRTY_SECONDS=fe.TEN_SECONDS=fe.FIVE_SECONDS=fe.ONE_SECOND=void 0;fe.ONE_SECOND=1;fe.FIVE_SECONDS=5;fe.TEN_SECONDS=10;fe.THIRTY_SECONDS=30;fe.SIXTY_SECONDS=60;fe.ONE_MINUTE=fe.SIXTY_SECONDS;fe.FIVE_MINUTES=fe.ONE_MINUTE*5;fe.TEN_MINUTES=fe.ONE_MINUTE*10;fe.THIRTY_MINUTES=fe.ONE_MINUTE*30;fe.SIXTY_MINUTES=fe.ONE_MINUTE*60;fe.ONE_HOUR=fe.SIXTY_MINUTES;fe.THREE_HOURS=fe.ONE_HOUR*3;fe.SIX_HOURS=fe.ONE_HOUR*6;fe.TWELVE_HOURS=fe.ONE_HOUR*12;fe.TWENTY_FOUR_HOURS=fe.ONE_HOUR*24;fe.ONE_DAY=fe.TWENTY_FOUR_HOURS;fe.THREE_DAYS=fe.ONE_DAY*3;fe.FIVE_DAYS=fe.ONE_DAY*5;fe.SEVEN_DAYS=fe.ONE_DAY*7;fe.THIRTY_DAYS=fe.ONE_DAY*30;fe.ONE_WEEK=fe.SEVEN_DAYS;fe.TWO_WEEKS=fe.ONE_WEEK*2;fe.THREE_WEEKS=fe.ONE_WEEK*3;fe.FOUR_WEEKS=fe.ONE_WEEK*4;fe.ONE_YEAR=fe.ONE_DAY*365});var jE=w(Ud=>{"use strict";c();Object.defineProperty(Ud,"__esModule",{value:!0});var nN=(lr(),nt(cr));nN.__exportStar(tN(),Ud);nN.__exportStar(rN(),Ud)});var sN=w(pu=>{"use strict";c();Object.defineProperty(pu,"__esModule",{value:!0});pu.fromMiliseconds=pu.toMiliseconds=void 0;var iN=jE();function V7(t){return t*iN.ONE_THOUSAND}pu.toMiliseconds=V7;function j7(t){return Math.floor(t/iN.ONE_THOUSAND)}pu.fromMiliseconds=j7});var aN=w(qd=>{"use strict";c();Object.defineProperty(qd,"__esModule",{value:!0});var oN=(lr(),nt(cr));oN.__exportStar(eN(),qd);oN.__exportStar(sN(),qd)});var uN=w(ll=>{"use strict";c();Object.defineProperty(ll,"__esModule",{value:!0});ll.Watch=void 0;var Vd=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}};ll.Watch=Vd;ll.default=Vd});var cN=w(jd=>{"use strict";c();Object.defineProperty(jd,"__esModule",{value:!0});jd.IWatch=void 0;var HE=class{};jd.IWatch=HE});var lN=w(GE=>{"use strict";c();Object.defineProperty(GE,"__esModule",{value:!0});var H7=(lr(),nt(cr));H7.__exportStar(cN(),GE)});var co=w(gu=>{"use strict";c();Object.defineProperty(gu,"__esModule",{value:!0});var Hd=(lr(),nt(cr));Hd.__exportStar(aN(),gu);Hd.__exportStar(uN(),gu);Hd.__exportStar(lN(),gu);Hd.__exportStar(jE(),gu)});var QE,fN=ge(()=>{c();QE=class{}});var kE={};at(kE,{IEvents:()=>QE});var zE=ge(()=>{c();fN()});var hN=w(Gd=>{"use strict";c();Object.defineProperty(Gd,"__esModule",{value:!0});Gd.IHeartBeat=void 0;var G7=(zE(),nt(kE)),WE=class extends G7.IEvents{constructor(e){super()}};Gd.IHeartBeat=WE});var $E=w(KE=>{"use strict";c();Object.defineProperty(KE,"__esModule",{value:!0});var Q7=(lr(),nt(cr));Q7.__exportStar(hN(),KE)});var dN=w(yu=>{"use strict";c();Object.defineProperty(yu,"__esModule",{value:!0});yu.HEARTBEAT_EVENTS=yu.HEARTBEAT_INTERVAL=void 0;var k7=co();yu.HEARTBEAT_INTERVAL=k7.FIVE_SECONDS;yu.HEARTBEAT_EVENTS={pulse:"heartbeat_pulse"}});var JE=w(YE=>{"use strict";c();Object.defineProperty(YE,"__esModule",{value:!0});var z7=(lr(),nt(cr));z7.__exportStar(dN(),YE)});var pN=w(Qd=>{"use strict";c();Object.defineProperty(Qd,"__esModule",{value:!0});Qd.HeartBeat=void 0;var XE=(lr(),nt(cr)),W7=Wn(),K7=co(),$7=$E(),ZE=JE(),fl=class extends $7.IHeartBeat{constructor(e){super(e),this.events=new W7.EventEmitter,this.interval=ZE.HEARTBEAT_INTERVAL,this.interval=e?.interval||ZE.HEARTBEAT_INTERVAL}static init(e){return XE.__awaiter(this,void 0,void 0,function*(){let r=new fl(e);return yield r.init(),r})}init(){return XE.__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 XE.__awaiter(this,void 0,void 0,function*(){this.intervalRef=setInterval(()=>this.pulse(),K7.toMiliseconds(this.interval))})}pulse(){this.events.emit(ZE.HEARTBEAT_EVENTS.pulse)}};Qd.HeartBeat=fl});var gN=w(hl=>{"use strict";c();Object.defineProperty(hl,"__esModule",{value:!0});var e1=(lr(),nt(cr));e1.__exportStar(pN(),hl);e1.__exportStar($E(),hl);e1.__exportStar(JE(),hl)});var t1=w(mu=>{"use strict";c();Object.defineProperty(mu,"__esModule",{value:!0});mu.PINO_CUSTOM_CONTEXT_KEY=mu.PINO_LOGGER_DEFAULTS=void 0;mu.PINO_LOGGER_DEFAULTS={level:"info"};mu.PINO_CUSTOM_CONTEXT_KEY="custom_context"});var vN=w(sr=>{"use strict";c();Object.defineProperty(sr,"__esModule",{value:!0});sr.generateChildLogger=sr.formatChildLoggerContext=sr.getLoggerContext=sr.setBrowserLoggerContext=sr.getBrowserLoggerContext=sr.getDefaultLoggerOptions=void 0;var wu=t1();function Y7(t){return Object.assign(Object.assign({},t),{level:t?.level||wu.PINO_LOGGER_DEFAULTS.level})}sr.getDefaultLoggerOptions=Y7;function yN(t,e=wu.PINO_CUSTOM_CONTEXT_KEY){return t[e]||""}sr.getBrowserLoggerContext=yN;function mN(t,e,r=wu.PINO_CUSTOM_CONTEXT_KEY){return t[r]=e,t}sr.setBrowserLoggerContext=mN;function wN(t,e=wu.PINO_CUSTOM_CONTEXT_KEY){let r="";return typeof t.bindings>"u"?r=yN(t,e):r=t.bindings().context||"",r}sr.getLoggerContext=wN;function EN(t,e,r=wu.PINO_CUSTOM_CONTEXT_KEY){let n=wN(t,r);return n.trim()?`${n}/${e}`:e}sr.formatChildLoggerContext=EN;function J7(t,e,r=wu.PINO_CUSTOM_CONTEXT_KEY){let n=EN(t,e,r),i=t.child({context:n});return mN(i,n,r)}sr.generateChildLogger=J7});var n1=w(Eu=>{"use strict";c();Object.defineProperty(Eu,"__esModule",{value:!0});Eu.pino=void 0;var r1=(lr(),nt(cr)),X7=r1.__importDefault(Od());Object.defineProperty(Eu,"pino",{enumerable:!0,get:function(){return X7.default}});r1.__exportStar(t1(),Eu);r1.__exportStar(vN(),Eu)});var v1=w(Ot=>{"use strict";c();Object.defineProperty(Ot,"__esModule",{value:!0});var vu=(zE(),nt(kE)),AN=Wn();function Z7(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var eG=Z7(AN),i1=class extends vu.IEvents{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},s1=class{constructor(e,r,n){this.core=e,this.logger=r}},o1=class extends vu.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}},u1=class extends vu.IEvents{constructor(e,r){super(),this.relayer=e,this.logger=r}},c1=class extends vu.IEvents{constructor(e){super()}},l1=class{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}},f1=class{constructor(){this.map=new Map}},h1=class extends vu.IEvents{constructor(e,r){super(),this.relayer=e,this.logger=r}},d1=class{constructor(e,r){this.core=e,this.logger=r}},p1=class extends vu.IEvents{constructor(e,r){super(),this.core=e,this.logger=r}},g1=class{constructor(e,r){this.logger=e,this.core=r}},y1=class extends eG.default{constructor(){super()}},m1=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},w1=class extends AN.EventEmitter{constructor(){super()}},E1=class{constructor(e){this.client=e}};Ot.ICore=i1,Ot.ICrypto=s1,Ot.IEngine=E1,Ot.IEngineEvents=w1,Ot.IExpirer=p1,Ot.IJsonRpcHistory=o1,Ot.IKeyChain=d1,Ot.IMessageTracker=a1,Ot.IPairing=g1,Ot.IPublisher=u1,Ot.IRelayer=c1,Ot.ISignClient=m1,Ot.ISignClientEvents=y1,Ot.IStore=l1,Ot.ISubscriber=h1,Ot.ISubscriberTopicMap=f1});var bN={};at(bN,{safeJsonParse:()=>dl,safeJsonStringify:()=>pl});function dl(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return rG(t)}catch{return t}}function pl(t){return typeof t=="string"?t:tG(t)||""}var tG,rG,kd=ge(()=>{c();tG=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),rG=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 IN=w(zd=>{"use strict";c();Object.defineProperty(zd,"__esModule",{value:!0});zd.BrowserRandomSource=void 0;var _N=65536,A1=class{constructor(){this.isAvailable=!1,this.isInstantiated=!1;let e=typeof self<"u"?self.crypto||self.msCrypto:null;e&&e.getRandomValues!==void 0&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");let r=new Uint8Array(e);for(let n=0;n{"use strict";c();Object.defineProperty(b1,"__esModule",{value:!0});function nG(t){for(var e=0;e{c()});var CN=w(Wd=>{"use strict";c();Object.defineProperty(Wd,"__esModule",{value:!0});Wd.NodeRandomSource=void 0;var iG=Or(),_1=class{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof B_<"u"){let e=SN();e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let r=this._crypto.randomBytes(e);if(r.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");let n=new Uint8Array(e);for(let i=0;i{"use strict";c();Object.defineProperty(Kd,"__esModule",{value:!0});Kd.SystemRandomSource=void 0;var sG=IN(),oG=CN(),I1=class{constructor(){if(this.isAvailable=!1,this.name="",this._source=new sG.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new oG.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)}};Kd.SystemRandomSource=I1});var xN=w(fr=>{"use strict";c();Object.defineProperty(fr,"__esModule",{value:!0});function aG(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}fr.mul=Math.imul||aG;function uG(t,e){return t+e|0}fr.add=uG;function cG(t,e){return t-e|0}fr.sub=cG;function lG(t,e){return t<>>32-e}fr.rotl=lG;function fG(t,e){return t<<32-e|t>>>e}fr.rotr=fG;function hG(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t}fr.isInteger=Number.isInteger||hG;fr.MAX_SAFE_INTEGER=9007199254740991;fr.isSafeInteger=function(t){return fr.isInteger(t)&&t>=-fr.MAX_SAFE_INTEGER&&t<=fr.MAX_SAFE_INTEGER}});var Au=w(Ne=>{"use strict";c();Object.defineProperty(Ne,"__esModule",{value:!0});var NN=xN();function dG(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}Ne.readInt16BE=dG;function pG(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}Ne.readUint16BE=pG;function gG(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}Ne.readInt16LE=gG;function yG(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}Ne.readUint16LE=yG;function ON(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}Ne.writeUint16BE=ON;Ne.writeInt16BE=ON;function DN(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}Ne.writeUint16LE=DN;Ne.writeInt16LE=DN;function S1(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}Ne.readInt32BE=S1;function C1(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}Ne.readUint32BE=C1;function T1(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}Ne.readInt32LE=T1;function x1(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}Ne.readUint32LE=x1;function $d(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}Ne.writeUint32BE=$d;Ne.writeInt32BE=$d;function Yd(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}Ne.writeUint32LE=Yd;Ne.writeInt32LE=Yd;function mG(t,e){e===void 0&&(e=0);var r=S1(t,e),n=S1(t,e+4);return r*4294967296+n-(n>>31)*4294967296}Ne.readInt64BE=mG;function wG(t,e){e===void 0&&(e=0);var r=C1(t,e),n=C1(t,e+4);return r*4294967296+n}Ne.readUint64BE=wG;function EG(t,e){e===void 0&&(e=0);var r=T1(t,e),n=T1(t,e+4);return n*4294967296+r-(r>>31)*4294967296}Ne.readInt64LE=EG;function vG(t,e){e===void 0&&(e=0);var r=x1(t,e),n=x1(t,e+4);return n*4294967296+r}Ne.readUint64LE=vG;function PN(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),$d(t/4294967296>>>0,e,r),$d(t>>>0,e,r+4),e}Ne.writeUint64BE=PN;Ne.writeInt64BE=PN;function RN(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),Yd(t>>>0,e,r),Yd(t/4294967296>>>0,e,r+4),e}Ne.writeUint64LE=RN;Ne.writeInt64LE=RN;function AG(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,s=t/8+r-1;s>=r;s--)n+=e[s]*i,i*=256;return n}Ne.readUintBE=AG;function bG(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,s=r;s=n;s--)r[s]=e/i&255,i*=256;return r}Ne.writeUintBE=_G;function IG(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(!NN.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,s=n;s{"use strict";c();Object.defineProperty(zt,"__esModule",{value:!0});zt.randomStringForEntropy=zt.randomString=zt.randomUint32=zt.randomBytes=zt.defaultRandomSource=void 0;var RG=TN(),BG=Au(),BN=Or();zt.defaultRandomSource=new RG.SystemRandomSource;function N1(t,e=zt.defaultRandomSource){return e.randomBytes(t)}zt.randomBytes=N1;function LG(t=zt.defaultRandomSource){let e=N1(4,t),r=(0,BG.readUint32LE)(e);return(0,BN.wipe)(e),r}zt.randomUint32=LG;var LN="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function FN(t,e=LN,r=zt.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=N1(Math.ceil(t*256/s),r);for(let a=0;a0;a++){let u=o[a];u{"use strict";c();Object.defineProperty($n,"__esModule",{value:!0});var _u=Au(),bu=Or();$n.DIGEST_LENGTH=64;$n.BLOCK_SIZE=128;var UN=function(){function t(){this.digestLength=$n.DIGEST_LENGTH,this.blockSize=$n.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(){bu.wipe(this._buffer),bu.wipe(this._tempHi),bu.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._bufferLength<$n.BLOCK_SIZE&&r>0;)this._buffer[this._bufferLength++]=e[n++],r--;this._bufferLength===this.blockSize&&(O1(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(n=O1(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){bu.wipe(e.stateHi),bu.wipe(e.stateLo),e.buffer&&bu.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},t}();$n.SHA512=UN;var MN=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 O1(t,e,r,n,i,s,o){for(var a=r[0],u=r[1],l=r[2],f=r[3],d=r[4],y=r[5],m=r[6],v=r[7],T=n[0],B=n[1],A=n[2],D=n[3],x=n[4],R=n[5],P=n[6],L=n[7],_,C,M,Z,z,H,G,$;o>=128;){for(var de=0;de<16;de++){var ae=8*de+s;t[de]=_u.readUint32BE(i,ae),e[de]=_u.readUint32BE(i,ae+4)}for(var de=0;de<80;de++){var re=a,Y=u,ie=l,te=f,ne=d,q=y,ce=m,oe=v,le=T,se=B,ue=A,g=D,E=x,b=R,O=P,I=L;if(_=v,C=L,z=C&65535,H=C>>>16,G=_&65535,$=_>>>16,_=(d>>>14|x<<32-14)^(d>>>18|x<<32-18)^(x>>>41-32|d<<32-(41-32)),C=(x>>>14|d<<32-14)^(x>>>18|d<<32-18)^(d>>>41-32|x<<32-(41-32)),z+=C&65535,H+=C>>>16,G+=_&65535,$+=_>>>16,_=d&y^~d&m,C=x&R^~x&P,z+=C&65535,H+=C>>>16,G+=_&65535,$+=_>>>16,_=MN[de*2],C=MN[de*2+1],z+=C&65535,H+=C>>>16,G+=_&65535,$+=_>>>16,_=t[de%16],C=e[de%16],z+=C&65535,H+=C>>>16,G+=_&65535,$+=_>>>16,H+=z>>>16,G+=H>>>16,$+=G>>>16,M=G&65535|$<<16,Z=z&65535|H<<16,_=M,C=Z,z=C&65535,H=C>>>16,G=_&65535,$=_>>>16,_=(a>>>28|T<<32-28)^(T>>>34-32|a<<32-(34-32))^(T>>>39-32|a<<32-(39-32)),C=(T>>>28|a<<32-28)^(a>>>34-32|T<<32-(34-32))^(a>>>39-32|T<<32-(39-32)),z+=C&65535,H+=C>>>16,G+=_&65535,$+=_>>>16,_=a&u^a&l^u&l,C=T&B^T&A^B&A,z+=C&65535,H+=C>>>16,G+=_&65535,$+=_>>>16,H+=z>>>16,G+=H>>>16,$+=G>>>16,oe=G&65535|$<<16,I=z&65535|H<<16,_=te,C=g,z=C&65535,H=C>>>16,G=_&65535,$=_>>>16,_=M,C=Z,z+=C&65535,H+=C>>>16,G+=_&65535,$+=_>>>16,H+=z>>>16,G+=H>>>16,$+=G>>>16,te=G&65535|$<<16,g=z&65535|H<<16,u=re,l=Y,f=ie,d=te,y=ne,m=q,v=ce,a=oe,B=le,A=se,D=ue,x=g,R=E,P=b,L=O,T=I,de%16===15)for(var ae=0;ae<16;ae++)_=t[ae],C=e[ae],z=C&65535,H=C>>>16,G=_&65535,$=_>>>16,_=t[(ae+9)%16],C=e[(ae+9)%16],z+=C&65535,H+=C>>>16,G+=_&65535,$+=_>>>16,M=t[(ae+1)%16],Z=e[(ae+1)%16],_=(M>>>1|Z<<32-1)^(M>>>8|Z<<32-8)^M>>>7,C=(Z>>>1|M<<32-1)^(Z>>>8|M<<32-8)^(Z>>>7|M<<32-7),z+=C&65535,H+=C>>>16,G+=_&65535,$+=_>>>16,M=t[(ae+14)%16],Z=e[(ae+14)%16],_=(M>>>19|Z<<32-19)^(Z>>>61-32|M<<32-(61-32))^M>>>6,C=(Z>>>19|M<<32-19)^(M>>>61-32|Z<<32-(61-32))^(Z>>>6|M<<32-6),z+=C&65535,H+=C>>>16,G+=_&65535,$+=_>>>16,H+=z>>>16,G+=H>>>16,$+=G>>>16,t[ae]=G&65535|$<<16,e[ae]=z&65535|H<<16}_=a,C=T,z=C&65535,H=C>>>16,G=_&65535,$=_>>>16,_=r[0],C=n[0],z+=C&65535,H+=C>>>16,G+=_&65535,$+=_>>>16,H+=z>>>16,G+=H>>>16,$+=G>>>16,r[0]=a=G&65535|$<<16,n[0]=T=z&65535|H<<16,_=u,C=B,z=C&65535,H=C>>>16,G=_&65535,$=_>>>16,_=r[1],C=n[1],z+=C&65535,H+=C>>>16,G+=_&65535,$+=_>>>16,H+=z>>>16,G+=H>>>16,$+=G>>>16,r[1]=u=G&65535|$<<16,n[1]=B=z&65535|H<<16,_=l,C=A,z=C&65535,H=C>>>16,G=_&65535,$=_>>>16,_=r[2],C=n[2],z+=C&65535,H+=C>>>16,G+=_&65535,$+=_>>>16,H+=z>>>16,G+=H>>>16,$+=G>>>16,r[2]=l=G&65535|$<<16,n[2]=A=z&65535|H<<16,_=f,C=D,z=C&65535,H=C>>>16,G=_&65535,$=_>>>16,_=r[3],C=n[3],z+=C&65535,H+=C>>>16,G+=_&65535,$+=_>>>16,H+=z>>>16,G+=H>>>16,$+=G>>>16,r[3]=f=G&65535|$<<16,n[3]=D=z&65535|H<<16,_=d,C=x,z=C&65535,H=C>>>16,G=_&65535,$=_>>>16,_=r[4],C=n[4],z+=C&65535,H+=C>>>16,G+=_&65535,$+=_>>>16,H+=z>>>16,G+=H>>>16,$+=G>>>16,r[4]=d=G&65535|$<<16,n[4]=x=z&65535|H<<16,_=y,C=R,z=C&65535,H=C>>>16,G=_&65535,$=_>>>16,_=r[5],C=n[5],z+=C&65535,H+=C>>>16,G+=_&65535,$+=_>>>16,H+=z>>>16,G+=H>>>16,$+=G>>>16,r[5]=y=G&65535|$<<16,n[5]=R=z&65535|H<<16,_=m,C=P,z=C&65535,H=C>>>16,G=_&65535,$=_>>>16,_=r[6],C=n[6],z+=C&65535,H+=C>>>16,G+=_&65535,$+=_>>>16,H+=z>>>16,G+=H>>>16,$+=G>>>16,r[6]=m=G&65535|$<<16,n[6]=P=z&65535|H<<16,_=v,C=L,z=C&65535,H=C>>>16,G=_&65535,$=_>>>16,_=r[7],C=n[7],z+=C&65535,H+=C>>>16,G+=_&65535,$+=_>>>16,H+=z>>>16,G+=H>>>16,$+=G>>>16,r[7]=v=G&65535|$<<16,n[7]=L=z&65535|H<<16,s+=128,o-=128}return s}function MG(t){var e=new UN;e.update(t);var r=e.digest();return e.clean(),r}$n.hash=MG});var ZN=w(qe=>{"use strict";c();Object.defineProperty(qe,"__esModule",{value:!0});qe.convertSecretKeyToX25519=qe.convertPublicKeyToX25519=qe.verify=qe.sign=qe.extractPublicKeyFromSecretKey=qe.generateKeyPair=qe.generateKeyPairFromSeed=qe.SEED_LENGTH=qe.SECRET_KEY_LENGTH=qe.PUBLIC_KEY_LENGTH=qe.SIGNATURE_LENGTH=void 0;var UG=gl(),yl=qN(),QN=Or();qe.SIGNATURE_LENGTH=64;qe.PUBLIC_KEY_LENGTH=32;qe.SECRET_KEY_LENGTH=64;qe.SEED_LENGTH=32;function Ee(t){let e=new Float64Array(16);if(t)for(let r=0;r>16&1),r[o-1]&=65535;r[15]=n[15]-32767-(r[14]>>16&1);let s=r[15]>>16&1;r[14]&=65535,kN(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 zN(t,e){let r=0;for(let n=0;n<32;n++)r|=t[n]^e[n];return(1&r-1>>>8)-1}function HN(t,e){let r=new Uint8Array(32),n=new Uint8Array(32);return ml(r,t),ml(n,e),zN(r,n)}function WN(t){let e=new Uint8Array(32);return ml(e,t),e[0]&1}function GG(t,e){for(let r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function lo(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]+r[n]}function ho(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]-r[n]}function Ge(t,e,r){let n,i,s=0,o=0,a=0,u=0,l=0,f=0,d=0,y=0,m=0,v=0,T=0,B=0,A=0,D=0,x=0,R=0,P=0,L=0,_=0,C=0,M=0,Z=0,z=0,H=0,G=0,$=0,de=0,ae=0,re=0,Y=0,ie=0,te=r[0],ne=r[1],q=r[2],ce=r[3],oe=r[4],le=r[5],se=r[6],ue=r[7],g=r[8],E=r[9],b=r[10],O=r[11],I=r[12],N=r[13],F=r[14],S=r[15];n=e[0],s+=n*te,o+=n*ne,a+=n*q,u+=n*ce,l+=n*oe,f+=n*le,d+=n*se,y+=n*ue,m+=n*g,v+=n*E,T+=n*b,B+=n*O,A+=n*I,D+=n*N,x+=n*F,R+=n*S,n=e[1],o+=n*te,a+=n*ne,u+=n*q,l+=n*ce,f+=n*oe,d+=n*le,y+=n*se,m+=n*ue,v+=n*g,T+=n*E,B+=n*b,A+=n*O,D+=n*I,x+=n*N,R+=n*F,P+=n*S,n=e[2],a+=n*te,u+=n*ne,l+=n*q,f+=n*ce,d+=n*oe,y+=n*le,m+=n*se,v+=n*ue,T+=n*g,B+=n*E,A+=n*b,D+=n*O,x+=n*I,R+=n*N,P+=n*F,L+=n*S,n=e[3],u+=n*te,l+=n*ne,f+=n*q,d+=n*ce,y+=n*oe,m+=n*le,v+=n*se,T+=n*ue,B+=n*g,A+=n*E,D+=n*b,x+=n*O,R+=n*I,P+=n*N,L+=n*F,_+=n*S,n=e[4],l+=n*te,f+=n*ne,d+=n*q,y+=n*ce,m+=n*oe,v+=n*le,T+=n*se,B+=n*ue,A+=n*g,D+=n*E,x+=n*b,R+=n*O,P+=n*I,L+=n*N,_+=n*F,C+=n*S,n=e[5],f+=n*te,d+=n*ne,y+=n*q,m+=n*ce,v+=n*oe,T+=n*le,B+=n*se,A+=n*ue,D+=n*g,x+=n*E,R+=n*b,P+=n*O,L+=n*I,_+=n*N,C+=n*F,M+=n*S,n=e[6],d+=n*te,y+=n*ne,m+=n*q,v+=n*ce,T+=n*oe,B+=n*le,A+=n*se,D+=n*ue,x+=n*g,R+=n*E,P+=n*b,L+=n*O,_+=n*I,C+=n*N,M+=n*F,Z+=n*S,n=e[7],y+=n*te,m+=n*ne,v+=n*q,T+=n*ce,B+=n*oe,A+=n*le,D+=n*se,x+=n*ue,R+=n*g,P+=n*E,L+=n*b,_+=n*O,C+=n*I,M+=n*N,Z+=n*F,z+=n*S,n=e[8],m+=n*te,v+=n*ne,T+=n*q,B+=n*ce,A+=n*oe,D+=n*le,x+=n*se,R+=n*ue,P+=n*g,L+=n*E,_+=n*b,C+=n*O,M+=n*I,Z+=n*N,z+=n*F,H+=n*S,n=e[9],v+=n*te,T+=n*ne,B+=n*q,A+=n*ce,D+=n*oe,x+=n*le,R+=n*se,P+=n*ue,L+=n*g,_+=n*E,C+=n*b,M+=n*O,Z+=n*I,z+=n*N,H+=n*F,G+=n*S,n=e[10],T+=n*te,B+=n*ne,A+=n*q,D+=n*ce,x+=n*oe,R+=n*le,P+=n*se,L+=n*ue,_+=n*g,C+=n*E,M+=n*b,Z+=n*O,z+=n*I,H+=n*N,G+=n*F,$+=n*S,n=e[11],B+=n*te,A+=n*ne,D+=n*q,x+=n*ce,R+=n*oe,P+=n*le,L+=n*se,_+=n*ue,C+=n*g,M+=n*E,Z+=n*b,z+=n*O,H+=n*I,G+=n*N,$+=n*F,de+=n*S,n=e[12],A+=n*te,D+=n*ne,x+=n*q,R+=n*ce,P+=n*oe,L+=n*le,_+=n*se,C+=n*ue,M+=n*g,Z+=n*E,z+=n*b,H+=n*O,G+=n*I,$+=n*N,de+=n*F,ae+=n*S,n=e[13],D+=n*te,x+=n*ne,R+=n*q,P+=n*ce,L+=n*oe,_+=n*le,C+=n*se,M+=n*ue,Z+=n*g,z+=n*E,H+=n*b,G+=n*O,$+=n*I,de+=n*N,ae+=n*F,re+=n*S,n=e[14],x+=n*te,R+=n*ne,P+=n*q,L+=n*ce,_+=n*oe,C+=n*le,M+=n*se,Z+=n*ue,z+=n*g,H+=n*E,G+=n*b,$+=n*O,de+=n*I,ae+=n*N,re+=n*F,Y+=n*S,n=e[15],R+=n*te,P+=n*ne,L+=n*q,_+=n*ce,C+=n*oe,M+=n*le,Z+=n*se,z+=n*ue,H+=n*g,G+=n*E,$+=n*b,de+=n*O,ae+=n*I,re+=n*N,Y+=n*F,ie+=n*S,s+=38*P,o+=38*L,a+=38*_,u+=38*C,l+=38*M,f+=38*Z,d+=38*z,y+=38*H,m+=38*G,v+=38*$,T+=38*de,B+=38*ae,A+=38*re,D+=38*Y,x+=38*ie,i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=l+i+65535,i=Math.floor(n/65536),l=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=m+i+65535,i=Math.floor(n/65536),m=n-i*65536,n=v+i+65535,i=Math.floor(n/65536),v=n-i*65536,n=T+i+65535,i=Math.floor(n/65536),T=n-i*65536,n=B+i+65535,i=Math.floor(n/65536),B=n-i*65536,n=A+i+65535,i=Math.floor(n/65536),A=n-i*65536,n=D+i+65535,i=Math.floor(n/65536),D=n-i*65536,n=x+i+65535,i=Math.floor(n/65536),x=n-i*65536,n=R+i+65535,i=Math.floor(n/65536),R=n-i*65536,s+=i-1+37*(i-1),i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=l+i+65535,i=Math.floor(n/65536),l=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=m+i+65535,i=Math.floor(n/65536),m=n-i*65536,n=v+i+65535,i=Math.floor(n/65536),v=n-i*65536,n=T+i+65535,i=Math.floor(n/65536),T=n-i*65536,n=B+i+65535,i=Math.floor(n/65536),B=n-i*65536,n=A+i+65535,i=Math.floor(n/65536),A=n-i*65536,n=D+i+65535,i=Math.floor(n/65536),D=n-i*65536,n=x+i+65535,i=Math.floor(n/65536),x=n-i*65536,n=R+i+65535,i=Math.floor(n/65536),R=n-i*65536,s+=i-1+37*(i-1),t[0]=s,t[1]=o,t[2]=a,t[3]=u,t[4]=l,t[5]=f,t[6]=d,t[7]=y,t[8]=m,t[9]=v,t[10]=T,t[11]=B,t[12]=A,t[13]=D,t[14]=x,t[15]=R}function fo(t,e){Ge(t,e,e)}function KN(t,e){let r=Ee(),n;for(n=0;n<16;n++)r[n]=e[n];for(n=253;n>=0;n--)fo(r,r),n!==2&&n!==4&&Ge(r,r,e);for(n=0;n<16;n++)t[n]=r[n]}function QG(t,e){let r=Ee(),n;for(n=0;n<16;n++)r[n]=e[n];for(n=250;n>=0;n--)fo(r,r),n!==1&&Ge(r,r,e);for(n=0;n<16;n++)t[n]=r[n]}function B1(t,e){let r=Ee(),n=Ee(),i=Ee(),s=Ee(),o=Ee(),a=Ee(),u=Ee(),l=Ee(),f=Ee();ho(r,t[1],t[0]),ho(f,e[1],e[0]),Ge(r,r,f),lo(n,t[0],t[1]),lo(f,e[0],e[1]),Ge(n,n,f),Ge(i,t[3],e[3]),Ge(i,i,jG),Ge(s,t[2],e[2]),lo(s,s,s),ho(o,n,r),ho(a,s,i),lo(u,s,i),lo(l,n,r),Ge(t[0],o,a),Ge(t[1],l,u),Ge(t[2],u,a),Ge(t[3],o,l)}function GN(t,e,r){for(let n=0;n<4;n++)kN(t[n],e[n],r)}function F1(t,e){let r=Ee(),n=Ee(),i=Ee();KN(i,e[2]),Ge(r,e[0],i),Ge(n,e[1],i),ml(t,n),t[31]^=WN(r)<<7}function $N(t,e,r){Ui(t[0],R1),Ui(t[1],Iu),Ui(t[2],Iu),Ui(t[3],R1);for(let n=255;n>=0;--n){let i=r[n/8|0]>>(n&7)&1;GN(t,e,i),B1(e,t),B1(t,t),GN(t,e,i)}}function M1(t,e){let r=[Ee(),Ee(),Ee(),Ee()];Ui(r[0],VN),Ui(r[1],jN),Ui(r[2],Iu),Ge(r[3],VN,jN),$N(t,r,e)}function YN(t){if(t.length!==qe.SEED_LENGTH)throw new Error(`ed25519: seed must be ${qe.SEED_LENGTH} bytes`);let e=(0,yl.hash)(t);e[0]&=248,e[31]&=127,e[31]|=64;let r=new Uint8Array(32),n=[Ee(),Ee(),Ee(),Ee()];M1(n,e),F1(r,n);let i=new Uint8Array(64);return i.set(t),i.set(r,32),{publicKey:r,secretKey:i}}qe.generateKeyPairFromSeed=YN;function kG(t){let e=(0,UG.randomBytes)(32,t),r=YN(e);return(0,QN.wipe)(e),r}qe.generateKeyPair=kG;function zG(t){if(t.length!==qe.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${qe.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(t.subarray(32))}qe.extractPublicKeyFromSecretKey=zG;var P1=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 JN(t,e){let r,n,i,s;for(n=63;n>=32;--n){for(r=0,i=n-32,s=n-12;i>4)*P1[i],r=e[i]>>8,e[i]&=255;for(i=0;i<32;i++)e[i]-=r*P1[i];for(n=0;n<32;n++)e[n+1]+=e[n]>>8,t[n]=e[n]&255}function L1(t){let e=new Float64Array(64);for(let r=0;r<64;r++)e[r]=t[r];for(let r=0;r<64;r++)t[r]=0;JN(t,e)}function WG(t,e){let r=new Float64Array(64),n=[Ee(),Ee(),Ee(),Ee()],i=(0,yl.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 yl.SHA512;o.update(s.subarray(32)),o.update(e);let a=o.digest();o.clean(),L1(a),M1(n,a),F1(s,n),o.reset(),o.update(s.subarray(0,32)),o.update(t.subarray(32)),o.update(e);let u=o.digest();L1(u);for(let l=0;l<32;l++)r[l]=a[l];for(let l=0;l<32;l++)for(let f=0;f<32;f++)r[l+f]+=u[l]*i[f];return JN(s.subarray(32),r),s}qe.sign=WG;function XN(t,e){let r=Ee(),n=Ee(),i=Ee(),s=Ee(),o=Ee(),a=Ee(),u=Ee();return Ui(t[2],Iu),GG(t[1],e),fo(i,t[1]),Ge(s,i,VG),ho(i,i,t[2]),lo(s,t[2],s),fo(o,s),fo(a,o),Ge(u,a,o),Ge(r,u,i),Ge(r,r,s),QG(r,r),Ge(r,r,i),Ge(r,r,s),Ge(r,r,s),Ge(t[0],r,s),fo(n,t[0]),Ge(n,n,s),HN(n,i)&&Ge(t[0],t[0],HG),fo(n,t[0]),Ge(n,n,s),HN(n,i)?-1:(WN(t[0])===e[31]>>7&&ho(t[0],R1,t[0]),Ge(t[3],t[0],t[1]),0)}function KG(t,e,r){let n=new Uint8Array(32),i=[Ee(),Ee(),Ee(),Ee()],s=[Ee(),Ee(),Ee(),Ee()];if(r.length!==qe.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${qe.SIGNATURE_LENGTH} bytes`);if(XN(s,t))return!1;let o=new yl.SHA512;o.update(r.subarray(0,32)),o.update(t),o.update(e);let a=o.digest();return L1(a),$N(i,s,a),M1(s,r.subarray(32)),B1(i,s),F1(n,i),!zN(r,n)}qe.verify=KG;function $G(t){let e=[Ee(),Ee(),Ee(),Ee()];if(XN(e,t))throw new Error("Ed25519: invalid public key");let r=Ee(),n=Ee(),i=e[1];lo(r,Iu,i),ho(n,Iu,i),KN(n,n),Ge(r,r,n);let s=new Uint8Array(32);return ml(s,r),s}qe.convertPublicKeyToX25519=$G;function YG(t){let e=(0,yl.hash)(t.subarray(0,32));e[0]&=248,e[31]&=127,e[31]|=64;let r=new Uint8Array(e.subarray(0,32));return(0,QN.wipe)(e),r}qe.convertSecretKeyToX25519=YG});var Jd,Xd,po,Su,Zd,wl,ep,tp,rp,Cu,np,ip,eO,tO,sp=ge(()=>{c();Jd="EdDSA",Xd="JWT",po=".",Su="base64url",Zd="utf8",wl="utf8",ep=":",tp="did",rp="key",Cu="base58btc",np="z",ip="K36",eO=32,tO=32});function qi(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}var El=ge(()=>{c()});function Tu(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?qi(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}var op=ge(()=>{c();El()});function ap(t,e){e||(e=t.reduce((i,s)=>i+s.length,0));let r=Tu(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return qi(r)}var U1=ge(()=>{c();op();El()});function JG(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,R=new Uint8Array(x);A!==D;){for(var P=v[A],L=0,_=x-1;(P!==0||L>>0,R[_]=P%a>>>0,P=P/a>>>0;if(P!==0)throw new Error("Non-zero carry");B=L,A++}for(var C=x-B;C!==x&&R[C]===0;)C++;for(var M=u.repeat(T);C>>0,x=new Uint8Array(D);v[T];){var R=r[v.charCodeAt(T)];if(R===255)return;for(var P=0,L=D-1;(R!==0||P>>0,x[L]=R%256>>>0,R=R/256>>>0;if(R!==0)throw new Error("Non-zero carry");A=P,T++}if(v[T]!==" "){for(var _=D-A;_!==D&&x[_]===0;)_++;for(var C=new Uint8Array(B+(D-_)),M=B;_!==D;)C[M++]=x[_++];return C}}}function m(v){var T=y(v);if(T)return T;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:y,decode:m}}var XG,ZG,rO,nO=ge(()=>{c();XG=JG,ZG=XG,rO=ZG});var Kue,iO,Yn,sO,oO,Vi=ge(()=>{c();Kue=new Uint8Array(0),iO=(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")},sO=t=>new TextEncoder().encode(t),oO=t=>new TextDecoder().decode(t)});var q1,V1,j1,uO,H1,xu,ji,e9,t9,ct,Hr=ge(()=>{c();nO();Vi();q1=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")}},V1=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 uO(this,e)}},j1=class{constructor(e){this.decoders=e}or(e){return uO(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`)}},uO=(t,e)=>new j1({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),H1=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new q1(e,r,n),this.decoder=new V1(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},xu=({name:t,prefix:e,encode:r,decode:n})=>new H1(t,e,r,n),ji=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=rO(r,e);return xu({prefix:t,name:e,encode:n,decode:s=>Yn(i(s))})},e9=(t,e,r,n)=>{let i={};for(let f=0;f=8&&(a-=8,o[l++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},t9=(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<xu({prefix:e,name:t,encode(i){return t9(i,n,r)},decode(i){return e9(i,n,r,t)}})});var G1={};at(G1,{identity:()=>r9});var r9,cO=ge(()=>{c();Hr();Vi();r9=xu({prefix:"\0",name:"identity",encode:t=>oO(t),decode:t=>sO(t)})});var Q1={};at(Q1,{base2:()=>n9});var n9,lO=ge(()=>{c();Hr();n9=ct({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1})});var k1={};at(k1,{base8:()=>i9});var i9,fO=ge(()=>{c();Hr();i9=ct({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3})});var z1={};at(z1,{base10:()=>s9});var s9,hO=ge(()=>{c();Hr();s9=ji({prefix:"9",name:"base10",alphabet:"0123456789"})});var W1={};at(W1,{base16:()=>o9,base16upper:()=>a9});var o9,a9,dO=ge(()=>{c();Hr();o9=ct({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),a9=ct({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})});var K1={};at(K1,{base32:()=>Nu,base32hex:()=>f9,base32hexpad:()=>d9,base32hexpadupper:()=>p9,base32hexupper:()=>h9,base32pad:()=>c9,base32padupper:()=>l9,base32upper:()=>u9,base32z:()=>g9});var Nu,u9,c9,l9,f9,h9,d9,p9,g9,$1=ge(()=>{c();Hr();Nu=ct({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),u9=ct({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),c9=ct({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),l9=ct({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),f9=ct({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),h9=ct({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),d9=ct({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),p9=ct({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),g9=ct({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})});var Y1={};at(Y1,{base36:()=>y9,base36upper:()=>m9});var y9,m9,pO=ge(()=>{c();Hr();y9=ji({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),m9=ji({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})});var J1={};at(J1,{base58btc:()=>_n,base58flickr:()=>w9});var _n,w9,X1=ge(()=>{c();Hr();_n=ji({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),w9=ji({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})});var Z1={};at(Z1,{base64:()=>E9,base64pad:()=>v9,base64url:()=>A9,base64urlpad:()=>b9});var E9,v9,A9,b9,gO=ge(()=>{c();Hr();E9=ct({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),v9=ct({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),A9=ct({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),b9=ct({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})});var ev={};at(ev,{base256emoji:()=>T9});function S9(t){return t.reduce((e,r)=>(e+=_9[r],e),"")}function C9(t){let e=[];for(let r of t){let n=I9[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var yO,_9,I9,T9,mO=ge(()=>{c();Hr();yO=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}"),_9=yO.reduce((t,e,r)=>(t[r]=e,t),[]),I9=yO.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);T9=xu({prefix:"\u{1F680}",name:"base256emoji",encode:S9,decode:C9})});function vO(t,e,r){e=e||[],r=r||0;for(var n=r;t>=D9;)e[r++]=t&255|wO,t/=128;for(;t&O9;)e[r++]=t&255|wO,t>>>=7;return e[r]=t|0,vO.bytes=r-n+1,e}function tv(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw tv.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&EO)<=R9);return tv.bytes=s-n,r}var x9,wO,N9,O9,D9,P9,R9,EO,B9,L9,F9,M9,U9,q9,V9,j9,H9,G9,Q9,k9,vl,AO=ge(()=>{c();x9=vO,wO=128,N9=127,O9=~N9,D9=Math.pow(2,31);P9=tv,R9=128,EO=127;B9=Math.pow(2,7),L9=Math.pow(2,14),F9=Math.pow(2,21),M9=Math.pow(2,28),U9=Math.pow(2,35),q9=Math.pow(2,42),V9=Math.pow(2,49),j9=Math.pow(2,56),H9=Math.pow(2,63),G9=function(t){return t{c();AO();Al=(t,e=0)=>[vl.decode(t,e),vl.decode.bytes],Ou=(t,e,r=0)=>(vl.encode(t,e,r),e),Du=t=>vl.encodingLength(t)});var go,bO,_O,Pu,_l=ge(()=>{c();Vi();cp();go=(t,e)=>{let r=e.byteLength,n=Du(t),i=n+Du(r),s=new Uint8Array(i+r);return Ou(t,s,0),Ou(r,s,n),s.set(e,i),new Pu(t,r,e,s)},bO=t=>{let e=Yn(t),[r,n]=Al(e),[i,s]=Al(e.subarray(n)),o=e.subarray(n+s);if(o.byteLength!==i)throw new Error("Incorrect length");return new Pu(r,i,o,e)},_O=(t,e)=>t===e?!0:t.code===e.code&&t.size===e.size&&iO(t.bytes,e.bytes),Pu=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}});var nv,rv,iv=ge(()=>{c();_l();nv=({name:t,code:e,encode:r})=>new rv(t,e,r),rv=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?go(this.code,r):r.then(n=>go(this.code,n))}else throw Error("Unknown type, must be binary type")}}});var sv={};at(sv,{sha256:()=>z9,sha512:()=>W9});var SO,z9,W9,CO=ge(()=>{c();iv();SO=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),z9=nv({name:"sha2-256",code:18,encode:SO("SHA-256")}),W9=nv({name:"sha2-512",code:19,encode:SO("SHA-512")})});var ov={};at(ov,{identity:()=>Y9});var TO,K9,xO,$9,Y9,NO=ge(()=>{c();Vi();_l();TO=0,K9="identity",xO=Yn,$9=t=>go(TO,xO(t)),Y9={code:TO,name:K9,encode:xO,digest:$9}});var OO=ge(()=>{c();Vi()});var Bce,Lce,DO=ge(()=>{c();Bce=new TextEncoder,Lce=new TextDecoder});var _t,Z9,eQ,tQ,Il,rQ,PO,RO,lp,fp,nQ,iQ,sQ,BO=ge(()=>{c();cp();_l();X1();$1();Vi();_t=class{constructor(e,r,n,i){this.code=r,this.version=e,this.multihash=n,this.bytes=i,this.byteOffset=i.byteOffset,this.byteLength=i.byteLength,this.asCID=this,this._baseCache=new Map,Object.defineProperties(this,{byteOffset:fp,byteLength:fp,code:lp,version:lp,multihash:lp,bytes:lp,_baseCache:fp,asCID:fp})}toV0(){switch(this.version){case 0:return this;default:{let{code:e,multihash:r}=this;if(e!==Il)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==rQ)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=go(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&&_O(this.multihash,e.multihash)}toString(e){let{bytes:r,version:n,_baseCache:i}=this;switch(n){case 0:return eQ(r,i,e||_n.encoder);default:return tQ(r,i,e||Nu.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 iQ(/^0\.0/,sQ),!!(e&&(e[RO]||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||PO(r,n,i.bytes))}else if(e!=null&&e[RO]===!0){let{version:r,multihash:n,code:i}=e,s=bO(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!==Il)throw new Error(`Version 0 CID must use dag-pb (code: ${Il}) block encoding`);return new _t(e,r,n,n.bytes)}case 1:{let i=PO(e,r,n.bytes);return new _t(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return _t.create(0,Il,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=Yn(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 Pu(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,y]=Al(e.subarray(r));return r+=y,d},i=n(),s=Il;if(i===18?(i=0,r=0):i===1&&(s=n()),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let o=r,a=n(),u=n(),l=r+u,f=l-o;return{version:i,codec:s,multihashCode:a,digestSize:u,multihashSize:f,size:l}}static parse(e,r){let[n,i]=Z9(e,r),s=_t.decode(i);return s._baseCache.set(n,e),s}},Z9=(t,e)=>{switch(t[0]){case"Q":{let r=e||_n;return[_n.prefix,r.decode(`${_n.prefix}${t}`)]}case _n.prefix:{let r=e||_n;return[_n.prefix,r.decode(t)]}case Nu.prefix:{let r=e||Nu;return[Nu.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)]}}},eQ=(t,e,r)=>{let{prefix:n}=r;if(n!==_n.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},tQ=(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},Il=112,rQ=18,PO=(t,e,r)=>{let n=Du(t),i=n+Du(e),s=new Uint8Array(i+r.byteLength);return Ou(t,s,0),Ou(e,s,n),s.set(r,i),s},RO=Symbol.for("@ipld/js-cid/CID"),lp={writable:!1,configurable:!1,enumerable:!0},fp={writable:!1,enumerable:!1,configurable:!1},nQ="0.0.0-dev",iQ=(t,e)=>{if(t.test(nQ))console.warn(e);else throw new Error(e)},sQ=`CID.isCID(v) is deprecated and will be removed in the next major release. +`)}};pe.ErrContractHasNoAddress=Q0;var W0=class extends Re{constructor(e){super(e)}};pe.ErrMock=W0;var z0=class extends Re{constructor(e){super(e)}};pe.ErrTypingSystem=z0;var $0=class extends Re{constructor(e,r){super(`field ${e} does not exist on struct ${r}`)}};pe.ErrMissingFieldOnStruct=$0;var K0=class extends Re{constructor(e,r){super(`field ${e} does not exist on enum ${r}`)}};pe.ErrMissingFieldOnEnum=K0;var Y0=class extends Re{constructor(e){super(`cannot parse contract results: ${e}`)}};pe.ErrCannotParseContractResults=Y0;var J0=class extends Re{constructor(e,r){super(`cannot parse outcome of transaction ${e}: ${r}`)}};pe.ErrCannotParseTransactionOutcome=J0;var X0=class extends Re{constructor(e){super(e)}};pe.ErrCodec=X0;var Z0=class extends Re{constructor(e){super(e)}};pe.ErrContractInteraction=Z0;var em=class extends Re{constructor(){super("Method not yet implemented")}};pe.ErrNotImplemented=em;var tm=class extends Re{constructor(){super("invalid arguments for relayed v1 builder")}};pe.ErrInvalidRelayedV1BuilderArguments=tm;var rm=class extends Re{constructor(){super("invalid arguments for relayed v2 builder")}};pe.ErrInvalidRelayedV2BuilderArguments=rm;var nm=class extends Re{constructor(){super("gas limit must be 0 for the inner transaction for relayed v2")}};pe.ErrGasLimitShouldBe0ForInnerTransaction=nm});var sm=m(ci=>{"use strict";c();var o5=ci&&ci.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ci,"__esModule",{value:!0});ci.TokenPayment=ci.TokenTransfer=void 0;var Au=o5(jt()),a5=Be(),YI="EGLD",JI=18;Au.default.set({ROUNDING_MODE:1});var Wl=class t{constructor(e){let r=new Au.default(e.amountAsBigInteger);if(!r.isInteger()||r.isNegative())throw new a5.ErrInvalidArgument(`bad amountAsBigInteger: ${e.amountAsBigInteger}`);this.tokenIdentifier=e.tokenIdentifier,this.nonce=e.nonce,this.amountAsBigInteger=r,this.numDecimals=e.numDecimals}static egldFromAmount(e){let r=new Au.default(e).shiftedBy(JI).decimalPlaces(0);return this.egldFromBigInteger(r)}static egldFromBigInteger(e){return new t({tokenIdentifier:YI,nonce:0,amountAsBigInteger:e,numDecimals:JI})}static fungibleFromAmount(e,r,n){let i=new Au.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 Au.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==YI}isFungible(){return this.nonce==0}};ci.TokenTransfer=Wl;var im=class extends Wl{constructor(e,r,n,i){super({tokenIdentifier:e,nonce:r,amountAsBigInteger:n,numDecimals:i})}};ci.TokenPayment=im});var ps=m($e=>{"use strict";c();Object.defineProperty($e,"__esModule",{value:!0});$e.ARGUMENTS_SEPARATOR=$e.ESDT_TRANSFER_VALUE=$e.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME=$e.ESDTNFT_TRANSFER_FUNCTION_NAME=$e.ESDT_TRANSFER_FUNCTION_NAME=$e.ESDT_TRANSFER_GAS_LIMIT=$e.TRANSACTION_VERSION_WITH_OPTIONS=$e.TRANSACTION_VERSION_DEFAULT=$e.TRANSACTION_OPTIONS_TX_GUARDED=$e.TRANSACTION_OPTIONS_TX_HASH_SIGN=$e.TRANSACTION_OPTIONS_DEFAULT=$e.TRANSACTION_MIN_GAS_PRICE=void 0;$e.TRANSACTION_MIN_GAS_PRICE=1e9;$e.TRANSACTION_OPTIONS_DEFAULT=0;$e.TRANSACTION_OPTIONS_TX_HASH_SIGN=1;$e.TRANSACTION_OPTIONS_TX_GUARDED=2;$e.TRANSACTION_VERSION_DEFAULT=1;$e.TRANSACTION_VERSION_WITH_OPTIONS=2;$e.ESDT_TRANSFER_GAS_LIMIT=5e5;$e.ESDT_TRANSFER_FUNCTION_NAME="ESDTTransfer";$e.ESDTNFT_TRANSFER_FUNCTION_NAME="ESDTNFTTransfer";$e.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME="MultiESDTNFTTransfer";$e.ESDT_TRANSFER_VALUE="0";$e.ARGUMENTS_SEPARATOR="@"});var gr=m(rt=>{"use strict";c();var u5=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]}),c5=rt&&rt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),l5=rt&&rt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&u5(e,t,r);return c5(e,t),e};Object.defineProperty(rt,"__esModule",{value:!0});rt.isEmpty=rt.guardEmpty=rt.guardNotEmpty=rt.guardLength=rt.guardSameLength=rt.guardValueIsSetWithMessage=rt.guardValueIsSet=rt.guardTrue=void 0;var go=l5(Be());function f5(t,e){if(!t)throw new go.ErrInvariantFailed(`[<${e}>] isn't true`)}rt.guardTrue=f5;function h5(t,e){XI(`${t} isn't set (null or undefined)`,e)}rt.guardValueIsSet=h5;function XI(t,e){if(e==null||e===void 0)throw new go.ErrInvariantFailed(t)}rt.guardValueIsSetWithMessage=XI;function d5(t,e){if(t=t||[],e=e||[],t.length!=e.length)throw new go.ErrInvariantFailed("arrays do not have the same length")}rt.guardSameLength=d5;function p5(t,e){let r=t.length||0;if(r!=e)throw new go.ErrInvariantFailed(`wrong length, expected: ${e}, actual: ${r}`)}rt.guardLength=p5;function g5(t,e){if(om(t))throw new go.ErrInvariantFailed(`${e} is empty`)}rt.guardNotEmpty=g5;function y5(t,e){if(!om(t))throw new go.ErrInvariantFailed(`${e} is not empty`)}rt.guardEmpty=y5;function om(t){return t.isEmpty?t.isEmpty():t.length===0}rt.isEmpty=om});var ZI=m(zl=>{"use strict";c();Object.defineProperty(zl,"__esModule",{value:!0});zl.getJavascriptPrototypesInHierarchy=void 0;function m5(t,e){let r=[],n=Object.getPrototypeOf(t);for(;n&&e(n);)r.push(n),n=Object.getPrototypeOf(n);return r}zl.getJavascriptPrototypesInHierarchy=m5});var _t=m(bt=>{"use strict";c();Object.defineProperty(bt,"__esModule",{value:!0});bt.NullType=bt.TypePlaceholder=bt.isTyped=bt.PrimitiveValue=bt.TypedValue=bt.CustomType=bt.PrimitiveType=bt.TypeCardinality=bt.Type=void 0;var am=ZI(),eS=gr(),li=class t{constructor(e,r=[],n=bu.fixed(1)){eS.guardValueIsSet("name",e),this.name=e,this.typeParameters=r,this.cardinality=n}getName(){return this.name}getClassName(){return t.ClassName}getClassHierarchy(){return am.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 eS.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 am.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(){}};bt.Type=li;li.ClassName="Type";var bu=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}};bt.TypeCardinality=bu;bu.MaxCardinality=4096;var $l=class t extends li{constructor(e){super(e)}getClassName(){return t.ClassName}};bt.PrimitiveType=$l;$l.ClassName="PrimitiveType";var Kl=class t extends li{getClassName(){return t.ClassName}};bt.CustomType=Kl;Kl.ClassName="CustomType";var _u=class t{constructor(e){this.type=e}getClassName(){return t.ClassName}getClassHierarchy(){return am.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(){}};bt.TypedValue=_u;_u.ClassName="TypedValue";var Yl=class t extends _u{constructor(e){super(e)}getClassName(){return t.ClassName}};bt.PrimitiveValue=Yl;Yl.ClassName="PrimitiveValue";function E5(t){return t.belongsToTypesystem!==void 0}bt.isTyped=E5;var Jl=class t extends li{constructor(){super("...")}getClassName(){return t.ClassName}};bt.TypePlaceholder=Jl;Jl.ClassName="TypePlaceholder";var Xl=class t extends li{constructor(){super("?")}getClassName(){return t.ClassName}};bt.NullType=Xl;Xl.ClassName="NullType"});var tS=m((yo,mo)=>{c();(function(t){var e=typeof yo=="object"&&yo&&!yo.nodeType&&yo,r=typeof mo=="object"&&mo&&!mo.nodeType&&mo,n=typeof global=="object"&&global;(n.global===n||n.window===n||n.self===n)&&(t=n);var i,s=2147483647,o=36,a=1,u=26,l=38,f=700,d=72,g=128,E="-",v=/^xn--/,N=/[^\x20-\x7E]/,O=/[\x2E\u3002\uFF0E\uFF61]/g,F={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},_=o-a,I=Math.floor,S=String.fromCharCode,R;function B(Y){throw new RangeError(F[Y])}function b(Y,se){for(var te=Y.length,ie=[];te--;)ie[te]=se(Y[te]);return ie}function C(Y,se){var te=Y.split("@"),ie="";te.length>1&&(ie=te[0]+"@",Y=te[1]),Y=Y.replace(O,".");var q=Y.split("."),le=b(q,se).join(".");return ie+le}function L(Y){for(var se=[],te=0,ie=Y.length,q,le;te=55296&&q<=56319&&te65535&&(se-=65536,te+=S(se>>>10&1023|55296),se=56320|se&1023),te+=S(se),te}).join("")}function W(Y){return Y-48<10?Y-22:Y-65<26?Y-65:Y-97<26?Y-97:o}function j(Y,se){return Y+22+75*(Y<26)-((se!=0)<<5)}function G(Y,se,te){var ie=0;for(Y=te?I(Y/f):Y>>1,Y+=I(Y/se);Y>_*u>>1;ie+=o)Y=I(Y/_);return I(ie+(_+1)*Y/(Y+l))}function K(Y){var se=[],te=Y.length,ie,q=0,le=g,ae=d,fe,oe,ce,y,w,A,P,T,D;for(fe=Y.lastIndexOf(E),fe<0&&(fe=0),oe=0;oe=128&&B("not-basic"),se.push(Y.charCodeAt(oe));for(ce=fe>0?fe+1:0;ce=te&&B("invalid-input"),P=W(Y.charCodeAt(ce++)),(P>=o||P>I((s-q)/w))&&B("overflow"),q+=P*w,T=A<=ae?a:A>=ae+u?u:A-ae,!(PI(s/D)&&B("overflow"),w*=D;ie=se.length+1,ae=G(q-y,ie,y==0),I(q/ie)>s-le&&B("overflow"),le+=I(q/ie),q%=ie,se.splice(q++,0,le)}return X(se)}function de(Y){var se,te,ie,q,le,ae,fe,oe,ce,y,w,A=[],P,T,D,M;for(Y=L(Y),P=Y.length,se=g,te=0,le=d,ae=0;ae=se&&wI((s-te)/T)&&B("overflow"),te+=(fe-se)*T,se=fe,ae=0;aes&&B("overflow"),w==se){for(oe=te,ce=o;y=ce<=le?a:ce>=le+u?u:ce-le,!(oe{"use strict";c();var nS=tS();function w5(t,e){this.__proto__=new Error(e),this.__proto__.name="BackslashError",this.offset=t}function um(t){return t>="0"&&t<="7"}function v5(t){return t>="0"&&t<="9"||t>="a"&&t<="f"||t>="A"&&t<="F"}function rS(t){return t=parseInt(t,16),nS.ucs2.encode([t])}function iS(t,e,r){var n=!1,i=[];function s(u){var l=t[u];if(!v5(l))throw new w5(u,"Unexpected token ILLEGAL");return l}for(;e{c();var uS=sS();fS.exports={validate:A5,parse:b5};function A5(t,e){var r;if(e=e||!1,typeof t!="string")r="Input must be a string";else try{Zl(t,0,e,!1)}catch(n){r=n.message}return r}function b5(t,e){if(typeof t!="string")throw new Error("Input must be a string");e=e||!1;var r=Zl(t,0,e,!0);return r.value}function cS(t,e){for(var r=t.length,n=e,i,s=e;s-1&&t[r]==="\\";)n++,r--;return n%2===0}function C5(t,e,r,n){for(var i=e,s=",",o=[],a=e;gs(t[a]);)a++;if(t[a]==="]")return{start:e,end:a,value:o};for(;s===",";){var u=Zl(t,i,r,n),l=cS(t,u.end);n&&o.push(u.value),i=l.end,s=l.value}return{start:e,end:i,value:o}}function T5(t,e){return t.substr(e,4)==="true"}function x5(t,e){return t.substr(e,5)==="false"}function N5(t,e){return t.substr(e,4)==="null"}var O5=new RegExp(/^\s$/);function gs(t){return O5.test(t)}var D5=new RegExp(/^\d$/);function oS(t){return D5.test(t)}function Un(t,e,r){var n=10,i;t.length{"use strict";c();var P5=en&&en.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),R5=en&&en.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),B5=en&&en.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&P5(e,t,r);return R5(e,t),e};Object.defineProperty(en,"__esModule",{value:!0});en.TypeExpressionParser=void 0;var dS=B5(Be()),L5=_t(),F5=hS(),lm=class{parse(e){let r=this.doParse(e),n=Object.keys(r);if(n.length!=1)throw new dS.ErrTypingSystem(`bad type expression: ${e}`);let i=n[0];return this.nodeToType(i,r[i])}doParse(e){let r=this.getJsonedString(e);try{return F5.parse(r)}catch{throw new dS.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 L5.Type(e,n)}};en.TypeExpressionParser=lm});var hm=m(fi=>{"use strict";c();Object.defineProperty(fi,"__esModule",{value:!0});fi.EndpointParameterDefinition=fi.EndpointModifiers=fi.EndpointDefinition=void 0;var M5=ef(),pS="?",U5="N / A",fm=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?pS:e.name,e.payableInTokens=e.payableInTokens||[],e.inputs=e.inputs||[],e.outputs=e.outputs||[];let r=e.inputs.map(s=>Iu.fromJSON(s)),n=e.outputs.map(s=>Iu.fromJSON(s)),i=new tf(e.mutability,e.payableInTokens);return new t(e.name,r,n,i)}};fi.EndpointDefinition=fm;var tf=class{constructor(e,r){this.mutability=e||"",this.payableInTokens=r||[]}isPayableInEGLD(){return this.isPayableInToken("EGLD")}isPayableInToken(e){return this.payableInTokens.includes(e)?!0:this.payableInTokens.includes(`!${e}`)?!1:!!this.payableInTokens.includes("*")}isPayable(){return this.payableInTokens.length!=0}isReadonly(){return this.mutability=="readonly"}};fi.EndpointModifiers=tf;var Iu=class t{constructor(e,r,n){this.name=e,this.description=r,this.type=n}static fromJSON(e){let r=new M5.TypeExpressionParser().parse(e.type);return new t(e.name||pS,e.description||U5,r)}};fi.EndpointParameterDefinition=Iu});var Eo=m(sr=>{"use strict";c();var q5=sr&&sr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),V5=sr&&sr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),H5=sr&&sr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&q5(e,t,r);return V5(e,t),e};Object.defineProperty(sr,"__esModule",{value:!0});sr.Fields=sr.Field=sr.FieldDefinition=void 0;var dm=H5(Be()),j5=ef(),pm=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)}};sr.FieldDefinition=pm;var gm=class{constructor(e,r=""){this.value=e,this.name=r}checkTyping(e){let r=this.value.getType();if(!r.equals(e.type))throw new dm.ErrTypingSystem(`check type of field "${e.name}; expected: ${e.type}, actual: ${r}"`);if(this.name!=e.name)throw new dm.ErrTypingSystem(`check name of field "${e.name}"`)}equals(e){return this.name==e.name&&this.value.equals(e.value)}};sr.Field=gm;var ym=class{static checkTyping(e,r){if(e.length!=r.length)throw new dm.ErrTypingSystem("fields length vs. field definitions length");for(let n=0;n{"use strict";c();Object.defineProperty(hi,"__esModule",{value:!0});hi.EnumValue=hi.EnumVariantDefinition=hi.EnumType=void 0;var G5=Be(),mm=gr(),rf=Eo(),yS=_t(),gS=256,nf=class t extends yS.CustomType{constructor(e,r){super(e),this.variants=[],this.variants=r}getClassName(){return t.ClassName}static fromJSON(e){let r=(e.variants||[]).map(n=>sf.fromJSON(n));return new t(e.name,r)}getVariantByDiscriminant(e){let r=this.variants.find(n=>n.discriminant==e);return mm.guardValueIsSet(`variant by discriminant (${e})`,r),r}getVariantByName(e){let r=this.variants.find(n=>n.name==e);return mm.guardValueIsSet(`variant by name (${e})`,r),r}getNamesOfDependencies(){let e=[];for(let r of this.variants)e.push(...r.getNamesOfDependencies());return[...new Set(e)]}};hi.EnumType=nf;nf.ClassName="EnumType";var sf=class t{constructor(e,r,n=[]){this.fieldsDefinitions=[],mm.guardTrue(rrf.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 rf.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};hi.EnumVariantDefinition=sf;var of=class t extends yS.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();rf.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=rf.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 G5.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}};hi.EnumValue=of;of.ClassName="EnumValue"});var vo=m(wo=>{"use strict";c();Object.defineProperty(wo,"__esModule",{value:!0});wo.Struct=wo.StructType=void 0;var k5=Be(),af=Eo(),mS=_t(),uf=class t extends mS.CustomType{constructor(e,r){super(e),this.fieldsDefinitions=[],this.fieldsDefinitions=r}getClassName(){return t.ClassName}static fromJSON(e){let r=(e.fields||[]).map(n=>af.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 af.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};wo.StructType=uf;uf.ClassName="StructType";var cf=class t extends mS.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();af.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 k5.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 af.Fields.equals(r,n)}};wo.Struct=cf;cf.ClassName="Struct"});var wm=m((tie,vS)=>{"use strict";c();var ff="qpzry9x8gf2tvdw0s3jn54khce6mua7l",Em={};for(Cu=0;Cu>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 ES(t){for(var e=1,r=0;r126)return"Invalid prefix ("+t+")";e=Ao(e)^n>>5}for(e=Ao(e),r=0;rr)throw new TypeError("Exceeds length limit");t=t.toLowerCase();var n=ES(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=Ao(n)^o,i+=ff.charAt(o)}for(s=0;s<6;++s)n=Ao(n);for(n^=1,s=0;s<6;++s){var a=n>>(5-s)*5&31;i+=ff.charAt(a)}return i}function wS(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=ES(s);if(typeof a=="string")return a;for(var u=[],l=0;l=o.length)&&u.push(d)}return a!==1?"Invalid checksum for "+t:{prefix:s,words:u}}function W5(){var t=wS.apply(null,arguments);if(typeof t=="object")return t}function z5(t){var e=wS.apply(null,arguments);if(typeof e=="object")return e;throw new Error(e)}function hf(t,e,r,n){for(var i=0,s=0,o=(1<=r;)s-=r,a.push(i>>s&o);if(n)s>0&&a.push(i<=e)return"Excess padding";if(i<{"use strict";c();var X5=tn&&tn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Z5=tn&&tn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),AS=tn&&tn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&X5(e,t,r);return Z5(e,t),e};Object.defineProperty(tn,"__esModule",{value:!0});tn.Address=void 0;var df=AS(wm()),bo=AS(Be()),vm="erd",Am=32,e4="0".repeat(16),bm=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 bo.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!=Am)throw new bo.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==Am}static fromHex(e){if(!t.isValidHex(e))throw new bo.ErrAddressCannotCreate(e);return t.fromValidHex(e)}static empty(){return new t}static fromBech32(e){let r;try{r=df.decode(e)}catch(s){throw new bo.ErrAddressCannotCreate(e,s)}let n=r.prefix;if(n!=vm)throw new bo.ErrAddressBadHrp(vm,n);let i=h.Buffer.from(df.fromWords(r.words));if(i.length!=Am)throw new bo.ErrAddressCannotCreate(e);return t.fromValidHex(i.toString("hex"))}hex(){return this.isEmpty()?"":this.valueHex}bech32(){if(this.isEmpty())return"";let e=df.toWords(this.pubkey());return df.encode(vm,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(e4)}};tn.Address=bm});var Io=m(_o=>{"use strict";c();Object.defineProperty(_o,"__esModule",{value:!0});_o.AddressValue=_o.AddressType=void 0;var t4=yt(),bS=_t(),Tu=class t extends bS.PrimitiveType{constructor(){super("Address")}getClassName(){return t.ClassName}};_o.AddressType=Tu;Tu.ClassName="AddressType";var pf=class t extends bS.PrimitiveValue{constructor(e){super(new Tu),this.value=new t4.Address(e.bech32())}getClassName(){return t.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};_o.AddressValue=pf;pf.ClassName="AddressValue"});var yf=m(So=>{"use strict";c();Object.defineProperty(So,"__esModule",{value:!0});So.OptionalValue=So.OptionalType=void 0;var r4=gr(),xu=_t(),Nu=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}};So.OptionalType=Nu;Nu.ClassName="OptionalType";var gf=class t extends xu.TypedValue{constructor(e,r=null){super(e),this.value=r}getClassName(){return t.ClassName}static newMissing(){let e=new Nu(new xu.NullType);return new t(e)}isSet(){return!!this.value}getTypedValue(){return r4.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}};So.OptionalValue=gf;gf.ClassName="OptionalValue"});var Du=m(Co=>{"use strict";c();Object.defineProperty(Co,"__esModule",{value:!0});Co.BooleanValue=Co.BooleanType=void 0;var _S=_t(),Ou=class t extends _S.PrimitiveType{constructor(){super("bool")}getClassName(){return t.ClassName}};Co.BooleanType=Ou;Ou.ClassName="BooleanType";var mf=class t extends _S.PrimitiveValue{constructor(e){super(new Ou),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}};Co.BooleanValue=mf;mf.ClassName="BooleanValue"});var di=m(To=>{"use strict";c();Object.defineProperty(To,"__esModule",{value:!0});To.BytesValue=To.BytesType=void 0;var IS=_t(),Pu=class t extends IS.PrimitiveType{constructor(){super("bytes")}getClassName(){return t.ClassName}};To.BytesType=Pu;Pu.ClassName="BytesType";var Ef=class t extends IS.PrimitiveValue{constructor(e){super(new Pu),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()}};To.BytesValue=Ef;Ef.ClassName="BytesValue"});var CS=m(xo=>{"use strict";c();Object.defineProperty(xo,"__esModule",{value:!0});xo.CodeMetadataValue=xo.CodeMetadataType=void 0;var SS=_t(),wf=class extends SS.PrimitiveType{constructor(){super("CodeMetadata")}};xo.CodeMetadataType=wf;var _m=class extends SS.PrimitiveValue{constructor(e){super(new wf),this.value=e}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};xo.CodeMetadataValue=_m});var Af=m(No=>{"use strict";c();Object.defineProperty(No,"__esModule",{value:!0});No.CompositeValue=No.CompositeType=void 0;var n4=gr(),Im=_t(),Ru=class t extends Im.Type{constructor(...e){super("Composite",e,Im.TypeCardinality.variable(e.length))}getClassName(){return t.ClassName}};No.CompositeType=Ru;Ru.ClassName="CompositeType";var vf=class t extends Im.TypedValue{constructor(e,r){super(e),n4.guardLength(r,e.getTypeParameters().length),this.items=r}getClassName(){return t.ClassName}static fromItems(...e){let r=e.map(i=>i.getType()),n=new Ru(...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";c();Object.defineProperty(bf,"__esModule",{value:!0});bf.CollectionOfTypedValues=void 0;var Sm=class{constructor(e){this.items=e}getLength(){return this.items.length}getItems(){return this.items}valueOf(){return this.items.map(e=>e.valueOf())}equals(e){if(this.getLength()!=e.getLength())return!1;for(let r=0;r{"use strict";c();Object.defineProperty(rn,"__esModule",{value:!0});rn.List=rn.OptionValue=rn.ListType=rn.OptionType=void 0;var i4=gr(),s4=Cm(),ms=_t(),ys=class t extends ms.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(ms.NullType.ClassName);return r||n}};rn.OptionType=ys;ys.ClassName="OptionType";var Bu=class t extends ms.Type{constructor(e){super("List",[e])}getClassName(){return t.ClassName}};rn.ListType=Bu;Bu.ClassName="ListType";var _f=class t extends ms.TypedValue{constructor(e,r=null){super(e),this.value=r}getClassName(){return t.ClassName}static newMissing(){let e=new ys(new ms.NullType);return new t(e)}static newMissingTyped(e){return new t(new ys(e))}static newProvided(e){let r=new ys(e.getType());return new t(r,e)}isSet(){return!!this.value}getTypedValue(){return i4.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}};rn.OptionValue=_f;_f.ClassName="OptionValue";var If=class t extends ms.TypedValue{constructor(e,r){super(e),this.backingCollection=new s4.CollectionOfTypedValues(r)}getClassName(){return t.ClassName}static fromItems(e){if(e.length==0)return new t(new ms.TypePlaceholder,[]);let r=e[0].getType(),n=new Bu(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)}};rn.List=If;If.ClassName="List"});var Tf=m(Oo=>{"use strict";c();Object.defineProperty(Oo,"__esModule",{value:!0});Oo.ArrayVec=Oo.ArrayVecType=void 0;var TS=gr(),o4=Cm(),xS=_t(),Sf=class t extends xS.Type{constructor(e,r){super("Array",[r]),TS.guardTrue(e>0,"array length > 0"),this.length=e}getClassName(){return t.ClassName}};Oo.ArrayVecType=Sf;Sf.ClassName="ArrayVecType";var Cf=class t extends xS.TypedValue{constructor(e,r){super(e),TS.guardLength(r,e.length),this.backingCollection=new o4.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)}};Oo.ArrayVec=Cf;Cf.ClassName="ArrayVec"});var Mu=m(Do=>{"use strict";c();Object.defineProperty(Do,"__esModule",{value:!0});Do.H256Value=Do.H256Type=void 0;var NS=_t(),Fu=class t extends NS.PrimitiveType{constructor(){super("H256")}getClassName(){return t.ClassName}};Do.H256Type=Fu;Fu.ClassName="H256Type";var xf=class t extends NS.PrimitiveValue{constructor(e){super(new Fu),this.value=e}getClassName(){return t.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};Do.H256Value=xf;xf.ClassName="H256Value"});var Of=m(Po=>{"use strict";c();Object.defineProperty(Po,"__esModule",{value:!0});Po.NothingValue=Po.NothingType=void 0;var OS=_t(),Uu=class t extends OS.PrimitiveType{constructor(){super("nothing")}getClassName(){return t.ClassName}};Po.NothingType=Uu;Uu.ClassName="NothingType";var Nf=class t extends OS.PrimitiveValue{constructor(){super(new Uu)}getClassName(){return t.ClassName}equals(e){return!1}valueOf(){return{}}};Po.NothingValue=Nf;Nf.ClassName="NothingValue"});var Ku=m(_e=>{"use strict";c();var a4=_e&&_e.__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]}),u4=_e&&_e.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),c4=_e&&_e.__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)&&a4(e,t,r);return u4(e,t),e},l4=_e&&_e.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(_e,"__esModule",{value:!0});_e.BigIntValue=_e.BigUIntValue=_e.I64Value=_e.U64Value=_e.I32Value=_e.U32Value=_e.I16Value=_e.U16Value=_e.I8Value=_e.U8Value=_e.NumericalValue=_e.BigIntType=_e.BigUIntType=_e.I64Type=_e.U64Type=_e.I32Type=_e.U32Type=_e.I16Type=_e.U16Type=_e.I8Type=_e.U8Type=_e.NumericalType=void 0;var DS=c4(Be()),PS=_t(),Es=l4(jt()),or=class t extends PS.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()}};_e.NumericalType=or;or.ClassName="NumericalType";var qu=class t extends or{constructor(){super("u8",1,!1)}getClassName(){return t.ClassName}};_e.U8Type=qu;qu.ClassName="U8Type";var Vu=class t extends or{constructor(){super("i8",1,!0)}getClassName(){return t.ClassName}};_e.I8Type=Vu;Vu.ClassName="I8Type";var Hu=class t extends or{constructor(){super("u16",2,!1)}getClassName(){return t.ClassName}};_e.U16Type=Hu;Hu.ClassName="U16Type";var ju=class t extends or{constructor(){super("i16",2,!0)}getClassName(){return t.ClassName}};_e.I16Type=ju;ju.ClassName="I16Type";var Gu=class t extends or{constructor(){super("u32",4,!1)}getClassName(){return t.ClassName}};_e.U32Type=Gu;Gu.ClassName="U32Type";var ku=class t extends or{constructor(){super("i32",4,!0)}getClassName(){return t.ClassName}};_e.I32Type=ku;ku.ClassName="I32Type";var Qu=class t extends or{constructor(){super("u64",8,!1)}getClassName(){return t.ClassName}};_e.U64Type=Qu;Qu.ClassName="U64Type";var Wu=class t extends or{constructor(){super("i64",8,!0)}getClassName(){return t.ClassName}};_e.I64Type=Wu;Wu.ClassName="I64Type";var zu=class t extends or{constructor(){super("BigUint",0,!1)}getClassName(){return t.ClassName}};_e.BigUIntType=zu;zu.ClassName="BigUIntType";var $u=class t extends or{constructor(){super("Bigint",0,!0)}getClassName(){return t.ClassName}};_e.BigIntType=$u;$u.ClassName="BigIntType";var ar=class t extends PS.PrimitiveValue{constructor(e,r){if(super(e),this.value=new Es.default(r),this.sizeInBytes=e.sizeInBytes,this.withSign=e.withSign,this.value.isNaN())throw new DS.ErrInvalidArgument(`not a number: ${r}`);if(!this.withSign&&this.value.isNegative())throw new DS.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()}};_e.NumericalValue=ar;ar.ClassName="NumericalValue";var Df=class t extends ar{constructor(e){super(new qu,new Es.default(e))}getClassName(){return t.ClassName}};_e.U8Value=Df;Df.ClassName="U8Value";var Pf=class t extends ar{constructor(e){super(new Vu,new Es.default(e))}getClassName(){return t.ClassName}};_e.I8Value=Pf;Pf.ClassName="I8Value";var Rf=class t extends ar{constructor(e){super(new Hu,new Es.default(e))}getClassName(){return t.ClassName}};_e.U16Value=Rf;Rf.ClassName="U16Value";var Bf=class t extends ar{constructor(e){super(new ju,new Es.default(e))}getClassName(){return t.ClassName}};_e.I16Value=Bf;Bf.ClassName="I16Value";var Lf=class t extends ar{constructor(e){super(new Gu,new Es.default(e))}getClassName(){return t.ClassName}};_e.U32Value=Lf;Lf.ClassName="U32Value";var Ff=class t extends ar{constructor(e){super(new ku,new Es.default(e))}getClassName(){return t.ClassName}};_e.I32Value=Ff;Ff.ClassName="I32Value";var Mf=class t extends ar{constructor(e){super(new Qu,e)}getClassName(){return t.ClassName}};_e.U64Value=Mf;Mf.ClassName="U64Value";var Uf=class t extends ar{constructor(e){super(new Wu,e)}getClassName(){return t.ClassName}};_e.I64Value=Uf;Uf.ClassName="I64Value";var qf=class t extends ar{constructor(e){super(new zu,e)}getClassName(){return t.ClassName}};_e.BigUIntValue=qf;qf.ClassName="BigUIntValue";var Vf=class t extends ar{constructor(e){super(new $u,e)}getClassName(){return t.ClassName}};_e.BigIntValue=Vf;Vf.ClassName="BigIntValue"});var jf=m(Ro=>{"use strict";c();Object.defineProperty(Ro,"__esModule",{value:!0});Ro.StringValue=Ro.StringType=void 0;var RS=_t(),Yu=class t extends RS.PrimitiveType{constructor(){super("utf-8 string")}getClassName(){return t.ClassName}};Ro.StringType=Yu;Yu.ClassName="StringType";var Hf=class t extends RS.PrimitiveValue{constructor(e){super(new Yu),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}};Ro.StringValue=Hf;Hf.ClassName="StringValue"});var Lo=m(Bo=>{"use strict";c();Object.defineProperty(Bo,"__esModule",{value:!0});Bo.TokenIdentifierValue=Bo.TokenIdentifierType=void 0;var BS=_t(),f4="EGLD",Ju=class t extends BS.PrimitiveType{constructor(){super("TokenIdentifier")}getClassName(){return t.ClassName}};Bo.TokenIdentifierType=Ju;Ju.ClassName="TokenIdentifierType";var Gf=class t extends BS.PrimitiveValue{constructor(e){super(new Ju),this.value=e}static egld(){return new t(f4)}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()}};Bo.TokenIdentifierValue=Gf;Gf.ClassName="TokenIdentifierValue"});var Qf=m(_r=>{"use strict";c();var h4=_r&&_r.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),d4=_r&&_r.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),p4=_r&&_r.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&h4(e,t,r);return d4(e,t),e};Object.defineProperty(_r,"__esModule",{value:!0});_r.Tuple=_r.TupleType=void 0;var g4=p4(Be()),LS=Eo(),FS=vo(),Xu=class t extends FS.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 LS.FieldDefinition(MS(i),"anonymous tuple field",n))}};_r.TupleType=Xu;Xu.ClassName="TupleType";function MS(t){return`field${t}`}var kf=class t extends FS.Struct{constructor(e,r){super(e,r)}getClassName(){return t.ClassName}static fromItems(e){if(e.length<1)throw new g4.ErrTypingSystem("bad tuple items");let r=e.map(s=>s.getType()),n=new Xu(...r),i=e.map((s,o)=>new LS.Field(s,MS(o)));return new t(n,i)}};_r.Tuple=kf;kf.ClassName="Tuple"});var $f=m(Mo=>{"use strict";c();Object.defineProperty(Mo,"__esModule",{value:!0});Mo.VariadicValue=Mo.VariadicType=void 0;var Wf=_t(),Fo=class t extends Wf.Type{constructor(e){super("Variadic",[e],Wf.TypeCardinality.variable())}getClassName(){return t.ClassName}};Mo.VariadicType=Fo;Fo.ClassName="VariadicType";var zf=class t extends Wf.TypedValue{constructor(e,r){super(e),this.items=r}getClassName(){return t.ClassName}static fromItems(...e){if(e.length==0)return new t(new Fo(new Wf.TypePlaceholder),[]);let r=e[0].getType();return new t(new Fo(r),e)}getItems(){return this.items}valueOf(){return this.items.map(e=>e.valueOf())}equals(e){if(this.getType().differs(e.getType()))return!1;for(let r=0;r{"use strict";c();var y4=nn&&nn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),m4=nn&&nn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),E4=nn&&nn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&y4(e,t,r);return m4(e,t),e};Object.defineProperty(nn,"__esModule",{value:!0});nn.TypeMapper=void 0;var US=E4(Be()),w4=Io(),Tm=yf(),v4=Du(),A4=di(),b4=CS(),Kf=Af(),xm=Su(),_4=Eo(),qS=Lu(),pi=Tf(),I4=Mu(),VS=Of(),Ir=Ku(),S4=jf(),HS=vo(),jS=Lo(),gi=Qf(),Nm=$f(),Om=class{constructor(e=[]){this.openTypesFactories=new Map([["Option",(...r)=>new qS.OptionType(r[0])],["List",(...r)=>new qS.ListType(r[0])],["VarArgs",(...r)=>new Nm.VariadicType(r[0])],["MultiResultVec",(...r)=>new Nm.VariadicType(r[0])],["variadic",(...r)=>new Nm.VariadicType(r[0])],["OptionalArg",(...r)=>new Tm.OptionalType(r[0])],["optional",(...r)=>new Tm.OptionalType(r[0])],["OptionalResult",(...r)=>new Tm.OptionalType(r[0])],["multi",(...r)=>new Kf.CompositeType(...r)],["MultiArg",(...r)=>new Kf.CompositeType(...r)],["MultiResult",(...r)=>new Kf.CompositeType(...r)],["multi",(...r)=>new Kf.CompositeType(...r)],["tuple",(...r)=>new gi.TupleType(...r)],["tuple2",(...r)=>new gi.TupleType(...r)],["tuple3",(...r)=>new gi.TupleType(...r)],["tuple4",(...r)=>new gi.TupleType(...r)],["tuple5",(...r)=>new gi.TupleType(...r)],["tuple6",(...r)=>new gi.TupleType(...r)],["tuple7",(...r)=>new gi.TupleType(...r)],["tuple8",(...r)=>new gi.TupleType(...r)],["array8",(...r)=>new pi.ArrayVecType(8,r[0])],["array16",(...r)=>new pi.ArrayVecType(16,r[0])],["array20",(...r)=>new pi.ArrayVecType(20,r[0])],["array32",(...r)=>new pi.ArrayVecType(32,r[0])],["array46",(...r)=>new pi.ArrayVecType(46,r[0])],["array64",(...r)=>new pi.ArrayVecType(64,r[0])],["array128",(...r)=>new pi.ArrayVecType(128,r[0])],["array256",(...r)=>new pi.ArrayVecType(256,r[0])]]),this.closedTypesMap=new Map([["u8",new Ir.U8Type],["u16",new Ir.U16Type],["u32",new Ir.U32Type],["u64",new Ir.U64Type],["U64",new Ir.U64Type],["BigUint",new Ir.BigUIntType],["i8",new Ir.I8Type],["i16",new Ir.I16Type],["i32",new Ir.I32Type],["i64",new Ir.I64Type],["Bigint",new Ir.BigIntType],["BigInt",new Ir.BigIntType],["bool",new v4.BooleanType],["bytes",new A4.BytesType],["Address",new w4.AddressType],["H256",new I4.H256Type],["utf-8 string",new S4.StringType],["TokenIdentifier",new jS.TokenIdentifierType],["EgldOrEsdtTokenIdentifier",new jS.TokenIdentifierType],["CodeMetadata",new b4.CodeMetadataType],["nothing",new VS.NothingType],["AsyncCall",new VS.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 US.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(xm.EnumType.ClassName)?this.mapEnumType(e):e.hasExactClass(HS.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 HS.StructType(e.getName(),r)}mapEnumType(e){let r=e.variants.map(i=>new xm.EnumVariantDefinition(i.name,i.discriminant,this.mappedFields(i.getFieldsDefinitions())));return new xm.EnumType(e.getName(),r)}mappedFields(e){return e.map(r=>new _4.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 US.ErrTypingSystem(`Cannot map the generic type "${e.getName()}" to a known type`);return i(...n)}};nn.TypeMapper=Om});var zS=m(sn=>{"use strict";c();var C4=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]}),T4=sn&&sn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),x4=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)&&C4(e,t,r);return T4(e,t),e};Object.defineProperty(sn,"__esModule",{value:!0});sn.AbiRegistry=void 0;var GS=x4(Be()),Pm=gr(),Zu=hm(),kS=Su(),QS=vo(),N4=Dm(),O4="?",Rm=class t{constructor(e){this.endpoints=[],this.customTypes=[],this.name=e.name,this.constructorDefinition=e.constructorDefinition,this.endpoints=e.endpoints,this.customTypes=e.customTypes}static create(e){let r=e.name||O4,n=e.constructor||{},i=e.endpoints||[],s=e.types||{},o=Zu.EndpointDefinition.fromJSON(Object.assign({name:"constructor"},n)),a=i.map(d=>Zu.EndpointDefinition.fromJSON(d)),u=[];for(let d in s){let g=s[d];if(g.type=="struct")u.push(QS.StructType.fromJSON({name:d,fields:g.fields}));else if(g.type=="enum")u.push(kS.EnumType.fromJSON({name:d,variants:g.variants}));else throw new GS.ErrTypingSystem(`Cannot handle custom type: ${d}`)}return new t({name:r,constructorDefinition:o,endpoints:a,customTypes:u}).remapToKnownTypes()}getStruct(e){let r=this.customTypes.find(n=>n.getName()==e&&n.hasExactClass(QS.StructType.ClassName));return Pm.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(kS.EnumType.ClassName));return Pm.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 Pm.guardValueIsSetWithMessage(`endpoint [${e}] not found`,r),r}remapToKnownTypes(){let e=new N4.TypeMapper([]),r=[];for(let o of this.customTypes)this.mapCustomTypeDepthFirst(o,this.customTypes,e,r);if(this.customTypes.length!=r.length)throw new GS.ErrTypingSystem("Did not re-map all custom types");let n=WS(this.constructorDefinition,e),i=[];for(let o of this.endpoints)i.push(WS(o,e));return new t({name:this.name,constructorDefinition:n,endpoints:i,customTypes:r})}mapCustomTypeDepthFirst(e,r,n,i){if(i.findIndex(a=>a.getName()==e.getName())>=0)return;for(let a of e.getNamesOfDependencies()){let u=r.find(l=>l.getName()==a);u&&this.mapCustomTypeDepthFirst(u,r,n,i)}let o=n.mapType(e);i.push(o)}};sn.AbiRegistry=Rm;function WS(t,e){let r=t.input.map(i=>new Zu.EndpointParameterDefinition(i.name,i.description,e.mapType(i.type))),n=t.output.map(i=>new Zu.EndpointParameterDefinition(i.name,i.description,e.mapType(i.type)));return new Zu.EndpointDefinition(t.name,r,n,t.modifiers)}});var KS=m(Uo=>{"use strict";c();Object.defineProperty(Uo,"__esModule",{value:!0});Uo.createListOfTokenIdentifiers=Uo.createListOfAddresses=void 0;var D4=Io(),$S=Lu(),P4=Lo();function R4(t){let e=t.map(n=>new D4.AddressValue(n));return $S.List.fromItems(e)}Uo.createListOfAddresses=R4;function B4(t){let e=t.map(n=>new P4.TokenIdentifierValue(n));return $S.List.fromItems(e)}Uo.createListOfTokenIdentifiers=B4});var cC=m(zt=>{"use strict";c();var L4=zt&&zt.__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]}),F4=zt&&zt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),M4=zt&&zt.__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)&&L4(e,t,r);return F4(e,t),e};Object.defineProperty(zt,"__esModule",{value:!0});zt.onPrimitiveTypeSelect=zt.onPrimitiveValueSelect=zt.onTypedValueSelect=zt.onTypeSelect=void 0;var Jf=M4(Be()),YS=Io(),JS=Du(),XS=di(),ZS=Su(),Yf=Lu(),eC=Mu(),tC=Ku(),rC=Of(),nC=vo(),iC=Lo(),sC=Qf(),oC=_t(),aC=Tf(),uC=jf();function U4(t,e){if(t.hasExactClass(Yf.OptionType.ClassName))return e.onOption();if(t.hasExactClass(Yf.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(ZS.EnumType.ClassName))return e.onEnum();if(e.onOther)return e.onOther();throw new Jf.ErrTypingSystem(`type isn't known: ${t}`)}zt.onTypeSelect=U4;function q4(t,e){if(t.hasClassOrSuperclass(oC.PrimitiveValue.ClassName))return e.onPrimitive();if(t.hasExactClass(Yf.OptionValue.ClassName))return e.onOption();if(t.hasExactClass(Yf.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(ZS.EnumValue.ClassName))return e.onEnum();if(e.onOther)return e.onOther();throw new Jf.ErrTypingSystem(`value isn't typed: ${t}`)}zt.onTypedValueSelect=q4;function V4(t,e){if(t.hasExactClass(JS.BooleanValue.ClassName))return e.onBoolean();if(t.hasClassOrSuperclass(tC.NumericalValue.ClassName))return e.onNumerical();if(t.hasExactClass(YS.AddressValue.ClassName))return e.onAddress();if(t.hasExactClass(XS.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 Jf.ErrTypingSystem(`value isn't a primitive: ${t.getType()}`)}zt.onPrimitiveValueSelect=V4;function H4(t,e){if(t.hasExactClass(JS.BooleanType.ClassName))return e.onBoolean();if(t.hasClassOrSuperclass(tC.NumericalType.ClassName))return e.onNumerical();if(t.hasExactClass(YS.AddressType.ClassName))return e.onAddress();if(t.hasExactClass(XS.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 Jf.ErrTypingSystem(`type isn't a known primitive: ${t}`)}zt.onPrimitiveTypeSelect=H4});var Ot=m(qe=>{"use strict";c();var j4=qe&&qe.__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]}),nt=qe&&qe.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&j4(e,t,r)};Object.defineProperty(qe,"__esModule",{value:!0});nt(zS(),qe);nt(Io(),qe);nt(yf(),qe);nt(Du(),qe);nt(di(),qe);nt(Af(),qe);nt(hm(),qe);nt(Su(),qe);nt(KS(),qe);nt(Eo(),qe);nt(Lu(),qe);nt(Tf(),qe);nt(Mu(),qe);nt(cC(),qe);nt(Of(),qe);nt(Ku(),qe);nt(jf(),qe);nt(vo(),qe);nt(Lo(),qe);nt(Qf(),qe);nt(ef(),qe);nt(Dm(),qe);nt(_t(),qe);nt($f(),qe)});var fC=m(on=>{"use strict";c();var G4=on&&on.__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]}),k4=on&&on.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Q4=on&&on.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&G4(e,t,r);return k4(e,t),e};Object.defineProperty(on,"__esModule",{value:!0});on.OptionValueBinaryCodec=void 0;var lC=Q4(Be()),Xf=Ot(),Bm=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){if(e[0]==0)return[Xf.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[Xf.OptionValue.newProvided(n),i+1]}decodeTopLevel(e,r){if(e.length==0)return new Xf.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 Xf.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([])}};on.OptionValueBinaryCodec=Bm});var hC=m(Zf=>{"use strict";c();Object.defineProperty(Zf,"__esModule",{value:!0});Zf.AddressBinaryCodec=void 0;var W4=yt(),z4=Ot(),Lm=class{decodeNested(e){let r=e.slice(0,32),n=new W4.Address(r);return[new z4.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()}};Zf.AddressBinaryCodec=Lm});var pC=m(an=>{"use strict";c();var $4=an&&an.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),K4=an&&an.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Y4=an&&an.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&$4(e,t,r);return K4(e,t),e};Object.defineProperty(an,"__esModule",{value:!0});an.BooleanBinaryCodec=void 0;var J4=Y4(Be()),dC=Ot(),ec=class t{decodeNested(e){let r=e.readUInt8(0);return[new dC.BooleanValue(r==t.TRUE),1]}decodeTopLevel(e){if(e.length>1)throw new J4.ErrInvalidArgument("buffer should be of size <= 1");let r=e[0];return new dC.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([])}};an.BooleanBinaryCodec=ec;ec.TRUE=1;ec.FALSE=0});var th=m(eh=>{"use strict";c();Object.defineProperty(eh,"__esModule",{value:!0});eh.SizeOfU32=void 0;eh.SizeOfU32=4});var rh=m(un=>{"use strict";c();var X4=un&&un.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(un,"__esModule",{value:!0});un.zeroPadStringIfOddLength=un.isPaddedHex=un.numberToPaddedHex=void 0;var Z4=X4(jt());function eq(t){let e=new Z4.default(t).toString(16);return gC(e)}un.numberToPaddedHex=eq;function tq(t){t=t||"";let e=h.Buffer.from(t,"hex").toString("hex");return t.toUpperCase()==e.toUpperCase()}un.isPaddedHex=tq;function gC(t){return t=t||"",t.length%2==1?"0"+t:t}un.zeroPadStringIfOddLength=gC});var tc=m(It=>{"use strict";c();var rq=It&&It.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(It,"__esModule",{value:!0});It.prependByteToBuffer=It.flipBufferBitsInPlace=It.getHexMagnitudeOfBigInt=It.bigIntToBuffer=It.bufferToBigInt=It.cloneBuffer=It.isMsbZero=It.isMsbOne=void 0;var Fm=rq(jt()),nq=rh();function yC(t,e=0){return t[e]>>7==1}It.isMsbOne=yC;function iq(t,e=0){return!yC(t,e)}It.isMsbZero=iq;function sq(t){let e=h.Buffer.alloc(t.length);return t.copy(e),e}It.cloneBuffer=sq;function oq(t){let e=t.toString("hex");return new Fm.default(`0x${e}`,16)}It.bufferToBigInt=oq;function aq(t){let e=mC(t);return h.Buffer.from(e,"hex")}It.bigIntToBuffer=aq;function mC(t){return t=new Fm.default(t),t?(t.isNegative()&&(t=t.multipliedBy(new Fm.default(-1))),nq.numberToPaddedHex(t)):""}It.getHexMagnitudeOfBigInt=mC;function uq(t){for(let e=0;e{"use strict";c();var lq=qo&&qo.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(qo,"__esModule",{value:!0});qo.NumericalBinaryCodec=void 0;var rc=lq(jt()),Mm=Ot(),EC=th(),mt=tc(),Um=class{decodeNested(e,r){let n=0,i=r.sizeInBytes;i||(n=EC.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=mt.cloneBuffer(e);if(e.length==0)return new Mm.NumericalValue(r,new rc.default(0));if(!r.withSign||mt.isMsbZero(n)){let l=mt.bufferToBigInt(n);return new Mm.NumericalValue(r,l)}mt.flipBufferBitsInPlace(n);let u=mt.bufferToBigInt(n).multipliedBy(new rc.default(-1)).minus(new rc.default(1));return new Mm.NumericalValue(r,u)}encodeNested(e){if(e.sizeInBytes)return this.encodeNestedFixedSize(e,e.sizeInBytes);let r=this.encodeTopLevel(e),n=h.Buffer.alloc(EC.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=mt.bigIntToBuffer(e.value),a=h.Buffer.alloc(r-o.length,0);return h.Buffer.concat([a,o])}if(e.value.isPositive()){let o=mt.bigIntToBuffer(e.value);mt.isMsbOne(o)&&(o=mt.prependByteToBuffer(o,0));let a=h.Buffer.alloc(r-o.length,0);return h.Buffer.concat([a,o])}let n=e.value.plus(new rc.default(1)),i=mt.bigIntToBuffer(n);mt.flipBufferBitsInPlace(i),mt.isMsbZero(i)&&(i=mt.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):mt.bigIntToBuffer(e.value)}encodePrimitive(e){if(e.value.isPositive()){let i=mt.bigIntToBuffer(e.value);return mt.isMsbOne(i)&&(i=mt.prependByteToBuffer(i,0)),i}let r=e.value.plus(new rc.default(1)),n=mt.bigIntToBuffer(r);return mt.flipBufferBitsInPlace(n),mt.isMsbZero(n)&&(n=mt.prependByteToBuffer(n,255)),n}};qo.NumericalBinaryCodec=Um});var vC=m(nh=>{"use strict";c();Object.defineProperty(nh,"__esModule",{value:!0});nh.H256BinaryCodec=void 0;var fq=Mu(),qm=class{decodeNested(e){let r=e.slice(0,32);return[new fq.H256Value(r),32]}decodeTopLevel(e){let[r,n]=this.decodeNested(e);return r}encodeNested(e){return e.valueOf()}encodeTopLevel(e){return e.valueOf()}};nh.H256BinaryCodec=qm});var oh=m(sh=>{"use strict";c();Object.defineProperty(sh,"__esModule",{value:!0});sh.BytesBinaryCodec=void 0;var AC=di(),ih=th(),Vm=class{decodeNested(e){let r=e.readUInt32BE(0),n=e.slice(ih.SizeOfU32,ih.SizeOfU32+r);return[new AC.BytesValue(n),ih.SizeOfU32+r]}decodeTopLevel(e){return new AC.BytesValue(e)}encodeNested(e){let r=h.Buffer.alloc(ih.SizeOfU32);return r.writeUInt32BE(e.getLength()),h.Buffer.concat([r,e.valueOf()])}encodeTopLevel(e){return e.valueOf()}};sh.BytesBinaryCodec=Vm});var _C=m(ah=>{"use strict";c();Object.defineProperty(ah,"__esModule",{value:!0});ah.TokenIdentifierCodec=void 0;var hq=di(),bC=Lo(),dq=oh(),Hm=class{constructor(){this.bytesCodec=new dq.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=hq.BytesValue.fromUTF8(e.valueOf());return this.bytesCodec.encodeNested(r)}encodeTopLevel(e){return h.Buffer.from(e.valueOf())}};ah.TokenIdentifierCodec=Hm});var SC=m(uh=>{"use strict";c();Object.defineProperty(uh,"__esModule",{value:!0});uh.NothingCodec=void 0;var IC=Ot(),jm=class{decodeNested(){return[new IC.NothingValue,0]}decodeTopLevel(){return new IC.NothingValue}encodeNested(){return h.Buffer.from([])}encodeTopLevel(){return h.Buffer.from([])}};uh.NothingCodec=jm});var TC=m(ch=>{"use strict";c();Object.defineProperty(ch,"__esModule",{value:!0});ch.StringBinaryCodec=void 0;var CC=Ot(),pq=di(),gq=oh(),Gm=class{constructor(){this.bytesBinaryCodec=new gq.BytesBinaryCodec}decodeNested(e){let[r,n]=this.bytesBinaryCodec.decodeNested(e);return[new CC.StringValue(r.valueOf().toString()),n]}decodeTopLevel(e){return new CC.StringValue(e.toString())}encodeNested(e){let r=pq.BytesValue.fromUTF8(e.valueOf());return this.bytesBinaryCodec.encodeNested(r)}encodeTopLevel(e){return h.Buffer.from(e.valueOf())}};ch.StringBinaryCodec=Gm});var xC=m(fh=>{"use strict";c();Object.defineProperty(fh,"__esModule",{value:!0});fh.PrimitiveBinaryCodec=void 0;var lh=Ot(),yq=hC(),mq=pC(),Eq=wC(),wq=vC(),vq=oh(),Aq=_C(),bq=SC(),_q=TC(),km=class{constructor(e){this.binaryCodec=e,this.booleanCodec=new mq.BooleanBinaryCodec,this.numericalCodec=new Eq.NumericalBinaryCodec,this.addressCodec=new yq.AddressBinaryCodec,this.h256Codec=new wq.H256BinaryCodec,this.bytesCodec=new vq.BytesBinaryCodec,this.stringCodec=new _q.StringBinaryCodec,this.tokenIdentifierCodec=new Aq.TokenIdentifierCodec,this.nothingCodec=new bq.NothingCodec}decodeNested(e,r){return lh.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 lh.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 lh.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 lh.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()})}};fh.PrimitiveBinaryCodec=km});var DC=m(hh=>{"use strict";c();Object.defineProperty(hh,"__esModule",{value:!0});hh.ListBinaryCodec=void 0;var NC=Ot(),OC=th(),Qm=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)}};hh.ListBinaryCodec=Qm});var zm=m(dh=>{"use strict";c();Object.defineProperty(dh,"__esModule",{value:!0});dh.FieldsBinaryCodec=void 0;var Iq=Ot(),Wm=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 Iq.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)}};dh.FieldsBinaryCodec=Wm});var Km=m(ph=>{"use strict";c();Object.defineProperty(ph,"__esModule",{value:!0});ph.StructBinaryCodec=void 0;var Sq=Ot(),Cq=zm(),$m=class{constructor(e){this.fieldsCodec=new Cq.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 Sq.Struct(r,i),s]}encodeNested(e){let r=e.getFields();return this.fieldsCodec.encodeNested(r)}encodeTopLevel(e){return this.encodeNested(e)}};ph.StructBinaryCodec=$m});var PC=m(yh=>{"use strict";c();Object.defineProperty(yh,"__esModule",{value:!0});yh.EnumBinaryCodec=void 0;var gh=Ot(),Tq=zm(),Ym=class{constructor(e){this.binaryCodec=e,this.fieldsCodec=new Tq.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 gh.EnumValue(r,s,a),i+u]}readDiscriminant(e){let[r,n]=this.binaryCodec.decodeNested(e,new gh.U8Type);return[r.valueOf(),n]}encodeNested(e){let r=new gh.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 gh.U8Value(e.discriminant),o=n?this.binaryCodec.encodeNested(s):this.binaryCodec.encodeTopLevel(s);return h.Buffer.concat([o,i])}};yh.EnumBinaryCodec=Ym});var RC=m(mh=>{"use strict";c();Object.defineProperty(mh,"__esModule",{value:!0});mh.TupleBinaryCodec=void 0;var xq=Km(),Jm=class{constructor(e){this.structCodec=new xq.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)}};mh.TupleBinaryCodec=Jm});var BC=m(Eh=>{"use strict";c();Object.defineProperty(Eh,"__esModule",{value:!0});Eh.ArrayVecBinaryCodec=void 0;var Nq=Ot(),Xm=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){let n=r.length,i=r.getFirstTypeParameter(),s=[],o=0;for(let a=0;a{"use strict";c();var Oq=Sr&&Sr.__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]}),Dq=Sr&&Sr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Pq=Sr&&Sr.__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)&&Oq(e,t,r);return Dq(e,t),e};Object.defineProperty(Sr,"__esModule",{value:!0});Sr.BinaryCodecConstraints=Sr.BinaryCodec=void 0;var LC=Pq(Be()),wh=Ot(),FC=gr(),Rq=fC(),Bq=xC(),Lq=DC(),Fq=Km(),Mq=PC(),Uq=RC(),qq=BC(),Zm=class{constructor(e=null){this.constraints=e||new vh,this.optionCodec=new Rq.OptionValueBinaryCodec(this),this.listCodec=new Lq.ListBinaryCodec(this),this.arrayCodec=new qq.ArrayVecBinaryCodec(this),this.primitiveCodec=new Bq.PrimitiveBinaryCodec(this),this.structCodec=new Fq.StructBinaryCodec(this),this.tupleCodec=new Uq.TupleBinaryCodec(this),this.enumCodec=new Mq.EnumBinaryCodec(this)}decodeTopLevel(e,r){return this.constraints.checkBufferLength(e),wh.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]=wh.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"),wh.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"),wh.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)})}};Sr.BinaryCodec=Zm;var vh=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}`)}};Sr.BinaryCodecConstraints=vh});var MC=m(Cr=>{"use strict";c();var Vq=Cr&&Cr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Cr,"__esModule",{value:!0});Cr.decodeBigNumber=Cr.decodeString=Cr.decodeBool=Cr.decodeUnsignedNumber=void 0;var Hq=Vq(jt()),Ah=Ot(),jq=eE(),bh=new jq.BinaryCodec;function Gq(t){let e=bh.decodeTopLevel(t,new Ah.BigUIntType);return Number(e.valueOf())}Cr.decodeUnsignedNumber=Gq;function kq(t){return!!bh.decodeTopLevel(t,new Ah.BooleanType).valueOf()}Cr.decodeBool=kq;function Qq(t){let e=bh.decodeTopLevel(t,new Ah.BytesType);return String(e.valueOf())}Cr.decodeString=Qq;function Wq(t){let e=bh.decodeTopLevel(t,new Ah.BigUIntType);return new Hq.default(e.valueOf())}Cr.decodeBigNumber=Wq});var tE=m(yi=>{"use strict";c();var zq=yi&&yi.__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=yi&&yi.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&zq(e,t,r)};Object.defineProperty(yi,"__esModule",{value:!0});UC(eE(),yi);UC(MC(),yi)});var Vo=m(_h=>{"use strict";c();Object.defineProperty(_h,"__esModule",{value:!0});_h.ArgSerializer=void 0;var qC=ps(),$q=tE(),rE=yf(),nE=Af(),iE=$f(),Kq={codec:new $q.BinaryCodec},sE=class{constructor(e){e=Object.assign(Object.assign({},Kq),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 f=0;f=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 s of e)i(s);function i(s){if(s.hasExactClass(rE.OptionalValue.ClassName)){let o=s;o.isSet()&&i(o.getTypedValue())}else if(s.hasExactClass(iE.VariadicValue.ClassName)){let o=s;for(let a of o.getItems())i(a)}else if(s.hasExactClass(nE.CompositeValue.ClassName)){let o=s;for(let a of o.getItems())i(a)}else{let o=r.codec.encodeTopLevel(s);n.push(o)}}return n}};_h.ArgSerializer=sE});var Ch=m(Sh=>{"use strict";c();Object.defineProperty(Sh,"__esModule",{value:!0});Sh.Compatibility=void 0;var Yq=yt(),Ih=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()==Yq.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.`))}};Sh.Compatibility=Ih;Ih.areWarningsEnabled=!0});var VC=m(cn=>{"use strict";c();var Jq=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]}),Xq=cn&&cn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Zq=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)&&Jq(e,t,r);return Xq(e,t),e};Object.defineProperty(cn,"__esModule",{value:!0});cn.Hash=void 0;var eV=Zq(Be()),oE=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 eV.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}};cn.Hash=oE});var Th=m(Tr=>{"use strict";c();var tV=Tr&&Tr.__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]}),rV=Tr&&Tr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nV=Tr&&Tr.__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)&&tV(e,t,r);return rV(e,t),e};Object.defineProperty(Tr,"__esModule",{value:!0});Tr.TransactionOptions=Tr.TransactionVersion=void 0;var Hr=ps(),HC=nV(Be()),aE=class t{constructor(e){if(e=Number(e),e<1)throw new HC.ErrTransactionVersionInvalid(e);this.value=e}static withDefaultVersion(){return new t(Hr.TRANSACTION_VERSION_DEFAULT)}static withTxOptions(){return new t(Hr.TRANSACTION_VERSION_WITH_OPTIONS)}valueOf(){return this.value}};Tr.TransactionVersion=aE;var uE=class t{constructor(e){if(e=Number(e),e<0)throw new HC.ErrTransactionOptionsInvalid(e);this.value=e}static withDefaultOptions(){return new t(Hr.TRANSACTION_OPTIONS_DEFAULT)}static withOptions(e){let r=0;return e.hashSign&&(r|=Hr.TRANSACTION_OPTIONS_TX_HASH_SIGN),e.guarded&&(r|=Hr.TRANSACTION_OPTIONS_TX_GUARDED),new t(r)}isWithHashSign(){return(this.value&Hr.TRANSACTION_OPTIONS_TX_HASH_SIGN)==Hr.TRANSACTION_OPTIONS_TX_HASH_SIGN}isWithGuardian(){return(this.value&Hr.TRANSACTION_OPTIONS_TX_GUARDED)==Hr.TRANSACTION_OPTIONS_TX_GUARDED}setWithHashSign(){this.value|=Hr.TRANSACTION_OPTIONS_TX_HASH_SIGN}setWithGuardian(){this.value|=Hr.TRANSACTION_OPTIONS_TX_GUARDED}valueOf(){return this.value}};Tr.TransactionOptions=uE});var GC=m((Qse,jC)=>{"use strict";c();jC.exports=iV;function iV(t,e){for(var r=new Array(arguments.length-1),n=0,i=2,s=!0;i{"use strict";c();var xh=WC;xh.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 Ho=new Array(64),QC=new Array(123);for(jr=0;jr<64;)QC[Ho[jr]=jr<26?jr+65:jr<52?jr+71:jr<62?jr-4:jr-59|43]=jr++;var jr;xh.encode=function(e,r,n){for(var i=null,s=[],o=0,a=0,u;r>2],u=(l&3)<<4,a=1;break;case 1:s[o++]=Ho[u|l>>4],u=(l&15)<<2,a=2;break;case 2:s[o++]=Ho[u|l>>6],s[o++]=Ho[l&63],a=0;break}o>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,s)),o=0)}return a&&(s[o++]=Ho[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 kC="invalid encoding";xh.decode=function(e,r,n){for(var i=n,s=0,o,a=0;a1)break;if((u=QC[u])===void 0)throw Error(kC);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(kC);return n-i};xh.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var KC=m((Kse,$C)=>{"use strict";c();$C.exports=Nh;function Nh(){this._listeners={}}Nh.prototype.on=function(e,r,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:r,ctx:n||this}),this};Nh.prototype.off=function(e,r){if(e===void 0)this._listeners={};else if(r===void 0)this._listeners[e]=[];else for(var n=this._listeners[e],i=0;i{"use strict";c();tT.exports=YC(YC);function YC(t){return typeof Float32Array<"u"?function(){var e=new Float32Array([-0]),r=new Uint8Array(e.buffer),n=r[3]===128;function i(u,l,f){e[0]=u,l[f]=r[0],l[f+1]=r[1],l[f+2]=r[2],l[f+3]=r[3]}function s(u,l,f){e[0]=u,l[f]=r[3],l[f+1]=r[2],l[f+2]=r[1],l[f+3]=r[0]}t.writeFloatLE=n?i:s,t.writeFloatBE=n?s:i;function o(u,l){return r[0]=u[l],r[1]=u[l+1],r[2]=u[l+2],r[3]=u[l+3],e[0]}function a(u,l){return r[3]=u[l],r[2]=u[l+1],r[1]=u[l+2],r[0]=u[l+3],e[0]}t.readFloatLE=n?o:a,t.readFloatBE=n?a:o}():function(){function e(n,i,s,o){var a=i<0?1:0;if(a&&(i=-i),i===0)n(1/i>0?0:2147483648,s,o);else if(isNaN(i))n(2143289344,s,o);else if(i>34028234663852886e22)n((a<<31|2139095040)>>>0,s,o);else if(i<11754943508222875e-54)n((a<<31|Math.round(i/1401298464324817e-60))>>>0,s,o);else{var u=Math.floor(Math.log(i)/Math.LN2),l=Math.round(i*Math.pow(2,-u)*8388608)&8388607;n((a<<31|u+127<<23|l)>>>0,s,o)}}t.writeFloatLE=e.bind(null,JC),t.writeFloatBE=e.bind(null,XC);function r(n,i,s){var o=n(i,s),a=(o>>31)*2+1,u=o>>>23&255,l=o&8388607;return u===255?l?NaN:a*(1/0):u===0?a*1401298464324817e-60*l:a*Math.pow(2,u-150)*(l+8388608)}t.readFloatLE=r.bind(null,ZC),t.readFloatBE=r.bind(null,eT)}(),typeof Float64Array<"u"?function(){var e=new Float64Array([-0]),r=new Uint8Array(e.buffer),n=r[7]===128;function i(u,l,f){e[0]=u,l[f]=r[0],l[f+1]=r[1],l[f+2]=r[2],l[f+3]=r[3],l[f+4]=r[4],l[f+5]=r[5],l[f+6]=r[6],l[f+7]=r[7]}function s(u,l,f){e[0]=u,l[f]=r[7],l[f+1]=r[6],l[f+2]=r[5],l[f+3]=r[4],l[f+4]=r[3],l[f+5]=r[2],l[f+6]=r[1],l[f+7]=r[0]}t.writeDoubleLE=n?i:s,t.writeDoubleBE=n?s:i;function o(u,l){return r[0]=u[l],r[1]=u[l+1],r[2]=u[l+2],r[3]=u[l+3],r[4]=u[l+4],r[5]=u[l+5],r[6]=u[l+6],r[7]=u[l+7],e[0]}function a(u,l){return r[7]=u[l],r[6]=u[l+1],r[5]=u[l+2],r[4]=u[l+3],r[3]=u[l+4],r[2]=u[l+5],r[1]=u[l+6],r[0]=u[l+7],e[0]}t.readDoubleLE=n?o:a,t.readDoubleBE=n?a:o}():function(){function e(n,i,s,o,a,u){var l=o<0?1:0;if(l&&(o=-o),o===0)n(0,a,u+i),n(1/o>0?0:2147483648,a,u+s);else if(isNaN(o))n(0,a,u+i),n(2146959360,a,u+s);else if(o>17976931348623157e292)n(0,a,u+i),n((l<<31|2146435072)>>>0,a,u+s);else{var f;if(o<22250738585072014e-324)f=o/5e-324,n(f>>>0,a,u+i),n((l<<31|f/4294967296)>>>0,a,u+s);else{var d=Math.floor(Math.log(o)/Math.LN2);d===1024&&(d=1023),f=o*Math.pow(2,-d),n(f*4503599627370496>>>0,a,u+i),n((l<<31|d+1023<<20|f*1048576&1048575)>>>0,a,u+s)}}}t.writeDoubleLE=e.bind(null,JC,0,4),t.writeDoubleBE=e.bind(null,XC,4,0);function r(n,i,s,o,a){var u=n(o,a+i),l=n(o,a+s),f=(l>>31)*2+1,d=l>>>20&2047,g=4294967296*(l&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,ZC,0,4),t.readDoubleBE=r.bind(null,eT,4,0)}(),t}function JC(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 XC(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 ZC(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0}function eT(t,e){return(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}});var nT=m((exports,module)=>{"use strict";c();module.exports=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(t){}return null}});var sT=m(iT=>{"use strict";c();var cE=iT;cE.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))};cE.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 aT=m((roe,oT)=>{"use strict";c();oT.exports=sV;function sV(t,e,r){var n=r||8192,i=n>>>1,s=null,o=n;return function(u){if(u<1||u>i)return t(u);o+u>n&&(s=t(n),o=0);var l=e.call(s,o,o+=u);return o&7&&(o=(o|7)+1),l}}});var cT=m((ioe,uT)=>{"use strict";c();uT.exports=Bt;var nc=Ei();function Bt(t,e){this.lo=t>>>0,this.hi=e>>>0}var ws=Bt.zero=new Bt(0,0);ws.toNumber=function(){return 0};ws.zzEncode=ws.zzDecode=function(){return this};ws.length=function(){return 1};var oV=Bt.zeroHash="\0\0\0\0\0\0\0\0";Bt.fromNumber=function(e){if(e===0)return ws;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 Bt(n,i)};Bt.from=function(e){if(typeof e=="number")return Bt.fromNumber(e);if(nc.isString(e))if(nc.Long)e=nc.Long.fromString(e);else return Bt.fromNumber(parseInt(e,10));return e.low||e.high?new Bt(e.low>>>0,e.high>>>0):ws};Bt.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};Bt.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 mi=String.prototype.charCodeAt;Bt.fromHash=function(e){return e===oV?ws:new Bt((mi.call(e,0)|mi.call(e,1)<<8|mi.call(e,2)<<16|mi.call(e,3)<<24)>>>0,(mi.call(e,4)|mi.call(e,5)<<8|mi.call(e,6)<<16|mi.call(e,7)<<24)>>>0)};Bt.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)};Bt.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};Bt.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};Bt.prototype.length=function(){var e=this.lo,r=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?r===0?e<16384?e<128?1:2:e<2097152?3:4:r<16384?r<128?5:6:r<2097152?7:8:n<128?9:10}});var Ei=m(lE=>{"use strict";c();var we=lE;we.asPromise=GC();we.base64=zC();we.EventEmitter=KC();we.float=rT();we.inquire=nT();we.utf8=sT();we.pool=aT();we.LongBits=cT();we.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);we.global=we.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||lE;we.emptyArray=Object.freeze?Object.freeze([]):[];we.emptyObject=Object.freeze?Object.freeze({}):{};we.isInteger=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};we.isString=function(e){return typeof e=="string"||e instanceof String};we.isObject=function(e){return e&&typeof e=="object"};we.isset=we.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};we.Buffer=function(){try{var t=we.inquire("buffer").Buffer;return t.prototype.utf8Write?t:null}catch{return null}}();we._Buffer_from=null;we._Buffer_allocUnsafe=null;we.newBuffer=function(e){return typeof e=="number"?we.Buffer?we._Buffer_allocUnsafe(e):new we.Array(e):we.Buffer?we._Buffer_from(e):typeof Uint8Array>"u"?e:new Uint8Array(e)};we.Array=typeof Uint8Array<"u"?Uint8Array:Array;we.Long=we.global.dcodeIO&&we.global.dcodeIO.Long||we.global.Long||we.inquire("long");we.key2Re=/^true|false|0|1$/;we.key32Re=/^-?(?:0|[1-9][0-9]*)$/;we.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;we.longToHash=function(e){return e?we.LongBits.from(e).toHash():we.LongBits.zeroHash};we.longFromHash=function(e,r){var n=we.LongBits.fromHash(e);return we.Long?we.Long.fromBits(n.lo,n.hi,r):n.toNumber(!!r)};function lT(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]}};we.oneOfSetter=function(e){return function(r){for(var n=0;n{"use strict";c();gT.exports=Fe;var xr=Ei(),fE,Oh=xr.LongBits,hT=xr.base64,dT=xr.utf8;function ic(t,e,r){this.fn=t,this.len=e,this.next=void 0,this.val=r}function dE(){}function aV(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}function Fe(){this.len=0,this.head=new ic(dE,0,0),this.tail=this.head,this.states=null}var pT=function(){return xr.Buffer?function(){return(Fe.create=function(){return new fE})()}:function(){return new Fe}};Fe.create=pT();Fe.alloc=function(e){return new xr.Array(e)};xr.Array!==Array&&(Fe.alloc=xr.pool(Fe.alloc,xr.Array.prototype.subarray));Fe.prototype._push=function(e,r,n){return this.tail=this.tail.next=new ic(e,r,n),this.len+=r,this};function pE(t,e,r){e[r]=t&255}function uV(t,e,r){for(;t>127;)e[r++]=t&127|128,t>>>=7;e[r]=t}function gE(t,e){this.len=t,this.next=void 0,this.val=e}gE.prototype=Object.create(ic.prototype);gE.prototype.fn=uV;Fe.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new gE((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this};Fe.prototype.int32=function(e){return e<0?this._push(yE,10,Oh.fromNumber(e)):this.uint32(e)};Fe.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function yE(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}Fe.prototype.uint64=function(e){var r=Oh.from(e);return this._push(yE,r.length(),r)};Fe.prototype.int64=Fe.prototype.uint64;Fe.prototype.sint64=function(e){var r=Oh.from(e).zzEncode();return this._push(yE,r.length(),r)};Fe.prototype.bool=function(e){return this._push(pE,1,e?1:0)};function hE(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}Fe.prototype.fixed32=function(e){return this._push(hE,4,e>>>0)};Fe.prototype.sfixed32=Fe.prototype.fixed32;Fe.prototype.fixed64=function(e){var r=Oh.from(e);return this._push(hE,4,r.lo)._push(hE,4,r.hi)};Fe.prototype.sfixed64=Fe.prototype.fixed64;Fe.prototype.float=function(e){return this._push(xr.float.writeFloatLE,4,e)};Fe.prototype.double=function(e){return this._push(xr.float.writeDoubleLE,8,e)};var cV=xr.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(pE,1,0);if(xr.isString(e)){var n=Fe.alloc(r=hT.length(e));hT.decode(e,n,0),e=n}return this.uint32(r)._push(cV,r,e)};Fe.prototype.string=function(e){var r=dT.length(e);return r?this.uint32(r)._push(dT.write,r,e):this._push(pE,1,0)};Fe.prototype.fork=function(){return this.states=new aV(this),this.head=this.tail=new ic(dE,0,0),this.len=0,this};Fe.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 ic(dE,0,0),this.len=0),this};Fe.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};Fe.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};Fe._configure=function(t){fE=t,Fe.create=pT(),fE._configure()}});var ET=m((loe,mT)=>{"use strict";c();mT.exports=ln;var yT=mE();(ln.prototype=Object.create(yT.prototype)).constructor=ln;var wi=Ei();function ln(){yT.call(this)}ln._configure=function(){ln.alloc=wi._Buffer_allocUnsafe,ln.writeBytesBuffer=wi.Buffer&&wi.Buffer.prototype instanceof Uint8Array&&wi.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(ln.writeBytesBuffer,r,e),this};function lV(t,e,r){t.length<40?wi.utf8.write(t,e,r):e.utf8Write?e.utf8Write(t,r):e.write(t,r)}ln.prototype.string=function(e){var r=wi.Buffer.byteLength(e);return this.uint32(r),r&&this._push(lV,r,e),this};ln._configure()});var vE=m((hoe,_T)=>{"use strict";c();_T.exports=Et;var fn=Ei(),wE,AT=fn.LongBits,fV=fn.utf8;function Gr(t,e){return RangeError("index out of range: "+t.pos+" + "+(e||1)+" > "+t.len)}function Et(t){this.buf=t,this.pos=0,this.len=t.length}var wT=typeof Uint8Array<"u"?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new Et(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new Et(e);throw Error("illegal buffer")},bT=function(){return fn.Buffer?function(r){return(Et.create=function(i){return fn.Buffer.isBuffer(i)?new wE(i):wT(i)})(r)}:wT};Et.create=bT();Et.prototype._slice=fn.Array.prototype.subarray||fn.Array.prototype.slice;Et.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,Gr(this,10);return e}}();Et.prototype.int32=function(){return this.uint32()|0};Et.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(e&1)|0};function EE(){var t=new AT(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 Gr(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 Gr(this);if(t.hi=(t.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}Et.prototype.bool=function(){return this.uint32()!==0};function Dh(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}Et.prototype.fixed32=function(){if(this.pos+4>this.len)throw Gr(this,4);return Dh(this.buf,this.pos+=4)};Et.prototype.sfixed32=function(){if(this.pos+4>this.len)throw Gr(this,4);return Dh(this.buf,this.pos+=4)|0};function vT(){if(this.pos+8>this.len)throw Gr(this,8);return new AT(Dh(this.buf,this.pos+=4),Dh(this.buf,this.pos+=4))}Et.prototype.float=function(){if(this.pos+4>this.len)throw Gr(this,4);var e=fn.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};Et.prototype.double=function(){if(this.pos+8>this.len)throw Gr(this,4);var e=fn.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e};Et.prototype.bytes=function(){var e=this.uint32(),r=this.pos,n=this.pos+e;if(n>this.len)throw Gr(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)};Et.prototype.string=function(){var e=this.bytes();return fV.read(e,0,e.length)};Et.prototype.skip=function(e){if(typeof e=="number"){if(this.pos+e>this.len)throw Gr(this,e);this.pos+=e}else do if(this.pos>=this.len)throw Gr(this);while(this.buf[this.pos++]&128);return this};Et.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};Et._configure=function(t){wE=t,Et.create=bT(),wE._configure();var e=fn.Long?"toLong":"toNumber";fn.merge(Et.prototype,{int64:function(){return EE.call(this)[e](!1)},uint64:function(){return EE.call(this)[e](!0)},sint64:function(){return EE.call(this).zzDecode()[e](!1)},fixed64:function(){return vT.call(this)[e](!0)},sfixed64:function(){return vT.call(this)[e](!1)}})}});var TT=m((poe,CT)=>{"use strict";c();CT.exports=vs;var ST=vE();(vs.prototype=Object.create(ST.prototype)).constructor=vs;var IT=Ei();function vs(t){ST.call(this,t)}vs._configure=function(){IT.Buffer&&(vs.prototype._slice=IT.Buffer.prototype.slice)};vs.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))};vs._configure()});var NT=m((yoe,xT)=>{"use strict";c();xT.exports=sc;var AE=Ei();(sc.prototype=Object.create(AE.EventEmitter.prototype)).constructor=sc;function sc(t,e,r){if(typeof t!="function")throw TypeError("rpcImpl must be a function");AE.EventEmitter.call(this),this.rpcImpl=t,this.requestDelimited=!!e,this.responseDelimited=!!r}sc.prototype.rpcCall=function t(e,r,n,i,s){if(!i)throw TypeError("request must be specified");var o=this;if(!s)return AE.asPromise(t,o,e,r,n,i);if(!o.rpcImpl){setTimeout(function(){s(Error("already ended"))},0);return}try{return o.rpcImpl(e,r[o.requestDelimited?"encodeDelimited":"encode"](i).finish(),function(u,l){if(u)return o.emit("error",u,e),s(u);if(l===null){o.end(!0);return}if(!(l instanceof n))try{l=n[o.responseDelimited?"decodeDelimited":"decode"](l)}catch(f){return o.emit("error",f,e),s(f)}return o.emit("data",l,e),s(null,l)})}catch(a){o.emit("error",a,e),setTimeout(function(){s(a)},0);return}};sc.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var DT=m(OT=>{"use strict";c();var hV=OT;hV.Service=NT()});var RT=m((voe,PT)=>{"use strict";c();PT.exports={}});var FT=m(LT=>{"use strict";c();var ur=LT;ur.build="minimal";ur.Writer=mE();ur.BufferWriter=ET();ur.Reader=vE();ur.BufferReader=TT();ur.util=Ei();ur.rpc=DT();ur.roots=RT();ur.configure=BT;function BT(){ur.util._configure(),ur.Writer._configure(ur.BufferWriter),ur.Reader._configure(ur.BufferReader)}BT()});var UT=m((Ioe,MT)=>{"use strict";c();MT.exports=FT()});var VT=m((Coe,qT)=>{"use strict";c();var jo=UT(),Ph=jo.Reader,dV=jo.Writer,J=jo.util,oc=jo.roots.default||(jo.roots.default={});oc.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 Ph||(n=new Ph(n)),this.decode(n,n.uint32())},e.verify=function(n){return typeof n!="object"||n===null?"object expected":n.Nonce!=null&&n.hasOwnProperty("Nonce")&&!J.isInteger(n.Nonce)&&!(n.Nonce&&J.isInteger(n.Nonce.low)&&J.isInteger(n.Nonce.high))?"Nonce: integer|Long expected":n.Value!=null&&n.hasOwnProperty("Value")&&!(n.Value&&typeof n.Value.length=="number"||J.isString(n.Value))?"Value: buffer expected":n.RcvAddr!=null&&n.hasOwnProperty("RcvAddr")&&!(n.RcvAddr&&typeof n.RcvAddr.length=="number"||J.isString(n.RcvAddr))?"RcvAddr: buffer expected":n.RcvUserName!=null&&n.hasOwnProperty("RcvUserName")&&!(n.RcvUserName&&typeof n.RcvUserName.length=="number"||J.isString(n.RcvUserName))?"RcvUserName: buffer expected":n.SndAddr!=null&&n.hasOwnProperty("SndAddr")&&!(n.SndAddr&&typeof n.SndAddr.length=="number"||J.isString(n.SndAddr))?"SndAddr: buffer expected":n.SndUserName!=null&&n.hasOwnProperty("SndUserName")&&!(n.SndUserName&&typeof n.SndUserName.length=="number"||J.isString(n.SndUserName))?"SndUserName: buffer expected":n.GasPrice!=null&&n.hasOwnProperty("GasPrice")&&!J.isInteger(n.GasPrice)&&!(n.GasPrice&&J.isInteger(n.GasPrice.low)&&J.isInteger(n.GasPrice.high))?"GasPrice: integer|Long expected":n.GasLimit!=null&&n.hasOwnProperty("GasLimit")&&!J.isInteger(n.GasLimit)&&!(n.GasLimit&&J.isInteger(n.GasLimit.low)&&J.isInteger(n.GasLimit.high))?"GasLimit: integer|Long expected":n.Data!=null&&n.hasOwnProperty("Data")&&!(n.Data&&typeof n.Data.length=="number"||J.isString(n.Data))?"Data: buffer expected":n.ChainID!=null&&n.hasOwnProperty("ChainID")&&!(n.ChainID&&typeof n.ChainID.length=="number"||J.isString(n.ChainID))?"ChainID: buffer expected":n.Version!=null&&n.hasOwnProperty("Version")&&!J.isInteger(n.Version)?"Version: integer expected":n.Signature!=null&&n.hasOwnProperty("Signature")&&!(n.Signature&&typeof n.Signature.length=="number"||J.isString(n.Signature))?"Signature: buffer expected":n.Options!=null&&n.hasOwnProperty("Options")&&!J.isInteger(n.Options)?"Options: integer expected":n.GuardAddr!=null&&n.hasOwnProperty("GuardAddr")&&!(n.GuardAddr&&typeof n.GuardAddr.length=="number"||J.isString(n.GuardAddr))?"GuardAddr: buffer expected":n.GuardSignature!=null&&n.hasOwnProperty("GuardSignature")&&!(n.GuardSignature&&typeof n.GuardSignature.length=="number"||J.isString(n.GuardSignature))?"GuardSignature: buffer expected":null},e.fromObject=function(n){if(n instanceof oc.proto.Transaction)return n;var i=new oc.proto.Transaction;return n.Nonce!=null&&(J.Long?(i.Nonce=J.Long.fromValue(n.Nonce)).unsigned=!0:typeof n.Nonce=="string"?i.Nonce=parseInt(n.Nonce,10):typeof n.Nonce=="number"?i.Nonce=n.Nonce:typeof n.Nonce=="object"&&(i.Nonce=new J.LongBits(n.Nonce.low>>>0,n.Nonce.high>>>0).toNumber(!0))),n.Value!=null&&(typeof n.Value=="string"?J.base64.decode(n.Value,i.Value=J.newBuffer(J.base64.length(n.Value)),0):n.Value.length&&(i.Value=n.Value)),n.RcvAddr!=null&&(typeof n.RcvAddr=="string"?J.base64.decode(n.RcvAddr,i.RcvAddr=J.newBuffer(J.base64.length(n.RcvAddr)),0):n.RcvAddr.length&&(i.RcvAddr=n.RcvAddr)),n.RcvUserName!=null&&(typeof n.RcvUserName=="string"?J.base64.decode(n.RcvUserName,i.RcvUserName=J.newBuffer(J.base64.length(n.RcvUserName)),0):n.RcvUserName.length&&(i.RcvUserName=n.RcvUserName)),n.SndAddr!=null&&(typeof n.SndAddr=="string"?J.base64.decode(n.SndAddr,i.SndAddr=J.newBuffer(J.base64.length(n.SndAddr)),0):n.SndAddr.length&&(i.SndAddr=n.SndAddr)),n.SndUserName!=null&&(typeof n.SndUserName=="string"?J.base64.decode(n.SndUserName,i.SndUserName=J.newBuffer(J.base64.length(n.SndUserName)),0):n.SndUserName.length&&(i.SndUserName=n.SndUserName)),n.GasPrice!=null&&(J.Long?(i.GasPrice=J.Long.fromValue(n.GasPrice)).unsigned=!0:typeof n.GasPrice=="string"?i.GasPrice=parseInt(n.GasPrice,10):typeof n.GasPrice=="number"?i.GasPrice=n.GasPrice:typeof n.GasPrice=="object"&&(i.GasPrice=new J.LongBits(n.GasPrice.low>>>0,n.GasPrice.high>>>0).toNumber(!0))),n.GasLimit!=null&&(J.Long?(i.GasLimit=J.Long.fromValue(n.GasLimit)).unsigned=!0:typeof n.GasLimit=="string"?i.GasLimit=parseInt(n.GasLimit,10):typeof n.GasLimit=="number"?i.GasLimit=n.GasLimit:typeof n.GasLimit=="object"&&(i.GasLimit=new J.LongBits(n.GasLimit.low>>>0,n.GasLimit.high>>>0).toNumber(!0))),n.Data!=null&&(typeof n.Data=="string"?J.base64.decode(n.Data,i.Data=J.newBuffer(J.base64.length(n.Data)),0):n.Data.length&&(i.Data=n.Data)),n.ChainID!=null&&(typeof n.ChainID=="string"?J.base64.decode(n.ChainID,i.ChainID=J.newBuffer(J.base64.length(n.ChainID)),0):n.ChainID.length&&(i.ChainID=n.ChainID)),n.Version!=null&&(i.Version=n.Version>>>0),n.Signature!=null&&(typeof n.Signature=="string"?J.base64.decode(n.Signature,i.Signature=J.newBuffer(J.base64.length(n.Signature)),0):n.Signature.length&&(i.Signature=n.Signature)),n.Options!=null&&(i.Options=n.Options>>>0),n.GuardAddr!=null&&(typeof n.GuardAddr=="string"?J.base64.decode(n.GuardAddr,i.GuardAddr=J.newBuffer(J.base64.length(n.GuardAddr)),0):n.GuardAddr.length&&(i.GuardAddr=n.GuardAddr)),n.GuardSignature!=null&&(typeof n.GuardSignature=="string"?J.base64.decode(n.GuardSignature,i.GuardSignature=J.newBuffer(J.base64.length(n.GuardSignature)),0):n.GuardSignature.length&&(i.GuardSignature=n.GuardSignature)),i},e.toObject=function(n,i){i||(i={});var s={};if(i.defaults){if(J.Long){var o=new J.Long(0,0,!0);s.Nonce=i.longs===String?o.toString():i.longs===Number?o.toNumber():o}else s.Nonce=i.longs===String?"0":0;if(i.bytes===String?s.Value="":(s.Value=[],i.bytes!==Array&&(s.Value=J.newBuffer(s.Value))),i.bytes===String?s.RcvAddr="":(s.RcvAddr=[],i.bytes!==Array&&(s.RcvAddr=J.newBuffer(s.RcvAddr))),i.bytes===String?s.RcvUserName="":(s.RcvUserName=[],i.bytes!==Array&&(s.RcvUserName=J.newBuffer(s.RcvUserName))),i.bytes===String?s.SndAddr="":(s.SndAddr=[],i.bytes!==Array&&(s.SndAddr=J.newBuffer(s.SndAddr))),i.bytes===String?s.SndUserName="":(s.SndUserName=[],i.bytes!==Array&&(s.SndUserName=J.newBuffer(s.SndUserName))),J.Long){var o=new J.Long(0,0,!0);s.GasPrice=i.longs===String?o.toString():i.longs===Number?o.toNumber():o}else s.GasPrice=i.longs===String?"0":0;if(J.Long){var o=new J.Long(0,0,!0);s.GasLimit=i.longs===String?o.toString():i.longs===Number?o.toNumber():o}else s.GasLimit=i.longs===String?"0":0;i.bytes===String?s.Data="":(s.Data=[],i.bytes!==Array&&(s.Data=J.newBuffer(s.Data))),i.bytes===String?s.ChainID="":(s.ChainID=[],i.bytes!==Array&&(s.ChainID=J.newBuffer(s.ChainID))),s.Version=0,i.bytes===String?s.Signature="":(s.Signature=[],i.bytes!==Array&&(s.Signature=J.newBuffer(s.Signature))),s.Options=0,i.bytes===String?s.GuardAddr="":(s.GuardAddr=[],i.bytes!==Array&&(s.GuardAddr=J.newBuffer(s.GuardAddr))),i.bytes===String?s.GuardSignature="":(s.GuardSignature=[],i.bytes!==Array&&(s.GuardSignature=J.newBuffer(s.GuardSignature)))}return n.Nonce!=null&&n.hasOwnProperty("Nonce")&&(typeof n.Nonce=="number"?s.Nonce=i.longs===String?String(n.Nonce):n.Nonce:s.Nonce=i.longs===String?J.Long.prototype.toString.call(n.Nonce):i.longs===Number?new J.LongBits(n.Nonce.low>>>0,n.Nonce.high>>>0).toNumber(!0):n.Nonce),n.Value!=null&&n.hasOwnProperty("Value")&&(s.Value=i.bytes===String?J.base64.encode(n.Value,0,n.Value.length):i.bytes===Array?Array.prototype.slice.call(n.Value):n.Value),n.RcvAddr!=null&&n.hasOwnProperty("RcvAddr")&&(s.RcvAddr=i.bytes===String?J.base64.encode(n.RcvAddr,0,n.RcvAddr.length):i.bytes===Array?Array.prototype.slice.call(n.RcvAddr):n.RcvAddr),n.RcvUserName!=null&&n.hasOwnProperty("RcvUserName")&&(s.RcvUserName=i.bytes===String?J.base64.encode(n.RcvUserName,0,n.RcvUserName.length):i.bytes===Array?Array.prototype.slice.call(n.RcvUserName):n.RcvUserName),n.SndAddr!=null&&n.hasOwnProperty("SndAddr")&&(s.SndAddr=i.bytes===String?J.base64.encode(n.SndAddr,0,n.SndAddr.length):i.bytes===Array?Array.prototype.slice.call(n.SndAddr):n.SndAddr),n.SndUserName!=null&&n.hasOwnProperty("SndUserName")&&(s.SndUserName=i.bytes===String?J.base64.encode(n.SndUserName,0,n.SndUserName.length):i.bytes===Array?Array.prototype.slice.call(n.SndUserName):n.SndUserName),n.GasPrice!=null&&n.hasOwnProperty("GasPrice")&&(typeof n.GasPrice=="number"?s.GasPrice=i.longs===String?String(n.GasPrice):n.GasPrice:s.GasPrice=i.longs===String?J.Long.prototype.toString.call(n.GasPrice):i.longs===Number?new J.LongBits(n.GasPrice.low>>>0,n.GasPrice.high>>>0).toNumber(!0):n.GasPrice),n.GasLimit!=null&&n.hasOwnProperty("GasLimit")&&(typeof n.GasLimit=="number"?s.GasLimit=i.longs===String?String(n.GasLimit):n.GasLimit:s.GasLimit=i.longs===String?J.Long.prototype.toString.call(n.GasLimit):i.longs===Number?new J.LongBits(n.GasLimit.low>>>0,n.GasLimit.high>>>0).toNumber(!0):n.GasLimit),n.Data!=null&&n.hasOwnProperty("Data")&&(s.Data=i.bytes===String?J.base64.encode(n.Data,0,n.Data.length):i.bytes===Array?Array.prototype.slice.call(n.Data):n.Data),n.ChainID!=null&&n.hasOwnProperty("ChainID")&&(s.ChainID=i.bytes===String?J.base64.encode(n.ChainID,0,n.ChainID.length):i.bytes===Array?Array.prototype.slice.call(n.ChainID):n.ChainID),n.Version!=null&&n.hasOwnProperty("Version")&&(s.Version=n.Version),n.Signature!=null&&n.hasOwnProperty("Signature")&&(s.Signature=i.bytes===String?J.base64.encode(n.Signature,0,n.Signature.length):i.bytes===Array?Array.prototype.slice.call(n.Signature):n.Signature),n.Options!=null&&n.hasOwnProperty("Options")&&(s.Options=n.Options),n.GuardAddr!=null&&n.hasOwnProperty("GuardAddr")&&(s.GuardAddr=i.bytes===String?J.base64.encode(n.GuardAddr,0,n.GuardAddr.length):i.bytes===Array?Array.prototype.slice.call(n.GuardAddr):n.GuardAddr),n.GuardSignature!=null&&n.hasOwnProperty("GuardSignature")&&(s.GuardSignature=i.bytes===String?J.base64.encode(n.GuardSignature,0,n.GuardSignature.length):i.bytes===Array?Array.prototype.slice.call(n.GuardSignature):n.GuardSignature),s},e.prototype.toJSON=function(){return this.constructor.toObject(this,jo.util.toJSONOptions)},e}(),t}();qT.exports=oc});var HT=m(Nr=>{"use strict";c();var pV=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]}),gV=Nr&&Nr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yV=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)&&pV(e,t,r);return gV(e,t),e},mV=Nr&&Nr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Nr,"__esModule",{value:!0});Nr.ProtoSerializer=void 0;var EV=mV(jt()),bE=yt(),wV=ps(),vV=yV(Be()),AV=tc(),_E=class{serializeTransaction(e){let r=VT().proto,n=new bE.Address(e.getReceiver().bech32()).pubkey(),i=new bE.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()!==wV.TRANSACTION_OPTIONS_DEFAULT&&(s.Options=e.getOptions().valueOf()),e.isGuardedTransaction()){let u=e.getGuardian();s.GuardAddr=new bE.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 EV.default(e.toString());if(r.isZero())return h.Buffer.from([0,0]);let n=AV.bigIntToBuffer(r);return n=h.Buffer.concat([h.Buffer.from([0]),n]),n}deserializeTransaction(e){throw new vV.ErrUnsupportedOperation("deserializeTransaction")}};Nr.ProtoSerializer=_E});var jT=m(As=>{"use strict";c();var bV=As&&As.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_V=As&&As.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&bV(e,t,r)};Object.defineProperty(As,"__esModule",{value:!0});_V(HT(),As)});var Rh=m(hn=>{"use strict";c();var IV=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]}),SV=hn&&hn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CV=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)&&IV(e,t,r);return SV(e,t),e};Object.defineProperty(hn,"__esModule",{value:!0});hn.Signature=void 0;var GT=CV(Be()),kT=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 GT.ErrSignatureCannotCreate(e);return t.fromValidHex(e)}static isValidHex(e){return h.Buffer.from(e,"hex").length==kT}static fromValidHex(e){let r=new t;return r.valueHex=e,r}static fromBuffer(e){if(e.length!=kT)throw new GT.ErrSignatureCannotCreate(e);return t.fromValidHex(e.toString("hex"))}hex(){return this.valueHex}};hn.Signature=IE});var qn=m(Bh=>{"use strict";c();Object.defineProperty(Bh,"__esModule",{value:!0});Bh.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}};Bh.TransactionPayload=SE});var CE=m((Foe,QT)=>{c();Vn.notEqual=xV;Vn.notOk=NV;Vn.equal=TV;Vn.ok=Vn;QT.exports=Vn;function TV(t,e,r){Vn(t==e,r)}function xV(t,e,r){Vn(t!=e,r)}function NV(t,e){Vn(!t,e)}function Vn(t,e){if(!t)throw new Error(e||"AssertionError")}});var _s=m(Wo=>{"use strict";c();var TE=p0(),ko=y0(),WT=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Wo.Buffer=z;Wo.SlowBuffer=LV;Wo.INSPECT_MAX_BYTES=50;var Lh=2147483647;Wo.kMaxLength=Lh;z.TYPED_ARRAY_SUPPORT=OV();!z.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function OV(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return!1}}Object.defineProperty(z.prototype,"parent",{enumerable:!0,get:function(){if(z.isBuffer(this))return this.buffer}});Object.defineProperty(z.prototype,"offset",{enumerable:!0,get:function(){if(z.isBuffer(this))return this.byteOffset}});function Hn(t){if(t>Lh)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,z.prototype),e}function z(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return DE(t)}return YT(t,e,r)}z.poolSize=8192;function YT(t,e,r){if(typeof t=="string")return PV(t,e);if(ArrayBuffer.isView(t))return RV(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(dn(t,ArrayBuffer)||t&&dn(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(dn(t,SharedArrayBuffer)||t&&dn(t.buffer,SharedArrayBuffer)))return NE(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=t.valueOf&&t.valueOf();if(n!=null&&n!==t)return z.from(n,e,r);let i=BV(t);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return z.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}z.from=function(t,e,r){return YT(t,e,r)};Object.setPrototypeOf(z.prototype,Uint8Array.prototype);Object.setPrototypeOf(z,Uint8Array);function JT(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 DV(t,e,r){return JT(t),t<=0?Hn(t):e!==void 0?typeof r=="string"?Hn(t).fill(e,r):Hn(t).fill(e):Hn(t)}z.alloc=function(t,e,r){return DV(t,e,r)};function DE(t){return JT(t),Hn(t<0?0:PE(t)|0)}z.allocUnsafe=function(t){return DE(t)};z.allocUnsafeSlow=function(t){return DE(t)};function PV(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!z.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=XT(t,e)|0,n=Hn(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function xE(t){let e=t.length<0?0:PE(t.length)|0,r=Hn(e);for(let n=0;n=Lh)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Lh.toString(16)+" bytes");return t|0}function LV(t){return+t!=t&&(t=0),z.alloc(+t)}z.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==z.prototype};z.compare=function(e,r){if(dn(e,Uint8Array)&&(e=z.from(e,e.offset,e.byteLength)),dn(r,Uint8Array)&&(r=z.from(r,r.offset,r.byteLength)),!z.isBuffer(e)||!z.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;let n=e.length,i=r.length;for(let s=0,o=Math.min(n,i);si.length?(z.isBuffer(o)||(o=z.from(o)),o.copy(i,s)):Uint8Array.prototype.set.call(i,o,s);else if(z.isBuffer(o))o.copy(i,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return i};function XT(t,e){if(z.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||dn(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 OE(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return ax(t).length;default:if(i)return n?-1:OE(t).length;e=(""+e).toLowerCase(),i=!0}}z.byteLength=XT;function FV(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 WV(this,e,r);case"utf8":case"utf-8":return ex(this,e,r);case"ascii":return kV(this,e,r);case"latin1":case"binary":return QV(this,e,r);case"base64":return jV(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return zV(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}z.prototype._isBuffer=!0;function bs(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}z.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let r=0;rr&&(e+=" ... "),""};WT&&(z.prototype[WT]=z.prototype.inspect);z.prototype.compare=function(e,r,n,i,s){if(dn(e,Uint8Array)&&(e=z.from(e,e.offset,e.byteLength)),!z.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),r<0||n>e.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&r>=n)return 0;if(i>=s)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,s>>>=0,this===e)return 0;let o=s-i,a=n-r,u=Math.min(o,a),l=this.slice(i,s),f=e.slice(r,n);for(let d=0;d2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,BE(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof e=="string"&&(e=z.from(e,n)),z.isBuffer(e))return e.length===0?-1:zT(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):zT(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function zT(t,e,r,n,i){let s=1,o=t.length,a=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;s=2,o/=2,a/=2,r/=2}function u(f,d){return s===1?f[d]:f.readUInt16BE(d*s)}let l;if(i){let f=-1;for(l=r;lo&&(r=o-a),l=r;l>=0;l--){let f=!0;for(let d=0;di&&(n=i)):n=i;let s=e.length;n>s/2&&(n=s/2);let o;for(o=0;o>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let s=this.length-r;if((n===void 0||n>s)&&(n=s),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let o=!1;for(;;)switch(i){case"hex":return MV(this,e,r,n);case"utf8":case"utf-8":return UV(this,e,r,n);case"ascii":case"latin1":case"binary":return qV(this,e,r,n);case"base64":return VV(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return HV(this,e,r,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};z.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function jV(t,e,r){return e===0&&r===t.length?TE.fromByteArray(t):TE.fromByteArray(t.slice(e,r))}function ex(t,e,r){r=Math.min(t.length,r);let n=[],i=e;for(;i239?4:s>223?3:s>191?2:1;if(i+a<=r){let u,l,f,d;switch(a){case 1:s<128&&(o=s);break;case 2:u=t[i+1],(u&192)===128&&(d=(s&31)<<6|u&63,d>127&&(o=d));break;case 3:u=t[i+1],l=t[i+2],(u&192)===128&&(l&192)===128&&(d=(s&15)<<12|(u&63)<<6|l&63,d>2047&&(d<55296||d>57343)&&(o=d));break;case 4:u=t[i+1],l=t[i+2],f=t[i+3],(u&192)===128&&(l&192)===128&&(f&192)===128&&(d=(s&15)<<18|(u&63)<<12|(l&63)<<6|f&63,d>65535&&d<1114112&&(o=d))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),i+=a}return GV(n)}var $T=4096;function GV(t){let e=t.length;if(e<=$T)return String.fromCharCode.apply(String,t);let r="",n=0;for(;nn)&&(r=n);let i="";for(let s=e;sn&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),rr)throw new RangeError("Trying to access beyond buffer length")}z.prototype.readUintLE=z.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Lt(e,r,this.length);let i=this[e],s=1,o=0;for(;++o>>0,r=r>>>0,n||Lt(e,r,this.length);let i=this[e+--r],s=1;for(;r>0&&(s*=256);)i+=this[e+--r]*s;return i};z.prototype.readUint8=z.prototype.readUInt8=function(e,r){return e=e>>>0,r||Lt(e,1,this.length),this[e]};z.prototype.readUint16LE=z.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||Lt(e,2,this.length),this[e]|this[e+1]<<8};z.prototype.readUint16BE=z.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||Lt(e,2,this.length),this[e]<<8|this[e+1]};z.prototype.readUint32LE=z.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||Lt(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};z.prototype.readUint32BE=z.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||Lt(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};z.prototype.readBigUInt64LE=vi(function(e){e=e>>>0,Qo(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&ac(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,Qo(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&ac(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||Lt(e,r,this.length);let i=this[e],s=1,o=0;for(;++o=s&&(i-=Math.pow(2,8*r)),i};z.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||Lt(e,r,this.length);let i=r,s=1,o=this[e+--i];for(;i>0&&(s*=256);)o+=this[e+--i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*r)),o};z.prototype.readInt8=function(e,r){return e=e>>>0,r||Lt(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};z.prototype.readInt16LE=function(e,r){e=e>>>0,r||Lt(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};z.prototype.readInt16BE=function(e,r){e=e>>>0,r||Lt(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};z.prototype.readInt32LE=function(e,r){return e=e>>>0,r||Lt(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};z.prototype.readInt32BE=function(e,r){return e=e>>>0,r||Lt(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};z.prototype.readBigInt64LE=vi(function(e){e=e>>>0,Qo(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&ac(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,Qo(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&ac(e,this.length-8);let i=(r<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(i)<>>0,r||Lt(e,4,this.length),ko.read(this,e,!0,23,4)};z.prototype.readFloatBE=function(e,r){return e=e>>>0,r||Lt(e,4,this.length),ko.read(this,e,!1,23,4)};z.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||Lt(e,8,this.length),ko.read(this,e,!0,52,8)};z.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||Lt(e,8,this.length),ko.read(this,e,!1,52,8)};function cr(t,e,r,n,i,s){if(!z.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}z.prototype.writeUintLE=z.prototype.writeUIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){let a=Math.pow(2,8*n)-1;cr(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;cr(this,e,r,n,a,0)}let s=n-1,o=1;for(this[r+s]=e&255;--s>=0&&(o*=256);)this[r+s]=e/o&255;return r+n};z.prototype.writeUint8=z.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||cr(this,e,r,1,255,0),this[r]=e&255,r+1};z.prototype.writeUint16LE=z.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||cr(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};z.prototype.writeUint16BE=z.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||cr(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};z.prototype.writeUint32LE=z.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||cr(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4};z.prototype.writeUint32BE=z.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||cr(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 tx(t,e,r,n,i){ox(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 rx(t,e,r,n,i){ox(e,n,i,t,r,7);let s=Number(e&BigInt(4294967295));t[r+7]=s,s=s>>8,t[r+6]=s,s=s>>8,t[r+5]=s,s=s>>8,t[r+4]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=o,o=o>>8,t[r+2]=o,o=o>>8,t[r+1]=o,o=o>>8,t[r]=o,r+8}z.prototype.writeBigUInt64LE=vi(function(e,r=0){return tx(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});z.prototype.writeBigUInt64BE=vi(function(e,r=0){return rx(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});z.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let u=Math.pow(2,8*n-1);cr(this,e,r,n,u-1,-u)}let s=0,o=1,a=0;for(this[r]=e&255;++s>0)-a&255;return r+n};z.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let u=Math.pow(2,8*n-1);cr(this,e,r,n,u-1,-u)}let s=n-1,o=1,a=0;for(this[r+s]=e&255;--s>=0&&(o*=256);)e<0&&a===0&&this[r+s+1]!==0&&(a=1),this[r+s]=(e/o>>0)-a&255;return r+n};z.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||cr(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};z.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||cr(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};z.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||cr(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};z.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||cr(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4};z.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||cr(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};z.prototype.writeBigInt64LE=vi(function(e,r=0){return tx(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});z.prototype.writeBigInt64BE=vi(function(e,r=0){return rx(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function nx(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 ix(t,e,r,n,i){return e=+e,r=r>>>0,i||nx(t,e,r,4,34028234663852886e22,-34028234663852886e22),ko.write(t,e,r,n,23,4),r+4}z.prototype.writeFloatLE=function(e,r,n){return ix(this,e,r,!0,n)};z.prototype.writeFloatBE=function(e,r,n){return ix(this,e,r,!1,n)};function sx(t,e,r,n,i){return e=+e,r=r>>>0,i||nx(t,e,r,8,17976931348623157e292,-17976931348623157e292),ko.write(t,e,r,n,52,8),r+8}z.prototype.writeDoubleLE=function(e,r,n){return sx(this,e,r,!0,n)};z.prototype.writeDoubleBE=function(e,r,n){return sx(this,e,r,!1,n)};z.prototype.copy=function(e,r,n,i){if(!z.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),r>=e.length&&(r=e.length),r||(r=0),i>0&&i=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-r>>0,n=n===void 0?this.length:n>>>0,e||(e=0);let s;if(typeof e=="number")for(s=r;s2**32?i=KT(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=KT(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);function KT(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 $V(t,e,r){Qo(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&ac(e,t.length-(r+1))}function ox(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 Go.ERR_OUT_OF_RANGE("value",a,t)}$V(n,i,s)}function Qo(t,e){if(typeof t!="number")throw new Go.ERR_INVALID_ARG_TYPE(e,"number",t)}function ac(t,e,r){throw Math.floor(t)!==t?(Qo(t,r),new Go.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new Go.ERR_BUFFER_OUT_OF_BOUNDS:new Go.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var KV=/[^+/0-9A-Za-z-_]/g;function YV(t){if(t=t.split("=")[0],t=t.trim().replace(KV,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function OE(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 JV(t){let e=[];for(let r=0;r>8,i=r%256,s.push(i),s.push(n);return s}function ax(t){return TE.toByteArray(YV(t))}function Fh(t,e,r,n){let i;for(i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function dn(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function BE(t){return t!==t}var ZV=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 vi(t){return typeof BigInt>"u"?eH:t}function eH(){throw new Error("BigInt not supported")}});var cx=m((Hoe,ux)=>{c();ux.exports=LE;LE.supported=typeof WebAssembly<"u";function LE(t){if(!LE.supported)return null;var e=t&&t.imports,r=tH("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 tH(t){return typeof atob=="function"?new Uint8Array(atob(t).split("").map(rH)):new(_s()).Buffer(t,"base64")}function rH(t){return t.charCodeAt(0)}});var yx=m((Qoe,gn)=>{c();var pn=CE(),Ke=cx()(),jn=64,Mh=[];gn.exports=Or;var lx=gn.exports.BYTES_MIN=16,fx=gn.exports.BYTES_MAX=64,Goe=gn.exports.BYTES=32,hx=gn.exports.KEYBYTES_MIN=16,dx=gn.exports.KEYBYTES_MAX=64,koe=gn.exports.KEYBYTES=32,px=gn.exports.SALTBYTES=16,gx=gn.exports.PERSONALBYTES=16;function Or(t,e,r,n,i){if(!(this instanceof Or))return new Or(t,e,r,n,i);if(!(Ke&&Ke.exports))throw new Error("WASM not loaded. Wait for Blake2b.ready(cb)");t||(t=32),i!==!0&&(pn(t>=lx,"digestLength must be at least "+lx+", was given "+t),pn(t<=fx,"digestLength must be at most "+fx+", was given "+t),e!=null&&pn(e.length>=hx,"key must be at least "+hx+", was given "+e.length),e!=null&&pn(e.length<=dx,"key must be at least "+dx+", was given "+e.length),r!=null&&pn(r.length===px,"salt must be exactly "+px+", was given "+r.length),n!=null&&pn(n.length===gx,"personal must be exactly "+gx+", was given "+n.length)),Mh.length||(Mh.push(jn),jn+=216),this.digestLength=t,this.finalized=!1,this.pointer=Mh.pop(),Ke.memory.fill(0,0,64),Ke.memory[0]=this.digestLength,Ke.memory[1]=e?e.length:0,Ke.memory[2]=1,Ke.memory[3]=1,r&&Ke.memory.set(r,32),n&&Ke.memory.set(n,48),this.pointer+216>Ke.memory.length&&Ke.realloc(this.pointer+216),Ke.exports.blake2b_init(this.pointer,this.digestLength),e&&(this.update(e),Ke.memory.fill(0,jn,jn+e.length),Ke.memory[this.pointer+200]=128)}Or.prototype.update=function(t){return pn(this.finalized===!1,"Hash instance finalized"),pn(t,"input must be TypedArray or Buffer"),jn+t.length>Ke.memory.length&&Ke.realloc(jn+t.length),Ke.memory.set(t,jn),Ke.exports.blake2b_update(this.pointer,jn,jn+t.length),this};Or.prototype.digest=function(t){if(pn(this.finalized===!1,"Hash instance finalized"),this.finalized=!0,Mh.push(this.pointer),Ke.exports.blake2b_final(this.pointer),!t||t==="binary")return Ke.memory.slice(this.pointer+128,this.pointer+128+this.digestLength);if(t==="hex")return iH(Ke.memory,this.pointer+128,this.digestLength);pn(t.length>=this.digestLength,"input must be TypedArray or Buffer");for(var e=0;e{c();var _i=CE(),cc=yx();function Uh(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 mx(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 Ix(t,e){return t[e]^t[e+1]<<8^t[e+2]<<16^t[e+3]<<24}function Ai(t,e,r,n,i,s){var o=uc[i],a=uc[i+1],u=uc[s],l=uc[s+1];Uh(Te,t,e),mx(Te,t,o,a);var f=Te[n]^Te[t],d=Te[n+1]^Te[t+1];Te[n]=d,Te[n+1]=f,Uh(Te,r,n),f=Te[e]^Te[r],d=Te[e+1]^Te[r+1],Te[e]=f>>>24^d<<8,Te[e+1]=d>>>24^f<<8,Uh(Te,t,e),mx(Te,t,u,l),f=Te[n]^Te[t],d=Te[n+1]^Te[t+1],Te[n]=f>>>16^d<<16,Te[n+1]=d>>>16^f<<16,Uh(Te,r,n),f=Te[e]^Te[r],d=Te[e+1]^Te[r+1],Te[e]=d>>>31^f<<1,Te[e+1]=f>>>31^d<<1}var Sx=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),oH=[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],$t=new Uint8Array(oH.map(function(t){return t*2})),Te=new Uint32Array(32),uc=new Uint32Array(32);function Cx(t,e){var r=0;for(r=0;r<16;r++)Te[r]=t.h[r],Te[r+16]=Sx[r];for(Te[24]=Te[24]^t.t,Te[25]=Te[25]^t.t/4294967296,e&&(Te[28]=~Te[28],Te[29]=~Te[29]),r=0;r<32;r++)uc[r]=Ix(t.b,4*r);for(r=0;r<12;r++)Ai(0,8,16,24,$t[r*16+0],$t[r*16+1]),Ai(2,10,18,26,$t[r*16+2],$t[r*16+3]),Ai(4,12,20,28,$t[r*16+4],$t[r*16+5]),Ai(6,14,22,30,$t[r*16+6],$t[r*16+7]),Ai(0,10,20,30,$t[r*16+8],$t[r*16+9]),Ai(2,12,22,24,$t[r*16+10],$t[r*16+11]),Ai(4,14,16,26,$t[r*16+12],$t[r*16+13]),Ai(6,8,18,28,$t[r*16+14],$t[r*16+15]);for(r=0;r<16;r++)t.h[r]=t.h[r]^Te[r]^Te[r+16]}var bi=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);function zo(t,e,r,n){bi.fill(0),this.b=new Uint8Array(128),this.h=new Uint32Array(16),this.t=0,this.c=0,this.outlen=t,bi[0]=t,e&&(bi[1]=e.length),bi[2]=1,bi[3]=1,r&&bi.set(r,32),n&&bi.set(n,48);for(var i=0;i<16;i++)this.h[i]=Sx[i]^Ix(bi,i*4);e&&(Tx(this,e),this.c=128)}zo.prototype.update=function(t){return _i(t!=null,"input must be Uint8Array or Buffer"),Tx(this,t),this};zo.prototype.digest=function(t){var e=!t||t==="binary"||t==="hex"?new Uint8Array(this.outlen):t;return _i(e.length>=this.outlen,"out must have at least outlen bytes of space"),aH(this,e),t==="hex"?uH(e):e};zo.prototype.final=zo.prototype.digest;zo.ready=function(t){cc.ready(function(){t()})};function Tx(t,e){for(var r=0;r>2]>>8*(r&3);return e}function uH(t){for(var e="",r=0;r=Ex,"outlen must be at least "+Ex+", was given "+e),_i(e<=wx,"outlen must be at most "+wx+", was given "+e),r!=null&&_i(r.length>=vx,"key must be at least "+vx+", was given "+r.length),r!=null&&_i(r.length<=Ax,"key must be at most "+Ax+", was given "+r.length),n!=null&&_i(n.length===bx,"salt must be exactly "+bx+", was given "+n.length),i!=null&&_i(i.length===_x,"personal must be exactly "+_x+", was given "+i.length)),new xx(e,r,n,i)};lr.exports.ready=function(t){cc.ready(function(){t()})};lr.exports.WASM_SUPPORTED=cc.SUPPORTED;lr.exports.WASM_LOADED=!1;var Ex=lr.exports.BYTES_MIN=16,wx=lr.exports.BYTES_MAX=64,zoe=lr.exports.BYTES=32,vx=lr.exports.KEYBYTES_MIN=16,Ax=lr.exports.KEYBYTES_MAX=64,$oe=lr.exports.KEYBYTES=32,bx=lr.exports.SALTBYTES=16,_x=lr.exports.PERSONALBYTES=16;cc.ready(function(t){t||(lr.exports.WASM_LOADED=!0,xx=cc)})});var yn=m(Dr=>{"use strict";c();var lH=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]}),fH=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)&&lH(e,t,r);return fH(e,t),e};Object.defineProperty(Dr,"__esModule",{value:!0});Dr.TransactionHash=Dr.Transaction=void 0;var $o=jt(),lc=yt(),dH=Ch(),pH=ps(),gH=hH(Be()),yH=VC(),Gn=Th(),mH=jT(),Ox=Rh(),Dx=qn(),EH=gr(),wH=Nx(),vH=32,FE=class t{constructor({nonce:e,value:r,sender:n,receiver:i,senderUsername:s,receiverUsername:o,gasPrice:a,gasLimit:u,data:l,chainID:f,version:d,options:g,guardian:E}){this.nonce=e||0,this.value=r?new $o.BigNumber(r.toString()).toFixed(0):0,this.sender=n,this.receiver=i,this.senderUsername=s||"",this.receiverUsername=o||"",this.gasPrice=a||pH.TRANSACTION_MIN_GAS_PRICE,this.gasLimit=u,this.data=l||new Dx.TransactionPayload,this.chainID=f,this.version=d?new Gn.TransactionVersion(d.valueOf()):Gn.TransactionVersion.withDefaultVersion(),this.options=g?new Gn.TransactionOptions(g.valueOf()):Gn.TransactionOptions.withDefaultOptions(),this.guardian=E||lc.Address.empty(),this.signature=h.Buffer.from([]),this.guardianSignature=h.Buffer.from([]),this.hash=Ko.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 Gn.TransactionVersion(e.valueOf())}getOptions(){return new Gn.TransactionOptions(this.options.valueOf())}setOptions(e){this.options=new Gn.TransactionOptions(e.valueOf())}getSignature(){return this.signature}getGuardianSignature(){return this.guardianSignature}setGuardian(e){this.guardian=e}getHash(){return EH.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 dH.Compatibility.guardAddressIsSetAndNonZero(new lc.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 $o.BigNumber(e.value).toFixed(0),receiver:lc.Address.fromString(e.receiver),receiverUsername:e.receiverUsername?h.Buffer.from(e.receiverUsername,"base64").toString():void 0,sender:lc.Address.fromString(e.sender),senderUsername:e.senderUsername?h.Buffer.from(e.senderUsername,"base64").toString():void 0,guardian:e.guardian?lc.Address.fromString(e.guardian):void 0,gasPrice:Number(e.gasPrice),gasLimit:Number(e.gasLimit),data:new Dx.TransactionPayload(h.Buffer.from(e.data||"","base64")),chainID:String(e.chainID),version:new Gn.TransactionVersion(e.version),options:e.options!=null?new Gn.TransactionOptions(e.options):void 0});return e.signature&&r.applySignature(new Ox.Signature(e.signature)),e.guardianSignature&&r.applyGuardianSignature(new Ox.Signature(e.guardianSignature)),r}applySignature(e){this.signature=this.interpretSignatureAsBuffer(e),this.hash=Ko.compute(this)}interpretSignatureAsBuffer(e){if(ArrayBuffer.isView(e))return h.Buffer.from(e);if(e.hex!=null)return h.Buffer.from(e.hex(),"hex");throw new Error(`Object cannot be interpreted as a signature: ${e}`)}applyGuardianSignature(e){this.guardianSignature=this.interpretSignatureAsBuffer(e),this.hash=Ko.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 gH.ErrNotEnoughGas(this.gasLimit.valueOf());let n=new $o.BigNumber(this.gasPrice.valueOf()),i=new $o.BigNumber(r).multipliedBy(n);if(r===this.gasLimit.valueOf())return i;let s=new $o.BigNumber(this.gasLimit.valueOf()-r),o=n.multipliedBy(new $o.BigNumber(e.GasPriceModifier.valueOf())),a=s.multipliedBy(o);return i.plus(a)}};Dr.Transaction=FE;var Ko=class t extends yH.Hash{constructor(e){super(e)}static compute(e){let n=new mH.ProtoSerializer().serializeTransaction(e),i=wH(vH).update(n).digest("hex");return new t(i)}};Dr.TransactionHash=Ko});var VE=m(Vh=>{"use strict";c();Object.defineProperty(Vh,"__esModule",{value:!0});Vh.TransferTransactionsFactory=void 0;var ME=Vo(),kr=Ot(),qh=yn(),UE=qn(),qE=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 qh.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([kr.BytesValue.fromUTF8(e.tokenTransfer.tokenIdentifier),new kr.BigUIntValue(e.tokenTransfer.valueOf())]),n=`ESDTTransfer@${r}`,i=new UE.TransactionPayload(n),s=i.length()||0,o=this.gasEstimator.forESDTTransfer(s);return new qh.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([kr.BytesValue.fromUTF8(e.tokenTransfer.tokenIdentifier),new kr.U64Value(e.tokenTransfer.nonce),new kr.BigUIntValue(e.tokenTransfer.valueOf()),new kr.AddressValue(e.destination)]),n=`ESDTNFTTransfer@${r}`,i=new UE.TransactionPayload(n),s=i.length()||0,o=this.gasEstimator.forESDTNFTTransfer(s);return new qh.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 kr.AddressValue(e.destination),new kr.U16Value(e.tokenTransfers.length)];for(let u of e.tokenTransfers)r.push(kr.BytesValue.fromUTF8(u.tokenIdentifier),new kr.U64Value(u.nonce),new kr.BigUIntValue(u.valueOf()));let{argumentsString:n}=new ME.ArgSerializer().valuesToString(r),i=`MultiESDTNFTTransfer@${n}`,s=new UE.TransactionPayload(i),o=s.length()||0,a=this.gasEstimator.forMultiESDTNFTTransfer(o,e.tokenTransfers.length);return new qh.Transaction({nonce:e.nonce,receiver:e.sender,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||a,data:s,chainID:e.chainID})}};Vh.TransferTransactionsFactory=qE});var jE=m(Is=>{"use strict";c();Object.defineProperty(Is,"__esModule",{value:!0});Is.GasEstimator=Is.DefaultGasConfiguration=void 0;Is.DefaultGasConfiguration={minGasLimit:5e4,gasPerDataByte:1500,gasCostESDTTransfer:2e5,gasCostESDTNFTTransfer:2e5,gasCostESDTNFTMultiTransfer:2e5};var AH=1e5,Px=8e5,HE=class{constructor(e){this.gasConfiguration=e||Is.DefaultGasConfiguration}forEGLDTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasPerDataByte*e}forESDTTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasCostESDTTransfer+this.gasConfiguration.gasPerDataByte*e+AH}forESDTNFTTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasCostESDTNFTTransfer+this.gasConfiguration.gasPerDataByte*e+Px}forMultiESDTNFTTransfer(e,r){return this.gasConfiguration.minGasLimit+(this.gasConfiguration.gasCostESDTNFTMultiTransfer+Px)*r+this.gasConfiguration.gasPerDataByte*e}};Is.GasEstimator=HE});var Ss=m(Hh=>{"use strict";c();Object.defineProperty(Hh,"__esModule",{value:!0});Hh.Account=void 0;var bH=yt(),GE=class{constructor(e){this.address=new bH.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()}}};Hh.Account=GE});var Yo=m(Ts=>{"use strict";c();Object.defineProperty(Ts,"__esModule",{value:!0});Ts.Logger=Ts.LogLevel=void 0;var Cs;(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"})(Cs=Ts.LogLevel||(Ts.LogLevel={}));var jh=class t{static setLevel(e){t.logLevel=e}static trace(e,...r){t.logLevel>=Cs.Debug||console.debug(e,r)}static debug(e,...r){t.logLevel>=Cs.Debug||console.debug(e,r)}static info(e,...r){t.logLevel>=Cs.Info||console.log(e,r)}static warn(e,...r){t.logLevel>=Cs.Warn||console.warn(e,r)}static error(e,...r){t.logLevel>=Cs.Error||console.error(e,r)}};Ts.Logger=jh;jh.logLevel=Cs.Debug});var WE=m(mn=>{"use strict";c();var _H=mn&&mn.__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]}),IH=mn&&mn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SH=mn&&mn.__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 IH(e,t),e};Object.defineProperty(mn,"__esModule",{value:!0});mn.AsyncTimer=void 0;var CH=SH(Be()),TH=Be(),kE=Yo(),QE=class{constructor(e){this.timeoutHandle=null,this.rejectionFunc=null,this.name=e,this.correlationTag=0}start(e){if(this.timeoutHandle)throw new CH.ErrAsyncTimerAlreadyRunning;return this.correlationTag++,kE.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(){kE.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].abort()`),this.rejectionFunc&&(this.rejectionFunc(new TH.ErrAsyncTimerAborted),this.rejectionFunc=null),this.stop()}stop(){this.isStopped()||(kE.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].stop()`),this.timeoutHandle&&(clearTimeout(this.timeoutHandle),this.timeoutHandle=null))}isStopped(){return!this.timeoutHandle}};mn.AsyncTimer=QE});var Gh=m(Xo=>{"use strict";c();var Pr=Xo&&Xo.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(Xo,"__esModule",{value:!0});Xo.TransactionWatcher=void 0;var zE=WE(),Jo=Be(),Rx=Yo(),Ii=class t{constructor(e,r={}){this.fetcher=new $E(e),this.pollingIntervalMilliseconds=r.pollingIntervalMilliseconds||t.DefaultPollingInterval,this.timeoutMilliseconds=r.timeoutMilliseconds||t.DefaultTimeout,this.patienceMilliseconds=r.patienceMilliseconds||t.DefaultPatience}awaitPending(e){return Pr(this,void 0,void 0,function*(){let r=s=>s.status.isPending(),n=()=>Pr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),i=()=>new Jo.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)})}awaitCompleted(e){return Pr(this,void 0,void 0,function*(){let r=s=>s.isCompleted,n=()=>Pr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),i=()=>new Jo.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)})}awaitAllEvents(e,r){return Pr(this,void 0,void 0,function*(){let n=o=>{let a=this.getAllTransactionEvents(o).map(l=>l.identifier);return r.every(l=>a.includes(l))},i=()=>Pr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),s=()=>new Jo.ErrExpectedTransactionEventsNotFound;return this.awaitConditionally(n,i,s)})}awaitAnyEvent(e,r){return Pr(this,void 0,void 0,function*(){let n=o=>{let a=this.getAllTransactionEvents(o).map(l=>l.identifier);return r.find(l=>a.includes(l))!=null},i=()=>Pr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),s=()=>new Jo.ErrExpectedTransactionEventsNotFound;return this.awaitConditionally(n,i,s)})}awaitOnCondition(e,r){return Pr(this,void 0,void 0,function*(){let n=()=>Pr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),i=()=>new Jo.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)})}awaitConditionally(e,r,n){return Pr(this,void 0,void 0,function*(){let i=new zE.AsyncTimer("watcher:periodic"),s=new zE.AsyncTimer("watcher:patience"),o=new zE.AsyncTimer("watcher:timeout"),a=!1,u,l=!1;for(o.start(this.timeoutMilliseconds).finally(()=>{o.stop(),a=!0});!a;){yield i.start(this.pollingIntervalMilliseconds);try{if(u=yield r(),l=e(u),l||a)break}catch(f){if(Rx.Logger.debug("TransactionWatcher.awaitConditionally(): cannot (yet) fetch data."),!(f instanceof Jo.Err))throw f}}if(l&&(yield s.start(this.patienceMilliseconds)),o.isStopped()||o.stop(),!u||!l)throw n();return u})}getAllTransactionEvents(e){let r=[...e.logs.events];for(let n of e.contractResults.items)r.push(...n.logs.events);return r}};Xo.TransactionWatcher=Ii;Ii.DefaultPollingInterval=6e3;Ii.DefaultTimeout=Ii.DefaultPollingInterval*15;Ii.DefaultPatience=0;Ii.NoopOnStatusReceived=t=>{};var $E=class{constructor(e){this.fetcher=e}getTransaction(e){return Pr(this,void 0,void 0,function*(){return Rx.Logger.debug(`transactionWatcher, getTransaction(${e})`),yield this.fetcher.getTransaction(e)})}}});var YE=m(Wh=>{"use strict";c();Object.defineProperty(Wh,"__esModule",{value:!0});Wh.CodeMetadata=void 0;var KE=class{constructor(e=!0,r=!1,n=!1,i=!1){this.upgradeable=e,this.readable=r,this.payable=n,this.payableBySc=i}toggleUpgradeable(e){this.upgradeable=e}toggleReadable(e){this.readable=e}togglePayable(e){this.payable=e}togglePayableBySc(e){this.payableBySc=e}toBuffer(){let e=0,r=0;return this.upgradeable&&(e|=kh.Upgradeable),this.readable&&(e|=kh.Readable),this.payable&&(r|=Qh.Payable),this.payableBySc&&(r|=Qh.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}};Wh.CodeMetadata=KE;var kh;(function(t){t[t.Upgradeable=1]="Upgradeable",t[t.Reserved2=2]="Reserved2",t[t.Readable=4]="Readable"})(kh||(kh={}));var Qh;(function(t){t[t.Reserved1=1]="Reserved1",t[t.Payable=2]="Payable",t[t.PayableBySc=4]="PayableBySc"})(Qh||(Qh={}))});var fc=m(En=>{"use strict";c();var xH=En&&En.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),NH=En&&En.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),OH=En&&En.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&xH(e,t,r);return NH(e,t),e};Object.defineProperty(En,"__esModule",{value:!0});En.ContractFunction=void 0;var DH=OH(Be()),JE=class t{constructor(e){if(this.name=e,e==null)throw new DH.ErrInvalidFunctionName}static none(){return new t("untitled")}toString(){return this.name}valueOf(){return this.name}};En.ContractFunction=JE});var ew=m(Rr=>{"use strict";c();var PH=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]}),RH=Rr&&Rr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),BH=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)&&PH(e,t,r);return RH(e,t),e},LH=Rr&&Rr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Rr,"__esModule",{value:!0});Rr.InteractionChecker=void 0;var XE=BH(Be()),FH=LH(jt()),ZE=class{checkInteraction(e,r){this.checkPayable(e,r),this.checkArguments(e,r)}checkPayable(e,r){let n=!new FH.default(e.getValue().toString()).isZero(),i=r.modifiers.isPayableInEGLD();if(n&&!i)throw new XE.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 XE.ErrContractInteraction(`bad arguments, expected: ${s}, got: ${o}`);for(let a=0;a{"use strict";c();Object.defineProperty(zh,"__esModule",{value:!0});zh.Query=void 0;var MH=yt(),UH=Vo(),tw=class{constructor(e){this.caller=e.caller||new MH.Address,this.address=e.address,this.func=e.func,this.args=e.args||[],this.value=e.value||0}getEncodedArguments(){return new UH.ArgSerializer().valuesToStrings(this.args)}};zh.Query=tw});var sw=m($h=>{"use strict";c();Object.defineProperty($h,"__esModule",{value:!0});$h.Interaction=void 0;var Bx=yt(),qH=Ch(),rw=ps(),nw=fc(),VH=ew(),HH=hc(),Zo=Ot(),iw=class{constructor(e,r,n){this.nonce=0,this.value="0",this.gasLimit=0,this.gasPrice=void 0,this.chainID="",this.querent=new Bx.Address,this.sender=new Bx.Address,this.isWithSingleESDTTransfer=!1,this.isWithSingleESDTNFTTransfer=!1,this.isWithMultiESDTNFTTransfer=!1,this.contract=e,this.function=r,this.args=n,this.tokenTransfers=new ea([],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(){qH.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 nw.ContractFunction(rw.ESDT_TRANSFER_FUNCTION_NAME),n=this.tokenTransfers.buildArgsForSingleESDTTransfer()):this.isWithSingleESDTNFTTransfer?(e=this.sender,r=new nw.ContractFunction(rw.ESDTNFT_TRANSFER_FUNCTION_NAME),n=this.tokenTransfers.buildArgsForSingleESDTNFTTransfer()):this.isWithMultiESDTNFTTransfer&&(e=this.sender,r=new nw.ContractFunction(rw.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 HH.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 ea([e],this),this}withSingleESDTNFTTransfer(e,r){return this.isWithSingleESDTNFTTransfer=!0,this.tokenTransfers=new ea([e],this),r&&(this.sender=r),this}withMultiESDTNFTTransfer(e,r){return this.isWithMultiESDTNFTTransfer=!0,this.tokenTransfers=new ea(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 VH.InteractionChecker().checkInteraction(this,this.getEndpoint()),this}};$h.Interaction=iw;var ea=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 Zo.U8Value(this.transfers.length)}getTypedTokenIdentifier(e){return Zo.BytesValue.fromUTF8(e.tokenIdentifier)}getTypedTokenNonce(e){return new Zo.U64Value(e.nonce)}getTypedTokenQuantity(e){return new Zo.BigUIntValue(e.amountAsBigInteger)}getTypedTokensReceiver(){return new Zo.AddressValue(this.interaction.getContractAddress())}getTypedInteractionFunction(){return Zo.BytesValue.fromUTF8(this.interaction.getFunction().valueOf())}getInteractionArguments(){return this.interaction.getArguments()}}});var Lx=m(Kh=>{"use strict";c();Object.defineProperty(Kh,"__esModule",{value:!0});Kh.ArgumentErrorContext=void 0;var jH=Be(),ow=class{constructor(e,r,n){this.endpointName=e,this.argumentIndex=r,this.parameterDefinition=n}throwError(e){throw new jH.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)})`)}};Kh.ArgumentErrorContext=ow});var aw=m(xs=>{"use strict";c();var GH=xs&&xs.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(xs,"__esModule",{value:!0});xs.NativeSerializer=void 0;var kH=GH(jt()),QH=yt(),Fx=Be(),WH=rh(),zH=Lx(),Ae=Ot(),$H;(function(t){function e(_,I){_=_||[],_=r(_,I);let S=I.input,R=[];for(let B=0;B0&&I[0].type.getCardinality().isComposite()&&(R=1/0,B=!0);for(let b of I){if(b.type.getCardinality().isSingular())break;S-=1}return{min:S,max:R,variadic:B}}function i(_,I,S){if(_&&_.belongsToTypesystem)return _;if(I instanceof Ae.OptionType)return s(_,I,S);if(I instanceof Ae.OptionalType)return o(_,I,S);if(I instanceof Ae.VariadicType)return a(_,I,S);if(I instanceof Ae.CompositeType)return l(_,I,S);if(I instanceof Ae.TupleType)return f(_,I,S);if(I instanceof Ae.StructType)return d(_,I,S);if(I instanceof Ae.ListType)return u(_,I,S);if(I instanceof Ae.PrimitiveType)return g(_,I,S);if(I instanceof Ae.EnumType)return E(_,I,S);S.throwError(`convertToTypedValue: unhandled type ${I}`)}function s(_,I,S){if(_==null)return Ae.OptionValue.newMissing();let R=i(_,I.getFirstTypeParameter(),S);return Ae.OptionValue.newProvided(R)}function o(_,I,S){if(_==null)return new Ae.OptionalValue(I);let R=i(_,I.getFirstTypeParameter(),S);return new Ae.OptionalValue(I,R)}function a(_,I,S){_==null&&(_=[]),_.map===void 0&&S.convertError(_,"Variadic");let R=_.map(function(B){return i(B,I.getFirstTypeParameter(),S)});return new Ae.VariadicValue(I,R)}function u(_,I,S){_.map===void 0&&S.convertError(_,"List");let R=_.map(function(B){return i(B,I.getFirstTypeParameter(),S)});return new Ae.List(I,R)}function l(_,I,S){let R=[],B=I.getTypeParameters();S.guardSameLength(_,B);for(let b=0;b{"use strict";c();Object.defineProperty(Qr,"__esModule",{value:!0});Qr.ContractCallPayloadBuilder=Qr.ContractUpgradePayloadBuilder=Qr.ContractDeployPayloadBuilder=Qr.ArwenVirtualMachine=void 0;var fw=qn(),hw=gr(),KH=Vo();Qr.ArwenVirtualMachine="0500";var uw=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(){hw.guardValueIsSet("code",this.code);let e=this.code.toString(),r=this.codeMetadata.toString(),n=`${e}@${Qr.ArwenVirtualMachine}@${r}`;return n=dw(n,this.arguments),new fw.TransactionPayload(n)}};Qr.ContractDeployPayloadBuilder=uw;var cw=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(){hw.guardValueIsSet("code",this.code);let e=this.code.toString(),r=this.codeMetadata.toString(),n=`upgradeContract@${e}@${r}`;return n=dw(n,this.arguments),new fw.TransactionPayload(n)}};Qr.ContractUpgradePayloadBuilder=cw;var lw=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(){hw.guardValueIsSet("calledFunction",this.contractFunction);let e=this.contractFunction.name;return e=dw(e,this.arguments),new fw.TransactionPayload(e)}};Qr.ContractCallPayloadBuilder=lw;function dw(t,e){let{argumentsString:r,count:n}=new KH.ArgSerializer().valuesToString(e);return n==0?t:`${t}@${r}`}});var kn=m((Tae,gw)=>{"use strict";c();var ta=typeof Reflect=="object"?Reflect:null,Mx=ta&&typeof ta.apply=="function"?ta.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},Yh;ta&&typeof ta.ownKeys=="function"?Yh=ta.ownKeys:Object.getOwnPropertySymbols?Yh=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Yh=function(e){return Object.getOwnPropertyNames(e)};function YH(t){console&&console.warn&&console.warn(t)}var qx=Number.isNaN||function(e){return e!==e};function ke(){ke.init.call(this)}gw.exports=ke;gw.exports.once=ej;ke.EventEmitter=ke;ke.prototype._events=void 0;ke.prototype._eventsCount=0;ke.prototype._maxListeners=void 0;var Ux=10;function Jh(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(ke,"defaultMaxListeners",{enumerable:!0,get:function(){return Ux},set:function(t){if(typeof t!="number"||t<0||qx(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Ux=t}});ke.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};ke.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||qx(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 Vx(t){return t._maxListeners===void 0?ke.defaultMaxListeners:t._maxListeners}ke.prototype.getMaxListeners=function(){return Vx(this)};ke.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")Mx(u,this,r);else for(var l=u.length,f=Qx(u,l),n=0;n0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,YH(a)}return t}ke.prototype.addListener=function(e,r){return Hx(this,e,r,!1)};ke.prototype.on=ke.prototype.addListener;ke.prototype.prependListener=function(e,r){return Hx(this,e,r,!0)};function JH(){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 jx(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=JH.bind(n);return i.listener=r,n.wrapFn=i,i}ke.prototype.once=function(e,r){return Jh(r),this.on(e,jx(this,e,r)),this};ke.prototype.prependOnceListener=function(e,r){return Jh(r),this.prependListener(e,jx(this,e,r)),this};ke.prototype.removeListener=function(e,r){var n,i,s,o,a;if(Jh(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():XH(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};ke.prototype.off=ke.prototype.removeListener;ke.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 Gx(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?ZH(i):Qx(i,i.length)}ke.prototype.listeners=function(e){return Gx(this,e,!0)};ke.prototype.rawListeners=function(e){return Gx(this,e,!1)};ke.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):kx.call(t,e)};ke.prototype.listenerCount=kx;function kx(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}ke.prototype.eventNames=function(){return this._eventsCount>0?Yh(this._events):[]};function Qx(t,e){for(var r=new Array(e),n=0;n{c();zx.exports=kn().EventEmitter});var mw=m(()=>{c()});var Zx=m((Bae,Xx)=>{"use strict";c();function $x(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 Kx(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 Xh.alloc(0);for(var n=Xh.allocUnsafe(r>>>0),i=this.head,s=0;i;)cj(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=Xh.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:uj,value:function(r,n){return Ew(this,Kx(Kx({},n),{},{depth:0,customInspect:!1}))}}]),t}()});var vw=m((Fae,tN)=>{"use strict";c();function lj(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(ww,this,t)):p.default.nextTick(ww,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(Zh,r):(r._writableState.errorEmitted=!0,p.default.nextTick(eN,r,s)):p.default.nextTick(eN,r,s):e?(p.default.nextTick(Zh,r),e(s)):p.default.nextTick(Zh,r)}),this)}function eN(t,e){ww(t,e),Zh(t)}function Zh(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function fj(){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 ww(t,e){t.emit("error",e)}function hj(t,e){var r=t._readableState,n=t._writableState;r&&r.autoDestroy||n&&n.autoDestroy?t.destroy(e):t.emit("error",e)}tN.exports={destroy:lj,undestroy:fj,errorOrDestroy:hj}});var Ns=m((Uae,iN)=>{"use strict";c();function dj(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var nN={};function Br(t,e,r){r||(r=Error);function n(s,o,a){return typeof e=="string"?e:e(s,o,a)}var i=function(s){dj(o,s);function o(a,u,l){return s.call(this,n(a,u,l))||this}return o}(r);i.prototype.name=r.name,i.prototype.code=t,nN[t]=i}function rN(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 pj(t,e,r){return t.substr(!r||r<0?0:+r,e.length)===e}function gj(t,e,r){return(r===void 0||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}function yj(t,e,r){return typeof r!="number"&&(r=0),r+e.length>t.length?!1:t.indexOf(e,r)!==-1}Br("ERR_INVALID_OPT_VALUE",function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'},TypeError);Br("ERR_INVALID_ARG_TYPE",function(t,e,r){var n;typeof e=="string"&&pj(e,"not ")?(n="must not be",e=e.replace(/^not /,"")):n="must be";var i;if(gj(t," argument"))i="The ".concat(t," ").concat(n," ").concat(rN(e,"type"));else{var s=yj(t,".")?"property":"argument";i='The "'.concat(t,'" ').concat(s," ").concat(n," ").concat(rN(e,"type"))}return i+=". Received type ".concat(typeof r),i},TypeError);Br("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");Br("ERR_METHOD_NOT_IMPLEMENTED",function(t){return"The "+t+" method is not implemented"});Br("ERR_STREAM_PREMATURE_CLOSE","Premature close");Br("ERR_STREAM_DESTROYED",function(t){return"Cannot call "+t+" after a stream was destroyed"});Br("ERR_MULTIPLE_CALLBACK","Callback called multiple times");Br("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");Br("ERR_STREAM_WRITE_AFTER_END","write after end");Br("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Br("ERR_UNKNOWN_ENCODING",function(t){return"Unknown encoding: "+t},TypeError);Br("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");iN.exports.codes=nN});var Aw=m((Vae,sN)=>{"use strict";c();var mj=Ns().codes.ERR_INVALID_OPT_VALUE;function Ej(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function wj(t,e,r,n){var i=Ej(e,n,r);if(i!=null){if(!(isFinite(i)&&Math.floor(i)===i)||i<0){var s=n?r:"highWaterMark";throw new mj(s,i)}return Math.floor(i)}return t.objectMode?16:16*1024}sN.exports={getHighWaterMark:wj}});var ra=m((jae,bw)=>{c();typeof Object.create=="function"?bw.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:bw.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 aN=m((kae,oN)=>{c();oN.exports=vj;function vj(t,e){if(_w("noDeprecation"))return t;var r=!1;function n(){if(!r){if(_w("throwDeprecation"))throw new Error(e);_w("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}return n}function _w(t){try{if(!global.localStorage)return!1}catch{return!1}var e=global.localStorage[t];return e==null?!1:String(e).toLowerCase()==="true"}});var Cw=m((Wae,dN)=>{"use strict";c();dN.exports=ht;function cN(t){var e=this;this.next=null,this.entry=null,this.finish=function(){zj(e,t)}}var na;ht.WritableState=pc;var Aj={deprecate:aN()},lN=yw(),td=_s().Buffer,bj=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function _j(t){return td.from(t)}function Ij(t){return td.isBuffer(t)||t instanceof bj}var Sw=vw(),Sj=Aw(),Cj=Sj.getHighWaterMark,Si=Ns().codes,Tj=Si.ERR_INVALID_ARG_TYPE,xj=Si.ERR_METHOD_NOT_IMPLEMENTED,Nj=Si.ERR_MULTIPLE_CALLBACK,Oj=Si.ERR_STREAM_CANNOT_PIPE,Dj=Si.ERR_STREAM_DESTROYED,Pj=Si.ERR_STREAM_NULL_VALUES,Rj=Si.ERR_STREAM_WRITE_AFTER_END,Bj=Si.ERR_UNKNOWN_ENCODING,ia=Sw.errorOrDestroy;ra()(ht,lN);function Lj(){}function pc(t,e,r){na=na||Os(),t=t||{},typeof r!="boolean"&&(r=e instanceof na),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=Cj(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){jj(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 cN(this)}pc.prototype.getBuffer=function(){for(var e=this.bufferedRequest,r=[];e;)r.push(e),e=e.next;return r};(function(){try{Object.defineProperty(pc.prototype,"buffer",{get:Aj.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var ed;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(ed=Function.prototype[Symbol.hasInstance],Object.defineProperty(ht,Symbol.hasInstance,{value:function(e){return ed.call(this,e)?!0:this!==ht?!1:e&&e._writableState instanceof pc}})):ed=function(e){return e instanceof this};function ht(t){na=na||Os();var e=this instanceof na;if(!e&&!ed.call(ht,this))return new ht(t);this._writableState=new pc(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)),lN.call(this)}ht.prototype.pipe=function(){ia(this,new Oj)};function Fj(t,e){var r=new Rj;ia(t,r),p.default.nextTick(e,r)}function Mj(t,e,r,n){var i;return r===null?i=new Pj:typeof r!="string"&&!e.objectMode&&(i=new Tj("chunk",["string","Buffer"],r)),i?(ia(t,i),p.default.nextTick(n,i),!1):!0}ht.prototype.write=function(t,e,r){var n=this._writableState,i=!1,s=!n.objectMode&&Ij(t);return s&&!td.isBuffer(t)&&(t=_j(t)),typeof e=="function"&&(r=e,e=null),s?e="buffer":e||(e=n.defaultEncoding),typeof r!="function"&&(r=Lj),n.ending?Fj(this,r):(s||Mj(this,n,t,r))&&(n.pendingcb++,i=qj(this,n,s,t,e,r)),i};ht.prototype.cork=function(){this._writableState.corked++};ht.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,!t.writing&&!t.corked&&!t.bufferProcessing&&t.bufferedRequest&&fN(this,t))};ht.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 Bj(e);return this._writableState.defaultEncoding=e,this};Object.defineProperty(ht.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function Uj(t,e,r){return!t.objectMode&&t.decodeStrings!==!1&&typeof e=="string"&&(e=td.from(e,r)),e}Object.defineProperty(ht.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function qj(t,e,r,n,i,s){if(!r){var o=Uj(e,n,i);n!==o&&(r=!0,i="buffer",n=o)}var a=e.objectMode?1:n.length;e.length+=a;var u=e.length{"use strict";c();var $j=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};gN.exports=wn;var pN=Nw(),xw=Cw();ra()(wn,pN);for(Tw=$j(xw.prototype),rd=0;rd{c();var id=_s(),vn=id.Buffer;function yN(t,e){for(var r in t)e[r]=t[r]}vn.from&&vn.alloc&&vn.allocUnsafe&&vn.allocUnsafeSlow?mN.exports=id:(yN(id,Ow),Ow.Buffer=Ds);function Ds(t,e,r){return vn(t,e,r)}Ds.prototype=Object.create(vn.prototype);yN(vn,Ds);Ds.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return vn(t,e,r)};Ds.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=vn(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};Ds.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return vn(t)};Ds.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return id.SlowBuffer(t)}});var Rw=m(vN=>{"use strict";c();var Pw=EN().Buffer,wN=Pw.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 Jj(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 Xj(t){var e=Jj(t);if(typeof e!="string"&&(Pw.isEncoding===wN||!wN(t)))throw new Error("Unknown encoding: "+t);return e||t}vN.StringDecoder=gc;function gc(t){this.encoding=Xj(t);var e;switch(this.encoding){case"utf16le":this.text=iG,this.end=sG,e=4;break;case"utf8":this.fillLast=tG,e=4;break;case"base64":this.text=oG,this.end=aG,e=3;break;default:this.write=uG,this.end=cG;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Pw.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 Zj(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 eG(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 tG(t){var e=this.lastTotal-this.lastNeed,r=eG(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 rG(t,e){var r=Zj(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 nG(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function iG(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 sG(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 oG(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 aG(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function uG(t){return t.toString(this.encoding)}function cG(t){return t&&t.length?this.write(t):""}});var sd=m((Zae,_N)=>{"use strict";c();var AN=Ns().codes.ERR_STREAM_PREMATURE_CLOSE;function lG(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,n=new Array(r),i=0;i{"use strict";c();var od;function Ci(t,e,r){return e=dG(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function dG(t){var e=pG(t,"string");return typeof e=="symbol"?e:String(e)}function pG(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 gG=sd(),Ti=Symbol("lastResolve"),Ps=Symbol("lastReject"),yc=Symbol("error"),ad=Symbol("ended"),Rs=Symbol("lastPromise"),Bw=Symbol("handlePromise"),Bs=Symbol("stream");function xi(t,e){return{value:t,done:e}}function yG(t){var e=t[Ti];if(e!==null){var r=t[Bs].read();r!==null&&(t[Rs]=null,t[Ti]=null,t[Ps]=null,e(xi(r,!1)))}}function mG(t){p.default.nextTick(yG,t)}function EG(t,e){return function(r,n){t.then(function(){if(e[ad]){r(xi(void 0,!0));return}e[Bw](r,n)},n)}}var wG=Object.getPrototypeOf(function(){}),vG=Object.setPrototypeOf((od={get stream(){return this[Bs]},next:function(){var e=this,r=this[yc];if(r!==null)return Promise.reject(r);if(this[ad])return Promise.resolve(xi(void 0,!0));if(this[Bs].destroyed)return new Promise(function(o,a){p.default.nextTick(function(){e[yc]?a(e[yc]):o(xi(void 0,!0))})});var n=this[Rs],i;if(n)i=new Promise(EG(n,this));else{var s=this[Bs].read();if(s!==null)return Promise.resolve(xi(s,!1));i=new Promise(this[Bw])}return this[Rs]=i,i}},Ci(od,Symbol.asyncIterator,function(){return this}),Ci(od,"return",function(){var e=this;return new Promise(function(r,n){e[Bs].destroy(null,function(i){if(i){n(i);return}r(xi(void 0,!0))})})}),od),wG),AG=function(e){var r,n=Object.create(vG,(r={},Ci(r,Bs,{value:e,writable:!0}),Ci(r,Ti,{value:null,writable:!0}),Ci(r,Ps,{value:null,writable:!0}),Ci(r,yc,{value:null,writable:!0}),Ci(r,ad,{value:e._readableState.endEmitted,writable:!0}),Ci(r,Bw,{value:function(s,o){var a=n[Bs].read();a?(n[Rs]=null,n[Ti]=null,n[Ps]=null,s(xi(a,!1))):(n[Ti]=s,n[Ps]=o)},writable:!0}),r));return n[Rs]=null,gG(e,function(i){if(i&&i.code!=="ERR_STREAM_PREMATURE_CLOSE"){var s=n[Ps];s!==null&&(n[Rs]=null,n[Ti]=null,n[Ps]=null,s(i)),n[yc]=i;return}var o=n[Ti];o!==null&&(n[Rs]=null,n[Ti]=null,n[Ps]=null,o(xi(void 0,!0))),n[ad]=!0}),e.on("readable",mG.bind(null,n)),n};IN.exports=AG});var TN=m((nue,CN)=>{c();CN.exports=function(){throw new Error("Readable.from is not available in the browser")}});var Nw=m((oue,MN)=>{"use strict";c();MN.exports=Me;var sa;Me.ReadableState=DN;var sue=kn().EventEmitter,ON=function(e,r){return e.listeners(r).length},Ec=yw(),ud=_s().Buffer,bG=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function _G(t){return ud.from(t)}function IG(t){return ud.isBuffer(t)||t instanceof bG}var Lw=mw(),xe;Lw&&Lw.debuglog?xe=Lw.debuglog("stream"):xe=function(){};var SG=Zx(),jw=vw(),CG=Aw(),TG=CG.getHighWaterMark,cd=Ns().codes,xG=cd.ERR_INVALID_ARG_TYPE,NG=cd.ERR_STREAM_PUSH_AFTER_EOF,OG=cd.ERR_METHOD_NOT_IMPLEMENTED,DG=cd.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,oa,Fw,Mw;ra()(Me,Ec);var mc=jw.errorOrDestroy,Uw=["error","close","destroy","pause","resume"];function PG(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 DN(t,e,r){sa=sa||Os(),t=t||{},typeof r!="boolean"&&(r=e instanceof sa),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=TG(this,t,"readableHighWaterMark",r),this.buffer=new SG,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&&(oa||(oa=Rw().StringDecoder),this.decoder=new oa(t.encoding),this.encoding=t.encoding)}function Me(t){if(sa=sa||Os(),!(this instanceof Me))return new Me(t);var e=this instanceof sa;this._readableState=new DN(t,this,e),this.readable=!0,t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy)),Ec.call(this)}Object.defineProperty(Me.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}});Me.prototype.destroy=jw.destroy;Me.prototype._undestroy=jw.undestroy;Me.prototype._destroy=function(t,e){e(t)};Me.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=ud.from(t,e),e=""),n=!0),PN(this,t,e,!1,n)};Me.prototype.unshift=function(t){return PN(this,t,null,!0,!1)};function PN(t,e,r,n,i){xe("readableAddChunk",e);var s=t._readableState;if(e===null)s.reading=!1,LG(t,s);else{var o;if(i||(o=RG(s,e)),o)mc(t,o);else if(s.objectMode||e&&e.length>0)if(typeof e!="string"&&!s.objectMode&&Object.getPrototypeOf(e)!==ud.prototype&&(e=_G(e)),n)s.endEmitted?mc(t,new DG):qw(t,s,e,!0);else if(s.ended)mc(t,new NG);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(e=s.decoder.write(e),s.objectMode||e.length!==0?qw(t,s,e,!1):Hw(t,s)):qw(t,s,e,!1)}else n||(s.reading=!1,Hw(t,s))}return!s.ended&&(s.length=xN?t=xN:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}function NN(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=BG(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}Me.prototype.read=function(t){xe("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(t!==0&&(e.emittedReadable=!1),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return xe("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?Vw(this):ld(this),null;if(t=NN(t,e),t===0&&e.ended)return e.length===0&&Vw(this),null;var n=e.needReadable;xe("need readable",n),(e.length===0||e.length-t0?i=LN(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&&Vw(this)),i!==null&&this.emit("data",i),i};function LG(t,e){if(xe("onEofChunk"),!e.ended){if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?ld(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,RN(t)))}}function ld(t){var e=t._readableState;xe("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(xe("emitReadable",e.flowing),e.emittedReadable=!0,p.default.nextTick(RN,t))}function RN(t){var e=t._readableState;xe("emitReadable_",e.destroyed,e.length,e.ended),!e.destroyed&&(e.length||e.ended)&&(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,Gw(t)}function Hw(t,e){e.readingMore||(e.readingMore=!0,p.default.nextTick(FG,t,e))}function FG(t,e){for(;!e.reading&&!e.ended&&(e.length1&&FN(n.pipes,t)!==-1)&&!l&&(xe("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function g(O){xe("onerror",O),N(),t.removeListener("error",g),ON(t,"error")===0&&mc(t,O)}PG(t,"error",g);function E(){t.removeListener("finish",v),N()}t.once("close",E);function v(){xe("onfinish"),t.removeListener("close",E),N()}t.once("finish",v);function N(){xe("unpipe"),r.unpipe(t)}return t.emit("pipe",r),n.flowing||(xe("pipe resume"),r.resume()),t};function MG(t){return function(){var r=t._readableState;xe("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,r.awaitDrain===0&&ON(t,"data")&&(r.flowing=!0,Gw(t))}}Me.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(e.pipesCount===0)return this;if(e.pipesCount===1)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r),this);if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var s=0;s0,n.flowing!==!1&&this.resume()):t==="readable"&&!n.endEmitted&&!n.readableListening&&(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,xe("on readable",n.length,n.reading),n.length?ld(this):n.reading||p.default.nextTick(UG,this)),r};Me.prototype.addListener=Me.prototype.on;Me.prototype.removeListener=function(t,e){var r=Ec.prototype.removeListener.call(this,t,e);return t==="readable"&&p.default.nextTick(BN,this),r};Me.prototype.removeAllListeners=function(t){var e=Ec.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&p.default.nextTick(BN,this),e};function BN(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 UG(t){xe("readable nexttick read 0"),t.read(0)}Me.prototype.resume=function(){var t=this._readableState;return t.flowing||(xe("resume"),t.flowing=!t.readableListening,qG(this,t)),t.paused=!1,this};function qG(t,e){e.resumeScheduled||(e.resumeScheduled=!0,p.default.nextTick(VG,t,e))}function VG(t,e){xe("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),Gw(t),e.flowing&&!e.reading&&t.read(0)}Me.prototype.pause=function(){return xe("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(xe("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function Gw(t){var e=t._readableState;for(xe("flow",e.flowing);e.flowing&&t.read()!==null;);}Me.prototype.wrap=function(t){var e=this,r=this._readableState,n=!1;t.on("end",function(){if(xe("wrapped end"),r.decoder&&!r.ended){var o=r.decoder.end();o&&o.length&&e.push(o)}e.push(null)}),t.on("data",function(o){if(xe("wrapped data"),r.decoder&&(o=r.decoder.write(o)),!(r.objectMode&&o==null)&&!(!r.objectMode&&(!o||!o.length))){var a=e.push(o);a||(n=!0,t.pause())}});for(var i in t)this[i]===void 0&&typeof t[i]=="function"&&(this[i]=function(a){return function(){return t[a].apply(t,arguments)}}(i));for(var s=0;s=e.length?(e.decoder?r=e.buffer.join(""):e.buffer.length===1?r=e.buffer.first():r=e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r}function Vw(t){var e=t._readableState;xe("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,p.default.nextTick(HG,e,t))}function HG(t,e){if(xe("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&t.length===0&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}typeof Symbol=="function"&&(Me.from=function(t,e){return Mw===void 0&&(Mw=TN()),Mw(Me,t,e)});function FN(t,e){for(var r=0,n=t.length;r{"use strict";c();qN.exports=Qn;var fd=Ns().codes,jG=fd.ERR_METHOD_NOT_IMPLEMENTED,GG=fd.ERR_MULTIPLE_CALLBACK,kG=fd.ERR_TRANSFORM_ALREADY_TRANSFORMING,QG=fd.ERR_TRANSFORM_WITH_LENGTH_0,hd=Os();ra()(Qn,hd);function WG(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(n===null)return this.emit("error",new GG);r.writechunk=null,r.writecb=null,e!=null&&this.push(e),n(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length{"use strict";c();HN.exports=wc;var VN=kw();ra()(wc,VN);function wc(t){if(!(this instanceof wc))return new wc(t);VN.call(this,t)}wc.prototype._transform=function(t,e,r){r(null,t)}});var zN=m((hue,WN)=>{"use strict";c();var Qw;function $G(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}var QN=Ns().codes,KG=QN.ERR_MISSING_ARGS,YG=QN.ERR_STREAM_DESTROYED;function GN(t){if(t)throw t}function JG(t){return t.setHeader&&typeof t.abort=="function"}function XG(t,e,r,n){n=$G(n);var i=!1;t.on("close",function(){i=!0}),Qw===void 0&&(Qw=sd()),Qw(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,JG(t))return t.abort();if(typeof t.destroy=="function")return t.destroy();n(o||new YG("pipe"))}}}function kN(t){t()}function ZG(t,e){return t.pipe(e)}function ek(t){return!t.length||typeof t[t.length-1]!="function"?GN:t.pop()}function tk(){for(var t=arguments.length,e=new Array(t),r=0;r0;return XG(o,u,l,function(f){i||(i=f),f&&s.forEach(kN),!u&&(s.forEach(kN),n(i))})});return e.reduce(ZG)}WN.exports=tk});var Ww=m((Lr,$N)=>{c();Lr=$N.exports=Nw();Lr.Stream=Lr;Lr.Readable=Lr;Lr.Writable=Cw();Lr.Duplex=Os();Lr.Transform=kw();Lr.PassThrough=jN();Lr.finished=sd();Lr.pipeline=zN()});var JN=m((gue,YN)=>{c();var{Transform:rk}=Ww();YN.exports=t=>class KN extends rk{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 KN(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}}});var eO=m((mue,ZN)=>{c();var{Transform:nk}=Ww();ZN.exports=t=>class XN extends nk{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 XN(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}}});var rO=m((wue,tO)=>{c();var ik=JN(),sk=eO();tO.exports=function(t){let e=ik(t),r=sk(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 sO=m(iO=>{c();var nO=[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];iO.p1600=function(t){for(let e=0;e<24;++e){let r=t[0]^t[10]^t[20]^t[30]^t[40],n=t[1]^t[11]^t[21]^t[31]^t[41],i=t[2]^t[12]^t[22]^t[32]^t[42],s=t[3]^t[13]^t[23]^t[33]^t[43],o=t[4]^t[14]^t[24]^t[34]^t[44],a=t[5]^t[15]^t[25]^t[35]^t[45],u=t[6]^t[16]^t[26]^t[36]^t[46],l=t[7]^t[17]^t[27]^t[37]^t[47],f=t[8]^t[18]^t[28]^t[38]^t[48],d=t[9]^t[19]^t[29]^t[39]^t[49],g=f^(i<<1|s>>>31),E=d^(s<<1|i>>>31),v=t[0]^g,N=t[1]^E,O=t[10]^g,F=t[11]^E,_=t[20]^g,I=t[21]^E,S=t[30]^g,R=t[31]^E,B=t[40]^g,b=t[41]^E;g=r^(o<<1|a>>>31),E=n^(a<<1|o>>>31);let C=t[2]^g,L=t[3]^E,X=t[12]^g,W=t[13]^E,j=t[22]^g,G=t[23]^E,K=t[32]^g,de=t[33]^E,ue=t[42]^g,re=t[43]^E;g=i^(u<<1|l>>>31),E=s^(l<<1|u>>>31);let Y=t[4]^g,se=t[5]^E,te=t[14]^g,ie=t[15]^E,q=t[24]^g,le=t[25]^E,ae=t[34]^g,fe=t[35]^E,oe=t[44]^g,ce=t[45]^E;g=o^(f<<1|d>>>31),E=a^(d<<1|f>>>31);let y=t[6]^g,w=t[7]^E,A=t[16]^g,P=t[17]^E,T=t[26]^g,D=t[27]^E,M=t[36]^g,x=t[37]^E,U=t[46]^g,H=t[47]^E;g=u^(r<<1|n>>>31),E=l^(n<<1|r>>>31);let V=t[8]^g,Z=t[9]^E,Ee=t[18]^g,ve=t[19]^E,Pe=t[28]^g,Ze=t[29]^E,lt=t[38]^g,Oe=t[39]^E,Ue=t[48]^g,xt=t[49]^E,ui=v,cs=N,ls=F<<4|O>>>28,nr=O<<4|F>>>28,Bn=_<<3|I>>>29,Wt=I<<3|_>>>29,Nt=R<<9|S>>>23,ze=S<<9|R>>>23,Sy=B<<18|b>>>14,Cy=b<<18|B>>>14,Ty=C<<1|L>>>31,xy=L<<1|C>>>31,Ny=W<<12|X>>>20,Oy=X<<12|W>>>20,Dy=j<<10|G>>>22,Py=G<<10|j>>>22,Ry=de<<13|K>>>19,By=K<<13|de>>>19,Ly=ue<<2|re>>>30,Fy=re<<2|ue>>>30,My=se<<30|Y>>>2,Uy=Y<<30|se>>>2,qy=te<<6|ie>>>26,Vy=ie<<6|te>>>26,Hy=le<<11|q>>>21,jy=q<<11|le>>>21,Gy=ae<<15|fe>>>17,ky=fe<<15|ae>>>17,Qy=ce<<29|oe>>>3,Wy=oe<<29|ce>>>3,zy=y<<28|w>>>4,$y=w<<28|y>>>4,Ky=P<<23|A>>>9,Yy=A<<23|P>>>9,Jy=T<<25|D>>>7,Xy=D<<25|T>>>7,Zy=M<<21|x>>>11,e0=x<<21|M>>>11,t0=H<<24|U>>>8,r0=U<<24|H>>>8,n0=V<<27|Z>>>5,i0=Z<<27|V>>>5,s0=Ee<<20|ve>>>12,o0=ve<<20|Ee>>>12,a0=Ze<<7|Pe>>>25,u0=Pe<<7|Ze>>>25,c0=lt<<8|Oe>>>24,l0=Oe<<8|lt>>>24,f0=Ue<<14|xt>>>18,h0=xt<<14|Ue>>>18;t[0]=ui^~Ny&Hy,t[1]=cs^~Oy&jy,t[10]=zy^~s0&Bn,t[11]=$y^~o0&Wt,t[20]=Ty^~qy&Jy,t[21]=xy^~Vy&Xy,t[30]=n0^~ls&Dy,t[31]=i0^~nr&Py,t[40]=My^~Ky&a0,t[41]=Uy^~Yy&u0,t[2]=Ny^~Hy&Zy,t[3]=Oy^~jy&e0,t[12]=s0^~Bn&Ry,t[13]=o0^~Wt&By,t[22]=qy^~Jy&c0,t[23]=Vy^~Xy&l0,t[32]=ls^~Dy&Gy,t[33]=nr^~Py&ky,t[42]=Ky^~a0&Nt,t[43]=Yy^~u0&ze,t[4]=Hy^~Zy&f0,t[5]=jy^~e0&h0,t[14]=Bn^~Ry&Qy,t[15]=Wt^~By&Wy,t[24]=Jy^~c0&Sy,t[25]=Xy^~l0&Cy,t[34]=Dy^~Gy&t0,t[35]=Py^~ky&r0,t[44]=a0^~Nt&Ly,t[45]=u0^~ze&Fy,t[6]=Zy^~f0&ui,t[7]=e0^~h0&cs,t[16]=Ry^~Qy&zy,t[17]=By^~Wy&$y,t[26]=c0^~Sy&Ty,t[27]=l0^~Cy&xy,t[36]=Gy^~t0&n0,t[37]=ky^~r0&i0,t[46]=Nt^~Ly&My,t[47]=ze^~Fy&Uy,t[8]=f0^~ui&Ny,t[9]=h0^~cs&Oy,t[18]=Qy^~zy&s0,t[19]=Wy^~$y&o0,t[28]=Sy^~Ty&qy,t[29]=Cy^~xy&Vy,t[38]=t0^~n0&ls,t[39]=r0^~i0&nr,t[48]=Ly^~My&Ky,t[49]=Fy^~Uy&Yy,t[0]^=nO[e*2],t[1]^=nO[e*2+1]}}});var aO=m((_ue,oO)=>{c();var dd=sO();function aa(){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}aa.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};aa.prototype.absorb=function(t){for(let e=0;e>>8*(this.count%4)&255,this.count+=1,this.count===this.blockSize&&(dd.p1600(this.state),this.count=0);return e};aa.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};oO.exports=aa});var zw=m((Sue,uO)=>{c();uO.exports=rO()(aO())});var Jw=m(ua=>{"use strict";c();var ok=ua&&ua.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ua,"__esModule",{value:!0});ua.SmartContract=void 0;var ak=ok(jt()),vc=yt(),$w=Ch(),uk=Be(),Kw=yn(),ck=gr(),lk=tc(),cO=YE(),lO=fc(),fO=sw(),fk=aw(),hk=hc(),pd=pw(),dk=zw(),Yw=class{constructor(e={}){this.address=new vc.Address,this.methodsExplicit={},this.methods={},this.address=e.address||new vc.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 lO.ContractFunction(i);return new fO.Interaction(e,o,s||[])},this.methods[i]=function(s){let o=new lO.ContractFunction(i),a=fk.NativeSerializer.nativeToTypedValues(s||[],n);return new fO.Interaction(e,o,a||[])}}}setAddress(e){this.address=e}getAddress(){return this.address}getAbi(){return ck.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}){$w.Compatibility.guardAddressIsSetAndNonZero(e,"'deployer' of SmartContract.deploy()","pass the actual address to deploy()"),n=n||new cO.CodeMetadata,i=i||[],s=s||0;let l=new pd.ContractDeployPayloadBuilder().setCode(r).setCodeMetadata(n).setInitArgs(i).build();return new Kw.Transaction({receiver:vc.Address.Zero(),sender:e,value:s,gasLimit:o,gasPrice:a,data:l,chainID:u})}upgrade({caller:e,code:r,codeMetadata:n,initArguments:i,value:s,gasLimit:o,gasPrice:a,chainID:u}){$w.Compatibility.guardAddressIsSetAndNonZero(e,"'caller' of SmartContract.upgrade()","pass the actual address to upgrade()"),this.ensureHasAddress(),n=n||new cO.CodeMetadata,i=i||[],s=s||0;let l=new pd.ContractUpgradePayloadBuilder().setCode(r).setCodeMetadata(n).setInitArgs(i).build();return new Kw.Transaction({sender:e,receiver:this.getAddress(),value:s,gasLimit:o,gasPrice:a,data:l,chainID:u})}call({func:e,args:r,value:n,gasLimit:i,receiver:s,gasPrice:o,chainID:a,caller:u}){$w.Compatibility.guardAddressIsSetAndNonZero(u,"'caller' of SmartContract.call()","pass the actual address to call()"),this.ensureHasAddress(),r=r||[],n=n||0;let l=new pd.ContractCallPayloadBuilder().setFunction(e).setArgs(r).build();return new Kw.Transaction({sender:u,receiver:s||this.getAddress(),value:n,gasLimit:i,gasPrice:o,data:l,chainID:a})}createQuery({func:e,args:r,value:n,caller:i}){return this.ensureHasAddress(),new hk.Query({address:this.getAddress(),func:e,args:r,value:n,caller:i})}ensureHasAddress(){if(!this.getAddress().bech32())throw new uk.ErrContractHasNoAddress}static computeAddress(e,r){let n=h.Buffer.alloc(8,0),i=new vc.Address(e.bech32()).pubkey(),s=i.slice(30),o=h.Buffer.alloc(8),a=new ak.default(r.valueOf().toString(10)),u=lk.bigIntToBuffer(a);o.write(u.reverse().toString("hex"),"hex");let l=h.Buffer.concat([i,o]),f=dk("keccak256").update(l).digest(),d=h.Buffer.from(pd.ArwenVirtualMachine,"hex"),g=h.Buffer.concat([n,d,f.slice(10,30),s]);return new vc.Address(g)}};ua.SmartContract=Yw});var hO=m(Ni=>{"use strict";c();Object.defineProperty(Ni,"__esModule",{value:!0});Ni.ErrAccountNotConnected=Ni.ErrCannotSignSingleTransaction=Ni.Err=void 0;var Ac=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};Ni.Err=Ac;var Xw=class extends Ac{constructor(){super("Cannot sign single transaction.")}};Ni.ErrCannotSignSingleTransaction=Xw;var Zw=class extends Ac{constructor(){super("Account is not connected.")}};Ni.ErrAccountNotConnected=Zw});var dO=m(bc=>{"use strict";c();Object.defineProperty(bc,"__esModule",{value:!0});bc.Operation=void 0;var pk;(function(t){t.Connect="connect",t.Logout="logout",t.SignTransactions="signTransactions",t.SignMessage="signMessage",t.CancelAction="cancelAction"})(pk=bc.Operation||(bc.Operation={}))});var ev=m(ca=>{"use strict";c();var Oi=ca&&ca.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(ca,"__esModule",{value:!0});ca.ExtensionProvider=void 0;var gk=yn(),pO=hO(),_c=dO(),Ic=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 Oi(this,void 0,void 0,function*(){return window&&window.elrondWallet&&(this.initialized=!0),this.initialized})}login(e={}){return Oi(this,void 0,void 0,function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");let{token:r}=e,n=r||"";return yield this.startBgrMsgChannel(_c.Operation.Connect,n),this.account.address})}logout(){return Oi(this,void 0,void 0,function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");try{yield this.startBgrMsgChannel(_c.Operation.Logout,this.account.address),this.disconnect()}catch(e){console.warn("Extension origin url is already cleared!",e)}return!0})}disconnect(){this.account={address:""}}getAddress(){return Oi(this,void 0,void 0,function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");return this.account?this.account.address:""})}isInitialized(){return this.initialized}isConnected(){return Oi(this,void 0,void 0,function*(){return!!this.account.address})}signTransaction(e){return Oi(this,void 0,void 0,function*(){this.ensureConnected();let r=yield this.signTransactions([e]);if(r.length!=1)throw new pO.ErrCannotSignSingleTransaction;return r[0]})}ensureConnected(){if(!this.account.address)throw new pO.ErrAccountNotConnected}signTransactions(e){return Oi(this,void 0,void 0,function*(){this.ensureConnected();let r=yield this.startBgrMsgChannel(_c.Operation.SignTransactions,{from:this.account.address,transactions:e.map(n=>n.toPlainObject())});try{return r.map(i=>gk.Transaction.fromPlainObject(i))}catch(n){throw new Error(`Transaction canceled: ${n.message}.`)}})}signMessage(e){return Oi(this,void 0,void 0,function*(){this.ensureConnected();let r={account:this.account.address,message:e.message.toString()},i=(yield this.startBgrMsgChannel(_c.Operation.SignMessage,r)).signature,s=h.Buffer.from(i,"hex");return e.applySignature(s),e})}cancelAction(){return this.startBgrMsgChannel(_c.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)})}};ca.ExtensionProvider=Ic;Ic._instance=new Ic});var yr={};ft(yr,{__assign:()=>rv,__asyncDelegator:()=>xk,__asyncGenerator:()=>Tk,__asyncValues:()=>Nk,__await:()=>Sc,__awaiter:()=>Ak,__classPrivateFieldGet:()=>Rk,__classPrivateFieldSet:()=>Bk,__createBinding:()=>_k,__decorate:()=>Ek,__exportStar:()=>Ik,__extends:()=>yk,__generator:()=>bk,__importDefault:()=>Pk,__importStar:()=>Dk,__makeTemplateObject:()=>Ok,__metadata:()=>vk,__param:()=>wk,__read:()=>wO,__rest:()=>mk,__spread:()=>Sk,__spreadArrays:()=>Ck,__values:()=>nv});function yk(t,e){tv(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function mk(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 wk(t,e){return function(r,n){e(r,n,t)}}function vk(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function Ak(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})}function bk(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(f){return u([l,f])}}function u(l){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=l[0]&2?i.return:l[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,l[1])).done)return s;switch(i=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,i=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function wO(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 Sk(){for(var t=[],e=0;e1||a(g,E)})})}function a(g,E){try{u(n[g](E))}catch(v){d(s[0][3],v)}}function u(g){g.value instanceof Sc?Promise.resolve(g.value.v).then(l,f):d(s[0][2],g)}function l(g){a("next",g)}function f(g){a("throw",g)}function d(g,E){g(E),s.shift(),s.length&&a(s[0][0],s[0][1])}}function xk(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:Sc(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function Nk(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 nv=="function"?nv(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(a,u){o=t[s](o),i(a,u,o.done,o.value)})}}function i(s,o,a,u){Promise.resolve(u).then(function(l){s({value:l,done:a})},o)}}function Ok(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function Dk(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 Pk(t){return t&&t.__esModule?t:{default:t}}function Rk(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function Bk(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 tv,rv,mr=ge(()=>{c();tv=function(t,e){return tv=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])},tv(t,e)};rv=function(){return rv=Object.assign||function(e){for(var r,n=1,i=arguments.length;n{"use strict";c();Object.defineProperty(wd,"__esModule",{value:!0});function Lk(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return JSON.parse(t)}catch{return t}}wd.safeJsonParse=Lk;function Fk(t){return typeof t=="string"?t:JSON.stringify(t,(e,r)=>typeof r>"u"?null:r)}wd.safeJsonStringify=Fk});var vO=m((Wue,vd)=>{"use strict";c();(function(){"use strict";let t;function e(){}t=e,t.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},t.prototype.setItem=function(r,n){this[r]=String(n)},t.prototype.removeItem=function(r){delete this[r]},t.prototype.clear=function(){let r=this;Object.keys(r).forEach(function(n){r[n]=void 0,delete r[n]})},t.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof global<"u"&&global.localStorage?vd.exports=global.localStorage:typeof window<"u"&&window.localStorage?vd.exports=window.localStorage:vd.exports=new e})()});var AO=m(Ad=>{"use strict";c();Object.defineProperty(Ad,"__esModule",{value:!0});Ad.IKeyValueStorage=void 0;var sv=class{};Ad.IKeyValueStorage=sv});var bO=m(bd=>{"use strict";c();Object.defineProperty(bd,"__esModule",{value:!0});bd.parseEntry=void 0;var Mk=iv();function Uk(t){var e;return[t[0],Mk.safeJsonParse((e=t[1])!==null&&e!==void 0?e:"")]}bd.parseEntry=Uk});var IO=m(_d=>{"use strict";c();Object.defineProperty(_d,"__esModule",{value:!0});var _O=(mr(),ut(yr));_O.__exportStar(AO(),_d);_O.__exportStar(bO(),_d)});var CO=m(Cc=>{"use strict";c();Object.defineProperty(Cc,"__esModule",{value:!0});Cc.KeyValueStorage=void 0;var la=(mr(),ut(yr)),SO=iv(),qk=la.__importDefault(vO()),Vk=IO(),Id=class{constructor(){this.localStorage=qk.default}getKeys(){return la.__awaiter(this,void 0,void 0,function*(){return Object.keys(this.localStorage)})}getEntries(){return la.__awaiter(this,void 0,void 0,function*(){return Object.entries(this.localStorage).map(Vk.parseEntry)})}getItem(e){return la.__awaiter(this,void 0,void 0,function*(){let r=this.localStorage.getItem(e);if(r!==null)return SO.safeJsonParse(r)})}setItem(e,r){return la.__awaiter(this,void 0,void 0,function*(){this.localStorage.setItem(e,SO.safeJsonStringify(r))})}removeItem(e){return la.__awaiter(this,void 0,void 0,function*(){this.localStorage.removeItem(e)})}};Cc.KeyValueStorage=Id;Cc.default=Id});var TO=m(Sd=>{"use strict";c();Object.defineProperty(Sd,"__esModule",{value:!0});Sd.delay=void 0;function Hk(t){return new Promise(e=>{setTimeout(()=>{e(!0)},t)})}Sd.delay=Hk});var xO=m(fa=>{"use strict";c();Object.defineProperty(fa,"__esModule",{value:!0});fa.ONE_THOUSAND=fa.ONE_HUNDRED=void 0;fa.ONE_HUNDRED=100;fa.ONE_THOUSAND=1e3});var NO=m(he=>{"use strict";c();Object.defineProperty(he,"__esModule",{value:!0});he.ONE_YEAR=he.FOUR_WEEKS=he.THREE_WEEKS=he.TWO_WEEKS=he.ONE_WEEK=he.THIRTY_DAYS=he.SEVEN_DAYS=he.FIVE_DAYS=he.THREE_DAYS=he.ONE_DAY=he.TWENTY_FOUR_HOURS=he.TWELVE_HOURS=he.SIX_HOURS=he.THREE_HOURS=he.ONE_HOUR=he.SIXTY_MINUTES=he.THIRTY_MINUTES=he.TEN_MINUTES=he.FIVE_MINUTES=he.ONE_MINUTE=he.SIXTY_SECONDS=he.THIRTY_SECONDS=he.TEN_SECONDS=he.FIVE_SECONDS=he.ONE_SECOND=void 0;he.ONE_SECOND=1;he.FIVE_SECONDS=5;he.TEN_SECONDS=10;he.THIRTY_SECONDS=30;he.SIXTY_SECONDS=60;he.ONE_MINUTE=he.SIXTY_SECONDS;he.FIVE_MINUTES=he.ONE_MINUTE*5;he.TEN_MINUTES=he.ONE_MINUTE*10;he.THIRTY_MINUTES=he.ONE_MINUTE*30;he.SIXTY_MINUTES=he.ONE_MINUTE*60;he.ONE_HOUR=he.SIXTY_MINUTES;he.THREE_HOURS=he.ONE_HOUR*3;he.SIX_HOURS=he.ONE_HOUR*6;he.TWELVE_HOURS=he.ONE_HOUR*12;he.TWENTY_FOUR_HOURS=he.ONE_HOUR*24;he.ONE_DAY=he.TWENTY_FOUR_HOURS;he.THREE_DAYS=he.ONE_DAY*3;he.FIVE_DAYS=he.ONE_DAY*5;he.SEVEN_DAYS=he.ONE_DAY*7;he.THIRTY_DAYS=he.ONE_DAY*30;he.ONE_WEEK=he.SEVEN_DAYS;he.TWO_WEEKS=he.ONE_WEEK*2;he.THREE_WEEKS=he.ONE_WEEK*3;he.FOUR_WEEKS=he.ONE_WEEK*4;he.ONE_YEAR=he.ONE_DAY*365});var ov=m(Cd=>{"use strict";c();Object.defineProperty(Cd,"__esModule",{value:!0});var OO=(mr(),ut(yr));OO.__exportStar(xO(),Cd);OO.__exportStar(NO(),Cd)});var PO=m(ha=>{"use strict";c();Object.defineProperty(ha,"__esModule",{value:!0});ha.fromMiliseconds=ha.toMiliseconds=void 0;var DO=ov();function jk(t){return t*DO.ONE_THOUSAND}ha.toMiliseconds=jk;function Gk(t){return Math.floor(t/DO.ONE_THOUSAND)}ha.fromMiliseconds=Gk});var BO=m(Td=>{"use strict";c();Object.defineProperty(Td,"__esModule",{value:!0});var RO=(mr(),ut(yr));RO.__exportStar(TO(),Td);RO.__exportStar(PO(),Td)});var LO=m(Tc=>{"use strict";c();Object.defineProperty(Tc,"__esModule",{value:!0});Tc.Watch=void 0;var xd=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}};Tc.Watch=xd;Tc.default=xd});var FO=m(Nd=>{"use strict";c();Object.defineProperty(Nd,"__esModule",{value:!0});Nd.IWatch=void 0;var av=class{};Nd.IWatch=av});var MO=m(uv=>{"use strict";c();Object.defineProperty(uv,"__esModule",{value:!0});var kk=(mr(),ut(yr));kk.__exportStar(FO(),uv)});var Ls=m(da=>{"use strict";c();Object.defineProperty(da,"__esModule",{value:!0});var Od=(mr(),ut(yr));Od.__exportStar(BO(),da);Od.__exportStar(LO(),da);Od.__exportStar(MO(),da);Od.__exportStar(ov(),da)});var cv,UO=ge(()=>{c();cv=class{}});var lv={};ft(lv,{IEvents:()=>cv});var fv=ge(()=>{c();UO()});var qO=m(Dd=>{"use strict";c();Object.defineProperty(Dd,"__esModule",{value:!0});Dd.IHeartBeat=void 0;var Qk=(fv(),ut(lv)),hv=class extends Qk.IEvents{constructor(e){super()}};Dd.IHeartBeat=hv});var pv=m(dv=>{"use strict";c();Object.defineProperty(dv,"__esModule",{value:!0});var Wk=(mr(),ut(yr));Wk.__exportStar(qO(),dv)});var VO=m(pa=>{"use strict";c();Object.defineProperty(pa,"__esModule",{value:!0});pa.HEARTBEAT_EVENTS=pa.HEARTBEAT_INTERVAL=void 0;var zk=Ls();pa.HEARTBEAT_INTERVAL=zk.FIVE_SECONDS;pa.HEARTBEAT_EVENTS={pulse:"heartbeat_pulse"}});var yv=m(gv=>{"use strict";c();Object.defineProperty(gv,"__esModule",{value:!0});var $k=(mr(),ut(yr));$k.__exportStar(VO(),gv)});var HO=m(Pd=>{"use strict";c();Object.defineProperty(Pd,"__esModule",{value:!0});Pd.HeartBeat=void 0;var mv=(mr(),ut(yr)),Kk=kn(),Yk=Ls(),Jk=pv(),Ev=yv(),wv=class t extends Jk.IHeartBeat{constructor(e){super(e),this.events=new Kk.EventEmitter,this.interval=Ev.HEARTBEAT_INTERVAL,this.interval=e?.interval||Ev.HEARTBEAT_INTERVAL}static init(e){return mv.__awaiter(this,void 0,void 0,function*(){let r=new t(e);return yield r.init(),r})}init(){return mv.__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 mv.__awaiter(this,void 0,void 0,function*(){this.intervalRef=setInterval(()=>this.pulse(),Yk.toMiliseconds(this.interval))})}pulse(){this.events.emit(Ev.HEARTBEAT_EVENTS.pulse)}};Pd.HeartBeat=wv});var jO=m(xc=>{"use strict";c();Object.defineProperty(xc,"__esModule",{value:!0});var vv=(mr(),ut(yr));vv.__exportStar(HO(),xc);vv.__exportStar(pv(),xc);vv.__exportStar(yv(),xc)});var kO=m((Uce,GO)=>{"use strict";c();function Xk(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}GO.exports=Zk;function Zk(t,e,r){var n=r&&r.stringify||Xk,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(E+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=E+2,E++;break}l+=n(e[f]),d=E+2,E++;break;case 115:if(f>=u)break;d{"use strict";c();var QO=kO();$O.exports=bn;var Nc=c7().console||{},e7={mapHttpRequest:Rd,mapHttpResponse:Rd,wrapRequestSerializer:Av,wrapResponseSerializer:Av,wrapErrorSerializer:Av,req:Rd,res:Rd,err:s7};function t7(t,e){return Array.isArray(t)?t.filter(function(n){return n!=="!stdSerializers.err"}):t===!0?Object.keys(e):!1}function bn(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||Nc;t.browser.write&&(t.browser.asObject=!0);let n=t.serializers||{},i=t7(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=Oc),Object.defineProperty(u,"levelVal",{get:f}),Object.defineProperty(u,"level",{get:d,set:g});let l={transmit:e,serialize:i,asObject:t.browser.asObject,levels:o,timestamp:o7(t)};u.levels=bn.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=Oc,u.serializers=n,u._serialize=i,u._stdErrSerialize=s,u.child=E,e&&(u._logEvent=bv());function f(){return this.level==="silent"?1/0:this.levels.values[this.level]}function d(){return this._level}function g(v){if(v!=="silent"&&!this.levels.values[v])throw Error("unknown level "+v);this._level=v,ga(l,u,"error","log"),ga(l,u,"fatal","error"),ga(l,u,"warn","error"),ga(l,u,"info","log"),ga(l,u,"debug","log"),ga(l,u,"trace","log")}function E(v,N){if(!v)throw new Error("missing bindings for child Pino");N=N||{},i&&v.serializers&&(N.serializers=v.serializers);let O=N.serializers;if(i&&O){var F=Object.assign({},n,O),_=t.browser.serialize===!0?Object.keys(F):i;delete v.serializers,Bd([v],_,F,this._stdErrSerialize)}function I(S){this._childLevel=(S._childLevel|0)+1,this.error=ya(S,v,"error"),this.fatal=ya(S,v,"fatal"),this.warn=ya(S,v,"warn"),this.info=ya(S,v,"info"),this.debug=ya(S,v,"debug"),this.trace=ya(S,v,"trace"),F&&(this.serializers=F,this._serialize=_),e&&(this._logEvent=bv([].concat(S._logEvent.bindings,v)))}return I.prototype=this,new I(this)}return u}bn.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"}};bn.stdSerializers=e7;bn.stdTimeFunctions=Object.assign({},{nullTime:WO,epochTime:zO,unixTime:a7,isoTime:u7});function ga(t,e,r,n){let i=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?Oc:i[r]?i[r]:Nc[r]||Nc[n]||Oc,r7(t,e,r)}function r7(t,e,r){!t.transmit&&e[r]===Oc||(e[r]=function(n){return function(){let s=t.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Nc?Nc:this;for(var u=0;u-1&&s in r&&(t[i][s]=r[s](t[i][s]))}function ya(t,e,r){return function(){let n=new Array(1+arguments.length);n[0]=e;for(var i=1;i{"use strict";c();Object.defineProperty(ma,"__esModule",{value:!0});ma.PINO_CUSTOM_CONTEXT_KEY=ma.PINO_LOGGER_DEFAULTS=void 0;ma.PINO_LOGGER_DEFAULTS={level:"info"};ma.PINO_CUSTOM_CONTEXT_KEY="custom_context"});var e2=m(fr=>{"use strict";c();Object.defineProperty(fr,"__esModule",{value:!0});fr.generateChildLogger=fr.formatChildLoggerContext=fr.getLoggerContext=fr.setBrowserLoggerContext=fr.getBrowserLoggerContext=fr.getDefaultLoggerOptions=void 0;var Ea=_v();function l7(t){return Object.assign(Object.assign({},t),{level:t?.level||Ea.PINO_LOGGER_DEFAULTS.level})}fr.getDefaultLoggerOptions=l7;function YO(t,e=Ea.PINO_CUSTOM_CONTEXT_KEY){return t[e]||""}fr.getBrowserLoggerContext=YO;function JO(t,e,r=Ea.PINO_CUSTOM_CONTEXT_KEY){return t[r]=e,t}fr.setBrowserLoggerContext=JO;function XO(t,e=Ea.PINO_CUSTOM_CONTEXT_KEY){let r="";return typeof t.bindings>"u"?r=YO(t,e):r=t.bindings().context||"",r}fr.getLoggerContext=XO;function ZO(t,e,r=Ea.PINO_CUSTOM_CONTEXT_KEY){let n=XO(t,r);return n.trim()?`${n}/${e}`:e}fr.formatChildLoggerContext=ZO;function f7(t,e,r=Ea.PINO_CUSTOM_CONTEXT_KEY){let n=ZO(t,e,r),i=t.child({context:n});return JO(i,n,r)}fr.generateChildLogger=f7});var Sv=m(wa=>{"use strict";c();Object.defineProperty(wa,"__esModule",{value:!0});wa.pino=void 0;var Iv=(mr(),ut(yr)),h7=Iv.__importDefault(KO());Object.defineProperty(wa,"pino",{enumerable:!0,get:function(){return h7.default}});Iv.__exportStar(_v(),wa);Iv.__exportStar(e2(),wa)});var Gv=m(Dt=>{"use strict";c();Object.defineProperty(Dt,"__esModule",{value:!0});var va=(fv(),ut(lv)),t2=kn();function d7(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var p7=d7(t2),Cv=class extends va.IEvents{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},Tv=class{constructor(e,r,n){this.core=e,this.logger=r}},xv=class extends va.IEvents{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}},Nv=class{constructor(e,r){this.logger=e,this.core=r}},Ov=class extends va.IEvents{constructor(e,r){super(),this.relayer=e,this.logger=r}},Dv=class extends va.IEvents{constructor(e){super()}},Pv=class{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}},Rv=class{constructor(){this.map=new Map}},Bv=class extends va.IEvents{constructor(e,r){super(),this.relayer=e,this.logger=r}},Lv=class{constructor(e,r){this.core=e,this.logger=r}},Fv=class extends va.IEvents{constructor(e,r){super(),this.core=e,this.logger=r}},Mv=class{constructor(e,r){this.logger=e,this.core=r}},Uv=class{constructor(e,r){this.projectId=e,this.logger=r}},qv=class extends p7.default{constructor(){super()}},Vv=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},Hv=class extends t2.EventEmitter{constructor(){super()}},jv=class{constructor(e){this.client=e}};Dt.ICore=Cv,Dt.ICrypto=Tv,Dt.IEngine=jv,Dt.IEngineEvents=Hv,Dt.IExpirer=Fv,Dt.IJsonRpcHistory=xv,Dt.IKeyChain=Lv,Dt.IMessageTracker=Nv,Dt.IPairing=Mv,Dt.IPublisher=Ov,Dt.IRelayer=Dv,Dt.ISignClient=Vv,Dt.ISignClientEvents=qv,Dt.IStore=Pv,Dt.ISubscriber=Bv,Dt.ISubscriberTopicMap=Rv,Dt.IVerify=Uv});var r2={};ft(r2,{safeJsonParse:()=>Dc,safeJsonStringify:()=>Pc});function Dc(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return y7(t)}catch{return t}}function Pc(t){return typeof t=="string"?t:g7(t)||""}var g7,y7,Ld=ge(()=>{c();g7=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),y7=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 i2=m(Fd=>{"use strict";c();Object.defineProperty(Fd,"__esModule",{value:!0});Fd.BrowserRandomSource=void 0;var n2=65536,kv=class{constructor(){this.isAvailable=!1,this.isInstantiated=!1;let e=typeof self<"u"?self.crypto||self.msCrypto:null;e&&e.getRandomValues!==void 0&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");let r=new Uint8Array(e);for(let n=0;n{"use strict";c();Object.defineProperty(Qv,"__esModule",{value:!0});function m7(t){for(var e=0;e{c()});var o2=m(Md=>{"use strict";c();Object.defineProperty(Md,"__esModule",{value:!0});Md.NodeRandomSource=void 0;var E7=Fr(),Wv=class{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof xI<"u"){let e=s2();e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let r=this._crypto.randomBytes(e);if(r.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");let n=new Uint8Array(e);for(let i=0;i{"use strict";c();Object.defineProperty(Ud,"__esModule",{value:!0});Ud.SystemRandomSource=void 0;var w7=i2(),v7=o2(),zv=class{constructor(){if(this.isAvailable=!1,this.name="",this._source=new w7.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new v7.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)}};Ud.SystemRandomSource=zv});var u2=m(Er=>{"use strict";c();Object.defineProperty(Er,"__esModule",{value:!0});function A7(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}Er.mul=Math.imul||A7;function b7(t,e){return t+e|0}Er.add=b7;function _7(t,e){return t-e|0}Er.sub=_7;function I7(t,e){return t<>>32-e}Er.rotl=I7;function S7(t,e){return t<<32-e|t>>>e}Er.rotr=S7;function C7(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t}Er.isInteger=Number.isInteger||C7;Er.MAX_SAFE_INTEGER=9007199254740991;Er.isSafeInteger=function(t){return Er.isInteger(t)&&t>=-Er.MAX_SAFE_INTEGER&&t<=Er.MAX_SAFE_INTEGER}});var Aa=m(Ne=>{"use strict";c();Object.defineProperty(Ne,"__esModule",{value:!0});var c2=u2();function T7(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}Ne.readInt16BE=T7;function x7(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}Ne.readUint16BE=x7;function N7(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}Ne.readInt16LE=N7;function O7(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}Ne.readUint16LE=O7;function l2(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}Ne.writeUint16BE=l2;Ne.writeInt16BE=l2;function f2(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}Ne.writeUint16LE=f2;Ne.writeInt16LE=f2;function $v(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}Ne.readInt32BE=$v;function Kv(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}Ne.readUint32BE=Kv;function Yv(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}Ne.readInt32LE=Yv;function Jv(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}Ne.readUint32LE=Jv;function qd(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}Ne.writeUint32BE=qd;Ne.writeInt32BE=qd;function Vd(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}Ne.writeUint32LE=Vd;Ne.writeInt32LE=Vd;function D7(t,e){e===void 0&&(e=0);var r=$v(t,e),n=$v(t,e+4);return r*4294967296+n-(n>>31)*4294967296}Ne.readInt64BE=D7;function P7(t,e){e===void 0&&(e=0);var r=Kv(t,e),n=Kv(t,e+4);return r*4294967296+n}Ne.readUint64BE=P7;function R7(t,e){e===void 0&&(e=0);var r=Yv(t,e),n=Yv(t,e+4);return n*4294967296+r-(r>>31)*4294967296}Ne.readInt64LE=R7;function B7(t,e){e===void 0&&(e=0);var r=Jv(t,e),n=Jv(t,e+4);return n*4294967296+r}Ne.readUint64LE=B7;function h2(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),qd(t/4294967296>>>0,e,r),qd(t>>>0,e,r+4),e}Ne.writeUint64BE=h2;Ne.writeInt64BE=h2;function d2(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),Vd(t>>>0,e,r),Vd(t/4294967296>>>0,e,r+4),e}Ne.writeUint64LE=d2;Ne.writeInt64LE=d2;function L7(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,s=t/8+r-1;s>=r;s--)n+=e[s]*i,i*=256;return n}Ne.readUintBE=L7;function F7(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,s=r;s=n;s--)r[s]=e/i&255,i*=256;return r}Ne.writeUintBE=M7;function U7(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(!c2.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,s=n;s{"use strict";c();Object.defineProperty(Kt,"__esModule",{value:!0});Kt.randomStringForEntropy=Kt.randomString=Kt.randomUint32=Kt.randomBytes=Kt.defaultRandomSource=void 0;var z7=a2(),$7=Aa(),p2=Fr();Kt.defaultRandomSource=new z7.SystemRandomSource;function Xv(t,e=Kt.defaultRandomSource){return e.randomBytes(t)}Kt.randomBytes=Xv;function K7(t=Kt.defaultRandomSource){let e=Xv(4,t),r=(0,$7.readUint32LE)(e);return(0,p2.wipe)(e),r}Kt.randomUint32=K7;var g2="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function y2(t,e=g2,r=Kt.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=Xv(Math.ceil(t*256/s),r);for(let a=0;a0;a++){let u=o[a];u{"use strict";c();Object.defineProperty(Wn,"__esModule",{value:!0});var _a=Aa(),ba=Fr();Wn.DIGEST_LENGTH=64;Wn.BLOCK_SIZE=128;var E2=function(){function t(){this.digestLength=Wn.DIGEST_LENGTH,this.blockSize=Wn.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(){ba.wipe(this._buffer),ba.wipe(this._tempHi),ba.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&&(Zv(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(n=Zv(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){ba.wipe(e.stateHi),ba.wipe(e.stateLo),e.buffer&&ba.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},t}();Wn.SHA512=E2;var m2=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 Zv(t,e,r,n,i,s,o){for(var a=r[0],u=r[1],l=r[2],f=r[3],d=r[4],g=r[5],E=r[6],v=r[7],N=n[0],O=n[1],F=n[2],_=n[3],I=n[4],S=n[5],R=n[6],B=n[7],b,C,L,X,W,j,G,K;o>=128;){for(var de=0;de<16;de++){var ue=8*de+s;t[de]=_a.readUint32BE(i,ue),e[de]=_a.readUint32BE(i,ue+4)}for(var de=0;de<80;de++){var re=a,Y=u,se=l,te=f,ie=d,q=g,le=E,ae=v,fe=N,oe=O,ce=F,y=_,w=I,A=S,P=R,T=B;if(b=v,C=B,W=C&65535,j=C>>>16,G=b&65535,K=b>>>16,b=(d>>>14|I<<32-14)^(d>>>18|I<<32-18)^(I>>>41-32|d<<32-(41-32)),C=(I>>>14|d<<32-14)^(I>>>18|d<<32-18)^(d>>>41-32|I<<32-(41-32)),W+=C&65535,j+=C>>>16,G+=b&65535,K+=b>>>16,b=d&g^~d&E,C=I&S^~I&R,W+=C&65535,j+=C>>>16,G+=b&65535,K+=b>>>16,b=m2[de*2],C=m2[de*2+1],W+=C&65535,j+=C>>>16,G+=b&65535,K+=b>>>16,b=t[de%16],C=e[de%16],W+=C&65535,j+=C>>>16,G+=b&65535,K+=b>>>16,j+=W>>>16,G+=j>>>16,K+=G>>>16,L=G&65535|K<<16,X=W&65535|j<<16,b=L,C=X,W=C&65535,j=C>>>16,G=b&65535,K=b>>>16,b=(a>>>28|N<<32-28)^(N>>>34-32|a<<32-(34-32))^(N>>>39-32|a<<32-(39-32)),C=(N>>>28|a<<32-28)^(a>>>34-32|N<<32-(34-32))^(a>>>39-32|N<<32-(39-32)),W+=C&65535,j+=C>>>16,G+=b&65535,K+=b>>>16,b=a&u^a&l^u&l,C=N&O^N&F^O&F,W+=C&65535,j+=C>>>16,G+=b&65535,K+=b>>>16,j+=W>>>16,G+=j>>>16,K+=G>>>16,ae=G&65535|K<<16,T=W&65535|j<<16,b=te,C=y,W=C&65535,j=C>>>16,G=b&65535,K=b>>>16,b=L,C=X,W+=C&65535,j+=C>>>16,G+=b&65535,K+=b>>>16,j+=W>>>16,G+=j>>>16,K+=G>>>16,te=G&65535|K<<16,y=W&65535|j<<16,u=re,l=Y,f=se,d=te,g=ie,E=q,v=le,a=ae,O=fe,F=oe,_=ce,I=y,S=w,R=A,B=P,N=T,de%16===15)for(var ue=0;ue<16;ue++)b=t[ue],C=e[ue],W=C&65535,j=C>>>16,G=b&65535,K=b>>>16,b=t[(ue+9)%16],C=e[(ue+9)%16],W+=C&65535,j+=C>>>16,G+=b&65535,K+=b>>>16,L=t[(ue+1)%16],X=e[(ue+1)%16],b=(L>>>1|X<<32-1)^(L>>>8|X<<32-8)^L>>>7,C=(X>>>1|L<<32-1)^(X>>>8|L<<32-8)^(X>>>7|L<<32-7),W+=C&65535,j+=C>>>16,G+=b&65535,K+=b>>>16,L=t[(ue+14)%16],X=e[(ue+14)%16],b=(L>>>19|X<<32-19)^(X>>>61-32|L<<32-(61-32))^L>>>6,C=(X>>>19|L<<32-19)^(L>>>61-32|X<<32-(61-32))^(X>>>6|L<<32-6),W+=C&65535,j+=C>>>16,G+=b&65535,K+=b>>>16,j+=W>>>16,G+=j>>>16,K+=G>>>16,t[ue]=G&65535|K<<16,e[ue]=W&65535|j<<16}b=a,C=N,W=C&65535,j=C>>>16,G=b&65535,K=b>>>16,b=r[0],C=n[0],W+=C&65535,j+=C>>>16,G+=b&65535,K+=b>>>16,j+=W>>>16,G+=j>>>16,K+=G>>>16,r[0]=a=G&65535|K<<16,n[0]=N=W&65535|j<<16,b=u,C=O,W=C&65535,j=C>>>16,G=b&65535,K=b>>>16,b=r[1],C=n[1],W+=C&65535,j+=C>>>16,G+=b&65535,K+=b>>>16,j+=W>>>16,G+=j>>>16,K+=G>>>16,r[1]=u=G&65535|K<<16,n[1]=O=W&65535|j<<16,b=l,C=F,W=C&65535,j=C>>>16,G=b&65535,K=b>>>16,b=r[2],C=n[2],W+=C&65535,j+=C>>>16,G+=b&65535,K+=b>>>16,j+=W>>>16,G+=j>>>16,K+=G>>>16,r[2]=l=G&65535|K<<16,n[2]=F=W&65535|j<<16,b=f,C=_,W=C&65535,j=C>>>16,G=b&65535,K=b>>>16,b=r[3],C=n[3],W+=C&65535,j+=C>>>16,G+=b&65535,K+=b>>>16,j+=W>>>16,G+=j>>>16,K+=G>>>16,r[3]=f=G&65535|K<<16,n[3]=_=W&65535|j<<16,b=d,C=I,W=C&65535,j=C>>>16,G=b&65535,K=b>>>16,b=r[4],C=n[4],W+=C&65535,j+=C>>>16,G+=b&65535,K+=b>>>16,j+=W>>>16,G+=j>>>16,K+=G>>>16,r[4]=d=G&65535|K<<16,n[4]=I=W&65535|j<<16,b=g,C=S,W=C&65535,j=C>>>16,G=b&65535,K=b>>>16,b=r[5],C=n[5],W+=C&65535,j+=C>>>16,G+=b&65535,K+=b>>>16,j+=W>>>16,G+=j>>>16,K+=G>>>16,r[5]=g=G&65535|K<<16,n[5]=S=W&65535|j<<16,b=E,C=R,W=C&65535,j=C>>>16,G=b&65535,K=b>>>16,b=r[6],C=n[6],W+=C&65535,j+=C>>>16,G+=b&65535,K+=b>>>16,j+=W>>>16,G+=j>>>16,K+=G>>>16,r[6]=E=G&65535|K<<16,n[6]=R=W&65535|j<<16,b=v,C=B,W=C&65535,j=C>>>16,G=b&65535,K=b>>>16,b=r[7],C=n[7],W+=C&65535,j+=C>>>16,G+=b&65535,K+=b>>>16,j+=W>>>16,G+=j>>>16,K+=G>>>16,r[7]=v=G&65535|K<<16,n[7]=B=W&65535|j<<16,s+=128,o-=128}return s}function J7(t){var e=new E2;e.update(t);var r=e.digest();return e.clean(),r}Wn.hash=J7});var R2=m(Ve=>{"use strict";c();Object.defineProperty(Ve,"__esModule",{value:!0});Ve.convertSecretKeyToX25519=Ve.convertPublicKeyToX25519=Ve.verify=Ve.sign=Ve.extractPublicKeyFromSecretKey=Ve.generateKeyPair=Ve.generateKeyPairFromSeed=Ve.SEED_LENGTH=Ve.SECRET_KEY_LENGTH=Ve.PUBLIC_KEY_LENGTH=Ve.SIGNATURE_LENGTH=void 0;var X7=Rc(),Bc=w2(),I2=Fr();Ve.SIGNATURE_LENGTH=64;Ve.PUBLIC_KEY_LENGTH=32;Ve.SECRET_KEY_LENGTH=64;Ve.SEED_LENGTH=32;function be(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,S2(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 C2(t,e){let r=0;for(let n=0;n<32;n++)r|=t[n]^e[n];return(1&r-1>>>8)-1}function b2(t,e){let r=new Uint8Array(32),n=new Uint8Array(32);return Lc(r,t),Lc(n,e),C2(r,n)}function T2(t){let e=new Uint8Array(32);return Lc(e,t),e[0]&1}function n9(t,e){for(let r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function Fs(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]+r[n]}function Us(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]-r[n]}function Qe(t,e,r){let n,i,s=0,o=0,a=0,u=0,l=0,f=0,d=0,g=0,E=0,v=0,N=0,O=0,F=0,_=0,I=0,S=0,R=0,B=0,b=0,C=0,L=0,X=0,W=0,j=0,G=0,K=0,de=0,ue=0,re=0,Y=0,se=0,te=r[0],ie=r[1],q=r[2],le=r[3],ae=r[4],fe=r[5],oe=r[6],ce=r[7],y=r[8],w=r[9],A=r[10],P=r[11],T=r[12],D=r[13],M=r[14],x=r[15];n=e[0],s+=n*te,o+=n*ie,a+=n*q,u+=n*le,l+=n*ae,f+=n*fe,d+=n*oe,g+=n*ce,E+=n*y,v+=n*w,N+=n*A,O+=n*P,F+=n*T,_+=n*D,I+=n*M,S+=n*x,n=e[1],o+=n*te,a+=n*ie,u+=n*q,l+=n*le,f+=n*ae,d+=n*fe,g+=n*oe,E+=n*ce,v+=n*y,N+=n*w,O+=n*A,F+=n*P,_+=n*T,I+=n*D,S+=n*M,R+=n*x,n=e[2],a+=n*te,u+=n*ie,l+=n*q,f+=n*le,d+=n*ae,g+=n*fe,E+=n*oe,v+=n*ce,N+=n*y,O+=n*w,F+=n*A,_+=n*P,I+=n*T,S+=n*D,R+=n*M,B+=n*x,n=e[3],u+=n*te,l+=n*ie,f+=n*q,d+=n*le,g+=n*ae,E+=n*fe,v+=n*oe,N+=n*ce,O+=n*y,F+=n*w,_+=n*A,I+=n*P,S+=n*T,R+=n*D,B+=n*M,b+=n*x,n=e[4],l+=n*te,f+=n*ie,d+=n*q,g+=n*le,E+=n*ae,v+=n*fe,N+=n*oe,O+=n*ce,F+=n*y,_+=n*w,I+=n*A,S+=n*P,R+=n*T,B+=n*D,b+=n*M,C+=n*x,n=e[5],f+=n*te,d+=n*ie,g+=n*q,E+=n*le,v+=n*ae,N+=n*fe,O+=n*oe,F+=n*ce,_+=n*y,I+=n*w,S+=n*A,R+=n*P,B+=n*T,b+=n*D,C+=n*M,L+=n*x,n=e[6],d+=n*te,g+=n*ie,E+=n*q,v+=n*le,N+=n*ae,O+=n*fe,F+=n*oe,_+=n*ce,I+=n*y,S+=n*w,R+=n*A,B+=n*P,b+=n*T,C+=n*D,L+=n*M,X+=n*x,n=e[7],g+=n*te,E+=n*ie,v+=n*q,N+=n*le,O+=n*ae,F+=n*fe,_+=n*oe,I+=n*ce,S+=n*y,R+=n*w,B+=n*A,b+=n*P,C+=n*T,L+=n*D,X+=n*M,W+=n*x,n=e[8],E+=n*te,v+=n*ie,N+=n*q,O+=n*le,F+=n*ae,_+=n*fe,I+=n*oe,S+=n*ce,R+=n*y,B+=n*w,b+=n*A,C+=n*P,L+=n*T,X+=n*D,W+=n*M,j+=n*x,n=e[9],v+=n*te,N+=n*ie,O+=n*q,F+=n*le,_+=n*ae,I+=n*fe,S+=n*oe,R+=n*ce,B+=n*y,b+=n*w,C+=n*A,L+=n*P,X+=n*T,W+=n*D,j+=n*M,G+=n*x,n=e[10],N+=n*te,O+=n*ie,F+=n*q,_+=n*le,I+=n*ae,S+=n*fe,R+=n*oe,B+=n*ce,b+=n*y,C+=n*w,L+=n*A,X+=n*P,W+=n*T,j+=n*D,G+=n*M,K+=n*x,n=e[11],O+=n*te,F+=n*ie,_+=n*q,I+=n*le,S+=n*ae,R+=n*fe,B+=n*oe,b+=n*ce,C+=n*y,L+=n*w,X+=n*A,W+=n*P,j+=n*T,G+=n*D,K+=n*M,de+=n*x,n=e[12],F+=n*te,_+=n*ie,I+=n*q,S+=n*le,R+=n*ae,B+=n*fe,b+=n*oe,C+=n*ce,L+=n*y,X+=n*w,W+=n*A,j+=n*P,G+=n*T,K+=n*D,de+=n*M,ue+=n*x,n=e[13],_+=n*te,I+=n*ie,S+=n*q,R+=n*le,B+=n*ae,b+=n*fe,C+=n*oe,L+=n*ce,X+=n*y,W+=n*w,j+=n*A,G+=n*P,K+=n*T,de+=n*D,ue+=n*M,re+=n*x,n=e[14],I+=n*te,S+=n*ie,R+=n*q,B+=n*le,b+=n*ae,C+=n*fe,L+=n*oe,X+=n*ce,W+=n*y,j+=n*w,G+=n*A,K+=n*P,de+=n*T,ue+=n*D,re+=n*M,Y+=n*x,n=e[15],S+=n*te,R+=n*ie,B+=n*q,b+=n*le,C+=n*ae,L+=n*fe,X+=n*oe,W+=n*ce,j+=n*y,G+=n*w,K+=n*A,de+=n*P,ue+=n*T,re+=n*D,Y+=n*M,se+=n*x,s+=38*R,o+=38*B,a+=38*b,u+=38*C,l+=38*L,f+=38*X,d+=38*W,g+=38*j,E+=38*G,v+=38*K,N+=38*de,O+=38*ue,F+=38*re,_+=38*Y,I+=38*se,i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=l+i+65535,i=Math.floor(n/65536),l=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=g+i+65535,i=Math.floor(n/65536),g=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=v+i+65535,i=Math.floor(n/65536),v=n-i*65536,n=N+i+65535,i=Math.floor(n/65536),N=n-i*65536,n=O+i+65535,i=Math.floor(n/65536),O=n-i*65536,n=F+i+65535,i=Math.floor(n/65536),F=n-i*65536,n=_+i+65535,i=Math.floor(n/65536),_=n-i*65536,n=I+i+65535,i=Math.floor(n/65536),I=n-i*65536,n=S+i+65535,i=Math.floor(n/65536),S=n-i*65536,s+=i-1+37*(i-1),i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=l+i+65535,i=Math.floor(n/65536),l=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=g+i+65535,i=Math.floor(n/65536),g=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=v+i+65535,i=Math.floor(n/65536),v=n-i*65536,n=N+i+65535,i=Math.floor(n/65536),N=n-i*65536,n=O+i+65535,i=Math.floor(n/65536),O=n-i*65536,n=F+i+65535,i=Math.floor(n/65536),F=n-i*65536,n=_+i+65535,i=Math.floor(n/65536),_=n-i*65536,n=I+i+65535,i=Math.floor(n/65536),I=n-i*65536,n=S+i+65535,i=Math.floor(n/65536),S=n-i*65536,s+=i-1+37*(i-1),t[0]=s,t[1]=o,t[2]=a,t[3]=u,t[4]=l,t[5]=f,t[6]=d,t[7]=g,t[8]=E,t[9]=v,t[10]=N,t[11]=O,t[12]=F,t[13]=_,t[14]=I,t[15]=S}function Ms(t,e){Qe(t,e,e)}function x2(t,e){let r=be(),n;for(n=0;n<16;n++)r[n]=e[n];for(n=253;n>=0;n--)Ms(r,r),n!==2&&n!==4&&Qe(r,r,e);for(n=0;n<16;n++)t[n]=r[n]}function i9(t,e){let r=be(),n;for(n=0;n<16;n++)r[n]=e[n];for(n=250;n>=0;n--)Ms(r,r),n!==1&&Qe(r,r,e);for(n=0;n<16;n++)t[n]=r[n]}function n1(t,e){let r=be(),n=be(),i=be(),s=be(),o=be(),a=be(),u=be(),l=be(),f=be();Us(r,t[1],t[0]),Us(f,e[1],e[0]),Qe(r,r,f),Fs(n,t[0],t[1]),Fs(f,e[0],e[1]),Qe(n,n,f),Qe(i,t[3],e[3]),Qe(i,i,t9),Qe(s,t[2],e[2]),Fs(s,s,s),Us(o,n,r),Us(a,s,i),Fs(u,s,i),Fs(l,n,r),Qe(t[0],o,a),Qe(t[1],l,u),Qe(t[2],u,a),Qe(t[3],o,l)}function _2(t,e,r){for(let n=0;n<4;n++)S2(t[n],e[n],r)}function s1(t,e){let r=be(),n=be(),i=be();x2(i,e[2]),Qe(r,e[0],i),Qe(n,e[1],i),Lc(t,n),t[31]^=T2(r)<<7}function N2(t,e,r){Di(t[0],r1),Di(t[1],Ia),Di(t[2],Ia),Di(t[3],r1);for(let n=255;n>=0;--n){let i=r[n/8|0]>>(n&7)&1;_2(t,e,i),n1(e,t),n1(t,t),_2(t,e,i)}}function o1(t,e){let r=[be(),be(),be(),be()];Di(r[0],v2),Di(r[1],A2),Di(r[2],Ia),Qe(r[3],v2,A2),N2(t,r,e)}function O2(t){if(t.length!==Ve.SEED_LENGTH)throw new Error(`ed25519: seed must be ${Ve.SEED_LENGTH} bytes`);let e=(0,Bc.hash)(t);e[0]&=248,e[31]&=127,e[31]|=64;let r=new Uint8Array(32),n=[be(),be(),be(),be()];o1(n,e),s1(r,n);let i=new Uint8Array(64);return i.set(t),i.set(r,32),{publicKey:r,secretKey:i}}Ve.generateKeyPairFromSeed=O2;function s9(t){let e=(0,X7.randomBytes)(32,t),r=O2(e);return(0,I2.wipe)(e),r}Ve.generateKeyPair=s9;function o9(t){if(t.length!==Ve.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${Ve.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(t.subarray(32))}Ve.extractPublicKeyFromSecretKey=o9;var t1=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 D2(t,e){let r,n,i,s;for(n=63;n>=32;--n){for(r=0,i=n-32,s=n-12;i>4)*t1[i],r=e[i]>>8,e[i]&=255;for(i=0;i<32;i++)e[i]-=r*t1[i];for(n=0;n<32;n++)e[n+1]+=e[n]>>8,t[n]=e[n]&255}function i1(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;D2(t,e)}function a9(t,e){let r=new Float64Array(64),n=[be(),be(),be(),be()],i=(0,Bc.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 Bc.SHA512;o.update(s.subarray(32)),o.update(e);let a=o.digest();o.clean(),i1(a),o1(n,a),s1(s,n),o.reset(),o.update(s.subarray(0,32)),o.update(t.subarray(32)),o.update(e);let u=o.digest();i1(u);for(let l=0;l<32;l++)r[l]=a[l];for(let l=0;l<32;l++)for(let f=0;f<32;f++)r[l+f]+=u[l]*i[f];return D2(s.subarray(32),r),s}Ve.sign=a9;function P2(t,e){let r=be(),n=be(),i=be(),s=be(),o=be(),a=be(),u=be();return Di(t[2],Ia),n9(t[1],e),Ms(i,t[1]),Qe(s,i,e9),Us(i,i,t[2]),Fs(s,t[2],s),Ms(o,s),Ms(a,o),Qe(u,a,o),Qe(r,u,i),Qe(r,r,s),i9(r,r),Qe(r,r,i),Qe(r,r,s),Qe(r,r,s),Qe(t[0],r,s),Ms(n,t[0]),Qe(n,n,s),b2(n,i)&&Qe(t[0],t[0],r9),Ms(n,t[0]),Qe(n,n,s),b2(n,i)?-1:(T2(t[0])===e[31]>>7&&Us(t[0],r1,t[0]),Qe(t[3],t[0],t[1]),0)}function u9(t,e,r){let n=new Uint8Array(32),i=[be(),be(),be(),be()],s=[be(),be(),be(),be()];if(r.length!==Ve.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${Ve.SIGNATURE_LENGTH} bytes`);if(P2(s,t))return!1;let o=new Bc.SHA512;o.update(r.subarray(0,32)),o.update(t),o.update(e);let a=o.digest();return i1(a),N2(i,s,a),o1(s,r.subarray(32)),n1(i,s),s1(n,i),!C2(r,n)}Ve.verify=u9;function c9(t){let e=[be(),be(),be(),be()];if(P2(e,t))throw new Error("Ed25519: invalid public key");let r=be(),n=be(),i=e[1];Fs(r,Ia,i),Us(n,Ia,i),x2(n,n),Qe(r,r,n);let s=new Uint8Array(32);return Lc(s,r),s}Ve.convertPublicKeyToX25519=c9;function l9(t){let e=(0,Bc.hash)(t.subarray(0,32));e[0]&=248,e[31]&=127,e[31]|=64;let r=new Uint8Array(e.subarray(0,32));return(0,I2.wipe)(e),r}Ve.convertSecretKeyToX25519=l9});var Hd,jd,qs,Sa,Gd,Fc,kd,Qd,Wd,Ca,zd,$d,B2,L2,Kd=ge(()=>{c();Hd="EdDSA",jd="JWT",qs=".",Sa="base64url",Gd="utf8",Fc="utf8",kd=":",Qd="did",Wd="key",Ca="base58btc",zd="z",$d="K36",B2=32,L2=32});function Pi(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}var Mc=ge(()=>{c()});function Ta(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?Pi(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}var Yd=ge(()=>{c();Mc()});function Jd(t,e){e||(e=t.reduce((i,s)=>i+s.length,0));let r=Ta(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return Pi(r)}var a1=ge(()=>{c();Yd();Mc()});function f9(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,S=new Uint8Array(I);F!==_;){for(var R=v[F],B=0,b=I-1;(R!==0||B>>0,S[b]=R%a>>>0,R=R/a>>>0;if(R!==0)throw new Error("Non-zero carry");O=B,F++}for(var C=I-O;C!==I&&S[C]===0;)C++;for(var L=u.repeat(N);C>>0,I=new Uint8Array(_);v[N];){var S=r[v.charCodeAt(N)];if(S===255)return;for(var R=0,B=_-1;(S!==0||R>>0,I[B]=S%256>>>0,S=S/256>>>0;if(S!==0)throw new Error("Non-zero carry");F=R,N++}if(v[N]!==" "){for(var b=_-F;b!==_&&I[b]===0;)b++;for(var C=new Uint8Array(O+(_-b)),L=O;b!==_;)C[L++]=I[b++];return C}}}function E(v){var N=g(v);if(N)return N;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:g,decode:E}}var h9,d9,F2,M2=ge(()=>{c();h9=f9,d9=h9,F2=d9});var Ple,U2,zn,q2,V2,Ri=ge(()=>{c();Ple=new Uint8Array(0),U2=(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")},q2=t=>new TextEncoder().encode(t),V2=t=>new TextDecoder().decode(t)});var u1,c1,l1,j2,f1,xa,Bi,p9,g9,dt,Wr=ge(()=>{c();M2();Ri();u1=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")}},c1=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 j2(this,e)}},l1=class{constructor(e){this.decoders=e}or(e){return j2(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`)}},j2=(t,e)=>new l1({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),f1=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new u1(e,r,n),this.decoder=new c1(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},xa=({name:t,prefix:e,encode:r,decode:n})=>new f1(t,e,r,n),Bi=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=F2(r,e);return xa({prefix:t,name:e,encode:n,decode:s=>zn(i(s))})},p9=(t,e,r,n)=>{let i={};for(let f=0;f=8&&(a-=8,o[l++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},g9=(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<xa({prefix:e,name:t,encode(i){return g9(i,n,r)},decode(i){return p9(i,n,r,t)}})});var h1={};ft(h1,{identity:()=>y9});var y9,G2=ge(()=>{c();Wr();Ri();y9=xa({prefix:"\0",name:"identity",encode:t=>V2(t),decode:t=>q2(t)})});var d1={};ft(d1,{base2:()=>m9});var m9,k2=ge(()=>{c();Wr();m9=dt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1})});var p1={};ft(p1,{base8:()=>E9});var E9,Q2=ge(()=>{c();Wr();E9=dt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3})});var g1={};ft(g1,{base10:()=>w9});var w9,W2=ge(()=>{c();Wr();w9=Bi({prefix:"9",name:"base10",alphabet:"0123456789"})});var y1={};ft(y1,{base16:()=>v9,base16upper:()=>A9});var v9,A9,z2=ge(()=>{c();Wr();v9=dt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),A9=dt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})});var m1={};ft(m1,{base32:()=>Na,base32hex:()=>S9,base32hexpad:()=>T9,base32hexpadupper:()=>x9,base32hexupper:()=>C9,base32pad:()=>_9,base32padupper:()=>I9,base32upper:()=>b9,base32z:()=>N9});var Na,b9,_9,I9,S9,C9,T9,x9,N9,E1=ge(()=>{c();Wr();Na=dt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),b9=dt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),_9=dt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),I9=dt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),S9=dt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),C9=dt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),T9=dt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),x9=dt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),N9=dt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})});var w1={};ft(w1,{base36:()=>O9,base36upper:()=>D9});var O9,D9,$2=ge(()=>{c();Wr();O9=Bi({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),D9=Bi({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})});var v1={};ft(v1,{base58btc:()=>_n,base58flickr:()=>P9});var _n,P9,A1=ge(()=>{c();Wr();_n=Bi({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),P9=Bi({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})});var b1={};ft(b1,{base64:()=>R9,base64pad:()=>B9,base64url:()=>L9,base64urlpad:()=>F9});var R9,B9,L9,F9,K2=ge(()=>{c();Wr();R9=dt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),B9=dt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),L9=dt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),F9=dt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})});var _1={};ft(_1,{base256emoji:()=>H9});function q9(t){return t.reduce((e,r)=>(e+=M9[r],e),"")}function V9(t){let e=[];for(let r of t){let n=U9[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var Y2,M9,U9,H9,J2=ge(()=>{c();Wr();Y2=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}"),M9=Y2.reduce((t,e,r)=>(t[r]=e,t),[]),U9=Y2.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);H9=xa({prefix:"\u{1F680}",name:"base256emoji",encode:q9,decode:V9})});function eD(t,e,r){e=e||[],r=r||0;for(var n=r;t>=Q9;)e[r++]=t&255|X2,t/=128;for(;t&k9;)e[r++]=t&255|X2,t>>>=7;return e[r]=t|0,eD.bytes=r-n+1,e}function I1(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw I1.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&Z2)<=z9);return I1.bytes=s-n,r}var j9,X2,G9,k9,Q9,W9,z9,Z2,$9,K9,Y9,J9,X9,Z9,eQ,tQ,rQ,nQ,iQ,sQ,Uc,tD=ge(()=>{c();j9=eD,X2=128,G9=127,k9=~G9,Q9=Math.pow(2,31);W9=I1,z9=128,Z2=127;$9=Math.pow(2,7),K9=Math.pow(2,14),Y9=Math.pow(2,21),J9=Math.pow(2,28),X9=Math.pow(2,35),Z9=Math.pow(2,42),eQ=Math.pow(2,49),tQ=Math.pow(2,56),rQ=Math.pow(2,63),nQ=function(t){return t<$9?1:t{c();tD();qc=(t,e=0)=>[Uc.decode(t,e),Uc.decode.bytes],Oa=(t,e,r=0)=>(Uc.encode(t,e,r),e),Da=t=>Uc.encodingLength(t)});var Vs,rD,nD,Pa,Hc=ge(()=>{c();Ri();Zd();Vs=(t,e)=>{let r=e.byteLength,n=Da(t),i=n+Da(r),s=new Uint8Array(i+r);return Oa(t,s,0),Oa(r,s,n),s.set(e,i),new Pa(t,r,e,s)},rD=t=>{let e=zn(t),[r,n]=qc(e),[i,s]=qc(e.subarray(n)),o=e.subarray(n+s);if(o.byteLength!==i)throw new Error("Incorrect length");return new Pa(r,i,o,e)},nD=(t,e)=>t===e?!0:t.code===e.code&&t.size===e.size&&U2(t.bytes,e.bytes),Pa=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}});var C1,S1,T1=ge(()=>{c();Hc();C1=({name:t,code:e,encode:r})=>new S1(t,e,r),S1=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?Vs(this.code,r):r.then(n=>Vs(this.code,n))}else throw Error("Unknown type, must be binary type")}}});var x1={};ft(x1,{sha256:()=>oQ,sha512:()=>aQ});var sD,oQ,aQ,oD=ge(()=>{c();T1();sD=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),oQ=C1({name:"sha2-256",code:18,encode:sD("SHA-256")}),aQ=C1({name:"sha2-512",code:19,encode:sD("SHA-512")})});var N1={};ft(N1,{identity:()=>lQ});var aD,uQ,uD,cQ,lQ,cD=ge(()=>{c();Ri();Hc();aD=0,uQ="identity",uD=zn,cQ=t=>Vs(aD,uD(t)),lQ={code:aD,name:uQ,encode:uD,digest:cQ}});var lD=ge(()=>{c();Ri()});var Efe,wfe,fD=ge(()=>{c();Efe=new TextEncoder,wfe=new TextDecoder});var rp,dQ,pQ,gQ,jc,yQ,hD,dD,ep,tp,mQ,EQ,wQ,pD=ge(()=>{c();Zd();Hc();A1();E1();Ri();rp=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:tp,byteLength:tp,code:ep,version:ep,multihash:ep,bytes:ep,_baseCache:tp,asCID:tp})}toV0(){switch(this.version){case 0:return this;default:{let{code:e,multihash:r}=this;if(e!==jc)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==yQ)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=Vs(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&&nD(this.multihash,e.multihash)}toString(e){let{bytes:r,version:n,_baseCache:i}=this;switch(n){case 0:return pQ(r,i,e||_n.encoder);default:return gQ(r,i,e||Na.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 EQ(/^0\.0/,wQ),!!(e&&(e[dD]||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||hD(r,n,i.bytes))}else if(e!=null&&e[dD]===!0){let{version:r,multihash:n,code:i}=e,s=rD(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!==jc)throw new Error(`Version 0 CID must use dag-pb (code: ${jc}) block encoding`);return new t(e,r,n,n.bytes)}case 1:{let i=hD(e,r,n.bytes);return new t(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return t.create(0,jc,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=zn(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 Pa(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]=qc(e.subarray(r));return r+=g,d},i=n(),s=jc;if(i===18?(i=0,r=0):i===1&&(s=n()),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let o=r,a=n(),u=n(),l=r+u,f=l-o;return{version:i,codec:s,multihashCode:a,digestSize:u,multihashSize:f,size:l}}static parse(e,r){let[n,i]=dQ(e,r),s=t.decode(i);return s._baseCache.set(n,e),s}},dQ=(t,e)=>{switch(t[0]){case"Q":{let r=e||_n;return[_n.prefix,r.decode(`${_n.prefix}${t}`)]}case _n.prefix:{let r=e||_n;return[_n.prefix,r.decode(t)]}case Na.prefix:{let r=e||Na;return[Na.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)]}}},pQ=(t,e,r)=>{let{prefix:n}=r;if(n!==_n.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},gQ=(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},jc=112,yQ=18,hD=(t,e,r)=>{let n=Da(t),i=n+Da(e),s=new Uint8Array(i+r.byteLength);return Oa(t,s,0),Oa(e,s,n),s.set(r,i),s},dD=Symbol.for("@ipld/js-cid/CID"),ep={writable:!1,configurable:!1,enumerable:!0},tp={writable:!1,enumerable:!1,configurable:!1},mQ="0.0.0-dev",EQ=(t,e)=>{if(t.test(mQ))console.warn(e);else throw new Error(e)},wQ=`CID.isCID(v) is deprecated and will be removed in the next major release. Following code pattern: if (CID.isCID(value)) { @@ -17,27 +17,33 @@ if (cid) { // Make sure to use cid instead of value doSomethingWithCID(cid) } -`});var LO=ge(()=>{c();BO();cp();Vi();iv();_l()});var av,zce,FO=ge(()=>{c();cO();lO();fO();hO();dO();$1();pO();X1();gO();mO();CO();NO();OO();DO();LO();av={...G1,...Q1,...k1,...z1,...W1,...K1,...Y1,...J1,...Z1,...ev},zce={...sv,...ov}});function UO(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var MO,uv,oQ,hp,cv=ge(()=>{c();FO();op();MO=UO("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),uv=UO("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);let e=Tu(t.length);for(let r=0;r{c();cv()});function In(t,e="utf8"){let r=hp[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?qi(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}var fv=ge(()=>{c();cv();El()});function Sl(t){return dl(Jn(In(t,Su),Zd))}function Cl(t){return Jn(In(pl(t),Zd),Su)}function hv(t){let e=In(ip,Cu),r=np+Jn(ap([e,t]),Cu);return[tp,rp,r].join(ep)}function dv(t){let[e,r,n]=t.split(ep);if(e!==tp||r!==rp)throw new Error('Issuer must be a DID with method "key"');if(n.slice(0,1)!==np)throw new Error("Issuer must be a key in mulicodec format");let s=In(n.slice(1),Cu);if(Jn(s.slice(0,2),Cu)!==ip)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 qO(t){return Jn(t,Su)}function VO(t){return In(t,Su)}function pv(t){return In([Cl(t.header),Cl(t.payload)].join(po),wl)}function aQ(t){let e=Jn(t,wl).split(po),r=Sl(e[0]),n=Sl(e[1]);return{header:r,payload:n}}function gv(t){return[Cl(t.header),Cl(t.payload),qO(t.signature)].join(po)}function yv(t){let e=t.split(po),r=Sl(e[0]),n=Sl(e[1]),i=VO(e[2]),s=In(e.slice(0,2).join(po),wl);return{header:r,payload:n,signature:i,data:s}}var mv=ge(()=>{c();U1();lv();fv();kd();sp()});function uQ(t=(0,jO.randomBytes)(32)){return Ru.generateKeyPairFromSeed(t)}async function cQ(t,e,r,n,i=(0,HO.fromMiliseconds)(Date.now())){let s={alg:Jd,typ:Xd},o=hv(n.publicKey),a=i+r,u={iss:o,sub:t,aud:e,iat:i,exp:a},l=pv({header:s,payload:u}),f=Ru.sign(n.secretKey,l);return gv({header:s,payload:u,signature:f})}async function lQ(t){let{header:e,payload:r,data:n,signature:i}=yv(t);if(e.alg!==Jd||e.typ!==Xd)throw new Error("JWT must use EdDSA algorithm");let s=dv(r.iss);return Ru.verify(s,n,i)}var Ru,jO,HO,GO=ge(()=>{c();Ru=_e(ZN()),jO=_e(gl()),HO=_e(co());sp();mv()});var QO=ge(()=>{c()});var kO={};at(kO,{DATA_ENCODING:()=>wl,DID_DELIMITER:()=>ep,DID_METHOD:()=>rp,DID_PREFIX:()=>tp,JSON_ENCODING:()=>Zd,JWT_DELIMITER:()=>po,JWT_ENCODING:()=>Su,JWT_IRIDIUM_ALG:()=>Jd,JWT_IRIDIUM_TYP:()=>Xd,KEY_PAIR_SEED_LENGTH:()=>tO,MULTICODEC_ED25519_BASE:()=>np,MULTICODEC_ED25519_ENCODING:()=>Cu,MULTICODEC_ED25519_HEADER:()=>ip,MULTICODEC_ED25519_LENGTH:()=>eO,decodeData:()=>aQ,decodeIss:()=>dv,decodeJSON:()=>Sl,decodeJWT:()=>yv,decodeSig:()=>VO,encodeData:()=>pv,encodeIss:()=>hv,encodeJSON:()=>Cl,encodeJWT:()=>gv,encodeSig:()=>qO,generateKeyPair:()=>uQ,signJWT:()=>cQ,verifyJWT:()=>lQ});var zO=ge(()=>{c();GO();sp();QO();mv()});var KO=w(dp=>{"use strict";c();Object.defineProperty(dp,"__esModule",{value:!0});var Wt=Au(),wv=Or(),fQ=20;function hQ(t,e,r){for(var n=1634760805,i=857760878,s=2036477234,o=1797285236,a=r[3]<<24|r[2]<<16|r[1]<<8|r[0],u=r[7]<<24|r[6]<<16|r[5]<<8|r[4],l=r[11]<<24|r[10]<<16|r[9]<<8|r[8],f=r[15]<<24|r[14]<<16|r[13]<<8|r[12],d=r[19]<<24|r[18]<<16|r[17]<<8|r[16],y=r[23]<<24|r[22]<<16|r[21]<<8|r[20],m=r[27]<<24|r[26]<<16|r[25]<<8|r[24],v=r[31]<<24|r[30]<<16|r[29]<<8|r[28],T=e[3]<<24|e[2]<<16|e[1]<<8|e[0],B=e[7]<<24|e[6]<<16|e[5]<<8|e[4],A=e[11]<<24|e[10]<<16|e[9]<<8|e[8],D=e[15]<<24|e[14]<<16|e[13]<<8|e[12],x=n,R=i,P=s,L=o,_=a,C=u,M=l,Z=f,z=d,H=y,G=m,$=v,de=T,ae=B,re=A,Y=D,ie=0;ie>>32-16|de<<16,z=z+de|0,_^=z,_=_>>>32-12|_<<12,R=R+C|0,ae^=R,ae=ae>>>32-16|ae<<16,H=H+ae|0,C^=H,C=C>>>32-12|C<<12,P=P+M|0,re^=P,re=re>>>32-16|re<<16,G=G+re|0,M^=G,M=M>>>32-12|M<<12,L=L+Z|0,Y^=L,Y=Y>>>32-16|Y<<16,$=$+Y|0,Z^=$,Z=Z>>>32-12|Z<<12,P=P+M|0,re^=P,re=re>>>32-8|re<<8,G=G+re|0,M^=G,M=M>>>32-7|M<<7,L=L+Z|0,Y^=L,Y=Y>>>32-8|Y<<8,$=$+Y|0,Z^=$,Z=Z>>>32-7|Z<<7,R=R+C|0,ae^=R,ae=ae>>>32-8|ae<<8,H=H+ae|0,C^=H,C=C>>>32-7|C<<7,x=x+_|0,de^=x,de=de>>>32-8|de<<8,z=z+de|0,_^=z,_=_>>>32-7|_<<7,x=x+C|0,Y^=x,Y=Y>>>32-16|Y<<16,G=G+Y|0,C^=G,C=C>>>32-12|C<<12,R=R+M|0,de^=R,de=de>>>32-16|de<<16,$=$+de|0,M^=$,M=M>>>32-12|M<<12,P=P+Z|0,ae^=P,ae=ae>>>32-16|ae<<16,z=z+ae|0,Z^=z,Z=Z>>>32-12|Z<<12,L=L+_|0,re^=L,re=re>>>32-16|re<<16,H=H+re|0,_^=H,_=_>>>32-12|_<<12,P=P+Z|0,ae^=P,ae=ae>>>32-8|ae<<8,z=z+ae|0,Z^=z,Z=Z>>>32-7|Z<<7,L=L+_|0,re^=L,re=re>>>32-8|re<<8,H=H+re|0,_^=H,_=_>>>32-7|_<<7,R=R+M|0,de^=R,de=de>>>32-8|de<<8,$=$+de|0,M^=$,M=M>>>32-7|M<<7,x=x+C|0,Y^=x,Y=Y>>>32-8|Y<<8,G=G+Y|0,C^=G,C=C>>>32-7|C<<7;Wt.writeUint32LE(x+n|0,t,0),Wt.writeUint32LE(R+i|0,t,4),Wt.writeUint32LE(P+s|0,t,8),Wt.writeUint32LE(L+o|0,t,12),Wt.writeUint32LE(_+a|0,t,16),Wt.writeUint32LE(C+u|0,t,20),Wt.writeUint32LE(M+l|0,t,24),Wt.writeUint32LE(Z+f|0,t,28),Wt.writeUint32LE(z+d|0,t,32),Wt.writeUint32LE(H+y|0,t,36),Wt.writeUint32LE(G+m|0,t,40),Wt.writeUint32LE($+v|0,t,44),Wt.writeUint32LE(de+T|0,t,48),Wt.writeUint32LE(ae+B|0,t,52),Wt.writeUint32LE(re+A|0,t,56),Wt.writeUint32LE(Y+D|0,t,60)}function WO(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 pp=w(Bu=>{"use strict";c();Object.defineProperty(Bu,"__esModule",{value:!0});function gQ(t,e,r){return~(t-1)&e|t-1&r}Bu.select=gQ;function yQ(t,e){return(t|0)-(e|0)-1>>>31&1}Bu.lessOrEqual=yQ;function $O(t,e){if(t.length!==e.length)return 0;for(var r=0,n=0;n>>8}Bu.compare=$O;function mQ(t,e){return t.length===0||e.length===0?!1:$O(t,e)!==0}Bu.equal=mQ});var JO=w(Xn=>{"use strict";c();Object.defineProperty(Xn,"__esModule",{value:!0});var wQ=pp(),gp=Or();Xn.DIGEST_LENGTH=16;var YO=function(){function t(e){this.digestLength=Xn.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var r=e[0]|e[1]<<8;this._r[0]=r&8191;var n=e[2]|e[3]<<8;this._r[1]=(r>>>13|n<<3)&8191;var i=e[4]|e[5]<<8;this._r[2]=(n>>>10|i<<6)&7939;var s=e[6]|e[7]<<8;this._r[3]=(i>>>7|s<<9)&8191;var o=e[8]|e[9]<<8;this._r[4]=(s>>>4|o<<12)&255,this._r[5]=o>>>1&8190;var a=e[10]|e[11]<<8;this._r[6]=(o>>>14|a<<2)&8191;var u=e[12]|e[13]<<8;this._r[7]=(a>>>11|u<<5)&8065;var l=e[14]|e[15]<<8;this._r[8]=(u>>>8|l<<8)&8191,this._r[9]=l>>>5&127,this._pad[0]=e[16]|e[17]<<8,this._pad[1]=e[18]|e[19]<<8,this._pad[2]=e[20]|e[21]<<8,this._pad[3]=e[22]|e[23]<<8,this._pad[4]=e[24]|e[25]<<8,this._pad[5]=e[26]|e[27]<<8,this._pad[6]=e[28]|e[29]<<8,this._pad[7]=e[30]|e[31]<<8}return t.prototype._blocks=function(e,r,n){for(var i=this._fin?0:2048,s=this._h[0],o=this._h[1],a=this._h[2],u=this._h[3],l=this._h[4],f=this._h[5],d=this._h[6],y=this._h[7],m=this._h[8],v=this._h[9],T=this._r[0],B=this._r[1],A=this._r[2],D=this._r[3],x=this._r[4],R=this._r[5],P=this._r[6],L=this._r[7],_=this._r[8],C=this._r[9];n>=16;){var M=e[r+0]|e[r+1]<<8;s+=M&8191;var Z=e[r+2]|e[r+3]<<8;o+=(M>>>13|Z<<3)&8191;var z=e[r+4]|e[r+5]<<8;a+=(Z>>>10|z<<6)&8191;var H=e[r+6]|e[r+7]<<8;u+=(z>>>7|H<<9)&8191;var G=e[r+8]|e[r+9]<<8;l+=(H>>>4|G<<12)&8191,f+=G>>>1&8191;var $=e[r+10]|e[r+11]<<8;d+=(G>>>14|$<<2)&8191;var de=e[r+12]|e[r+13]<<8;y+=($>>>11|de<<5)&8191;var ae=e[r+14]|e[r+15]<<8;m+=(de>>>8|ae<<8)&8191,v+=ae>>>5|i;var re=0,Y=re;Y+=s*T,Y+=o*(5*C),Y+=a*(5*_),Y+=u*(5*L),Y+=l*(5*P),re=Y>>>13,Y&=8191,Y+=f*(5*R),Y+=d*(5*x),Y+=y*(5*D),Y+=m*(5*A),Y+=v*(5*B),re+=Y>>>13,Y&=8191;var ie=re;ie+=s*B,ie+=o*T,ie+=a*(5*C),ie+=u*(5*_),ie+=l*(5*L),re=ie>>>13,ie&=8191,ie+=f*(5*P),ie+=d*(5*R),ie+=y*(5*x),ie+=m*(5*D),ie+=v*(5*A),re+=ie>>>13,ie&=8191;var te=re;te+=s*A,te+=o*B,te+=a*T,te+=u*(5*C),te+=l*(5*_),re=te>>>13,te&=8191,te+=f*(5*L),te+=d*(5*P),te+=y*(5*R),te+=m*(5*x),te+=v*(5*D),re+=te>>>13,te&=8191;var ne=re;ne+=s*D,ne+=o*A,ne+=a*B,ne+=u*T,ne+=l*(5*C),re=ne>>>13,ne&=8191,ne+=f*(5*_),ne+=d*(5*L),ne+=y*(5*P),ne+=m*(5*R),ne+=v*(5*x),re+=ne>>>13,ne&=8191;var q=re;q+=s*x,q+=o*D,q+=a*A,q+=u*B,q+=l*T,re=q>>>13,q&=8191,q+=f*(5*C),q+=d*(5*_),q+=y*(5*L),q+=m*(5*P),q+=v*(5*R),re+=q>>>13,q&=8191;var ce=re;ce+=s*R,ce+=o*x,ce+=a*D,ce+=u*A,ce+=l*B,re=ce>>>13,ce&=8191,ce+=f*T,ce+=d*(5*C),ce+=y*(5*_),ce+=m*(5*L),ce+=v*(5*P),re+=ce>>>13,ce&=8191;var oe=re;oe+=s*P,oe+=o*R,oe+=a*x,oe+=u*D,oe+=l*A,re=oe>>>13,oe&=8191,oe+=f*B,oe+=d*T,oe+=y*(5*C),oe+=m*(5*_),oe+=v*(5*L),re+=oe>>>13,oe&=8191;var le=re;le+=s*L,le+=o*P,le+=a*R,le+=u*x,le+=l*D,re=le>>>13,le&=8191,le+=f*A,le+=d*B,le+=y*T,le+=m*(5*C),le+=v*(5*_),re+=le>>>13,le&=8191;var se=re;se+=s*_,se+=o*L,se+=a*P,se+=u*R,se+=l*x,re=se>>>13,se&=8191,se+=f*D,se+=d*A,se+=y*B,se+=m*T,se+=v*(5*C),re+=se>>>13,se&=8191;var ue=re;ue+=s*C,ue+=o*_,ue+=a*L,ue+=u*P,ue+=l*R,re=ue>>>13,ue&=8191,ue+=f*x,ue+=d*D,ue+=y*A,ue+=m*B,ue+=v*T,re+=ue>>>13,ue&=8191,re=(re<<2)+re|0,re=re+Y|0,Y=re&8191,re=re>>>13,ie+=re,s=Y,o=ie,a=te,u=ne,l=q,f=ce,d=oe,y=le,m=se,v=ue,r+=16,n-=16}this._h[0]=s,this._h[1]=o,this._h[2]=a,this._h[3]=u,this._h[4]=l,this._h[5]=f,this._h[6]=d,this._h[7]=y,this._h[8]=m,this._h[9]=v},t.prototype.finish=function(e,r){r===void 0&&(r=0);var n=new Uint16Array(10),i,s,o,a;if(this._leftover){for(a=this._leftover,this._buffer[a++]=1;a<16;a++)this._buffer[a]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(i=this._h[1]>>>13,this._h[1]&=8191,a=2;a<10;a++)this._h[a]+=i,i=this._h[a]>>>13,this._h[a]&=8191;for(this._h[0]+=i*5,i=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=i,i=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=i,n[0]=this._h[0]+5,i=n[0]>>>13,n[0]&=8191,a=1;a<10;a++)n[a]=this._h[a]+i,i=n[a]>>>13,n[a]&=8191;for(n[9]-=8192,s=(i^1)-1,a=0;a<10;a++)n[a]&=s;for(s=~s,a=0;a<10;a++)this._h[a]=this._h[a]&s|n[a];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,o=this._h[0]+this._pad[0],this._h[0]=o&65535,a=1;a<8;a++)o=(this._h[a]+this._pad[a]|0)+(o>>>16)|0,this._h[a]=o&65535;return e[r+0]=this._h[0]>>>0,e[r+1]=this._h[0]>>>8,e[r+2]=this._h[1]>>>0,e[r+3]=this._h[1]>>>8,e[r+4]=this._h[2]>>>0,e[r+5]=this._h[2]>>>8,e[r+6]=this._h[3]>>>0,e[r+7]=this._h[3]>>>8,e[r+8]=this._h[4]>>>0,e[r+9]=this._h[4]>>>8,e[r+10]=this._h[5]>>>0,e[r+11]=this._h[5]>>>8,e[r+12]=this._h[6]>>>0,e[r+13]=this._h[6]>>>8,e[r+14]=this._h[7]>>>0,e[r+15]=this._h[7]>>>8,this._finished=!0,this},t.prototype.update=function(e){var r=0,n=e.length,i;if(this._leftover){i=16-this._leftover,i>n&&(i=n);for(var s=0;s=16&&(i=n-n%16,this._blocks(e,r,i),r+=i,n-=i),n){for(var s=0;s{"use strict";c();Object.defineProperty(Zn,"__esModule",{value:!0});var yp=KO(),AQ=JO(),Tl=Or(),XO=Au(),bQ=pp();Zn.KEY_LENGTH=32;Zn.NONCE_LENGTH=12;Zn.TAG_LENGTH=16;var ZO=new Uint8Array(16),_Q=function(){function t(e){if(this.nonceLength=Zn.NONCE_LENGTH,this.tagLength=Zn.TAG_LENGTH,e.length!==Zn.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);yp.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 yp.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),Tl.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(ZO.subarray(i.length%16))),s.update(n),n.length%16>0&&s.update(ZO.subarray(n.length%16));var o=new Uint8Array(8);i&&XO.writeUint64LE(i.length,o),s.update(o),XO.writeUint64LE(n.length,o),s.update(o);for(var a=s.digest(),u=0;u{"use strict";c();Object.defineProperty(Ev,"__esModule",{value:!0});function IQ(t){return typeof t.saveState<"u"&&typeof t.restoreState<"u"&&typeof t.cleanSavedState<"u"}Ev.isSerializableHash=IQ});var nD=w(xl=>{"use strict";c();Object.defineProperty(xl,"__esModule",{value:!0});var Sn=tD(),SQ=pp(),CQ=Or(),rD=function(){function t(e,r){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var n=new Uint8Array(this.blockSize);r.length>this.blockSize?this._inner.update(r).finish(n).clean():n.set(r);for(var i=0;i{"use strict";c();Object.defineProperty(vv,"__esModule",{value:!0});var iD=nD(),sD=Or(),xQ=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=iD.hmac(this._hash,n,r);this._hmac=new iD.HMAC(e,s),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return t.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(e===0)throw new Error("hkdf: cannot expand more");this._hmac.reset(),e>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},t.prototype.expand=function(e){for(var r=new Uint8Array(e),n=0;n{"use strict";c();Object.defineProperty(Hi,"__esModule",{value:!0});var wp=Au(),mp=Or();Hi.DIGEST_LENGTH=32;Hi.BLOCK_SIZE=64;var aD=function(){function t(){this.digestLength=Hi.DIGEST_LENGTH,this.blockSize=Hi.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(){mp.wipe(this._buffer),mp.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&&(Av(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(n=Av(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){mp.wipe(e.state),e.buffer&&mp.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},t}();Hi.SHA256=aD;var NQ=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 Av(t,e,r,n,i){for(;i>=64;){for(var s=e[0],o=e[1],a=e[2],u=e[3],l=e[4],f=e[5],d=e[6],y=e[7],m=0;m<16;m++){var v=n+m*4;t[m]=wp.readUint32BE(r,v)}for(var m=16;m<64;m++){var T=t[m-2],B=(T>>>17|T<<32-17)^(T>>>19|T<<32-19)^T>>>10;T=t[m-15];var A=(T>>>7|T<<32-7)^(T>>>18|T<<32-18)^T>>>3;t[m]=(B+t[m-7]|0)+(A+t[m-16]|0)}for(var m=0;m<64;m++){var B=(((l>>>6|l<<26)^(l>>>11|l<<21)^(l>>>25|l<<7))+(l&f^~l&d)|0)+(y+(NQ[m]+t[m]|0)|0)|0,A=((s>>>2|s<<32-2)^(s>>>13|s<<32-13)^(s>>>22|s<<32-22))+(s&o^s&a^o&a)|0;y=d,d=f,f=l,l=u+B|0,u=a,a=o,o=s,s=B+A|0}e[0]+=s,e[1]+=o,e[2]+=a,e[3]+=u,e[4]+=l,e[5]+=f,e[6]+=d,e[7]+=y,n+=64,i-=64}return n}function OQ(t){var e=new aD;e.update(t);var r=e.digest();return e.clean(),r}Hi.hash=OQ});var hD=w(lt=>{"use strict";c();Object.defineProperty(lt,"__esModule",{value:!0});lt.sharedKey=lt.generateKeyPair=lt.generateKeyPairFromSeed=lt.scalarMultBase=lt.scalarMult=lt.SHARED_KEY_LENGTH=lt.SECRET_KEY_LENGTH=lt.PUBLIC_KEY_LENGTH=void 0;var DQ=gl(),PQ=Or();lt.PUBLIC_KEY_LENGTH=32;lt.SECRET_KEY_LENGTH=32;lt.SHARED_KEY_LENGTH=32;function Cn(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,Nl(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 LQ(t,e){for(let r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function Ep(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]+r[n]}function vp(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]-r[n]}function ei(t,e,r){let n,i,s=0,o=0,a=0,u=0,l=0,f=0,d=0,y=0,m=0,v=0,T=0,B=0,A=0,D=0,x=0,R=0,P=0,L=0,_=0,C=0,M=0,Z=0,z=0,H=0,G=0,$=0,de=0,ae=0,re=0,Y=0,ie=0,te=r[0],ne=r[1],q=r[2],ce=r[3],oe=r[4],le=r[5],se=r[6],ue=r[7],g=r[8],E=r[9],b=r[10],O=r[11],I=r[12],N=r[13],F=r[14],S=r[15];n=e[0],s+=n*te,o+=n*ne,a+=n*q,u+=n*ce,l+=n*oe,f+=n*le,d+=n*se,y+=n*ue,m+=n*g,v+=n*E,T+=n*b,B+=n*O,A+=n*I,D+=n*N,x+=n*F,R+=n*S,n=e[1],o+=n*te,a+=n*ne,u+=n*q,l+=n*ce,f+=n*oe,d+=n*le,y+=n*se,m+=n*ue,v+=n*g,T+=n*E,B+=n*b,A+=n*O,D+=n*I,x+=n*N,R+=n*F,P+=n*S,n=e[2],a+=n*te,u+=n*ne,l+=n*q,f+=n*ce,d+=n*oe,y+=n*le,m+=n*se,v+=n*ue,T+=n*g,B+=n*E,A+=n*b,D+=n*O,x+=n*I,R+=n*N,P+=n*F,L+=n*S,n=e[3],u+=n*te,l+=n*ne,f+=n*q,d+=n*ce,y+=n*oe,m+=n*le,v+=n*se,T+=n*ue,B+=n*g,A+=n*E,D+=n*b,x+=n*O,R+=n*I,P+=n*N,L+=n*F,_+=n*S,n=e[4],l+=n*te,f+=n*ne,d+=n*q,y+=n*ce,m+=n*oe,v+=n*le,T+=n*se,B+=n*ue,A+=n*g,D+=n*E,x+=n*b,R+=n*O,P+=n*I,L+=n*N,_+=n*F,C+=n*S,n=e[5],f+=n*te,d+=n*ne,y+=n*q,m+=n*ce,v+=n*oe,T+=n*le,B+=n*se,A+=n*ue,D+=n*g,x+=n*E,R+=n*b,P+=n*O,L+=n*I,_+=n*N,C+=n*F,M+=n*S,n=e[6],d+=n*te,y+=n*ne,m+=n*q,v+=n*ce,T+=n*oe,B+=n*le,A+=n*se,D+=n*ue,x+=n*g,R+=n*E,P+=n*b,L+=n*O,_+=n*I,C+=n*N,M+=n*F,Z+=n*S,n=e[7],y+=n*te,m+=n*ne,v+=n*q,T+=n*ce,B+=n*oe,A+=n*le,D+=n*se,x+=n*ue,R+=n*g,P+=n*E,L+=n*b,_+=n*O,C+=n*I,M+=n*N,Z+=n*F,z+=n*S,n=e[8],m+=n*te,v+=n*ne,T+=n*q,B+=n*ce,A+=n*oe,D+=n*le,x+=n*se,R+=n*ue,P+=n*g,L+=n*E,_+=n*b,C+=n*O,M+=n*I,Z+=n*N,z+=n*F,H+=n*S,n=e[9],v+=n*te,T+=n*ne,B+=n*q,A+=n*ce,D+=n*oe,x+=n*le,R+=n*se,P+=n*ue,L+=n*g,_+=n*E,C+=n*b,M+=n*O,Z+=n*I,z+=n*N,H+=n*F,G+=n*S,n=e[10],T+=n*te,B+=n*ne,A+=n*q,D+=n*ce,x+=n*oe,R+=n*le,P+=n*se,L+=n*ue,_+=n*g,C+=n*E,M+=n*b,Z+=n*O,z+=n*I,H+=n*N,G+=n*F,$+=n*S,n=e[11],B+=n*te,A+=n*ne,D+=n*q,x+=n*ce,R+=n*oe,P+=n*le,L+=n*se,_+=n*ue,C+=n*g,M+=n*E,Z+=n*b,z+=n*O,H+=n*I,G+=n*N,$+=n*F,de+=n*S,n=e[12],A+=n*te,D+=n*ne,x+=n*q,R+=n*ce,P+=n*oe,L+=n*le,_+=n*se,C+=n*ue,M+=n*g,Z+=n*E,z+=n*b,H+=n*O,G+=n*I,$+=n*N,de+=n*F,ae+=n*S,n=e[13],D+=n*te,x+=n*ne,R+=n*q,P+=n*ce,L+=n*oe,_+=n*le,C+=n*se,M+=n*ue,Z+=n*g,z+=n*E,H+=n*b,G+=n*O,$+=n*I,de+=n*N,ae+=n*F,re+=n*S,n=e[14],x+=n*te,R+=n*ne,P+=n*q,L+=n*ce,_+=n*oe,C+=n*le,M+=n*se,Z+=n*ue,z+=n*g,H+=n*E,G+=n*b,$+=n*O,de+=n*I,ae+=n*N,re+=n*F,Y+=n*S,n=e[15],R+=n*te,P+=n*ne,L+=n*q,_+=n*ce,C+=n*oe,M+=n*le,Z+=n*se,z+=n*ue,H+=n*g,G+=n*E,$+=n*b,de+=n*O,ae+=n*I,re+=n*N,Y+=n*F,ie+=n*S,s+=38*P,o+=38*L,a+=38*_,u+=38*C,l+=38*M,f+=38*Z,d+=38*z,y+=38*H,m+=38*G,v+=38*$,T+=38*de,B+=38*ae,A+=38*re,D+=38*Y,x+=38*ie,i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=l+i+65535,i=Math.floor(n/65536),l=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=m+i+65535,i=Math.floor(n/65536),m=n-i*65536,n=v+i+65535,i=Math.floor(n/65536),v=n-i*65536,n=T+i+65535,i=Math.floor(n/65536),T=n-i*65536,n=B+i+65535,i=Math.floor(n/65536),B=n-i*65536,n=A+i+65535,i=Math.floor(n/65536),A=n-i*65536,n=D+i+65535,i=Math.floor(n/65536),D=n-i*65536,n=x+i+65535,i=Math.floor(n/65536),x=n-i*65536,n=R+i+65535,i=Math.floor(n/65536),R=n-i*65536,s+=i-1+37*(i-1),i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=l+i+65535,i=Math.floor(n/65536),l=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=m+i+65535,i=Math.floor(n/65536),m=n-i*65536,n=v+i+65535,i=Math.floor(n/65536),v=n-i*65536,n=T+i+65535,i=Math.floor(n/65536),T=n-i*65536,n=B+i+65535,i=Math.floor(n/65536),B=n-i*65536,n=A+i+65535,i=Math.floor(n/65536),A=n-i*65536,n=D+i+65535,i=Math.floor(n/65536),D=n-i*65536,n=x+i+65535,i=Math.floor(n/65536),x=n-i*65536,n=R+i+65535,i=Math.floor(n/65536),R=n-i*65536,s+=i-1+37*(i-1),t[0]=s,t[1]=o,t[2]=a,t[3]=u,t[4]=l,t[5]=f,t[6]=d,t[7]=y,t[8]=m,t[9]=v,t[10]=T,t[11]=B,t[12]=A,t[13]=D,t[14]=x,t[15]=R}function Ol(t,e){ei(t,e,e)}function FQ(t,e){let r=Cn();for(let n=0;n<16;n++)r[n]=e[n];for(let n=253;n>=0;n--)Ol(r,r),n!==2&&n!==4&&ei(r,r,e);for(let n=0;n<16;n++)t[n]=r[n]}function _v(t,e){let r=new Uint8Array(32),n=new Float64Array(80),i=Cn(),s=Cn(),o=Cn(),a=Cn(),u=Cn(),l=Cn();for(let m=0;m<31;m++)r[m]=t[m];r[31]=t[31]&127|64,r[0]&=248,LQ(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 v=r[m>>>3]>>>(m&7)&1;Nl(i,s,v),Nl(o,a,v),Ep(u,i,o),vp(i,i,o),Ep(o,s,a),vp(s,s,a),Ol(a,u),Ol(l,i),ei(i,o,i),ei(o,s,u),Ep(u,i,o),vp(i,i,o),Ol(s,i),vp(o,a,l),ei(i,o,RQ),Ep(i,i,a),ei(o,o,i),ei(i,a,l),ei(a,s,n),Ol(s,u),Nl(i,s,v),Nl(o,a,v)}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);FQ(f,f),ei(d,d,f);let y=new Uint8Array(32);return BQ(y,d),y}lt.scalarMult=_v;function lD(t){return _v(t,cD)}lt.scalarMultBase=lD;function fD(t){if(t.length!==lt.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${lt.SECRET_KEY_LENGTH} bytes`);let e=new Uint8Array(t);return{publicKey:lD(e),secretKey:e}}lt.generateKeyPairFromSeed=fD;function MQ(t){let e=(0,DQ.randomBytes)(32,t),r=fD(e);return(0,PQ.wipe)(e),r}lt.generateKeyPair=MQ;function UQ(t,e,r=!1){if(t.length!==lt.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(e.length!==lt.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");let n=_v(t,e);if(r){let i=0;for(let s=0;se[r])return 1}return t.byteLength>e.byteLength?1:t.byteLength{c()});function gD(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r{c()});function mD(t,e){if(t.length!==e.length)throw new Error("Inputs should have the same length");let r=Tu(t.length);for(let n=0;n{c();op();El()});var Iv={};at(Iv,{compare:()=>dD,concat:()=>ap,equals:()=>gD,fromString:()=>In,toString:()=>Jn,xor:()=>mD});var Sv=ge(()=>{c();pD();U1();yD();fv();lv();wD()});var OD=w(Ze=>{"use strict";c();var ED=Ze&&Ze.__spreadArray||function(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,s;n"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new CD:typeof navigator<"u"?Cv(navigator.userAgent):ND()}Ze.detect=HQ;function TD(t){return t!==""&&jQ.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 GQ(t){var e=TD(t);return e?e[0]:null}Ze.browserName=GQ;function Cv(t){var e=TD(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new SD;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length{"use strict";c();Object.defineProperty(We,"__esModule",{value:!0});We.getLocalStorage=We.getLocalStorageOrThrow=We.getCrypto=We.getCryptoOrThrow=We.getLocation=We.getLocationOrThrow=We.getNavigator=We.getNavigatorOrThrow=We.getDocument=We.getDocumentOrThrow=We.getFromWindowOrThrow=We.getFromWindow=void 0;function yo(t){let e;return typeof window<"u"&&typeof window[t]<"u"&&(e=window[t]),e}We.getFromWindow=yo;function Lu(t){let e=yo(t);if(!e)throw new Error(`${t} is not defined in Window`);return e}We.getFromWindowOrThrow=Lu;function kQ(){return Lu("document")}We.getDocumentOrThrow=kQ;function zQ(){return yo("document")}We.getDocument=zQ;function WQ(){return Lu("navigator")}We.getNavigatorOrThrow=WQ;function KQ(){return yo("navigator")}We.getNavigator=KQ;function $Q(){return Lu("location")}We.getLocationOrThrow=$Q;function YQ(){return yo("location")}We.getLocation=YQ;function JQ(){return Lu("crypto")}We.getCryptoOrThrow=JQ;function XQ(){return yo("crypto")}We.getCrypto=XQ;function ZQ(){return Lu("localStorage")}We.getLocalStorageOrThrow=ZQ;function ek(){return yo("localStorage")}We.getLocalStorage=ek});var PD=w(Ap=>{"use strict";c();Object.defineProperty(Ap,"__esModule",{value:!0});Ap.getWindowMetadata=void 0;var DD=Tv();function tk(){let t,e;try{t=DD.getDocumentOrThrow(),e=DD.getLocationOrThrow()}catch{return null}function r(){let d=t.getElementsByTagName("link"),y=[];for(let m=0;m-1){let B=v.getAttribute("href");if(B)if(B.toLowerCase().indexOf("https:")===-1&&B.toLowerCase().indexOf("http:")===-1&&B.indexOf("//")!==0){let A=e.protocol+"//"+e.host;if(B.indexOf("/")===0)A+=B;else{let D=e.pathname.split("/");D.pop();let x=D.join("/");A+=x+"/"+B}y.push(A)}else if(B.indexOf("//")===0){let A=e.protocol+B;y.push(A)}else y.push(B)}}return y}function n(...d){let y=t.getElementsByTagName("meta");for(let m=0;mv.getAttribute(B)).filter(B=>B?d.includes(B):!1);if(T.length&&T){let B=v.getAttribute("content");if(B)return B}}return""}function i(){let d=n("name","og:site_name","og:title","twitter:title");return d||(d=t.title),d}function s(){return n("description","og:description","twitter:description","keywords")}let o=i(),a=s(),u=e.origin,l=r();return{description:a,url:u,icons:l,name:o}}Ap.getWindowMetadata=tk});var BD=w((ufe,RD)=>{"use strict";c();RD.exports=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)});var qD=w((lfe,UD)=>{"use strict";c();var MD="%[a-f0-9]{2}",LD=new RegExp("("+MD+")|([^%]+?)","gi"),FD=new RegExp("("+MD+")+","gi");function xv(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([],xv(r),xv(n))}function rk(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(LD)||[],r=1;r{"use strict";c();VD.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 GD=w((pfe,HD)=>{"use strict";c();HD.exports=function(t,e){for(var r={},n=Object.keys(t),i=Array.isArray(e),s=0;s{"use strict";c();var ik=BD(),sk=qD(),kD=jD(),ok=GD(),ak=t=>t==null,Nv=Symbol("encodeFragmentIdentifier");function uk(t){switch(t.arrayFormat){case"index":return e=>(r,n)=>{let i=r.length;return n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[pt(e,t),"[",i,"]"].join("")]:[...r,[pt(e,t),"[",pt(i,t),"]=",pt(n,t)].join("")]};case"bracket":return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[pt(e,t),"[]"].join("")]:[...r,[pt(e,t),"[]=",pt(n,t)].join("")];case"colon-list-separator":return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[pt(e,t),":list="].join("")]:[...r,[pt(e,t),":list=",pt(n,t)].join("")];case"comma":case"separator":case"bracket-separator":{let e=t.arrayFormat==="bracket-separator"?"[]=":"=";return r=>(n,i)=>i===void 0||t.skipNull&&i===null||t.skipEmptyString&&i===""?n:(i=i===null?"":i,n.length===0?[[pt(r,t),e,pt(i,t)].join("")]:[[n,pt(i,t)].join(t.arrayFormatSeparator)])}default:return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,pt(e,t)]:[...r,[pt(e,t),"=",pt(n,t)].join("")]}}function ck(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&&ti(n,t).includes(t.arrayFormatSeparator);n=o?ti(n,t):n;let a=s||o?n.split(t.arrayFormatSeparator).map(u=>ti(u,t)):n===null?n:ti(n,t);i[r]=a};case"bracket-separator":return(r,n,i)=>{let s=/(\[\])$/.test(r);if(r=r.replace(/\[\]$/,""),!s){i[r]=n&&ti(n,t);return}let o=n===null?[]:n.split(t.arrayFormatSeparator).map(a=>ti(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 zD(t){if(typeof t!="string"||t.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function pt(t,e){return e.encode?e.strict?ik(t):encodeURIComponent(t):t}function ti(t,e){return e.decode?sk(t):t}function WD(t){return Array.isArray(t)?t.sort():typeof t=="object"?WD(Object.keys(t)).sort((e,r)=>Number(e)-Number(r)).map(e=>t[e]):t}function KD(t){let e=t.indexOf("#");return e!==-1&&(t=t.slice(0,e)),t}function lk(t){let e="",r=t.indexOf("#");return r!==-1&&(e=t.slice(r)),e}function $D(t){t=KD(t);let e=t.indexOf("?");return e===-1?"":t.slice(e+1)}function QD(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 YD(t,e){e=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},e),zD(e.arrayFormatSeparator);let r=ck(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]=kD(e.decode?i.replace(/\+/g," "):i,"=");o=o===void 0?null:["comma","separator","bracket-separator"].includes(e.arrayFormat)?o:ti(o,e),r(ti(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]=QD(s[o],e);else n[i]=QD(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]=WD(o):i[s]=o,i},Object.create(null))}or.extract=$D;or.parse=YD;or.stringify=(t,e)=>{if(!t)return"";e=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},e),zD(e.arrayFormatSeparator);let r=o=>e.skipNull&&ak(t[o])||e.skipEmptyString&&t[o]==="",n=uk(e),i={};for(let o of Object.keys(t))r(o)||(i[o]=t[o]);let s=Object.keys(i);return e.sort!==!1&&s.sort(e.sort),s.map(o=>{let a=t[o];return a===void 0?"":a===null?pt(o,e):Array.isArray(a)?a.length===0&&e.arrayFormat==="bracket-separator"?pt(o,e)+"[]":a.reduce(n(o),[]).join("&"):pt(o,e)+"="+pt(a,e)}).filter(o=>o.length>0).join("&")};or.parseUrl=(t,e)=>{e=Object.assign({decode:!0},e);let[r,n]=kD(t,"#");return Object.assign({url:r.split("?")[0]||"",query:YD($D(t),e)},e&&e.parseFragmentIdentifier&&n?{fragmentIdentifier:ti(n,e)}:{})};or.stringifyUrl=(t,e)=>{e=Object.assign({encode:!0,strict:!0,[Nv]:!0},e);let r=KD(t.url).split("?")[0]||"",n=or.extract(t.url),i=or.parse(n,{sort:!1}),s=Object.assign(i,t.query),o=or.stringify(s,e);o&&(o=`?${o}`);let a=lk(t.url);return t.fragmentIdentifier&&(a=`#${e[Nv]?pt(t.fragmentIdentifier,e):t.fragmentIdentifier}`),`${r}${o}${a}`};or.pick=(t,e,r)=>{r=Object.assign({parseFragmentIdentifier:!0,[Nv]:!1},r);let{url:n,query:i,fragmentIdentifier:s}=or.parseUrl(t,r);return or.stringifyUrl({url:n,query:ok(i,e),fragmentIdentifier:s},r)};or.exclude=(t,e,r)=>{let n=Array.isArray(e)?i=>!e.includes(i):(i,s)=>!e(i,s);return or.pick(t,n,r)}});var XD=ge(()=>{c()});function Gi(t,e,r="string"){if(!t[e]||typeof t[e]!==r)throw new Error(`Missing or invalid "${e}" param`)}function fk(t,e){let r=!0;return e.forEach(n=>{n in t||(r=!1)}),r}function hk(t,e){return Array.isArray(t)?t.length===e:Object.keys(t).length===e}function dk(t,e){return Array.isArray(t)?t.length>=e:Object.keys(t).length>=e}function Dl(t,e,r){return(!r.length?hk(t,e.length):dk(t,e.length))?fk(t,e):!1}function Pl(t,e,r="_"){let n=t.split(r);return n[n.length-1].trim().toLowerCase()===e.trim().toLowerCase()}var Ov=ge(()=>{c()});function pk(t){return bp(t.method)&&_p(t.params)}function bp(t){return Pl(t,"subscribe")}function _p(t){return Dl(t,["topic"],[])}function gk(t){return Ip(t.method)&&Sp(t.params)}function Ip(t){return Pl(t,"publish")}function Sp(t){return Dl(t,["message","topic","ttl"],["prompt","tag"])}function yk(t){return Cp(t.method)&&Tp(t.params)}function Cp(t){return Pl(t,"unsubscribe")}function Tp(t){return Dl(t,["id","topic"],[])}function mk(t){return xp(t.method)&&Np(t.params)}function xp(t){return Pl(t,"subscription")}function Np(t){return Dl(t,["id","data"],[])}var Dv=ge(()=>{c();Ov()});function wk(t){if(!bp(t.method))throw new Error("JSON-RPC Request has invalid subscribe method");if(!_p(t.params))throw new Error("JSON-RPC Request has invalid subscribe params");let e=t.params;return Gi(e,"topic"),e}function Ek(t){if(!Ip(t.method))throw new Error("JSON-RPC Request has invalid publish method");if(!Sp(t.params))throw new Error("JSON-RPC Request has invalid publish params");let e=t.params;return Gi(e,"topic"),Gi(e,"message"),Gi(e,"ttl","number"),e}function vk(t){if(!Cp(t.method))throw new Error("JSON-RPC Request has invalid unsubscribe method");if(!Tp(t.params))throw new Error("JSON-RPC Request has invalid unsubscribe params");let e=t.params;return Gi(e,"id"),e}function Ak(t){if(!xp(t.method))throw new Error("JSON-RPC Request has invalid subscription method");if(!Np(t.params))throw new Error("JSON-RPC Request has invalid subscription params");let e=t.params;return Gi(e,"id"),Gi(e,"data"),e}var ZD=ge(()=>{c();Ov();Dv()});var bk,e3=ge(()=>{c();bk={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 t3={};at(t3,{RELAY_JSONRPC:()=>bk,isPublishMethod:()=>Ip,isPublishParams:()=>Sp,isPublishRequest:()=>gk,isSubscribeMethod:()=>bp,isSubscribeParams:()=>_p,isSubscribeRequest:()=>pk,isSubscriptionMethod:()=>xp,isSubscriptionParams:()=>Np,isSubscriptionRequest:()=>mk,isUnsubscribeMethod:()=>Cp,isUnsubscribeParams:()=>Tp,isUnsubscribeRequest:()=>yk,parsePublishRequest:()=>Ek,parseSubscribeRequest:()=>wk,parseSubscriptionRequest:()=>Ak,parseUnsubscribeRequest:()=>vk});var r3=ge(()=>{c();XD();ZD();e3();Dv()});var Vp=w(Q=>{"use strict";c();Object.defineProperty(Q,"__esModule",{value:!0});var h3=eD(),_k=oD(),d3=gl(),Lv=uD(),Ik=hD(),et=(Sv(),nt(Iv)),Sk=OD(),Mu=co(),Rl=Tv(),Ck=PD(),Tk=JD(),xk=(r3(),nt(t3));function p3(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 g3=p3(Ik),Op=p3(Tk),Rp=":";function y3(t){let[e,r]=t.split(Rp);return{namespace:e,reference:r}}function m3(t){let{namespace:e,reference:r}=t;return[e,r].join(Rp)}function Fv(t){let[e,r,n]=t.split(Rp);return{namespace:e,reference:r,address:n}}function w3(t){let{namespace:e,reference:r,address:n}=t;return[e,r,n].join(Rp)}function Mv(t,e){let r=[];return t.forEach(n=>{let i=e(n);r.includes(i)||r.push(i)}),r}function E3(t){let{address:e}=Fv(t);return e}function v3(t){let{namespace:e,reference:r}=Fv(t);return m3({namespace:e,reference:r})}function Nk(t,e){let{namespace:r,reference:n}=y3(e);return w3({namespace:r,reference:n,address:t})}function Ok(t){return Mv(t,E3)}function A3(t){return Mv(t,v3)}function Dk(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 Pk(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...A3(i.accounts))}),r}function Rk(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...Bp(n,i))}),r}function Bp(t,e){return t.includes(":")?[t]:e.chains||[]}var Lp=t=>t?.split(":"),b3=t=>{let e=t&&Lp(t);if(e)return e[3]},Bk=t=>{let e=t&&Lp(t);if(e)return e[2]+":"+e[3]},_3=t=>{let e=t&&Lp(t);if(e)return e.pop()},Lk=(t,e)=>{let r=`${t.domain} wants you to sign in with your Ethereum account:`,n=_3(e),i=t.statement,s=`URI: ${t.aud}`,o=`Version: ${t.version}`,a=`Chain ID: ${b3(e)}`,u=`Nonce: ${t.nonce}`,l=`Issued At: ${t.iat}`,f=t.resources&&t.resources.length>0?`Resources: +`});var gD=ge(()=>{c();pD();Zd();Ri();T1();Hc()});var O1,Ofe,yD=ge(()=>{c();G2();k2();Q2();W2();z2();E1();$2();A1();K2();J2();oD();cD();lD();fD();gD();O1={...h1,...d1,...p1,...g1,...y1,...m1,...w1,...v1,...b1,..._1},Ofe={...x1,...N1}});function ED(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var mD,D1,vQ,np,P1=ge(()=>{c();yD();Yd();mD=ED("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),D1=ED("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);let e=Ta(t.length);for(let r=0;r{c();P1()});function In(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?Pi(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}var B1=ge(()=>{c();P1();Mc()});function Gc(t){return Dc($n(In(t,Sa),Gd))}function kc(t){return $n(In(Pc(t),Gd),Sa)}function L1(t){let e=In($d,Ca),r=zd+$n(Jd([e,t]),Ca);return[Qd,Wd,r].join(kd)}function F1(t){let[e,r,n]=t.split(kd);if(e!==Qd||r!==Wd)throw new Error('Issuer must be a DID with method "key"');if(n.slice(0,1)!==zd)throw new Error("Issuer must be a key in mulicodec format");let s=In(n.slice(1),Ca);if($n(s.slice(0,2),Ca)!==$d)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 wD(t){return $n(t,Sa)}function vD(t){return In(t,Sa)}function M1(t){return In([kc(t.header),kc(t.payload)].join(qs),Fc)}function AQ(t){let e=$n(t,Fc).split(qs),r=Gc(e[0]),n=Gc(e[1]);return{header:r,payload:n}}function U1(t){return[kc(t.header),kc(t.payload),wD(t.signature)].join(qs)}function q1(t){let e=t.split(qs),r=Gc(e[0]),n=Gc(e[1]),i=vD(e[2]),s=In(e.slice(0,2).join(qs),Fc);return{header:r,payload:n,signature:i,data:s}}var V1=ge(()=>{c();a1();R1();B1();Ld();Kd()});function bQ(t=(0,AD.randomBytes)(32)){return Ra.generateKeyPairFromSeed(t)}async function _Q(t,e,r,n,i=(0,bD.fromMiliseconds)(Date.now())){let s={alg:Hd,typ:jd},o=L1(n.publicKey),a=i+r,u={iss:o,sub:t,aud:e,iat:i,exp:a},l=M1({header:s,payload:u}),f=Ra.sign(n.secretKey,l);return U1({header:s,payload:u,signature:f})}async function IQ(t){let{header:e,payload:r,data:n,signature:i}=q1(t);if(e.alg!==Hd||e.typ!==jd)throw new Error("JWT must use EdDSA algorithm");let s=F1(r.iss);return Ra.verify(s,n,i)}var Ra,AD,bD,_D=ge(()=>{c();Ra=Ie(R2()),AD=Ie(Rc()),bD=Ie(Ls());Kd();V1()});var ID=ge(()=>{c()});var SD={};ft(SD,{DATA_ENCODING:()=>Fc,DID_DELIMITER:()=>kd,DID_METHOD:()=>Wd,DID_PREFIX:()=>Qd,JSON_ENCODING:()=>Gd,JWT_DELIMITER:()=>qs,JWT_ENCODING:()=>Sa,JWT_IRIDIUM_ALG:()=>Hd,JWT_IRIDIUM_TYP:()=>jd,KEY_PAIR_SEED_LENGTH:()=>L2,MULTICODEC_ED25519_BASE:()=>zd,MULTICODEC_ED25519_ENCODING:()=>Ca,MULTICODEC_ED25519_HEADER:()=>$d,MULTICODEC_ED25519_LENGTH:()=>B2,decodeData:()=>AQ,decodeIss:()=>F1,decodeJSON:()=>Gc,decodeJWT:()=>q1,decodeSig:()=>vD,encodeData:()=>M1,encodeIss:()=>L1,encodeJSON:()=>kc,encodeJWT:()=>U1,encodeSig:()=>wD,generateKeyPair:()=>bQ,signJWT:()=>_Q,verifyJWT:()=>IQ});var CD=ge(()=>{c();_D();Kd();ID();V1()});var xD=m(ip=>{"use strict";c();Object.defineProperty(ip,"__esModule",{value:!0});var Yt=Aa(),H1=Fr(),SQ=20;function CQ(t,e,r){for(var n=1634760805,i=857760878,s=2036477234,o=1797285236,a=r[3]<<24|r[2]<<16|r[1]<<8|r[0],u=r[7]<<24|r[6]<<16|r[5]<<8|r[4],l=r[11]<<24|r[10]<<16|r[9]<<8|r[8],f=r[15]<<24|r[14]<<16|r[13]<<8|r[12],d=r[19]<<24|r[18]<<16|r[17]<<8|r[16],g=r[23]<<24|r[22]<<16|r[21]<<8|r[20],E=r[27]<<24|r[26]<<16|r[25]<<8|r[24],v=r[31]<<24|r[30]<<16|r[29]<<8|r[28],N=e[3]<<24|e[2]<<16|e[1]<<8|e[0],O=e[7]<<24|e[6]<<16|e[5]<<8|e[4],F=e[11]<<24|e[10]<<16|e[9]<<8|e[8],_=e[15]<<24|e[14]<<16|e[13]<<8|e[12],I=n,S=i,R=s,B=o,b=a,C=u,L=l,X=f,W=d,j=g,G=E,K=v,de=N,ue=O,re=F,Y=_,se=0;se>>32-16|de<<16,W=W+de|0,b^=W,b=b>>>32-12|b<<12,S=S+C|0,ue^=S,ue=ue>>>32-16|ue<<16,j=j+ue|0,C^=j,C=C>>>32-12|C<<12,R=R+L|0,re^=R,re=re>>>32-16|re<<16,G=G+re|0,L^=G,L=L>>>32-12|L<<12,B=B+X|0,Y^=B,Y=Y>>>32-16|Y<<16,K=K+Y|0,X^=K,X=X>>>32-12|X<<12,R=R+L|0,re^=R,re=re>>>32-8|re<<8,G=G+re|0,L^=G,L=L>>>32-7|L<<7,B=B+X|0,Y^=B,Y=Y>>>32-8|Y<<8,K=K+Y|0,X^=K,X=X>>>32-7|X<<7,S=S+C|0,ue^=S,ue=ue>>>32-8|ue<<8,j=j+ue|0,C^=j,C=C>>>32-7|C<<7,I=I+b|0,de^=I,de=de>>>32-8|de<<8,W=W+de|0,b^=W,b=b>>>32-7|b<<7,I=I+C|0,Y^=I,Y=Y>>>32-16|Y<<16,G=G+Y|0,C^=G,C=C>>>32-12|C<<12,S=S+L|0,de^=S,de=de>>>32-16|de<<16,K=K+de|0,L^=K,L=L>>>32-12|L<<12,R=R+X|0,ue^=R,ue=ue>>>32-16|ue<<16,W=W+ue|0,X^=W,X=X>>>32-12|X<<12,B=B+b|0,re^=B,re=re>>>32-16|re<<16,j=j+re|0,b^=j,b=b>>>32-12|b<<12,R=R+X|0,ue^=R,ue=ue>>>32-8|ue<<8,W=W+ue|0,X^=W,X=X>>>32-7|X<<7,B=B+b|0,re^=B,re=re>>>32-8|re<<8,j=j+re|0,b^=j,b=b>>>32-7|b<<7,S=S+L|0,de^=S,de=de>>>32-8|de<<8,K=K+de|0,L^=K,L=L>>>32-7|L<<7,I=I+C|0,Y^=I,Y=Y>>>32-8|Y<<8,G=G+Y|0,C^=G,C=C>>>32-7|C<<7;Yt.writeUint32LE(I+n|0,t,0),Yt.writeUint32LE(S+i|0,t,4),Yt.writeUint32LE(R+s|0,t,8),Yt.writeUint32LE(B+o|0,t,12),Yt.writeUint32LE(b+a|0,t,16),Yt.writeUint32LE(C+u|0,t,20),Yt.writeUint32LE(L+l|0,t,24),Yt.writeUint32LE(X+f|0,t,28),Yt.writeUint32LE(W+d|0,t,32),Yt.writeUint32LE(j+g|0,t,36),Yt.writeUint32LE(G+E|0,t,40),Yt.writeUint32LE(K+v|0,t,44),Yt.writeUint32LE(de+N|0,t,48),Yt.writeUint32LE(ue+O|0,t,52),Yt.writeUint32LE(re+F|0,t,56),Yt.writeUint32LE(Y+_|0,t,60)}function TD(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 sp=m(Ba=>{"use strict";c();Object.defineProperty(Ba,"__esModule",{value:!0});function NQ(t,e,r){return~(t-1)&e|t-1&r}Ba.select=NQ;function OQ(t,e){return(t|0)-(e|0)-1>>>31&1}Ba.lessOrEqual=OQ;function ND(t,e){if(t.length!==e.length)return 0;for(var r=0,n=0;n>>8}Ba.compare=ND;function DQ(t,e){return t.length===0||e.length===0?!1:ND(t,e)!==0}Ba.equal=DQ});var DD=m(Kn=>{"use strict";c();Object.defineProperty(Kn,"__esModule",{value:!0});var PQ=sp(),op=Fr();Kn.DIGEST_LENGTH=16;var OD=function(){function t(e){this.digestLength=Kn.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var r=e[0]|e[1]<<8;this._r[0]=r&8191;var n=e[2]|e[3]<<8;this._r[1]=(r>>>13|n<<3)&8191;var i=e[4]|e[5]<<8;this._r[2]=(n>>>10|i<<6)&7939;var s=e[6]|e[7]<<8;this._r[3]=(i>>>7|s<<9)&8191;var o=e[8]|e[9]<<8;this._r[4]=(s>>>4|o<<12)&255,this._r[5]=o>>>1&8190;var a=e[10]|e[11]<<8;this._r[6]=(o>>>14|a<<2)&8191;var u=e[12]|e[13]<<8;this._r[7]=(a>>>11|u<<5)&8065;var l=e[14]|e[15]<<8;this._r[8]=(u>>>8|l<<8)&8191,this._r[9]=l>>>5&127,this._pad[0]=e[16]|e[17]<<8,this._pad[1]=e[18]|e[19]<<8,this._pad[2]=e[20]|e[21]<<8,this._pad[3]=e[22]|e[23]<<8,this._pad[4]=e[24]|e[25]<<8,this._pad[5]=e[26]|e[27]<<8,this._pad[6]=e[28]|e[29]<<8,this._pad[7]=e[30]|e[31]<<8}return t.prototype._blocks=function(e,r,n){for(var i=this._fin?0:2048,s=this._h[0],o=this._h[1],a=this._h[2],u=this._h[3],l=this._h[4],f=this._h[5],d=this._h[6],g=this._h[7],E=this._h[8],v=this._h[9],N=this._r[0],O=this._r[1],F=this._r[2],_=this._r[3],I=this._r[4],S=this._r[5],R=this._r[6],B=this._r[7],b=this._r[8],C=this._r[9];n>=16;){var L=e[r+0]|e[r+1]<<8;s+=L&8191;var X=e[r+2]|e[r+3]<<8;o+=(L>>>13|X<<3)&8191;var W=e[r+4]|e[r+5]<<8;a+=(X>>>10|W<<6)&8191;var j=e[r+6]|e[r+7]<<8;u+=(W>>>7|j<<9)&8191;var G=e[r+8]|e[r+9]<<8;l+=(j>>>4|G<<12)&8191,f+=G>>>1&8191;var K=e[r+10]|e[r+11]<<8;d+=(G>>>14|K<<2)&8191;var de=e[r+12]|e[r+13]<<8;g+=(K>>>11|de<<5)&8191;var ue=e[r+14]|e[r+15]<<8;E+=(de>>>8|ue<<8)&8191,v+=ue>>>5|i;var re=0,Y=re;Y+=s*N,Y+=o*(5*C),Y+=a*(5*b),Y+=u*(5*B),Y+=l*(5*R),re=Y>>>13,Y&=8191,Y+=f*(5*S),Y+=d*(5*I),Y+=g*(5*_),Y+=E*(5*F),Y+=v*(5*O),re+=Y>>>13,Y&=8191;var se=re;se+=s*O,se+=o*N,se+=a*(5*C),se+=u*(5*b),se+=l*(5*B),re=se>>>13,se&=8191,se+=f*(5*R),se+=d*(5*S),se+=g*(5*I),se+=E*(5*_),se+=v*(5*F),re+=se>>>13,se&=8191;var te=re;te+=s*F,te+=o*O,te+=a*N,te+=u*(5*C),te+=l*(5*b),re=te>>>13,te&=8191,te+=f*(5*B),te+=d*(5*R),te+=g*(5*S),te+=E*(5*I),te+=v*(5*_),re+=te>>>13,te&=8191;var ie=re;ie+=s*_,ie+=o*F,ie+=a*O,ie+=u*N,ie+=l*(5*C),re=ie>>>13,ie&=8191,ie+=f*(5*b),ie+=d*(5*B),ie+=g*(5*R),ie+=E*(5*S),ie+=v*(5*I),re+=ie>>>13,ie&=8191;var q=re;q+=s*I,q+=o*_,q+=a*F,q+=u*O,q+=l*N,re=q>>>13,q&=8191,q+=f*(5*C),q+=d*(5*b),q+=g*(5*B),q+=E*(5*R),q+=v*(5*S),re+=q>>>13,q&=8191;var le=re;le+=s*S,le+=o*I,le+=a*_,le+=u*F,le+=l*O,re=le>>>13,le&=8191,le+=f*N,le+=d*(5*C),le+=g*(5*b),le+=E*(5*B),le+=v*(5*R),re+=le>>>13,le&=8191;var ae=re;ae+=s*R,ae+=o*S,ae+=a*I,ae+=u*_,ae+=l*F,re=ae>>>13,ae&=8191,ae+=f*O,ae+=d*N,ae+=g*(5*C),ae+=E*(5*b),ae+=v*(5*B),re+=ae>>>13,ae&=8191;var fe=re;fe+=s*B,fe+=o*R,fe+=a*S,fe+=u*I,fe+=l*_,re=fe>>>13,fe&=8191,fe+=f*F,fe+=d*O,fe+=g*N,fe+=E*(5*C),fe+=v*(5*b),re+=fe>>>13,fe&=8191;var oe=re;oe+=s*b,oe+=o*B,oe+=a*R,oe+=u*S,oe+=l*I,re=oe>>>13,oe&=8191,oe+=f*_,oe+=d*F,oe+=g*O,oe+=E*N,oe+=v*(5*C),re+=oe>>>13,oe&=8191;var ce=re;ce+=s*C,ce+=o*b,ce+=a*B,ce+=u*R,ce+=l*S,re=ce>>>13,ce&=8191,ce+=f*I,ce+=d*_,ce+=g*F,ce+=E*O,ce+=v*N,re+=ce>>>13,ce&=8191,re=(re<<2)+re|0,re=re+Y|0,Y=re&8191,re=re>>>13,se+=re,s=Y,o=se,a=te,u=ie,l=q,f=le,d=ae,g=fe,E=oe,v=ce,r+=16,n-=16}this._h[0]=s,this._h[1]=o,this._h[2]=a,this._h[3]=u,this._h[4]=l,this._h[5]=f,this._h[6]=d,this._h[7]=g,this._h[8]=E,this._h[9]=v},t.prototype.finish=function(e,r){r===void 0&&(r=0);var n=new Uint16Array(10),i,s,o,a;if(this._leftover){for(a=this._leftover,this._buffer[a++]=1;a<16;a++)this._buffer[a]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(i=this._h[1]>>>13,this._h[1]&=8191,a=2;a<10;a++)this._h[a]+=i,i=this._h[a]>>>13,this._h[a]&=8191;for(this._h[0]+=i*5,i=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=i,i=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=i,n[0]=this._h[0]+5,i=n[0]>>>13,n[0]&=8191,a=1;a<10;a++)n[a]=this._h[a]+i,i=n[a]>>>13,n[a]&=8191;for(n[9]-=8192,s=(i^1)-1,a=0;a<10;a++)n[a]&=s;for(s=~s,a=0;a<10;a++)this._h[a]=this._h[a]&s|n[a];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,o=this._h[0]+this._pad[0],this._h[0]=o&65535,a=1;a<8;a++)o=(this._h[a]+this._pad[a]|0)+(o>>>16)|0,this._h[a]=o&65535;return e[r+0]=this._h[0]>>>0,e[r+1]=this._h[0]>>>8,e[r+2]=this._h[1]>>>0,e[r+3]=this._h[1]>>>8,e[r+4]=this._h[2]>>>0,e[r+5]=this._h[2]>>>8,e[r+6]=this._h[3]>>>0,e[r+7]=this._h[3]>>>8,e[r+8]=this._h[4]>>>0,e[r+9]=this._h[4]>>>8,e[r+10]=this._h[5]>>>0,e[r+11]=this._h[5]>>>8,e[r+12]=this._h[6]>>>0,e[r+13]=this._h[6]>>>8,e[r+14]=this._h[7]>>>0,e[r+15]=this._h[7]>>>8,this._finished=!0,this},t.prototype.update=function(e){var r=0,n=e.length,i;if(this._leftover){i=16-this._leftover,i>n&&(i=n);for(var s=0;s=16&&(i=n-n%16,this._blocks(e,r,i),r+=i,n-=i),n){for(var s=0;s{"use strict";c();Object.defineProperty(Yn,"__esModule",{value:!0});var ap=xD(),LQ=DD(),Qc=Fr(),PD=Aa(),FQ=sp();Yn.KEY_LENGTH=32;Yn.NONCE_LENGTH=12;Yn.TAG_LENGTH=16;var RD=new Uint8Array(16),MQ=function(){function t(e){if(this.nonceLength=Yn.NONCE_LENGTH,this.tagLength=Yn.TAG_LENGTH,e.length!==Yn.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);ap.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 ap.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),Qc.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(RD.subarray(i.length%16))),s.update(n),n.length%16>0&&s.update(RD.subarray(n.length%16));var o=new Uint8Array(8);i&&PD.writeUint64LE(i.length,o),s.update(o),PD.writeUint64LE(n.length,o),s.update(o);for(var a=s.digest(),u=0;u{"use strict";c();Object.defineProperty(j1,"__esModule",{value:!0});function UQ(t){return typeof t.saveState<"u"&&typeof t.restoreState<"u"&&typeof t.cleanSavedState<"u"}j1.isSerializableHash=UQ});var MD=m(Wc=>{"use strict";c();Object.defineProperty(Wc,"__esModule",{value:!0});var Sn=LD(),qQ=sp(),VQ=Fr(),FD=function(){function t(e,r){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var n=new Uint8Array(this.blockSize);r.length>this.blockSize?this._inner.update(r).finish(n).clean():n.set(r);for(var i=0;i{"use strict";c();Object.defineProperty(G1,"__esModule",{value:!0});var UD=MD(),qD=Fr(),jQ=function(){function t(e,r,n,i){n===void 0&&(n=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=i;var s=UD.hmac(this._hash,n,r);this._hmac=new UD.HMAC(e,s),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return t.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(e===0)throw new Error("hkdf: cannot expand more");this._hmac.reset(),e>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},t.prototype.expand=function(e){for(var r=new Uint8Array(e),n=0;n{"use strict";c();Object.defineProperty(Li,"__esModule",{value:!0});var cp=Aa(),up=Fr();Li.DIGEST_LENGTH=32;Li.BLOCK_SIZE=64;var HD=function(){function t(){this.digestLength=Li.DIGEST_LENGTH,this.blockSize=Li.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(){up.wipe(this._buffer),up.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&&(k1(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(n=k1(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){up.wipe(e.state),e.buffer&&up.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},t}();Li.SHA256=HD;var GQ=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 k1(t,e,r,n,i){for(;i>=64;){for(var s=e[0],o=e[1],a=e[2],u=e[3],l=e[4],f=e[5],d=e[6],g=e[7],E=0;E<16;E++){var v=n+E*4;t[E]=cp.readUint32BE(r,v)}for(var E=16;E<64;E++){var N=t[E-2],O=(N>>>17|N<<32-17)^(N>>>19|N<<32-19)^N>>>10;N=t[E-15];var F=(N>>>7|N<<32-7)^(N>>>18|N<<32-18)^N>>>3;t[E]=(O+t[E-7]|0)+(F+t[E-16]|0)}for(var E=0;E<64;E++){var O=(((l>>>6|l<<26)^(l>>>11|l<<21)^(l>>>25|l<<7))+(l&f^~l&d)|0)+(g+(GQ[E]+t[E]|0)|0)|0,F=((s>>>2|s<<32-2)^(s>>>13|s<<32-13)^(s>>>22|s<<32-22))+(s&o^s&a^o&a)|0;g=d,d=f,f=l,l=u+O|0,u=a,a=o,o=s,s=O+F|0}e[0]+=s,e[1]+=o,e[2]+=a,e[3]+=u,e[4]+=l,e[5]+=f,e[6]+=d,e[7]+=g,n+=64,i-=64}return n}function kQ(t){var e=new HD;e.update(t);var r=e.digest();return e.clean(),r}Li.hash=kQ});var WD=m(pt=>{"use strict";c();Object.defineProperty(pt,"__esModule",{value:!0});pt.sharedKey=pt.generateKeyPair=pt.generateKeyPairFromSeed=pt.scalarMultBase=pt.scalarMult=pt.SHARED_KEY_LENGTH=pt.SECRET_KEY_LENGTH=pt.PUBLIC_KEY_LENGTH=void 0;var QQ=Rc(),WQ=Fr();pt.PUBLIC_KEY_LENGTH=32;pt.SECRET_KEY_LENGTH=32;pt.SHARED_KEY_LENGTH=32;function Cn(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,zc(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 KQ(t,e){for(let r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function lp(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]+r[n]}function fp(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]-r[n]}function Jn(t,e,r){let n,i,s=0,o=0,a=0,u=0,l=0,f=0,d=0,g=0,E=0,v=0,N=0,O=0,F=0,_=0,I=0,S=0,R=0,B=0,b=0,C=0,L=0,X=0,W=0,j=0,G=0,K=0,de=0,ue=0,re=0,Y=0,se=0,te=r[0],ie=r[1],q=r[2],le=r[3],ae=r[4],fe=r[5],oe=r[6],ce=r[7],y=r[8],w=r[9],A=r[10],P=r[11],T=r[12],D=r[13],M=r[14],x=r[15];n=e[0],s+=n*te,o+=n*ie,a+=n*q,u+=n*le,l+=n*ae,f+=n*fe,d+=n*oe,g+=n*ce,E+=n*y,v+=n*w,N+=n*A,O+=n*P,F+=n*T,_+=n*D,I+=n*M,S+=n*x,n=e[1],o+=n*te,a+=n*ie,u+=n*q,l+=n*le,f+=n*ae,d+=n*fe,g+=n*oe,E+=n*ce,v+=n*y,N+=n*w,O+=n*A,F+=n*P,_+=n*T,I+=n*D,S+=n*M,R+=n*x,n=e[2],a+=n*te,u+=n*ie,l+=n*q,f+=n*le,d+=n*ae,g+=n*fe,E+=n*oe,v+=n*ce,N+=n*y,O+=n*w,F+=n*A,_+=n*P,I+=n*T,S+=n*D,R+=n*M,B+=n*x,n=e[3],u+=n*te,l+=n*ie,f+=n*q,d+=n*le,g+=n*ae,E+=n*fe,v+=n*oe,N+=n*ce,O+=n*y,F+=n*w,_+=n*A,I+=n*P,S+=n*T,R+=n*D,B+=n*M,b+=n*x,n=e[4],l+=n*te,f+=n*ie,d+=n*q,g+=n*le,E+=n*ae,v+=n*fe,N+=n*oe,O+=n*ce,F+=n*y,_+=n*w,I+=n*A,S+=n*P,R+=n*T,B+=n*D,b+=n*M,C+=n*x,n=e[5],f+=n*te,d+=n*ie,g+=n*q,E+=n*le,v+=n*ae,N+=n*fe,O+=n*oe,F+=n*ce,_+=n*y,I+=n*w,S+=n*A,R+=n*P,B+=n*T,b+=n*D,C+=n*M,L+=n*x,n=e[6],d+=n*te,g+=n*ie,E+=n*q,v+=n*le,N+=n*ae,O+=n*fe,F+=n*oe,_+=n*ce,I+=n*y,S+=n*w,R+=n*A,B+=n*P,b+=n*T,C+=n*D,L+=n*M,X+=n*x,n=e[7],g+=n*te,E+=n*ie,v+=n*q,N+=n*le,O+=n*ae,F+=n*fe,_+=n*oe,I+=n*ce,S+=n*y,R+=n*w,B+=n*A,b+=n*P,C+=n*T,L+=n*D,X+=n*M,W+=n*x,n=e[8],E+=n*te,v+=n*ie,N+=n*q,O+=n*le,F+=n*ae,_+=n*fe,I+=n*oe,S+=n*ce,R+=n*y,B+=n*w,b+=n*A,C+=n*P,L+=n*T,X+=n*D,W+=n*M,j+=n*x,n=e[9],v+=n*te,N+=n*ie,O+=n*q,F+=n*le,_+=n*ae,I+=n*fe,S+=n*oe,R+=n*ce,B+=n*y,b+=n*w,C+=n*A,L+=n*P,X+=n*T,W+=n*D,j+=n*M,G+=n*x,n=e[10],N+=n*te,O+=n*ie,F+=n*q,_+=n*le,I+=n*ae,S+=n*fe,R+=n*oe,B+=n*ce,b+=n*y,C+=n*w,L+=n*A,X+=n*P,W+=n*T,j+=n*D,G+=n*M,K+=n*x,n=e[11],O+=n*te,F+=n*ie,_+=n*q,I+=n*le,S+=n*ae,R+=n*fe,B+=n*oe,b+=n*ce,C+=n*y,L+=n*w,X+=n*A,W+=n*P,j+=n*T,G+=n*D,K+=n*M,de+=n*x,n=e[12],F+=n*te,_+=n*ie,I+=n*q,S+=n*le,R+=n*ae,B+=n*fe,b+=n*oe,C+=n*ce,L+=n*y,X+=n*w,W+=n*A,j+=n*P,G+=n*T,K+=n*D,de+=n*M,ue+=n*x,n=e[13],_+=n*te,I+=n*ie,S+=n*q,R+=n*le,B+=n*ae,b+=n*fe,C+=n*oe,L+=n*ce,X+=n*y,W+=n*w,j+=n*A,G+=n*P,K+=n*T,de+=n*D,ue+=n*M,re+=n*x,n=e[14],I+=n*te,S+=n*ie,R+=n*q,B+=n*le,b+=n*ae,C+=n*fe,L+=n*oe,X+=n*ce,W+=n*y,j+=n*w,G+=n*A,K+=n*P,de+=n*T,ue+=n*D,re+=n*M,Y+=n*x,n=e[15],S+=n*te,R+=n*ie,B+=n*q,b+=n*le,C+=n*ae,L+=n*fe,X+=n*oe,W+=n*ce,j+=n*y,G+=n*w,K+=n*A,de+=n*P,ue+=n*T,re+=n*D,Y+=n*M,se+=n*x,s+=38*R,o+=38*B,a+=38*b,u+=38*C,l+=38*L,f+=38*X,d+=38*W,g+=38*j,E+=38*G,v+=38*K,N+=38*de,O+=38*ue,F+=38*re,_+=38*Y,I+=38*se,i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=l+i+65535,i=Math.floor(n/65536),l=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=g+i+65535,i=Math.floor(n/65536),g=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=v+i+65535,i=Math.floor(n/65536),v=n-i*65536,n=N+i+65535,i=Math.floor(n/65536),N=n-i*65536,n=O+i+65535,i=Math.floor(n/65536),O=n-i*65536,n=F+i+65535,i=Math.floor(n/65536),F=n-i*65536,n=_+i+65535,i=Math.floor(n/65536),_=n-i*65536,n=I+i+65535,i=Math.floor(n/65536),I=n-i*65536,n=S+i+65535,i=Math.floor(n/65536),S=n-i*65536,s+=i-1+37*(i-1),i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=l+i+65535,i=Math.floor(n/65536),l=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=g+i+65535,i=Math.floor(n/65536),g=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=v+i+65535,i=Math.floor(n/65536),v=n-i*65536,n=N+i+65535,i=Math.floor(n/65536),N=n-i*65536,n=O+i+65535,i=Math.floor(n/65536),O=n-i*65536,n=F+i+65535,i=Math.floor(n/65536),F=n-i*65536,n=_+i+65535,i=Math.floor(n/65536),_=n-i*65536,n=I+i+65535,i=Math.floor(n/65536),I=n-i*65536,n=S+i+65535,i=Math.floor(n/65536),S=n-i*65536,s+=i-1+37*(i-1),t[0]=s,t[1]=o,t[2]=a,t[3]=u,t[4]=l,t[5]=f,t[6]=d,t[7]=g,t[8]=E,t[9]=v,t[10]=N,t[11]=O,t[12]=F,t[13]=_,t[14]=I,t[15]=S}function $c(t,e){Jn(t,e,e)}function YQ(t,e){let r=Cn();for(let n=0;n<16;n++)r[n]=e[n];for(let n=253;n>=0;n--)$c(r,r),n!==2&&n!==4&&Jn(r,r,e);for(let n=0;n<16;n++)t[n]=r[n]}function W1(t,e){let r=new Uint8Array(32),n=new Float64Array(80),i=Cn(),s=Cn(),o=Cn(),a=Cn(),u=Cn(),l=Cn();for(let E=0;E<31;E++)r[E]=t[E];r[31]=t[31]&127|64,r[0]&=248,KQ(n,e);for(let E=0;E<16;E++)s[E]=n[E];i[0]=a[0]=1;for(let E=254;E>=0;--E){let v=r[E>>>3]>>>(E&7)&1;zc(i,s,v),zc(o,a,v),lp(u,i,o),fp(i,i,o),lp(o,s,a),fp(s,s,a),$c(a,u),$c(l,i),Jn(i,o,i),Jn(o,s,u),lp(u,i,o),fp(i,i,o),$c(s,i),fp(o,a,l),Jn(i,o,zQ),lp(i,i,a),Jn(o,o,i),Jn(i,a,l),Jn(a,s,n),$c(s,u),zc(i,s,v),zc(o,a,v)}for(let E=0;E<16;E++)n[E+16]=i[E],n[E+32]=o[E],n[E+48]=s[E],n[E+64]=a[E];let f=n.subarray(32),d=n.subarray(16);YQ(f,f),Jn(d,d,f);let g=new Uint8Array(32);return $Q(g,d),g}pt.scalarMult=W1;function kD(t){return W1(t,GD)}pt.scalarMultBase=kD;function QD(t){if(t.length!==pt.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${pt.SECRET_KEY_LENGTH} bytes`);let e=new Uint8Array(t);return{publicKey:kD(e),secretKey:e}}pt.generateKeyPairFromSeed=QD;function JQ(t){let e=(0,QQ.randomBytes)(32,t),r=QD(e);return(0,WQ.wipe)(e),r}pt.generateKeyPair=JQ;function XQ(t,e,r=!1){if(t.length!==pt.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(e.length!==pt.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");let n=W1(t,e);if(r){let i=0;for(let s=0;se[r])return 1}return t.byteLength>e.byteLength?1:t.byteLength{c()});function KD(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r{c()});function JD(t,e){if(t.length!==e.length)throw new Error("Inputs should have the same length");let r=Ta(t.length);for(let n=0;n{c();Yd();Mc()});var z1={};ft(z1,{compare:()=>zD,concat:()=>Jd,equals:()=>KD,fromString:()=>In,toString:()=>$n,xor:()=>JD});var $1=ge(()=>{c();$D();a1();YD();B1();R1();XD()});var lP=m(it=>{"use strict";c();var ZD=it&&it.__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 oP:typeof navigator<"u"?K1(navigator.userAgent):cP()}it.detect=rW;function aP(t){return t!==""&&tW.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 nW(t){var e=aP(t);return e?e[0]:null}it.browserName=nW;function K1(t){var e=aP(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new sP;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length{"use strict";c();Object.defineProperty(Ye,"__esModule",{value:!0});Ye.getLocalStorage=Ye.getLocalStorageOrThrow=Ye.getCrypto=Ye.getCryptoOrThrow=Ye.getLocation=Ye.getLocationOrThrow=Ye.getNavigator=Ye.getNavigatorOrThrow=Ye.getDocument=Ye.getDocumentOrThrow=Ye.getFromWindowOrThrow=Ye.getFromWindow=void 0;function Hs(t){let e;return typeof window<"u"&&typeof window[t]<"u"&&(e=window[t]),e}Ye.getFromWindow=Hs;function La(t){let e=Hs(t);if(!e)throw new Error(`${t} is not defined in Window`);return e}Ye.getFromWindowOrThrow=La;function sW(){return La("document")}Ye.getDocumentOrThrow=sW;function oW(){return Hs("document")}Ye.getDocument=oW;function aW(){return La("navigator")}Ye.getNavigatorOrThrow=aW;function uW(){return Hs("navigator")}Ye.getNavigator=uW;function cW(){return La("location")}Ye.getLocationOrThrow=cW;function lW(){return Hs("location")}Ye.getLocation=lW;function fW(){return La("crypto")}Ye.getCryptoOrThrow=fW;function hW(){return Hs("crypto")}Ye.getCrypto=hW;function dW(){return La("localStorage")}Ye.getLocalStorageOrThrow=dW;function pW(){return Hs("localStorage")}Ye.getLocalStorage=pW});var hP=m(hp=>{"use strict";c();Object.defineProperty(hp,"__esModule",{value:!0});hp.getWindowMetadata=void 0;var fP=Y1();function gW(){let t,e;try{t=fP.getDocumentOrThrow(),e=fP.getLocationOrThrow()}catch{return null}function r(){let d=t.getElementsByTagName("link"),g=[];for(let E=0;E-1){let O=v.getAttribute("href");if(O)if(O.toLowerCase().indexOf("https:")===-1&&O.toLowerCase().indexOf("http:")===-1&&O.indexOf("//")!==0){let F=e.protocol+"//"+e.host;if(O.indexOf("/")===0)F+=O;else{let _=e.pathname.split("/");_.pop();let I=_.join("/");F+=I+"/"+O}g.push(F)}else if(O.indexOf("//")===0){let F=e.protocol+O;g.push(F)}else g.push(O)}}return g}function n(...d){let g=t.getElementsByTagName("meta");for(let E=0;Ev.getAttribute(O)).filter(O=>O?d.includes(O):!1);if(N.length&&N){let O=v.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,l=r();return{description:a,url:u,icons:l,name:o}}hp.getWindowMetadata=gW});var pP=m((Whe,dP)=>{"use strict";c();dP.exports=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)});var wP=m(($he,EP)=>{"use strict";c();var mP="%[a-f0-9]{2}",gP=new RegExp("("+mP+")|([^%]+?)","gi"),yP=new RegExp("("+mP+")+","gi");function J1(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([],J1(r),J1(n))}function yW(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(gP)||[],r=1;r{"use strict";c();vP.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 _P=m((Xhe,bP)=>{"use strict";c();bP.exports=function(t,e){for(var r={},n=Object.keys(t),i=Array.isArray(e),s=0;s{"use strict";c();var EW=pP(),wW=wP(),SP=AP(),vW=_P(),AW=t=>t==null,X1=Symbol("encodeFragmentIdentifier");function bW(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,[wt(e,t),"[",i,"]"].join("")]:[...r,[wt(e,t),"[",wt(i,t),"]=",wt(n,t)].join("")]};case"bracket":return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[wt(e,t),"[]"].join("")]:[...r,[wt(e,t),"[]=",wt(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,[wt(e,t),":list="].join("")]:[...r,[wt(e,t),":list=",wt(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?[[wt(r,t),e,wt(i,t)].join("")]:[[n,wt(i,t)].join(t.arrayFormatSeparator)])}default:return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,wt(e,t)]:[...r,[wt(e,t),"=",wt(n,t)].join("")]}}function _W(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&&Xn(n,t).includes(t.arrayFormatSeparator);n=o?Xn(n,t):n;let a=s||o?n.split(t.arrayFormatSeparator).map(u=>Xn(u,t)):n===null?n:Xn(n,t);i[r]=a};case"bracket-separator":return(r,n,i)=>{let s=/(\[\])$/.test(r);if(r=r.replace(/\[\]$/,""),!s){i[r]=n&&Xn(n,t);return}let o=n===null?[]:n.split(t.arrayFormatSeparator).map(a=>Xn(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 CP(t){if(typeof t!="string"||t.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function wt(t,e){return e.encode?e.strict?EW(t):encodeURIComponent(t):t}function Xn(t,e){return e.decode?wW(t):t}function TP(t){return Array.isArray(t)?t.sort():typeof t=="object"?TP(Object.keys(t)).sort((e,r)=>Number(e)-Number(r)).map(e=>t[e]):t}function xP(t){let e=t.indexOf("#");return e!==-1&&(t=t.slice(0,e)),t}function IW(t){let e="",r=t.indexOf("#");return r!==-1&&(e=t.slice(r)),e}function NP(t){t=xP(t);let e=t.indexOf("?");return e===-1?"":t.slice(e+1)}function IP(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 OP(t,e){e=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},e),CP(e.arrayFormatSeparator);let r=_W(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]=SP(e.decode?i.replace(/\+/g," "):i,"=");o=o===void 0?null:["comma","separator","bracket-separator"].includes(e.arrayFormat)?o:Xn(o,e),r(Xn(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]=IP(s[o],e);else n[i]=IP(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]=TP(o):i[s]=o,i},Object.create(null))}hr.extract=NP;hr.parse=OP;hr.stringify=(t,e)=>{if(!t)return"";e=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},e),CP(e.arrayFormatSeparator);let r=o=>e.skipNull&&AW(t[o])||e.skipEmptyString&&t[o]==="",n=bW(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?wt(o,e):Array.isArray(a)?a.length===0&&e.arrayFormat==="bracket-separator"?wt(o,e)+"[]":a.reduce(n(o),[]).join("&"):wt(o,e)+"="+wt(a,e)}).filter(o=>o.length>0).join("&")};hr.parseUrl=(t,e)=>{e=Object.assign({decode:!0},e);let[r,n]=SP(t,"#");return Object.assign({url:r.split("?")[0]||"",query:OP(NP(t),e)},e&&e.parseFragmentIdentifier&&n?{fragmentIdentifier:Xn(n,e)}:{})};hr.stringifyUrl=(t,e)=>{e=Object.assign({encode:!0,strict:!0,[X1]:!0},e);let r=xP(t.url).split("?")[0]||"",n=hr.extract(t.url),i=hr.parse(n,{sort:!1}),s=Object.assign(i,t.query),o=hr.stringify(s,e);o&&(o=`?${o}`);let a=IW(t.url);return t.fragmentIdentifier&&(a=`#${e[X1]?wt(t.fragmentIdentifier,e):t.fragmentIdentifier}`),`${r}${o}${a}`};hr.pick=(t,e,r)=>{r=Object.assign({parseFragmentIdentifier:!0,[X1]:!1},r);let{url:n,query:i,fragmentIdentifier:s}=hr.parseUrl(t,r);return hr.stringifyUrl({url:n,query:vW(i,e),fragmentIdentifier:s},r)};hr.exclude=(t,e,r)=>{let n=Array.isArray(e)?i=>!e.includes(i):(i,s)=>!e(i,s);return hr.pick(t,n,r)}});var PP=ge(()=>{c()});function Fi(t,e,r="string"){if(!t[e]||typeof t[e]!==r)throw new Error(`Missing or invalid "${e}" param`)}function SW(t,e){let r=!0;return e.forEach(n=>{n in t||(r=!1)}),r}function CW(t,e){return Array.isArray(t)?t.length===e:Object.keys(t).length===e}function TW(t,e){return Array.isArray(t)?t.length>=e:Object.keys(t).length>=e}function Kc(t,e,r){return(!r.length?CW(t,e.length):TW(t,e.length))?SW(t,e):!1}function Yc(t,e,r="_"){let n=t.split(r);return n[n.length-1].trim().toLowerCase()===e.trim().toLowerCase()}var Z1=ge(()=>{c()});function xW(t){return dp(t.method)&&pp(t.params)}function dp(t){return Yc(t,"subscribe")}function pp(t){return Kc(t,["topic"],[])}function NW(t){return gp(t.method)&&yp(t.params)}function gp(t){return Yc(t,"publish")}function yp(t){return Kc(t,["message","topic","ttl"],["prompt","tag"])}function OW(t){return mp(t.method)&&Ep(t.params)}function mp(t){return Yc(t,"unsubscribe")}function Ep(t){return Kc(t,["id","topic"],[])}function DW(t){return wp(t.method)&&vp(t.params)}function wp(t){return Yc(t,"subscription")}function vp(t){return Kc(t,["id","data"],[])}var eA=ge(()=>{c();Z1()});function PW(t){if(!dp(t.method))throw new Error("JSON-RPC Request has invalid subscribe method");if(!pp(t.params))throw new Error("JSON-RPC Request has invalid subscribe params");let e=t.params;return Fi(e,"topic"),e}function RW(t){if(!gp(t.method))throw new Error("JSON-RPC Request has invalid publish method");if(!yp(t.params))throw new Error("JSON-RPC Request has invalid publish params");let e=t.params;return Fi(e,"topic"),Fi(e,"message"),Fi(e,"ttl","number"),e}function BW(t){if(!mp(t.method))throw new Error("JSON-RPC Request has invalid unsubscribe method");if(!Ep(t.params))throw new Error("JSON-RPC Request has invalid unsubscribe params");let e=t.params;return Fi(e,"id"),e}function LW(t){if(!wp(t.method))throw new Error("JSON-RPC Request has invalid subscription method");if(!vp(t.params))throw new Error("JSON-RPC Request has invalid subscription params");let e=t.params;return Fi(e,"id"),Fi(e,"data"),e}var RP=ge(()=>{c();Z1();eA()});var FW,BP=ge(()=>{c();FW={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 LP={};ft(LP,{RELAY_JSONRPC:()=>FW,isPublishMethod:()=>gp,isPublishParams:()=>yp,isPublishRequest:()=>NW,isSubscribeMethod:()=>dp,isSubscribeParams:()=>pp,isSubscribeRequest:()=>xW,isSubscriptionMethod:()=>wp,isSubscriptionParams:()=>vp,isSubscriptionRequest:()=>DW,isUnsubscribeMethod:()=>mp,isUnsubscribeParams:()=>Ep,isUnsubscribeRequest:()=>OW,parsePublishRequest:()=>RW,parseSubscribeRequest:()=>PW,parseSubscriptionRequest:()=>LW,parseUnsubscribeRequest:()=>BW});var FP=ge(()=>{c();PP();RP();BP();eA()});var rl=m(k=>{"use strict";c();Object.defineProperty(k,"__esModule",{value:!0});var WP=BD(),MW=VD(),zP=Rc(),iA=jD(),UW=WD(),st=($1(),ut(z1)),qW=lP(),Fa=Ls(),Jc=Y1(),VW=hP(),HW=DP(),jW=(FP(),ut(LP));function $P(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 KP=$P(UW),Ap=$P(HW),Ip=":";function YP(t){let[e,r]=t.split(Ip);return{namespace:e,reference:r}}function JP(t){let{namespace:e,reference:r}=t;return[e,r].join(Ip)}function sA(t){let[e,r,n]=t.split(Ip);return{namespace:e,reference:r,address:n}}function XP(t){let{namespace:e,reference:r,address:n}=t;return[e,r,n].join(Ip)}function oA(t,e){let r=[];return t.forEach(n=>{let i=e(n);r.includes(i)||r.push(i)}),r}function ZP(t){let{address:e}=sA(t);return e}function e3(t){let{namespace:e,reference:r}=sA(t);return JP({namespace:e,reference:r})}function GW(t,e){let{namespace:r,reference:n}=YP(e);return XP({namespace:r,reference:n,address:t})}function kW(t){return oA(t,ZP)}function t3(t){return oA(t,e3)}function QW(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 WW(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...t3(i.accounts))}),r}function zW(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...Sp(n,i))}),r}function Sp(t,e){return t.includes(":")?[t]:e.chains||[]}var Cp=t=>t?.split(":"),r3=t=>{let e=t&&Cp(t);if(e)return e[3]},$W=t=>{let e=t&&Cp(t);if(e)return e[2]+":"+e[3]},n3=t=>{let e=t&&Cp(t);if(e)return e.pop()},KW=(t,e)=>{let r=`${t.domain} wants you to sign in with your Ethereum account:`,n=n3(e),i=t.statement,s=`URI: ${t.aud}`,o=`Version: ${t.version}`,a=`Chain ID: ${r3(e)}`,u=`Nonce: ${t.nonce}`,l=`Issued At: ${t.iat}`,f=t.resources&&t.resources.length>0?`Resources: ${t.resources.map(d=>`- ${d}`).join(` `)}`:void 0;return[r,n,"",i,"",s,o,a,u,l,f].filter(d=>d!=null).join(` -`)},Uv="base10",Jt="base16",Dp="base64pad",Fp="utf8",qv=0,Uu=1,Fk=0,n3=1,Pv=12,Vv=32;function Mk(){let t=g3.generateKeyPair();return{privateKey:et.toString(t.secretKey,Jt),publicKey:et.toString(t.publicKey,Jt)}}function Uk(){let t=d3.randomBytes(Vv);return et.toString(t,Jt)}function qk(t,e){let r=g3.sharedKey(et.fromString(t,Jt),et.fromString(e,Jt)),n=new _k.HKDF(Lv.SHA256,r).expand(Vv);return et.toString(n,Jt)}function Vk(t){let e=Lv.hash(et.fromString(t,Jt));return et.toString(e,Jt)}function jk(t){let e=Lv.hash(et.fromString(t,Fp));return et.toString(e,Jt)}function I3(t){return et.fromString(`${t}`,Uv)}function Bl(t){return Number(et.toString(t,Uv))}function Hk(t){let e=I3(typeof t.type<"u"?t.type:qv);if(Bl(e)===Uu&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");let r=typeof t.senderPublicKey<"u"?et.fromString(t.senderPublicKey,Jt):void 0,n=typeof t.iv<"u"?et.fromString(t.iv,Jt):d3.randomBytes(Pv),i=new h3.ChaCha20Poly1305(et.fromString(t.symKey,Jt)).seal(n,et.fromString(t.message,Fp));return S3({type:e,sealed:i,iv:n,senderPublicKey:r})}function Gk(t){let e=new h3.ChaCha20Poly1305(et.fromString(t.symKey,Jt)),{sealed:r,iv:n}=jv(t.encoded),i=e.open(n,r);if(i===null)throw new Error("Failed to decrypt");return et.toString(i,Fp)}function S3(t){if(Bl(t.type)===Uu){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return et.toString(et.concat([t.type,t.senderPublicKey,t.iv,t.sealed]),Dp)}return et.toString(et.concat([t.type,t.iv,t.sealed]),Dp)}function jv(t){let e=et.fromString(t,Dp),r=e.slice(Fk,n3),n=n3;if(Bl(r)===Uu){let a=n+Vv,u=a+Pv,l=e.slice(n,a),f=e.slice(a,u),d=e.slice(u);return{type:r,sealed:d,iv:f,senderPublicKey:l}}let i=n+Pv,s=e.slice(n,i),o=e.slice(i);return{type:r,sealed:o,iv:s}}function Qk(t,e){let r=jv(t);return C3({type:Bl(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?et.toString(r.senderPublicKey,Jt):void 0,receiverPublicKey:e?.receiverPublicKey})}function C3(t){let e=t?.type||qv;if(e===Uu){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 kk(t){return t.type===Uu&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}var zk=Object.defineProperty,i3=Object.getOwnPropertySymbols,Wk=Object.prototype.hasOwnProperty,Kk=Object.prototype.propertyIsEnumerable,s3=(t,e,r)=>e in t?zk(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,o3=(t,e)=>{for(var r in e||(e={}))Wk.call(e,r)&&s3(t,r,e[r]);if(i3)for(var r of i3(e))Kk.call(e,r)&&s3(t,r,e[r]);return t},T3="ReactNative",Fu={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},Pp=" ",$k=":",x3="/",Hv=2,Yk=1e3,N3="js";function Gv(){return typeof p.default<"u"&&typeof p.default.versions<"u"&&typeof p.default.versions.node<"u"}function O3(){return!Rl.getDocument()&&!!Rl.getNavigator()&&navigator.product===T3}function D3(){return!Gv()&&!!Rl.getNavigator()}function Qv(){return O3()?Fu.reactNative:Gv()?Fu.node:D3()?Fu.browser:Fu.unknown}function P3(t,e){let r=Op.parse(t);return r=o3(o3({},r),e),t=Op.stringify(r),t}function Jk(){return Ck.getWindowMetadata()||{name:"",description:"",url:"",icons:[""]}}function Xk(t,e){var r;let n=Qv(),i={protocol:t,version:e,env:n};return n==="browser"&&(i.host=((r=Rl.getLocation())==null?void 0:r.host)||"unknown"),i}function R3(){let t=Sk.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 B3(){var t;let e=Qv();return e===Fu.browser?[e,((t=Rl.getLocation())==null?void 0:t.host)||"unknown"].join(":"):e}function L3(t,e,r){let n=R3(),i=B3();return[[t,e].join("-"),[N3,r].join("-"),n,i].join("/")}function Zk({protocol:t,version:e,relayUrl:r,sdkVersion:n,auth:i,projectId:s,useOnCloseEvent:o}){let a=r.split("?"),u=L3(t,e,n),l={auth:i,ua:u,projectId:s,useOnCloseEvent:o||void 0},f=P3(a[1]||"",l);return a[0]+"?"+f}function ez(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 tz(t,e,r){if(!t[e]||typeof t[e]!==r)throw new Error(`Missing or invalid "${e}" param`)}function F3(t,e=Hv){return M3(t.split(x3),e)}function rz(t){return F3(t).join(Pp)}function Qi(t,e){return t.filter(r=>e.includes(r)).length===t.length}function M3(t,e=Hv){return t.slice(Math.max(t.length-e,0))}function nz(t){return Object.fromEntries(t.entries())}function iz(t){return new Map(Object.entries(t))}function sz(t,e){let r={};return Object.keys(t).forEach(n=>{r[n]=e(t[n])}),r}var oz=t=>t;function U3(t){return t.trim().replace(/^\w/,e=>e.toUpperCase())}function az(t){return t.split(Pp).map(e=>U3(e)).join(Pp)}function uz(t=Mu.FIVE_MINUTES,e){let r=Mu.toMiliseconds(t||Mu.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 cz(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 kv(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 lz(t){return kv("topic",t)}function fz(t){return kv("id",t)}function hz(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 dz(t,e){return Mu.fromMiliseconds((e||Date.now())+Mu.toMiliseconds(t))}function pz(t){return Date.now()>=Mu.toMiliseconds(t)}function gz(t,e){return`${t}${e?`:${e}`:""}`}function ki(t=[],e=[]){return[...new Set([...t,...e])]}var q3="irn";function yz(t){return t?.relay||{protocol:q3}}function mz(t){let e=xk.RELAY_JSONRPC[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var wz=Object.defineProperty,a3=Object.getOwnPropertySymbols,Ez=Object.prototype.hasOwnProperty,vz=Object.prototype.propertyIsEnumerable,u3=(t,e,r)=>e in t?wz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Az=(t,e)=>{for(var r in e||(e={}))Ez.call(e,r)&&u3(t,r,e[r]);if(a3)for(var r of a3(e))vz.call(e,r)&&u3(t,r,e[r]);return t};function V3(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 bz(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=Op.parse(s);return{protocol:n,topic:i[0],version:parseInt(i[1],10),symKey:o.symKey,relay:V3(o)}}function j3(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 _z(t){return`${t.protocol}:${t.topic}@${t.version}?`+Op.stringify(Az({symKey:t.symKey},j3(t.relay)))}var Iz=Object.defineProperty,Sz=Object.defineProperties,Cz=Object.getOwnPropertyDescriptors,c3=Object.getOwnPropertySymbols,Tz=Object.prototype.hasOwnProperty,xz=Object.prototype.propertyIsEnumerable,l3=(t,e,r)=>e in t?Iz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Nz=(t,e)=>{for(var r in e||(e={}))Tz.call(e,r)&&l3(t,r,e[r]);if(c3)for(var r of c3(e))xz.call(e,r)&&l3(t,r,e[r]);return t},Oz=(t,e)=>Sz(t,Cz(e));function wo(t){let e=[];return t.forEach(r=>{let[n,i]=r.split(":");e.push(`${n}:${i}`)}),e}function H3(t){let e=[];return Object.values(t).forEach(r=>{e.push(...wo(r.accounts))}),e}function G3(t,e){let r=[];return Object.values(t).forEach(n=>{wo(n.accounts).includes(e)&&r.push(...n.methods)}),r}function Q3(t,e){let r=[];return Object.values(t).forEach(n=>{wo(n.accounts).includes(e)&&r.push(...n.events)}),r}function Dz(t,e){let r=X3(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 Pz(t){let{proposal:{requiredNamespaces:e,optionalNamespaces:r={}},supportedNamespaces:n}=t,i=Rv(e),s=Rv(r),o={};Object.keys(n).forEach(l=>{let f=n[l].chains,d=n[l].methods,y=n[l].events,m=n[l].accounts;o[l]={chains:f,methods:d,events:y,accounts:m}});let a=eP(e,o,"approve()");if(a)throw new Error(a.message);let u={};return Object.keys(i).forEach(l=>{let f=n[l].chains.filter(v=>{var T,B;return(B=(T=i[l])==null?void 0:T.chains)==null?void 0:B.includes(v)}),d=n[l].methods.filter(v=>{var T,B;return(B=(T=i[l])==null?void 0:T.methods)==null?void 0:B.includes(v)}),y=n[l].events.filter(v=>{var T,B;return(B=(T=i[l])==null?void 0:T.events)==null?void 0:B.includes(v)}),m=f.map(v=>n[l].accounts.filter(T=>T.includes(v))).flat();u[l]={chains:f,methods:d,events:y,accounts:m}}),Object.keys(s).forEach(l=>{var f,d,y,m,v,T;if(!n[l])return;let B=(d=(f=s[l])==null?void 0:f.chains)==null?void 0:d.filter(R=>n[l].chains.includes(R)),A=n[l].methods.filter(R=>{var P,L;return(L=(P=s[l])==null?void 0:P.methods)==null?void 0:L.includes(R)}),D=n[l].events.filter(R=>{var P,L;return(L=(P=s[l])==null?void 0:P.events)==null?void 0:L.includes(R)}),x=B?.map(R=>n[l].accounts.filter(P=>P.includes(R))).flat();u[l]={chains:ki((y=u[l])==null?void 0:y.chains,B),methods:ki((m=u[l])==null?void 0:m.methods,A),events:ki((v=u[l])==null?void 0:v.events,D),accounts:ki((T=u[l])==null?void 0:T.accounts,x)}}),u}function zv(t){return t.includes(":")}function k3(t){return zv(t)?t.split(":")[0]:t}function Rv(t){var e,r,n;let i={};if(!Mp(t))return i;for(let[s,o]of Object.entries(t)){let a=zv(s)?[s]:o.chains,u=o.methods||[],l=o.events||[],f=k3(s);i[f]=Oz(Nz({},i[f]),{chains:ki(a,(e=i[f])==null?void 0:e.chains),methods:ki(u,(r=i[f])==null?void 0:r.methods),events:ki(l,(n=i[f])==null?void 0:n.events)})}return i}var Rz={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}},Bz={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 ri(t,e){let{message:r,code:n}=Bz[t];return{message:e?`${r} ${e}`:r,code:n}}function mo(t,e){let{message:r,code:n}=Rz[t];return{message:e?`${r} ${e}`:r,code:n}}function Ll(t,e){return Array.isArray(t)?typeof e<"u"&&t.length?t.every(e):!0:!1}function Mp(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function zi(t){return typeof t>"u"}function hr(t,e){return e&&zi(t)?!0:typeof t=="string"&&!!t.trim().length}function Up(t,e){return e&&zi(t)?!0:typeof t=="number"&&!isNaN(t)}function Lz(t,e){let{requiredNamespaces:r}=e,n=Object.keys(t.namespaces),i=Object.keys(r),s=!0;return Qi(i,n)?(n.forEach(o=>{let{accounts:a,methods:u,events:l}=t.namespaces[o],f=wo(a),d=r[o];(!Qi(Bp(o,d),f)||!Qi(d.methods,u)||!Qi(d.events,l))&&(s=!1)}),s):!1}function qp(t){return hr(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function z3(t){if(hr(t,!1)&&t.includes(":")){let e=t.split(":");if(e.length===3){let r=e[0]+":"+e[1];return!!e[2]&&qp(r)}}return!1}function Fz(t){if(hr(t,!1))try{return typeof new URL(t)<"u"}catch{return!1}return!1}function Mz(t){var e;return(e=t?.proposer)==null?void 0:e.publicKey}function Uz(t){return t?.topic}function qz(t,e){let r=null;return hr(t?.publicKey,!1)||(r=ri("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function Bv(t){let e=!0;return Ll(t)?t.length&&(e=t.every(r=>hr(r,!1))):e=!1,e}function W3(t,e,r){let n=null;return Ll(e)?e.forEach(i=>{n||(!qp(i)||!i.includes(t))&&(n=mo("UNSUPPORTED_CHAINS",`${r}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):n=mo("UNSUPPORTED_CHAINS",`${r}, chains ${e} should be an array of strings conforming to "namespace:chainId" format`),n}function K3(t,e){let r=null;return Object.entries(t).forEach(([n,i])=>{if(r)return;let s=W3(n,Bp(n,i),`${e} requiredNamespace`);s&&(r=s)}),r}function $3(t,e){let r=null;return Ll(t)?t.forEach(n=>{r||z3(n)||(r=mo("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):r=mo("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function Y3(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;let i=$3(n?.accounts,`${e} namespace`);i&&(r=i)}),r}function J3(t,e){let r=null;return Bv(t?.methods)?Bv(t?.events)||(r=mo("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=mo("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function Wv(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;let i=J3(n,`${e}, namespace`);i&&(r=i)}),r}function Vz(t,e,r){let n=null;if(t&&Mp(t)){let i=Wv(t,e);i&&(n=i);let s=K3(t,e);s&&(n=s)}else n=ri("MISSING_OR_INVALID",`${e}, ${r} should be an object with data`);return n}function X3(t,e){let r=null;if(t&&Mp(t)){let n=Wv(t,e);n&&(r=n);let i=Y3(t,e);i&&(r=i)}else r=ri("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function Z3(t){return hr(t.protocol,!0)}function jz(t,e){let r=!1;return e&&!t?r=!0:t&&Ll(t)&&t.length&&t.forEach(n=>{r=Z3(n)}),r}function Hz(t){return typeof t=="number"}function Gz(t){return typeof t<"u"&&typeof t!==null}function Qz(t){return!(!t||typeof t!="object"||!t.code||!Up(t.code,!1)||!t.message||!hr(t.message,!1))}function kz(t){return!(zi(t)||!hr(t.method,!1))}function zz(t){return!(zi(t)||zi(t.result)&&zi(t.error)||!Up(t.id,!1)||!hr(t.jsonrpc,!1))}function Wz(t){return!(zi(t)||!hr(t.name,!1))}function Kz(t,e){return!(!qp(e)||!H3(t).includes(e))}function $z(t,e,r){return hr(r,!1)?G3(t,e).includes(r):!1}function Yz(t,e,r){return hr(r,!1)?Q3(t,e).includes(r):!1}function eP(t,e,r){let n=null,i=Jz(t),s=Xz(e),o=Object.keys(i),a=Object.keys(s),u=f3(Object.keys(t)),l=f3(Object.keys(e)),f=u.filter(d=>!l.includes(d));return f.length&&(n=ri("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces. +`)},aA="base10",tr="base16",bp="base64pad",Tp="utf8",uA=0,Ma=1,YW=0,MP=1,tA=12,cA=32;function JW(){let t=KP.generateKeyPair();return{privateKey:st.toString(t.secretKey,tr),publicKey:st.toString(t.publicKey,tr)}}function XW(){let t=zP.randomBytes(cA);return st.toString(t,tr)}function ZW(t,e){let r=KP.sharedKey(st.fromString(t,tr),st.fromString(e,tr)),n=new MW.HKDF(iA.SHA256,r).expand(cA);return st.toString(n,tr)}function ez(t){let e=iA.hash(st.fromString(t,tr));return st.toString(e,tr)}function tz(t){let e=iA.hash(st.fromString(t,Tp));return st.toString(e,tr)}function i3(t){return st.fromString(`${t}`,aA)}function Zc(t){return Number(st.toString(t,aA))}function rz(t){let e=i3(typeof t.type<"u"?t.type:uA);if(Zc(e)===Ma&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");let r=typeof t.senderPublicKey<"u"?st.fromString(t.senderPublicKey,tr):void 0,n=typeof t.iv<"u"?st.fromString(t.iv,tr):zP.randomBytes(tA),i=new WP.ChaCha20Poly1305(st.fromString(t.symKey,tr)).seal(n,st.fromString(t.message,Tp));return s3({type:e,sealed:i,iv:n,senderPublicKey:r})}function nz(t){let e=new WP.ChaCha20Poly1305(st.fromString(t.symKey,tr)),{sealed:r,iv:n}=lA(t.encoded),i=e.open(n,r);if(i===null)throw new Error("Failed to decrypt");return st.toString(i,Tp)}function s3(t){if(Zc(t.type)===Ma){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return st.toString(st.concat([t.type,t.senderPublicKey,t.iv,t.sealed]),bp)}return st.toString(st.concat([t.type,t.iv,t.sealed]),bp)}function lA(t){let e=st.fromString(t,bp),r=e.slice(YW,MP),n=MP;if(Zc(r)===Ma){let a=n+cA,u=a+tA,l=e.slice(n,a),f=e.slice(a,u),d=e.slice(u);return{type:r,sealed:d,iv:f,senderPublicKey:l}}let i=n+tA,s=e.slice(n,i),o=e.slice(i);return{type:r,sealed:o,iv:s}}function iz(t,e){let r=lA(t);return o3({type:Zc(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?st.toString(r.senderPublicKey,tr):void 0,receiverPublicKey:e?.receiverPublicKey})}function o3(t){let e=t?.type||uA;if(e===Ma){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 sz(t){return t.type===Ma&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}var oz=Object.defineProperty,UP=Object.getOwnPropertySymbols,az=Object.prototype.hasOwnProperty,uz=Object.prototype.propertyIsEnumerable,qP=(t,e,r)=>e in t?oz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,VP=(t,e)=>{for(var r in e||(e={}))az.call(e,r)&&qP(t,r,e[r]);if(UP)for(var r of UP(e))uz.call(e,r)&&qP(t,r,e[r]);return t},a3="ReactNative",ei={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},_p=" ",cz=":",u3="/",fA=2,lz=1e3,c3="js";function hA(){return typeof p.default<"u"&&typeof p.default.versions<"u"&&typeof p.default.versions.node<"u"}function l3(){return!Jc.getDocument()&&!!Jc.getNavigator()&&navigator.product===a3}function f3(){return!hA()&&!!Jc.getNavigator()}function el(){return l3()?ei.reactNative:hA()?ei.node:f3()?ei.browser:ei.unknown}function h3(t,e){let r=Ap.parse(t);return r=VP(VP({},r),e),t=Ap.stringify(r),t}function fz(){return VW.getWindowMetadata()||{name:"",description:"",url:"",icons:[""]}}function hz(t,e){var r;let n=el(),i={protocol:t,version:e,env:n};return n==="browser"&&(i.host=((r=Jc.getLocation())==null?void 0:r.host)||"unknown"),i}function d3(){if(el()===ei.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=qW.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 p3(){var t;let e=el();return e===ei.browser?[e,((t=Jc.getLocation())==null?void 0:t.host)||"unknown"].join(":"):e}function g3(t,e,r){let n=d3(),i=p3();return[[t,e].join("-"),[c3,r].join("-"),n,i].join("/")}function dz({protocol:t,version:e,relayUrl:r,sdkVersion:n,auth:i,projectId:s,useOnCloseEvent:o}){let a=r.split("?"),u=g3(t,e,n),l={auth:i,ua:u,projectId:s,useOnCloseEvent:o||void 0},f=h3(a[1]||"",l);return a[0]+"?"+f}function pz(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 gz(t,e,r){if(!t[e]||typeof t[e]!==r)throw new Error(`Missing or invalid "${e}" param`)}function y3(t,e=fA){return m3(t.split(u3),e)}function yz(t){return y3(t).join(_p)}function Mi(t,e){return t.filter(r=>e.includes(r)).length===t.length}function m3(t,e=fA){return t.slice(Math.max(t.length-e,0))}function mz(t){return Object.fromEntries(t.entries())}function Ez(t){return new Map(Object.entries(t))}function wz(t,e){let r={};return Object.keys(t).forEach(n=>{r[n]=e(t[n])}),r}var vz=t=>t;function E3(t){return t.trim().replace(/^\w/,e=>e.toUpperCase())}function Az(t){return t.split(_p).map(e=>E3(e)).join(_p)}function bz(t=Fa.FIVE_MINUTES,e){let r=Fa.toMiliseconds(t||Fa.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 _z(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 dA(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 Iz(t){return dA("topic",t)}function Sz(t){return dA("id",t)}function Cz(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 Tz(t,e){return Fa.fromMiliseconds((e||Date.now())+Fa.toMiliseconds(t))}function xz(t){return Date.now()>=Fa.toMiliseconds(t)}function Nz(t,e){return`${t}${e?`:${e}`:""}`}function Ui(t=[],e=[]){return[...new Set([...t,...e])]}async function Oz({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=el();o===ei.browser?s.startsWith("https://")?window.open(s,"_blank","noreferrer noopener"):window.open(s,"_self","noreferrer noopener"):o===ei.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(s)}catch(n){console.error(n)}}var w3="irn";function Dz(t){return t?.relay||{protocol:w3}}function Pz(t){let e=jW.RELAY_JSONRPC[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var Rz=Object.defineProperty,HP=Object.getOwnPropertySymbols,Bz=Object.prototype.hasOwnProperty,Lz=Object.prototype.propertyIsEnumerable,jP=(t,e,r)=>e in t?Rz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Fz=(t,e)=>{for(var r in e||(e={}))Bz.call(e,r)&&jP(t,r,e[r]);if(HP)for(var r of HP(e))Lz.call(e,r)&&jP(t,r,e[r]);return t};function v3(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 Mz(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=Ap.parse(s);return{protocol:n,topic:A3(i[0]),version:parseInt(i[1],10),symKey:o.symKey,relay:v3(o)}}function A3(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 Uz(t){return`${t.protocol}:${t.topic}@${t.version}?`+Ap.stringify(Fz({symKey:t.symKey},b3(t.relay)))}var qz=Object.defineProperty,Vz=Object.defineProperties,Hz=Object.getOwnPropertyDescriptors,GP=Object.getOwnPropertySymbols,jz=Object.prototype.hasOwnProperty,Gz=Object.prototype.propertyIsEnumerable,kP=(t,e,r)=>e in t?qz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,kz=(t,e)=>{for(var r in e||(e={}))jz.call(e,r)&&kP(t,r,e[r]);if(GP)for(var r of GP(e))Gz.call(e,r)&&kP(t,r,e[r]);return t},Qz=(t,e)=>Vz(t,Hz(e));function Gs(t){let e=[];return t.forEach(r=>{let[n,i]=r.split(":");e.push(`${n}:${i}`)}),e}function _3(t){let e=[];return Object.values(t).forEach(r=>{e.push(...Gs(r.accounts))}),e}function I3(t,e){let r=[];return Object.values(t).forEach(n=>{Gs(n.accounts).includes(e)&&r.push(...n.methods)}),r}function S3(t,e){let r=[];return Object.values(t).forEach(n=>{Gs(n.accounts).includes(e)&&r.push(...n.events)}),r}function Wz(t,e){let r=R3(t,e);if(r)throw new Error(r.message);let n={};for(let[i,s]of Object.entries(t))n[i]={methods:s.methods,events:s.events,chains:s.accounts.map(o=>`${o.split(":")[0]}:${o.split(":")[1]}`)};return n}function zz(t){let{proposal:{requiredNamespaces:e,optionalNamespaces:r={}},supportedNamespaces:n}=t,i=rA(e),s=rA(r),o={};Object.keys(n).forEach(l=>{let f=n[l].chains,d=n[l].methods,g=n[l].events,E=n[l].accounts;o[l]={chains:f,methods:d,events:g,accounts:E}});let a=L3(e,o,"approve()");if(a)throw new Error(a.message);let u={};return Object.keys(i).forEach(l=>{let f=n[l].chains.filter(v=>{var N,O;return(O=(N=i[l])==null?void 0:N.chains)==null?void 0:O.includes(v)}),d=n[l].methods.filter(v=>{var N,O;return(O=(N=i[l])==null?void 0:N.methods)==null?void 0:O.includes(v)}),g=n[l].events.filter(v=>{var N,O;return(O=(N=i[l])==null?void 0:N.events)==null?void 0:O.includes(v)}),E=f.map(v=>n[l].accounts.filter(N=>N.includes(`${v}:`))).flat();u[l]={chains:f,methods:d,events:g,accounts:E}}),Object.keys(s).forEach(l=>{var f,d,g,E,v,N;if(!n[l])return;let O=(d=(f=s[l])==null?void 0:f.chains)==null?void 0:d.filter(S=>n[l].chains.includes(S)),F=n[l].methods.filter(S=>{var R,B;return(B=(R=s[l])==null?void 0:R.methods)==null?void 0:B.includes(S)}),_=n[l].events.filter(S=>{var R,B;return(B=(R=s[l])==null?void 0:R.events)==null?void 0:B.includes(S)}),I=O?.map(S=>n[l].accounts.filter(R=>R.includes(S))).flat();u[l]={chains:Ui((g=u[l])==null?void 0:g.chains,O),methods:Ui((E=u[l])==null?void 0:E.methods,F),events:Ui((v=u[l])==null?void 0:v.events,_),accounts:Ui((N=u[l])==null?void 0:N.accounts,I)}}),u}function pA(t){return t.includes(":")}function C3(t){return pA(t)?t.split(":")[0]:t}function rA(t){var e,r,n;let i={};if(!xp(t))return i;for(let[s,o]of Object.entries(t)){let a=pA(s)?[s]:o.chains,u=o.methods||[],l=o.events||[],f=C3(s);i[f]=Qz(kz({},i[f]),{chains:Ui(a,(e=i[f])==null?void 0:e.chains),methods:Ui(u,(r=i[f])==null?void 0:r.methods),events:Ui(l,(n=i[f])==null?void 0:n.events)})}return i}var $z={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}},Kz={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 Zn(t,e){let{message:r,code:n}=Kz[t];return{message:e?`${r} ${e}`:r,code:n}}function js(t,e){let{message:r,code:n}=$z[t];return{message:e?`${r} ${e}`:r,code:n}}function tl(t,e){return Array.isArray(t)?typeof e<"u"&&t.length?t.every(e):!0:!1}function xp(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function qi(t){return typeof t>"u"}function wr(t,e){return e&&qi(t)?!0:typeof t=="string"&&!!t.trim().length}function Np(t,e){return e&&qi(t)?!0:typeof t=="number"&&!isNaN(t)}function Yz(t,e){let{requiredNamespaces:r}=e,n=Object.keys(t.namespaces),i=Object.keys(r),s=!0;return Mi(i,n)?(n.forEach(o=>{let{accounts:a,methods:u,events:l}=t.namespaces[o],f=Gs(a),d=r[o];(!Mi(Sp(o,d),f)||!Mi(d.methods,u)||!Mi(d.events,l))&&(s=!1)}),s):!1}function Xc(t){return wr(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function T3(t){if(wr(t,!1)&&t.includes(":")){let e=t.split(":");if(e.length===3){let r=e[0]+":"+e[1];return!!e[2]&&Xc(r)}}return!1}function Jz(t){if(wr(t,!1))try{return typeof new URL(t)<"u"}catch{return!1}return!1}function Xz(t){var e;return(e=t?.proposer)==null?void 0:e.publicKey}function Zz(t){return t?.topic}function e$(t,e){let r=null;return wr(t?.publicKey,!1)||(r=Zn("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function nA(t){let e=!0;return tl(t)?t.length&&(e=t.every(r=>wr(r,!1))):e=!1,e}function x3(t,e,r){let n=null;return tl(e)&&e.length?e.forEach(i=>{n||Xc(i)||(n=js("UNSUPPORTED_CHAINS",`${r}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):Xc(t)||(n=js("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 N3(t,e,r){let n=null;return Object.entries(t).forEach(([i,s])=>{if(n)return;let o=x3(i,Sp(i,s),`${e} ${r}`);o&&(n=o)}),n}function O3(t,e){let r=null;return tl(t)?t.forEach(n=>{r||T3(n)||(r=js("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):r=js("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function D3(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;let i=O3(n?.accounts,`${e} namespace`);i&&(r=i)}),r}function P3(t,e){let r=null;return nA(t?.methods)?nA(t?.events)||(r=js("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=js("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function gA(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;let i=P3(n,`${e}, namespace`);i&&(r=i)}),r}function t$(t,e,r){let n=null;if(t&&xp(t)){let i=gA(t,e);i&&(n=i);let s=N3(t,e,r);s&&(n=s)}else n=Zn("MISSING_OR_INVALID",`${e}, ${r} should be an object with data`);return n}function R3(t,e){let r=null;if(t&&xp(t)){let n=gA(t,e);n&&(r=n);let i=D3(t,e);i&&(r=i)}else r=Zn("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function B3(t){return wr(t.protocol,!0)}function r$(t,e){let r=!1;return e&&!t?r=!0:t&&tl(t)&&t.length&&t.forEach(n=>{r=B3(n)}),r}function n$(t){return typeof t=="number"}function i$(t){return typeof t<"u"&&typeof t!==null}function s$(t){return!(!t||typeof t!="object"||!t.code||!Np(t.code,!1)||!t.message||!wr(t.message,!1))}function o$(t){return!(qi(t)||!wr(t.method,!1))}function a$(t){return!(qi(t)||qi(t.result)&&qi(t.error)||!Np(t.id,!1)||!wr(t.jsonrpc,!1))}function u$(t){return!(qi(t)||!wr(t.name,!1))}function c$(t,e){return!(!Xc(e)||!_3(t).includes(e))}function l$(t,e,r){return wr(r,!1)?I3(t,e).includes(r):!1}function f$(t,e,r){return wr(r,!1)?S3(t,e).includes(r):!1}function L3(t,e,r){let n=null,i=h$(t),s=d$(e),o=Object.keys(i),a=Object.keys(s),u=QP(Object.keys(t)),l=QP(Object.keys(e)),f=u.filter(d=>!l.includes(d));return f.length&&(n=Zn("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces. Required: ${f.toString()} - Received: ${Object.keys(e).toString()}`)),Qi(o,a)||(n=ri("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces. + Received: ${Object.keys(e).toString()}`)),Mi(o,a)||(n=Zn("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces. Required: ${o.toString()} - Approved: ${a.toString()}`)),Object.keys(e).forEach(d=>{if(!d.includes(":")||n)return;let y=wo(e[d].accounts);y.includes(d)||(n=ri("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${d} + Approved: ${a.toString()}`)),Object.keys(e).forEach(d=>{if(!d.includes(":")||n)return;let g=Gs(e[d].accounts);g.includes(d)||(n=Zn("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${d} Required: ${d} - Approved: ${y.toString()}`))}),o.forEach(d=>{n||(Qi(i[d].methods,s[d].methods)?Qi(i[d].events,s[d].events)||(n=ri("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${d}`)):n=ri("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${d}`))}),n}function Jz(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 f3(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function Xz(t){let e={};return Object.keys(t).forEach(r=>{r.includes(":")?e[r]=t[r]:wo(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 Zz(t,e){return Up(t,!1)&&t<=e.max&&t>=e.min}Q.BASE10=Uv,Q.BASE16=Jt,Q.BASE64=Dp,Q.COLON=$k,Q.DEFAULT_DEPTH=Hv,Q.EMPTY_SPACE=Pp,Q.ENV_MAP=Fu,Q.ONE_THOUSAND=Yk,Q.REACT_NATIVE_PRODUCT=T3,Q.RELAYER_DEFAULT_PROTOCOL=q3,Q.SDK_TYPE=N3,Q.SLASH=x3,Q.TYPE_0=qv,Q.TYPE_1=Uu,Q.UTF8=Fp,Q.appendToQueryString=P3,Q.assertType=tz,Q.buildApprovedNamespaces=Pz,Q.calcExpiry=dz,Q.capitalize=az,Q.capitalizeWord=U3,Q.createDelayedPromise=uz,Q.createExpiringPromise=cz,Q.decodeTypeByte=Bl,Q.decrypt=Gk,Q.deriveSymKey=qk,Q.deserialize=jv,Q.encodeTypeByte=I3,Q.encrypt=Hk,Q.engineEvent=gz,Q.enumify=oz,Q.formatAccountId=w3,Q.formatAccountWithChain=Nk,Q.formatChainId=m3,Q.formatExpirerTarget=kv,Q.formatIdTarget=fz,Q.formatMessage=Lk,Q.formatMessageContext=rz,Q.formatRelayParams=j3,Q.formatRelayRpcUrl=Zk,Q.formatTopicTarget=lz,Q.formatUA=L3,Q.formatUri=_z,Q.generateKeyPair=Mk,Q.generateRandomBytes32=Uk,Q.getAccountsChains=wo,Q.getAccountsFromNamespaces=Dk,Q.getAddressFromAccount=E3,Q.getAddressesFromAccounts=Ok,Q.getAppMetadata=Jk,Q.getChainFromAccount=v3,Q.getChainsFromAccounts=A3,Q.getChainsFromNamespace=Bp,Q.getChainsFromNamespaces=Pk,Q.getChainsFromRequiredNamespaces=Rk,Q.getDidAddress=_3,Q.getDidAddressSegments=Lp,Q.getDidChainId=b3,Q.getEnvironment=Qv,Q.getHttpUrl=ez,Q.getInternalError=ri,Q.getJavascriptID=B3,Q.getJavascriptOS=R3,Q.getLastItems=M3,Q.getNamespacedDidChainId=Bk,Q.getNamespacesChains=H3,Q.getNamespacesEventsForChainId=Q3,Q.getNamespacesMethodsForChainId=G3,Q.getRelayClientMetadata=Xk,Q.getRelayProtocolApi=mz,Q.getRelayProtocolName=yz,Q.getRequiredNamespacesFromNamespaces=Dz,Q.getSdkError=mo,Q.getUniqueValues=Mv,Q.hasOverlap=Qi,Q.hashKey=Vk,Q.hashMessage=jk,Q.isBrowser=D3,Q.isCaipNamespace=zv,Q.isConformingNamespaces=eP,Q.isExpired=pz,Q.isNode=Gv,Q.isProposalStruct=Mz,Q.isReactNative=O3,Q.isSessionCompatible=Lz,Q.isSessionStruct=Uz,Q.isTypeOneEnvelope=kk,Q.isUndefined=zi,Q.isValidAccountId=z3,Q.isValidAccounts=$3,Q.isValidActions=J3,Q.isValidArray=Ll,Q.isValidChainId=qp,Q.isValidChains=W3,Q.isValidController=qz,Q.isValidErrorReason=Qz,Q.isValidEvent=Wz,Q.isValidId=Hz,Q.isValidNamespaceAccounts=Y3,Q.isValidNamespaceActions=Wv,Q.isValidNamespaceChains=K3,Q.isValidNamespaceMethodsOrEvents=Bv,Q.isValidNamespaces=X3,Q.isValidNamespacesChainId=Kz,Q.isValidNamespacesEvent=Yz,Q.isValidNamespacesRequest=$z,Q.isValidNumber=Up,Q.isValidObject=Mp,Q.isValidParams=Gz,Q.isValidRelay=Z3,Q.isValidRelays=jz,Q.isValidRequest=kz,Q.isValidRequestExpiry=Zz,Q.isValidRequiredNamespaces=Vz,Q.isValidResponse=zz,Q.isValidString=hr,Q.isValidUrl=Fz,Q.mapEntries=sz,Q.mapToObj=nz,Q.mergeArrays=ki,Q.normalizeNamespaces=Rv,Q.objToMap=iz,Q.parseAccountId=Fv,Q.parseChainId=y3,Q.parseContextNames=F3,Q.parseExpirerTarget=hz,Q.parseNamespaceKey=k3,Q.parseRelayParams=V3,Q.parseUri=bz,Q.serialize=S3,Q.validateDecoding=Qk,Q.validateEncoding=C3});var tP,rP,nP,iP,jp,Fl,Kv,Hp,Wi,Ml,Gp=ge(()=>{c();tP="PARSE_ERROR",rP="INVALID_REQUEST",nP="METHOD_NOT_FOUND",iP="INVALID_PARAMS",jp="INTERNAL_ERROR",Fl="SERVER_ERROR",Kv=[-32700,-32600,-32601,-32602,-32603],Hp=[-32e3,-32099],Wi={[tP]:{code:-32700,message:"Parse error"},[rP]:{code:-32600,message:"Invalid Request"},[nP]:{code:-32601,message:"Method not found"},[iP]:{code:-32602,message:"Invalid params"},[jp]:{code:-32603,message:"Internal error"},[Fl]:{code:-32e3,message:"Server error"}},Ml=Fl});function eW(t){return t<=Hp[0]&&t>=Hp[1]}function Qp(t){return Kv.includes(t)}function sP(t){return typeof t=="number"}function kp(t){return Object.keys(Wi).includes(t)?Wi[t]:Wi[Ml]}function zp(t){let e=Object.values(Wi).find(r=>r.code===t);return e||Wi[Ml]}function tW(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(!sP(t.error.code))return{valid:!1,error:`Invalid error code type for JSON-RPC: ${t.error.code}`};if(Qp(t.error.code)){let e=zp(t.error.code);if(e.message!==Wi[Ml].message&&t.error.message===e.message)return{valid:!1,error:`Invalid error code message for JSON-RPC: ${t.error.code}`}}return{valid:!0}}function $v(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var Yv=ge(()=>{c();Gp()});var aP=w(Ki=>{"use strict";c();Object.defineProperty(Ki,"__esModule",{value:!0});Ki.isBrowserCryptoAvailable=Ki.getSubtleCrypto=Ki.getBrowerCrypto=void 0;function Jv(){return(global===null||global===void 0?void 0:global.crypto)||(global===null||global===void 0?void 0:global.msCrypto)||{}}Ki.getBrowerCrypto=Jv;function oP(){let t=Jv();return t.subtle||t.webkitSubtle}Ki.getSubtleCrypto=oP;function rW(){return!!Jv()&&!!oP()}Ki.isBrowserCryptoAvailable=rW});var lP=w($i=>{"use strict";c();Object.defineProperty($i,"__esModule",{value:!0});$i.isBrowser=$i.isNode=$i.isReactNative=void 0;function uP(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}$i.isReactNative=uP;function cP(){return typeof p.default<"u"&&typeof p.default.versions<"u"&&typeof p.default.versions.node<"u"}$i.isNode=cP;function nW(){return!uP()&&!cP()}$i.isBrowser=nW});var Xv=w(Wp=>{"use strict";c();Object.defineProperty(Wp,"__esModule",{value:!0});var fP=(lr(),nt(cr));fP.__exportStar(aP(),Wp);fP.__exportStar(lP(),Wp)});var Dt={};at(Dt,{isNodeJs:()=>dP});var hP,dP,pP=ge(()=>{c();hP=_e(Xv());Mt(Dt,_e(Xv()));dP=hP.isNode});function Zv(t=3){let e=Date.now()*Math.pow(10,t),r=Math.floor(Math.random()*Math.pow(10,t));return e+r}function eA(t=6){return BigInt(Zv(t))}function tA(t,e,r){return{id:r||Zv(),jsonrpc:"2.0",method:t,params:e}}function iW(t,e){return{id:t,jsonrpc:"2.0",result:e}}function rA(t,e,r){return{id:t,jsonrpc:"2.0",error:gP(e,r)}}function gP(t,e){return typeof t>"u"?kp(jp):(typeof t=="string"&&(t=Object.assign(Object.assign({},kp(Fl)),{message:t})),typeof e<"u"&&(t.data=e),Qp(t.code)&&(t=zp(t.code)),t)}var yP=ge(()=>{c();Yv();Gp()});function sW(t){return t.includes("*")?$p(t):!/\W/g.test(t)}function Kp(t){return t==="*"}function $p(t){return Kp(t)?!0:!(!t.includes("*")||t.split("*").length!==2||t.split("*").filter(e=>e.trim()==="").length!==1)}function oW(t){return!Kp(t)&&$p(t)&&!t.split("*")[0].trim()}function aW(t){return!Kp(t)&&$p(t)&&!t.split("*")[1].trim()}var mP=ge(()=>{c()});var wP=ge(()=>{c()});var qu,nA=ge(()=>{c();qu=class{}});var iA,Yp,Ul,EP=ge(()=>{c();nA();iA=class extends qu{constructor(e){super()}},Yp=class extends qu{constructor(){super()}},Ul=class extends Yp{constructor(e){super()}}});var vP=ge(()=>{c()});var AP=ge(()=>{c();wP();nA();EP();vP()});var bP=ge(()=>{c();AP()});function lW(t){let e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function _P(t,e){let r=lW(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function fW(t){return _P(t,uW)}function Jp(t){return _P(t,cW)}function sA(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}var uW,cW,IP=ge(()=>{c();uW="^https?:",cW="^wss?:"});function oA(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function hW(t){return oA(t)&&"method"in t}function aA(t){return oA(t)&&(SP(t)||Xp(t))}function SP(t){return"result"in t}function Xp(t){return"error"in t}function dW(t){return"error"in t&&t.valid===!1}var CP=ge(()=>{c()});var Kt={};at(Kt,{DEFAULT_ERROR:()=>Ml,IBaseJsonRpcProvider:()=>Yp,IEvents:()=>qu,IJsonRpcConnection:()=>iA,IJsonRpcProvider:()=>Ul,INTERNAL_ERROR:()=>jp,INVALID_PARAMS:()=>iP,INVALID_REQUEST:()=>rP,METHOD_NOT_FOUND:()=>nP,PARSE_ERROR:()=>tP,RESERVED_ERROR_CODES:()=>Kv,SERVER_ERROR:()=>Fl,SERVER_ERROR_CODE_RANGE:()=>Hp,STANDARD_ERROR_MAP:()=>Wi,formatErrorMessage:()=>gP,formatJsonRpcError:()=>rA,formatJsonRpcRequest:()=>tA,formatJsonRpcResult:()=>iW,getBigIntRpcId:()=>eA,getError:()=>kp,getErrorByCode:()=>zp,isHttpUrl:()=>fW,isJsonRpcError:()=>Xp,isJsonRpcPayload:()=>oA,isJsonRpcRequest:()=>hW,isJsonRpcResponse:()=>aA,isJsonRpcResult:()=>SP,isJsonRpcValidationInvalid:()=>dW,isLocalhostUrl:()=>sA,isNodeJs:()=>dP,isReservedErrorCode:()=>Qp,isServerErrorCode:()=>eW,isValidDefaultRoute:()=>Kp,isValidErrorCode:()=>sP,isValidLeadingWildcardRoute:()=>oW,isValidRoute:()=>sW,isValidTrailingWildcardRoute:()=>aW,isValidWildcardRoute:()=>$p,isWsUrl:()=>Jp,parseConnectionError:()=>$v,payloadId:()=>Zv,validateJsonRpcError:()=>tW});var ql=ge(()=>{c();Gp();Yv();pP();Mt(Kt,Dt);yP();mP();bP();IP();CP()});var TP,Zp,xP,uA=ge(()=>{c();TP=_e(Wn());ql();Zp=class extends Ul{constructor(e){super(e),this.events=new TP.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(tA(e.method,e.params||[],eA().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=>{Xp(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),aA(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)}},xP=Zp});var NP={};at(NP,{JsonRpcProvider:()=>Zp,default:()=>pW});var pW,OP=ge(()=>{c();uA();uA();pW=xP});var PP=w((Mhe,DP)=>{"use strict";c();DP.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}});var BP,RP,gW,yW,mW,eg,LP,cA=ge(()=>{c();BP=_e(Wn());kd();ql();RP=10,gW=()=>typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:PP(),yW=()=>typeof window<"u",mW=gW(),eg=class{constructor(e){if(this.url=e,this.events=new BP.EventEmitter,this.registering=!1,!Jp(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,r)=>{if(typeof this.socket>"u"){r(new Error("Connection already closed"));return}this.socket.onclose=n=>{this.onClose(n),e()},this.socket.close()})}async send(e,r){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(pl(e))}catch(n){this.onError(e.id,n)}}register(e=this.url){if(!Jp(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){let r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return i(new Error("WebSocket connection is missing or invalid"));n(this.socket)})})}return this.url=e,this.registering=!0,new Promise((r,n)=>{let i=(0,Kt.isReactNative)()?void 0:{rejectUnauthorized:!sA(e)},s=new mW(e,[],i);yW()?s.onerror=o=>{let a=o;n(this.emitError(a.error))}:s.on("error",o=>{n(this.emitError(o))}),s.onopen=()=>{this.onOpen(s),r(s)}})}onOpen(e){e.onmessage=r=>this.onPayload(r),e.onclose=r=>this.onClose(r),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;let r=typeof e.data=="string"?dl(e.data):e.data;this.events.emit("payload",r)}onError(e,r){let n=this.parseError(r),i=n.message||n.toString(),s=rA(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return $v(e,r,"WS")}resetMaxListeners(){this.events.getMaxListeners()>RP&&this.events.setMaxListeners(RP)}emitError(e){let r=this.parseError(new Error(e?.message||`WebSocket connection failed for URL: ${this.url}`));return this.events.emit("register_error",r),r}},LP=eg});var FP={};at(FP,{WsConnection:()=>eg,default:()=>wW});var wW,MP=ge(()=>{c();cA();cA();wW=LP});var w6=w((Vl,ju)=>{c();var EW=200,vA="__lodash_hash_undefined__",ug=1,$P=2,YP=9007199254740991,tg="[object Arguments]",dA="[object Array]",vW="[object AsyncFunction]",JP="[object Boolean]",XP="[object Date]",ZP="[object Error]",e6="[object Function]",AW="[object GeneratorFunction]",rg="[object Map]",t6="[object Number]",bW="[object Null]",Vu="[object Object]",UP="[object Promise]",_W="[object Proxy]",r6="[object RegExp]",ng="[object Set]",n6="[object String]",IW="[object Symbol]",SW="[object Undefined]",pA="[object WeakMap]",i6="[object ArrayBuffer]",ig="[object DataView]",CW="[object Float32Array]",TW="[object Float64Array]",xW="[object Int8Array]",NW="[object Int16Array]",OW="[object Int32Array]",DW="[object Uint8Array]",PW="[object Uint8ClampedArray]",RW="[object Uint16Array]",BW="[object Uint32Array]",LW=/[\\^$.*+?()[\]{}|]/g,FW=/^\[object .+?Constructor\]$/,MW=/^(?:0|[1-9]\d*)$/,Ye={};Ye[CW]=Ye[TW]=Ye[xW]=Ye[NW]=Ye[OW]=Ye[DW]=Ye[PW]=Ye[RW]=Ye[BW]=!0;Ye[tg]=Ye[dA]=Ye[i6]=Ye[JP]=Ye[ig]=Ye[XP]=Ye[ZP]=Ye[e6]=Ye[rg]=Ye[t6]=Ye[Vu]=Ye[r6]=Ye[ng]=Ye[n6]=Ye[pA]=!1;var s6=typeof global=="object"&&global&&global.Object===Object&&global,UW=typeof self=="object"&&self&&self.Object===Object&&self,ni=s6||UW||Function("return this")(),o6=typeof Vl=="object"&&Vl&&!Vl.nodeType&&Vl,qP=o6&&typeof ju=="object"&&ju&&!ju.nodeType&&ju,a6=qP&&qP.exports===o6,lA=a6&&s6.process,VP=function(){try{return lA&&lA.binding&&lA.binding("util")}catch{}}(),jP=VP&&VP.isTypedArray;function qW(t,e){for(var r=-1,n=t==null?0:t.length,i=0,s=[];++r-1}function gK(t,e){var r=this.__data__,n=lg(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}ii.prototype.clear=fK;ii.prototype.delete=hK;ii.prototype.get=dK;ii.prototype.has=pK;ii.prototype.set=gK;function Ao(t){var e=-1,r=t==null?0:t.length;for(this.clear();++ea))return!1;var l=s.get(t);if(l&&s.get(e))return l==e;var f=-1,d=!0,y=r&$P?new og:void 0;for(s.set(t,e),s.set(e,t);++f-1&&t%1==0&&t-1&&t%1==0&&t<=YP}function y6(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}function Gl(t){return t!=null&&typeof t=="object"}var m6=jP?GW(jP):PK;function zK(t){return QK(t)?xK(t):RK(t)}function WK(){return[]}function KK(){return!1}ju.exports=kK});var v8=w(ve=>{"use strict";c();Object.defineProperty(ve,"__esModule",{value:!0});var _o=Wn(),$K=Od(),YK=Z2(),bg=gN(),tt=n1(),Xi=v1(),E6=(kd(),nt(bN)),JK=(zO(),nt(kO)),ee=Vp(),XK=(Sv(),nt(Iv)),It=co(),ZK=(OP(),nt(NP)),kr=(ql(),nt(Kt)),e$=(MP(),nt(FP)),t$=w6();function Wl(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}function r$(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 n$=Wl(_o),F6=Wl($K),i$=Wl(YK),hg=r$(JK),s$=Wl(e$),o$=Wl(t$);function a$(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,R=new Uint8Array(x);A!==D;){for(var P=v[A],L=0,_=x-1;(P!==0||L>>0,R[_]=P%a>>>0,P=P/a>>>0;if(P!==0)throw new Error("Non-zero carry");B=L,A++}for(var C=x-B;C!==x&&R[C]===0;)C++;for(var M=u.repeat(T);C>>0,x=new Uint8Array(D);v[T];){var R=r[v.charCodeAt(T)];if(R===255)return;for(var P=0,L=D-1;(R!==0||P>>0,x[L]=R%256>>>0,R=R/256>>>0;if(R!==0)throw new Error("Non-zero carry");A=P,T++}if(v[T]!==" "){for(var _=D-A;_!==D&&x[_]===0;)_++;for(var C=new Uint8Array(B+(D-_)),M=B;_!==D;)C[M++]=x[_++];return C}}}function m(v){var T=y(v);if(T)return T;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:y,decode:m}}var u$=a$,c$=u$,M6=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")},l$=t=>new TextEncoder().encode(t),f$=t=>new TextDecoder().decode(t),_A=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")}},IA=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 U6(this,e)}},SA=class{constructor(e){this.decoders=e}or(e){return U6(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`)}},U6=(t,e)=>new SA({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),CA=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new _A(e,r,n),this.decoder=new IA(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},_g=({name:t,prefix:e,encode:r,decode:n})=>new CA(t,e,r,n),Kl=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=c$(r,e);return _g({prefix:t,name:e,encode:n,decode:s=>M6(i(s))})},h$=(t,e,r,n)=>{let i={};for(let f=0;f=8&&(a-=8,o[l++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},d$=(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<_g({prefix:e,name:t,encode(i){return d$(i,n,r)},decode(i){return h$(i,n,r,t)}}),p$=_g({prefix:"\0",name:"identity",encode:t=>f$(t),decode:t=>l$(t)}),g$=Object.freeze({__proto__:null,identity:p$}),y$=qt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),m$=Object.freeze({__proto__:null,base2:y$}),w$=qt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),E$=Object.freeze({__proto__:null,base8:w$}),v$=Kl({prefix:"9",name:"base10",alphabet:"0123456789"}),A$=Object.freeze({__proto__:null,base10:v$}),b$=qt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),_$=qt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),I$=Object.freeze({__proto__:null,base16:b$,base16upper:_$}),S$=qt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),C$=qt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),T$=qt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),x$=qt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),N$=qt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),O$=qt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),D$=qt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),P$=qt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),R$=qt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),B$=Object.freeze({__proto__:null,base32:S$,base32upper:C$,base32pad:T$,base32padupper:x$,base32hex:N$,base32hexupper:O$,base32hexpad:D$,base32hexpadupper:P$,base32z:R$}),L$=Kl({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),F$=Kl({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),M$=Object.freeze({__proto__:null,base36:L$,base36upper:F$}),U$=Kl({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),q$=Kl({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),V$=Object.freeze({__proto__:null,base58btc:U$,base58flickr:q$}),j$=qt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),H$=qt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),G$=qt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Q$=qt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),k$=Object.freeze({__proto__:null,base64:j$,base64pad:H$,base64url:G$,base64urlpad:Q$}),q6=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}"),z$=q6.reduce((t,e,r)=>(t[r]=e,t),[]),W$=q6.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function K$(t){return t.reduce((e,r)=>(e+=z$[r],e),"")}function $$(t){let e=[];for(let r of t){let n=W$[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var Y$=_g({prefix:"\u{1F680}",name:"base256emoji",encode:K$,decode:$$}),J$=Object.freeze({__proto__:null,base256emoji:Y$}),X$=V6,v6=128,Z$=127,eY=~Z$,tY=Math.pow(2,31);function V6(t,e,r){e=e||[],r=r||0;for(var n=r;t>=tY;)e[r++]=t&255|v6,t/=128;for(;t&eY;)e[r++]=t&255|v6,t>>>=7;return e[r]=t|0,V6.bytes=r-n+1,e}var rY=TA,nY=128,A6=127;function TA(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw TA.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&A6)<=nY);return TA.bytes=s-n,r}var iY=Math.pow(2,7),sY=Math.pow(2,14),oY=Math.pow(2,21),aY=Math.pow(2,28),uY=Math.pow(2,35),cY=Math.pow(2,42),lY=Math.pow(2,49),fY=Math.pow(2,56),hY=Math.pow(2,63),dY=function(t){return t(j6.encode(t,e,r),e),_6=t=>j6.encodingLength(t),xA=(t,e)=>{let r=e.byteLength,n=_6(t),i=n+_6(r),s=new Uint8Array(i+r);return b6(t,s,0),b6(r,s,n),s.set(e,i),new NA(t,r,e,s)},NA=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}},H6=({name:t,code:e,encode:r})=>new OA(t,e,r),OA=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?xA(this.code,r):r.then(n=>xA(this.code,n))}else throw Error("Unknown type, must be binary type")}},G6=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),gY=H6({name:"sha2-256",code:18,encode:G6("SHA-256")}),yY=H6({name:"sha2-512",code:19,encode:G6("SHA-512")}),mY=Object.freeze({__proto__:null,sha256:gY,sha512:yY}),Q6=0,wY="identity",k6=M6,EY=t=>xA(Q6,k6(t)),vY={code:Q6,name:wY,encode:k6,digest:EY},AY=Object.freeze({__proto__:null,identity:vY});new TextEncoder,new TextDecoder;var I6={...g$,...m$,...E$,...A$,...I$,...B$,...M$,...V$,...k$,...J$};({...mY,...AY});function bY(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function z6(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var S6=z6("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),AA=z6("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);let e=bY(t.length);for(let r=0;r{if(!this.initialized){let n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}},this.has=n=>(this.isInitialized(),this.keychain.has(n)),this.set=async(n,i)=>{this.isInitialized(),this.keychain.set(n,i),await this.persist()},this.get=n=>{this.isInitialized();let i=this.keychain.get(n);if(typeof i>"u"){let{message:s}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(s)}return i},this.del=async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()},this.core=e,this.logger=tt.generateChildLogger(r,this.name)}get context(){return tt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,ee.mapToObj(e))}async getKeyChain(){let e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?ee.objToMap(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},pg=class{constructor(e,r,n){this.core=e,this.logger=r,this.name=Y6,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=hg.generateKeyPair(i);return hg.encodeIss(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();let i=ee.generateKeyPair();return this.setPrivateKey(i.publicKey,i.privateKey)},this.signJWT=async i=>{this.isInitialized();let s=await this.getClientSeed(),o=hg.generateKeyPair(s),a=ee.generateRandomBytes32(),u=J6;return await hg.signJWT(a,i,u,o)},this.generateSharedKey=(i,s,o)=>{this.isInitialized();let a=this.getPrivateKey(i),u=ee.deriveSymKey(a,s);return this.setSymKey(u,o)},this.setSymKey=async(i,s)=>{this.isInitialized();let o=s||ee.hashKey(i);return await this.keychain.set(o,i),o},this.deleteKeyPair=async i=>{this.isInitialized(),await this.keychain.del(i)},this.deleteSymKey=async i=>{this.isInitialized(),await this.keychain.del(i)},this.encode=async(i,s,o)=>{this.isInitialized();let a=ee.validateEncoding(o),u=E6.safeJsonStringify(s);if(ee.isTypeOneEnvelope(a)){let y=a.senderPublicKey,m=a.receiverPublicKey;i=await this.generateSharedKey(y,m)}let l=this.getSymKey(i),{type:f,senderPublicKey:d}=a;return ee.encrypt({type:f,symKey:l,message:u,senderPublicKey:d})},this.decode=async(i,s,o)=>{this.isInitialized();let a=ee.validateDecoding(s,o);if(ee.isTypeOneEnvelope(a)){let f=a.receiverPublicKey,d=a.senderPublicKey;i=await this.generateSharedKey(f,d)}let u=this.getSymKey(i),l=ee.decrypt({symKey:u,encoded:s});return E6.safeJsonParse(l)},this.getPayloadType=i=>{let s=ee.deserialize(i);return ee.decodeTypeByte(s.type)},this.getPayloadSenderPublicKey=i=>{let s=ee.deserialize(i);return s.senderPublicKey?XK.toString(s.senderPublicKey,ee.BASE16):void 0},this.core=e,this.logger=tt.generateChildLogger(r,this.name),this.keychain=n||new dg(this.core,this.logger)}get context(){return tt.getLoggerContext(this.logger)}async setPrivateKey(e,r){return await this.keychain.set(e,r),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(DA)}catch{e=ee.generateRandomBytes32(),await this.keychain.set(DA,e)}return IY(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},gg=class extends Xi.IMessageTracker{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=e8,this.version=t8,this.initialized=!1,this.storagePrefix=si,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{let n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}},this.set=async(n,i)=>{this.isInitialized();let s=ee.hashMessage(i),o=this.messages.get(n);return typeof o>"u"&&(o={}),typeof o[s]<"u"||(o[s]=i,this.messages.set(n,o),await this.persist()),s},this.get=n=>{this.isInitialized();let i=this.messages.get(n);return typeof i>"u"&&(i={}),i},this.has=(n,i)=>{this.isInitialized();let s=this.get(n),o=ee.hashMessage(i);return typeof s[o]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=tt.generateChildLogger(e,this.name),this.core=r}get context(){return tt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,ee.mapToObj(e))}async getRelayerMessages(){let e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?ee.objToMap(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},PA=class extends Xi.IPublisher{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new _o.EventEmitter,this.name=n8,this.queue=new Map,this.publishTimeout=1e4,this.publish=async(n,i,s)=>{this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}});try{let o=s?.ttl||r8,a=ee.getRelayProtocolName(s),u=s?.prompt||!1,l=s?.tag||0,f={topic:n,message:i,opts:{ttl:o,relay:a,prompt:u,tag:l}},d=ee.hashMessage(i);this.queue.set(d,f);try{await await ee.createExpiringPromise(this.rpcPublish(n,i,o,a,u,l),this.publishTimeout),this.relayer.events.emit(Ut.publish,f)}catch{this.logger.debug("Publishing Payload stalled"),this.relayer.events.emit(Ut.connection_stalled);return}this.onPublish(d,f),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}})}catch(o){throw this.logger.debug("Failed to Publish Payload"),this.logger.error(o),o}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.relayer=e,this.logger=tt.generateChildLogger(r,this.name),this.registerEventListeners()}get context(){return tt.getLoggerContext(this.logger)}rpcPublish(e,r,n,i,s,o){var a,u,l,f;let d={method:ee.getRelayProtocolApi(i.protocol).publish,params:{topic:e,message:r,ttl:n,prompt:s,tag:o}};return ee.isUndefined((a=d.params)==null?void 0:a.prompt)&&((u=d.params)==null||delete u.prompt),ee.isUndefined((l=d.params)==null?void 0:l.tag)&&((f=d.params)==null||delete f.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:d}),this.relayer.request(d)}onPublish(e,r){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{let{topic:r,message:n,opts:i}=e;await this.publish(r,n,i)})}registerEventListeners(){this.relayer.core.heartbeat.on(bg.HEARTBEAT_EVENTS.pulse,()=>{this.checkQueue()})}},RA=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())}},NY=Object.defineProperty,OY=Object.defineProperties,DY=Object.getOwnPropertyDescriptors,C6=Object.getOwnPropertySymbols,PY=Object.prototype.hasOwnProperty,RY=Object.prototype.propertyIsEnumerable,T6=(t,e,r)=>e in t?NY(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,kl=(t,e)=>{for(var r in e||(e={}))PY.call(e,r)&&T6(t,r,e[r]);if(C6)for(var r of C6(e))RY.call(e,r)&&T6(t,r,e[r]);return t},bA=(t,e)=>OY(t,DY(e)),yg=class extends Xi.ISubscriber{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new RA,this.events=new _o.EventEmitter,this.name=f8,this.version=h8,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=si,this.subscribeTimeout=1e4,this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restart(),this.registerEventListeners(),this.onEnable(),this.clientId=await this.relayer.core.crypto.getClientId())},this.subscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}});try{let s=ee.getRelayProtocolName(i),o={topic:n,relay:s};this.pending.set(n,o);let a=await this.rpcSubscribe(n,s);return this.onSubscribe(a,o),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}}),a}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}},this.unsubscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),typeof i?.id<"u"?await this.unsubscribeById(n,i.id,i):await this.unsubscribeByTopic(n,i)},this.isSubscribed=async n=>this.topics.includes(n)?!0:await new Promise((i,s)=>{let o=new It.Watch;o.start(this.pendingSubscriptionWatchLabel);let a=setInterval(()=>{!this.pending.has(n)&&this.topics.includes(n)&&(clearInterval(a),o.stop(this.pendingSubscriptionWatchLabel),i(!0)),o.elapsed(this.pendingSubscriptionWatchLabel)>=d8&&(clearInterval(a),o.stop(this.pendingSubscriptionWatchLabel),s(!1))},this.pollingInterval)}),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=tt.generateChildLogger(r,this.name),this.clientId=""}get context(){return tt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,r){let n=!1;try{n=this.getSubscription(e).topic===r}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,r){let n=this.topicMap.get(e);await Promise.all(n.map(async i=>await this.unsubscribeById(e,i,r)))}async unsubscribeById(e,r,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}});try{let i=ee.getRelayProtocolName(n);await this.rpcUnsubscribe(e,r,i);let s=ee.getSdkError("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,r,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}})}catch(i){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(i),i}}async rpcSubscribe(e,r){let n={method:ee.getRelayProtocolApi(r.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{await await ee.createExpiringPromise(this.relayer.request(n),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(Ut.connection_stalled)}return ee.hashMessage(e+this.clientId)}async rpcBatchSubscribe(e){if(!e.length)return;let r=e[0].relay,n={method:ee.getRelayProtocolApi(r.protocol).batchSubscribe,params:{topics:e.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await ee.createExpiringPromise(this.relayer.request(n),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Payload stalled"),this.relayer.events.emit(Ut.connection_stalled)}}rpcUnsubscribe(e,r,n){let i={method:ee.getRelayProtocolApi(n.protocol).unsubscribe,params:{topic:e,id:r}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(e,r){this.setSubscription(e,bA(kl({},r),{id:e})),this.pending.delete(r.topic)}onBatchSubscribe(e){e.length&&e.forEach(r=>{this.setSubscription(r.id,kl({},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,kl({},r)),this.topicMap.set(r.topic,e),this.events.emit(Qr.created,r)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});let r=this.subscriptions.get(e);if(!r){let{message:n}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}deleteSubscription(e,r){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:r});let n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit(Qr.deleted,bA(kl({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Qr.sync)}async reset(){if(!this.cached.length)return;let e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r"u"||!e.length)return;if(this.subscriptions.size){let{message:r}=ee.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;let r=await this.rpcBatchSubscribe(e);ee.isValidArray(r)&&this.onBatchSubscribe(r.map((n,i)=>bA(kl({},e[i]),{id:n})))}async onConnect(){this.restartInProgress||(await this.restart(),this.onEnable())}onDisconnect(){this.onDisable()}async checkPending(){if(this.relayer.transportExplicitlyClosed)return;let e=[];this.pending.forEach(r=>{e.push(r)}),await this.batchSubscribe(e)}registerEventListeners(){this.relayer.core.heartbeat.on(bg.HEARTBEAT_EVENTS.pulse,async()=>{await this.checkPending()}),this.relayer.on(Ut.connect,async()=>{await this.onConnect()}),this.relayer.on(Ut.disconnect,()=>{this.onDisconnect()}),this.events.on(Qr.created,async e=>{let r=Qr.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()}),this.events.on(Qr.deleted,async e=>{let r=Qr.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){this.restartInProgress&&await new Promise(e=>{let r=setInterval(()=>{this.restartInProgress||(clearInterval(r),e())},this.pollingInterval)})}},BY=Object.defineProperty,x6=Object.getOwnPropertySymbols,LY=Object.prototype.hasOwnProperty,FY=Object.prototype.propertyIsEnumerable,N6=(t,e,r)=>e in t?BY(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,MY=(t,e)=>{for(var r in e||(e={}))LY.call(e,r)&&N6(t,r,e[r]);if(x6)for(var r of x6(e))FY.call(e,r)&&N6(t,r,e[r]);return t},mg=class extends Xi.IRelayer{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new _o.EventEmitter,this.name=o8,this.transportExplicitlyClosed=!1,this.initialized=!1,this.reconnecting=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","socket stalled"],this.request=async r=>{this.logger.debug("Publishing Request Payload");try{return await this.toEstablishConnection(),await this.provider.request(r)}catch(n){throw this.logger.debug("Failed to Publish Request"),this.logger.error(n),n}},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?tt.generateChildLogger(e.logger,this.name):F6.default(tt.getDefaultLoggerOptions({level:e.logger||s8})),this.messages=new gg(this.logger,e.core),this.subscriber=new yg(this,this.logger),this.publisher=new PA(this,this.logger),this.relayUrl=e?.relayUrl||LA,this.projectId=e.projectId,this.provider={}}async init(){this.logger.trace("Initialized"),await this.createProvider(),await Promise.all([this.messages.init(),this.transportOpen(),this.subscriber.init()]),this.registerEventListeners(),this.initialized=!0}get context(){return tt.getLoggerContext(this.logger)}get connected(){return this.provider.connection.connected}get connecting(){return this.provider.connection.connecting}async publish(e,r,n){this.isInitialized(),await this.publisher.publish(e,r,n),await this.recordMessageEvent({topic:e,message:r,publishedAt:Date.now()})}async subscribe(e,r){this.isInitialized();let n="";return await Promise.all([new Promise(i=>{this.subscriber.once(Qr.created,s=>{s.topic===e&&i()})}),new Promise(async i=>{n=await this.subscriber.subscribe(e,r),i()})]),n}async unsubscribe(e,r){this.isInitialized(),await this.subscriber.unsubscribe(e,r)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async transportClose(){this.transportExplicitlyClosed=!0,this.connected&&(await this.provider.disconnect(),this.events.emit(Ut.transport_closed))}async transportOpen(e){if(!this.reconnecting){this.relayUrl=e||this.relayUrl,this.transportExplicitlyClosed=!1,this.reconnecting=!0;try{await Promise.all([new Promise(r=>{this.initialized||r(),this.subscriber.once(Qr.resubscribed,()=>{r()})}),await Promise.race([new Promise(async(r,n)=>{await ee.createExpiringPromise(this.provider.connect(),5e3,"socket stalled").catch(i=>n(i)).then(()=>r()).finally(()=>this.removeListener(Ut.transport_closed,this.rejectTransportOpen))}),new Promise(r=>this.once(Ut.transport_closed,this.rejectTransportOpen))])])}catch(r){this.logger.error(r);let n=r;if(!this.isConnectionStalled(n.message))throw r;this.events.emit(Ut.transport_closed)}finally{this.reconnecting=!1}}}async restartTransport(e){this.transportExplicitlyClosed||(this.relayUrl=e||this.relayUrl,await this.transportClose(),await new Promise(r=>setTimeout(r,500)),await this.createProvider(),await this.transportOpen())}isConnectionStalled(e){return this.staleConnectionErrors.some(r=>e.includes(r))}rejectTransportOpen(){throw new Error("closeTransport called before connection was established")}async createProvider(){let e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new ZK.JsonRpcProvider(new s$.default(ee.formatRelayRpcUrl({sdkVersion:c8,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0}))),this.registerProviderListeners()}async recordMessageEvent(e){let{topic:r,message:n}=e;await this.messages.set(r,n)}async shouldIgnoreMessageEvent(e){let{topic:r,message:n}=e;return await this.subscriber.isSubscribed(r)?this.messages.has(r,n):!0}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),kr.isJsonRpcRequest(e)){if(!e.method.endsWith(a8))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(MY({type:"event",event:r.id},o)),this.events.emit(r.id,o),await this.acknowledgePayload(e),await this.onMessageEvent(o)}}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(Ut.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){let r=kr.formatJsonRpcResult(e.id,!0);await this.provider.connection.send(r)}registerProviderListeners(){this.provider.on(zl.payload,e=>this.onProviderPayload(e)),this.provider.on(zl.connect,()=>{this.events.emit(Ut.connect)}),this.provider.on(zl.disconnect,()=>{this.onProviderDisconnect()}),this.provider.on(zl.error,e=>{this.logger.error(e),this.events.emit(Ut.error,e)})}registerEventListeners(){this.events.on(Ut.connection_stalled,async()=>{await this.restartTransport()})}onProviderDisconnect(){this.events.emit(Ut.disconnect),this.attemptToReconnect()}attemptToReconnect(){this.transportExplicitlyClosed||setTimeout(async()=>{await this.restartTransport()},It.toMiliseconds(u8))}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){if(!this.connected){if(this.connecting)return await new Promise(e=>{let r=setInterval(()=>{this.connected&&(clearInterval(r),e())},this.connectionStatusPollingInterval)});await this.restartTransport()}}},UY=Object.defineProperty,O6=Object.getOwnPropertySymbols,qY=Object.prototype.hasOwnProperty,VY=Object.prototype.propertyIsEnumerable,D6=(t,e,r)=>e in t?UY(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,P6=(t,e)=>{for(var r in e||(e={}))qY.call(e,r)&&D6(t,r,e[r]);if(O6)for(var r of O6(e))VY.call(e,r)&&D6(t,r,e[r]);return t},wg=class extends Xi.IStore{constructor(e,r,n,i=si,s=void 0){super(e,r,n,i),this.core=e,this.logger=r,this.name=n,this.map=new Map,this.version=l8,this.cached=[],this.initialized=!1,this.storagePrefix=si,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!ee.isUndefined(o)?this.map.set(this.getKey(o),o):ee.isProposalStruct(o)?this.map.set(o.id,o):ee.isSessionStruct(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)},this.set=async(o,a)=>{this.isInitialized(),this.map.has(o)?await this.update(o,a):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:a}),this.map.set(o,a),await this.persist())},this.get=o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o)),this.getAll=o=>(this.isInitialized(),o?this.values.filter(a=>Object.keys(o).every(u=>o$.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=P6(P6({},this.getData(o)),a);this.map.set(o,u),await this.persist()},this.delete=async(o,a)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:a}),this.map.delete(o),await this.persist())},this.logger=tt.generateChildLogger(r,this.name),this.storagePrefix=i,this.getKey=s}get context(){return tt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){let r=this.map.get(e);if(!r){let{message:n}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}async persist(){await this.setDataStore(this.values)}async restore(){try{let e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){let{message:r}=ee.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Eg=class{constructor(e,r){this.core=e,this.logger=r,this.name=p8,this.version=g8,this.events=new n$.default,this.initialized=!1,this.storagePrefix=si,this.ignoredPayloadTypes=[ee.TYPE_1],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]},this.create=async()=>{this.isInitialized();let n=ee.generateRandomBytes32(),i=await this.core.crypto.setSymKey(n),s=ee.calcExpiry(It.FIVE_MINUTES),o={protocol:i8},a={topic:i,expiry:s,relay:o,active:!1},u=ee.formatUri({protocol:this.core.protocol,version:this.core.version,topic:i,symKey:n,relay:o});return await this.pairings.set(i,a),await this.core.relayer.subscribe(i),this.core.expirer.set(i,s),{topic:i,uri:u}},this.pair=async n=>{this.isInitialized(),this.isValidPair(n);let{topic:i,symKey:s,relay:o}=ee.parseUri(n.uri);if(this.pairings.keys.includes(i))throw new Error(`Pairing already exists: ${i}`);if(this.core.crypto.hasKeys(i))throw new Error(`Keychain already exists: ${i}`);let a=ee.calcExpiry(It.FIVE_MINUTES),u={topic:i,relay:o,expiry:a,active:!1};return await this.pairings.set(i,u),await this.core.crypto.setSymKey(s,i),await this.core.relayer.subscribe(i,{relay:o}),this.core.expirer.set(i,a),n.activatePairing&&await this.activate({topic:i}),u},this.activate=async({topic:n})=>{this.isInitialized();let i=ee.calcExpiry(It.THIRTY_DAYS);await this.pairings.update(n,{active:!0,expiry:i}),this.core.expirer.set(n,i)},this.ping=async n=>{this.isInitialized(),await this.isValidPing(n);let{topic:i}=n;if(this.pairings.keys.includes(i)){let s=await this.sendRequest(i,"wc_pairingPing",{}),{done:o,resolve:a,reject:u}=ee.createDelayedPromise();this.events.once(ee.engineEvent("pairing_ping",s),({error:l})=>{l?u(l):a()}),await o()}},this.updateExpiry=async({topic:n,expiry:i})=>{this.isInitialized(),await this.pairings.update(n,{expiry:i})},this.updateMetadata=async({topic:n,metadata:i})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:i})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async n=>{this.isInitialized(),await this.isValidDisconnect(n);let{topic:i}=n;this.pairings.keys.includes(i)&&(await this.sendRequest(i,"wc_pairingDelete",ee.getSdkError("USER_DISCONNECTED")),await this.deletePairing(i))},this.sendRequest=async(n,i,s)=>{let o=kr.formatJsonRpcRequest(i,s),a=await this.core.crypto.encode(n,o),u=Gu[i].req;return this.core.history.set(n,o),await this.core.relayer.publish(n,a,u),o.id},this.sendResult=async(n,i,s)=>{let o=kr.formatJsonRpcResult(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=Gu[u.request.method].res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.sendError=async(n,i,s)=>{let o=kr.formatJsonRpcError(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=Gu[u.request.method]?Gu[u.request.method].res:Gu.unregistered_method.res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.deletePairing=async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,ee.getSdkError("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),i?Promise.resolve():this.core.expirer.del(n)])},this.cleanup=async()=>{let n=this.pairings.getAll().filter(i=>ee.isExpired(i.expiry));await Promise.all(n.map(i=>this.deletePairing(i.topic)))},this.onRelayEventRequest=n=>{let{topic:i,payload:s}=n,o=s.method;if(this.pairings.keys.includes(i))switch(o){case"wc_pairingPing":return this.onPairingPingRequest(i,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(i,s);default:return this.onUnknownRpcMethodRequest(i,s)}},this.onRelayEventResponse=async n=>{let{topic:i,payload:s}=n,o=(await this.core.history.get(i,s.id)).request.method;if(this.pairings.keys.includes(i))switch(o){case"wc_pairingPing":return this.onPairingPingResponse(i,s);default:return this.onUnknownRpcMethodResponse(o)}},this.onPairingPingRequest=async(n,i)=>{let{id:s}=i;try{this.isValidPing({topic:n}),await this.sendResult(s,n,!0),this.events.emit("pairing_ping",{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onPairingPingResponse=(n,i)=>{let{id:s}=i;setTimeout(()=>{kr.isJsonRpcResult(i)?this.events.emit(ee.engineEvent("pairing_ping",s),{}):kr.isJsonRpcError(i)&&this.events.emit(ee.engineEvent("pairing_ping",s),{error:i.error})},500)},this.onPairingDeleteRequest=async(n,i)=>{let{id:s}=i;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit("pairing_delete",{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onUnknownRpcMethodRequest=async(n,i)=>{let{id:s,method:o}=i;try{if(this.registeredMethods.includes(o))return;let a=ee.getSdkError("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,n,a),this.logger.error(a)}catch(a){await this.sendError(s,n,a),this.logger.error(a)}},this.onUnknownRpcMethodResponse=n=>{this.registeredMethods.includes(n)||this.logger.error(ee.getSdkError("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=n=>{if(!ee.isValidParams(n)){let{message:i}=ee.getInternalError("MISSING_OR_INVALID",`pair() params: ${n}`);throw new Error(i)}if(!ee.isValidUrl(n.uri)){let{message:i}=ee.getInternalError("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw new Error(i)}},this.isValidPing=async n=>{if(!ee.isValidParams(n)){let{message:s}=ee.getInternalError("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}let{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidDisconnect=async n=>{if(!ee.isValidParams(n)){let{message:s}=ee.getInternalError("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}let{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidPairingTopic=async n=>{if(!ee.isValidString(n,!1)){let{message:i}=ee.getInternalError("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){let{message:i}=ee.getInternalError("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(ee.isExpired(this.pairings.get(n).expiry)){await this.deletePairing(n);let{message:i}=ee.getInternalError("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}},this.core=e,this.logger=tt.generateChildLogger(r,this.name),this.pairings=new wg(this.core,this.logger,this.name,this.storagePrefix)}get context(){return tt.getLoggerContext(this.logger)}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(Ut.message,async e=>{let{topic:r,message:n}=e;if(this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;let i=await this.core.crypto.decode(r,n);kr.isJsonRpcRequest(i)?(this.core.history.set(r,i),this.onRelayEventRequest({topic:r,payload:i})):kr.isJsonRpcResponse(i)&&(await this.core.history.resolve(i),this.onRelayEventResponse({topic:r,payload:i}))})}registerExpirerEvents(){this.core.expirer.on(Dr.expired,async e=>{let{topic:r}=ee.parseExpirerTarget(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit("pairing_expire",{topic:r}))})}},vg=class extends Xi.IJsonRpcHistory{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new _o.EventEmitter,this.name=y8,this.version=m8,this.cached=[],this.initialized=!1,this.storagePrefix=si,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.records.set(n.id,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(n,i,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:i,chainId:s}),this.records.has(i.id))return;let o={id:i.id,topic:n,request:{method:i.method,params:i.params||null},chainId:s};this.records.set(o.id,o),this.events.emit(Gr.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=kr.isJsonRpcError(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.events.emit(Gr.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(Gr.deleted,s)}})},this.exists=async(n,i)=>(this.isInitialized(),this.records.has(i)?(await this.getRecord(i)).topic===n:!1),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=tt.generateChildLogger(r,this.name)}get context(){return tt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){let e=[];return this.values.forEach(r=>{if(typeof r.response<"u")return;let n={topic:r.topic,request:kr.formatJsonRpcRequest(r.request.method,r.request.params,r.id),chainId:r.chainId};return e.push(n)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();let r=this.records.get(e);if(!r){let{message:n}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(Gr.sync)}async restore(){try{let e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){let{message:r}=ee.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(Gr.created,e=>{let r=Gr.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.events.on(Gr.updated,e=>{let r=Gr.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.events.on(Gr.deleted,e=>{let r=Gr.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Ag=class extends Xi.IExpirer{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new _o.EventEmitter,this.name=w8,this.version=E8,this.cached=[],this.initialized=!1,this.storagePrefix=si,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(Dr.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(Dr.deleted,{target:i,expiration:s})}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=tt.generateChildLogger(r,this.name)}get context(){return tt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return ee.formatTopicTarget(e);if(typeof e=="number")return ee.formatIdTarget(e);let{message:r}=ee.getInternalError("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(r)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(Dr.sync)}async restore(){try{let e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){let{message:r}=ee.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){let r=this.expirations.get(e);if(!r){let{message:n}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}checkExpiry(e,r){let{expiry:n}=r;It.toMiliseconds(n)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(Dr.expired,{target:e,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(bg.HEARTBEAT_EVENTS.pulse,()=>this.checkExpirations()),this.events.on(Dr.created,e=>{let r=Dr.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Dr.expired,e=>{let r=Dr.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Dr.deleted,e=>{let r=Dr.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},jY=Object.defineProperty,R6=Object.getOwnPropertySymbols,HY=Object.prototype.hasOwnProperty,GY=Object.prototype.propertyIsEnumerable,B6=(t,e,r)=>e in t?jY(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,L6=(t,e)=>{for(var r in e||(e={}))HY.call(e,r)&&B6(t,r,e[r]);if(R6)for(var r of R6(e))GY.call(e,r)&&B6(t,r,e[r]);return t},Qu=class extends Xi.ICore{constructor(e){super(e),this.protocol=BA,this.version=W6,this.name=Ig,this.events=new _o.EventEmitter,this.initialized=!1,this.on=(n,i)=>this.events.on(n,i),this.once=(n,i)=>this.events.once(n,i),this.off=(n,i)=>this.events.off(n,i),this.removeListener=(n,i)=>this.events.removeListener(n,i),this.projectId=e?.projectId,this.relayUrl=e?.relayUrl||LA;let r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:F6.default(tt.getDefaultLoggerOptions({level:e?.logger||K6.logger}));this.logger=tt.generateChildLogger(r,this.name),this.heartbeat=new bg.HeartBeat,this.crypto=new pg(this,this.logger,e?.keychain),this.history=new vg(this,this.logger),this.expirer=new Ag(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new i$.default(L6(L6({},$6),e?.storageOptions)),this.relayer=new mg({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new Eg(this,this.logger)}static async init(e){let r=new Qu(e);return await r.initialize(),r}get context(){return tt.getLoggerContext(this.logger)}async start(){this.initialized||await this.initialize()}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}},QY=Qu;ve.CORE_CONTEXT=Ig,ve.CORE_DEFAULT=K6,ve.CORE_PROTOCOL=BA,ve.CORE_STORAGE_OPTIONS=$6,ve.CORE_STORAGE_PREFIX=si,ve.CORE_VERSION=W6,ve.CRYPTO_CLIENT_SEED=DA,ve.CRYPTO_CONTEXT=Y6,ve.CRYPTO_JWT_TTL=J6,ve.Core=QY,ve.Crypto=pg,ve.EXPIRER_CONTEXT=w8,ve.EXPIRER_DEFAULT_TTL=xY,ve.EXPIRER_EVENTS=Dr,ve.EXPIRER_STORAGE_VERSION=E8,ve.Expirer=Ag,ve.HISTORY_CONTEXT=y8,ve.HISTORY_EVENTS=Gr,ve.HISTORY_STORAGE_VERSION=m8,ve.JsonRpcHistory=vg,ve.KEYCHAIN_CONTEXT=X6,ve.KEYCHAIN_STORAGE_VERSION=Z6,ve.KeyChain=dg,ve.MESSAGES_CONTEXT=e8,ve.MESSAGES_STORAGE_VERSION=t8,ve.MessageTracker=gg,ve.PAIRING_CONTEXT=p8,ve.PAIRING_DEFAULT_TTL=TY,ve.PAIRING_RPC_OPTS=Gu,ve.PAIRING_STORAGE_VERSION=g8,ve.PENDING_SUB_RESOLUTION_TIMEOUT=d8,ve.PUBLISHER_CONTEXT=n8,ve.PUBLISHER_DEFAULT_TTL=r8,ve.Pairing=Eg,ve.RELAYER_CONTEXT=o8,ve.RELAYER_DEFAULT_LOGGER=s8,ve.RELAYER_DEFAULT_PROTOCOL=i8,ve.RELAYER_DEFAULT_RELAY_URL=LA,ve.RELAYER_EVENTS=Ut,ve.RELAYER_PROVIDER_EVENTS=zl,ve.RELAYER_RECONNECT_TIMEOUT=u8,ve.RELAYER_SDK_VERSION=c8,ve.RELAYER_STORAGE_OPTIONS=SY,ve.RELAYER_SUBSCRIBER_SUFFIX=a8,ve.Relayer=mg,ve.STORE_STORAGE_VERSION=l8,ve.SUBSCRIBER_CONTEXT=f8,ve.SUBSCRIBER_DEFAULT_TTL=CY,ve.SUBSCRIBER_EVENTS=Qr,ve.SUBSCRIBER_STORAGE_VERSION=h8,ve.Store=wg,ve.Subscriber=yg,ve.default=Qu});var D8=w(it=>{"use strict";c();Object.defineProperty(it,"__esModule",{value:!0});var kY=Od(),Zi=v8(),FA=n1(),_8=v1(),k=Vp(),I8=Wn(),st=co(),St=(ql(),nt(Kt));function S8(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var zY=S8(kY),WY=S8(I8),HA="wc",GA=2,QA="client",Tg=`${HA}@${GA}:${QA}:`,Sg={name:QA,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},KY={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"},$Y={database:":memory:"},YY={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},JY="history",XY="0.3",C8="proposal",ZY=st.THIRTY_DAYS,T8="Proposal expired",x8="session",$l=st.SEVEN_DAYS,N8="engine",ku={wc_sessionPropose:{req:{ttl:st.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:st.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:st.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:st.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:st.ONE_DAY,prompt:!1,tag:1104},res:{ttl:st.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:st.ONE_DAY,prompt:!1,tag:1106},res:{ttl:st.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:st.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:st.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:st.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:st.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:st.ONE_DAY,prompt:!1,tag:1112},res:{ttl:st.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:st.THIRTY_SECONDS,prompt:!1,tag:1114},res:{ttl:st.THIRTY_SECONDS,prompt:!1,tag:1115}}},Cg={min:st.FIVE_MINUTES,max:st.SEVEN_DAYS},O8="request",eJ=Object.defineProperty,tJ=Object.defineProperties,rJ=Object.getOwnPropertyDescriptors,A8=Object.getOwnPropertySymbols,nJ=Object.prototype.hasOwnProperty,iJ=Object.prototype.propertyIsEnumerable,b8=(t,e,r)=>e in t?eJ(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Pr=(t,e)=>{for(var r in e||(e={}))nJ.call(e,r)&&b8(t,r,e[r]);if(A8)for(var r of A8(e))iJ.call(e,r)&&b8(t,r,e[r]);return t},MA=(t,e)=>tJ(t,rJ(e)),UA=class extends _8.IEngine{constructor(e){super(e),this.name=N8,this.events=new WY.default,this.initialized=!1,this.ignoredPayloadTypes=[k.TYPE_1],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.client.core.pairing.register({methods:Object.keys(ku)}),this.initialized=!0)},this.connect=async r=>{this.isInitialized();let n=MA(Pr({},r),{requiredNamespaces:r.requiredNamespaces||{},optionalNamespaces:r.optionalNamespaces||{}});await this.isValidConnect(n);let{pairingTopic:i,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:a,relays:u}=n,l=i,f,d=!1;if(l&&(d=this.client.core.pairing.pairings.get(l).active),!l||!d){let{topic:x,uri:R}=await this.client.core.pairing.create();l=x,f=R}let y=await this.client.core.crypto.generateKeyPair(),m=Pr({requiredNamespaces:s,optionalNamespaces:o,relays:u??[{protocol:Zi.RELAYER_DEFAULT_PROTOCOL}],proposer:{publicKey:y,metadata:this.client.metadata}},a&&{sessionProperties:a}),{reject:v,resolve:T,done:B}=k.createDelayedPromise(st.FIVE_MINUTES,T8);if(this.events.once(k.engineEvent("session_connect"),async({error:x,session:R})=>{if(x)v(x);else if(R){R.self.publicKey=y;let P=MA(Pr({},R),{requiredNamespaces:R.requiredNamespaces,optionalNamespaces:R.optionalNamespaces});await this.client.session.set(R.topic,P),await this.setExpiry(R.topic,R.expiry),l&&await this.client.core.pairing.updateMetadata({topic:l,metadata:R.peer.metadata}),T(P)}}),!l){let{message:x}=k.getInternalError("NO_MATCHING_KEY",`connect() pairing topic: ${l}`);throw new Error(x)}let A=await this.sendRequest(l,"wc_sessionPropose",m),D=k.calcExpiry(st.FIVE_MINUTES);return await this.setProposal(A,Pr({id:A,expiry:D},m)),{uri:f,approval:B}},this.pair=async r=>(this.isInitialized(),await this.client.core.pairing.pair(r)),this.approve=async r=>{this.isInitialized(),await this.isValidApprove(r);let{id:n,relayProtocol:i,namespaces:s,sessionProperties:o}=r,a=this.client.proposal.get(n),{pairingTopic:u,proposer:l,requiredNamespaces:f,optionalNamespaces:d}=a;u=u||"",k.isValidObject(f)||(f=k.getRequiredNamespacesFromNamespaces(s,"approve()"));let y=await this.client.core.crypto.generateKeyPair(),m=l.publicKey,v=await this.client.core.crypto.generateSharedKey(y,m);u&&n&&(await this.client.core.pairing.updateMetadata({topic:u,metadata:l.metadata}),await this.sendResult(n,u,{relay:{protocol:i??"irn"},responderPublicKey:y}),await this.client.proposal.delete(n,k.getSdkError("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:u}));let T=Pr({relay:{protocol:i??"irn"},namespaces:s,requiredNamespaces:f,optionalNamespaces:d,pairingTopic:u,controller:{publicKey:y,metadata:this.client.metadata},expiry:k.calcExpiry($l)},o&&{sessionProperties:o});await this.client.core.relayer.subscribe(v),await this.sendRequest(v,"wc_sessionSettle",T);let B=MA(Pr({},T),{topic:v,pairingTopic:u,acknowledged:!1,self:T.controller,peer:{publicKey:l.publicKey,metadata:l.metadata},controller:y});return await this.client.session.set(v,B),await this.setExpiry(v,k.calcExpiry($l)),{topic:v,acknowledged:()=>new Promise(A=>A(this.client.session.get(v)))}},this.reject=async r=>{this.isInitialized(),await this.isValidReject(r);let{id:n,reason:i}=r,{pairingTopic:s}=this.client.proposal.get(n);s&&(await this.sendError(n,s,i),await this.client.proposal.delete(n,k.getSdkError("USER_DISCONNECTED")))},this.update=async r=>{this.isInitialized(),await this.isValidUpdate(r);let{topic:n,namespaces:i}=r,s=await this.sendRequest(n,"wc_sessionUpdate",{namespaces:i}),{done:o,resolve:a,reject:u}=k.createDelayedPromise();return this.events.once(k.engineEvent("session_update",s),({error:l})=>{l?u(l):a()}),await this.client.session.update(n,{namespaces:i}),{acknowledged:o}},this.extend=async r=>{this.isInitialized(),await this.isValidExtend(r);let{topic:n}=r,i=await this.sendRequest(n,"wc_sessionExtend",{}),{done:s,resolve:o,reject:a}=k.createDelayedPromise();return this.events.once(k.engineEvent("session_extend",i),({error:u})=>{u?a(u):o()}),await this.setExpiry(n,k.calcExpiry($l)),{acknowledged:s}},this.request=async r=>{this.isInitialized(),await this.isValidRequest(r);let{chainId:n,request:i,topic:s,expiry:o}=r,a=await this.sendRequest(s,"wc_sessionRequest",{request:i,chainId:n},o),{done:u,resolve:l,reject:f}=k.createDelayedPromise(o);return this.events.once(k.engineEvent("session_request",a),({error:d,result:y})=>{d?f(d):l(y)}),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:a}),await u()},this.respond=async r=>{this.isInitialized(),await this.isValidRespond(r);let{topic:n,response:i}=r,{id:s}=i;St.isJsonRpcResult(i)?await this.sendResult(s,n,i.result):St.isJsonRpcError(i)&&await this.sendError(s,n,i.error),this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0})},this.ping=async r=>{this.isInitialized(),await this.isValidPing(r);let{topic:n}=r;if(this.client.session.keys.includes(n)){let i=await this.sendRequest(n,"wc_sessionPing",{}),{done:s,resolve:o,reject:a}=k.createDelayedPromise();this.events.once(k.engineEvent("session_ping",i),({error:u})=>{u?a(u):o()}),await s()}else this.client.core.pairing.pairings.keys.includes(n)&&await this.client.core.pairing.ping({topic:n})},this.emit=async r=>{this.isInitialized(),await this.isValidEmit(r);let{topic:n,event:i,chainId:s}=r;await this.sendRequest(n,"wc_sessionEvent",{event:i,chainId:s})},this.disconnect=async r=>{this.isInitialized(),await this.isValidDisconnect(r);let{topic:n}=r;this.client.session.keys.includes(n)?(await this.sendRequest(n,"wc_sessionDelete",k.getSdkError("USER_DISCONNECTED")),await this.deleteSession(n)):await this.client.core.pairing.disconnect({topic:n})},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(n=>k.isSessionCompatible(n,r))),this.getPendingSessionRequests=()=>(this.isInitialized(),this.client.pendingRequest.getAll()),this.deleteSession=async(r,n)=>{let{self:i}=this.client.session.get(r);await this.client.core.relayer.unsubscribe(r),await Promise.all([this.client.session.delete(r,k.getSdkError("USER_DISCONNECTED")),this.client.core.crypto.deleteKeyPair(i.publicKey),this.client.core.crypto.deleteSymKey(r),n?Promise.resolve():this.client.core.expirer.del(r)])},this.deleteProposal=async(r,n)=>{await Promise.all([this.client.proposal.delete(r,k.getSdkError("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(r)])},this.deletePendingSessionRequest=async(r,n,i=!1)=>{await Promise.all([this.client.pendingRequest.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)])},this.setExpiry=async(r,n)=>{this.client.session.keys.includes(r)&&await this.client.session.update(r,{expiry:n}),this.client.core.expirer.set(r,n)},this.setProposal=async(r,n)=>{await this.client.proposal.set(r,n),this.client.core.expirer.set(r,n.expiry)},this.setPendingSessionRequest=async r=>{let n=ku.wc_sessionRequest.req.ttl,{id:i,topic:s,params:o}=r;await this.client.pendingRequest.set(i,{id:i,topic:s,params:o}),n&&this.client.core.expirer.set(i,k.calcExpiry(n))},this.sendRequest=async(r,n,i,s)=>{let o=St.formatJsonRpcRequest(n,i),a=await this.client.core.crypto.encode(r,o),u=ku[n].req;return s&&(u.ttl=s),this.client.core.history.set(r,o),this.client.core.relayer.publish(r,a,u),o.id},this.sendResult=async(r,n,i)=>{let s=St.formatJsonRpcResult(r,i),o=await this.client.core.crypto.encode(n,s),a=await this.client.core.history.get(n,r),u=ku[a.request.method].res;this.client.core.relayer.publish(n,o,u),await this.client.core.history.resolve(s)},this.sendError=async(r,n,i)=>{let s=St.formatJsonRpcError(r,i),o=await this.client.core.crypto.encode(n,s),a=await this.client.core.history.get(n,r),u=ku[a.request.method].res;this.client.core.relayer.publish(n,o,u),await this.client.core.history.resolve(s)},this.cleanup=async()=>{let r=[],n=[];this.client.session.getAll().forEach(i=>{k.isExpired(i.expiry)&&r.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{k.isExpired(i.expiry)&&n.push(i.id)}),await Promise.all([...r.map(i=>this.deleteSession(i)),...n.map(i=>this.deleteProposal(i))])},this.onRelayEventRequest=r=>{let{topic:n,payload:i}=r,s=i.method;switch(s){case"wc_sessionPropose":return this.onSessionProposeRequest(n,i);case"wc_sessionSettle":return this.onSessionSettleRequest(n,i);case"wc_sessionUpdate":return this.onSessionUpdateRequest(n,i);case"wc_sessionExtend":return this.onSessionExtendRequest(n,i);case"wc_sessionPing":return this.onSessionPingRequest(n,i);case"wc_sessionDelete":return this.onSessionDeleteRequest(n,i);case"wc_sessionRequest":return this.onSessionRequest(n,i);case"wc_sessionEvent":return this.onSessionEventRequest(n,i);default:return this.client.logger.info(`Unsupported request method ${s}`)}},this.onRelayEventResponse=async r=>{let{topic:n,payload:i}=r,s=(await this.client.core.history.get(n,i.id)).request.method;switch(s){case"wc_sessionPropose":return this.onSessionProposeResponse(n,i);case"wc_sessionSettle":return this.onSessionSettleResponse(n,i);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,i);case"wc_sessionExtend":return this.onSessionExtendResponse(n,i);case"wc_sessionPing":return this.onSessionPingResponse(n,i);case"wc_sessionRequest":return this.onSessionRequestResponse(n,i);default:return this.client.logger.info(`Unsupported response method ${s}`)}},this.onSessionProposeRequest=async(r,n)=>{let{params:i,id:s}=n;try{this.isValidConnect(Pr({},n.params));let o=k.calcExpiry(st.FIVE_MINUTES),a=Pr({id:s,pairingTopic:r,expiry:o},i);await this.setProposal(s,a),this.client.events.emit("session_proposal",{id:s,params:a})}catch(o){await this.sendError(s,r,o),this.client.logger.error(o)}},this.onSessionProposeResponse=async(r,n)=>{let{id:i}=n;if(St.isJsonRpcResult(n)){let{result:s}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:s});let o=this.client.proposal.get(i);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:o});let a=o.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:a});let u=s.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:u});let l=await this.client.core.crypto.generateSharedKey(a,u);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:l});let f=await this.client.core.relayer.subscribe(l);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:f}),await this.client.core.pairing.activate({topic:r})}else St.isJsonRpcError(n)&&(await this.client.proposal.delete(i,k.getSdkError("USER_DISCONNECTED")),this.events.emit(k.engineEvent("session_connect"),{error:n.error}))},this.onSessionSettleRequest=async(r,n)=>{let{id:i,params:s}=n;try{this.isValidSessionSettleRequest(s);let{relay:o,controller:a,expiry:u,namespaces:l,requiredNamespaces:f,optionalNamespaces:d,sessionProperties:y,pairingTopic:m}=n.params,v=Pr({topic:r,relay:o,expiry:u,namespaces:l,acknowledged:!0,pairingTopic:m,requiredNamespaces:f,optionalNamespaces:d,controller:a.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}},y&&{sessionProperties:y});await this.sendResult(n.id,r,!0),this.events.emit(k.engineEvent("session_connect"),{session:v})}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.onSessionSettleResponse=async(r,n)=>{let{id:i}=n;St.isJsonRpcResult(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(k.engineEvent("session_approve",i),{})):St.isJsonRpcError(n)&&(await this.client.session.delete(r,k.getSdkError("USER_DISCONNECTED")),this.events.emit(k.engineEvent("session_approve",i),{error:n.error}))},this.onSessionUpdateRequest=async(r,n)=>{let{params:i,id:s}=n;try{this.isValidUpdate(Pr({topic:r},i)),await this.client.session.update(r,{namespaces:i.namespaces}),await this.sendResult(s,r,!0),this.client.events.emit("session_update",{id:s,topic:r,params:i})}catch(o){await this.sendError(s,r,o),this.client.logger.error(o)}},this.onSessionUpdateResponse=(r,n)=>{let{id:i}=n;St.isJsonRpcResult(n)?this.events.emit(k.engineEvent("session_update",i),{}):St.isJsonRpcError(n)&&this.events.emit(k.engineEvent("session_update",i),{error:n.error})},this.onSessionExtendRequest=async(r,n)=>{let{id:i}=n;try{this.isValidExtend({topic:r}),await this.setExpiry(r,k.calcExpiry($l)),await this.sendResult(i,r,!0),this.client.events.emit("session_extend",{id:i,topic:r})}catch(s){await this.sendError(i,r,s),this.client.logger.error(s)}},this.onSessionExtendResponse=(r,n)=>{let{id:i}=n;St.isJsonRpcResult(n)?this.events.emit(k.engineEvent("session_extend",i),{}):St.isJsonRpcError(n)&&this.events.emit(k.engineEvent("session_extend",i),{error:n.error})},this.onSessionPingRequest=async(r,n)=>{let{id:i}=n;try{this.isValidPing({topic:r}),await this.sendResult(i,r,!0),this.client.events.emit("session_ping",{id:i,topic:r})}catch(s){await this.sendError(i,r,s),this.client.logger.error(s)}},this.onSessionPingResponse=(r,n)=>{let{id:i}=n;setTimeout(()=>{St.isJsonRpcResult(n)?this.events.emit(k.engineEvent("session_ping",i),{}):St.isJsonRpcError(n)&&this.events.emit(k.engineEvent("session_ping",i),{error:n.error})},500)},this.onSessionDeleteRequest=async(r,n)=>{let{id:i}=n;try{this.isValidDisconnect({topic:r,reason:n.params}),this.client.core.relayer.once(Zi.RELAYER_EVENTS.publish,async()=>{await this.deleteSession(r)}),await this.sendResult(i,r,!0),this.client.events.emit("session_delete",{id:i,topic:r})}catch(s){await this.sendError(i,r,s),this.client.logger.error(s)}},this.onSessionRequest=async(r,n)=>{let{id:i,params:s}=n;try{this.isValidRequest(Pr({topic:r},s)),await this.setPendingSessionRequest({id:i,topic:r,params:s}),this.client.events.emit("session_request",{id:i,topic:r,params:s})}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.onSessionRequestResponse=(r,n)=>{let{id:i}=n;St.isJsonRpcResult(n)?this.events.emit(k.engineEvent("session_request",i),{result:n.result}):St.isJsonRpcError(n)&&this.events.emit(k.engineEvent("session_request",i),{error:n.error})},this.onSessionEventRequest=async(r,n)=>{let{id:i,params:s}=n;try{this.isValidEmit(Pr({topic:r},s)),this.client.events.emit("session_event",{id:i,topic:r,params:s})}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.isValidConnect=async r=>{if(!k.isValidParams(r)){let{message:u}=k.getInternalError("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(r)}`);throw new Error(u)}let{pairingTopic:n,requiredNamespaces:i,optionalNamespaces:s,sessionProperties:o,relays:a}=r;if(k.isUndefined(n)||await this.isValidPairingTopic(n),!k.isValidRelays(a,!0)){let{message:u}=k.getInternalError("MISSING_OR_INVALID",`connect() relays: ${a}`);throw new Error(u)}!k.isUndefined(i)&&k.isValidObject(i)!==0&&this.validateNamespaces(i,"requiredNamespaces"),!k.isUndefined(s)&&k.isValidObject(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),k.isUndefined(o)||this.validateSessionProps(o,"sessionProperties")},this.validateNamespaces=(r,n)=>{let i=k.isValidRequiredNamespaces(r,"connect()",n);if(i)throw new Error(i.message)},this.isValidApprove=async r=>{if(!k.isValidParams(r))throw new Error(k.getInternalError("MISSING_OR_INVALID",`approve() params: ${r}`).message);let{id:n,namespaces:i,relayProtocol:s,sessionProperties:o}=r;await this.isValidProposalId(n);let a=this.client.proposal.get(n),u=k.isValidNamespaces(i,"approve()");if(u)throw new Error(u.message);let l=k.isConformingNamespaces(a.requiredNamespaces,i,"approve()");if(l)throw new Error(l.message);if(!k.isValidString(s,!0)){let{message:f}=k.getInternalError("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(f)}k.isUndefined(o)||this.validateSessionProps(o,"sessionProperties")},this.isValidReject=async r=>{if(!k.isValidParams(r)){let{message:s}=k.getInternalError("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(s)}let{id:n,reason:i}=r;if(await this.isValidProposalId(n),!k.isValidErrorReason(i)){let{message:s}=k.getInternalError("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidSessionSettleRequest=r=>{if(!k.isValidParams(r)){let{message:l}=k.getInternalError("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(l)}let{relay:n,controller:i,namespaces:s,expiry:o}=r;if(!k.isValidRelay(n)){let{message:l}=k.getInternalError("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(l)}let a=k.isValidController(i,"onSessionSettleRequest()");if(a)throw new Error(a.message);let u=k.isValidNamespaces(s,"onSessionSettleRequest()");if(u)throw new Error(u.message);if(k.isExpired(o)){let{message:l}=k.getInternalError("EXPIRED","onSessionSettleRequest()");throw new Error(l)}},this.isValidUpdate=async r=>{if(!k.isValidParams(r)){let{message:u}=k.getInternalError("MISSING_OR_INVALID",`update() params: ${r}`);throw new Error(u)}let{topic:n,namespaces:i}=r;await this.isValidSessionTopic(n);let s=this.client.session.get(n),o=k.isValidNamespaces(i,"update()");if(o)throw new Error(o.message);let a=k.isConformingNamespaces(s.requiredNamespaces,i,"update()");if(a)throw new Error(a.message)},this.isValidExtend=async r=>{if(!k.isValidParams(r)){let{message:i}=k.getInternalError("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionTopic(n)},this.isValidRequest=async r=>{if(!k.isValidParams(r)){let{message:u}=k.getInternalError("MISSING_OR_INVALID",`request() params: ${r}`);throw new Error(u)}let{topic:n,request:i,chainId:s,expiry:o}=r;await this.isValidSessionTopic(n);let{namespaces:a}=this.client.session.get(n);if(!k.isValidNamespacesChainId(a,s)){let{message:u}=k.getInternalError("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(u)}if(!k.isValidRequest(i)){let{message:u}=k.getInternalError("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(u)}if(!k.isValidNamespacesRequest(a,s,i.method)){let{message:u}=k.getInternalError("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(u)}if(o&&!k.isValidRequestExpiry(o,Cg)){let{message:u}=k.getInternalError("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${Cg.min} and ${Cg.max}`);throw new Error(u)}},this.isValidRespond=async r=>{if(!k.isValidParams(r)){let{message:s}=k.getInternalError("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(s)}let{topic:n,response:i}=r;if(await this.isValidSessionTopic(n),!k.isValidResponse(i)){let{message:s}=k.getInternalError("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidPing=async r=>{if(!k.isValidParams(r)){let{message:i}=k.getInternalError("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async r=>{if(!k.isValidParams(r)){let{message:a}=k.getInternalError("MISSING_OR_INVALID",`emit() params: ${r}`);throw new Error(a)}let{topic:n,event:i,chainId:s}=r;await this.isValidSessionTopic(n);let{namespaces:o}=this.client.session.get(n);if(!k.isValidNamespacesChainId(o,s)){let{message:a}=k.getInternalError("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(a)}if(!k.isValidEvent(i)){let{message:a}=k.getInternalError("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}if(!k.isValidNamespacesEvent(o,s,i.name)){let{message:a}=k.getInternalError("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}},this.isValidDisconnect=async r=>{if(!k.isValidParams(r)){let{message:i}=k.getInternalError("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.validateSessionProps=(r,n)=>{Object.values(r).forEach(i=>{if(!k.isValidString(i,!1)){let{message:s}=k.getInternalError("MISSING_OR_INVALID",`${n} must be in Record format. Received: ${JSON.stringify(i)}`);throw new Error(s)}})}}isInitialized(){if(!this.initialized){let{message:e}=k.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.client.core.relayer.on(Zi.RELAYER_EVENTS.message,async e=>{let{topic:r,message:n}=e;if(this.ignoredPayloadTypes.includes(this.client.core.crypto.getPayloadType(n)))return;let i=await this.client.core.crypto.decode(r,n);St.isJsonRpcRequest(i)?(this.client.core.history.set(r,i),this.onRelayEventRequest({topic:r,payload:i})):St.isJsonRpcResponse(i)&&(await this.client.core.history.resolve(i),this.onRelayEventResponse({topic:r,payload:i}))})}registerExpirerEvents(){this.client.core.expirer.on(Zi.EXPIRER_EVENTS.expired,async e=>{let{topic:r,id:n}=k.parseExpirerTarget(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,k.getInternalError("EXPIRED"),!0);r?this.client.session.keys.includes(r)&&(await this.deleteSession(r,!0),this.client.events.emit("session_expire",{topic:r})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}isValidPairingTopic(e){if(!k.isValidString(e,!1)){let{message:r}=k.getInternalError("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(r)}if(!this.client.core.pairing.pairings.keys.includes(e)){let{message:r}=k.getInternalError("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(k.isExpired(this.client.core.pairing.pairings.get(e).expiry)){let{message:r}=k.getInternalError("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!k.isValidString(e,!1)){let{message:r}=k.getInternalError("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(r)}if(!this.client.session.keys.includes(e)){let{message:r}=k.getInternalError("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(k.isExpired(this.client.session.get(e).expiry)){await this.deleteSession(e);let{message:r}=k.getInternalError("EXPIRED",`session topic: ${e}`);throw new Error(r)}}async isValidSessionOrPairingTopic(e){if(this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(k.isValidString(e,!1)){let{message:r}=k.getInternalError("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{let{message:r}=k.getInternalError("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!k.isValidId(e)){let{message:r}=k.getInternalError("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(r)}if(!this.client.proposal.keys.includes(e)){let{message:r}=k.getInternalError("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(k.isExpired(this.client.proposal.get(e).expiry)){await this.deleteProposal(e);let{message:r}=k.getInternalError("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}},qA=class extends Zi.Store{constructor(e,r){super(e,r,C8,Tg),this.core=e,this.logger=r}},VA=class extends Zi.Store{constructor(e,r){super(e,r,x8,Tg),this.core=e,this.logger=r}},jA=class extends Zi.Store{constructor(e,r){super(e,r,O8,Tg,n=>n.id),this.core=e,this.logger=r}},zu=class extends _8.ISignClient{constructor(e){super(e),this.protocol=HA,this.version=GA,this.name=Sg.name,this.events=new I8.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||Sg.name,this.metadata=e?.metadata||k.getAppMetadata();let r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:zY.default(FA.getDefaultLoggerOptions({level:e?.logger||Sg.logger}));this.core=e?.core||new Zi.Core(e),this.logger=FA.generateChildLogger(r,this.name),this.session=new VA(this.core,this.logger),this.proposal=new qA(this.core,this.logger),this.pendingRequest=new jA(this.core,this.logger),this.engine=new UA(this)}static async init(e){let r=new zu(e);return await r.initialize(),r}get context(){return FA.getLoggerContext(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success")}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}},sJ=zu;it.ENGINE_CONTEXT=N8,it.ENGINE_RPC_OPTS=ku,it.HISTORY_CONTEXT=JY,it.HISTORY_EVENTS=YY,it.HISTORY_STORAGE_VERSION=XY,it.PROPOSAL_CONTEXT=C8,it.PROPOSAL_EXPIRY=ZY,it.PROPOSAL_EXPIRY_MESSAGE=T8,it.REQUEST_CONTEXT=O8,it.SESSION_CONTEXT=x8,it.SESSION_EXPIRY=$l,it.SESSION_REQUEST_EXPIRY_BOUNDARIES=Cg,it.SIGN_CLIENT_CONTEXT=QA,it.SIGN_CLIENT_DEFAULT=Sg,it.SIGN_CLIENT_EVENTS=KY,it.SIGN_CLIENT_PROTOCOL=HA,it.SIGN_CLIENT_STORAGE_OPTIONS=$Y,it.SIGN_CLIENT_STORAGE_PREFIX=Tg,it.SIGN_CLIENT_VERSION=GA,it.SignClient=sJ,it.default=zu});var kA=w(Yl=>{"use strict";c();Object.defineProperty(Yl,"__esModule",{value:!0});Yl.Operation=void 0;var oJ;(function(t){t.SIGN_TRANSACTION="mvx_signTransaction",t.SIGN_TRANSACTIONS="mvx_signTransactions",t.SIGN_MESSAGE="mvx_signMessage",t.SIGN_LOGIN_TOKEN="mvx_signLoginToken"})(oJ=Yl.Operation||(Yl.Operation={}))});var P8=w(es=>{"use strict";c();Object.defineProperty(es,"__esModule",{value:!0});es.WALLETCONNECT_MULTIVERSX_METHODS=es.WALLETCONNECT_MULTIVERSX_NAMESPACE=es.WALLETCONNECT_MULTIVERSX_CHAIN_ID=void 0;var aJ=kA();es.WALLETCONNECT_MULTIVERSX_CHAIN_ID=508;es.WALLETCONNECT_MULTIVERSX_NAMESPACE="mvx";es.WALLETCONNECT_MULTIVERSX_METHODS=Object.values(aJ.Operation)});var R8=w(xg=>{"use strict";c();Object.defineProperty(xg,"__esModule",{value:!0});xg.Logger=void 0;var zA=class{static error(e){console.error(e)}static trace(e){console.trace(e)}};xg.Logger=zA});var B8=w(Wu=>{"use strict";c();Object.defineProperty(Wu,"__esModule",{value:!0});Wu.Signature=Wu.Address=void 0;var WA=class{constructor(e){this.value=e}bech32(){return this.value}};Wu.Address=WA;var Jl=class{constructor(e){this.buffer=e}static fromHex(e){return new Jl(h.Buffer.from(e,"hex"))}hex(){return this.buffer.toString("hex")}};Wu.Signature=Jl});var YA=w(zr=>{"use strict";c();Object.defineProperty(zr,"__esModule",{value:!0});zr.WalletConnectV2ProviderErrorMessagesEnum=zr.ErrBadAddress=zr.ErrNotImplemented=zr.Err=void 0;var Xl=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};zr.Err=Xl;var KA=class extends Xl{constructor(){super("Method not yet implemented")}};zr.ErrNotImplemented=KA;var $A=class extends Xl{constructor(e,r){super(`Bad address: ${e}`,r)}};zr.ErrBadAddress=$A;var uJ;(function(t){t.unableToInit="WalletConnect is unable to init",t.notInitialized="WalletConnect is not initialized",t.unableToConnect="WalletConnect is unable to connect",t.unableToConnectExisting="WalletConnect is unable to connect to existing pairing",t.unableToSignLoginToken="WalletConnect could not sign login token",t.unableToLogin="WalletConnect is unable to login",t.unableToHandleTopic="WalletConnect: Unable to handle topic update",t.unableToHandleEvent="WalletConnect: Unable to handle events",t.unableToHandleCleanup="WalletConnect: Unable to handle cleanup",t.sessionNotConnected="WalletConnect Session is not connected",t.sessionDeleted="WalletConnect Session Deleted",t.sessionExpired="WalletConnect Session Expired",t.alreadyLoggedOut="WalletConnect: Already logged out",t.pingFailed="WalletConnect Ping Failed",t.invalidAddress="WalletConnect: Invalid address",t.requestDifferentChain="WalletConnect: Request Chain Id different than Connection Chain Id",t.invalidMessageResponse="WalletConnect could not sign the message",t.invalidMessageSignature="WalletConnect: Invalid message signature",t.invalidTransactionResponse="WalletConnect could not sign the transactions. Invalid signatures",t.invalidCustomRequestResponse="WalletConnect could not send the custom request",t.transactionError="Transaction canceled",t.connectionError="WalletConnect could not establish a connection"})(uJ=zr.WalletConnectV2ProviderErrorMessagesEnum||(zr.WalletConnectV2ProviderErrorMessagesEnum={}))});var F8=w(xn=>{"use strict";c();var cJ=xn&&xn.__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]}),lJ=xn&&xn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fJ=xn&&xn.__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)&&cJ(e,t,r);return lJ(e,t),e};Object.defineProperty(xn,"__esModule",{value:!0});xn.UserAddress=void 0;var hJ=fJ(Qf()),L8=YA(),dJ="erd",Zl=class{constructor(e){this.value=e}static fromBech32(e){let r;try{r=hJ.decode(e)}catch(n){throw new L8.ErrBadAddress(e,n)}if(r.prefix!=dJ)throw new L8.ErrBadAddress(e);return new Zl(e)}bech32(){return this.value}};xn.UserAddress=Zl});var tf=w(Nn=>{"use strict";c();var gt=Nn&&Nn.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})},pJ=Nn&&Nn.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Nn,"__esModule",{value:!0});Nn.WalletConnectV2Provider=Nn.WalletConnectV2ProviderErrorMessagesEnum=void 0;var gJ=pJ(D8()),JA=Vp(),Io=P8(),Ng=kA(),Be=R8(),ef=B8(),he=YA();Object.defineProperty(Nn,"WalletConnectV2ProviderErrorMessagesEnum",{enumerable:!0,get:function(){return he.WalletConnectV2ProviderErrorMessagesEnum}});var Og=F8(),XA=class{constructor(e,r,n,i,s){this.chainId="",this.address="",this.signature="",this.namespace=Io.WALLETCONNECT_MULTIVERSX_NAMESPACE,this.isInitializing=!1,this.events=[],this.methods=[],this.processingTopic="",this.options={},this.onClientConnect=e,this.chainId=r,this.walletConnectV2Relay=n,this.walletConnectV2ProjectId=i,this.options=s}reset(){this.address="",this.signature="",this.namespace=Io.WALLETCONNECT_MULTIVERSX_NAMESPACE,this.session=void 0}init(){return gt(this,void 0,void 0,function*(){if(this.isInitialized())return this.isInitialized();try{if(!this.isInitializing){this.isInitializing=!0,this.reset();let e=yield gJ.default.init(Object.assign({relayUrl:this.walletConnectV2Relay,projectId:this.walletConnectV2ProjectId},this.options));this.walletConnector=e,this.isInitializing=!1,yield this.subscribeToEvents(e),yield this.checkPersistedState(e)}}catch{throw new Error(he.WalletConnectV2ProviderErrorMessagesEnum.unableToInit)}finally{return this.isInitializing=!1,this.isInitialized()}})}isInitialized(){return!!this.walletConnector&&!this.isInitializing}isConnected(){return new Promise((e,r)=>e(!!(this.isInitialized()&&typeof this.session<"u")))}connect(e){var r,n,i,s;return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let o=this.getConnectionParams(e);try{let a=yield this.walletConnector.connect(Object.assign({pairingTopic:e?.topic},o));return this.events=(n=(r=o?.requiredNamespaces)===null||r===void 0?void 0:r[Io.WALLETCONNECT_MULTIVERSX_NAMESPACE])===null||n===void 0?void 0:n.events,this.methods=(s=(i=o?.requiredNamespaces)===null||i===void 0?void 0:i[Io.WALLETCONNECT_MULTIVERSX_NAMESPACE])===null||s===void 0?void 0:s.methods,a}catch{throw this.reset(),Be.Logger.error(e?.topic?he.WalletConnectV2ProviderErrorMessagesEnum.unableToConnectExisting:he.WalletConnectV2ProviderErrorMessagesEnum.unableToConnect),new Error(e?.topic?he.WalletConnectV2ProviderErrorMessagesEnum.unableToConnectExisting:he.WalletConnectV2ProviderErrorMessagesEnum.unableToConnect)}})}login(e){var r;return gt(this,void 0,void 0,function*(){if(this.isInitializing=!0,typeof this.walletConnector>"u"&&(yield this.connect()),typeof this.walletConnector>"u")throw new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);typeof this.session<"u"&&(yield this.logout({topic:(r=this.session)===null||r===void 0?void 0:r.topic}));try{if(e&&e.approval){let n=yield e.approval();if(e.token){let i=this.getAddressFromSession(n),{signature:s}=yield this.walletConnector.request({chainId:`${this.namespace}:${this.chainId}`,topic:n.topic,request:{method:Ng.Operation.SIGN_LOGIN_TOKEN,params:{token:e.token,address:i}}});if(!s)throw Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.unableToSignLoginToken),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.unableToSignLoginToken);return yield this.onSessionConnected({session:n,signature:s})}return yield this.onSessionConnected({session:n,signature:""})}}catch{throw this.reset(),Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.unableToLogin),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.unableToLogin)}finally{this.isInitializing=!1}return""})}logout(e){return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);try{if(this.processingTopic===(e?.topic||this.getCurrentTopic(this.walletConnector)))return!0;if(e?.topic)this.processingTopic=e.topic,yield this.walletConnector.disconnect({topic:e.topic,reason:JA.getSdkError("USER_DISCONNECTED")});else{let r=this.getCurrentTopic(this.walletConnector);this.processingTopic=r,yield this.walletConnector.disconnect({topic:r,reason:JA.getSdkError("USER_DISCONNECTED")}),this.reset(),yield this.cleanupPendingPairings({deletePairings:!0})}}catch{Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.alreadyLoggedOut)}finally{this.processingTopic=""}return!0})}getAddress(){return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return this.address})}getSignature(){return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return this.signature})}getPairings(){var e,r,n,i,s;return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return(s=(i=(n=(r=(e=this.walletConnector)===null||e===void 0?void 0:e.core)===null||r===void 0?void 0:r.pairing)===null||n===void 0?void 0:n.pairings)===null||i===void 0?void 0:i.getAll({active:!0}))!==null&&s!==void 0?s:[]})}signMessage(e){return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let r=yield this.getAddress(),{signature:n}=yield this.walletConnector.request({chainId:`${this.namespace}:${this.chainId}`,topic:this.getCurrentTopic(this.walletConnector),request:{method:Ng.Operation.SIGN_MESSAGE,params:{address:r,message:e.message.toString()}}});if(!n)throw Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageResponse),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageResponse);try{e.applySignature(new ef.Signature(n),Og.UserAddress.fromBech32(r))}catch{throw Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageSignature),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageSignature)}return e})}signTransaction(e){return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let r=yield this.getAddress(),n=new ef.Address(r),i=e.toPlainObject(n);if(this.chainId!==e.getChainID().valueOf())throw Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);try{let{signature:s}=yield this.walletConnector.request({chainId:`${this.namespace}:${this.chainId}`,topic:this.getCurrentTopic(this.walletConnector),request:{method:Ng.Operation.SIGN_TRANSACTION,params:{transaction:i}}});if(!s)throw Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);return e.applySignature(ef.Signature.fromHex(s),Og.UserAddress.fromBech32(r)),e}catch{throw new Error(he.WalletConnectV2ProviderErrorMessagesEnum.transactionError)}})}signTransactions(e){return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let r=yield this.getAddress(),n=new ef.Address(r),i=e.map(s=>{if(this.chainId!==s.getChainID().valueOf())throw Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);return s.toPlainObject(n)});try{let{signatures:s}=yield this.walletConnector.request({chainId:`${this.namespace}:${this.chainId}`,topic:this.getCurrentTopic(this.walletConnector),request:{method:Ng.Operation.SIGN_TRANSACTIONS,params:{transactions:i}}});(!s||!Array.isArray(s))&&Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse),e.length!==s.length&&Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse);for(let[o,a]of e.entries())a.applySignature(ef.Signature.fromHex(s[o].signature),Og.UserAddress.fromBech32(r));return e}catch{throw new Error(he.WalletConnectV2ProviderErrorMessagesEnum.transactionError)}})}sendCustomRequest(e){var r;return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);if(!((r=e?.request)===null||r===void 0)&&r.method){let n=Object.assign({},e.request),{method:i}=n,{response:s}=yield this.walletConnector.request({chainId:`${this.namespace}:${this.chainId}`,topic:this.getCurrentTopic(this.walletConnector),request:Object.assign(Object.assign({},n),{method:i})});if(!s)throw Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.invalidCustomRequestResponse),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.invalidCustomRequestResponse);return s}})}ping(){return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);typeof this.session>"u"&&Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);try{let e=this.getCurrentTopic(this.walletConnector);return yield this.walletConnector.ping({topic:e}),!0}catch{return Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.pingFailed),!1}})}loginAccount(e){return gt(this,void 0,void 0,function*(){return e?this.addressIsValid(e.address)?(this.address=e.address,e.signature&&(this.signature=e.signature),this.onClientConnect.onClientLogin(),this.address):(Be.Logger.error(`${he.WalletConnectV2ProviderErrorMessagesEnum.invalidAddress} ${e.address}`),this.walletConnector&&(yield this.logout()),""):""})}onSessionConnected(e){return gt(this,void 0,void 0,function*(){if(!e)return"";this.session=e.session;let r=this.getAddressFromSession(e.session);return r?(yield this.loginAccount({address:r,signature:e.signature}),r):""})}handleTopicUpdateEvent({topic:e}){return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);try{let r=yield this.getPairings();if(this.address&&!this.isInitializing&&r)if(r?.length===0)this.onClientConnect.onClientLogout();else{let n=r[r.length-1];n?.topic===e&&this.onClientConnect.onClientLogout()}}catch{Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleTopic)}finally{this.pairings=yield this.getPairings()}})}handleSessionEvents({topic:e,params:r}){var n;return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(this.session&&((n=this.session)===null||n===void 0?void 0:n.topic)!==e)return;let{event:i}=r;if(i?.name&&this.getCurrentTopic(this.walletConnector)===e){let s=i.data;this.onClientConnect.onClientEvent(s)}})}subscribeToEvents(e){var r,n,i,s;return gt(this,void 0,void 0,function*(){if(typeof e>"u")throw new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);try{e.on("session_update",({topic:o,params:a})=>{var u;if(!this.session||((u=this.session)===null||u===void 0?void 0:u.topic)!==o)return;let{namespaces:l}=a,f=e.session.get(o),d=Object.assign(Object.assign({},f),{namespaces:l});this.onSessionConnected({session:d})}),e.on("session_event",this.handleSessionEvents.bind(this)),e.on("session_delete",({topic:o})=>gt(this,void 0,void 0,function*(){var a;!this.session||((a=this.session)===null||a===void 0?void 0:a.topic)!==o||(Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.sessionDeleted),this.onClientConnect.onClientLogout(),this.reset(),yield this.cleanupPendingPairings({deletePairings:!0}))})),e.on("session_expire",({topic:o})=>gt(this,void 0,void 0,function*(){var a;!this.session||((a=this.session)===null||a===void 0?void 0:a.topic)!==o||(Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.sessionExpired),this.onClientConnect.onClientLogout(),this.reset(),yield this.cleanupPendingPairings({deletePairings:!0}))})),(n=(r=e.core)===null||r===void 0?void 0:r.pairing)===null||n===void 0||n.events.on("pairing_delete",this.handleTopicUpdateEvent.bind(this)),(s=(i=e.core)===null||i===void 0?void 0:i.pairing)===null||s===void 0||s.events.on("pairing_expire",this.handleTopicUpdateEvent.bind(this))}catch{Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleEvent)}})}checkPersistedState(e){return gt(this,void 0,void 0,function*(){if(typeof e>"u")throw new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(this.pairings=yield this.getPairings(),!(typeof this.session<"u")&&e.session.length&&!this.address&&!this.isInitializing){let r=this.getCurrentSession(e);if(r)return yield this.onSessionConnected({session:r}),r}})}cleanupPendingPairings(e={}){var r,n,i,s,o,a,u,l;return gt(this,void 0,void 0,function*(){if(!(typeof this.walletConnector>"u"))try{let f=(i=(n=(r=this.walletConnector.core)===null||r===void 0?void 0:r.pairing)===null||n===void 0?void 0:n.pairings)===null||i===void 0?void 0:i.getAll({active:!1});if(!JA.isValidArray(f))return;for(let d of f)e.deletePairings?(o=(s=this.walletConnector.core)===null||s===void 0?void 0:s.expirer)===null||o===void 0||o.set(d.topic,0):yield(l=(u=(a=this.walletConnector.core)===null||a===void 0?void 0:a.relayer)===null||u===void 0?void 0:u.subscriber)===null||l===void 0?void 0:l.unsubscribe(d.topic)}catch{Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleCleanup)}})}getCurrentSession(e){if(typeof e>"u")throw new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=e.find(this.getConnectionParams()).filter(n=>n.acknowledged);if(r.length>0){let n=r.length-1;return r[n]}else if(e.session.length>0){let n=e.session.keys.length-1;return e.session.get(e.session.keys[n])}else throw Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected)}getCurrentTopic(e){if(typeof e>"u")throw new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=this.getCurrentSession(e);if(r?.topic)return r.topic;throw new Error(he.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected)}getConnectionParams(e){var r,n;let i=[...Io.WALLETCONNECT_MULTIVERSX_METHODS,...(r=e?.methods)!==null&&r!==void 0?r:[]],s=[`${Io.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`],o=(n=e?.events)!==null&&n!==void 0?n:[];return{requiredNamespaces:{[Io.WALLETCONNECT_MULTIVERSX_NAMESPACE]:{methods:i,chains:s,events:o}}}}addressIsValid(e){try{return!!Og.UserAddress.fromBech32(e)}catch{return!1}}getAddressFromSession(e){let r=e.namespaces[this.namespace];if(r&&r.accounts){let n=r.accounts[0],[i,s,o]=n.split(":");return o}return""}};Nn.WalletConnectV2Provider=XA});var U8=w((fde,M8)=>{"use strict";c();M8.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 j8=w((dde,V8)=>{"use strict";c();var q8=typeof Symbol<"u"&&Symbol,yJ=U8();V8.exports=function(){return typeof q8!="function"||typeof Symbol!="function"||typeof q8("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:yJ()}});var G8=w((gde,H8)=>{"use strict";c();var mJ="Function.prototype.bind called on incompatible ",ZA=Array.prototype.slice,wJ=Object.prototype.toString,EJ="[object Function]";H8.exports=function(e){var r=this;if(typeof r!="function"||wJ.call(r)!==EJ)throw new TypeError(mJ+r);for(var n=ZA.call(arguments,1),i,s=function(){if(this instanceof i){var f=r.apply(this,n.concat(ZA.call(arguments)));return Object(f)===f?f:this}else return r.apply(e,n.concat(ZA.call(arguments)))},o=Math.max(0,r.length-n.length),a=[],u=0;u{"use strict";c();var vJ=G8();Q8.exports=Function.prototype.bind||vJ});var z8=w((Ede,k8)=>{"use strict";c();var AJ=Dg();k8.exports=AJ.call(Function.call,Object.prototype.hasOwnProperty)});var Bg=w((Ade,J8)=>{"use strict";c();var De,Ju=SyntaxError,Y8=Function,Yu=TypeError,eb=function(t){try{return Y8('"use strict"; return ('+t+").constructor;")()}catch{}},So=Object.getOwnPropertyDescriptor;if(So)try{So({},"")}catch{So=null}var tb=function(){throw new Yu},bJ=So?function(){try{return arguments.callee,tb}catch{try{return So(arguments,"callee").get}catch{return tb}}}():tb,Ku=j8()(),On=Object.getPrototypeOf||function(t){return t.__proto__},$u={},_J=typeof Uint8Array>"u"?De:On(Uint8Array),Co={"%AggregateError%":typeof AggregateError>"u"?De:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?De:ArrayBuffer,"%ArrayIteratorPrototype%":Ku?On([][Symbol.iterator]()):De,"%AsyncFromSyncIteratorPrototype%":De,"%AsyncFunction%":$u,"%AsyncGenerator%":$u,"%AsyncGeneratorFunction%":$u,"%AsyncIteratorPrototype%":$u,"%Atomics%":typeof Atomics>"u"?De:Atomics,"%BigInt%":typeof BigInt>"u"?De:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?De:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?De:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?De:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?De:Float32Array,"%Float64Array%":typeof Float64Array>"u"?De:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?De:FinalizationRegistry,"%Function%":Y8,"%GeneratorFunction%":$u,"%Int8Array%":typeof Int8Array>"u"?De:Int8Array,"%Int16Array%":typeof Int16Array>"u"?De:Int16Array,"%Int32Array%":typeof Int32Array>"u"?De:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Ku?On(On([][Symbol.iterator]())):De,"%JSON%":typeof JSON=="object"?JSON:De,"%Map%":typeof Map>"u"?De:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Ku?De:On(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?De:Promise,"%Proxy%":typeof Proxy>"u"?De:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?De:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?De:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Ku?De:On(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?De:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Ku?On(""[Symbol.iterator]()):De,"%Symbol%":Ku?Symbol:De,"%SyntaxError%":Ju,"%ThrowTypeError%":bJ,"%TypedArray%":_J,"%TypeError%":Yu,"%Uint8Array%":typeof Uint8Array>"u"?De:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?De:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?De:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?De:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?De:WeakMap,"%WeakRef%":typeof WeakRef>"u"?De:WeakRef,"%WeakSet%":typeof WeakSet>"u"?De:WeakSet};try{null.error}catch(t){W8=On(On(t)),Co["%Error.prototype%"]=W8}var W8,IJ=function t(e){var r;if(e==="%AsyncFunction%")r=eb("async function () {}");else if(e==="%GeneratorFunction%")r=eb("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=eb("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=t("%AsyncGenerator%");i&&(r=On(i.prototype))}return Co[e]=r,r},K8={"%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"]},rf=Dg(),Pg=z8(),SJ=rf.call(Function.call,Array.prototype.concat),CJ=rf.call(Function.apply,Array.prototype.splice),$8=rf.call(Function.call,String.prototype.replace),Rg=rf.call(Function.call,String.prototype.slice),TJ=rf.call(Function.call,RegExp.prototype.exec),xJ=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,NJ=/\\(\\)?/g,OJ=function(e){var r=Rg(e,0,1),n=Rg(e,-1);if(r==="%"&&n!=="%")throw new Ju("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new Ju("invalid intrinsic syntax, expected opening `%`");var i=[];return $8(e,xJ,function(s,o,a,u){i[i.length]=a?$8(u,NJ,"$1"):o||s}),i},DJ=function(e,r){var n=e,i;if(Pg(K8,n)&&(i=K8[n],n="%"+i[0]+"%"),Pg(Co,n)){var s=Co[n];if(s===$u&&(s=IJ(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 Ju("intrinsic "+e+" does not exist!")};J8.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(TJ(/^%?[^%]*%?$/,e)===null)throw new Ju("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=OJ(e),i=n.length>0?n[0]:"",s=DJ("%"+i+"%",r),o=s.name,a=s.value,u=!1,l=s.alias;l&&(i=l[0],CJ(n,SJ([0,1],l)));for(var f=1,d=!0;f=n.length){var T=So(a,y);d=!!T,d&&"get"in T&&!("originalValue"in T.get)?a=T.get:a=a[y]}else d=Pg(a,y),a=a[y];d&&!u&&(Co[o]=a)}}return a}});var nR=w((_de,Lg)=>{"use strict";c();var rb=Dg(),Xu=Bg(),eR=Xu("%Function.prototype.apply%"),tR=Xu("%Function.prototype.call%"),rR=Xu("%Reflect.apply%",!0)||rb.call(tR,eR),X8=Xu("%Object.getOwnPropertyDescriptor%",!0),To=Xu("%Object.defineProperty%",!0),PJ=Xu("%Math.max%");if(To)try{To({},"a",{value:1})}catch{To=null}Lg.exports=function(e){var r=rR(rb,tR,arguments);if(X8&&To){var n=X8(r,"length");n.configurable&&To(r,"length",{value:1+PJ(0,e.length-(arguments.length-1))})}return r};var Z8=function(){return rR(rb,eR,arguments)};To?To(Lg.exports,"apply",{value:Z8}):Lg.exports.apply=Z8});var aR=w((Sde,oR)=>{"use strict";c();var iR=Bg(),sR=nR(),RJ=sR(iR("String.prototype.indexOf"));oR.exports=function(e,r){var n=iR(e,!!r);return typeof n=="function"&&RJ(e,".prototype.")>-1?sR(n):n}});var uR=w(()=>{c()});var xR=w((Ode,TR)=>{c();var hb=typeof Map=="function"&&Map.prototype,nb=Object.getOwnPropertyDescriptor&&hb?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Mg=hb&&nb&&typeof nb.get=="function"?nb.get:null,cR=hb&&Map.prototype.forEach,db=typeof Set=="function"&&Set.prototype,ib=Object.getOwnPropertyDescriptor&&db?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Ug=db&&ib&&typeof ib.get=="function"?ib.get:null,lR=db&&Set.prototype.forEach,BJ=typeof WeakMap=="function"&&WeakMap.prototype,sf=BJ?WeakMap.prototype.has:null,LJ=typeof WeakSet=="function"&&WeakSet.prototype,of=LJ?WeakSet.prototype.has:null,FJ=typeof WeakRef=="function"&&WeakRef.prototype,fR=FJ?WeakRef.prototype.deref:null,MJ=Boolean.prototype.valueOf,UJ=Object.prototype.toString,qJ=Function.prototype.toString,VJ=String.prototype.match,pb=String.prototype.slice,rs=String.prototype.replace,jJ=String.prototype.toUpperCase,hR=String.prototype.toLowerCase,AR=RegExp.prototype.test,dR=Array.prototype.concat,Dn=Array.prototype.join,HJ=Array.prototype.slice,pR=Math.floor,ab=typeof BigInt=="function"?BigInt.prototype.valueOf:null,sb=Object.getOwnPropertySymbols,ub=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Zu=typeof Symbol=="function"&&typeof Symbol.iterator=="object",$t=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Zu||"symbol")?Symbol.toStringTag:null,bR=Object.prototype.propertyIsEnumerable,gR=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function yR(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||AR.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var n=t<0?-pR(-t):pR(t);if(n!==t){var i=String(n),s=pb.call(e,i.length+1);return rs.call(i,r,"$&_")+"."+rs.call(rs.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return rs.call(e,r,"$&_")}var cb=uR(),mR=cb.custom,wR=IR(mR)?mR:null;TR.exports=function t(e,r,n,i){var s=r||{};if(ts(s,"quoteStyle")&&s.quoteStyle!=="single"&&s.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(ts(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=ts(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(ts(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(ts(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 CR(e,s);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var u=String(e);return a?yR(e,u):u}if(typeof e=="bigint"){var l=String(e)+"n";return a?yR(e,l):l}var f=typeof s.depth>"u"?5:s.depth;if(typeof n>"u"&&(n=0),n>=f&&f>0&&typeof e=="object")return lb(e)?"[Array]":"[Object]";var d=oX(s,n);if(typeof i>"u")i=[];else if(SR(i,e)>=0)return"[Circular]";function y(G,$,de){if($&&(i=HJ.call(i),i.push($)),de){var ae={depth:s.depth};return ts(s,"quoteStyle")&&(ae.quoteStyle=s.quoteStyle),t(G,ae,n+1,i)}return t(G,s,n+1,i)}if(typeof e=="function"&&!ER(e)){var m=JJ(e),v=Fg(e,y);return"[Function"+(m?": "+m:" (anonymous)")+"]"+(v.length>0?" { "+Dn.call(v,", ")+" }":"")}if(IR(e)){var T=Zu?rs.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):ub.call(e);return typeof e=="object"&&!Zu?nf(T):T}if(nX(e)){for(var B="<"+hR.call(String(e.nodeName)),A=e.attributes||[],D=0;D",B}if(lb(e)){if(e.length===0)return"[]";var x=Fg(e,y);return d&&!sX(x)?"["+fb(x,d)+"]":"[ "+Dn.call(x,", ")+" ]"}if(kJ(e)){var R=Fg(e,y);return!("cause"in Error.prototype)&&"cause"in e&&!bR.call(e,"cause")?"{ ["+String(e)+"] "+Dn.call(dR.call("[cause]: "+y(e.cause),R),", ")+" }":R.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+Dn.call(R,", ")+" }"}if(typeof e=="object"&&o){if(wR&&typeof e[wR]=="function"&&cb)return cb(e,{depth:f-n});if(o!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(XJ(e)){var P=[];return cR&&cR.call(e,function(G,$){P.push(y($,e,!0)+" => "+y(G,e))}),vR("Map",Mg.call(e),P,d)}if(tX(e)){var L=[];return lR&&lR.call(e,function(G){L.push(y(G,e))}),vR("Set",Ug.call(e),L,d)}if(ZJ(e))return ob("WeakMap");if(rX(e))return ob("WeakSet");if(eX(e))return ob("WeakRef");if(WJ(e))return nf(y(Number(e)));if($J(e))return nf(y(ab.call(e)));if(KJ(e))return nf(MJ.call(e));if(zJ(e))return nf(y(String(e)));if(!QJ(e)&&!ER(e)){var _=Fg(e,y),C=gR?gR(e)===Object.prototype:e instanceof Object||e.constructor===Object,M=e instanceof Object?"":"null prototype",Z=!C&&$t&&Object(e)===e&&$t in e?pb.call(ns(e),8,-1):M?"Object":"",z=C||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",H=z+(Z||M?"["+Dn.call(dR.call([],Z||[],M||[]),": ")+"] ":"");return _.length===0?H+"{}":d?H+"{"+fb(_,d)+"}":H+"{ "+Dn.call(_,", ")+" }"}return String(e)};function _R(t,e,r){var n=(r.quoteStyle||e)==="double"?'"':"'";return n+t+n}function GJ(t){return rs.call(String(t),/"/g,""")}function lb(t){return ns(t)==="[object Array]"&&(!$t||!(typeof t=="object"&&$t in t))}function QJ(t){return ns(t)==="[object Date]"&&(!$t||!(typeof t=="object"&&$t in t))}function ER(t){return ns(t)==="[object RegExp]"&&(!$t||!(typeof t=="object"&&$t in t))}function kJ(t){return ns(t)==="[object Error]"&&(!$t||!(typeof t=="object"&&$t in t))}function zJ(t){return ns(t)==="[object String]"&&(!$t||!(typeof t=="object"&&$t in t))}function WJ(t){return ns(t)==="[object Number]"&&(!$t||!(typeof t=="object"&&$t in t))}function KJ(t){return ns(t)==="[object Boolean]"&&(!$t||!(typeof t=="object"&&$t in t))}function IR(t){if(Zu)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!ub)return!1;try{return ub.call(t),!0}catch{}return!1}function $J(t){if(!t||typeof t!="object"||!ab)return!1;try{return ab.call(t),!0}catch{}return!1}var YJ=Object.prototype.hasOwnProperty||function(t){return t in this};function ts(t,e){return YJ.call(t,e)}function ns(t){return UJ.call(t)}function JJ(t){if(t.name)return t.name;var e=VJ.call(qJ.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function SR(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 CR(pb.call(t,0,e.maxStringLength),e)+n}var i=rs.call(rs.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,iX);return _R(i,"single",e)}function iX(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":"")+jJ.call(e.toString(16))}function nf(t){return"Object("+t+")"}function ob(t){return t+" { ? }"}function vR(t,e,r,n){var i=n?fb(r,n):Dn.call(r,", ");return t+" ("+e+") {"+i+"}"}function sX(t){for(var e=0;e=0)return!1;return!0}function oX(t,e){var r;if(t.indent===" ")r=" ";else if(typeof t.indent=="number"&&t.indent>0)r=Dn.call(Array(t.indent+1)," ");else return null;return{base:r,prev:Dn.call(Array(e+1),r)}}function fb(t,e){if(t.length===0)return"";var r=` -`+e.prev+e.base;return r+Dn.call(t,","+r)+` -`+e.prev}function Fg(t,e){var r=lb(t),n=[];if(r){n.length=t.length;for(var i=0;i{"use strict";c();var gb=Bg(),ec=aR(),aX=xR(),uX=gb("%TypeError%"),qg=gb("%WeakMap%",!0),Vg=gb("%Map%",!0),cX=ec("WeakMap.prototype.get",!0),lX=ec("WeakMap.prototype.set",!0),fX=ec("WeakMap.prototype.has",!0),hX=ec("Map.prototype.get",!0),dX=ec("Map.prototype.set",!0),pX=ec("Map.prototype.has",!0),yb=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},gX=function(t,e){var r=yb(t,e);return r&&r.value},yX=function(t,e,r){var n=yb(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}},mX=function(t,e){return!!yb(t,e)};NR.exports=function(){var e,r,n,i={assert:function(s){if(!i.has(s))throw new uX("Side channel does not contain "+aX(s))},get:function(s){if(qg&&s&&(typeof s=="object"||typeof s=="function")){if(e)return cX(e,s)}else if(Vg){if(r)return hX(r,s)}else if(n)return gX(n,s)},has:function(s){if(qg&&s&&(typeof s=="object"||typeof s=="function")){if(e)return fX(e,s)}else if(Vg){if(r)return pX(r,s)}else if(n)return mX(n,s);return!1},set:function(s,o){qg&&s&&(typeof s=="object"||typeof s=="function")?(e||(e=new qg),lX(e,s,o)):Vg?(r||(r=new Vg),dX(r,s,o)):(n||(n={key:{},next:null}),yX(n,s,o))}};return i}});var jg=w((Bde,DR)=>{"use strict";c();var wX=String.prototype.replace,EX=/%20/g,mb={RFC1738:"RFC1738",RFC3986:"RFC3986"};DR.exports={default:mb.RFC3986,formatters:{RFC1738:function(t){return wX.call(t,EX,"+")},RFC3986:function(t){return String(t)}},RFC1738:mb.RFC1738,RFC3986:mb.RFC3986}});var Eb=w((Fde,RR)=>{"use strict";c();var vX=jg(),wb=Object.prototype.hasOwnProperty,xo=Array.isArray,Pn=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),AX=function(e){for(;e.length>1;){var r=e.pop(),n=r.obj[r.prop];if(xo(n)){for(var i=[],s=0;s=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122||s===vX.RFC1738&&(l===40||l===41)){a+=o.charAt(u);continue}if(l<128){a=a+Pn[l];continue}if(l<2048){a=a+(Pn[192|l>>6]+Pn[128|l&63]);continue}if(l<55296||l>=57344){a=a+(Pn[224|l>>12]+Pn[128|l>>6&63]+Pn[128|l&63]);continue}u+=1,l=65536+((l&1023)<<10|o.charCodeAt(u)&1023),a+=Pn[240|l>>18]+Pn[128|l>>12&63]+Pn[128|l>>6&63]+Pn[128|l&63]}return a},CX=function(e){for(var r=[{obj:{o:e},prop:"o"}],n=[],i=0;i{"use strict";c();var FR=OR(),Ab=Eb(),af=jg(),DX=Object.prototype.hasOwnProperty,BR={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,r){return e+"["+r+"]"},repeat:function(e){return e}},No=Array.isArray,PX=String.prototype.split,RX=Array.prototype.push,MR=function(t,e){RX.apply(t,No(e)?e:[e])},BX=Date.prototype.toISOString,LR=af.default,Vt={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:Ab.encode,encodeValuesOnly:!1,format:LR,formatter:af.formatters[LR],indices:!1,serializeDate:function(e){return BX.call(e)},skipNulls:!1,strictNullHandling:!1},LX=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},vb={},FX=function t(e,r,n,i,s,o,a,u,l,f,d,y,m,v,T){for(var B=e,A=T,D=0,x=!1;(A=A.get(vb))!==void 0&&!x;){var R=A.get(e);if(D+=1,typeof R<"u"){if(R===D)throw new RangeError("Cyclic object value");x=!0}typeof A.get(vb)>"u"&&(D=0)}if(typeof a=="function"?B=a(r,B):B instanceof Date?B=f(B):n==="comma"&&No(B)&&(B=Ab.maybeMap(B,function(re){return re instanceof Date?f(re):re})),B===null){if(i)return o&&!m?o(r,Vt.encoder,v,"key",d):r;B=""}if(LX(B)||Ab.isBuffer(B)){if(o){var P=m?r:o(r,Vt.encoder,v,"key",d);if(n==="comma"&&m){for(var L=PX.call(String(B),","),_="",C=0;C"u")return M;var Z;if(n==="comma"&&No(B))Z=[{value:B.length>0?B.join(",")||null:void 0}];else if(No(a))Z=a;else{var z=Object.keys(B);Z=u?z.sort(u):z}for(var H=0;H"u"?Vt.allowDots:!!e.allowDots,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Vt.charsetSentinel,delimiter:typeof e.delimiter>"u"?Vt.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:Vt.encode,encoder:typeof e.encoder=="function"?e.encoder:Vt.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:Vt.encodeValuesOnly,filter:s,format:n,formatter:i,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:Vt.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:Vt.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Vt.strictNullHandling}};UR.exports=function(t,e){var r=t,n=MX(e),i,s;typeof n.filter=="function"?(s=n.filter,r=s("",r)):No(n.filter)&&(s=n.filter,i=s);var o=[];if(typeof r!="object"||r===null)return"";var a;e&&e.arrayFormat in BR?a=e.arrayFormat:e&&"indices"in e?a=e.indices?"indices":"repeat":a="indices";var u=BR[a];i||(i=Object.keys(r)),n.sort&&i.sort(n.sort);for(var l=FR(),f=0;f0?m+y:""}});var HR=w((Vde,jR)=>{"use strict";c();var tc=Eb(),bb=Object.prototype.hasOwnProperty,UX=Array.isArray,Pt={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:tc.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},qX=function(t){return t.replace(/&#(\d+);/g,function(e,r){return String.fromCharCode(parseInt(r,10))})},VR=function(t,e){return t&&typeof t=="string"&&e.comma&&t.indexOf(",")>-1?t.split(","):t},VX="utf8=%26%2310003%3B",jX="utf8=%E2%9C%93",HX=function(e,r){var n={},i=r.ignoreQueryPrefix?e.replace(/^\?/,""):e,s=r.parameterLimit===1/0?void 0:r.parameterLimit,o=i.split(r.delimiter,s),a=-1,u,l=r.charset;if(r.charsetSentinel)for(u=0;u-1&&(v=UX(v)?[v]:v),bb.call(n,m)?n[m]=tc.combine(n[m],v):n[m]=v}return n},GX=function(t,e,r,n){for(var i=n?e:VR(e,r),s=t.length-1;s>=0;--s){var o,a=t[s];if(a==="[]"&&r.parseArrays)o=[].concat(i);else{o=r.plainObjects?Object.create(null):{};var u=a.charAt(0)==="["&&a.charAt(a.length-1)==="]"?a.slice(1,-1):a,l=parseInt(u,10);!r.parseArrays&&u===""?o={0:i}:!isNaN(l)&&a!==u&&String(l)===u&&l>=0&&r.parseArrays&&l<=r.arrayLimit?(o=[],o[l]=i):u!=="__proto__"&&(o[u]=i)}i=o}return i},QX=function(e,r,n,i){if(e){var s=n.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,o=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,u=n.depth>0&&o.exec(s),l=u?s.slice(0,u.index):s,f=[];if(l){if(!n.plainObjects&&bb.call(Object.prototype,l)&&!n.allowPrototypes)return;f.push(l)}for(var d=0;n.depth>0&&(u=a.exec(s))!==null&&d"u"?Pt.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?Pt.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:Pt.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:Pt.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:Pt.arrayLimit,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Pt.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:Pt.comma,decoder:typeof e.decoder=="function"?e.decoder:Pt.decoder,delimiter:typeof e.delimiter=="string"||tc.isRegExp(e.delimiter)?e.delimiter:Pt.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:Pt.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:Pt.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:Pt.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:Pt.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Pt.strictNullHandling}};jR.exports=function(t,e){var r=kX(e);if(t===""||t===null||typeof t>"u")return r.plainObjects?Object.create(null):{};for(var n=typeof t=="string"?HX(t,r):t,i=r.plainObjects?Object.create(null):{},s=Object.keys(n),o=0;o{"use strict";c();var zX=qR(),WX=HR(),KX=jg();GR.exports={formats:KX,parse:WX,stringify:zX}});var _b=w(rt=>{"use strict";c();Object.defineProperty(rt,"__esModule",{value:!0});rt.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED=rt.WALLET_PROVIDER_CALLBACK_PARAM=rt.WALLET_PROVIDER_SIGN_MESSAGE_URL=rt.WALLET_PROVIDER_GUARD_TRANSACTION_URL=rt.WALLET_PROVIDER_SIGN_TRANSACTION_URL=rt.WALLET_PROVIDER_SEND_TRANSACTION_URL=rt.WALLET_PROVIDER_DISCONNECT_URL=rt.WALLET_PROVIDER_CONNECT_URL=rt.WALLET_PROVIDER_TESTNET=rt.WALLET_PROVIDER_DEVNET=rt.WALLET_PROVIDER_MAINNET=void 0;rt.WALLET_PROVIDER_MAINNET="https://wallet.multiversx.com/dapp/init";rt.WALLET_PROVIDER_DEVNET="https://devnet-wallet.multiversx.com/dapp/init";rt.WALLET_PROVIDER_TESTNET="https://testnet-wallet.multiversx.com/dapp/init";rt.WALLET_PROVIDER_CONNECT_URL="hook/login";rt.WALLET_PROVIDER_DISCONNECT_URL="hook/logout";rt.WALLET_PROVIDER_SEND_TRANSACTION_URL="hook/transaction";rt.WALLET_PROVIDER_SIGN_TRANSACTION_URL="hook/sign";rt.WALLET_PROVIDER_GUARD_TRANSACTION_URL="hook/2fa";rt.WALLET_PROVIDER_SIGN_MESSAGE_URL="hook/sign-message";rt.WALLET_PROVIDER_CALLBACK_PARAM="walletProviderStatus";rt.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED="transactionsSigned"});var kR=w(rc=>{"use strict";c();Object.defineProperty(rc,"__esModule",{value:!0});rc.ErrCannotSignedMessage=rc.ErrCannotGetSignedTransactions=void 0;var Ib=class extends Error{constructor(){super("Cannot get signed transaction(s)")}};rc.ErrCannotGetSignedTransactions=Ib;var Sb=class extends Error{constructor(){super("Cannot get signed message")}};rc.ErrCannotSignedMessage=Sb});var zR=w(Hg=>{"use strict";c();Object.defineProperty(Hg,"__esModule",{value:!0});Hg.PlainSignedTransaction=void 0;var Cb=class{constructor(e){this.nonce=0,this.value="",this.receiver="",this.sender="",this.gasPrice=0,this.gasLimit=0,this.data="",this.chainID="",this.version=0,this.options=void 0,this.signature="",Object.assign(this,e)}};Hg.PlainSignedTransaction=Cb});var uf=w(os=>{"use strict";c();var is=os&&os.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})},$X=os&&os.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(os,"__esModule",{value:!0});os.WalletProvider=void 0;var Tb=$X(QR()),ss=_b(),xb=kR(),YX=zR(),nc=class{constructor(e){this.walletUrl=e}login(e){return is(this,void 0,void 0,function*(){let r=this.buildWalletUrl({endpoint:ss.WALLET_PROVIDER_CONNECT_URL,callbackUrl:e?.callbackUrl,params:{token:e?.token}});return yield this.redirect(r,e?.redirectDelayMilliseconds),r})}redirect(e,r){return is(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 is(this,void 0,void 0,function*(){yield new Promise(n=>{setTimeout(()=>{window.location.href=e,n(!0)},r)})})}logout(e){return is(this,void 0,void 0,function*(){let r=this.buildWalletUrl({endpoint:ss.WALLET_PROVIDER_DISCONNECT_URL,callbackUrl:e?.callbackUrl});return yield this.redirect(r,e?.redirectDelayMilliseconds),!0})}signMessage(e,r){return is(this,void 0,void 0,function*(){let n=this.buildWalletUrl({endpoint:ss.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=Tb.default.parse(n);if((((e=i.status)===null||e===void 0?void 0:e.toString())||"")!=="signed")throw new xb.ErrCannotSignedMessage;return((r=i.signature)===null||r===void 0?void 0:r.toString())||""}guardTransactions(e,r){return is(this,void 0,void 0,function*(){this.redirectTransactionsToEndpoint(ss.WALLET_PROVIDER_GUARD_TRANSACTION_URL,e,r)})}signTransactions(e,r){return is(this,void 0,void 0,function*(){this.redirectTransactionsToEndpoint(ss.WALLET_PROVIDER_SIGN_TRANSACTION_URL,e,r)})}signTransaction(e,r){return is(this,void 0,void 0,function*(){yield this.signTransactions([e],r)})}getTransactionsFromWalletUrl(){let e=Tb.default.parse(window.location.search.slice(1));return nc.isTxSignReturnSuccess(e)?this.getTxSignReturnValue(e):[]}static isTxSignReturnSuccess(e){return e.hasOwnProperty(ss.WALLET_PROVIDER_CALLBACK_PARAM)&&e[ss.WALLET_PROVIDER_CALLBACK_PARAM]===ss.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED}getTxSignReturnValue(e){var r;console.info("getTxSignReturnValue(), urlParams:",e);let n=["nonce","value","receiver","sender","gasPrice","gasLimit","chainID","version","signature"];for(let o of n)if(!e[o]||!Array.isArray(e[o]))throw new xb.ErrCannotGetSignedTransactions;let i=e.nonce.length;for(let o of n)if(e[o].length!==i)throw new xb.ErrCannotGetSignedTransactions;let s=[];for(let o=0;o{let a=nc.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}};os.WalletProvider=nc});var Nb=w((Xde,WR)=>{"use strict";c();WR.exports=function(e,r){return function(){for(var i=new Array(arguments.length),s=0;s{"use strict";c();var JX=Nb(),Db=Object.prototype.toString,Pb=function(t){return function(e){var r=Db.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())}}(Object.create(null));function Oo(t){return t=t.toLowerCase(),function(r){return Pb(r)===t}}function Rb(t){return Array.isArray(t)}function Qg(t){return typeof t>"u"}function XX(t){return t!==null&&!Qg(t)&&t.constructor!==null&&!Qg(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}var KR=Oo("ArrayBuffer");function ZX(t){var e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&KR(t.buffer),e}function eZ(t){return typeof t=="string"}function tZ(t){return typeof t=="number"}function $R(t){return t!==null&&typeof t=="object"}function Gg(t){if(Pb(t)!=="object")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}var rZ=Oo("Date"),nZ=Oo("File"),iZ=Oo("Blob"),sZ=Oo("FileList");function Bb(t){return Db.call(t)==="[object Function]"}function oZ(t){return $R(t)&&Bb(t.pipe)}function aZ(t){var e="[object FormData]";return t&&(typeof FormData=="function"&&t instanceof FormData||Db.call(t)===e||Bb(t.toString)&&t.toString()===e)}var uZ=Oo("URLSearchParams");function cZ(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function lZ(){return typeof navigator<"u"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window<"u"&&typeof document<"u"}function Lb(t,e){if(!(t===null||typeof t>"u"))if(typeof t!="object"&&(t=[t]),Rb(t))for(var r=0,n=t.length;r0;)s=n[i],o[s]||(e[s]=t[s],o[s]=!0);t=Object.getPrototypeOf(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e}function gZ(t,e,r){t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;var n=t.indexOf(e,r);return n!==-1&&n===r}function yZ(t){if(!t)return null;var e=t.length;if(Qg(e))return null;for(var r=new Array(e);e-- >0;)r[e]=t[e];return r}var mZ=function(t){return function(e){return t&&e instanceof t}}(typeof Uint8Array<"u"&&Object.getPrototypeOf(Uint8Array));YR.exports={isArray:Rb,isArrayBuffer:KR,isBuffer:XX,isFormData:aZ,isArrayBufferView:ZX,isString:eZ,isNumber:tZ,isObject:$R,isPlainObject:Gg,isUndefined:Qg,isDate:rZ,isFile:nZ,isBlob:iZ,isFunction:Bb,isStream:oZ,isURLSearchParams:uZ,isStandardBrowserEnv:lZ,forEach:Lb,merge:Ob,extend:fZ,trim:cZ,stripBOM:hZ,inherits:dZ,toFlatObject:pZ,kindOf:Pb,kindOfTest:Oo,endsWith:gZ,toArray:yZ,isTypedArray:mZ,isFileList:sZ}});var Fb=w((rpe,XR)=>{"use strict";c();var ic=Rt();function JR(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}XR.exports=function(e,r,n){if(!r)return e;var i;if(n)i=n(r);else if(ic.isURLSearchParams(r))i=r.toString();else{var s=[];ic.forEach(r,function(u,l){u===null||typeof u>"u"||(ic.isArray(u)?l=l+"[]":u=[u],ic.forEach(u,function(d){ic.isDate(d)?d=d.toISOString():ic.isObject(d)&&(d=JSON.stringify(d)),s.push(JR(l)+"="+JR(d))}))}),i=s.join("&")}if(i){var o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}});var eB=w((ipe,ZR)=>{"use strict";c();var wZ=Rt();function kg(){this.handlers=[]}kg.prototype.use=function(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};kg.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};kg.prototype.forEach=function(e){wZ.forEach(this.handlers,function(n){n!==null&&e(n)})};ZR.exports=kg});var rB=w((ope,tB)=>{"use strict";c();var EZ=Rt();tB.exports=function(e,r){EZ.forEach(e,function(i,s){s!==r&&s.toUpperCase()===r.toUpperCase()&&(e[r]=i,delete e[s])})}});var Do=w((upe,oB)=>{"use strict";c();var nB=Rt();function sc(t,e,r,n,i){Error.call(this),this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i)}nB.inherits(sc,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:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var iB=sc.prototype,sB={};["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"].forEach(function(t){sB[t]={value:t}});Object.defineProperties(sc,sB);Object.defineProperty(iB,"isAxiosError",{value:!0});sc.from=function(t,e,r,n,i,s){var o=Object.create(iB);return nB.toFlatObject(t,o,function(u){return u!==Error.prototype}),sc.call(o,t.message,e,r,n,i),o.name=t.name,s&&Object.assign(o,s),o};oB.exports=sc});var Mb=w((lpe,aB)=>{"use strict";c();aB.exports={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1}});var Ub=w((hpe,uB)=>{"use strict";c();var Wr=Rt();function vZ(t,e){e=e||new FormData;var r=[];function n(s){return s===null?"":Wr.isDate(s)?s.toISOString():Wr.isArrayBuffer(s)||Wr.isTypedArray(s)?typeof Blob=="function"?new Blob([s]):h.Buffer.from(s):s}function i(s,o){if(Wr.isPlainObject(s)||Wr.isArray(s)){if(r.indexOf(s)!==-1)throw Error("Circular reference detected in "+o);r.push(s),Wr.forEach(s,function(u,l){if(!Wr.isUndefined(u)){var f=o?o+"."+l:l,d;if(u&&!o&&typeof u=="object"){if(Wr.endsWith(l,"{}"))u=JSON.stringify(u);else if(Wr.endsWith(l,"[]")&&(d=Wr.toArray(u))){d.forEach(function(y){!Wr.isUndefined(y)&&e.append(f,n(y))});return}}i(u,f)}}),r.pop()}else e.append(o,n(s))}return i(t),e}uB.exports=vZ});var lB=w((ppe,cB)=>{"use strict";c();var qb=Do();cB.exports=function(e,r,n){var i=n.config.validateStatus;!n.status||!i||i(n.status)?e(n):r(new qb("Request failed with status code "+n.status,[qb.ERR_BAD_REQUEST,qb.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}});var hB=w((ype,fB)=>{"use strict";c();var zg=Rt();fB.exports=zg.isStandardBrowserEnv()?function(){return{write:function(r,n,i,s,o,a){var u=[];u.push(r+"="+encodeURIComponent(n)),zg.isNumber(i)&&u.push("expires="+new Date(i).toGMTString()),zg.isString(s)&&u.push("path="+s),zg.isString(o)&&u.push("domain="+o),a===!0&&u.push("secure"),document.cookie=u.join("; ")},read:function(r){var n=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(r){this.write(r,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()});var pB=w((wpe,dB)=>{"use strict";c();dB.exports=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}});var yB=w((vpe,gB)=>{"use strict";c();gB.exports=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e}});var Vb=w((bpe,mB)=>{"use strict";c();var AZ=pB(),bZ=yB();mB.exports=function(e,r){return e&&!AZ(r)?bZ(e,r):r}});var EB=w((Ipe,wB)=>{"use strict";c();var jb=Rt(),_Z=["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"];wB.exports=function(e){var r={},n,i,s;return e&&jb.forEach(e.split(` -`),function(a){if(s=a.indexOf(":"),n=jb.trim(a.substr(0,s)).toLowerCase(),i=jb.trim(a.substr(s+1)),n){if(r[n]&&_Z.indexOf(n)>=0)return;n==="set-cookie"?r[n]=(r[n]?r[n]:[]).concat([i]):r[n]=r[n]?r[n]+", "+i:i}}),r}});var bB=w((Cpe,AB)=>{"use strict";c();var vB=Rt();AB.exports=vB.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),n;function i(s){var 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){var a=vB.isString(o)?i(o):o;return a.protocol===n.protocol&&a.host===n.host}}():function(){return function(){return!0}}()});var cf=w((xpe,IB)=>{"use strict";c();var Hb=Do(),IZ=Rt();function _B(t){Hb.call(this,t??"canceled",Hb.ERR_CANCELED),this.name="CanceledError"}IZ.inherits(_B,Hb,{__CANCEL__:!0});IB.exports=_B});var CB=w((Ope,SB)=>{"use strict";c();SB.exports=function(e){var r=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return r&&r[1]||""}});var Gb=w((Ppe,TB)=>{"use strict";c();var lf=Rt(),SZ=lB(),CZ=hB(),TZ=Fb(),xZ=Vb(),NZ=EB(),OZ=bB(),DZ=Mb(),oi=Do(),PZ=cf(),RZ=CB();TB.exports=function(e){return new Promise(function(n,i){var s=e.data,o=e.headers,a=e.responseType,u;function l(){e.cancelToken&&e.cancelToken.unsubscribe(u),e.signal&&e.signal.removeEventListener("abort",u)}lf.isFormData(s)&&lf.isStandardBrowserEnv()&&delete o["Content-Type"];var f=new XMLHttpRequest;if(e.auth){var d=e.auth.username||"",y=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.Authorization="Basic "+btoa(d+":"+y)}var m=xZ(e.baseURL,e.url);f.open(e.method.toUpperCase(),TZ(m,e.params,e.paramsSerializer),!0),f.timeout=e.timeout;function v(){if(f){var A="getAllResponseHeaders"in f?NZ(f.getAllResponseHeaders()):null,D=!a||a==="text"||a==="json"?f.responseText:f.response,x={data:D,status:f.status,statusText:f.statusText,headers:A,config:e,request:f};SZ(function(P){n(P),l()},function(P){i(P),l()},x),f=null}}if("onloadend"in f?f.onloadend=v:f.onreadystatechange=function(){!f||f.readyState!==4||f.status===0&&!(f.responseURL&&f.responseURL.indexOf("file:")===0)||setTimeout(v)},f.onabort=function(){f&&(i(new oi("Request aborted",oi.ECONNABORTED,e,f)),f=null)},f.onerror=function(){i(new oi("Network Error",oi.ERR_NETWORK,e,f,f)),f=null},f.ontimeout=function(){var D=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",x=e.transitional||DZ;e.timeoutErrorMessage&&(D=e.timeoutErrorMessage),i(new oi(D,x.clarifyTimeoutError?oi.ETIMEDOUT:oi.ECONNABORTED,e,f)),f=null},lf.isStandardBrowserEnv()){var T=(e.withCredentials||OZ(m))&&e.xsrfCookieName?CZ.read(e.xsrfCookieName):void 0;T&&(o[e.xsrfHeaderName]=T)}"setRequestHeader"in f&&lf.forEach(o,function(D,x){typeof s>"u"&&x.toLowerCase()==="content-type"?delete o[x]:f.setRequestHeader(x,D)}),lf.isUndefined(e.withCredentials)||(f.withCredentials=!!e.withCredentials),a&&a!=="json"&&(f.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&f.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&f.upload&&f.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(u=function(A){f&&(i(!A||A&&A.type?new PZ:A),f.abort(),f=null)},e.cancelToken&&e.cancelToken.subscribe(u),e.signal&&(e.signal.aborted?u():e.signal.addEventListener("abort",u))),s||(s=null);var B=RZ(m);if(B&&["http","https","file"].indexOf(B)===-1){i(new oi("Unsupported protocol "+B+":",oi.ERR_BAD_REQUEST,e));return}f.send(s)})}});var NB=w((Bpe,xB)=>{c();xB.exports=null});var Kg=w((Fpe,RB)=>{"use strict";c();var Bt=Rt(),OB=rB(),DB=Do(),BZ=Mb(),LZ=Ub(),FZ={"Content-Type":"application/x-www-form-urlencoded"};function PB(t,e){!Bt.isUndefined(t)&&Bt.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function MZ(){var t;return typeof XMLHttpRequest<"u"?t=Gb():typeof p.default<"u"&&Object.prototype.toString.call(p.default)==="[object process]"&&(t=Gb()),t}function UZ(t,e,r){if(Bt.isString(t))try{return(e||JSON.parse)(t),Bt.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}var Wg={transitional:BZ,adapter:MZ(),transformRequest:[function(e,r){if(OB(r,"Accept"),OB(r,"Content-Type"),Bt.isFormData(e)||Bt.isArrayBuffer(e)||Bt.isBuffer(e)||Bt.isStream(e)||Bt.isFile(e)||Bt.isBlob(e))return e;if(Bt.isArrayBufferView(e))return e.buffer;if(Bt.isURLSearchParams(e))return PB(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString();var n=Bt.isObject(e),i=r&&r["Content-Type"],s;if((s=Bt.isFileList(e))||n&&i==="multipart/form-data"){var o=this.env&&this.env.FormData;return LZ(s?{"files[]":e}:e,o&&new o)}else if(n||i==="application/json")return PB(r,"application/json"),UZ(e);return e}],transformResponse:[function(e){var r=this.transitional||Wg.transitional,n=r&&r.silentJSONParsing,i=r&&r.forcedJSONParsing,s=!n&&this.responseType==="json";if(s||i&&Bt.isString(e)&&e.length)try{return JSON.parse(e)}catch(o){if(s)throw o.name==="SyntaxError"?DB.from(o,DB.ERR_BAD_RESPONSE,this,null,this.response):o}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:NB()},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};Bt.forEach(["delete","get","head"],function(e){Wg.headers[e]={}});Bt.forEach(["post","put","patch"],function(e){Wg.headers[e]=Bt.merge(FZ)});RB.exports=Wg});var LB=w((Upe,BB)=>{"use strict";c();var qZ=Rt(),VZ=Kg();BB.exports=function(e,r,n){var i=this||VZ;return qZ.forEach(n,function(o){e=o.call(i,e,r)}),e}});var Qb=w((Vpe,FB)=>{"use strict";c();FB.exports=function(e){return!!(e&&e.__CANCEL__)}});var qB=w((Hpe,UB)=>{"use strict";c();var MB=Rt(),kb=LB(),jZ=Qb(),HZ=Kg(),GZ=cf();function zb(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new GZ}UB.exports=function(e){zb(e),e.headers=e.headers||{},e.data=kb.call(e,e.data,e.headers,e.transformRequest),e.headers=MB.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),MB.forEach(["delete","get","head","post","put","patch","common"],function(i){delete e.headers[i]});var r=e.adapter||HZ.adapter;return r(e).then(function(i){return zb(e),i.data=kb.call(e,i.data,i.headers,e.transformResponse),i},function(i){return jZ(i)||(zb(e),i&&i.response&&(i.response.data=kb.call(e,i.response.data,i.response.headers,e.transformResponse))),Promise.reject(i)})}});var Wb=w((Qpe,VB)=>{"use strict";c();var dr=Rt();VB.exports=function(e,r){r=r||{};var n={};function i(f,d){return dr.isPlainObject(f)&&dr.isPlainObject(d)?dr.merge(f,d):dr.isPlainObject(d)?dr.merge({},d):dr.isArray(d)?d.slice():d}function s(f){if(dr.isUndefined(r[f])){if(!dr.isUndefined(e[f]))return i(void 0,e[f])}else return i(e[f],r[f])}function o(f){if(!dr.isUndefined(r[f]))return i(void 0,r[f])}function a(f){if(dr.isUndefined(r[f])){if(!dr.isUndefined(e[f]))return i(void 0,e[f])}else return i(void 0,r[f])}function u(f){if(f in r)return i(e[f],r[f]);if(f in e)return i(void 0,e[f])}var l={url:o,method:o,data:o,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:u};return dr.forEach(Object.keys(e).concat(Object.keys(r)),function(d){var y=l[d]||s,m=y(d);dr.isUndefined(m)&&y!==u||(n[d]=m)}),n}});var Kb=w((zpe,jB)=>{c();jB.exports={version:"0.27.2"}});var QB=w((Kpe,GB)=>{"use strict";c();var QZ=Kb().version,as=Do(),$b={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){$b[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var HB={};$b.transitional=function(e,r,n){function i(s,o){return"[Axios v"+QZ+"] Transitional option '"+s+"'"+o+(n?". "+n:"")}return function(s,o,a){if(e===!1)throw new as(i(o," has been removed"+(r?" in "+r:"")),as.ERR_DEPRECATED);return r&&!HB[o]&&(HB[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 kZ(t,e,r){if(typeof t!="object")throw new as("options must be an object",as.ERR_BAD_OPTION_VALUE);for(var n=Object.keys(t),i=n.length;i-- >0;){var s=n[i],o=e[s];if(o){var a=t[s],u=a===void 0||o(a,s,t);if(u!==!0)throw new as("option "+s+" must be "+u,as.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new as("Unknown option "+s,as.ERR_BAD_OPTION)}}GB.exports={assertOptions:kZ,validators:$b}});var YB=w((Ype,$B)=>{"use strict";c();var WB=Rt(),zZ=Fb(),kB=eB(),zB=qB(),$g=Wb(),WZ=Vb(),KB=QB(),oc=KB.validators;function ac(t){this.defaults=t,this.interceptors={request:new kB,response:new kB}}ac.prototype.request=function(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=$g(this.defaults,r),r.method?r.method=r.method.toLowerCase():this.defaults.method?r.method=this.defaults.method.toLowerCase():r.method="get";var n=r.transitional;n!==void 0&&KB.assertOptions(n,{silentJSONParsing:oc.transitional(oc.boolean),forcedJSONParsing:oc.transitional(oc.boolean),clarifyTimeoutError:oc.transitional(oc.boolean)},!1);var i=[],s=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(r)===!1||(s=s&&m.synchronous,i.unshift(m.fulfilled,m.rejected))});var o=[];this.interceptors.response.forEach(function(m){o.push(m.fulfilled,m.rejected)});var a;if(!s){var u=[zB,void 0];for(Array.prototype.unshift.apply(u,i),u=u.concat(o),a=Promise.resolve(r);u.length;)a=a.then(u.shift(),u.shift());return a}for(var l=r;i.length;){var f=i.shift(),d=i.shift();try{l=f(l)}catch(y){d(y);break}}try{a=zB(l)}catch(y){return Promise.reject(y)}for(;o.length;)a=a.then(o.shift(),o.shift());return a};ac.prototype.getUri=function(e){e=$g(this.defaults,e);var r=WZ(e.baseURL,e.url);return zZ(r,e.params,e.paramsSerializer)};WB.forEach(["delete","get","head","options"],function(e){ac.prototype[e]=function(r,n){return this.request($g(n||{},{method:e,url:r,data:(n||{}).data}))}});WB.forEach(["post","put","patch"],function(e){function r(n){return function(s,o,a){return this.request($g(a||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:s,data:o}))}}ac.prototype[e]=r(),ac.prototype[e+"Form"]=r(!0)});$B.exports=ac});var XB=w((Xpe,JB)=>{"use strict";c();var KZ=cf();function uc(t){if(typeof t!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(i){e=i});var r=this;this.promise.then(function(n){if(r._listeners){var i,s=r._listeners.length;for(i=0;i{"use strict";c();ZB.exports=function(e){return function(n){return e.apply(null,n)}}});var rL=w((rge,tL)=>{"use strict";c();var $Z=Rt();tL.exports=function(e){return $Z.isObject(e)&&e.isAxiosError===!0}});var sL=w((ige,Yb)=>{"use strict";c();var nL=Rt(),YZ=Nb(),Yg=YB(),JZ=Wb(),XZ=Kg();function iL(t){var e=new Yg(t),r=YZ(Yg.prototype.request,e);return nL.extend(r,Yg.prototype,e),nL.extend(r,e),r.create=function(i){return iL(JZ(t,i))},r}var ar=iL(XZ);ar.Axios=Yg;ar.CanceledError=cf();ar.CancelToken=XB();ar.isCancel=Qb();ar.VERSION=Kb().version;ar.toFormData=Ub();ar.AxiosError=Do();ar.Cancel=ar.CanceledError;ar.all=function(e){return Promise.all(e)};ar.spread=eL();ar.isAxiosError=rL();Yb.exports=ar;Yb.exports.default=ar});var aL=w((oge,oL)=>{c();oL.exports=sL()});var uL=w(Jg=>{"use strict";c();Object.defineProperty(Jg,"__esModule",{value:!0});Jg.NativeAuthClientConfig=void 0;var Jb=class{constructor(){this.origin=typeof window<"u"?window.location.hostname:"",this.apiUrl="https://api.multiversx.com",this.expirySeconds=60*60*24}};Jg.NativeAuthClientConfig=Jb});var Zb=w(cc=>{"use strict";c();var Po=cc&&cc.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(cc,"__esModule",{value:!0});cc.NativeAuthClient=void 0;var ZZ=aL(),eee=uL(),Xb=class{constructor(e){this.config=Object.assign(new eee.NativeAuthClientConfig,e)}getToken(e,r,n){let i=this.encodeValue(e),s=this.encodeValue(r);return`${i}.${s}.${n}`}initialize(e={}){return Po(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 Po(this,void 0,void 0,function*(){return this.config.gatewayUrl?yield this.getCurrentBlockHashWithGateway():yield this.getCurrentBlockHashWithApi()})}getCurrentBlockHashWithGateway(){return Po(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 Po(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 Po(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 Po(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 Po(this,void 0,void 0,function*(){return yield ZZ.default.get(e,{headers:this.config.extraRequestHeaders})})}};cc.NativeAuthClient=Xb});var dL=w(e0=>{"use strict";c();Object.defineProperty(e0,"__esModule",{value:!0});e0.TransactionStatus=void 0;var ff=class{constructor(e){this.status=(e||"").toLowerCase()}static createUnknown(){return new ff("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}};e0.TransactionStatus=ff});var hc=w(Ft=>{"use strict";c();var tee=Ft&&Ft.__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]}),ree=Ft&&Ft.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nee=Ft&&Ft.__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)&&tee(e,t,r);return ree(e,t),e};Object.defineProperty(Ft,"__esModule",{value:!0});Ft.zeroPadStringIfOddLength=Ft.isPaddedHex=Ft.numberToPaddedHex=Ft.Nonce=Ft.Address=void 0;var pL=nee(Qf()),iee="erd",hf=class{constructor(e){this.value=e}static fromPubkey(e){let r=pL.toWords(e),n=pL.encode(iee,r);return new hf(n)}bech32(){return this.value}toString(){return this.bech32()}};Ft.Address=hf;var e_=class{constructor(e){this.value=e}valueOf(){return this.value}hex(){return gL(this.value)}};Ft.Nonce=e_;function gL(t){let e=t.toString(16);return yL(e)}Ft.numberToPaddedHex=gL;function see(t){t=t||"";let e=h.Buffer.from(t,"hex").toString("hex");return t.toUpperCase()==e.toUpperCase()}Ft.isPaddedHex=see;function yL(t){return t=t||"",t.length%2==1?"0"+t:t}Ft.zeroPadStringIfOddLength=yL});var wL=w(t0=>{"use strict";c();Object.defineProperty(t0,"__esModule",{value:!0});t0.TransactionReceipt=void 0;var mL=hc(),df=class{constructor(){this.value="",this.sender=new mL.Address(""),this.data="",this.hash=""}static fromHttpResponse(e){let r=new df;return r.value=(e.value||0).toString(),r.sender=new mL.Address(e.sender),r.data=e.data,r.hash=e.txHash,r}};t0.TransactionReceipt=df});var EL=w(Rn=>{"use strict";c();Object.defineProperty(Rn,"__esModule",{value:!0});Rn.ErrContractQuery=Rn.ErrNetworkProvider=Rn.ErrUnexpectedCondition=Rn.Err=void 0;var dc=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};Rn.Err=dc;var t_=class extends dc{constructor(e){super(`Unexpected condition: [${e}]`)}};Rn.ErrUnexpectedCondition=t_;var r_=class extends dc{constructor(e,r,n){let i=`Request error on url [${e}]: [${r}]`;super(i,n)}};Rn.ErrNetworkProvider=r_;var n_=class extends dc{constructor(e){super(e.message.replace("executeQuery:",""))}};Rn.ErrContractQuery=n_});var AL=w(pc=>{"use strict";c();Object.defineProperty(pc,"__esModule",{value:!0});pc.TransactionEventTopic=pc.TransactionEvent=void 0;var vL=hc(),pf=class{constructor(e){this.address=new vL.Address(""),this.identifier="",this.topics=[],this.data="",Object.assign(this,e)}static fromHttpResponse(e){let r=new pf;return r.address=new vL.Address(e.address),r.identifier=e.identifier||"",r.topics=(e.topics||[]).map(n=>new r0(n)),r.data=h.Buffer.from(e.data||"","base64").toString(),r}findFirstOrNoneTopic(e){return this.topics.filter(r=>e(r))[0]}getLastTopic(){return this.topics[this.topics.length-1]}};pc.TransactionEvent=pf;var r0=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}};pc.TransactionEventTopic=r0});var i_=w(n0=>{"use strict";c();Object.defineProperty(n0,"__esModule",{value:!0});n0.TransactionLogs=void 0;var oee=EL(),bL=hc(),aee=AL(),gf=class{constructor(e){this.address=new bL.Address(""),this.events=[],Object.assign(this,e)}static fromHttpResponse(e){let r=new gf;return r.address=new bL.Address(e.address),r.events=(e.events||[]).map(n=>aee.TransactionEvent.fromHttpResponse(n)),r}findSingleOrNoneEvent(e,r){let n=this.findEvents(e,r);if(n.length>1)throw new oee.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}};n0.TransactionLogs=gf});var IL=w(yc=>{"use strict";c();Object.defineProperty(yc,"__esModule",{value:!0});yc.ContractResultItem=yc.ContractResults=void 0;var _L=i_(),i0=hc(),gc=class{constructor(e){this.items=e,this.items.sort(function(r,n){return r.nonce.valueOf()-n.nonce.valueOf()})}static fromProxyHttpResponse(e){let r=e.map(n=>ai.fromProxyHttpResponse(n));return new gc(r)}static fromApiHttpResponse(e){let r=e.map(n=>ai.fromApiHttpResponse(n));return new gc(r)}};yc.ContractResults=gc;var ai=class{constructor(e){this.hash="",this.nonce=0,this.value="",this.receiver=new i0.Address(""),this.sender=new i0.Address(""),this.data="",this.previousHash="",this.originalHash="",this.gasLimit=0,this.gasPrice=0,this.callType=0,this.returnMessage="",this.logs=new _L.TransactionLogs,Object.assign(this,e)}static fromProxyHttpResponse(e){return ai.fromHttpResponse(e)}static fromApiHttpResponse(e){let r=ai.fromHttpResponse(e);return r.data=h.Buffer.from(r.data,"base64").toString(),r.callType=Number(r.callType),r}static fromHttpResponse(e){let r=new ai;return r.hash=e.hash,r.nonce=Number(e.nonce||0),r.value=(e.value||0).toString(),r.receiver=new i0.Address(e.receiver),r.sender=new i0.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=_L.TransactionLogs.fromHttpResponse(e.logs||{}),r}};yc.ContractResultItem=ai});var SL=w(cs=>{"use strict";c();var uee=cs&&cs.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(cs,"__esModule",{value:!0});cs.EsdtContractAddress=cs.MaxUint64AsBigNumber=void 0;var cee=uee(Yt()),lee=hc();cs.MaxUint64AsBigNumber=new cee.default("18446744073709551615");cs.EsdtContractAddress=new lee.Address("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u")});var CL=w(mc=>{"use strict";c();var fee=mc&&mc.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(mc,"__esModule",{value:!0});mc.ContractQueryResponse=void 0;var hee=fee(Yt()),dee=SL(),yf=class{constructor(e){this.returnData=e?.returnData||[],this.returnCode=e?.returnCode||"",this.returnMessage=e?.returnMessage||"",this.gasUsed=e?.gasUsed||0}static fromHttpResponse(e){let r=e.returnData||e.ReturnData,n=e.returnCode||e.ReturnCode,i=e.returnMessage||e.ReturnMessage,s=new hee.default(e.gasRemaining||e.GasRemaining||0),o=dee.MaxUint64AsBigNumber.minus(s).toNumber();return new yf({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()}}};mc.ContractQueryResponse=yf});var TL=w(s0=>{"use strict";c();Object.defineProperty(s0,"__esModule",{value:!0});s0.ContractQueryRequest=void 0;var s_=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}};s0.ContractQueryRequest=s_});var UL=w((S0e,ML)=>{c();ML.exports=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}});var ls=w(Lo=>{c();var o_,pee=[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];Lo.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};Lo.getSymbolTotalCodewords=function(e){return pee[e]};Lo.getBCHDigit=function(t){let e=0;for(;t!==0;)e++,t>>>=1;return e};Lo.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');o_=e};Lo.isKanjiModeEnabled=function(){return typeof o_<"u"};Lo.toSJIS=function(e){return o_(e)}});var u0=w(Rr=>{c();Rr.L={bit:1};Rr.M={bit:0};Rr.Q={bit:3};Rr.H={bit:2};function gee(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return Rr.L;case"m":case"medium":return Rr.M;case"q":case"quartile":return Rr.Q;case"h":case"high":return Rr.H;default:throw new Error("Unknown EC Level: "+t)}}Rr.isValid=function(e){return e&&typeof e.bit<"u"&&e.bit>=0&&e.bit<4};Rr.from=function(e,r){if(Rr.isValid(e))return e;try{return gee(e)}catch{return r}}});var jL=w((D0e,VL)=>{c();function qL(){this.buffer=[],this.length=0}qL.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++}};VL.exports=qL});var GL=w((R0e,HL)=>{c();function mf(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)}mf.prototype.set=function(t,e,r,n){let i=t*this.size+e;this.data[i]=r,n&&(this.reservedBit[i]=!0)};mf.prototype.get=function(t,e){return this.data[t*this.size+e]};mf.prototype.xor=function(t,e,r){this.data[t*this.size+e]^=r};mf.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};HL.exports=mf});var QL=w(c0=>{c();var yee=ls().getSymbolSize;c0.getRowColCoords=function(e){if(e===1)return[];let r=Math.floor(e/7)+2,n=yee(e),i=n===145?26:Math.ceil((n-13)/(2*r-2))*2,s=[n-7];for(let o=1;o{c();var mee=ls().getSymbolSize,kL=7;zL.getPositions=function(e){let r=mee(e);return[[0,0],[r-kL,0],[0,r-kL]]}});var KL=w(Ke=>{c();Ke.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var Fo={N1:3,N2:3,N3:40,N4:10};Ke.isValid=function(e){return e!=null&&e!==""&&!isNaN(e)&&e>=0&&e<=7};Ke.from=function(e){return Ke.isValid(e)?parseInt(e,10):void 0};Ke.getPenaltyN1=function(e){let r=e.size,n=0,i=0,s=0,o=null,a=null;for(let u=0;u=5&&(n+=Fo.N1+(i-5)),o=f,i=1),f=e.get(l,u),f===a?s++:(s>=5&&(n+=Fo.N1+(s-5)),a=f,s=1)}i>=5&&(n+=Fo.N1+(i-5)),s>=5&&(n+=Fo.N1+(s-5))}return n};Ke.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*Fo.N3};Ke.getPenaltyN4=function(e){let r=0,n=e.data.length;for(let s=0;s{c();var fs=u0(),l0=[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],f0=[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];a_.getBlocksCount=function(e,r){switch(r){case fs.L:return l0[(e-1)*4+0];case fs.M:return l0[(e-1)*4+1];case fs.Q:return l0[(e-1)*4+2];case fs.H:return l0[(e-1)*4+3];default:return}};a_.getTotalCodewordsCount=function(e,r){switch(r){case fs.L:return f0[(e-1)*4+0];case fs.M:return f0[(e-1)*4+1];case fs.Q:return f0[(e-1)*4+2];case fs.H:return f0[(e-1)*4+3];default:return}}});var $L=w(d0=>{c();var wf=new Uint8Array(512),h0=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)wf[r]=e,h0[e]=r,e<<=1,e&256&&(e^=285);for(let r=255;r<512;r++)wf[r]=wf[r-255]})();d0.log=function(e){if(e<1)throw new Error("log("+e+")");return h0[e]};d0.exp=function(e){return wf[e]};d0.mul=function(e,r){return e===0||r===0?0:wf[h0[e]+h0[r]]}});var YL=w(Ef=>{c();var c_=$L();Ef.mul=function(e,r){let n=new Uint8Array(e.length+r.length-1);for(let i=0;i=0;){let i=n[0];for(let o=0;o{c();var JL=YL();function l_(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}l_.prototype.initialize=function(e){this.degree=e,this.genPoly=JL.generateECPolynomial(this.degree)};l_.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=JL.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};XL.exports=l_});var f_=w(eF=>{c();eF.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}});var h_=w(ui=>{c();var tF="[0-9]+",Eee="[A-Z $%*+\\-./:]+",vf="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";vf=vf.replace(/u/g,"\\u");var vee="(?:(?![A-Z0-9 $%*+\\-./:]|"+vf+`)(?:.|[\r -]))+`;ui.KANJI=new RegExp(vf,"g");ui.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");ui.BYTE=new RegExp(vee,"g");ui.NUMERIC=new RegExp(tF,"g");ui.ALPHANUMERIC=new RegExp(Eee,"g");var Aee=new RegExp("^"+vf+"$"),bee=new RegExp("^"+tF+"$"),_ee=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");ui.testKanji=function(e){return Aee.test(e)};ui.testNumeric=function(e){return bee.test(e)};ui.testAlphanumeric=function(e){return _ee.test(e)}});var hs=w(Et=>{c();var Iee=f_(),d_=h_();Et.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]};Et.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]};Et.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]};Et.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]};Et.MIXED={bit:-1};Et.getCharCountIndicator=function(e,r){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!Iee.isValid(r))throw new Error("Invalid version: "+r);return r>=1&&r<10?e.ccBits[0]:r<27?e.ccBits[1]:e.ccBits[2]};Et.getBestModeForData=function(e){return d_.testNumeric(e)?Et.NUMERIC:d_.testAlphanumeric(e)?Et.ALPHANUMERIC:d_.testKanji(e)?Et.KANJI:Et.BYTE};Et.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")};Et.isValid=function(e){return e&&e.bit&&e.ccBits};function See(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return Et.NUMERIC;case"alphanumeric":return Et.ALPHANUMERIC;case"kanji":return Et.KANJI;case"byte":return Et.BYTE;default:throw new Error("Unknown mode: "+t)}}Et.from=function(e,r){if(Et.isValid(e))return e;try{return See(e)}catch{return r}}});var oF=w(Mo=>{c();var p0=ls(),Cee=u_(),rF=u0(),ds=hs(),p_=f_(),iF=7973,nF=p0.getBCHDigit(iF);function Tee(t,e,r){for(let n=1;n<=40;n++)if(e<=Mo.getCapacity(n,r,t))return n}function sF(t,e){return ds.getCharCountIndicator(t,e)+4}function xee(t,e){let r=0;return t.forEach(function(n){let i=sF(n.mode,e);r+=i+n.getBitsLength()}),r}function Nee(t,e){for(let r=1;r<=40;r++)if(xee(t,r)<=Mo.getCapacity(r,e,ds.MIXED))return r}Mo.from=function(e,r){return p_.isValid(e)?parseInt(e,10):r};Mo.getCapacity=function(e,r,n){if(!p_.isValid(e))throw new Error("Invalid QR Code version");typeof n>"u"&&(n=ds.BYTE);let i=p0.getSymbolTotalCodewords(e),s=Cee.getTotalCodewordsCount(e,r),o=(i-s)*8;if(n===ds.MIXED)return o;let a=o-sF(n,e);switch(n){case ds.NUMERIC:return Math.floor(a/10*3);case ds.ALPHANUMERIC:return Math.floor(a/11*2);case ds.KANJI:return Math.floor(a/13);case ds.BYTE:default:return Math.floor(a/8)}};Mo.getBestVersionForData=function(e,r){let n,i=rF.from(r,rF.M);if(Array.isArray(e)){if(e.length>1)return Nee(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return Tee(n.mode,n.getLength(),i)};Mo.getEncodedBits=function(e){if(!p_.isValid(e)||e<7)throw new Error("Invalid QR Code version");let r=e<<12;for(;p0.getBCHDigit(r)-nF>=0;)r^=iF<{c();var g_=ls(),uF=1335,Oee=21522,aF=g_.getBCHDigit(uF);cF.getEncodedBits=function(e,r){let n=e.bit<<3|r,i=n<<10;for(;g_.getBCHDigit(i)-aF>=0;)i^=uF<{c();var Dee=hs();function wc(t){this.mode=Dee.NUMERIC,this.data=t.toString()}wc.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)};wc.prototype.getLength=function(){return this.data.length};wc.prototype.getBitsLength=function(){return wc.getBitsLength(this.data.length)};wc.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))};fF.exports=wc});var pF=w((aye,dF)=>{c();var Pee=hs(),y_=["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 Ec(t){this.mode=Pee.ALPHANUMERIC,this.data=t}Ec.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)};Ec.prototype.getLength=function(){return this.data.length};Ec.prototype.getBitsLength=function(){return Ec.getBitsLength(this.data.length)};Ec.prototype.write=function(e){let r;for(r=0;r+2<=this.data.length;r+=2){let n=y_.indexOf(this.data[r])*45;n+=y_.indexOf(this.data[r+1]),e.put(n,11)}this.data.length%2&&e.put(y_.indexOf(this.data[r]),6)};dF.exports=Ec});var yF=w((cye,gF)=>{"use strict";c();gF.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 wF=w((fye,mF)=>{c();var Ree=yF(),Bee=hs();function vc(t){this.mode=Bee.BYTE,typeof t=="string"&&(t=Ree(t)),this.data=new Uint8Array(t)}vc.getBitsLength=function(e){return e*8};vc.prototype.getLength=function(){return this.data.length};vc.prototype.getBitsLength=function(){return vc.getBitsLength(this.data.length)};vc.prototype.write=function(t){for(let e=0,r=this.data.length;e{c();var Lee=hs(),Fee=ls();function Ac(t){this.mode=Lee.KANJI,this.data=t}Ac.getBitsLength=function(e){return e*13};Ac.prototype.getLength=function(){return this.data.length};Ac.prototype.getBitsLength=function(){return Ac.getBitsLength(this.data.length)};Ac.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)}};EF.exports=Ac});var AF=w((gye,m_)=>{"use strict";c();var Af={single_source_shortest_paths:function(t,e,r){var n={},i={};i[e]=0;var s=Af.PriorityQueue.make();s.push(e,0);for(var o,a,u,l,f,d,y,m,v;!s.empty();){o=s.pop(),a=o.value,l=o.cost,f=t[a]||{};for(u in f)f.hasOwnProperty(u)&&(d=f[u],y=l+d,m=i[u],v=typeof i[u]>"u",(v||m>y)&&(i[u]=y,s.push(u,y),n[u]=a))}if(typeof r<"u"&&typeof i[r]>"u"){var T=["Could not find a path from ",e," to ",r,"."].join("");throw new Error(T)}return n},extract_shortest_path_from_predecessor_list:function(t,e){for(var r=[],n=e,i;n;)r.push(n),i=t[n],n=t[n];return r.reverse(),r},find_path:function(t,e,r){var n=Af.single_source_shortest_paths(t,e,r);return Af.extract_shortest_path_from_predecessor_list(n,r)},PriorityQueue:{make:function(t){var e=Af.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 m_<"u"&&(m_.exports=Af)});var NF=w(bc=>{c();var Ve=hs(),IF=hF(),SF=pF(),CF=wF(),TF=vF(),bf=h_(),g0=ls(),Mee=AF();function bF(t){return unescape(encodeURIComponent(t)).length}function _f(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 xF(t){let e=_f(bf.NUMERIC,Ve.NUMERIC,t),r=_f(bf.ALPHANUMERIC,Ve.ALPHANUMERIC,t),n,i;return g0.isKanjiModeEnabled()?(n=_f(bf.BYTE,Ve.BYTE,t),i=_f(bf.KANJI,Ve.KANJI,t)):(n=_f(bf.BYTE_KANJI,Ve.BYTE,t),i=[]),e.concat(r,n,i).sort(function(o,a){return o.index-a.index}).map(function(o){return{data:o.data,mode:o.mode,length:o.length}})}function w_(t,e){switch(e){case Ve.NUMERIC:return IF.getBitsLength(t);case Ve.ALPHANUMERIC:return SF.getBitsLength(t);case Ve.KANJI:return TF.getBitsLength(t);case Ve.BYTE:return CF.getBitsLength(t)}}function Uee(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 qee(t){let e=[];for(let r=0;r{c();var m0=ls(),E_=u0(),jee=jL(),Hee=GL(),Gee=QL(),Qee=WL(),b_=KL(),__=u_(),kee=ZL(),y0=oF(),zee=lF(),Wee=hs(),v_=NF();function Kee(t,e){let r=t.size,n=Qee.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 $ee(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 A_(t,e,r){let n=t.size,i=zee.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 Xee(t,e){let r=t.size,n=-1,i=r-1,s=7,o=0;for(let a=r-1;a>0;a-=2)for(a===6&&a--;;){for(let u=0;u<2;u++)if(!t.isReserved(i,a-u)){let l=!1;o>>s&1)===1),t.set(i,a-u,l),s--,s===-1&&(o++,s=7)}if(i+=n,i<0||r<=i){i-=n,n=-n;break}}}function Zee(t,e,r){let n=new jee;r.forEach(function(u){n.put(u.mode.bit,4),n.put(u.getLength(),Wee.getCharCountIndicator(u.mode,t)),u.write(n)});let i=m0.getSymbolTotalCodewords(t),s=__.getTotalCodewordsCount(t,e),o=(i-s)*8;for(n.getLengthInBits()+4<=o&&n.put(0,4);n.getLengthInBits()%8!==0;)n.putBit(0);let a=(o-n.getLengthInBits())/8;for(let u=0;u{n||(Mi(i[d].methods,s[d].methods)?Mi(i[d].events,s[d].events)||(n=Zn("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${d}`)):n=Zn("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${d}`))}),n}function h$(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 QP(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function d$(t){let e={};return Object.keys(t).forEach(r=>{r.includes(":")?e[r]=t[r]:Gs(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 p$(t,e){return Np(t,!1)&&t<=e.max&&t>=e.min}k.BASE10=aA,k.BASE16=tr,k.BASE64=bp,k.COLON=cz,k.DEFAULT_DEPTH=fA,k.EMPTY_SPACE=_p,k.ENV_MAP=ei,k.ONE_THOUSAND=lz,k.REACT_NATIVE_PRODUCT=a3,k.RELAYER_DEFAULT_PROTOCOL=w3,k.SDK_TYPE=c3,k.SLASH=u3,k.TYPE_0=uA,k.TYPE_1=Ma,k.UTF8=Tp,k.appendToQueryString=h3,k.assertType=gz,k.buildApprovedNamespaces=zz,k.calcExpiry=Tz,k.capitalize=Az,k.capitalizeWord=E3,k.createDelayedPromise=bz,k.createExpiringPromise=_z,k.decodeTypeByte=Zc,k.decrypt=nz,k.deriveSymKey=ZW,k.deserialize=lA,k.encodeTypeByte=i3,k.encrypt=rz,k.engineEvent=Nz,k.enumify=vz,k.formatAccountId=XP,k.formatAccountWithChain=GW,k.formatChainId=JP,k.formatExpirerTarget=dA,k.formatIdTarget=Sz,k.formatMessage=KW,k.formatMessageContext=yz,k.formatRelayParams=b3,k.formatRelayRpcUrl=dz,k.formatTopicTarget=Iz,k.formatUA=g3,k.formatUri=Uz,k.generateKeyPair=JW,k.generateRandomBytes32=XW,k.getAccountsChains=Gs,k.getAccountsFromNamespaces=QW,k.getAddressFromAccount=ZP,k.getAddressesFromAccounts=kW,k.getAppMetadata=fz,k.getChainFromAccount=e3,k.getChainsFromAccounts=t3,k.getChainsFromNamespace=Sp,k.getChainsFromNamespaces=WW,k.getChainsFromRequiredNamespaces=zW,k.getDidAddress=n3,k.getDidAddressSegments=Cp,k.getDidChainId=r3,k.getEnvironment=el,k.getHttpUrl=pz,k.getInternalError=Zn,k.getJavascriptID=p3,k.getJavascriptOS=d3,k.getLastItems=m3,k.getNamespacedDidChainId=$W,k.getNamespacesChains=_3,k.getNamespacesEventsForChainId=S3,k.getNamespacesMethodsForChainId=I3,k.getRelayClientMetadata=hz,k.getRelayProtocolApi=Pz,k.getRelayProtocolName=Dz,k.getRequiredNamespacesFromNamespaces=Wz,k.getSdkError=js,k.getUniqueValues=oA,k.handleDeeplinkRedirect=Oz,k.hasOverlap=Mi,k.hashKey=ez,k.hashMessage=tz,k.isBrowser=f3,k.isCaipNamespace=pA,k.isConformingNamespaces=L3,k.isExpired=xz,k.isNode=hA,k.isProposalStruct=Xz,k.isReactNative=l3,k.isSessionCompatible=Yz,k.isSessionStruct=Zz,k.isTypeOneEnvelope=sz,k.isUndefined=qi,k.isValidAccountId=T3,k.isValidAccounts=O3,k.isValidActions=P3,k.isValidArray=tl,k.isValidChainId=Xc,k.isValidChains=x3,k.isValidController=e$,k.isValidErrorReason=s$,k.isValidEvent=u$,k.isValidId=n$,k.isValidNamespaceAccounts=D3,k.isValidNamespaceActions=gA,k.isValidNamespaceChains=N3,k.isValidNamespaceMethodsOrEvents=nA,k.isValidNamespaces=R3,k.isValidNamespacesChainId=c$,k.isValidNamespacesEvent=f$,k.isValidNamespacesRequest=l$,k.isValidNumber=Np,k.isValidObject=xp,k.isValidParams=i$,k.isValidRelay=B3,k.isValidRelays=r$,k.isValidRequest=o$,k.isValidRequestExpiry=p$,k.isValidRequiredNamespaces=t$,k.isValidResponse=a$,k.isValidString=wr,k.isValidUrl=Jz,k.mapEntries=wz,k.mapToObj=mz,k.mergeArrays=Ui,k.normalizeNamespaces=rA,k.objToMap=Ez,k.parseAccountId=sA,k.parseChainId=YP,k.parseContextNames=y3,k.parseExpirerTarget=Cz,k.parseNamespaceKey=C3,k.parseRelayParams=v3,k.parseTopic=A3,k.parseUri=Mz,k.serialize=s3,k.validateDecoding=iz,k.validateEncoding=o3});var F3,M3,U3,q3,Op,nl,yA,Dp,Vi,il,Pp=ge(()=>{c();F3="PARSE_ERROR",M3="INVALID_REQUEST",U3="METHOD_NOT_FOUND",q3="INVALID_PARAMS",Op="INTERNAL_ERROR",nl="SERVER_ERROR",yA=[-32700,-32600,-32601,-32602,-32603],Dp=[-32e3,-32099],Vi={[F3]:{code:-32700,message:"Parse error"},[M3]:{code:-32600,message:"Invalid Request"},[U3]:{code:-32601,message:"Method not found"},[q3]:{code:-32602,message:"Invalid params"},[Op]:{code:-32603,message:"Internal error"},[nl]:{code:-32e3,message:"Server error"}},il=nl});function g$(t){return t<=Dp[0]&&t>=Dp[1]}function Rp(t){return yA.includes(t)}function V3(t){return typeof t=="number"}function Bp(t){return Object.keys(Vi).includes(t)?Vi[t]:Vi[il]}function Lp(t){let e=Object.values(Vi).find(r=>r.code===t);return e||Vi[il]}function y$(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(!V3(t.error.code))return{valid:!1,error:`Invalid error code type for JSON-RPC: ${t.error.code}`};if(Rp(t.error.code)){let e=Lp(t.error.code);if(e.message!==Vi[il].message&&t.error.message===e.message)return{valid:!1,error:`Invalid error code message for JSON-RPC: ${t.error.code}`}}return{valid:!0}}function mA(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var EA=ge(()=>{c();Pp()});var j3=m(Hi=>{"use strict";c();Object.defineProperty(Hi,"__esModule",{value:!0});Hi.isBrowserCryptoAvailable=Hi.getSubtleCrypto=Hi.getBrowerCrypto=void 0;function wA(){return(global===null||global===void 0?void 0:global.crypto)||(global===null||global===void 0?void 0:global.msCrypto)||{}}Hi.getBrowerCrypto=wA;function H3(){let t=wA();return t.subtle||t.webkitSubtle}Hi.getSubtleCrypto=H3;function m$(){return!!wA()&&!!H3()}Hi.isBrowserCryptoAvailable=m$});var Q3=m(ji=>{"use strict";c();Object.defineProperty(ji,"__esModule",{value:!0});ji.isBrowser=ji.isNode=ji.isReactNative=void 0;function G3(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}ji.isReactNative=G3;function k3(){return typeof p.default<"u"&&typeof p.default.versions<"u"&&typeof p.default.versions.node<"u"}ji.isNode=k3;function E$(){return!G3()&&!k3()}ji.isBrowser=E$});var vA=m(Fp=>{"use strict";c();Object.defineProperty(Fp,"__esModule",{value:!0});var W3=(mr(),ut(yr));W3.__exportStar(j3(),Fp);W3.__exportStar(Q3(),Fp)});var Ft={};ft(Ft,{isNodeJs:()=>$3});var z3,$3,K3=ge(()=>{c();z3=Ie(vA());Ht(Ft,Ie(vA()));$3=z3.isNode});function AA(t=3){let e=Date.now()*Math.pow(10,t),r=Math.floor(Math.random()*Math.pow(10,t));return e+r}function bA(t=6){return BigInt(AA(t))}function _A(t,e,r){return{id:r||AA(),jsonrpc:"2.0",method:t,params:e}}function w$(t,e){return{id:t,jsonrpc:"2.0",result:e}}function IA(t,e,r){return{id:t,jsonrpc:"2.0",error:Y3(e,r)}}function Y3(t,e){return typeof t>"u"?Bp(Op):(typeof t=="string"&&(t=Object.assign(Object.assign({},Bp(nl)),{message:t})),typeof e<"u"&&(t.data=e),Rp(t.code)&&(t=Lp(t.code)),t)}var J3=ge(()=>{c();EA();Pp()});function v$(t){return t.includes("*")?Up(t):!/\W/g.test(t)}function Mp(t){return t==="*"}function Up(t){return Mp(t)?!0:!(!t.includes("*")||t.split("*").length!==2||t.split("*").filter(e=>e.trim()==="").length!==1)}function A$(t){return!Mp(t)&&Up(t)&&!t.split("*")[0].trim()}function b$(t){return!Mp(t)&&Up(t)&&!t.split("*")[1].trim()}var X3=ge(()=>{c()});var Z3=ge(()=>{c()});var Ua,SA=ge(()=>{c();Ua=class{}});var CA,qp,sl,eR=ge(()=>{c();SA();CA=class extends Ua{constructor(e){super()}},qp=class extends Ua{constructor(){super()}},sl=class extends qp{constructor(e){super()}}});var tR=ge(()=>{c()});var rR=ge(()=>{c();Z3();SA();eR();tR()});var nR=ge(()=>{c();rR()});function S$(t){let e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function iR(t,e){let r=S$(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function C$(t){return iR(t,_$)}function Vp(t){return iR(t,I$)}function TA(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}var _$,I$,sR=ge(()=>{c();_$="^https?:",I$="^wss?:"});function xA(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function T$(t){return xA(t)&&"method"in t}function NA(t){return xA(t)&&(oR(t)||Hp(t))}function oR(t){return"result"in t}function Hp(t){return"error"in t}function x$(t){return"error"in t&&t.valid===!1}var aR=ge(()=>{c()});var Jt={};ft(Jt,{DEFAULT_ERROR:()=>il,IBaseJsonRpcProvider:()=>qp,IEvents:()=>Ua,IJsonRpcConnection:()=>CA,IJsonRpcProvider:()=>sl,INTERNAL_ERROR:()=>Op,INVALID_PARAMS:()=>q3,INVALID_REQUEST:()=>M3,METHOD_NOT_FOUND:()=>U3,PARSE_ERROR:()=>F3,RESERVED_ERROR_CODES:()=>yA,SERVER_ERROR:()=>nl,SERVER_ERROR_CODE_RANGE:()=>Dp,STANDARD_ERROR_MAP:()=>Vi,formatErrorMessage:()=>Y3,formatJsonRpcError:()=>IA,formatJsonRpcRequest:()=>_A,formatJsonRpcResult:()=>w$,getBigIntRpcId:()=>bA,getError:()=>Bp,getErrorByCode:()=>Lp,isHttpUrl:()=>C$,isJsonRpcError:()=>Hp,isJsonRpcPayload:()=>xA,isJsonRpcRequest:()=>T$,isJsonRpcResponse:()=>NA,isJsonRpcResult:()=>oR,isJsonRpcValidationInvalid:()=>x$,isLocalhostUrl:()=>TA,isNodeJs:()=>$3,isReservedErrorCode:()=>Rp,isServerErrorCode:()=>g$,isValidDefaultRoute:()=>Mp,isValidErrorCode:()=>V3,isValidLeadingWildcardRoute:()=>A$,isValidRoute:()=>v$,isValidTrailingWildcardRoute:()=>b$,isValidWildcardRoute:()=>Up,isWsUrl:()=>Vp,parseConnectionError:()=>mA,payloadId:()=>AA,validateJsonRpcError:()=>y$});var ol=ge(()=>{c();Pp();EA();K3();Ht(Jt,Ft);J3();X3();nR();sR();aR()});var uR,jp,cR,OA=ge(()=>{c();uR=Ie(kn());ol();jp=class extends sl{constructor(e){super(e),this.events=new uR.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(_A(e.method,e.params||[],e.id||bA().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=>{Hp(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),NA(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)}},cR=jp});var lR={};ft(lR,{JsonRpcProvider:()=>jp,default:()=>N$});var N$,fR=ge(()=>{c();OA();OA();N$=cR});var dR=m((Ape,hR)=>{"use strict";c();hR.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}});var pR,gR,DA,yR=ge(()=>{c();pR=()=>typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:dR(),gR=()=>typeof window<"u",DA=t=>t.split("?")[0]});var ER,mR,O$,Gp,wR,PA=ge(()=>{c();ER=Ie(kn());Ld();ol();yR();mR=10,O$=pR(),Gp=class{constructor(e){if(this.url=e,this.events=new ER.EventEmitter,this.registering=!1,!Vp(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,r)=>{if(typeof this.socket>"u"){r(new Error("Connection already closed"));return}this.socket.onclose=n=>{this.onClose(n),e()},this.socket.close()})}async send(e,r){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(Pc(e))}catch(n){this.onError(e.id,n)}}register(e=this.url){if(!Vp(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){let r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return i(new Error("WebSocket connection is missing or invalid"));n(this.socket)})})}return this.url=e,this.registering=!0,new Promise((r,n)=>{let i=(0,Jt.isReactNative)()?void 0:{rejectUnauthorized:!TA(e)},s=new O$(e,[],i);gR()?s.onerror=o=>{let a=o;n(this.emitError(a.error))}:s.on("error",o=>{n(this.emitError(o))}),s.onopen=()=>{this.onOpen(s),r(s)}})}onOpen(e){e.onmessage=r=>this.onPayload(r),e.onclose=r=>this.onClose(r),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;let r=typeof e.data=="string"?Dc(e.data):e.data;this.events.emit("payload",r)}onError(e,r){let n=this.parseError(r),i=n.message||n.toString(),s=IA(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return mA(e,DA(r),"WS")}resetMaxListeners(){this.events.getMaxListeners()>mR&&this.events.setMaxListeners(mR)}emitError(e){let r=this.parseError(new Error(e?.message||`WebSocket connection failed for host: ${DA(this.url)}`));return this.events.emit("register_error",r),r}},wR=Gp});var vR={};ft(vR,{WsConnection:()=>Gp,default:()=>D$});var D$,AR=ge(()=>{c();PA();PA();D$=wR});var r8=m((al,Va)=>{c();var P$=200,GA="__lodash_hash_undefined__",Jp=1,RR=2,BR=9007199254740991,kp="[object Arguments]",FA="[object Array]",R$="[object AsyncFunction]",LR="[object Boolean]",FR="[object Date]",MR="[object Error]",UR="[object Function]",B$="[object GeneratorFunction]",Qp="[object Map]",qR="[object Number]",L$="[object Null]",qa="[object Object]",bR="[object Promise]",F$="[object Proxy]",VR="[object RegExp]",Wp="[object Set]",HR="[object String]",M$="[object Symbol]",U$="[object Undefined]",MA="[object WeakMap]",jR="[object ArrayBuffer]",zp="[object DataView]",q$="[object Float32Array]",V$="[object Float64Array]",H$="[object Int8Array]",j$="[object Int16Array]",G$="[object Int32Array]",k$="[object Uint8Array]",Q$="[object Uint8ClampedArray]",W$="[object Uint16Array]",z$="[object Uint32Array]",$$=/[\\^$.*+?()[\]{}|]/g,K$=/^\[object .+?Constructor\]$/,Y$=/^(?:0|[1-9]\d*)$/,et={};et[q$]=et[V$]=et[H$]=et[j$]=et[G$]=et[k$]=et[Q$]=et[W$]=et[z$]=!0;et[kp]=et[FA]=et[jR]=et[LR]=et[zp]=et[FR]=et[MR]=et[UR]=et[Qp]=et[qR]=et[qa]=et[VR]=et[Wp]=et[HR]=et[MA]=!1;var GR=typeof global=="object"&&global&&global.Object===Object&&global,J$=typeof self=="object"&&self&&self.Object===Object&&self,ti=GR||J$||Function("return this")(),kR=typeof al=="object"&&al&&!al.nodeType&&al,_R=kR&&typeof Va=="object"&&Va&&!Va.nodeType&&Va,QR=_R&&_R.exports===kR,RA=QR&&GR.process,IR=function(){try{return RA&&RA.binding&&RA.binding("util")}catch{}}(),SR=IR&&IR.isTypedArray;function X$(t,e){for(var r=-1,n=t==null?0:t.length,i=0,s=[];++r-1}function xK(t,e){var r=this.__data__,n=Zp(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}ri.prototype.clear=IK;ri.prototype.delete=SK;ri.prototype.get=CK;ri.prototype.has=TK;ri.prototype.set=xK;function Ws(t){var e=-1,r=t==null?0:t.length;for(this.clear();++ea))return!1;var l=s.get(t);if(l&&s.get(e))return l==e;var f=-1,d=!0,g=r&RR?new Kp:void 0;for(s.set(t,e),s.set(e,t);++f-1&&t%1==0&&t-1&&t%1==0&&t<=BR}function e8(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}function ll(t){return t!=null&&typeof t=="object"}var t8=SR?rK(SR):QK;function sY(t){return nY(t)?HK(t):WK(t)}function oY(){return[]}function aY(){return!1}Va.exports=iY});var o6=m(me=>{"use strict";c();Object.defineProperty(me,"__esModule",{value:!0});var $s=kn(),uY=CO(),dl=jO(),We=Sv(),ii=Gv(),n8=(Ld(),ut(r2)),cY=(CD(),ut(SD)),ee=rl(),lY=($1(),ut(z1)),je=Ls(),fY=(fR(),ut(lR)),vr=(ol(),ut(Jt)),hY=(AR(),ut(vR)),dY=r8();function pg(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}function pY(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 gY=pg($s),yY=pg(uY),tg=pY(cY),mY=pg(hY),EY=pg(dY);function wY(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,S=new Uint8Array(I);F!==_;){for(var R=v[F],B=0,b=I-1;(R!==0||B>>0,S[b]=R%a>>>0,R=R/a>>>0;if(R!==0)throw new Error("Non-zero carry");O=B,F++}for(var C=I-O;C!==I&&S[C]===0;)C++;for(var L=u.repeat(N);C>>0,I=new Uint8Array(_);v[N];){var S=r[v.charCodeAt(N)];if(S===255)return;for(var R=0,B=_-1;(S!==0||R>>0,I[B]=S%256>>>0,S=S/256>>>0;if(S!==0)throw new Error("Non-zero carry");F=R,N++}if(v[N]!==" "){for(var b=_-F;b!==_&&I[b]===0;)b++;for(var C=new Uint8Array(O+(_-b)),L=O;b!==_;)C[L++]=I[b++];return C}}}function E(v){var N=g(v);if(N)return N;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:g,decode:E}}var vY=wY,AY=vY,v8=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")},bY=t=>new TextEncoder().encode(t),_Y=t=>new TextDecoder().decode(t),WA=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")}},zA=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 A8(this,e)}},$A=class{constructor(e){this.decoders=e}or(e){return A8(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`)}},A8=(t,e)=>new $A({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),KA=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new WA(e,r,n),this.decoder=new zA(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},gg=({name:t,prefix:e,encode:r,decode:n})=>new KA(t,e,r,n),pl=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=AY(r,e);return gg({prefix:t,name:e,encode:n,decode:s=>v8(i(s))})},IY=(t,e,r,n)=>{let i={};for(let f=0;f=8&&(a-=8,o[l++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},SY=(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<gg({prefix:e,name:t,encode(i){return SY(i,n,r)},decode(i){return IY(i,n,r,t)}}),CY=gg({prefix:"\0",name:"identity",encode:t=>_Y(t),decode:t=>bY(t)}),TY=Object.freeze({__proto__:null,identity:CY}),xY=Gt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),NY=Object.freeze({__proto__:null,base2:xY}),OY=Gt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),DY=Object.freeze({__proto__:null,base8:OY}),PY=pl({prefix:"9",name:"base10",alphabet:"0123456789"}),RY=Object.freeze({__proto__:null,base10:PY}),BY=Gt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),LY=Gt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),FY=Object.freeze({__proto__:null,base16:BY,base16upper:LY}),MY=Gt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),UY=Gt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),qY=Gt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),VY=Gt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),HY=Gt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),jY=Gt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),GY=Gt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),kY=Gt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),QY=Gt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),WY=Object.freeze({__proto__:null,base32:MY,base32upper:UY,base32pad:qY,base32padupper:VY,base32hex:HY,base32hexupper:jY,base32hexpad:GY,base32hexpadupper:kY,base32z:QY}),zY=pl({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),$Y=pl({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),KY=Object.freeze({__proto__:null,base36:zY,base36upper:$Y}),YY=pl({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),JY=pl({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),XY=Object.freeze({__proto__:null,base58btc:YY,base58flickr:JY}),ZY=Gt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),eJ=Gt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),tJ=Gt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),rJ=Gt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),nJ=Object.freeze({__proto__:null,base64:ZY,base64pad:eJ,base64url:tJ,base64urlpad:rJ}),b8=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}"),iJ=b8.reduce((t,e,r)=>(t[r]=e,t),[]),sJ=b8.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function oJ(t){return t.reduce((e,r)=>(e+=iJ[r],e),"")}function aJ(t){let e=[];for(let r of t){let n=sJ[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var uJ=gg({prefix:"\u{1F680}",name:"base256emoji",encode:oJ,decode:aJ}),cJ=Object.freeze({__proto__:null,base256emoji:uJ}),lJ=_8,i8=128,fJ=127,hJ=~fJ,dJ=Math.pow(2,31);function _8(t,e,r){e=e||[],r=r||0;for(var n=r;t>=dJ;)e[r++]=t&255|i8,t/=128;for(;t&hJ;)e[r++]=t&255|i8,t>>>=7;return e[r]=t|0,_8.bytes=r-n+1,e}var pJ=YA,gJ=128,s8=127;function YA(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw YA.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&s8)<=gJ);return YA.bytes=s-n,r}var yJ=Math.pow(2,7),mJ=Math.pow(2,14),EJ=Math.pow(2,21),wJ=Math.pow(2,28),vJ=Math.pow(2,35),AJ=Math.pow(2,42),bJ=Math.pow(2,49),_J=Math.pow(2,56),IJ=Math.pow(2,63),SJ=function(t){return t(I8.encode(t,e,r),e),a8=t=>I8.encodingLength(t),JA=(t,e)=>{let r=e.byteLength,n=a8(t),i=n+a8(r),s=new Uint8Array(i+r);return o8(t,s,0),o8(r,s,n),s.set(e,i),new XA(t,r,e,s)},XA=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}},S8=({name:t,code:e,encode:r})=>new ZA(t,e,r),ZA=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?JA(this.code,r):r.then(n=>JA(this.code,n))}else throw Error("Unknown type, must be binary type")}},C8=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),TJ=S8({name:"sha2-256",code:18,encode:C8("SHA-256")}),xJ=S8({name:"sha2-512",code:19,encode:C8("SHA-512")}),NJ=Object.freeze({__proto__:null,sha256:TJ,sha512:xJ}),T8=0,OJ="identity",x8=v8,DJ=t=>JA(T8,x8(t)),PJ={code:T8,name:OJ,encode:x8,digest:DJ},RJ=Object.freeze({__proto__:null,identity:PJ});new TextEncoder,new TextDecoder;var u8={...TY,...NY,...DY,...RY,...FY,...WY,...KY,...XY,...nJ,...cJ};({...NJ,...RJ});function N8(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function BJ(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?N8(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function O8(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var c8=O8("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),kA=O8("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);let e=BJ(t.length);for(let r=0;r{if(!this.initialized){let n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}},this.has=n=>(this.isInitialized(),this.keychain.has(n)),this.set=async(n,i)=>{this.isInitialized(),this.keychain.set(n,i),await this.persist()},this.get=n=>{this.isInitialized();let i=this.keychain.get(n);if(typeof i>"u"){let{message:s}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(s)}return i},this.del=async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()},this.core=e,this.logger=We.generateChildLogger(r,this.name)}get context(){return We.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,ee.mapToObj(e))}async getKeyChain(){let e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?ee.objToMap(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},ig=class{constructor(e,r,n){this.core=e,this.logger=r,this.name=B8,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=ee.generateKeyPair();return this.setPrivateKey(i.publicKey,i.privateKey)},this.signJWT=async i=>{this.isInitialized();let s=await this.getClientSeed(),o=tg.generateKeyPair(s),a=ee.generateRandomBytes32(),u=L8;return await tg.signJWT(a,i,u,o)},this.generateSharedKey=(i,s,o)=>{this.isInitialized();let a=this.getPrivateKey(i),u=ee.deriveSymKey(a,s);return this.setSymKey(u,o)},this.setSymKey=async(i,s)=>{this.isInitialized();let o=s||ee.hashKey(i);return await this.keychain.set(o,i),o},this.deleteKeyPair=async i=>{this.isInitialized(),await this.keychain.del(i)},this.deleteSymKey=async i=>{this.isInitialized(),await this.keychain.del(i)},this.encode=async(i,s,o)=>{this.isInitialized();let a=ee.validateEncoding(o),u=n8.safeJsonStringify(s);if(ee.isTypeOneEnvelope(a)){let g=a.senderPublicKey,E=a.receiverPublicKey;i=await this.generateSharedKey(g,E)}let l=this.getSymKey(i),{type:f,senderPublicKey:d}=a;return ee.encrypt({type:f,symKey:l,message:u,senderPublicKey:d})},this.decode=async(i,s,o)=>{this.isInitialized();let a=ee.validateDecoding(s,o);if(ee.isTypeOneEnvelope(a)){let f=a.receiverPublicKey,d=a.senderPublicKey;i=await this.generateSharedKey(f,d)}let u=this.getSymKey(i),l=ee.decrypt({symKey:u,encoded:s});return n8.safeJsonParse(l)},this.getPayloadType=i=>{let s=ee.deserialize(i);return ee.decodeTypeByte(s.type)},this.getPayloadSenderPublicKey=i=>{let s=ee.deserialize(i);return s.senderPublicKey?lY.toString(s.senderPublicKey,ee.BASE16):void 0},this.core=e,this.logger=We.generateChildLogger(r,this.name),this.keychain=n||new ng(this.core,this.logger)}get context(){return We.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(eb)}catch{e=ee.generateRandomBytes32(),await this.keychain.set(eb,e)}return FJ(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},sg=class extends ii.IMessageTracker{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=U8,this.version=q8,this.initialized=!1,this.storagePrefix=ni,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{let n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}},this.set=async(n,i)=>{this.isInitialized();let s=ee.hashMessage(i),o=this.messages.get(n);return typeof o>"u"&&(o={}),typeof o[s]<"u"||(o[s]=i,this.messages.set(n,o),await this.persist()),s},this.get=n=>{this.isInitialized();let i=this.messages.get(n);return typeof i>"u"&&(i={}),i},this.has=(n,i)=>{this.isInitialized();let s=this.get(n),o=ee.hashMessage(i);return typeof s[o]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=We.generateChildLogger(e,this.name),this.core=r}get context(){return We.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,ee.mapToObj(e))}async getRelayerMessages(){let e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?ee.objToMap(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},nb=class extends ii.IPublisher{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new $s.EventEmitter,this.name=H8,this.queue=new Map,this.publishTimeout=je.toMiliseconds(je.TEN_SECONDS),this.queueTimeout=je.toMiliseconds(je.FIVE_SECONDS),this.needsTransportRestart=!1,this.publish=async(n,i,s)=>{this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}});try{let o=s?.ttl||V8,a=ee.getRelayProtocolName(s),u=s?.prompt||!1,l=s?.tag||0,f=s?.id||vr.getBigIntRpcId().toString(),d={topic:n,message:i,opts:{ttl:o,relay:a,prompt:u,tag:l,id:f}},g=setTimeout(()=>this.queue.set(f,d),this.queueTimeout);try{await await ee.createExpiringPromise(this.rpcPublish(n,i,o,a,u,l,f),this.publishTimeout),clearTimeout(g),this.relayer.events.emit(Pt.publish,d)}catch{this.logger.debug("Publishing Payload stalled"),this.needsTransportRestart=!0;return}this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}})}catch(o){throw this.logger.debug("Failed to Publish Payload"),this.logger.error(o),o}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.relayer=e,this.logger=We.generateChildLogger(r,this.name),this.registerEventListeners()}get context(){return We.getLoggerContext(this.logger)}rpcPublish(e,r,n,i,s,o,a){var u,l,f,d;let g={method:ee.getRelayProtocolApi(i.protocol).publish,params:{topic:e,message:r,ttl:n,prompt:s,tag:o},id:a};return ee.isUndefined((u=g.params)==null?void 0:u.prompt)&&((l=g.params)==null||delete l.prompt),ee.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)}onPublish(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(dl.HEARTBEAT_EVENTS.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(Pt.connection_stalled);return}this.checkQueue()}),this.relayer.on(Pt.message_ack,e=>{this.onPublish(e.id.toString())})}},ib=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())}},HJ=Object.defineProperty,jJ=Object.defineProperties,GJ=Object.getOwnPropertyDescriptors,l8=Object.getOwnPropertySymbols,kJ=Object.prototype.hasOwnProperty,QJ=Object.prototype.propertyIsEnumerable,f8=(t,e,r)=>e in t?HJ(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hl=(t,e)=>{for(var r in e||(e={}))kJ.call(e,r)&&f8(t,r,e[r]);if(l8)for(var r of l8(e))QJ.call(e,r)&&f8(t,r,e[r]);return t},QA=(t,e)=>jJ(t,GJ(e)),og=class extends ii.ISubscriber{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new ib,this.events=new $s.EventEmitter,this.name=J8,this.version=X8,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=ni,this.subscribeTimeout=1e4,this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restart(),this.registerEventListeners(),this.onEnable(),this.clientId=await this.relayer.core.crypto.getClientId())},this.subscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}});try{let s=ee.getRelayProtocolName(i),o={topic:n,relay:s};this.pending.set(n,o);let a=await this.rpcSubscribe(n,s);return this.onSubscribe(a,o),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}}),a}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}},this.unsubscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),typeof i?.id<"u"?await this.unsubscribeById(n,i.id,i):await this.unsubscribeByTopic(n,i)},this.isSubscribed=async n=>this.topics.includes(n)?!0:await new Promise((i,s)=>{let o=new je.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)>=Z8&&(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=We.generateChildLogger(r,this.name),this.clientId=""}get context(){return We.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,r){let n=!1;try{n=this.getSubscription(e).topic===r}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,r){let n=this.topicMap.get(e);await Promise.all(n.map(async i=>await this.unsubscribeById(e,i,r)))}async unsubscribeById(e,r,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}});try{let i=ee.getRelayProtocolName(n);await this.rpcUnsubscribe(e,r,i);let s=ee.getSdkError("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,r,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}})}catch(i){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(i),i}}async rpcSubscribe(e,r){let n={method:ee.getRelayProtocolApi(r.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{await await ee.createExpiringPromise(this.relayer.request(n),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(Pt.connection_stalled)}return ee.hashMessage(e+this.clientId)}async rpcBatchSubscribe(e){if(!e.length)return;let r=e[0].relay,n={method:ee.getRelayProtocolApi(r.protocol).batchSubscribe,params:{topics:e.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await ee.createExpiringPromise(this.relayer.request(n),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Payload stalled"),this.relayer.events.emit(Pt.connection_stalled)}}rpcUnsubscribe(e,r,n){let i={method:ee.getRelayProtocolApi(n.protocol).unsubscribe,params:{topic:e,id:r}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(e,r){this.setSubscription(e,QA(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($r.created,r)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});let r=this.subscriptions.get(e);if(!r){let{message:n}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}deleteSubscription(e,r){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:r});let n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit($r.deleted,QA(hl({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit($r.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}=ee.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;let r=await this.rpcBatchSubscribe(e);ee.isValidArray(r)&&this.onBatchSubscribe(r.map((n,i)=>QA(hl({},e[i]),{id:n})))}async onConnect(){this.restartInProgress||(await this.restart(),this.onEnable())}onDisconnect(){this.onDisable()}async checkPending(){if(this.relayer.transportExplicitlyClosed)return;let e=[];this.pending.forEach(r=>{e.push(r)}),await this.batchSubscribe(e)}registerEventListeners(){this.relayer.core.heartbeat.on(dl.HEARTBEAT_EVENTS.pulse,async()=>{await this.checkPending()}),this.relayer.on(Pt.connect,async()=>{await this.onConnect()}),this.relayer.on(Pt.disconnect,()=>{this.onDisconnect()}),this.events.on($r.created,async e=>{let r=$r.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()}),this.events.on($r.deleted,async e=>{let r=$r.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){this.restartInProgress&&await new Promise(e=>{let r=setInterval(()=>{this.restartInProgress||(clearInterval(r),e())},this.pollingInterval)})}},WJ=Object.defineProperty,h8=Object.getOwnPropertySymbols,zJ=Object.prototype.hasOwnProperty,$J=Object.prototype.propertyIsEnumerable,d8=(t,e,r)=>e in t?WJ(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,KJ=(t,e)=>{for(var r in e||(e={}))zJ.call(e,r)&&d8(t,r,e[r]);if(h8)for(var r of h8(e))$J.call(e,r)&&d8(t,r,e[r]);return t},ag=class extends ii.IRelayer{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new $s.EventEmitter,this.name=k8,this.transportExplicitlyClosed=!1,this.initialized=!1,this.reconnecting=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","socket stalled"],this.request=async r=>{this.logger.debug("Publishing Request Payload");try{return await this.toEstablishConnection(),await this.provider.request(r)}catch(n){throw this.logger.debug("Failed to Publish Request"),this.logger.error(n),n}},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?We.generateChildLogger(e.logger,this.name):We.pino(We.getDefaultLoggerOptions({level:e.logger||G8})),this.messages=new sg(this.logger,e.core),this.subscriber=new og(this,this.logger),this.publisher=new nb(this,this.logger),this.relayUrl=e?.relayUrl||ob,this.projectId=e.projectId,this.provider={}}async init(){this.logger.trace("Initialized"),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 ${tb}...`),await this.restartTransport(tb)}this.registerEventListeners(),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)},$8)}get context(){return We.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])||"";return i||(await Promise.all([new Promise(s=>{this.subscriber.once($r.created,o=>{o.topic===e&&s()})}),new Promise(async s=>{i=await this.subscriber.subscribe(e,r),s()})]),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.connected&&(await this.provider.disconnect(),this.events.emit(Pt.transport_closed))}async transportOpen(e){if(this.transportExplicitlyClosed=!1,!this.reconnecting){this.relayUrl=e||this.relayUrl,this.reconnecting=!0;try{await Promise.all([new Promise(r=>{this.initialized||r(),this.subscriber.once($r.resubscribed,()=>{r()})}),await Promise.race([new Promise(async(r,n)=>{await ee.createExpiringPromise(this.provider.connect(),5e3,`Socket stalled when trying to connect to ${this.relayUrl}`).catch(i=>n(i)).then(()=>r()).finally(()=>this.removeListener(Pt.transport_closed,this.rejectTransportOpen))}),new Promise(r=>this.once(Pt.transport_closed,this.rejectTransportOpen))])])}catch(r){this.logger.error(r);let n=r;if(!this.isConnectionStalled(n.message))throw r;this.events.emit(Pt.transport_closed)}finally{this.reconnecting=!1}}}async restartTransport(e){this.transportExplicitlyClosed||this.reconnecting||(this.relayUrl=e||this.relayUrl,this.connected&&await Promise.all([new Promise(r=>{this.provider.once(ja.disconnect,()=>{r()})}),this.transportClose()]),await this.createProvider(),await this.transportOpen())}isConnectionStalled(e){return this.staleConnectionErrors.some(r=>e.includes(r))}rejectTransportOpen(){throw new Error("Attempt to connect to relay via `transportOpen` has stalled. Retrying...")}async createProvider(){let e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new fY.JsonRpcProvider(new mY.default(ee.formatRelayRpcUrl({sdkVersion:z8,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0}))),this.registerProviderListeners()}async recordMessageEvent(e){let{topic:r,message:n}=e;await this.messages.set(r,n)}async shouldIgnoreMessageEvent(e){let{topic:r,message:n}=e;return await this.subscriber.isSubscribed(r)?this.messages.has(r,n):!0}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),vr.isJsonRpcRequest(e)){if(!e.method.endsWith(Q8))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(KJ({type:"event",event:r.id},o)),this.events.emit(r.id,o),await this.acknowledgePayload(e),await this.onMessageEvent(o)}else vr.isJsonRpcResponse(e)&&this.events.emit(Pt.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(Pt.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){let r=vr.formatJsonRpcResult(e.id,!0);await this.provider.connection.send(r)}registerProviderListeners(){this.provider.on(ja.payload,e=>this.onProviderPayload(e)),this.provider.on(ja.connect,()=>{this.events.emit(Pt.connect)}),this.provider.on(ja.disconnect,()=>{this.onProviderDisconnect()}),this.provider.on(ja.error,e=>{this.logger.error(e),this.events.emit(Pt.error,e)})}registerEventListeners(){this.events.on(Pt.connection_stalled,async()=>{await this.restartTransport()})}onProviderDisconnect(){this.events.emit(Pt.disconnect),this.attemptToReconnect()}attemptToReconnect(){this.transportExplicitlyClosed||setTimeout(async()=>{await this.restartTransport()},je.toMiliseconds(W8))}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){if(!this.connected){if(this.connecting)return await new Promise(e=>{let r=setInterval(()=>{this.connected&&(clearInterval(r),e())},this.connectionStatusPollingInterval)});await this.restartTransport()}}},YJ=Object.defineProperty,p8=Object.getOwnPropertySymbols,JJ=Object.prototype.hasOwnProperty,XJ=Object.prototype.propertyIsEnumerable,g8=(t,e,r)=>e in t?YJ(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,y8=(t,e)=>{for(var r in e||(e={}))JJ.call(e,r)&&g8(t,r,e[r]);if(p8)for(var r of p8(e))XJ.call(e,r)&&g8(t,r,e[r]);return t},ug=class extends ii.IStore{constructor(e,r,n,i=ni,s=void 0){super(e,r,n,i),this.core=e,this.logger=r,this.name=n,this.map=new Map,this.version=K8,this.cached=[],this.initialized=!1,this.storagePrefix=ni,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!ee.isUndefined(o)?this.map.set(this.getKey(o),o):ee.isProposalStruct(o)?this.map.set(o.id,o):ee.isSessionStruct(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)},this.set=async(o,a)=>{this.isInitialized(),this.map.has(o)?await this.update(o,a):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:a}),this.map.set(o,a),await this.persist())},this.get=o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o)),this.getAll=o=>(this.isInitialized(),o?this.values.filter(a=>Object.keys(o).every(u=>EY.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=y8(y8({},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=We.generateChildLogger(r,this.name),this.storagePrefix=i,this.getKey=s}get context(){return We.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){let r=this.map.get(e);if(!r){let{message:n}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}async persist(){await this.setDataStore(this.values)}async restore(){try{let e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){let{message:r}=ee.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},cg=class{constructor(e,r){this.core=e,this.logger=r,this.name=e6,this.version=t6,this.events=new gY.default,this.initialized=!1,this.storagePrefix=ni,this.ignoredPayloadTypes=[ee.TYPE_1],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]},this.create=async()=>{this.isInitialized();let n=ee.generateRandomBytes32(),i=await this.core.crypto.setSymKey(n),s=ee.calcExpiry(je.FIVE_MINUTES),o={protocol:j8},a={topic:i,expiry:s,relay:o,active:!1},u=ee.formatUri({protocol:this.core.protocol,version:this.core.version,topic:i,symKey:n,relay:o});return await this.pairings.set(i,a),await this.core.relayer.subscribe(i),this.core.expirer.set(i,s),{topic:i,uri:u}},this.pair=async n=>{this.isInitialized(),this.isValidPair(n);let{topic:i,symKey:s,relay:o}=ee.parseUri(n.uri);if(this.pairings.keys.includes(i))throw new Error(`Pairing already exists: ${i}`);if(this.core.crypto.hasKeys(i))throw new Error(`Keychain already exists: ${i}`);let a=ee.calcExpiry(je.FIVE_MINUTES),u={topic:i,relay:o,expiry:a,active:!1};return await this.pairings.set(i,u),await this.core.crypto.setSymKey(s,i),await this.core.relayer.subscribe(i,{relay:o}),this.core.expirer.set(i,a),n.activatePairing&&await this.activate({topic:i}),u},this.activate=async({topic:n})=>{this.isInitialized();let i=ee.calcExpiry(je.THIRTY_DAYS);await this.pairings.update(n,{active:!0,expiry:i}),this.core.expirer.set(n,i)},this.ping=async n=>{this.isInitialized(),await this.isValidPing(n);let{topic:i}=n;if(this.pairings.keys.includes(i)){let s=await this.sendRequest(i,"wc_pairingPing",{}),{done:o,resolve:a,reject:u}=ee.createDelayedPromise();this.events.once(ee.engineEvent("pairing_ping",s),({error:l})=>{l?u(l):a()}),await o()}},this.updateExpiry=async({topic:n,expiry:i})=>{this.isInitialized(),await this.pairings.update(n,{expiry:i})},this.updateMetadata=async({topic:n,metadata:i})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:i})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async n=>{this.isInitialized(),await this.isValidDisconnect(n);let{topic:i}=n;this.pairings.keys.includes(i)&&(await this.sendRequest(i,"wc_pairingDelete",ee.getSdkError("USER_DISCONNECTED")),await this.deletePairing(i))},this.sendRequest=async(n,i,s)=>{let o=vr.formatJsonRpcRequest(i,s),a=await this.core.crypto.encode(n,o),u=Ga[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=vr.formatJsonRpcResult(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=Ga[u.request.method].res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.sendError=async(n,i,s)=>{let o=vr.formatJsonRpcError(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=Ga[u.request.method]?Ga[u.request.method].res:Ga.unregistered_method.res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.deletePairing=async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,ee.getSdkError("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),i?Promise.resolve():this.core.expirer.del(n)])},this.cleanup=async()=>{let n=this.pairings.getAll().filter(i=>ee.isExpired(i.expiry));await Promise.all(n.map(i=>this.deletePairing(i.topic)))},this.onRelayEventRequest=n=>{let{topic:i,payload:s}=n,o=s.method;if(this.pairings.keys.includes(i))switch(o){case"wc_pairingPing":return this.onPairingPingRequest(i,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(i,s);default:return this.onUnknownRpcMethodRequest(i,s)}},this.onRelayEventResponse=async n=>{let{topic:i,payload:s}=n,o=(await this.core.history.get(i,s.id)).request.method;if(this.pairings.keys.includes(i))switch(o){case"wc_pairingPing":return this.onPairingPingResponse(i,s);default:return this.onUnknownRpcMethodResponse(o)}},this.onPairingPingRequest=async(n,i)=>{let{id:s}=i;try{this.isValidPing({topic:n}),await this.sendResult(s,n,!0),this.events.emit("pairing_ping",{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onPairingPingResponse=(n,i)=>{let{id:s}=i;setTimeout(()=>{vr.isJsonRpcResult(i)?this.events.emit(ee.engineEvent("pairing_ping",s),{}):vr.isJsonRpcError(i)&&this.events.emit(ee.engineEvent("pairing_ping",s),{error:i.error})},500)},this.onPairingDeleteRequest=async(n,i)=>{let{id:s}=i;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit("pairing_delete",{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onUnknownRpcMethodRequest=async(n,i)=>{let{id:s,method:o}=i;try{if(this.registeredMethods.includes(o))return;let a=ee.getSdkError("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,n,a),this.logger.error(a)}catch(a){await this.sendError(s,n,a),this.logger.error(a)}},this.onUnknownRpcMethodResponse=n=>{this.registeredMethods.includes(n)||this.logger.error(ee.getSdkError("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=n=>{if(!ee.isValidParams(n)){let{message:i}=ee.getInternalError("MISSING_OR_INVALID",`pair() params: ${n}`);throw new Error(i)}if(!ee.isValidUrl(n.uri)){let{message:i}=ee.getInternalError("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw new Error(i)}},this.isValidPing=async n=>{if(!ee.isValidParams(n)){let{message:s}=ee.getInternalError("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}let{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidDisconnect=async n=>{if(!ee.isValidParams(n)){let{message:s}=ee.getInternalError("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}let{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidPairingTopic=async n=>{if(!ee.isValidString(n,!1)){let{message:i}=ee.getInternalError("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){let{message:i}=ee.getInternalError("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(ee.isExpired(this.pairings.get(n).expiry)){await this.deletePairing(n);let{message:i}=ee.getInternalError("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}},this.core=e,this.logger=We.generateChildLogger(r,this.name),this.pairings=new ug(this.core,this.logger,this.name,this.storagePrefix)}get context(){return We.getLoggerContext(this.logger)}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(Pt.message,async e=>{let{topic:r,message:n}=e;if(this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;let i=await this.core.crypto.decode(r,n);vr.isJsonRpcRequest(i)?(this.core.history.set(r,i),this.onRelayEventRequest({topic:r,payload:i})):vr.isJsonRpcResponse(i)&&(await this.core.history.resolve(i),await this.onRelayEventResponse({topic:r,payload:i}),this.core.history.delete(r,i.id))})}registerExpirerEvents(){this.core.expirer.on(Mr.expired,async e=>{let{topic:r}=ee.parseExpirerTarget(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit("pairing_expire",{topic:r}))})}},lg=class extends ii.IJsonRpcHistory{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new $s.EventEmitter,this.name=r6,this.version=n6,this.cached=[],this.initialized=!1,this.storagePrefix=ni,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:ee.calcExpiry(je.THIRTY_DAYS)};this.records.set(o.id,o),this.events.emit(zr.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=vr.isJsonRpcError(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.events.emit(zr.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(zr.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=We.generateChildLogger(r,this.name)}get context(){return We.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){let e=[];return this.values.forEach(r=>{if(typeof r.response<"u")return;let n={topic:r.topic,request:vr.formatJsonRpcRequest(r.request.method,r.request.params,r.id),chainId:r.chainId};return e.push(n)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();let r=this.records.get(e);if(!r){let{message:n}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(zr.sync)}async restore(){try{let e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){let{message:r}=ee.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(zr.created,e=>{let r=zr.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.events.on(zr.updated,e=>{let r=zr.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.events.on(zr.deleted,e=>{let r=zr.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.core.heartbeat.on(dl.HEARTBEAT_EVENTS.pulse,()=>{this.cleanup()})}cleanup(){try{this.records.forEach(e=>{je.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}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},fg=class extends ii.IExpirer{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new $s.EventEmitter,this.name=i6,this.version=s6,this.cached=[],this.initialized=!1,this.storagePrefix=ni,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(Mr.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(Mr.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=We.generateChildLogger(r,this.name)}get context(){return We.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return ee.formatTopicTarget(e);if(typeof e=="number")return ee.formatIdTarget(e);let{message:r}=ee.getInternalError("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(r)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(Mr.sync)}async restore(){try{let e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){let{message:r}=ee.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){let r=this.expirations.get(e);if(!r){let{message:n}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}checkExpiry(e,r){let{expiry:n}=r;je.toMiliseconds(n)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(Mr.expired,{target:e,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(dl.HEARTBEAT_EVENTS.pulse,()=>this.checkExpirations()),this.events.on(Mr.created,e=>{let r=Mr.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Mr.expired,e=>{let r=Mr.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Mr.deleted,e=>{let r=Mr.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},hg=class extends ii.IVerify{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.name=rg,this.initialized=!1,this.init=async n=>{ee.isReactNative()||!ee.isBrowser()||(this.verifyUrl=n?.verifyUrl||rb,await this.createIframe())},this.register=async n=>{var i;if(this.initialized||await this.init(),!!this.iframe)try{(i=this.iframe.contentWindow)==null||i.postMessage(n.attestationId,this.verifyUrl),this.logger.info(`postMessage sent: ${n.attestationId} ${this.verifyUrl}`)}catch{}},this.resolve=async n=>{var i;if(this.isDevEnv)return"";this.logger.info(`resolving attestation: ${n.attestationId}`);let s=this.startAbortTimer(je.FIVE_SECONDS),o=await fetch(`${this.verifyUrl}/attestation/${n.attestationId}`,{signal:this.abortController.signal});return clearTimeout(s),o.status===200?(i=await o.json())==null?void 0:i.origin:""},this.createIframe=async()=>{try{await Promise.race([new Promise((n,i)=>{if(document.getElementById(rg))return n();let s=document.createElement("iframe");s.setAttribute("id",rg),s.setAttribute("src",`${this.verifyUrl}/${this.projectId}`),s.style.display="none",s.addEventListener("load",()=>{this.initialized=!0,n()}),s.addEventListener("error",o=>{i(o)}),document.body.append(s),this.iframe=s}),new Promise(n=>{setTimeout(()=>n("iframe load timeout"),je.toMiliseconds(je.ONE_SECOND/2))})])}catch(n){this.logger.error(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.error(n)}},this.logger=We.generateChildLogger(r,this.name),this.verifyUrl=rb,this.abortController=new AbortController,this.isDevEnv=ee.isNode()&&p.default.env.IS_VITEST}get context(){return We.getLoggerContext(this.logger)}startAbortTimer(e){return setTimeout(()=>this.abortController.abort(),je.toMiliseconds(e))}},ZJ=Object.defineProperty,m8=Object.getOwnPropertySymbols,eX=Object.prototype.hasOwnProperty,tX=Object.prototype.propertyIsEnumerable,E8=(t,e,r)=>e in t?ZJ(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,w8=(t,e)=>{for(var r in e||(e={}))eX.call(e,r)&&E8(t,r,e[r]);if(m8)for(var r of m8(e))tX.call(e,r)&&E8(t,r,e[r]);return t},dg=class t extends ii.ICore{constructor(e){super(e),this.protocol=sb,this.version=D8,this.name=yg,this.events=new $s.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||ob;let r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:We.pino(We.getDefaultLoggerOptions({level:e?.logger||P8.logger}));this.logger=We.generateChildLogger(r,this.name),this.heartbeat=new dl.HeartBeat,this.crypto=new ig(this,this.logger,e?.keychain),this.history=new lg(this,this.logger),this.expirer=new fg(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new yY.default(w8(w8({},R8),e?.storageOptions)),this.relayer=new ag({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new cg(this,this.logger),this.verify=new hg(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(Y8,n),r}get context(){return We.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}}},rX=dg;me.CORE_CONTEXT=yg,me.CORE_DEFAULT=P8,me.CORE_PROTOCOL=sb,me.CORE_STORAGE_OPTIONS=R8,me.CORE_STORAGE_PREFIX=ni,me.CORE_VERSION=D8,me.CRYPTO_CLIENT_SEED=eb,me.CRYPTO_CONTEXT=B8,me.CRYPTO_JWT_TTL=L8,me.Core=rX,me.Crypto=ig,me.EXPIRER_CONTEXT=i6,me.EXPIRER_DEFAULT_TTL=VJ,me.EXPIRER_EVENTS=Mr,me.EXPIRER_STORAGE_VERSION=s6,me.Expirer=fg,me.HISTORY_CONTEXT=r6,me.HISTORY_EVENTS=zr,me.HISTORY_STORAGE_VERSION=n6,me.JsonRpcHistory=lg,me.KEYCHAIN_CONTEXT=F8,me.KEYCHAIN_STORAGE_VERSION=M8,me.KeyChain=ng,me.MESSAGES_CONTEXT=U8,me.MESSAGES_STORAGE_VERSION=q8,me.MessageTracker=sg,me.PAIRING_CONTEXT=e6,me.PAIRING_DEFAULT_TTL=qJ,me.PAIRING_RPC_OPTS=Ga,me.PAIRING_STORAGE_VERSION=t6,me.PENDING_SUB_RESOLUTION_TIMEOUT=Z8,me.PUBLISHER_CONTEXT=H8,me.PUBLISHER_DEFAULT_TTL=V8,me.Pairing=cg,me.RELAYER_CONTEXT=k8,me.RELAYER_DEFAULT_LOGGER=G8,me.RELAYER_DEFAULT_PROTOCOL=j8,me.RELAYER_DEFAULT_RELAY_URL=ob,me.RELAYER_EVENTS=Pt,me.RELAYER_FAILOVER_RELAY_URL=tb,me.RELAYER_PROVIDER_EVENTS=ja,me.RELAYER_RECONNECT_TIMEOUT=W8,me.RELAYER_SDK_VERSION=z8,me.RELAYER_STORAGE_OPTIONS=MJ,me.RELAYER_SUBSCRIBER_SUFFIX=Q8,me.RELAYER_TRANSPORT_CUTOFF=$8,me.Relayer=ag,me.STORE_STORAGE_VERSION=K8,me.SUBSCRIBER_CONTEXT=J8,me.SUBSCRIBER_DEFAULT_TTL=UJ,me.SUBSCRIBER_EVENTS=$r,me.SUBSCRIBER_STORAGE_VERSION=X8,me.Store=ug,me.Subscriber=og,me.VERIFY_CONTEXT=rg,me.VERIFY_SERVER=rb,me.Verify=hg,me.WALLETCONNECT_CLIENT_ID=Y8,me.default=dg});var E6=m(tt=>{"use strict";c();Object.defineProperty(tt,"__esModule",{value:!0});var xn=o6(),mg=Sv(),c6=Gv(),Q=rl(),l6=kn(),ct=Ls(),St=(ol(),ut(Jt));function nX(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var iX=nX(l6),hb="wc",db=2,pb="client",Ag=`${hb}@${db}:${pb}:`,Eg={name:pb,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},sX={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"},oX={database:":memory:"},f6="WALLETCONNECT_DEEPLINK_CHOICE",aX={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},uX="history",cX="0.3",h6="proposal",lX=ct.THIRTY_DAYS,d6="Proposal expired",p6="session",gl=ct.SEVEN_DAYS,g6="engine",ka={wc_sessionPropose:{req:{ttl:ct.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:ct.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:ct.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:ct.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:ct.ONE_DAY,prompt:!1,tag:1104},res:{ttl:ct.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:ct.ONE_DAY,prompt:!1,tag:1106},res:{ttl:ct.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:ct.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:ct.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:ct.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:ct.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:ct.ONE_DAY,prompt:!1,tag:1112},res:{ttl:ct.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:ct.THIRTY_SECONDS,prompt:!1,tag:1114},res:{ttl:ct.THIRTY_SECONDS,prompt:!1,tag:1115}}},wg={min:ct.FIVE_MINUTES,max:ct.SEVEN_DAYS},y6="request",m6=["wc_sessionPropose","wc_sessionRequest","wc_authRequest"],fX=Object.defineProperty,hX=Object.defineProperties,dX=Object.getOwnPropertyDescriptors,a6=Object.getOwnPropertySymbols,pX=Object.prototype.hasOwnProperty,gX=Object.prototype.propertyIsEnumerable,u6=(t,e,r)=>e in t?fX(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Ur=(t,e)=>{for(var r in e||(e={}))pX.call(e,r)&&u6(t,r,e[r]);if(a6)for(var r of a6(e))gX.call(e,r)&&u6(t,r,e[r]);return t},ab=(t,e)=>hX(t,dX(e)),ub=class extends c6.IEngine{constructor(e){super(e),this.name=g6,this.events=new iX.default,this.initialized=!1,this.ignoredPayloadTypes=[Q.TYPE_1],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.client.core.pairing.register({methods:Object.keys(ka)}),this.initialized=!0)},this.connect=async r=>{this.isInitialized();let n=ab(Ur({},r),{requiredNamespaces:r.requiredNamespaces||{},optionalNamespaces:r.optionalNamespaces||{}});await this.isValidConnect(n);let{pairingTopic:i,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:a,relays:u}=n,l=i,f,d=!1;if(l&&(d=this.client.core.pairing.pairings.get(l).active),!l||!d){let{topic:I,uri:S}=await this.client.core.pairing.create();l=I,f=S}let g=await this.client.core.crypto.generateKeyPair(),E=Ur({requiredNamespaces:s,optionalNamespaces:o,relays:u??[{protocol:xn.RELAYER_DEFAULT_PROTOCOL}],proposer:{publicKey:g,metadata:this.client.metadata}},a&&{sessionProperties:a}),{reject:v,resolve:N,done:O}=Q.createDelayedPromise(ct.FIVE_MINUTES,d6);if(this.events.once(Q.engineEvent("session_connect"),async({error:I,session:S})=>{if(I)v(I);else if(S){S.self.publicKey=g;let R=ab(Ur({},S),{requiredNamespaces:S.requiredNamespaces,optionalNamespaces:S.optionalNamespaces});await this.client.session.set(S.topic,R),await this.setExpiry(S.topic,S.expiry),l&&await this.client.core.pairing.updateMetadata({topic:l,metadata:S.peer.metadata}),N(R)}}),!l){let{message:I}=Q.getInternalError("NO_MATCHING_KEY",`connect() pairing topic: ${l}`);throw new Error(I)}let F=await this.sendRequest(l,"wc_sessionPropose",E),_=Q.calcExpiry(ct.FIVE_MINUTES);return await this.setProposal(F,Ur({id:F,expiry:_},E)),{uri:f,approval:O}},this.pair=async r=>(this.isInitialized(),await this.client.core.pairing.pair(r)),this.approve=async r=>{this.isInitialized(),await this.isValidApprove(r);let{id:n,relayProtocol:i,namespaces:s,sessionProperties:o}=r,a=this.client.proposal.get(n),{pairingTopic:u,proposer:l,requiredNamespaces:f,optionalNamespaces:d}=a;u=u||"",Q.isValidObject(f)||(f=Q.getRequiredNamespacesFromNamespaces(s,"approve()"));let g=await this.client.core.crypto.generateKeyPair(),E=l.publicKey,v=await this.client.core.crypto.generateSharedKey(g,E);u&&n&&(await this.client.core.pairing.updateMetadata({topic:u,metadata:l.metadata}),await this.sendResult(n,u,{relay:{protocol:i??"irn"},responderPublicKey:g}),await this.client.proposal.delete(n,Q.getSdkError("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:u}));let N=Ur({relay:{protocol:i??"irn"},namespaces:s,requiredNamespaces:f,optionalNamespaces:d,pairingTopic:u,controller:{publicKey:g,metadata:this.client.metadata},expiry:Q.calcExpiry(gl)},o&&{sessionProperties:o});await this.client.core.relayer.subscribe(v),await this.sendRequest(v,"wc_sessionSettle",N);let O=ab(Ur({},N),{topic:v,pairingTopic:u,acknowledged:!1,self:N.controller,peer:{publicKey:l.publicKey,metadata:l.metadata},controller:g});return await this.client.session.set(v,O),await this.setExpiry(v,Q.calcExpiry(gl)),{topic:v,acknowledged:()=>new Promise(F=>setTimeout(()=>F(this.client.session.get(v)),500))}},this.reject=async r=>{this.isInitialized(),await this.isValidReject(r);let{id:n,reason:i}=r,{pairingTopic:s}=this.client.proposal.get(n);s&&(await this.sendError(n,s,i),await this.client.proposal.delete(n,Q.getSdkError("USER_DISCONNECTED")))},this.update=async r=>{this.isInitialized(),await this.isValidUpdate(r);let{topic:n,namespaces:i}=r,s=await this.sendRequest(n,"wc_sessionUpdate",{namespaces:i}),{done:o,resolve:a,reject:u}=Q.createDelayedPromise();return this.events.once(Q.engineEvent("session_update",s),({error:l})=>{l?u(l):a()}),await this.client.session.update(n,{namespaces:i}),{acknowledged:o}},this.extend=async r=>{this.isInitialized(),await this.isValidExtend(r);let{topic:n}=r,i=await this.sendRequest(n,"wc_sessionExtend",{}),{done:s,resolve:o,reject:a}=Q.createDelayedPromise();return this.events.once(Q.engineEvent("session_extend",i),({error:u})=>{u?a(u):o()}),await this.setExpiry(n,Q.calcExpiry(gl)),{acknowledged:s}},this.request=async r=>{this.isInitialized(),await this.isValidRequest(r);let{chainId:n,request:i,topic:s,expiry:o}=r,a=await this.sendRequest(s,"wc_sessionRequest",{request:i,chainId:n},o),{done:u,resolve:l,reject:f}=Q.createDelayedPromise(o);this.events.once(Q.engineEvent("session_request",a),({error:g,result:E})=>{g?f(g):l(E)}),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:a});let d=await this.client.core.storage.getItem(f6);return Q.handleDeeplinkRedirect({id:a,topic:s,wcDeepLink:d}),await u()},this.respond=async r=>{this.isInitialized(),await this.isValidRespond(r);let{topic:n,response:i}=r,{id:s}=i;St.isJsonRpcResult(i)?await this.sendResult(s,n,i.result):St.isJsonRpcError(i)&&await this.sendError(s,n,i.error),this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0})},this.ping=async r=>{this.isInitialized(),await this.isValidPing(r);let{topic:n}=r;if(this.client.session.keys.includes(n)){let i=await this.sendRequest(n,"wc_sessionPing",{}),{done:s,resolve:o,reject:a}=Q.createDelayedPromise();this.events.once(Q.engineEvent("session_ping",i),({error:u})=>{u?a(u):o()}),await s()}else this.client.core.pairing.pairings.keys.includes(n)&&await this.client.core.pairing.ping({topic:n})},this.emit=async r=>{this.isInitialized(),await this.isValidEmit(r);let{topic:n,event:i,chainId:s}=r;await this.sendRequest(n,"wc_sessionEvent",{event:i,chainId:s})},this.disconnect=async r=>{this.isInitialized(),await this.isValidDisconnect(r);let{topic:n}=r;if(this.client.session.keys.includes(n)){let i=St.getBigIntRpcId().toString(),s,o=a=>{a?.id.toString()===i&&(this.client.core.relayer.events.removeListener(xn.RELAYER_EVENTS.message_ack,o),s())};await Promise.all([new Promise(a=>{s=a,this.client.core.relayer.on(xn.RELAYER_EVENTS.message_ack,o)}),this.sendRequest(n,"wc_sessionDelete",Q.getSdkError("USER_DISCONNECTED"),void 0,i)]),await this.deleteSession(n)}else await this.client.core.pairing.disconnect({topic:n})},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(n=>Q.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,Q.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.deleteProposal=async(r,n)=>{await Promise.all([this.client.proposal.delete(r,Q.getSdkError("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(r)])},this.deletePendingSessionRequest=async(r,n,i=!1)=>{await Promise.all([this.client.pendingRequest.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)])},this.setExpiry=async(r,n)=>{this.client.session.keys.includes(r)&&await this.client.session.update(r,{expiry:n}),this.client.core.expirer.set(r,n)},this.setProposal=async(r,n)=>{await this.client.proposal.set(r,n),this.client.core.expirer.set(r,n.expiry)},this.setPendingSessionRequest=async r=>{let n=ka.wc_sessionRequest.req.ttl,{id:i,topic:s,params:o}=r;await this.client.pendingRequest.set(i,{id:i,topic:s,params:o}),n&&this.client.core.expirer.set(i,Q.calcExpiry(n))},this.sendRequest=async(r,n,i,s,o)=>{let a=St.formatJsonRpcRequest(n,i);if(Q.isBrowser()&&m6.includes(n)){let f=Q.hashMessage(JSON.stringify(a));await this.client.core.verify.register({attestationId:f})}let u=await this.client.core.crypto.encode(r,a),l=ka[n].req;return s&&(l.ttl=s),o&&(l.id=o),this.client.core.history.set(r,a),this.client.core.relayer.publish(r,u,l),a.id},this.sendResult=async(r,n,i)=>{let s=St.formatJsonRpcResult(r,i),o=await this.client.core.crypto.encode(n,s),a=await this.client.core.history.get(n,r),u=ka[a.request.method].res;this.client.core.relayer.publish(n,o,u),await this.client.core.history.resolve(s)},this.sendError=async(r,n,i)=>{let s=St.formatJsonRpcError(r,i),o=await this.client.core.crypto.encode(n,s),a=await this.client.core.history.get(n,r),u=ka[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=>{Q.isExpired(i.expiry)&&r.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{Q.isExpired(i.expiry)&&n.push(i.id)}),await Promise.all([...r.map(i=>this.deleteSession(i)),...n.map(i=>this.deleteProposal(i))])},this.onRelayEventRequest=r=>{let{topic:n,payload:i}=r,s=i.method;switch(s){case"wc_sessionPropose":return this.onSessionProposeRequest(n,i);case"wc_sessionSettle":return this.onSessionSettleRequest(n,i);case"wc_sessionUpdate":return this.onSessionUpdateRequest(n,i);case"wc_sessionExtend":return this.onSessionExtendRequest(n,i);case"wc_sessionPing":return this.onSessionPingRequest(n,i);case"wc_sessionDelete":return this.onSessionDeleteRequest(n,i);case"wc_sessionRequest":return this.onSessionRequest(n,i);case"wc_sessionEvent":return this.onSessionEventRequest(n,i);default:return this.client.logger.info(`Unsupported request method ${s}`)}},this.onRelayEventResponse=async r=>{let{topic:n,payload:i}=r,s=(await this.client.core.history.get(n,i.id)).request.method;switch(s){case"wc_sessionPropose":return this.onSessionProposeResponse(n,i);case"wc_sessionSettle":return this.onSessionSettleResponse(n,i);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,i);case"wc_sessionExtend":return this.onSessionExtendResponse(n,i);case"wc_sessionPing":return this.onSessionPingResponse(n,i);case"wc_sessionRequest":return this.onSessionRequestResponse(n,i);default:return this.client.logger.info(`Unsupported response method ${s}`)}},this.onRelayEventUnknownPayload=r=>{let{topic:n}=r,{message:i}=Q.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(Ur({},n.params));let o=Q.calcExpiry(ct.FIVE_MINUTES),a=Ur({id:s,pairingTopic:r,expiry:o},i);await this.setProposal(s,a);let u=Q.hashMessage(JSON.stringify(n)),l=await this.getVerifyContext(u,a.proposer.metadata);this.client.events.emit("session_proposal",{id:s,params:a,verifyContext:l})}catch(o){await this.sendError(s,r,o),this.client.logger.error(o)}},this.onSessionProposeResponse=async(r,n)=>{let{id:i}=n;if(St.isJsonRpcResult(n)){let{result:s}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:s});let o=this.client.proposal.get(i);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:o});let a=o.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:a});let u=s.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:u});let l=await this.client.core.crypto.generateSharedKey(a,u);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:l});let f=await this.client.core.relayer.subscribe(l);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:f}),await this.client.core.pairing.activate({topic:r})}else St.isJsonRpcError(n)&&(await this.client.proposal.delete(i,Q.getSdkError("USER_DISCONNECTED")),this.events.emit(Q.engineEvent("session_connect"),{error:n.error}))},this.onSessionSettleRequest=async(r,n)=>{let{id:i,params:s}=n;try{this.isValidSessionSettleRequest(s);let{relay:o,controller:a,expiry:u,namespaces:l,requiredNamespaces:f,optionalNamespaces:d,sessionProperties:g,pairingTopic:E}=n.params,v=Ur({topic:r,relay:o,expiry:u,namespaces:l,acknowledged:!0,pairingTopic:E,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(n.id,r,!0),this.events.emit(Q.engineEvent("session_connect"),{session:v}),this.cleanupDuplicatePairings(v)}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.onSessionSettleResponse=async(r,n)=>{let{id:i}=n;St.isJsonRpcResult(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(Q.engineEvent("session_approve",i),{})):St.isJsonRpcError(n)&&(await this.client.session.delete(r,Q.getSdkError("USER_DISCONNECTED")),this.events.emit(Q.engineEvent("session_approve",i),{error:n.error}))},this.onSessionUpdateRequest=async(r,n)=>{let{params:i,id:s}=n;try{this.isValidUpdate(Ur({topic:r},i)),await this.client.session.update(r,{namespaces:i.namespaces}),await this.sendResult(s,r,!0),this.client.events.emit("session_update",{id:s,topic:r,params:i})}catch(o){await this.sendError(s,r,o),this.client.logger.error(o)}},this.onSessionUpdateResponse=(r,n)=>{let{id:i}=n;St.isJsonRpcResult(n)?this.events.emit(Q.engineEvent("session_update",i),{}):St.isJsonRpcError(n)&&this.events.emit(Q.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,Q.calcExpiry(gl)),await this.sendResult(i,r,!0),this.client.events.emit("session_extend",{id:i,topic:r})}catch(s){await this.sendError(i,r,s),this.client.logger.error(s)}},this.onSessionExtendResponse=(r,n)=>{let{id:i}=n;St.isJsonRpcResult(n)?this.events.emit(Q.engineEvent("session_extend",i),{}):St.isJsonRpcError(n)&&this.events.emit(Q.engineEvent("session_extend",i),{error:n.error})},this.onSessionPingRequest=async(r,n)=>{let{id:i}=n;try{this.isValidPing({topic:r}),await this.sendResult(i,r,!0),this.client.events.emit("session_ping",{id:i,topic:r})}catch(s){await this.sendError(i,r,s),this.client.logger.error(s)}},this.onSessionPingResponse=(r,n)=>{let{id:i}=n;setTimeout(()=>{St.isJsonRpcResult(n)?this.events.emit(Q.engineEvent("session_ping",i),{}):St.isJsonRpcError(n)&&this.events.emit(Q.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(xn.RELAYER_EVENTS.publish,async()=>{s(await this.deleteSession(r))})}),this.sendResult(i,r,!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(Ur({topic:r},s)),await this.setPendingSessionRequest({id:i,topic:r,params:s});let o=Q.hashMessage(JSON.stringify(n)),a=this.client.session.get(r),u=await this.getVerifyContext(o,a.peer.metadata);this.client.events.emit("session_request",{id:i,topic:r,params:s,verifyContext:u})}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.onSessionRequestResponse=(r,n)=>{let{id:i}=n;St.isJsonRpcResult(n)?this.events.emit(Q.engineEvent("session_request",i),{result:n.result}):St.isJsonRpcError(n)&&this.events.emit(Q.engineEvent("session_request",i),{error:n.error})},this.onSessionEventRequest=async(r,n)=>{let{id:i,params:s}=n;try{this.isValidEmit(Ur({topic:r},s)),this.client.events.emit("session_event",{id:i,topic:r,params:s})}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.isValidConnect=async r=>{if(!Q.isValidParams(r)){let{message:u}=Q.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(Q.isUndefined(n)||await this.isValidPairingTopic(n),!Q.isValidRelays(a,!0)){let{message:u}=Q.getInternalError("MISSING_OR_INVALID",`connect() relays: ${a}`);throw new Error(u)}!Q.isUndefined(i)&&Q.isValidObject(i)!==0&&this.validateNamespaces(i,"requiredNamespaces"),!Q.isUndefined(s)&&Q.isValidObject(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),Q.isUndefined(o)||this.validateSessionProps(o,"sessionProperties")},this.validateNamespaces=(r,n)=>{let i=Q.isValidRequiredNamespaces(r,"connect()",n);if(i)throw new Error(i.message)},this.isValidApprove=async r=>{if(!Q.isValidParams(r))throw new Error(Q.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=Q.isValidNamespaces(i,"approve()");if(u)throw new Error(u.message);let l=Q.isConformingNamespaces(a.requiredNamespaces,i,"approve()");if(l)throw new Error(l.message);if(!Q.isValidString(s,!0)){let{message:f}=Q.getInternalError("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(f)}Q.isUndefined(o)||this.validateSessionProps(o,"sessionProperties")},this.isValidReject=async r=>{if(!Q.isValidParams(r)){let{message:s}=Q.getInternalError("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(s)}let{id:n,reason:i}=r;if(await this.isValidProposalId(n),!Q.isValidErrorReason(i)){let{message:s}=Q.getInternalError("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidSessionSettleRequest=r=>{if(!Q.isValidParams(r)){let{message:l}=Q.getInternalError("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(l)}let{relay:n,controller:i,namespaces:s,expiry:o}=r;if(!Q.isValidRelay(n)){let{message:l}=Q.getInternalError("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(l)}let a=Q.isValidController(i,"onSessionSettleRequest()");if(a)throw new Error(a.message);let u=Q.isValidNamespaces(s,"onSessionSettleRequest()");if(u)throw new Error(u.message);if(Q.isExpired(o)){let{message:l}=Q.getInternalError("EXPIRED","onSessionSettleRequest()");throw new Error(l)}},this.isValidUpdate=async r=>{if(!Q.isValidParams(r)){let{message:u}=Q.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=Q.isValidNamespaces(i,"update()");if(o)throw new Error(o.message);let a=Q.isConformingNamespaces(s.requiredNamespaces,i,"update()");if(a)throw new Error(a.message)},this.isValidExtend=async r=>{if(!Q.isValidParams(r)){let{message:i}=Q.getInternalError("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionTopic(n)},this.isValidRequest=async r=>{if(!Q.isValidParams(r)){let{message:u}=Q.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(!Q.isValidNamespacesChainId(a,s)){let{message:u}=Q.getInternalError("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(u)}if(!Q.isValidRequest(i)){let{message:u}=Q.getInternalError("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(u)}if(!Q.isValidNamespacesRequest(a,s,i.method)){let{message:u}=Q.getInternalError("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(u)}if(o&&!Q.isValidRequestExpiry(o,wg)){let{message:u}=Q.getInternalError("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${wg.min} and ${wg.max}`);throw new Error(u)}},this.isValidRespond=async r=>{if(!Q.isValidParams(r)){let{message:s}=Q.getInternalError("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(s)}let{topic:n,response:i}=r;if(await this.isValidSessionTopic(n),!Q.isValidResponse(i)){let{message:s}=Q.getInternalError("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidPing=async r=>{if(!Q.isValidParams(r)){let{message:i}=Q.getInternalError("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async r=>{if(!Q.isValidParams(r)){let{message:a}=Q.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(!Q.isValidNamespacesChainId(o,s)){let{message:a}=Q.getInternalError("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(a)}if(!Q.isValidEvent(i)){let{message:a}=Q.getInternalError("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}if(!Q.isValidNamespacesEvent(o,s,i.name)){let{message:a}=Q.getInternalError("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}},this.isValidDisconnect=async r=>{if(!Q.isValidParams(r)){let{message:i}=Q.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||"",validation:"UNKNOWN",origin:n.url||""}};try{let s=await this.client.core.verify.resolve({attestationId:r,verifyUrl:n.verifyUrl});s&&(i.verified.origin=s,i.verified.validation=s===n.url?"VALID":"INVALID")}catch(s){this.client.logger.error(s)}return this.client.logger.info(`Verify context: ${JSON.stringify(i)}`),i},this.validateSessionProps=(r,n)=>{Object.values(r).forEach(i=>{if(!Q.isValidString(i,!1)){let{message:s}=Q.getInternalError("MISSING_OR_INVALID",`${n} must be in Record format. Received: ${JSON.stringify(i)}`);throw new Error(s)}})}}isInitialized(){if(!this.initialized){let{message:e}=Q.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.client.core.relayer.on(xn.RELAYER_EVENTS.message,async e=>{let{topic:r,message:n}=e;if(this.ignoredPayloadTypes.includes(this.client.core.crypto.getPayloadType(n)))return;let i=await this.client.core.crypto.decode(r,n);St.isJsonRpcRequest(i)?(this.client.core.history.set(r,i),this.onRelayEventRequest({topic:r,payload:i})):St.isJsonRpcResponse(i)?(await this.client.core.history.resolve(i),await this.onRelayEventResponse({topic:r,payload:i}),this.client.core.history.delete(r,i.id)):this.onRelayEventUnknownPayload({topic:r,payload:i})})}registerExpirerEvents(){this.client.core.expirer.on(xn.EXPIRER_EVENTS.expired,async e=>{let{topic:r,id:n}=Q.parseExpirerTarget(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,Q.getInternalError("EXPIRED"),!0);r?this.client.session.keys.includes(r)&&(await this.deleteSession(r,!0),this.client.events.emit("session_expire",{topic:r})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}isValidPairingTopic(e){if(!Q.isValidString(e,!1)){let{message:r}=Q.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}=Q.getInternalError("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(Q.isExpired(this.client.core.pairing.pairings.get(e).expiry)){let{message:r}=Q.getInternalError("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!Q.isValidString(e,!1)){let{message:r}=Q.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}=Q.getInternalError("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(Q.isExpired(this.client.session.get(e).expiry)){await this.deleteSession(e);let{message:r}=Q.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(Q.isValidString(e,!1)){let{message:r}=Q.getInternalError("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{let{message:r}=Q.getInternalError("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!Q.isValidId(e)){let{message:r}=Q.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}=Q.getInternalError("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(Q.isExpired(this.client.proposal.get(e).expiry)){await this.deleteProposal(e);let{message:r}=Q.getInternalError("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}},cb=class extends xn.Store{constructor(e,r){super(e,r,h6,Ag),this.core=e,this.logger=r}},lb=class extends xn.Store{constructor(e,r){super(e,r,p6,Ag),this.core=e,this.logger=r}},fb=class extends xn.Store{constructor(e,r){super(e,r,y6,Ag,n=>n.id),this.core=e,this.logger=r}},vg=class t extends c6.ISignClient{constructor(e){super(e),this.protocol=hb,this.version=db,this.name=Eg.name,this.events=new l6.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||Eg.name,this.metadata=e?.metadata||Q.getAppMetadata();let r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:mg.pino(mg.getDefaultLoggerOptions({level:e?.logger||Eg.logger}));this.core=e?.core||new xn.Core(e),this.logger=mg.generateChildLogger(r,this.name),this.session=new lb(this.core,this.logger),this.proposal=new cb(this.core,this.logger),this.pendingRequest=new fb(this.core,this.logger),this.engine=new ub(this)}static async init(e){let r=new t(e);return await r.initialize(),r}get context(){return mg.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}}},yX=vg;tt.ENGINE_CONTEXT=g6,tt.ENGINE_RPC_OPTS=ka,tt.HISTORY_CONTEXT=uX,tt.HISTORY_EVENTS=aX,tt.HISTORY_STORAGE_VERSION=cX,tt.METHODS_TO_VERIFY=m6,tt.PROPOSAL_CONTEXT=h6,tt.PROPOSAL_EXPIRY=lX,tt.PROPOSAL_EXPIRY_MESSAGE=d6,tt.REQUEST_CONTEXT=y6,tt.SESSION_CONTEXT=p6,tt.SESSION_EXPIRY=gl,tt.SESSION_REQUEST_EXPIRY_BOUNDARIES=wg,tt.SIGN_CLIENT_CONTEXT=pb,tt.SIGN_CLIENT_DEFAULT=Eg,tt.SIGN_CLIENT_EVENTS=sX,tt.SIGN_CLIENT_PROTOCOL=hb,tt.SIGN_CLIENT_STORAGE_OPTIONS=oX,tt.SIGN_CLIENT_STORAGE_PREFIX=Ag,tt.SIGN_CLIENT_VERSION=db,tt.SignClient=yX,tt.WALLETCONNECT_DEEPLINK_CHOICE=f6,tt.default=vg});var bg=m(Qi=>{"use strict";c();Object.defineProperty(Qi,"__esModule",{value:!0});Qi.OptionalOperation=Qi.Operation=void 0;var mX;(function(t){t.SIGN_TRANSACTION="mvx_signTransaction",t.SIGN_TRANSACTIONS="mvx_signTransactions",t.SIGN_MESSAGE="mvx_signMessage"})(mX=Qi.Operation||(Qi.Operation={}));var EX;(function(t){t.SIGN_LOGIN_TOKEN="mvx_signLoginToken",t.SIGN_NATIVE_AUTH_TOKEN="mvx_signNativeAuthToken",t.CANCEL_ACTION="mvx_cancelAction"})(EX=Qi.OptionalOperation||(Qi.OptionalOperation={}))});var gb=m(Wi=>{"use strict";c();Object.defineProperty(Wi,"__esModule",{value:!0});Wi.WALLETCONNECT_MULTIVERSX_OPTIONAL_METHODS=Wi.WALLETCONNECT_MULTIVERSX_METHODS=Wi.WALLETCONNECT_MULTIVERSX_NAMESPACE=void 0;var w6=bg();Wi.WALLETCONNECT_MULTIVERSX_NAMESPACE="mvx";Wi.WALLETCONNECT_MULTIVERSX_METHODS=Object.values(w6.Operation);Wi.WALLETCONNECT_MULTIVERSX_OPTIONAL_METHODS=Object.values(w6.OptionalOperation)});var Eb=m(Kr=>{"use strict";c();Object.defineProperty(Kr,"__esModule",{value:!0});Kr.WalletConnectV2ProviderErrorMessagesEnum=Kr.ErrBadAddress=Kr.ErrNotImplemented=Kr.Err=void 0;var yl=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};Kr.Err=yl;var yb=class extends yl{constructor(){super("Method not yet implemented")}};Kr.ErrNotImplemented=yb;var mb=class extends yl{constructor(e,r){super(`Bad address: ${e}`,r)}};Kr.ErrBadAddress=mb;var wX;(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"})(wX=Kr.WalletConnectV2ProviderErrorMessagesEnum||(Kr.WalletConnectV2ProviderErrorMessagesEnum={}))});var vb=m(_g=>{"use strict";c();Object.defineProperty(_g,"__esModule",{value:!0});_g.Logger=void 0;var wb=class{static error(e){console.error(e)}static trace(e){console.trace(e)}};_g.Logger=wb});var v6=m(()=>{"use strict";c();global.Buffer||(global.Buffer=_s().Buffer)});var b6=m(A6=>{"use strict";c();Object.defineProperty(A6,"__esModule",{value:!0})});var I6=m(_6=>{"use strict";c();Object.defineProperty(_6,"__esModule",{value:!0})});var S6=m(Qa=>{"use strict";c();var vX=Qa&&Qa.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Qa,"__esModule",{value:!0});Qa.RelayedTransactionV1Builder=void 0;var AX=vX(jt()),Ab=yt(),bX=Be(),_X=yn(),IX=qn(),bb=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 bX.ErrInvalidRelayedV1BuilderArguments;let e=this.prepareInnerTransaction(),r=`relayedTx@${h.Buffer.from(e).toString("hex")}`,n=new IX.TransactionPayload(r),i=this.netConfig.MinGasLimit+this.netConfig.GasPerDataByte*n.length()+this.innerTransaction.getGasLimit().valueOf(),s=new _X.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 Ab.Address(this.innerTransaction.getSender().bech32()).pubkey().toString("base64"),receiver:new Ab.Address(this.innerTransaction.getReceiver().bech32()).pubkey().toString("base64"),value:new AX.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 Ab.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)}};Qa.RelayedTransactionV1Builder=bb});var C6=m(Ig=>{"use strict";c();Object.defineProperty(Ig,"__esModule",{value:!0});Ig.Code=void 0;var _b=class t{constructor(e){this.hex=e}static fromBuffer(e){return new t(e.toString("hex"))}toString(){return this.hex}valueOf(){return h.Buffer.from(this.hex,"hex")}};Ig.Code=_b});var x6=m(T6=>{"use strict";c();Object.defineProperty(T6,"__esModule",{value:!0})});var P6=m(za=>{"use strict";c();Object.defineProperty(za,"__esModule",{value:!0});za.bech32m=za.bech32=void 0;var Sg="qpzry9x8gf2tvdw0s3jn54khce6mua7l",O6={};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 N6(t){let e=1;for(let r=0;r126)return"Invalid prefix ("+t+")";e=Wa(e)^n>>5}e=Wa(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 l=N6(o);if(typeof l=="string")throw new Error(l);let f=o+"1";for(let d=0;d>5)throw new Error("Non 5-bit word");l=Wa(l)^g,f+=Sg.charAt(g)}for(let d=0;d<6;++d)l=Wa(l);l^=e;for(let d=0;d<6;++d){let g=l>>(5-d)*5&31;f+=Sg.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(),l=o.toUpperCase();if(o!==u&&o!==l)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 E=N6(d);if(typeof E=="string")return E;let v=[];for(let N=0;N=g.length)&&v.push(F)}return E!==e?"Invalid checksum for "+o:{prefix:d,words:v}}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:SX,fromWordsUnsafe:CX,fromWords:TX}}za.bech32=D6("bech32");za.bech32m=D6("bech32m")});var B6=m(qr=>{"use strict";c();Object.defineProperty(qr,"__esModule",{value:!0});qr.TokenTransferProperties=qr.TransactionMetadataTransfer=qr.TransactionMetadata=qr.TransactionToDecode=qr.TransactionDecoder=void 0;var R6=P6(),Sb=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 Ks;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 Cg;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 Ks;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 Ks;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 Ks;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=R6.bech32.toWords(r);return R6.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)}};qr.TransactionDecoder=Sb;var Cg=class{constructor(){this.sender="",this.receiver="",this.data="",this.value="0"}};qr.TransactionToDecode=Cg;var Ks=class{constructor(){this.sender="",this.receiver="",this.value=BigInt(0)}};qr.TransactionMetadata=Ks;var Cb=class{constructor(){this.value=BigInt(0)}};qr.TransactionMetadataTransfer=Cb;var Tb=class{};qr.TokenTransferProperties=Tb});var xb=m(Tg=>{"use strict";c();Object.defineProperty(Tg,"__esModule",{value:!0});Tg.ReturnCode=void 0;var Ge=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)}};Tg.ReturnCode=Ge;Ge.None=new Ge("");Ge.Ok=new Ge("ok");Ge.FunctionNotFound=new Ge("function not found");Ge.FunctionWrongSignature=new Ge("wrong signature for function");Ge.ContractNotFound=new Ge("contract not found");Ge.UserError=new Ge("user error");Ge.OutOfGas=new Ge("out of gas");Ge.AccountCollision=new Ge("account collision");Ge.OutOfFunds=new Ge("out of funds");Ge.CallStackOverFlow=new Ge("call stack overflow");Ge.ContractInvalid=new Ge("contract invalid");Ge.ExecutionFailed=new Ge("execution failed");Ge.Unknown=new Ge("unknown")});var M6=m(xg=>{"use strict";c();Object.defineProperty(xg,"__esModule",{value:!0});xg.ResultsParser=void 0;var xX=B6(),L6=yt(),F6=Be(),zi=Yo(),NX=Vo(),$a=xb(),Ka;(function(t){t.OnTransactionCompleted="completedTxEvent",t.OnSignalError="signalError",t.OnWriteLog="writeLog"})(Ka||(Ka={}));var Nb;(function(t){t.TooMuchGas="@too much gas provided for processing"})(Nb||(Nb={}));var OX={argsSerializer:new NX.ArgSerializer},Ob=class{constructor(e){e=Object.assign(Object.assign({},OX),e),this.argsSerializer=e.argsSerializer}parseQueryResponse(e,r){let n=e.getReturnDataParts(),i=this.argsSerializer.buffersToValues(n,r.output);return{returnCode:new $a.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 $a.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 zi.Logger.trace("parseUntypedOutcome(): on simple move balance"),r;if(r=this.createBundleOnInvalidTransaction(e),r)return zi.Logger.trace("parseUntypedOutcome(): on invalid transaction"),r;if(r=this.createBundleOnEasilyFoundResultWithReturnData(e.contractResults),r)return zi.Logger.trace("parseUntypedOutcome(): on easily found result with return data"),r;if(r=this.createBundleOnSignalError(e.logs),r)return zi.Logger.trace("parseUntypedOutcome(): on signal error"),r;if(r=this.createBundleOnTooMuchGasWarning(e.logs),r)return zi.Logger.trace("parseUntypedOutcome(): on 'too much gas' warning"),r;if(r=this.createBundleOnWriteLogWhereFirstTopicEqualsAddress(e.logs,e.sender),r)return zi.Logger.trace("parseUntypedOutcome(): on writelog with topics[0] == tx.sender"),r;if(r=this.createBundleWithCustomHeuristics(e,n),r)return zi.Logger.trace("parseUntypedOutcome(): with custom heuristics"),r;if(r=this.createBundleWithFallbackHeuristics(e,n),r)return zi.Logger.trace("parseUntypedOutcome(): with fallback heuristics"),r;throw new F6.ErrCannotParseContractResults(`transaction ${e.hash.toString()}`)}parseTransactionMetadata(e){return new xX.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:$a.ReturnCode.None,returnMessage:$a.ReturnCode.None.toString(),values:[]}:null}createBundleOnInvalidTransaction(e){return e.status.isInvalid()&&e.receipt.data?{returnCode:$a.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(Ka.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(Ka.OnWriteLog,a=>a.findFirstOrNoneTopic(u=>u.toString().startsWith(Nb.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 L6.Address(r.bech32()).hex(),i=e.findSingleOrNoneEvent(Ka.OnWriteLog,u=>u.findFirstOrNoneTopic(l=>l.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 L6.Address(r.receiver);for(let i of e.contractResults.items){let s=i.logs.findSingleOrNoneEvent(Ka.OnWriteLog,o=>{var a;let u=o.address.bech32()==e.sender.bech32(),l=((a=o.topics[0])===null||a===void 0?void 0:a.hex())==n.hex();return u&&l});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 F6.ErrCannotParseContractResults("no return code");return{returnCode:$a.ReturnCode.fromBuffer(i),returnDataParts:s}}};xg.ResultsParser=Ob});var Db=m(vt=>{"use strict";c();var DX=vt&&vt.__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]}),rr=vt&&vt.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&DX(e,t,r)};Object.defineProperty(vt,"__esModule",{value:!0});rr(Vo(),vt);rr(C6(),vt);rr(tE(),vt);rr(YE(),vt);rr(fc(),vt);rr(sw(),vt);rr(ew(),vt);rr(x6(),vt);rr(aw(),vt);rr(hc(),vt);rr(M6(),vt);rr(xb(),vt);rr(Jw(),vt);rr(pw(),vt);rr(Ot(),vt)});var q6=m(Ng=>{"use strict";c();Object.defineProperty(Ng,"__esModule",{value:!0});Ng.RelayedTransactionV2Builder=void 0;var U6=Be(),ml=Db(),PX=yn(),RX=qn(),Pb=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 U6.ErrInvalidRelayedV2BuilderArguments;if(this.innerTransaction.getGasLimit()!=0)throw new U6.ErrGasLimitShouldBe0ForInnerTransaction;let{argumentsString:e}=new ml.ArgSerializer().valuesToString([new ml.AddressValue(this.innerTransaction.getReceiver()),new ml.U64Value(this.innerTransaction.getNonce().valueOf()),new ml.BytesValue(this.innerTransaction.getData().valueOf()),new ml.BytesValue(this.innerTransaction.getSignature())]),r=`relayedTxV2@${e}`,n=new RX.TransactionPayload(r),i=new PX.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}};Ng.RelayedTransactionV2Builder=Pb});var V6=m(Ys=>{"use strict";c();Object.defineProperty(Ys,"__esModule",{value:!0});Ys.SignableMessage=Ys.MESSAGE_PREFIX=void 0;var BX=yt(),LX=zw();Ys.MESSAGE_PREFIX=`Elrond Signed Message: +`;var Rb=class{constructor(e){this.message=h.Buffer.from([]),this.signature=h.Buffer.from([]),this.version=1,this.signer="ErdJS",this.address=new BX.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(Ys.MESSAGE_PREFIX),r]);return LX("keccak256").update(n).digest()}serializeForSigningRaw(){return h.Buffer.concat([this.getMessageSize(),this.message])}getSignature(){return this.signature}applySignature(e){e instanceof h.Buffer?this.signature=e:this.signature=h.Buffer.from(e.hex(),"hex")}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}}};Ys.SignableMessage=Rb});var Lb=m(ot=>{"use strict";c();var FX=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]}),MX=ot&&ot.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),H6=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)&&FX(e,t,r);return MX(e,t),e},UX=ot&&ot.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ot,"__esModule",{value:!0});ot.addressToHex=ot.bufferToHex=ot.utf8ToHex=ot.bigIntToHex=ot.bigIntToBuffer=ot.bufferToBigInt=ot.stringToBuffer=void 0;var qX=UX(jt()),VX=yt(),Bb=H6(tc()),j6=H6(rh());function HX(t){return h.Buffer.from(t)}ot.stringToBuffer=HX;function jX(t){return t.length==0?new qX.default(0):Bb.bufferToBigInt(t)}ot.bufferToBigInt=jX;function GX(t){return t==0?h.Buffer.from([]):Bb.bigIntToBuffer(t)}ot.bigIntToBuffer=GX;function kX(t){return t==0?"":Bb.getHexMagnitudeOfBigInt(t)}ot.bigIntToHex=kX;function QX(t){let e=h.Buffer.from(t).toString("hex");return j6.zeroPadStringIfOddLength(e)}ot.utf8ToHex=QX;function WX(t){let e=t.toString("hex");return j6.zeroPadStringIfOddLength(e)}ot.bufferToHex=WX;function zX(t){return VX.Address.fromBech32(t.toString()).pubkey().toString("hex")}ot.addressToHex=zX});var k6=m(Og=>{"use strict";c();Object.defineProperty(Og,"__esModule",{value:!0});Og.TokenOperationsFactory=void 0;var Fb=ps(),$X=Yo(),G6=Th(),KX=yn(),YX=qn(),ne=Lb(),Mb=class{constructor(e){this.config=e,this.trueAsHex=ne.utf8ToHex("true")}issueFungible(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["issue",ne.utf8ToHex(e.tokenName),ne.utf8ToHex(e.tokenTicker),ne.bigIntToHex(e.initialSupply),ne.bigIntToHex(e.numDecimals),...e.canFreeze?[ne.utf8ToHex("canFreeze"),this.trueAsHex]:[],...e.canWipe?[ne.utf8ToHex("canWipe"),this.trueAsHex]:[],...e.canPause?[ne.utf8ToHex("canPause"),this.trueAsHex]:[],...e.canChangeOwner?[ne.utf8ToHex("canChangeOwner"),this.trueAsHex]:[],...e.canUpgrade?[ne.utf8ToHex("canUpgrade"),this.trueAsHex]:[],...e.canAddSpecialRoles?[ne.utf8ToHex("canAddSpecialRoles"),this.trueAsHex]:[]];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(){$X.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),...e.canFreeze?[ne.utf8ToHex("canFreeze"),this.trueAsHex]:[],...e.canWipe?[ne.utf8ToHex("canWipe"),this.trueAsHex]:[],...e.canPause?[ne.utf8ToHex("canPause"),this.trueAsHex]:[],...e.canTransferNFTCreateRole?[ne.utf8ToHex("canTransferNFTCreateRole"),this.trueAsHex]:[],...e.canChangeOwner?[ne.utf8ToHex("canChangeOwner"),this.trueAsHex]:[],...e.canUpgrade?[ne.utf8ToHex("canUpgrade"),this.trueAsHex]:[],...e.canAddSpecialRoles?[ne.utf8ToHex("canAddSpecialRoles"),this.trueAsHex]:[]];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),...e.canFreeze?[ne.utf8ToHex("canFreeze"),this.trueAsHex]:[],...e.canWipe?[ne.utf8ToHex("canWipe"),this.trueAsHex]:[],...e.canPause?[ne.utf8ToHex("canPause"),this.trueAsHex]:[],...e.canTransferNFTCreateRole?[ne.utf8ToHex("canTransferNFTCreateRole"),this.trueAsHex]:[],...e.canChangeOwner?[ne.utf8ToHex("canChangeOwner"),this.trueAsHex]:[],...e.canUpgrade?[ne.utf8ToHex("canUpgrade"),this.trueAsHex]:[],...e.canAddSpecialRoles?[ne.utf8ToHex("canAddSpecialRoles"),this.trueAsHex]:[]];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),...e.canFreeze?[ne.utf8ToHex("canFreeze"),this.trueAsHex]:[],...e.canWipe?[ne.utf8ToHex("canWipe"),this.trueAsHex]:[],...e.canPause?[ne.utf8ToHex("canPause"),this.trueAsHex]:[],...e.canTransferNFTCreateRole?[ne.utf8ToHex("canTransferNFTCreateRole"),this.trueAsHex]:[],...e.canChangeOwner?[ne.utf8ToHex("canChangeOwner"),this.trueAsHex]:[],...e.canUpgrade?[ne.utf8ToHex("canUpgrade"),this.trueAsHex]:[],...e.canAddSpecialRoles?[ne.utf8ToHex("canAddSpecialRoles"),this.trueAsHex]:[]];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 l=this.buildTransactionPayload(u),f=o||this.computeGasLimit(l,a),d=new G6.TransactionVersion(Fb.TRANSACTION_VERSION_DEFAULT),g=new G6.TransactionOptions(Fb.TRANSACTION_OPTIONS_DEFAULT);return new KX.Transaction({chainID:this.config.chainID,sender:e,receiver:r,gasLimit:f,gasPrice:s,nonce:n||0,value:i||0,data:l,version:d,options:g})}buildTransactionPayload(e){let r=e.join(Fb.ARGUMENTS_SEPARATOR);return new YX.TransactionPayload(r)}computeGasLimit(e,r){return this.config.minGasLimit.valueOf()+this.config.gasLimitPerByte.valueOf()*e.length()+r.valueOf()}};Og.TokenOperationsFactory=Mb});var Q6=m(Dg=>{"use strict";c();Object.defineProperty(Dg,"__esModule",{value:!0});Dg.TokenOperationsFactoryConfig=void 0;var JX=yt(),Ub=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=JX.Address.fromBech32("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u"),this.chainID=e}};Dg.TokenOperationsFactoryConfig=Ub});var z6=m(Pg=>{"use strict";c();Object.defineProperty(Pg,"__esModule",{value:!0});Pg.TokenOperationsOutcomeParser=void 0;var XX=yt(),qb=Be(),W6=Lb(),Vb=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 qb.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 qb.ErrCannotParseTransactionOutcome(e.hash,`cannot find event of type ${r}`);if(n.length>1)throw new qb.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 W6.bufferToBigInt((r=e.topics[1])===null||r===void 0?void 0:r.valueOf()).toFixed(0)}extractAmount(e){var r;return W6.bufferToBigInt((r=e.topics[2])===null||r===void 0?void 0:r.valueOf()).toFixed(0)}extractAddress(e){var r;return XX.Address.fromBuffer((r=e.topics[3])===null||r===void 0?void 0:r.valueOf()).toString()}};Pg.TokenOperationsOutcomeParser=Vb});var $6=m(si=>{"use strict";c();var ZX=si&&si.__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]}),Hb=si&&si.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&ZX(e,t,r)};Object.defineProperty(si,"__esModule",{value:!0});Hb(k6(),si);Hb(Q6(),si);Hb(z6(),si)});var K6=m(Je=>{"use strict";c();var eZ=Je&&Je.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ct=Je&&Je.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&eZ(e,t,r)};Object.defineProperty(Je,"__esModule",{value:!0});v6();Ct(Ss(),Je);Ct(yt(),Je);Ct(WE(),Je);Ct(Be(),Je);Ct(jE(),Je);Ct(b6(),Je);Ct(I6(),Je);Ct(Yo(),Je);Ct(Th(),Je);Ct(S6(),Je);Ct(q6(),Je);Ct(V6(),Je);Ct(Db(),Je);Ct($6(),Je);Ct(sm(),Je);Ct(yn(),Je);Ct(qn(),Je);Ct(Gh(),Je);Ct(VE(),Je);Ct(gr(),Je)});var tB=m(Xt=>{"use strict";c();Object.defineProperty(Xt,"__esModule",{value:!0});Xt.getMetadata=Xt.applyTransactionSignature=Xt.getAddressFromSession=Xt.addressIsValid=Xt.getConnectionParams=Xt.getCurrentTopic=Xt.getCurrentSession=void 0;var X6=K6(),Y6=Rh(),tZ=rl(),Rg=gb(),oi=Eb(),jb=vb(),J6=bg();function Z6(t,e){if(!e)throw new Error(oi.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=e.find(eB(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 jb.Logger.error(oi.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),new Error(oi.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected)}Xt.getCurrentSession=Z6;function rZ(t,e){if(!e)throw new Error(oi.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=Z6(t,e);if(!r?.topic)throw new Error(oi.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);return r.topic}Xt.getCurrentTopic=rZ;function eB(t,e){var r,n,i;let s=[...Rg.WALLETCONNECT_MULTIVERSX_METHODS,...(r=e?.methods)!==null&&r!==void 0?r:[]];!((n=e?.methods)===null||n===void 0)&&n.includes(J6.OptionalOperation.SIGN_LOGIN_TOKEN)||s.push(J6.OptionalOperation.SIGN_LOGIN_TOKEN);let o=[`${Rg.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${t}`],a=(i=e?.events)!==null&&i!==void 0?i:[];return{requiredNamespaces:{[Rg.WALLETCONNECT_MULTIVERSX_NAMESPACE]:{methods:s,chains:o,events:a}}}}Xt.getConnectionParams=eB;function nZ(t){try{return!X6.Address.fromBech32(t).isEmpty()}catch{return!1}}Xt.addressIsValid=nZ;function iZ(t){let e=t.namespaces[Rg.WALLETCONNECT_MULTIVERSX_NAMESPACE];if(e&&e.accounts){let r=e.accounts[0],[n,i,s]=r.split(":");return s}return""}Xt.getAddressFromSession=iZ;function sZ({transaction:t,response:e}){if(!e)throw jb.Logger.error(oi.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse),new Error(oi.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse);let{signature:r,guardianSignature:n,version:i,options:s,guardian:o}=e,a=t.getGuardian().bech32();if(a&&a!==o)throw jb.Logger.error(oi.WalletConnectV2ProviderErrorMessagesEnum.invalidGuardian),new Error(oi.WalletConnectV2ProviderErrorMessagesEnum.invalidGuardian);return o&&t.setGuardian(X6.Address.fromBech32(o)),i&&t.setVersion(i),s!=null&&t.setOptions(s),t.applySignature(new Y6.Signature(r)),n&&t.applyGuardianSignature(new Y6.Signature(n)),t}Xt.applyTransactionSignature=sZ;function oZ(t){if(t)return Object.assign(Object.assign({},t),{url:tZ.getAppMetadata().url})}Xt.getMetadata=oZ});var El=m(dr=>{"use strict";c();var At=dr&&dr.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})},aZ=dr&&dr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(dr,"__esModule",{value:!0});dr.WalletConnectV2Provider=dr.OptionalOperation=dr.Operation=dr.WalletConnectV2ProviderErrorMessagesEnum=void 0;var uZ=Rh(),cZ=aZ(E6()),Gb=rl(),Ya=gb(),ye=Eb();Object.defineProperty(dr,"WalletConnectV2ProviderErrorMessagesEnum",{enumerable:!0,get:function(){return ye.WalletConnectV2ProviderErrorMessagesEnum}});var Le=vb(),$i=bg();Object.defineProperty(dr,"Operation",{enumerable:!0,get:function(){return $i.Operation}});Object.defineProperty(dr,"OptionalOperation",{enumerable:!0,get:function(){return $i.OptionalOperation}});var Zt=tB(),kb=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 At(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:Zt.getMetadata((r=this.options)===null||r===void 0?void 0:r.metadata)}:{},i=yield cZ.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(ye.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 At(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=Zt.getConnectionParams(this.chainId,e);try{return yield this.walletConnector.connect(Object.assign({pairingTopic:e?.topic},r))}catch{throw this.reset(),Le.Logger.error(e?.topic?ye.WalletConnectV2ProviderErrorMessagesEnum.unableToConnectExisting:ye.WalletConnectV2ProviderErrorMessagesEnum.unableToConnect),new Error(e?.topic?ye.WalletConnectV2ProviderErrorMessagesEnum.unableToConnectExisting:ye.WalletConnectV2ProviderErrorMessagesEnum.unableToConnect)}})}login(e){var r;return At(this,void 0,void 0,function*(){if(this.isInitializing=!0,typeof this.walletConnector>"u"&&(yield this.connect()),typeof this.walletConnector>"u")throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);typeof this.session<"u"&&(yield this.logout({topic:(r=this.session)===null||r===void 0?void 0:r.topic}));try{if(e&&e.approval){let n=yield e.approval();if(e.token){let i=Zt.getAddressFromSession(n),o=n.namespaces[Ya.WALLETCONNECT_MULTIVERSX_NAMESPACE].methods.includes($i.OptionalOperation.SIGN_NATIVE_AUTH_TOKEN)?$i.OptionalOperation.SIGN_NATIVE_AUTH_TOKEN:$i.OptionalOperation.SIGN_LOGIN_TOKEN,{signature:a}=yield this.walletConnector.request({chainId:`${Ya.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:n.topic,request:{method:o,params:{token:e.token,address:i}}});if(!a)throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToSignLoginToken),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToSignLoginToken);return yield this.onSessionConnected({session:n,signature:a})}return yield this.onSessionConnected({session:n,signature:""})}}catch{throw this.reset(),Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToLogin),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToLogin)}finally{this.isInitializing=!1}return""})}logout(e){return At(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);try{if(this.processingTopic===(e?.topic||Zt.getCurrentTopic(this.chainId,this.walletConnector)))return!0;if(e?.topic)this.processingTopic=e.topic,yield this.walletConnector.disconnect({topic:e.topic,reason:Gb.getSdkError("USER_DISCONNECTED")});else{let r=Zt.getCurrentTopic(this.chainId,this.walletConnector);this.processingTopic=r,yield this.walletConnector.disconnect({topic:r,reason:Gb.getSdkError("USER_DISCONNECTED")}),this.reset(),yield this.cleanupPendingPairings({deletePairings:!0})}}catch{Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.alreadyLoggedOut)}finally{this.processingTopic=""}return!0})}getAddress(){return At(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return this.address})}getSignature(){return At(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return this.signature})}getPairings(){var e,r,n,i,s;return At(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(ye.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 At(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);try{let r=yield this.getAddress(),{signature:n}=yield this.walletConnector.request({chainId:`${Ya.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:Zt.getCurrentTopic(this.chainId,this.walletConnector),request:{method:$i.Operation.SIGN_MESSAGE,params:{address:r,message:e.message.toString()}}});if(!n)throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageResponse),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageResponse);try{e.applySignature(new uZ.Signature(n))}catch{throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageSignature),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageSignature)}}catch{throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToSign)}return e})}signTransaction(e){return At(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let r=e.toPlainObject();if(this.chainId!==e.getChainID().valueOf())throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);try{let n=yield this.walletConnector.request({chainId:`${Ya.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:Zt.getCurrentTopic(this.chainId,this.walletConnector),request:{method:$i.Operation.SIGN_TRANSACTION,params:{transaction:r}}});return Zt.applyTransactionSignature({transaction:e,response:n})}catch{throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.transactionError)}})}signTransactions(e){return At(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let r=e.map(n=>{if(this.chainId!==n.getChainID().valueOf())throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);return n.toPlainObject()});try{let{signatures:n}=yield this.walletConnector.request({chainId:`${Ya.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:Zt.getCurrentTopic(this.chainId,this.walletConnector),request:{method:$i.Operation.SIGN_TRANSACTIONS,params:{transactions:r}}});if(!n)throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse);if(!Array.isArray(n)||e.length!==n.length)throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse);for(let[i,s]of e.entries()){let o=n[i];Zt.applyTransactionSignature({transaction:s,response:o})}return e}catch{throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.transactionError)}})}sendCustomRequest(e){var r;return At(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(ye.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:`${Ya.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:Zt.getCurrentTopic(this.chainId,this.walletConnector),request:Object.assign(Object.assign({},n),{method:i})});s||Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.invalidCustomRequestResponse)}catch{Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.invalidCustomRequestResponse)}return}})}ping(){return At(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);typeof this.session>"u"&&Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);try{let e=Zt.getCurrentTopic(this.chainId,this.walletConnector);return yield this.walletConnector.ping({topic:e}),!0}catch{return Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.pingFailed),!1}})}loginAccount(e){return At(this,void 0,void 0,function*(){return e?Zt.addressIsValid(e.address)?(this.address=e.address,e.signature&&(this.signature=e.signature),this.onClientConnect.onClientLogin(),this.address):(Le.Logger.error(`${ye.WalletConnectV2ProviderErrorMessagesEnum.invalidAddress} ${e.address}`),this.walletConnector&&(yield this.logout()),""):""})}onSessionConnected(e){return At(this,void 0,void 0,function*(){if(!e)return"";this.session=e.session;let r=Zt.getAddressFromSession(e.session);return r?(yield this.loginAccount({address:r,signature:e.signature}),r):""})}handleTopicUpdateEvent({topic:e}){return At(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u"){Le.Logger.error(ye.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{Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleTopic)}finally{this.pairings=yield this.getPairings()}})}handleSessionEvents({topic:e,params:r}){var n;return At(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw new Error(ye.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&&Zt.getCurrentTopic(this.chainId,this.walletConnector)===e){let s=i.data;this.onClientConnect.onClientEvent(s)}})}subscribeToEvents(e){var r,n,i,s;return At(this,void 0,void 0,function*(){if(typeof e>"u")throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);try{e.on("session_update",({topic:o,params:a})=>{var u;if(!this.session||((u=this.session)===null||u===void 0?void 0:u.topic)!==o)return;let{namespaces:l}=a,f=e.session.get(o),d=Object.assign(Object.assign({},f),{namespaces:l});this.onSessionConnected({session:d})}),e.on("session_event",this.handleSessionEvents.bind(this)),e.on("session_delete",({topic:o})=>At(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)&&(Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionDeleted),this.onClientConnect.onClientLogout(),this.reset(),yield this.cleanupPendingPairings({deletePairings:!0}))})),e.on("session_expire",({topic:o})=>At(this,void 0,void 0,function*(){var a;!this.session||((a=this.session)===null||a===void 0?void 0:a.topic)!==o||(Le.Logger.error(ye.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{Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleEvent)}})}checkPersistedState(e){return At(this,void 0,void 0,function*(){if(typeof e>"u")throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(this.pairings=yield this.getPairings(),!(typeof this.session<"u")&&e.session.length&&!this.address&&!this.isInitializing){let r=Zt.getCurrentSession(this.chainId,e);if(r)return yield this.onSessionConnected({session:r}),r}})}cleanupPendingPairings(e={}){var r,n,i,s,o,a,u,l;return At(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(!Gb.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(l=(u=(a=this.walletConnector.core)===null||a===void 0?void 0:a.relayer)===null||u===void 0?void 0:u.subscriber)===null||l===void 0?void 0:l.unsubscribe(d.topic)}catch{Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleCleanup)}}catch{Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleCleanup)}})}};dr.WalletConnectV2Provider=kb});var nB=m((Lge,rB)=>{"use strict";c();rB.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 oB=m((Mge,sB)=>{"use strict";c();var iB=typeof Symbol<"u"&&Symbol,lZ=nB();sB.exports=function(){return typeof iB!="function"||typeof Symbol!="function"||typeof iB("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:lZ()}});var cB=m((qge,uB)=>{"use strict";c();var aB={foo:{}},fZ=Object;uB.exports=function(){return{__proto__:aB}.foo===aB.foo&&!({__proto__:null}instanceof fZ)}});var fB=m((Hge,lB)=>{"use strict";c();var hZ="Function.prototype.bind called on incompatible ",Qb=Array.prototype.slice,dZ=Object.prototype.toString,pZ="[object Function]";lB.exports=function(e){var r=this;if(typeof r!="function"||dZ.call(r)!==pZ)throw new TypeError(hZ+r);for(var n=Qb.call(arguments,1),i,s=function(){if(this instanceof i){var f=r.apply(this,n.concat(Qb.call(arguments)));return Object(f)===f?f:this}else return r.apply(e,n.concat(Qb.call(arguments)))},o=Math.max(0,r.length-n.length),a=[],u=0;u{"use strict";c();var gZ=fB();hB.exports=Function.prototype.bind||gZ});var pB=m((Qge,dB)=>{"use strict";c();var yZ=Bg();dB.exports=yZ.call(Function.call,Object.prototype.hasOwnProperty)});var Mg=m((zge,wB)=>{"use strict";c();var De,eu=SyntaxError,EB=Function,Za=TypeError,Wb=function(t){try{return EB('"use strict"; return ('+t+").constructor;")()}catch{}},Js=Object.getOwnPropertyDescriptor;if(Js)try{Js({},"")}catch{Js=null}var zb=function(){throw new Za},mZ=Js?function(){try{return arguments.callee,zb}catch{try{return Js(arguments,"callee").get}catch{return zb}}}():zb,Ja=oB()(),EZ=cB()(),Mt=Object.getPrototypeOf||(EZ?function(t){return t.__proto__}:null),Xa={},wZ=typeof Uint8Array>"u"||!Mt?De:Mt(Uint8Array),Xs={"%AggregateError%":typeof AggregateError>"u"?De:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?De:ArrayBuffer,"%ArrayIteratorPrototype%":Ja&&Mt?Mt([][Symbol.iterator]()):De,"%AsyncFromSyncIteratorPrototype%":De,"%AsyncFunction%":Xa,"%AsyncGenerator%":Xa,"%AsyncGeneratorFunction%":Xa,"%AsyncIteratorPrototype%":Xa,"%Atomics%":typeof Atomics>"u"?De:Atomics,"%BigInt%":typeof BigInt>"u"?De:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?De:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?De:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?De:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?De:Float32Array,"%Float64Array%":typeof Float64Array>"u"?De:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?De:FinalizationRegistry,"%Function%":EB,"%GeneratorFunction%":Xa,"%Int8Array%":typeof Int8Array>"u"?De:Int8Array,"%Int16Array%":typeof Int16Array>"u"?De:Int16Array,"%Int32Array%":typeof Int32Array>"u"?De:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Ja&&Mt?Mt(Mt([][Symbol.iterator]())):De,"%JSON%":typeof JSON=="object"?JSON:De,"%Map%":typeof Map>"u"?De:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Ja||!Mt?De:Mt(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?De:Promise,"%Proxy%":typeof Proxy>"u"?De:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?De:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?De:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Ja||!Mt?De:Mt(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?De:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Ja&&Mt?Mt(""[Symbol.iterator]()):De,"%Symbol%":Ja?Symbol:De,"%SyntaxError%":eu,"%ThrowTypeError%":mZ,"%TypedArray%":wZ,"%TypeError%":Za,"%Uint8Array%":typeof Uint8Array>"u"?De:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?De:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?De:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?De:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?De:WeakMap,"%WeakRef%":typeof WeakRef>"u"?De:WeakRef,"%WeakSet%":typeof WeakSet>"u"?De:WeakSet};if(Mt)try{null.error}catch(t){gB=Mt(Mt(t)),Xs["%Error.prototype%"]=gB}var gB,vZ=function t(e){var r;if(e==="%AsyncFunction%")r=Wb("async function () {}");else if(e==="%GeneratorFunction%")r=Wb("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=Wb("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=t("%AsyncGenerator%");i&&Mt&&(r=Mt(i.prototype))}return Xs[e]=r,r},yB={"%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"]},wl=Bg(),Lg=pB(),AZ=wl.call(Function.call,Array.prototype.concat),bZ=wl.call(Function.apply,Array.prototype.splice),mB=wl.call(Function.call,String.prototype.replace),Fg=wl.call(Function.call,String.prototype.slice),_Z=wl.call(Function.call,RegExp.prototype.exec),IZ=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,SZ=/\\(\\)?/g,CZ=function(e){var r=Fg(e,0,1),n=Fg(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 mB(e,IZ,function(s,o,a,u){i[i.length]=a?mB(u,SZ,"$1"):o||s}),i},TZ=function(e,r){var n=e,i;if(Lg(yB,n)&&(i=yB[n],n="%"+i[0]+"%"),Lg(Xs,n)){var s=Xs[n];if(s===Xa&&(s=vZ(n)),typeof s>"u"&&!r)throw new Za("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!")};wB.exports=function(e,r){if(typeof e!="string"||e.length===0)throw new Za("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new Za('"allowMissing" argument must be a boolean');if(_Z(/^%?[^%]*%?$/,e)===null)throw new eu("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=CZ(e),i=n.length>0?n[0]:"",s=TZ("%"+i+"%",r),o=s.name,a=s.value,u=!1,l=s.alias;l&&(i=l[0],bZ(n,AZ([0,1],l)));for(var f=1,d=!0;f=n.length){var N=Js(a,g);d=!!N,d&&"get"in N&&!("originalValue"in N.get)?a=N.get:a=a[g]}else d=Lg(a,g),a=a[g];d&&!u&&(Xs[o]=a)}}return a}});var SB=m((Kge,Ug)=>{"use strict";c();var $b=Bg(),tu=Mg(),bB=tu("%Function.prototype.apply%"),_B=tu("%Function.prototype.call%"),IB=tu("%Reflect.apply%",!0)||$b.call(_B,bB),vB=tu("%Object.getOwnPropertyDescriptor%",!0),Zs=tu("%Object.defineProperty%",!0),xZ=tu("%Math.max%");if(Zs)try{Zs({},"a",{value:1})}catch{Zs=null}Ug.exports=function(e){var r=IB($b,_B,arguments);if(vB&&Zs){var n=vB(r,"length");n.configurable&&Zs(r,"length",{value:1+xZ(0,e.length-(arguments.length-1))})}return r};var AB=function(){return IB($b,bB,arguments)};Zs?Zs(Ug.exports,"apply",{value:AB}):Ug.exports.apply=AB});var NB=m((Jge,xB)=>{"use strict";c();var CB=Mg(),TB=SB(),NZ=TB(CB("String.prototype.indexOf"));xB.exports=function(e,r){var n=CB(e,!!r);return typeof n=="function"&&NZ(e,".prototype.")>-1?TB(n):n}});var OB=m(()=>{c()});var YB=m((rye,KB)=>{c();var i_=typeof Map=="function"&&Map.prototype,Kb=Object.getOwnPropertyDescriptor&&i_?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Vg=i_&&Kb&&typeof Kb.get=="function"?Kb.get:null,DB=i_&&Map.prototype.forEach,s_=typeof Set=="function"&&Set.prototype,Yb=Object.getOwnPropertyDescriptor&&s_?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Hg=s_&&Yb&&typeof Yb.get=="function"?Yb.get:null,PB=s_&&Set.prototype.forEach,OZ=typeof WeakMap=="function"&&WeakMap.prototype,Al=OZ?WeakMap.prototype.has:null,DZ=typeof WeakSet=="function"&&WeakSet.prototype,bl=DZ?WeakSet.prototype.has:null,PZ=typeof WeakRef=="function"&&WeakRef.prototype,RB=PZ?WeakRef.prototype.deref:null,RZ=Boolean.prototype.valueOf,BZ=Object.prototype.toString,LZ=Function.prototype.toString,FZ=String.prototype.match,o_=String.prototype.slice,Yi=String.prototype.replace,MZ=String.prototype.toUpperCase,BB=String.prototype.toLowerCase,GB=RegExp.prototype.test,LB=Array.prototype.concat,Nn=Array.prototype.join,UZ=Array.prototype.slice,FB=Math.floor,Zb=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Jb=Object.getOwnPropertySymbols,e_=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,ru=typeof Symbol=="function"&&typeof Symbol.iterator=="object",er=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===ru||"symbol")?Symbol.toStringTag:null,kB=Object.prototype.propertyIsEnumerable,MB=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function UB(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||GB.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var n=t<0?-FB(-t):FB(t);if(n!==t){var i=String(n),s=o_.call(e,i.length+1);return Yi.call(i,r,"$&_")+"."+Yi.call(Yi.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Yi.call(e,r,"$&_")}var t_=OB(),qB=t_.custom,VB=WB(qB)?qB:null;KB.exports=function t(e,r,n,i){var s=r||{};if(Ki(s,"quoteStyle")&&s.quoteStyle!=="single"&&s.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Ki(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=Ki(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(Ki(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(Ki(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 $B(e,s);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var u=String(e);return a?UB(e,u):u}if(typeof e=="bigint"){var l=String(e)+"n";return a?UB(e,l):l}var f=typeof s.depth>"u"?5:s.depth;if(typeof n>"u"&&(n=0),n>=f&&f>0&&typeof e=="object")return r_(e)?"[Array]":"[Object]";var d=ree(s,n);if(typeof i>"u")i=[];else if(zB(i,e)>=0)return"[Circular]";function g(G,K,de){if(K&&(i=UZ.call(i),i.push(K)),de){var ue={depth:s.depth};return Ki(s,"quoteStyle")&&(ue.quoteStyle=s.quoteStyle),t(G,ue,n+1,i)}return t(G,s,n+1,i)}if(typeof e=="function"&&!HB(e)){var E=zZ(e),v=qg(e,g);return"[Function"+(E?": "+E:" (anonymous)")+"]"+(v.length>0?" { "+Nn.call(v,", ")+" }":"")}if(WB(e)){var N=ru?Yi.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):e_.call(e);return typeof e=="object"&&!ru?vl(N):N}if(ZZ(e)){for(var O="<"+BB.call(String(e.nodeName)),F=e.attributes||[],_=0;_",O}if(r_(e)){if(e.length===0)return"[]";var I=qg(e,g);return d&&!tee(I)?"["+n_(I,d)+"]":"[ "+Nn.call(I,", ")+" ]"}if(HZ(e)){var S=qg(e,g);return!("cause"in Error.prototype)&&"cause"in e&&!kB.call(e,"cause")?"{ ["+String(e)+"] "+Nn.call(LB.call("[cause]: "+g(e.cause),S),", ")+" }":S.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+Nn.call(S,", ")+" }"}if(typeof e=="object"&&o){if(VB&&typeof e[VB]=="function"&&t_)return t_(e,{depth:f-n});if(o!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if($Z(e)){var R=[];return DB&&DB.call(e,function(G,K){R.push(g(K,e,!0)+" => "+g(G,e))}),jB("Map",Vg.call(e),R,d)}if(JZ(e)){var B=[];return PB&&PB.call(e,function(G){B.push(g(G,e))}),jB("Set",Hg.call(e),B,d)}if(KZ(e))return Xb("WeakMap");if(XZ(e))return Xb("WeakSet");if(YZ(e))return Xb("WeakRef");if(GZ(e))return vl(g(Number(e)));if(QZ(e))return vl(g(Zb.call(e)));if(kZ(e))return vl(RZ.call(e));if(jZ(e))return vl(g(String(e)));if(!VZ(e)&&!HB(e)){var b=qg(e,g),C=MB?MB(e)===Object.prototype:e instanceof Object||e.constructor===Object,L=e instanceof Object?"":"null prototype",X=!C&&er&&Object(e)===e&&er in e?o_.call(Ji(e),8,-1):L?"Object":"",W=C||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",j=W+(X||L?"["+Nn.call(LB.call([],X||[],L||[]),": ")+"] ":"");return b.length===0?j+"{}":d?j+"{"+n_(b,d)+"}":j+"{ "+Nn.call(b,", ")+" }"}return String(e)};function QB(t,e,r){var n=(r.quoteStyle||e)==="double"?'"':"'";return n+t+n}function qZ(t){return Yi.call(String(t),/"/g,""")}function r_(t){return Ji(t)==="[object Array]"&&(!er||!(typeof t=="object"&&er in t))}function VZ(t){return Ji(t)==="[object Date]"&&(!er||!(typeof t=="object"&&er in t))}function HB(t){return Ji(t)==="[object RegExp]"&&(!er||!(typeof t=="object"&&er in t))}function HZ(t){return Ji(t)==="[object Error]"&&(!er||!(typeof t=="object"&&er in t))}function jZ(t){return Ji(t)==="[object String]"&&(!er||!(typeof t=="object"&&er in t))}function GZ(t){return Ji(t)==="[object Number]"&&(!er||!(typeof t=="object"&&er in t))}function kZ(t){return Ji(t)==="[object Boolean]"&&(!er||!(typeof t=="object"&&er in t))}function WB(t){if(ru)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!e_)return!1;try{return e_.call(t),!0}catch{}return!1}function QZ(t){if(!t||typeof t!="object"||!Zb)return!1;try{return Zb.call(t),!0}catch{}return!1}var WZ=Object.prototype.hasOwnProperty||function(t){return t in this};function Ki(t,e){return WZ.call(t,e)}function Ji(t){return BZ.call(t)}function zZ(t){if(t.name)return t.name;var e=FZ.call(LZ.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function zB(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 $B(o_.call(t,0,e.maxStringLength),e)+n}var i=Yi.call(Yi.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,eee);return QB(i,"single",e)}function eee(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":"")+MZ.call(e.toString(16))}function vl(t){return"Object("+t+")"}function Xb(t){return t+" { ? }"}function jB(t,e,r,n){var i=n?n_(r,n):Nn.call(r,", ");return t+" ("+e+") {"+i+"}"}function tee(t){for(var e=0;e=0)return!1;return!0}function ree(t,e){var r;if(t.indent===" ")r=" ";else if(typeof t.indent=="number"&&t.indent>0)r=Nn.call(Array(t.indent+1)," ");else return null;return{base:r,prev:Nn.call(Array(e+1),r)}}function n_(t,e){if(t.length===0)return"";var r=` +`+e.prev+e.base;return r+Nn.call(t,","+r)+` +`+e.prev}function qg(t,e){var r=r_(t),n=[];if(r){n.length=t.length;for(var i=0;i{"use strict";c();var a_=Mg(),nu=NB(),nee=YB(),iee=a_("%TypeError%"),jg=a_("%WeakMap%",!0),Gg=a_("%Map%",!0),see=nu("WeakMap.prototype.get",!0),oee=nu("WeakMap.prototype.set",!0),aee=nu("WeakMap.prototype.has",!0),uee=nu("Map.prototype.get",!0),cee=nu("Map.prototype.set",!0),lee=nu("Map.prototype.has",!0),u_=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},fee=function(t,e){var r=u_(t,e);return r&&r.value},hee=function(t,e,r){var n=u_(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}},dee=function(t,e){return!!u_(t,e)};JB.exports=function(){var e,r,n,i={assert:function(s){if(!i.has(s))throw new iee("Side channel does not contain "+nee(s))},get:function(s){if(jg&&s&&(typeof s=="object"||typeof s=="function")){if(e)return see(e,s)}else if(Gg){if(r)return uee(r,s)}else if(n)return fee(n,s)},has:function(s){if(jg&&s&&(typeof s=="object"||typeof s=="function")){if(e)return aee(e,s)}else if(Gg){if(r)return lee(r,s)}else if(n)return dee(n,s);return!1},set:function(s,o){jg&&s&&(typeof s=="object"||typeof s=="function")?(e||(e=new jg),oee(e,s,o)):Gg?(r||(r=new Gg),cee(r,s,o)):(n||(n={key:{},next:null}),hee(n,s,o))}};return i}});var kg=m((oye,ZB)=>{"use strict";c();var pee=String.prototype.replace,gee=/%20/g,c_={RFC1738:"RFC1738",RFC3986:"RFC3986"};ZB.exports={default:c_.RFC3986,formatters:{RFC1738:function(t){return pee.call(t,gee,"+")},RFC3986:function(t){return String(t)}},RFC1738:c_.RFC1738,RFC3986:c_.RFC3986}});var f_=m((uye,tL)=>{"use strict";c();var yee=kg(),l_=Object.prototype.hasOwnProperty,eo=Array.isArray,On=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),mee=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&&l<=57||l>=65&&l<=90||l>=97&&l<=122||s===yee.RFC1738&&(l===40||l===41)){a+=o.charAt(u);continue}if(l<128){a=a+On[l];continue}if(l<2048){a=a+(On[192|l>>6]+On[128|l&63]);continue}if(l<55296||l>=57344){a=a+(On[224|l>>12]+On[128|l>>6&63]+On[128|l&63]);continue}u+=1,l=65536+((l&1023)<<10|o.charCodeAt(u)&1023),a+=On[240|l>>18]+On[128|l>>12&63]+On[128|l>>6&63]+On[128|l&63]}return a},bee=function(e){for(var r=[{obj:{o:e},prop:"o"}],n=[],i=0;i{"use strict";c();var iL=XB(),d_=f_(),_l=kg(),Tee=Object.prototype.hasOwnProperty,rL={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,r){return e+"["+r+"]"},repeat:function(e){return e}},to=Array.isArray,xee=String.prototype.split,Nee=Array.prototype.push,sL=function(t,e){Nee.apply(t,to(e)?e:[e])},Oee=Date.prototype.toISOString,nL=_l.default,kt={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:d_.encode,encodeValuesOnly:!1,format:nL,formatter:_l.formatters[nL],indices:!1,serializeDate:function(e){return Oee.call(e)},skipNulls:!1,strictNullHandling:!1},Dee=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},h_={},Pee=function t(e,r,n,i,s,o,a,u,l,f,d,g,E,v,N){for(var O=e,F=N,_=0,I=!1;(F=F.get(h_))!==void 0&&!I;){var S=F.get(e);if(_+=1,typeof S<"u"){if(S===_)throw new RangeError("Cyclic object value");I=!0}typeof F.get(h_)>"u"&&(_=0)}if(typeof a=="function"?O=a(r,O):O instanceof Date?O=f(O):n==="comma"&&to(O)&&(O=d_.maybeMap(O,function(re){return re instanceof Date?f(re):re})),O===null){if(i)return o&&!E?o(r,kt.encoder,v,"key",d):r;O=""}if(Dee(O)||d_.isBuffer(O)){if(o){var R=E?r:o(r,kt.encoder,v,"key",d);if(n==="comma"&&E){for(var B=xee.call(String(O),","),b="",C=0;C"u")return L;var X;if(n==="comma"&&to(O))X=[{value:O.length>0?O.join(",")||null:void 0}];else if(to(a))X=a;else{var W=Object.keys(O);X=u?W.sort(u):W}for(var j=0;j"u"?kt.allowDots:!!e.allowDots,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:kt.charsetSentinel,delimiter:typeof e.delimiter>"u"?kt.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:kt.encode,encoder:typeof e.encoder=="function"?e.encoder:kt.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:kt.encodeValuesOnly,filter:s,format:n,formatter:i,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:kt.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:kt.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:kt.strictNullHandling}};oL.exports=function(t,e){var r=t,n=Ree(e),i,s;typeof n.filter=="function"?(s=n.filter,r=s("",r)):to(n.filter)&&(s=n.filter,i=s);var o=[];if(typeof r!="object"||r===null)return"";var a;e&&e.arrayFormat in rL?a=e.arrayFormat:e&&"indices"in e?a=e.indices?"indices":"repeat":a="indices";var u=rL[a];i||(i=Object.keys(r)),n.sort&&i.sort(n.sort);for(var l=iL(),f=0;f0?E+g:""}});var lL=m((hye,cL)=>{"use strict";c();var iu=f_(),p_=Object.prototype.hasOwnProperty,Bee=Array.isArray,Ut={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:iu.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},Lee=function(t){return t.replace(/&#(\d+);/g,function(e,r){return String.fromCharCode(parseInt(r,10))})},uL=function(t,e){return t&&typeof t=="string"&&e.comma&&t.indexOf(",")>-1?t.split(","):t},Fee="utf8=%26%2310003%3B",Mee="utf8=%E2%9C%93",Uee=function(e,r){var n={},i=r.ignoreQueryPrefix?e.replace(/^\?/,""):e,s=r.parameterLimit===1/0?void 0:r.parameterLimit,o=i.split(r.delimiter,s),a=-1,u,l=r.charset;if(r.charsetSentinel)for(u=0;u-1&&(v=Bee(v)?[v]:v),p_.call(n,E)?n[E]=iu.combine(n[E],v):n[E]=v}return n},qee=function(t,e,r,n){for(var i=n?e:uL(e,r),s=t.length-1;s>=0;--s){var o,a=t[s];if(a==="[]"&&r.parseArrays)o=[].concat(i);else{o=r.plainObjects?Object.create(null):{};var u=a.charAt(0)==="["&&a.charAt(a.length-1)==="]"?a.slice(1,-1):a,l=parseInt(u,10);!r.parseArrays&&u===""?o={0:i}:!isNaN(l)&&a!==u&&String(l)===u&&l>=0&&r.parseArrays&&l<=r.arrayLimit?(o=[],o[l]=i):u!=="__proto__"&&(o[u]=i)}i=o}return i},Vee=function(e,r,n,i){if(e){var s=n.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,o=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,u=n.depth>0&&o.exec(s),l=u?s.slice(0,u.index):s,f=[];if(l){if(!n.plainObjects&&p_.call(Object.prototype,l)&&!n.allowPrototypes)return;f.push(l)}for(var d=0;n.depth>0&&(u=a.exec(s))!==null&&d"u"?Ut.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?Ut.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:Ut.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:Ut.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:Ut.arrayLimit,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Ut.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:Ut.comma,decoder:typeof e.decoder=="function"?e.decoder:Ut.decoder,delimiter:typeof e.delimiter=="string"||iu.isRegExp(e.delimiter)?e.delimiter:Ut.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:Ut.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:Ut.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:Ut.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:Ut.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Ut.strictNullHandling}};cL.exports=function(t,e){var r=Hee(e);if(t===""||t===null||typeof t>"u")return r.plainObjects?Object.create(null):{};for(var n=typeof t=="string"?Uee(t,r):t,i=r.plainObjects?Object.create(null):{},s=Object.keys(n),o=0;o{"use strict";c();var jee=aL(),Gee=lL(),kee=kg();fL.exports={formats:kee,parse:Gee,stringify:jee}});var g_=m(at=>{"use strict";c();Object.defineProperty(at,"__esModule",{value:!0});at.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED=at.WALLET_PROVIDER_CALLBACK_PARAM=at.WALLET_PROVIDER_SIGN_MESSAGE_URL=at.WALLET_PROVIDER_GUARD_TRANSACTION_URL=at.WALLET_PROVIDER_SIGN_TRANSACTION_URL=at.WALLET_PROVIDER_SEND_TRANSACTION_URL=at.WALLET_PROVIDER_DISCONNECT_URL=at.WALLET_PROVIDER_CONNECT_URL=at.WALLET_PROVIDER_TESTNET=at.WALLET_PROVIDER_DEVNET=at.WALLET_PROVIDER_MAINNET=void 0;at.WALLET_PROVIDER_MAINNET="https://wallet.multiversx.com/dapp/init";at.WALLET_PROVIDER_DEVNET="https://devnet-wallet.multiversx.com/dapp/init";at.WALLET_PROVIDER_TESTNET="https://testnet-wallet.multiversx.com/dapp/init";at.WALLET_PROVIDER_CONNECT_URL="hook/login";at.WALLET_PROVIDER_DISCONNECT_URL="hook/logout";at.WALLET_PROVIDER_SEND_TRANSACTION_URL="hook/transaction";at.WALLET_PROVIDER_SIGN_TRANSACTION_URL="hook/sign";at.WALLET_PROVIDER_GUARD_TRANSACTION_URL="hook/2fa";at.WALLET_PROVIDER_SIGN_MESSAGE_URL="hook/sign-message";at.WALLET_PROVIDER_CALLBACK_PARAM="walletProviderStatus";at.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED="transactionsSigned"});var dL=m(su=>{"use strict";c();Object.defineProperty(su,"__esModule",{value:!0});su.ErrCannotSignedMessage=su.ErrCannotGetSignedTransactions=void 0;var y_=class extends Error{constructor(){super("Cannot get signed transaction(s)")}};su.ErrCannotGetSignedTransactions=y_;var m_=class extends Error{constructor(){super("Cannot get signed message")}};su.ErrCannotSignedMessage=m_});var pL=m(Qg=>{"use strict";c();Object.defineProperty(Qg,"__esModule",{value:!0});Qg.PlainSignedTransaction=void 0;var E_=class{constructor(e){this.nonce=0,this.value="",this.receiver="",this.sender="",this.gasPrice=0,this.gasLimit=0,this.data="",this.chainID="",this.version=0,this.options=void 0,this.signature="",Object.assign(this,e)}};Qg.PlainSignedTransaction=E_});var Il=m(es=>{"use strict";c();var Xi=es&&es.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})},Qee=es&&es.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(es,"__esModule",{value:!0});es.WalletProvider=void 0;var w_=Qee(hL()),Zi=g_(),v_=dL(),Wee=pL(),A_=class t{constructor(e){this.walletUrl=e}login(e){return Xi(this,void 0,void 0,function*(){let r=this.buildWalletUrl({endpoint:Zi.WALLET_PROVIDER_CONNECT_URL,callbackUrl:e?.callbackUrl,params:{token:e?.token}});return yield this.redirect(r,e?.redirectDelayMilliseconds),r})}redirect(e,r){return Xi(this,void 0,void 0,function*(){r?yield this.redirectLater(e,r):this.redirectImmediately(e)})}redirectImmediately(e){window.location.href=e}redirectLater(e,r){return Xi(this,void 0,void 0,function*(){yield new Promise(n=>{setTimeout(()=>{window.location.href=e,n(!0)},r)})})}logout(e){return Xi(this,void 0,void 0,function*(){let r=this.buildWalletUrl({endpoint:Zi.WALLET_PROVIDER_DISCONNECT_URL,callbackUrl:e?.callbackUrl});return yield this.redirect(r,e?.redirectDelayMilliseconds),!0})}signMessage(e,r){return Xi(this,void 0,void 0,function*(){let n=this.buildWalletUrl({endpoint:Zi.WALLET_PROVIDER_SIGN_MESSAGE_URL,callbackUrl:r?.callbackUrl,params:{message:e.message.toString()}});return yield this.redirect(n),n})}getMessageSignatureFromWalletUrl(){var e,r;let n=window.location.search.slice(1);console.info("getMessageSignatureFromWalletUrl(), url:",n);let i=w_.default.parse(n);if((((e=i.status)===null||e===void 0?void 0:e.toString())||"")!=="signed")throw new v_.ErrCannotSignedMessage;return((r=i.signature)===null||r===void 0?void 0:r.toString())||""}guardTransactions(e,r){return Xi(this,void 0,void 0,function*(){this.redirectTransactionsToEndpoint(Zi.WALLET_PROVIDER_GUARD_TRANSACTION_URL,e,r)})}signTransactions(e,r){return Xi(this,void 0,void 0,function*(){this.redirectTransactionsToEndpoint(Zi.WALLET_PROVIDER_SIGN_TRANSACTION_URL,e,r)})}signTransaction(e,r){return Xi(this,void 0,void 0,function*(){yield this.signTransactions([e],r)})}getTransactionsFromWalletUrl(){let e=w_.default.parse(window.location.search.slice(1));return t.isTxSignReturnSuccess(e)?this.getTxSignReturnValue(e):[]}static isTxSignReturnSuccess(e){return e.hasOwnProperty(Zi.WALLET_PROVIDER_CALLBACK_PARAM)&&e[Zi.WALLET_PROVIDER_CALLBACK_PARAM]===Zi.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED}getTxSignReturnValue(e){var r;console.info("getTxSignReturnValue(), urlParams:",e);let n=["nonce","value","receiver","sender","gasPrice","gasLimit","chainID","version","signature"];for(let o of n)if(!e[o]||!Array.isArray(e[o]))throw new v_.ErrCannotGetSignedTransactions;let i=e.nonce.length;for(let o of n)if(e[o].length!==i)throw new v_.ErrCannotGetSignedTransactions;let s=[];for(let o=0;o{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}};es.WalletProvider=A_});var b_=m((Iye,gL)=>{"use strict";c();gL.exports=function(e,r){return function(){for(var i=new Array(arguments.length),s=0;s{"use strict";c();var zee=b_(),ro=Object.prototype.toString;function S_(t){return ro.call(t)==="[object Array]"}function __(t){return typeof t>"u"}function $ee(t){return t!==null&&!__(t)&&t.constructor!==null&&!__(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function Kee(t){return ro.call(t)==="[object ArrayBuffer]"}function Yee(t){return typeof FormData<"u"&&t instanceof FormData}function Jee(t){var e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&t.buffer instanceof ArrayBuffer,e}function Xee(t){return typeof t=="string"}function Zee(t){return typeof t=="number"}function yL(t){return t!==null&&typeof t=="object"}function Wg(t){if(ro.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function ete(t){return ro.call(t)==="[object Date]"}function tte(t){return ro.call(t)==="[object File]"}function rte(t){return ro.call(t)==="[object Blob]"}function mL(t){return ro.call(t)==="[object Function]"}function nte(t){return yL(t)&&mL(t.pipe)}function ite(t){return typeof URLSearchParams<"u"&&t instanceof URLSearchParams}function ste(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function ote(){return typeof navigator<"u"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window<"u"&&typeof document<"u"}function C_(t,e){if(!(t===null||typeof t>"u"))if(typeof t!="object"&&(t=[t]),S_(t))for(var r=0,n=t.length;r{"use strict";c();var ou=pr();function wL(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}vL.exports=function(e,r,n){if(!r)return e;var i;if(n)i=n(r);else if(ou.isURLSearchParams(r))i=r.toString();else{var s=[];ou.forEach(r,function(u,l){u===null||typeof u>"u"||(ou.isArray(u)?l=l+"[]":u=[u],ou.forEach(u,function(d){ou.isDate(d)?d=d.toISOString():ou.isObject(d)&&(d=JSON.stringify(d)),s.push(wL(l)+"="+wL(d))}))}),i=s.join("&")}if(i){var o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}});var bL=m((Oye,AL)=>{"use strict";c();var cte=pr();function zg(){this.handlers=[]}zg.prototype.use=function(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};zg.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};zg.prototype.forEach=function(e){cte.forEach(this.handlers,function(n){n!==null&&e(n)})};AL.exports=zg});var IL=m((Pye,_L)=>{"use strict";c();var lte=pr();_L.exports=function(e,r){lte.forEach(e,function(i,s){s!==r&&s.toUpperCase()===r.toUpperCase()&&(e[r]=i,delete e[s])})}});var x_=m((Bye,SL)=>{"use strict";c();SL.exports=function(e,r,n,i,s){return e.config=r,n&&(e.code=n),e.request=i,e.response=s,e.isAxiosError=!0,e.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:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},e}});var N_=m((Fye,CL)=>{"use strict";c();var fte=x_();CL.exports=function(e,r,n,i,s){var o=new Error(e);return fte(o,r,n,i,s)}});var xL=m((Uye,TL)=>{"use strict";c();var hte=N_();TL.exports=function(e,r,n){var i=n.config.validateStatus;!n.status||!i||i(n.status)?e(n):r(hte("Request failed with status code "+n.status,n.config,null,n.request,n))}});var OL=m((Vye,NL)=>{"use strict";c();var $g=pr();NL.exports=$g.isStandardBrowserEnv()?function(){return{write:function(r,n,i,s,o,a){var u=[];u.push(r+"="+encodeURIComponent(n)),$g.isNumber(i)&&u.push("expires="+new Date(i).toGMTString()),$g.isString(s)&&u.push("path="+s),$g.isString(o)&&u.push("domain="+o),a===!0&&u.push("secure"),document.cookie=u.join("; ")},read:function(r){var n=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(r){this.write(r,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()});var PL=m((jye,DL)=>{"use strict";c();DL.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}});var BL=m((kye,RL)=>{"use strict";c();RL.exports=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e}});var FL=m((Wye,LL)=>{"use strict";c();var dte=PL(),pte=BL();LL.exports=function(e,r){return e&&!dte(r)?pte(e,r):r}});var UL=m(($ye,ML)=>{"use strict";c();var O_=pr(),gte=["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"];ML.exports=function(e){var r={},n,i,s;return e&&O_.forEach(e.split(` +`),function(a){if(s=a.indexOf(":"),n=O_.trim(a.substr(0,s)).toLowerCase(),i=O_.trim(a.substr(s+1)),n){if(r[n]&>e.indexOf(n)>=0)return;n==="set-cookie"?r[n]=(r[n]?r[n]:[]).concat([i]):r[n]=r[n]?r[n]+", "+i:i}}),r}});var HL=m((Yye,VL)=>{"use strict";c();var qL=pr();VL.exports=qL.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),n;function i(s){var 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){var a=qL.isString(o)?i(o):o;return a.protocol===n.protocol&&a.host===n.host}}():function(){return function(){return!0}}()});var Sl=m((Xye,jL)=>{"use strict";c();function D_(t){this.message=t}D_.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};D_.prototype.__CANCEL__=!0;jL.exports=D_});var R_=m((e0e,GL)=>{"use strict";c();var Kg=pr(),yte=xL(),mte=OL(),Ete=T_(),wte=FL(),vte=UL(),Ate=HL(),P_=N_(),bte=Cl(),_te=Sl();GL.exports=function(e){return new Promise(function(n,i){var s=e.data,o=e.headers,a=e.responseType,u;function l(){e.cancelToken&&e.cancelToken.unsubscribe(u),e.signal&&e.signal.removeEventListener("abort",u)}Kg.isFormData(s)&&delete o["Content-Type"];var f=new XMLHttpRequest;if(e.auth){var d=e.auth.username||"",g=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.Authorization="Basic "+btoa(d+":"+g)}var E=wte(e.baseURL,e.url);f.open(e.method.toUpperCase(),Ete(E,e.params,e.paramsSerializer),!0),f.timeout=e.timeout;function v(){if(f){var O="getAllResponseHeaders"in f?vte(f.getAllResponseHeaders()):null,F=!a||a==="text"||a==="json"?f.responseText:f.response,_={data:F,status:f.status,statusText:f.statusText,headers:O,config:e,request:f};yte(function(S){n(S),l()},function(S){i(S),l()},_),f=null}}if("onloadend"in f?f.onloadend=v:f.onreadystatechange=function(){!f||f.readyState!==4||f.status===0&&!(f.responseURL&&f.responseURL.indexOf("file:")===0)||setTimeout(v)},f.onabort=function(){f&&(i(P_("Request aborted",e,"ECONNABORTED",f)),f=null)},f.onerror=function(){i(P_("Network Error",e,null,f)),f=null},f.ontimeout=function(){var F=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",_=e.transitional||bte.transitional;e.timeoutErrorMessage&&(F=e.timeoutErrorMessage),i(P_(F,e,_.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",f)),f=null},Kg.isStandardBrowserEnv()){var N=(e.withCredentials||Ate(E))&&e.xsrfCookieName?mte.read(e.xsrfCookieName):void 0;N&&(o[e.xsrfHeaderName]=N)}"setRequestHeader"in f&&Kg.forEach(o,function(F,_){typeof s>"u"&&_.toLowerCase()==="content-type"?delete o[_]:f.setRequestHeader(_,F)}),Kg.isUndefined(e.withCredentials)||(f.withCredentials=!!e.withCredentials),a&&a!=="json"&&(f.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&f.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&f.upload&&f.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(u=function(O){f&&(i(!O||O&&O.type?new _te("canceled"):O),f.abort(),f=null)},e.cancelToken&&e.cancelToken.subscribe(u),e.signal&&(e.signal.aborted?u():e.signal.addEventListener("abort",u))),s||(s=null),f.send(s)})}});var Cl=m((r0e,WL)=>{"use strict";c();var Qt=pr(),kL=IL(),Ite=x_(),Ste={"Content-Type":"application/x-www-form-urlencoded"};function QL(t,e){!Qt.isUndefined(t)&&Qt.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function Cte(){var t;return typeof XMLHttpRequest<"u"?t=R_():typeof p.default<"u"&&Object.prototype.toString.call(p.default)==="[object process]"&&(t=R_()),t}function Tte(t,e,r){if(Qt.isString(t))try{return(e||JSON.parse)(t),Qt.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}var Yg={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:Cte(),transformRequest:[function(e,r){return kL(r,"Accept"),kL(r,"Content-Type"),Qt.isFormData(e)||Qt.isArrayBuffer(e)||Qt.isBuffer(e)||Qt.isStream(e)||Qt.isFile(e)||Qt.isBlob(e)?e:Qt.isArrayBufferView(e)?e.buffer:Qt.isURLSearchParams(e)?(QL(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):Qt.isObject(e)||r&&r["Content-Type"]==="application/json"?(QL(r,"application/json"),Tte(e)):e}],transformResponse:[function(e){var r=this.transitional||Yg.transitional,n=r&&r.silentJSONParsing,i=r&&r.forcedJSONParsing,s=!n&&this.responseType==="json";if(s||i&&Qt.isString(e)&&e.length)try{return JSON.parse(e)}catch(o){if(s)throw o.name==="SyntaxError"?Ite(o,this,"E_JSON_PARSE"):o}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};Qt.forEach(["delete","get","head"],function(e){Yg.headers[e]={}});Qt.forEach(["post","put","patch"],function(e){Yg.headers[e]=Qt.merge(Ste)});WL.exports=Yg});var $L=m((i0e,zL)=>{"use strict";c();var xte=pr(),Nte=Cl();zL.exports=function(e,r,n){var i=this||Nte;return xte.forEach(n,function(o){e=o.call(i,e,r)}),e}});var B_=m((o0e,KL)=>{"use strict";c();KL.exports=function(e){return!!(e&&e.__CANCEL__)}});var XL=m((u0e,JL)=>{"use strict";c();var YL=pr(),L_=$L(),Ote=B_(),Dte=Cl(),Pte=Sl();function F_(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Pte("canceled")}JL.exports=function(e){F_(e),e.headers=e.headers||{},e.data=L_.call(e,e.data,e.headers,e.transformRequest),e.headers=YL.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),YL.forEach(["delete","get","head","post","put","patch","common"],function(i){delete e.headers[i]});var r=e.adapter||Dte.adapter;return r(e).then(function(i){return F_(e),i.data=L_.call(e,i.data,i.headers,e.transformResponse),i},function(i){return Ote(i)||(F_(e),i&&i.response&&(i.response.data=L_.call(e,i.response.data,i.response.headers,e.transformResponse))),Promise.reject(i)})}});var M_=m((l0e,ZL)=>{"use strict";c();var Ar=pr();ZL.exports=function(e,r){r=r||{};var n={};function i(f,d){return Ar.isPlainObject(f)&&Ar.isPlainObject(d)?Ar.merge(f,d):Ar.isPlainObject(d)?Ar.merge({},d):Ar.isArray(d)?d.slice():d}function s(f){if(Ar.isUndefined(r[f])){if(!Ar.isUndefined(e[f]))return i(void 0,e[f])}else return i(e[f],r[f])}function o(f){if(!Ar.isUndefined(r[f]))return i(void 0,r[f])}function a(f){if(Ar.isUndefined(r[f])){if(!Ar.isUndefined(e[f]))return i(void 0,e[f])}else return i(void 0,r[f])}function u(f){if(f in r)return i(e[f],r[f]);if(f in e)return i(void 0,e[f])}var l={url:o,method:o,data:o,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:u};return Ar.forEach(Object.keys(e).concat(Object.keys(r)),function(d){var g=l[d]||s,E=g(d);Ar.isUndefined(E)&&g!==u||(n[d]=E)}),n}});var U_=m((h0e,eF)=>{c();eF.exports={version:"0.24.0"}});var nF=m((p0e,rF)=>{"use strict";c();var Rte=U_().version,q_={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){q_[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var tF={};q_.transitional=function(e,r,n){function i(s,o){return"[Axios v"+Rte+"] Transitional option '"+s+"'"+o+(n?". "+n:"")}return function(s,o,a){if(e===!1)throw new Error(i(o," has been removed"+(r?" in "+r:"")));return r&&!tF[o]&&(tF[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 Bte(t,e,r){if(typeof t!="object")throw new TypeError("options must be an object");for(var n=Object.keys(t),i=n.length;i-- >0;){var s=n[i],o=e[s];if(o){var a=t[s],u=a===void 0||o(a,s,t);if(u!==!0)throw new TypeError("option "+s+" must be "+u);continue}if(r!==!0)throw Error("Unknown option "+s)}}rF.exports={assertOptions:Bte,validators:q_}});var cF=m((y0e,uF)=>{"use strict";c();var oF=pr(),Lte=T_(),iF=bL(),sF=XL(),Jg=M_(),aF=nF(),au=aF.validators;function Tl(t){this.defaults=t,this.interceptors={request:new iF,response:new iF}}Tl.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=Jg(this.defaults,e),e.method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var r=e.transitional;r!==void 0&&aF.assertOptions(r,{silentJSONParsing:au.transitional(au.boolean),forcedJSONParsing:au.transitional(au.boolean),clarifyTimeoutError:au.transitional(au.boolean)},!1);var n=[],i=!0;this.interceptors.request.forEach(function(g){typeof g.runWhen=="function"&&g.runWhen(e)===!1||(i=i&&g.synchronous,n.unshift(g.fulfilled,g.rejected))});var s=[];this.interceptors.response.forEach(function(g){s.push(g.fulfilled,g.rejected)});var o;if(!i){var a=[sF,void 0];for(Array.prototype.unshift.apply(a,n),a=a.concat(s),o=Promise.resolve(e);a.length;)o=o.then(a.shift(),a.shift());return o}for(var u=e;n.length;){var l=n.shift(),f=n.shift();try{u=l(u)}catch(d){f(d);break}}try{o=sF(u)}catch(d){return Promise.reject(d)}for(;s.length;)o=o.then(s.shift(),s.shift());return o};Tl.prototype.getUri=function(e){return e=Jg(this.defaults,e),Lte(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};oF.forEach(["delete","get","head","options"],function(e){Tl.prototype[e]=function(r,n){return this.request(Jg(n||{},{method:e,url:r,data:(n||{}).data}))}});oF.forEach(["post","put","patch"],function(e){Tl.prototype[e]=function(r,n,i){return this.request(Jg(i||{},{method:e,url:r,data:n}))}});uF.exports=Tl});var fF=m((E0e,lF)=>{"use strict";c();var Fte=Sl();function uu(t){if(typeof t!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(i){e=i});var r=this;this.promise.then(function(n){if(r._listeners){var i,s=r._listeners.length;for(i=0;i{"use strict";c();hF.exports=function(e){return function(n){return e.apply(null,n)}}});var gF=m((b0e,pF)=>{"use strict";c();pF.exports=function(e){return typeof e=="object"&&e.isAxiosError===!0}});var EF=m((I0e,V_)=>{"use strict";c();var yF=pr(),Mte=b_(),Xg=cF(),Ute=M_(),qte=Cl();function mF(t){var e=new Xg(t),r=Mte(Xg.prototype.request,e);return yF.extend(r,Xg.prototype,e),yF.extend(r,e),r.create=function(i){return mF(Ute(t,i))},r}var Dn=mF(qte);Dn.Axios=Xg;Dn.Cancel=Sl();Dn.CancelToken=fF();Dn.isCancel=B_();Dn.VERSION=U_().version;Dn.all=function(e){return Promise.all(e)};Dn.spread=dF();Dn.isAxiosError=gF();V_.exports=Dn;V_.exports.default=Dn});var vF=m((C0e,wF)=>{c();wF.exports=EF()});var AF=m(Zg=>{"use strict";c();Object.defineProperty(Zg,"__esModule",{value:!0});Zg.NativeAuthClientConfig=void 0;var H_=class{constructor(){this.origin=typeof window<"u"?window.location.hostname:"",this.apiUrl="https://api.multiversx.com",this.expirySeconds=60*60*24}};Zg.NativeAuthClientConfig=H_});var G_=m(cu=>{"use strict";c();var no=cu&&cu.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(cu,"__esModule",{value:!0});cu.NativeAuthClient=void 0;var Vte=vF(),Hte=AF(),j_=class{constructor(e){this.config=Object.assign(new Hte.NativeAuthClientConfig,e)}getToken(e,r,n){let i=this.encodeValue(e),s=this.encodeValue(r);return`${i}.${s}.${n}`}initialize(e={}){return no(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 no(this,void 0,void 0,function*(){return this.config.gatewayUrl?yield this.getCurrentBlockHashWithGateway():yield this.getCurrentBlockHashWithApi()})}getCurrentBlockHashWithGateway(){return no(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 no(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 no(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 no(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 no(this,void 0,void 0,function*(){return yield Vte.default.get(e,{headers:this.config.extraRequestHeaders})})}};cu.NativeAuthClient=j_});var CF=m(ry=>{"use strict";c();Object.defineProperty(ry,"__esModule",{value:!0});ry.TransactionStatus=void 0;var k_=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}};ry.TransactionStatus=k_});var hu=m(Vt=>{"use strict";c();var jte=Vt&&Vt.__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]}),Gte=Vt&&Vt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kte=Vt&&Vt.__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)&&jte(e,t,r);return Gte(e,t),e};Object.defineProperty(Vt,"__esModule",{value:!0});Vt.zeroPadStringIfOddLength=Vt.isPaddedHex=Vt.numberToPaddedHex=Vt.Nonce=Vt.Address=void 0;var TF=kte(wm()),Qte="erd",Q_=class t{constructor(e){this.value=e}static fromPubkey(e){let r=TF.toWords(e),n=TF.encode(Qte,r);return new t(n)}bech32(){return this.value}toString(){return this.bech32()}};Vt.Address=Q_;var W_=class{constructor(e){this.value=e}valueOf(){return this.value}hex(){return xF(this.value)}};Vt.Nonce=W_;function xF(t){let e=t.toString(16);return NF(e)}Vt.numberToPaddedHex=xF;function Wte(t){t=t||"";let e=h.Buffer.from(t,"hex").toString("hex");return t.toUpperCase()==e.toUpperCase()}Vt.isPaddedHex=Wte;function NF(t){return t=t||"",t.length%2==1?"0"+t:t}Vt.zeroPadStringIfOddLength=NF});var DF=m(ny=>{"use strict";c();Object.defineProperty(ny,"__esModule",{value:!0});ny.TransactionReceipt=void 0;var OF=hu(),z_=class t{constructor(){this.value="",this.sender=new OF.Address(""),this.data="",this.hash=""}static fromHttpResponse(e){let r=new t;return r.value=(e.value||0).toString(),r.sender=new OF.Address(e.sender),r.data=e.data,r.hash=e.txHash,r}};ny.TransactionReceipt=z_});var PF=m(Pn=>{"use strict";c();Object.defineProperty(Pn,"__esModule",{value:!0});Pn.ErrContractQuery=Pn.ErrNetworkProvider=Pn.ErrUnexpectedCondition=Pn.Err=void 0;var du=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};Pn.Err=du;var $_=class extends du{constructor(e){super(`Unexpected condition: [${e}]`)}};Pn.ErrUnexpectedCondition=$_;var K_=class extends du{constructor(e,r,n){let i=`Request error on url [${e}]: [${r}]`;super(i,n)}};Pn.ErrNetworkProvider=K_;var Y_=class extends du{constructor(e){super(e.message.replace("executeQuery:",""))}};Pn.ErrContractQuery=Y_});var BF=m(rs=>{"use strict";c();Object.defineProperty(rs,"__esModule",{value:!0});rs.TransactionEventTopic=rs.TransactionEventData=rs.TransactionEvent=void 0;var RF=hu(),J_=class t{constructor(e){this.address=new RF.Address(""),this.identifier="",this.topics=[],this.dataPayload=new xl(h.Buffer.from("","utf8")),this.data="",Object.assign(this,e)}static fromHttpResponse(e){let r=new t;r.address=new RF.Address(e.address),r.identifier=e.identifier||"",r.topics=(e.topics||[]).map(i=>new iy(i));let n=h.Buffer.from(e.data||"","base64");return r.dataPayload=new xl(n),r.data=n.toString(),r}findFirstOrNoneTopic(e){return this.topics.filter(r=>e(r))[0]}getLastTopic(){return this.topics[this.topics.length-1]}};rs.TransactionEvent=J_;var xl=class{constructor(e){this.raw=e}toString(){return this.raw.toString("utf8")}hex(){return this.raw.toString("hex")}valueOf(){return this.raw}};rs.TransactionEventData=xl;var iy=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}};rs.TransactionEventTopic=iy});var Z_=m(sy=>{"use strict";c();Object.defineProperty(sy,"__esModule",{value:!0});sy.TransactionLogs=void 0;var zte=PF(),LF=hu(),$te=BF(),X_=class t{constructor(e){this.address=new LF.Address(""),this.events=[],Object.assign(this,e)}static fromHttpResponse(e){let r=new t;return r.address=new LF.Address(e.address),r.events=(e.events||[]).map(n=>$te.TransactionEvent.fromHttpResponse(n)),r}findSingleOrNoneEvent(e,r){let n=this.findEvents(e,r);if(n.length>1)throw new zte.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}};sy.TransactionLogs=X_});var MF=m(pu=>{"use strict";c();Object.defineProperty(pu,"__esModule",{value:!0});pu.ContractResultItem=pu.ContractResults=void 0;var FF=Z_(),oy=hu(),eI=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=>Nl.fromProxyHttpResponse(n));return new t(r)}static fromApiHttpResponse(e){let r=e.map(n=>Nl.fromApiHttpResponse(n));return new t(r)}};pu.ContractResults=eI;var Nl=class t{constructor(e){this.hash="",this.nonce=0,this.value="",this.receiver=new oy.Address(""),this.sender=new oy.Address(""),this.data="",this.previousHash="",this.originalHash="",this.gasLimit=0,this.gasPrice=0,this.callType=0,this.returnMessage="",this.logs=new FF.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 oy.Address(e.receiver),r.sender=new oy.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=FF.TransactionLogs.fromHttpResponse(e.logs||{}),r}};pu.ContractResultItem=Nl});var UF=m(ns=>{"use strict";c();var Kte=ns&&ns.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ns,"__esModule",{value:!0});ns.EsdtContractAddress=ns.MaxUint64AsBigNumber=void 0;var Yte=Kte(jt()),Jte=hu();ns.MaxUint64AsBigNumber=new Yte.default("18446744073709551615");ns.EsdtContractAddress=new Jte.Address("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u")});var qF=m(gu=>{"use strict";c();var Xte=gu&&gu.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(gu,"__esModule",{value:!0});gu.ContractQueryResponse=void 0;var Zte=Xte(jt()),ere=UF(),tI=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 Zte.default(e.gasRemaining||e.GasRemaining||0),o=ere.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()}}};gu.ContractQueryResponse=tI});var VF=m(ay=>{"use strict";c();Object.defineProperty(ay,"__esModule",{value:!0});ay.ContractQueryRequest=void 0;var rI=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}};ay.ContractQueryRequest=rI});var JF=m((qme,YF)=>{c();YF.exports=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}});var is=m(oo=>{c();var nI,tre=[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];oo.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};oo.getSymbolTotalCodewords=function(e){return tre[e]};oo.getBCHDigit=function(t){let e=0;for(;t!==0;)e++,t>>>=1;return e};oo.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');nI=e};oo.isKanjiModeEnabled=function(){return typeof nI<"u"};oo.toSJIS=function(e){return nI(e)}});var ly=m(Vr=>{c();Vr.L={bit:1};Vr.M={bit:0};Vr.Q={bit:3};Vr.H={bit:2};function rre(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return Vr.L;case"m":case"medium":return Vr.M;case"q":case"quartile":return Vr.Q;case"h":case"high":return Vr.H;default:throw new Error("Unknown EC Level: "+t)}}Vr.isValid=function(e){return e&&typeof e.bit<"u"&&e.bit>=0&&e.bit<4};Vr.from=function(e,r){if(Vr.isValid(e))return e;try{return rre(e)}catch{return r}}});var eM=m((Qme,ZF)=>{c();function XF(){this.buffer=[],this.length=0}XF.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++}};ZF.exports=XF});var rM=m((zme,tM)=>{c();function Ol(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)}Ol.prototype.set=function(t,e,r,n){let i=t*this.size+e;this.data[i]=r,n&&(this.reservedBit[i]=!0)};Ol.prototype.get=function(t,e){return this.data[t*this.size+e]};Ol.prototype.xor=function(t,e,r){this.data[t*this.size+e]^=r};Ol.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};tM.exports=Ol});var nM=m(fy=>{c();var nre=is().getSymbolSize;fy.getRowColCoords=function(e){if(e===1)return[];let r=Math.floor(e/7)+2,n=nre(e),i=n===145?26:Math.ceil((n-13)/(2*r-2))*2,s=[n-7];for(let o=1;o{c();var ire=is().getSymbolSize,iM=7;sM.getPositions=function(e){let r=ire(e);return[[0,0],[r-iM,0],[0,r-iM]]}});var aM=m(Xe=>{c();Xe.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var ao={N1:3,N2:3,N3:40,N4:10};Xe.isValid=function(e){return e!=null&&e!==""&&!isNaN(e)&&e>=0&&e<=7};Xe.from=function(e){return Xe.isValid(e)?parseInt(e,10):void 0};Xe.getPenaltyN1=function(e){let r=e.size,n=0,i=0,s=0,o=null,a=null;for(let u=0;u=5&&(n+=ao.N1+(i-5)),o=f,i=1),f=e.get(l,u),f===a?s++:(s>=5&&(n+=ao.N1+(s-5)),a=f,s=1)}i>=5&&(n+=ao.N1+(i-5)),s>=5&&(n+=ao.N1+(s-5))}return n};Xe.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*ao.N3};Xe.getPenaltyN4=function(e){let r=0,n=e.data.length;for(let s=0;s{c();var ss=ly(),hy=[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],dy=[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];iI.getBlocksCount=function(e,r){switch(r){case ss.L:return hy[(e-1)*4+0];case ss.M:return hy[(e-1)*4+1];case ss.Q:return hy[(e-1)*4+2];case ss.H:return hy[(e-1)*4+3];default:return}};iI.getTotalCodewordsCount=function(e,r){switch(r){case ss.L:return dy[(e-1)*4+0];case ss.M:return dy[(e-1)*4+1];case ss.Q:return dy[(e-1)*4+2];case ss.H:return dy[(e-1)*4+3];default:return}}});var uM=m(gy=>{c();var Dl=new Uint8Array(512),py=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)Dl[r]=e,py[e]=r,e<<=1,e&256&&(e^=285);for(let r=255;r<512;r++)Dl[r]=Dl[r-255]})();gy.log=function(e){if(e<1)throw new Error("log("+e+")");return py[e]};gy.exp=function(e){return Dl[e]};gy.mul=function(e,r){return e===0||r===0?0:Dl[py[e]+py[r]]}});var cM=m(Pl=>{c();var oI=uM();Pl.mul=function(e,r){let n=new Uint8Array(e.length+r.length-1);for(let i=0;i=0;){let i=n[0];for(let o=0;o{c();var lM=cM();function aI(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}aI.prototype.initialize=function(e){this.degree=e,this.genPoly=lM.generateECPolynomial(this.degree)};aI.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=lM.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};fM.exports=aI});var uI=m(dM=>{c();dM.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}});var cI=m(ai=>{c();var pM="[0-9]+",ore="[A-Z $%*+\\-./:]+",Rl="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";Rl=Rl.replace(/u/g,"\\u");var are="(?:(?![A-Z0-9 $%*+\\-./:]|"+Rl+`)(?:.|[\r +]))+`;ai.KANJI=new RegExp(Rl,"g");ai.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");ai.BYTE=new RegExp(are,"g");ai.NUMERIC=new RegExp(pM,"g");ai.ALPHANUMERIC=new RegExp(ore,"g");var ure=new RegExp("^"+Rl+"$"),cre=new RegExp("^"+pM+"$"),lre=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");ai.testKanji=function(e){return ure.test(e)};ai.testNumeric=function(e){return cre.test(e)};ai.testAlphanumeric=function(e){return lre.test(e)}});var os=m(Tt=>{c();var fre=uI(),lI=cI();Tt.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]};Tt.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]};Tt.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]};Tt.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]};Tt.MIXED={bit:-1};Tt.getCharCountIndicator=function(e,r){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!fre.isValid(r))throw new Error("Invalid version: "+r);return r>=1&&r<10?e.ccBits[0]:r<27?e.ccBits[1]:e.ccBits[2]};Tt.getBestModeForData=function(e){return lI.testNumeric(e)?Tt.NUMERIC:lI.testAlphanumeric(e)?Tt.ALPHANUMERIC:lI.testKanji(e)?Tt.KANJI:Tt.BYTE};Tt.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")};Tt.isValid=function(e){return e&&e.bit&&e.ccBits};function hre(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return Tt.NUMERIC;case"alphanumeric":return Tt.ALPHANUMERIC;case"kanji":return Tt.KANJI;case"byte":return Tt.BYTE;default:throw new Error("Unknown mode: "+t)}}Tt.from=function(e,r){if(Tt.isValid(e))return e;try{return hre(e)}catch{return r}}});var wM=m(uo=>{c();var yy=is(),dre=sI(),gM=ly(),as=os(),fI=uI(),mM=7973,yM=yy.getBCHDigit(mM);function pre(t,e,r){for(let n=1;n<=40;n++)if(e<=uo.getCapacity(n,r,t))return n}function EM(t,e){return as.getCharCountIndicator(t,e)+4}function gre(t,e){let r=0;return t.forEach(function(n){let i=EM(n.mode,e);r+=i+n.getBitsLength()}),r}function yre(t,e){for(let r=1;r<=40;r++)if(gre(t,r)<=uo.getCapacity(r,e,as.MIXED))return r}uo.from=function(e,r){return fI.isValid(e)?parseInt(e,10):r};uo.getCapacity=function(e,r,n){if(!fI.isValid(e))throw new Error("Invalid QR Code version");typeof n>"u"&&(n=as.BYTE);let i=yy.getSymbolTotalCodewords(e),s=dre.getTotalCodewordsCount(e,r),o=(i-s)*8;if(n===as.MIXED)return o;let a=o-EM(n,e);switch(n){case as.NUMERIC:return Math.floor(a/10*3);case as.ALPHANUMERIC:return Math.floor(a/11*2);case as.KANJI:return Math.floor(a/13);case as.BYTE:default:return Math.floor(a/8)}};uo.getBestVersionForData=function(e,r){let n,i=gM.from(r,gM.M);if(Array.isArray(e)){if(e.length>1)return yre(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return pre(n.mode,n.getLength(),i)};uo.getEncodedBits=function(e){if(!fI.isValid(e)||e<7)throw new Error("Invalid QR Code version");let r=e<<12;for(;yy.getBCHDigit(r)-yM>=0;)r^=mM<{c();var hI=is(),AM=1335,mre=21522,vM=hI.getBCHDigit(AM);bM.getEncodedBits=function(e,r){let n=e.bit<<3|r,i=n<<10;for(;hI.getBCHDigit(i)-vM>=0;)i^=AM<{c();var Ere=os();function yu(t){this.mode=Ere.NUMERIC,this.data=t.toString()}yu.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)};yu.prototype.getLength=function(){return this.data.length};yu.prototype.getBitsLength=function(){return yu.getBitsLength(this.data.length)};yu.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))};IM.exports=yu});var TM=m((AEe,CM)=>{c();var wre=os(),dI=["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 mu(t){this.mode=wre.ALPHANUMERIC,this.data=t}mu.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)};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;for(r=0;r+2<=this.data.length;r+=2){let n=dI.indexOf(this.data[r])*45;n+=dI.indexOf(this.data[r+1]),e.put(n,11)}this.data.length%2&&e.put(dI.indexOf(this.data[r]),6)};CM.exports=mu});var NM=m((_Ee,xM)=>{"use strict";c();xM.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 DM=m((SEe,OM)=>{c();var vre=NM(),Are=os();function Eu(t){this.mode=Are.BYTE,typeof t=="string"&&(t=vre(t)),this.data=new Uint8Array(t)}Eu.getBitsLength=function(e){return e*8};Eu.prototype.getLength=function(){return this.data.length};Eu.prototype.getBitsLength=function(){return Eu.getBitsLength(this.data.length)};Eu.prototype.write=function(t){for(let e=0,r=this.data.length;e{c();var bre=os(),_re=is();function wu(t){this.mode=bre.KANJI,this.data=t}wu.getBitsLength=function(e){return e*13};wu.prototype.getLength=function(){return this.data.length};wu.prototype.getBitsLength=function(){return wu.getBitsLength(this.data.length)};wu.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)}};PM.exports=wu});var BM=m((NEe,pI)=>{"use strict";c();var Bl={single_source_shortest_paths:function(t,e,r){var n={},i={};i[e]=0;var s=Bl.PriorityQueue.make();s.push(e,0);for(var o,a,u,l,f,d,g,E,v;!s.empty();){o=s.pop(),a=o.value,l=o.cost,f=t[a]||{};for(u in f)f.hasOwnProperty(u)&&(d=f[u],g=l+d,E=i[u],v=typeof i[u]>"u",(v||E>g)&&(i[u]=g,s.push(u,g),n[u]=a))}if(typeof r<"u"&&typeof i[r]>"u"){var N=["Could not find a path from ",e," to ",r,"."].join("");throw new Error(N)}return n},extract_shortest_path_from_predecessor_list:function(t,e){for(var r=[],n=e,i;n;)r.push(n),i=t[n],n=t[n];return r.reverse(),r},find_path:function(t,e,r){var n=Bl.single_source_shortest_paths(t,e,r);return Bl.extract_shortest_path_from_predecessor_list(n,r)},PriorityQueue:{make:function(t){var e=Bl.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 pI<"u"&&(pI.exports=Bl)});var jM=m(vu=>{c();var He=os(),MM=SM(),UM=TM(),qM=DM(),VM=RM(),Ll=cI(),my=is(),Ire=BM();function LM(t){return unescape(encodeURIComponent(t)).length}function Fl(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 HM(t){let e=Fl(Ll.NUMERIC,He.NUMERIC,t),r=Fl(Ll.ALPHANUMERIC,He.ALPHANUMERIC,t),n,i;return my.isKanjiModeEnabled()?(n=Fl(Ll.BYTE,He.BYTE,t),i=Fl(Ll.KANJI,He.KANJI,t)):(n=Fl(Ll.BYTE_KANJI,He.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 gI(t,e){switch(e){case He.NUMERIC:return MM.getBitsLength(t);case He.ALPHANUMERIC:return UM.getBitsLength(t);case He.KANJI:return VM.getBitsLength(t);case He.BYTE:return qM.getBitsLength(t)}}function Sre(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 Cre(t){let e=[];for(let r=0;r{c();var wy=is(),yI=ly(),xre=eM(),Nre=rM(),Ore=nM(),Dre=oM(),wI=aM(),vI=sI(),Pre=hM(),Ey=wM(),Rre=_M(),Bre=os(),mI=jM();function Lre(t,e){let r=t.size,n=Dre.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 Fre(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 EI(t,e,r){let n=t.size,i=Rre.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 qre(t,e){let r=t.size,n=-1,i=r-1,s=7,o=0;for(let a=r-1;a>0;a-=2)for(a===6&&a--;;){for(let u=0;u<2;u++)if(!t.isReserved(i,a-u)){let l=!1;o>>s&1)===1),t.set(i,a-u,l),s--,s===-1&&(o++,s=7)}if(i+=n,i<0||r<=i){i-=n,n=-n;break}}}function Vre(t,e,r){let n=new xre;r.forEach(function(u){n.put(u.mode.bit,4),n.put(u.getLength(),Bre.getCharCountIndicator(u.mode,t)),u.write(n)});let i=wy.getSymbolTotalCodewords(t),s=vI.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&&Jee(u,e),Xee(u,o),isNaN(n)&&(n=b_.getBestMask(u,A_.bind(null,u,r))),b_.applyMask(n,u),A_(u,r,n),{modules:u,version:e,errorCorrectionLevel:r,maskPattern:n,segments:i}}OF.create=function(e,r){if(typeof e>"u"||e==="")throw new Error("No input text");let n=E_.M,i,s;return typeof r<"u"&&(n=E_.from(r.errorCorrectionLevel,E_.M),i=y0.from(r.version),s=b_.from(r.maskPattern),r.toSJISFunc&&m0.setToSJISFunction(r.toSJISFunc)),tte(e,i,n,s)}});var I_=w(Uo=>{c();function PF(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("")}}Uo.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:PF(e.color.dark||"#000000ff"),light:PF(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}};Uo.getScale=function(e,r){return r.width&&r.width>=e+r.margin*2?r.width/(e+r.margin*2):r.scale};Uo.getImageWidth=function(e,r){let n=Uo.getScale(e,r);return Math.floor((e+r.margin*2)*n)};Uo.qrToImageData=function(e,r,n){let i=r.modules.size,s=r.modules.data,o=Uo.getScale(i,n),a=Math.floor((i+n.margin*2)*o),u=n.margin*o,l=[n.color.light,n.color.dark];for(let f=0;f=u&&d>=u&&f{c();var S_=I_();function rte(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 nte(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}w0.render=function(e,r,n){let i=n,s=r;typeof i>"u"&&(!r||!r.getContext)&&(i=r,r=void 0),r||(s=nte()),i=S_.getOptions(i);let o=S_.getImageWidth(e.modules.size,i),a=s.getContext("2d"),u=a.createImageData(o,o);return S_.qrToImageData(u.data,e,i),rte(a,s,o),a.putImageData(u,0,0),s};w0.renderToDataURL=function(e,r,n){let i=n;typeof i>"u"&&(!r||!r.getContext)&&(i=r,r=void 0),i||(i={});let s=w0.render(e,r,i),o=i.type||"image/png",a=i.rendererOpts||{};return s.toDataURL(o,a.quality)}});var FF=w(LF=>{c();var ite=I_();function BF(t,e){let r=t.a/255,n=e+'="'+t.hex+'"';return r<1?n+" "+e+'-opacity="'+r.toFixed(2).slice(1)+'"':n}function C_(t,e,r){let n=t+e;return typeof r<"u"&&(n+=" "+r),n}function ste(t,e,r){let n="",i=0,s=!1,o=0;for(let a=0;a0&&u>0&&t[a-1]||(n+=s?C_("M",u+r,.5+l+r):C_("m",i,0),i=0,s=!1),u+1':"",l="',f='viewBox="0 0 '+a+" "+a+'"',y=''+u+l+` -`;return typeof n=="function"&&n(null,y),y}});var UF=w(If=>{c();var ote=UL(),T_=DF(),MF=RF(),ate=FF();function x_(t,e,r,n,i){let s=[].slice.call(arguments,1),o=s.length,a=typeof s[o-1]=="function";if(!a&&!ote())throw new Error("Callback required as last argument");if(a){if(o<2)throw new Error("Too few arguments provided");o===2?(i=r,r=e,e=n=void 0):o===3&&(e.getContext&&typeof i>"u"?(i=n,n=void 0):(i=n,n=r,r=e,e=void 0))}else{if(o<1)throw new Error("Too few arguments provided");return o===1?(r=e,e=n=void 0):o===2&&!e.getContext&&(n=r,r=e,e=void 0),new Promise(function(u,l){try{let f=T_.create(r,n);u(t(f,e,n))}catch(f){l(f)}})}try{let u=T_.create(r,n);i(null,t(u,e,n))}catch(u){i(u)}}If.create=T_.create;If.toCanvas=x_.bind(null,MF.render);If.toDataURL=x_.bind(null,MF.renderToDataURL);If.toString=x_.bind(null,function(t,e,r){return ate.render(t,r)})});var JF=w(ps=>{"use strict";c();var Ete=ps&&ps.__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]}),YF=ps&&ps.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Ete(e,t,r)};Object.defineProperty(ps,"__esModule",{value:!0});YF(uf(),ps);YF(_b(),ps)});c();var vte=_e(iI(),1),Ate=_e(HT(),1),bte=_e(QT(),1),_te=_e(tr(),1),Ite=_e($h(),1),Ste=_e(Wc(),1),Cte=_e(jc(),1),Tte=_e(Rw(),1),xte=_e(D2(),1),Nte=_e(Zh(),1),i5=_e(yi(),1),Bn=_e(Rc(),1),s5=_e(Oc(),1),o5=_e(aa(),1);c();c();var q2=_e(RE(),1);c();c();var Id="elvenjs_state",F2="https://devnet-api.multiversx.com";var Sd="/dapp/init",Cd="devnet",M2="https://maiar.page.link/?apn=com.elrond.maiar.wallet&isi=1519405832&ibi=com.elrond.maiar.wallet&link=https://xportal.com/",U2=["wss://relay.walletconnect.com"],An={devnet:{id:"devnet",shortId:"D",name:"Devnet",egldLabel:"xEGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://devnet-wallet.multiversx.com",apiAddress:"https://devnet-api.multiversx.com",explorerAddress:"https://devnet-explorer.multiversx.com",apiTimeout:1e4},testnet:{id:"testnet",shortId:"T",name:"Testnet",egldLabel:"xEGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://testnet-wallet.multiversx.com",apiAddress:"https://testnet-api.multiversx.com",explorerAddress:"https://testnet-explorer.multiversx.com",apiTimeout:1e4},mainnet:{id:"mainnet",shortId:"1",name:"Mainnet",egldLabel:"EGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://wallet.multiversx.com",apiAddress:"https://api.multiversx.com",explorerAddress:"https://explorer.multiversx.com",apiTimeout:1e4}};var Ie={get(t){let e=localStorage.getItem(Id);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(Id,JSON.stringify(r))},clear(){localStorage.removeItem(Id)}};var Td=()=>Te(void 0,null,function*(){let t=q2.ExtensionProvider.getInstance();try{let e=yield t.init(),r=Ie.get();if(r!=null&&r.address&&t.setAddress(r.address),!e){console.warn("Something went wrong when trying to initialize the ExtensionProvider..");return}return t}catch(e){console.warn("Can't initialize the Dapp Provider!")}});var e5=_e(RE(),1),t5=_e(tf(),1),r5=_e(uf(),1),n5=_e(Zb(),1);c();var fL=_e(tf(),1);c();c();var Ce=class{static set(e,r){if(!e)return;let n=R_(xf({},this.events),{[e]:r});this.events=n}static get(e){if(!(!e||!this.events))return this.events[e]}static run(e,...r){var n,i;!e||!this.events||(i=(n=this.events)[e])==null||i.call(n,...r)}static clear(){this.events=void 0}};c();var Ro=(i=>(i.ledger="ledger",i.mobile="mobile",i.webWallet="web-wallet",i.browserExtension="browser-extension",i))(Ro||{});var lc=t=>Te(void 0,null,function*(){if(!t.dappProvider)throw new Error("Error: Logout failed: There is no active session!");Ce.run("onLoginPending");let e=yield t.dappProvider.logout();return e&&(Ie.clear(),Ce.run("onLogout")),e});c();var cL=_e(tr(),1),lL=_e($h(),1);c();var Lt=t=>typeof t=="string"?t.toUpperCase():t instanceof Error?t.message:`Error: ${JSON.stringify(t)}`;c();var fc=()=>new Date().setHours(new Date().getHours()+24),Xg=t=>Date.now()>t;var us=t=>Te(void 0,null,function*(){let e=Ie.get("address"),r=Ie.get("expires");if(!(r&&Xg(r))&&e&&t.networkProvider){let i=new cL.Address(e),s=new lL.Account(i);try{let o=yield t.networkProvider.getAccount(i);Ie.set("address",e),Ie.set("nonce",o.nonce.valueOf()),Ie.set("balance",o.balance.toString()),s.update(o)}catch(o){let a=Lt(o);console.warn(`Something went wrong trying to synchronize the user account: ${a}`)}}});c();function Zg(t){return t[Math.floor(Math.random()*t.length)]}var hL=t=>Te(void 0,null,function*(){if(!t.initOptions.walletConnectV2ProjectId||!t.initOptions.chainType)return;let e={onClientLogin:()=>{us(t),Ce.run("onLoggedIn")},onClientLogout:()=>lc(t),onClientEvent:i=>{console.log("wc2 session event: ",i)}},r=Zg(t.initOptions.walletConnectV2RelayAddresses),n=new fL.WalletConnectV2Provider(e,An[t.initOptions.chainType].shortId,r,t.initOptions.walletConnectV2ProjectId);try{return yield n.init(),n}catch(i){console.warn("Can't initialize the Dapp Provider!")}});c();var xL=_e(Yt(),1),o0=_e(tr(),1),NL=_e(dL(),1),OL=_e(wL(),1),DL=_e(i_(),1),PL=_e(IL(),1),RL=_e(CL(),1),BL=_e(TL(),1),LL=_e(td(),1);var a0=class{constructor({apiUrl:e,chainType:r,apiTimeout:n}){var i,s;this.chainType=r||Cd,this.apiUrl=e||((i=An[this.chainType])==null?void 0:i.apiAddress),this.apiTimeout=n||((s=An[this.chainType])==null?void 0:s.apiTimeout)}apiGet(e,r){return Te(this,null,function*(){if(typeof fetch!="undefined"){let n=new AbortController,i=setTimeout(()=>n.abort(),this.apiTimeout),s={method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json"},signal:n.signal};try{let o=yield fetch(this.apiUrl+"/"+e,Object.assign(s,r||{})),a=yield o.json();if(!o.ok){let u=(a==null?void 0:a.error)||o.status;return clearTimeout(i),Promise.reject(u)}return clearTimeout(i),a}catch(o){this.handleApiError(o,e)}}})}apiPost(e,r,n){return Te(this,null,function*(){if(typeof fetch!="undefined"){let i=new AbortController,s=setTimeout(()=>i.abort(),this.apiTimeout),o={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(r||{}),signal:i.signal};try{let a=yield fetch(this.apiUrl+"/"+e,Object.assign(o,n||{})),u=yield a.json();if(!a.ok){let l=(u==null?void 0:u.error)||a.status;return clearTimeout(s),Promise.reject(l)}return clearTimeout(s),u}catch(a){this.handleApiError(a,e)}}})}handleApiError(e,r){if(!e.response)throw new Error(`Request error on url [${r}]: [${e.toString()}]`);let n=e.response.data,i=n.error||n.message||JSON.stringify(n);throw new Error(i)}sendTransaction(e){return Te(this,null,function*(){return(yield this.apiPost("transactions",e.toSendable())).txHash})}getAccount(e){return Te(this,null,function*(){let r=yield this.apiGet(`accounts/${e.bech32()}`);return{address:new o0.Address((r==null?void 0:r.address)||""),nonce:Number((r==null?void 0:r.nonce)||0),balance:new xL.default((r==null?void 0:r.balance)||0),code:(r==null?void 0:r.code)||"",userName:(r==null?void 0:r.username)||""}})}getTransaction(e){return Te(this,null,function*(){let r=yield this.apiGet(`transactions/${e}`),n=new NL.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 o0.Address(r.sender),receiver:new o0.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:OL.TransactionReceipt.fromHttpResponse(r.receipt||{}),logs:DL.TransactionLogs.fromHttpResponse(r.logs||{}),contractResults:PL.ContractResults.fromApiHttpResponse(r.results||[]),isCompleted:!n.isPending()}})}queryContract(o){return Te(this,arguments,function*({address:e,func:r,args:n,value:i,caller:s}){try{let a=new LL.Query({address:e,func:r,args:n,value:i,caller:s}),u=new BL.ContractQueryRequest(a).toHttpRequest(),l=yield this.apiPost("query",u);return RL.ContractQueryResponse.fromHttpResponse(l)}catch(a){this.handleApiError(a,"query")}})}};c();var FL=(t,e,r,n="/")=>Te(void 0,null,function*(){let i=yield Td(),o={callbackUrl:encodeURIComponent(`${window.location.origin}${n}`),token:e};try{i&&(yield i.login(o)),Ce.run("onLoginPending")}catch(u){let l=Lt(u);console.warn(`Something went wrong trying to login the user: ${l}`)}if(!i)throw new Error("Error: There were problems with auth provider initialization!");let{signature:a}=i.account;if(Ie.set("loginToken",e),a&&Ie.set("signature",a),t.networkProvider&&a)try{let u=yield i.getAddress();if(!u)throw new Error("Canceled!");Ie.set("address",u),Ie.set("loginMethod","browser-extension"),Ie.set("expires",fc()),yield us(t),Ce.run("onLoggedIn");let l=r.getToken(u,e,a);return Ie.set("accessToken",l),i}catch(u){console.warn(`Something went wrong trying to synchronize the user account: ${u==null?void 0:u.message}`),Ce.run("onLogout")}});c();c();var qF=_e(UF(),1),VF=_e(tf(),1);var cte=t=>{var r;let e=document.createElement("template");return e.innerHTML=t.trim(),(r=e.content.firstChild)==null?void 0:r.cloneNode(!0)},lte=t=>{let e=`${M2}?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},fte=()=>{let t=document.createElement("div");return t.classList.add("elven-wc-pairings"),t},hte=()=>{let t=document.createElement("div");return t.textContent="Existing WalletConnect pairings:",t.classList.add("elven-wc-pairings-header"),t},N_={},dte=(t,e)=>{let r=document.createElement("button");return r.classList.add("elven-wc-pairings-remove-btn"),r.textContent="\u2716",N_[t.topic]=new AbortController,r.addEventListener("click",n=>{n.stopImmediatePropagation(),e(t.topic)},{signal:N_[t.topic].signal}),r},E0={},pte=(t,e,r)=>{var o,a;let n=document.createElement("div"),i=document.createElement("div");n.classList.add("elven-wc-pairing-item"),n.setAttribute("id",t.topic),i.classList.add("elven-wc-pairing-item-description"),i.textContent=`${(o=t.peerMetadata)==null?void 0:o.description} (${(a=t.peerMetadata)==null?void 0:a.url})`,n.appendChild(i);let s=dte(t,e);return n.appendChild(s),E0[t.topic]=new AbortController,n.addEventListener("click",()=>r(t.topic),{signal:E0[t.topic].signal}),n},gte=()=>{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},yte=t=>{if(!t)return;let e=document.getElementById(t);e==null||e.remove()},mte=()=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),wte=t=>Te(void 0,null,function*(){return t?yield qF.default.toString(t,{type:"svg"}):void 0}),jF=(t,e,r,n)=>Te(void 0,null,function*(){if(!t)throw new Error("Please provide the QR Code and WalletConnect Pairings container id!");let i=null;typeof t=="string"?i=document.getElementById(t):t instanceof HTMLElement&&(i=t);let s=yield wte(e),o;if(s&&(o=cte(s)),i&&o&&(i.replaceChildren(),i.appendChild(o),mte()&&i.appendChild(lte(e))),i&&r instanceof VF.WalletConnectV2Provider){let a=r.pairings,u=f=>Te(void 0,null,function*(){try{f&&(yield r.logout({topic:f}),yte(f))}catch(d){let y=Lt(d);console.warn(`Something went wrong trying to remove the existing pairing: ${y}`)}finally{E0[f].abort()}}),l=f=>Te(void 0,null,function*(){try{let{approval:d}=yield r.connect({topic:f,methods:["mvx_cancelAction"]});if(!document.getElementById("elven-wc-pairing-item-confirm-msessage")){let m=document.getElementById(f);m==null||m.after(gte())}yield r.login({approval:d,token:n})}catch(d){let y=Lt(d);console.warn(`Something went wrong trying to login the user: ${y}`)}finally{for(let d of Object.values(E0))d==null||d.abort();for(let d of Object.values(N_))d==null||d.abort()}});if(a&&a.length>0){let f=fte();i.appendChild(f);let d=hte();f.appendChild(d);for(let y of a){let m=pte(y,u,l);f.appendChild(m)}}}return i});var v0=_e(tf(),1);var HF=(t,e,r,n)=>Te(void 0,null,function*(){if(!n)throw new Error("You haven't provided the QR code container DOM element id");let i=Zg(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:()=>Te(void 0,null,function*(){if(t.dappProvider instanceof v0.WalletConnectV2Provider){Ce.run("onLoginPending");let u=yield t.dappProvider.getAddress(),l=yield t.dappProvider.getSignature();Ie.set("address",u),Ie.set("loginMethod","mobile"),Ie.set("expires",fc()),yield us(t),l&&Ie.set("signature",l),Ie.set("loginToken",e);let f=r.getToken(u,e,l);Ie.set("accessToken",f),Ce.run("onLoggedIn"),s==null||s.replaceChildren()}}),onClientLogout:()=>Te(void 0,null,function*(){t.dappProvider instanceof v0.WalletConnectV2Provider&&(yield lc(t),Ce.run("onLogout"))}),onClientEvent:u=>{console.log("wc2 session event: ",u)}},a=new v0.WalletConnectV2Provider(o,An[t.initOptions.chainType].shortId,i,t.initOptions.walletConnectV2ProjectId);try{if(a){t.dappProvider=a,Ce.run("onQrPending"),yield a.init();let{uri:u,approval:l}=yield a.connect({methods:["mvx_cancelAction"]}),f=e?`${u}&token=${e}`:u;return n&&f&&(s=yield jF(n,f,a,e),Ce.run("onQrLoaded")),yield a.login({approval:l,token:e}),a}}catch(u){let l=Lt(u);console.warn(`Something went wrong trying to login the user: ${l}`),Ce.run("onLogout")}});c();var GF=_e(uf(),1);var QF=(t,e,r)=>Te(void 0,null,function*(){let n=new GF.WalletProvider(`${t}${Sd}`),s={callbackUrl:typeof window!="undefined"?encodeURIComponent(`${window.location.origin}${r||"/"}`):"/",token:e};try{return Ce.run("onLoginPending"),Ie.set("loginMethod","web-wallet"),yield n.login(s),Ie.set("expires",fc()),Ie.set("loginToken",e),n}catch(o){let a=Lt(o);console.warn(`Something went wrong trying to login the user: ${a}`),Ie.set("loginMethod",""),Ce.run("onLogout")}});c();var qo=t=>{if(typeof window!="undefined"){let e=new URL(window.location.href);return new URLSearchParams(e.search).get(t)}};c();var kF=_e(uf(),1);var zF=_e(Zb(),1);var WF=(t,e)=>Te(void 0,null,function*(){let r=qo("signature"),n=qo("address"),i=Ie.get("address"),s=Ie.get("loginToken");if(r&&Ie.set("signature",r),n||i){n&&(Ie.set("address",n),window.history.replaceState(null,"",window.location.pathname));let o=new kF.WalletProvider(`${t}${Sd}`);if(r&&e&&n){let u=new zF.NativeAuthClient({apiUrl:e}).getToken(n,s,r);Ie.set("accessToken",u)}return o}});c();var KF=_e($h(),1),$F=_e(Rw(),1);var A0=(t,e)=>Te(void 0,null,function*(){Ce.run("onTxSent",t),yield new $F.TransactionWatcher(e).awaitCompleted(t);let n=t.getSender(),i=new KF.Account(n),s=yield e.getAccount(n);i.update(s),Ie.set("address",i.address.bech32()),Ie.set("nonce",i.getNonceThenIncrement().valueOf()),Ie.set("balance",i.balance.toString()),Ce.run("onTxFinalized",t)});c();var b0=_e(JF(),1),XF=_e(Wc(),1);var ZF=(t,e,r)=>Te(void 0,null,function*(){if(qo(b0.WALLET_PROVIDER_CALLBACK_PARAM)===b0.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED&&t&&e&&"getTransactionsFromWalletUrl"in t){let i=t.getTransactionsFromWalletUrl();window.history.replaceState(null,"",window.location.pathname);let s=i==null?void 0:i[0];if(s){s.data=h.Buffer.from(s.data).toString("base64");let o=XF.Transaction.fromPlainObject(s);o.setNonce(r);try{Ce.run("onTxStarted",o),yield e.sendTransaction(o),yield A0(o,e)}catch(a){let u=Lt(a);throw Ce.run("onTxError",o,u),new Error(`Error: Transaction signing failed! ${u}`)}}}});var Cf=class{static init(e){return Te(this,null,function*(){let r=Ie.get();if(r.expires&&Xg(r.expires)){Ie.clear(),this.dappProvider=void 0;return}this.initOptions=xf({chainType:Cd,apiUrl:F2,apiTimeout:1e4,walletConnectV2ProjectId:"",walletConnectV2RelayAddresses:U2},e),this.networkProvider=new a0(this.initOptions),this.initOptions.onLoginPending&&Ce.set("onLoginPending",this.initOptions.onLoginPending),this.initOptions.onLoggedIn&&Ce.set("onLoggedIn",this.initOptions.onLoggedIn),this.initOptions.onQrPending&&Ce.set("onQrPending",this.initOptions.onQrPending),this.initOptions.onQrLoaded&&Ce.set("onQrLoaded",this.initOptions.onQrLoaded),this.initOptions.onLogout&&Ce.set("onLogout",this.initOptions.onLogout),this.initOptions.onTxStarted&&Ce.set("onTxStarted",this.initOptions.onTxStarted),this.initOptions.onTxSent&&Ce.set("onTxSent",this.initOptions.onTxSent),this.initOptions.onTxFinalized&&Ce.set("onTxFinalized",this.initOptions.onTxFinalized),this.initOptions.onTxError&&Ce.set("onTxError",this.initOptions.onTxError),((r==null?void 0:r.address)||r.loginMethod==="web-wallet"&&qo("address"))&&(r!=null&&r.loginMethod)&&(Ce.run("onLoginPending"),r.loginMethod==="browser-extension"&&(this.dappProvider=yield Td()),r.loginMethod==="mobile"&&(this.dappProvider=yield hL(this)),r.loginMethod==="web-wallet"&&this.initOptions.chainType&&(this.dappProvider=yield WF(An[this.initOptions.chainType].walletAddress,this.initOptions.apiUrl)),yield us(this),Ce.run("onLoggedIn"),r.loginMethod==="web-wallet"&&(yield ZF(this.dappProvider,this.networkProvider,r.nonce)))})}static login(e,r){return Te(this,null,function*(){var o,a;if(!Object.values(Ro).includes(e))throw new Error("Error: Wrong login method!");if(!this.networkProvider)throw new Error("Error: Login failed: Use ElvenJs.init() first!");let i=new n5.NativeAuthClient({apiUrl:(o=this.initOptions)==null?void 0:o.apiUrl}),s=yield i.initialize();try{if(e==="browser-extension"){let u=yield FL(this,s,i,r==null?void 0:r.callbackRoute);this.dappProvider=u}if(e==="mobile"){let u=yield HF(this,s,i,r==null?void 0:r.qrCodeContainer);this.dappProvider=u}if(e==="web-wallet"&&((a=this.initOptions)!=null&&a.chainType)){let u=yield QF(An[this.initOptions.chainType].walletAddress,s,r==null?void 0:r.callbackRoute);this.dappProvider=u}}catch(u){let l=Lt(u);throw new Error(`Error: ${l}`)}})}static logout(){return Te(this,null,function*(){try{let e=yield lc(this);return this.dappProvider=void 0,e}catch(e){let r=Lt(e);console.warn("Something went wrong when logging out: ",r)}})}static signAndSendTransaction(e){return Te(this,null,function*(){if(!this.dappProvider)throw new Error("Error: Transaction signing failed: There is no active session!");if(!this.networkProvider)throw new Error("Error: Transaction signing failed: There is no active network provider!");try{Ce.run("onTxStarted",e);let r=Ie.get();e.setNonce(r.nonce),this.dappProvider instanceof e5.ExtensionProvider&&(yield this.dappProvider.signTransaction(e)),this.dappProvider instanceof t5.WalletConnectV2Provider&&(yield this.dappProvider.signTransaction(e)),this.dappProvider instanceof r5.WalletProvider&&(yield this.dappProvider.signTransaction(e)),r.loginMethod!=="web-wallet"&&(yield this.networkProvider.sendTransaction(e),yield A0(e,this.networkProvider))}catch(r){let n=Lt(r);throw Ce.run("onTxError",e,n),new Error(`Error: Transaction signing failed! ${n}`)}return e})}static queryContract(o){return Te(this,arguments,function*({address:e,func:r,args:n=[],value:i=0,caller:s}){if(!this.networkProvider)throw new Error("Error: Query failed: There is no active network provider!");if(!e||!r)throw new Error("Error: Query failed: The Query arguments are not valid! Address and func required");try{return yield this.networkProvider.queryContract({address:e,func:r,args:n,value:i,caller:s})}catch(a){let u=Lt(a);throw new Error(`Error: Smart contract query failed! ${u}`)}})}},Sf=Cf;Sf.storage=Ie,Sf.destroy=()=>{Cf.networkProvider=void 0,Cf.dappProvider=void 0,Cf.initOptions=void 0,Ce.clear()};var export_Account=Ite.Account;var export_Address=_te.Address;var export_AddressType=o5.AddressType;var export_AddressValue=o5.AddressValue;var export_BigUIntType=Bn.BigUIntType;var export_BigUIntValue=Bn.BigUIntValue;var export_BooleanType=s5.BooleanType;var export_BooleanValue=s5.BooleanValue;var export_BytesType=i5.BytesType;var export_BytesValue=i5.BytesValue;var export_ContractFunction=Nte.ContractFunction;var export_GasEstimator=bte.GasEstimator;var export_SmartContract=xte.SmartContract;var export_TokenTransfer=vte.TokenTransfer;var export_Transaction=Ste.Transaction;var export_TransactionPayload=Cte.TransactionPayload;var export_TransactionWatcher=Tte.TransactionWatcher;var export_TransferTransactionsFactory=Ate.TransferTransactionsFactory;var export_U16Type=Bn.U16Type;var export_U16Value=Bn.U16Value;var export_U32Type=Bn.U32Type;var export_U32Value=Bn.U32Value;var export_U64Type=Bn.U64Type;var export_U64Value=Bn.U64Value;var export_U8Type=Bn.U8Type;var export_U8Value=Bn.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,Sf as ElvenJS,export_GasEstimator as GasEstimator,Ro as LoginMethodsEnum,export_SmartContract as SmartContract,export_TokenTransfer as TokenTransfer,export_Transaction as Transaction,export_TransactionPayload as TransactionPayload,export_TransactionWatcher as TransactionWatcher,export_TransferTransactionsFactory as TransferTransactionsFactory,export_U16Type as U16Type,export_U16Value as U16Value,export_U32Type as U32Type,export_U32Value as U32Value,export_U64Type as U64Type,export_U64Value as U64Value,export_U8Type as U8Type,export_U8Value as U8Value}; +`);let o=Vre(e,r,i),a=wy.getSymbolSize(e),u=new Nre(a);return Lre(u,e),Fre(u),Mre(u,e),EI(u,r,0),e>=7&&Ure(u,e),qre(u,o),isNaN(n)&&(n=wI.getBestMask(u,EI.bind(null,u,r))),wI.applyMask(n,u),EI(u,r,n),{modules:u,version:e,errorCorrectionLevel:r,maskPattern:n,segments:i}}GM.create=function(e,r){if(typeof e>"u"||e==="")throw new Error("No input text");let n=yI.M,i,s;return typeof r<"u"&&(n=yI.from(r.errorCorrectionLevel,yI.M),i=Ey.from(r.version),s=wI.from(r.maskPattern),r.toSJISFunc&&wy.setToSJISFunction(r.toSJISFunc)),jre(e,i,n,s)}});var AI=m(co=>{c();function QM(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("")}}co.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:QM(e.color.dark||"#000000ff"),light:QM(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}};co.getScale=function(e,r){return r.width&&r.width>=e+r.margin*2?r.width/(e+r.margin*2):r.scale};co.getImageWidth=function(e,r){let n=co.getScale(e,r);return Math.floor((e+r.margin*2)*n)};co.qrToImageData=function(e,r,n){let i=r.modules.size,s=r.modules.data,o=co.getScale(i,n),a=Math.floor((i+n.margin*2)*o),u=n.margin*o,l=[n.color.light,n.color.dark];for(let f=0;f=u&&d>=u&&f{c();var bI=AI();function Gre(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 kre(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}vy.render=function(e,r,n){let i=n,s=r;typeof i>"u"&&(!r||!r.getContext)&&(i=r,r=void 0),r||(s=kre()),i=bI.getOptions(i);let o=bI.getImageWidth(e.modules.size,i),a=s.getContext("2d"),u=a.createImageData(o,o);return bI.qrToImageData(u.data,e,i),Gre(a,s,o),a.putImageData(u,0,0),s};vy.renderToDataURL=function(e,r,n){let i=n;typeof i>"u"&&(!r||!r.getContext)&&(i=r,r=void 0),i||(i={});let s=vy.render(e,r,i),o=i.type||"image/png",a=i.rendererOpts||{};return s.toDataURL(o,a.quality)}});var KM=m($M=>{c();var Qre=AI();function zM(t,e){let r=t.a/255,n=e+'="'+t.hex+'"';return r<1?n+" "+e+'-opacity="'+r.toFixed(2).slice(1)+'"':n}function _I(t,e,r){let n=t+e;return typeof r<"u"&&(n+=" "+r),n}function Wre(t,e,r){let n="",i=0,s=!1,o=0;for(let a=0;a0&&u>0&&t[a-1]||(n+=s?_I("M",u+r,.5+l+r):_I("m",i,0),i=0,s=!1),u+1':"",l="',f='viewBox="0 0 '+a+" "+a+'"',g=''+u+l+` +`;return typeof n=="function"&&n(null,g),g}});var JM=m(Ml=>{c();var zre=JF(),II=kM(),YM=WM(),$re=KM();function SI(t,e,r,n,i){let s=[].slice.call(arguments,1),o=s.length,a=typeof s[o-1]=="function";if(!a&&!zre())throw new Error("Callback required as last argument");if(a){if(o<2)throw new Error("Too few arguments provided");o===2?(i=r,r=e,e=n=void 0):o===3&&(e.getContext&&typeof i>"u"?(i=n,n=void 0):(i=n,n=r,r=e,e=void 0))}else{if(o<1)throw new Error("Too few arguments provided");return o===1?(r=e,e=n=void 0):o===2&&!e.getContext&&(n=r,r=e,e=void 0),new Promise(function(u,l){try{let f=II.create(r,n);u(t(f,e,n))}catch(f){l(f)}})}try{let u=II.create(r,n);i(null,t(u,e,n))}catch(u){i(u)}}Ml.create=II.create;Ml.toCanvas=SI.bind(null,YM.render);Ml.toDataURL=SI.bind(null,YM.renderToDataURL);Ml.toString=SI.bind(null,function(t,e,r){return $re.render(t,r)})});var lU=m(us=>{"use strict";c();var one=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]}),cU=us&&us.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&one(e,t,r)};Object.defineProperty(us,"__esModule",{value:!0});cU(Il(),us);cU(g_(),us)});c();var ane=Ie(sm(),1),une=Ie(VE(),1),cne=Ie(jE(),1),lne=Ie(yt(),1),fne=Ie(Ss(),1),hne=Ie(yn(),1),dne=Ie(qn(),1),pne=Ie(Gh(),1),gne=Ie(Jw(),1),yne=Ie(fc(),1),wU=Ie(di(),1),Rn=Ie(Ku(),1),vU=Ie(Du(),1),AU=Ie(Io(),1);c();c();var EO=Ie(ev(),1);c();c();var gd="elvenjs_state",gO="https://devnet-api.multiversx.com";var yd="/dapp/init",md="devnet",yO="https://maiar.page.link/?apn=com.elrond.maiar.wallet&isi=1519405832&ibi=com.elrond.maiar.wallet&link=https://xportal.com/",mO=["wss://relay.walletconnect.com"],An={devnet:{id:"devnet",shortId:"D",name:"Devnet",egldLabel:"xEGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://devnet-wallet.multiversx.com",apiAddress:"https://devnet-api.multiversx.com",explorerAddress:"https://devnet-explorer.multiversx.com",apiTimeout:1e4},testnet:{id:"testnet",shortId:"T",name:"Testnet",egldLabel:"xEGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://testnet-wallet.multiversx.com",apiAddress:"https://testnet-api.multiversx.com",explorerAddress:"https://testnet-explorer.multiversx.com",apiTimeout:1e4},mainnet:{id:"mainnet",shortId:"1",name:"Mainnet",egldLabel:"EGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://wallet.multiversx.com",apiAddress:"https://api.multiversx.com",explorerAddress:"https://explorer.multiversx.com",apiTimeout:1e4}};var Se={get(t){let e=localStorage.getItem(gd);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(gd,JSON.stringify(r))},clear(){localStorage.removeItem(gd)}};var Ed=async()=>{let t=EO.ExtensionProvider.getInstance();try{let e=await t.init(),r=Se.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 pU=Ie(ev(),1),gU=Ie(El(),1),yU=Ie(Il(),1),mU=Ie(G_(),1);c();var IF=Ie(El(),1);c();c();var Ce=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}};c();var io=(i=>(i.ledger="ledger",i.mobile="mobile",i.webWallet="web-wallet",i.browserExtension="browser-extension",i))(io||{});var lu=async t=>{if(!t.dappProvider)throw new Error("Error: Logout failed: There is no active session!");Ce.run("onLoginPending");let e=await t.dappProvider.logout();return e&&(Se.clear(),Ce.run("onLogout")),e};c();var bF=Ie(yt(),1),_F=Ie(Ss(),1);c();var qt=t=>typeof t=="string"?t.toUpperCase():t instanceof Error?t.message:`Error: ${JSON.stringify(t)}`;c();var fu=()=>new Date().setHours(new Date().getHours()+24),ey=t=>Date.now()>t;var ts=async t=>{let e=Se.get("address"),r=Se.get("expires");if(!(r&&ey(r))&&e&&t.networkProvider){let i=new bF.Address(e),s=new _F.Account(i);try{let o=await t.networkProvider.getAccount(i);Se.set("address",e),Se.set("nonce",o.nonce.valueOf()),Se.set("balance",o.balance.toString()),s.update(o)}catch(o){let a=qt(o);console.warn(`Something went wrong trying to synchronize the user account: ${a}`)}}};c();function ty(t){return t[Math.floor(Math.random()*t.length)]}var SF=async t=>{if(!t.initOptions.walletConnectV2ProjectId||!t.initOptions.chainType)return;let e={onClientLogin:()=>{ts(t),Ce.run("onLoggedIn")},onClientLogout:()=>lu(t),onClientEvent:i=>{console.log("wc2 session event: ",i)}},r=ty(t.initOptions.walletConnectV2RelayAddresses),n=new IF.WalletConnectV2Provider(e,An[t.initOptions.chainType].shortId,r,t.initOptions.walletConnectV2ProjectId);try{return await n.init(),n}catch{console.warn("Can't initialize the Dapp Provider!")}};c();var HF=Ie(jt(),1),uy=Ie(yt(),1),jF=Ie(CF(),1),GF=Ie(DF(),1),kF=Ie(Z_(),1),QF=Ie(MF(),1),WF=Ie(qF(),1),zF=Ie(VF(),1),$F=Ie(hc(),1);var cy=class{constructor({apiUrl:e,chainType:r,apiTimeout:n}){this.chainType=r||md,this.apiUrl=e||An[this.chainType]?.apiAddress,this.apiTimeout=n||An[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 l=u?.error||a.status;return clearTimeout(s),Promise.reject(l)}return clearTimeout(s),u}catch(a){this.handleApiError(a,e)}}}handleApiError(e,r){if(!e.response)throw new Error(`Request error on url [${r}]: [${e.toString()}]`);let n=e.response.data,i=n.error||n.message||JSON.stringify(n);throw new Error(i)}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 uy.Address(r?.address||""),nonce:Number(r?.nonce||0),balance:new HF.default(r?.balance||0),code:r?.code||"",userName:r?.username||""}}async getTransaction(e){let r=await this.apiGet(`transactions/${e}`),n=new jF.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 uy.Address(r.sender),receiver:new uy.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:GF.TransactionReceipt.fromHttpResponse(r.receipt||{}),logs:kF.TransactionLogs.fromHttpResponse(r.logs||{}),contractResults:QF.ContractResults.fromApiHttpResponse(r.results||[]),isCompleted:!n.isPending()}}async queryContract({address:e,func:r,args:n,value:i,caller:s}){try{let o=new $F.Query({address:e,func:r,args:n,value:i,caller:s}),a=new zF.ContractQueryRequest(o).toHttpRequest(),u=await this.apiPost("query",a);return WF.ContractQueryResponse.fromHttpResponse(u)}catch(o){this.handleApiError(o,"query")}}};c();var KF=async(t,e,r,n="/")=>{let i=await Ed(),o={callbackUrl:encodeURIComponent(`${window.location.origin}${n}`),token:e};try{i&&(await i.login(o)?Ce.run("onLoginPending"):Ce.run("onLogout"))}catch(u){let l=qt(u);console.warn(`Something went wrong trying to login the user: ${l}`)}if(!i)throw new Error("Error: There were problems with auth provider initialization!");let{signature:a}=i.account;if(Se.set("loginToken",e),a&&Se.set("signature",a),t.networkProvider&&a)try{let u=await i.getAddress();if(!u)throw new Error("Canceled!");Se.set("address",u),Se.set("loginMethod","browser-extension"),Se.set("expires",fu()),await ts(t),Ce.run("onLoggedIn");let l=r.getToken(u,e,a);return Se.set("accessToken",l),i}catch(u){console.warn(`Something went wrong trying to synchronize the user account: ${u?.message}`),Ce.run("onLogout")}};c();c();var XM=Ie(JM(),1),ZM=Ie(El(),1);var Yre=t=>{let e=document.createElement("template");return e.innerHTML=t.trim(),e.content.firstChild?.cloneNode(!0)},Jre=t=>{let e=`${yO}?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},Xre=()=>{let t=document.createElement("div");return t.classList.add("elven-wc-pairings"),t},Zre=()=>{let t=document.createElement("div");return t.textContent="Existing WalletConnect pairings:",t.classList.add("elven-wc-pairings-header"),t},CI={},ene=(t,e)=>{let r=document.createElement("button");return r.classList.add("elven-wc-pairings-remove-btn"),r.textContent="\u2716",CI[t.topic]=new AbortController,r.addEventListener("click",n=>{n.stopImmediatePropagation(),e(t.topic)},{signal:CI[t.topic].signal}),r},Ay={},tne=(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=ene(t,e);return n.appendChild(s),Ay[t.topic]=new AbortController,n.addEventListener("click",()=>r(t.topic),{signal:Ay[t.topic].signal}),n},rne=()=>{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},nne=t=>{if(!t)return;document.getElementById(t)?.remove()},ine=()=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),sne=async t=>t?await XM.default.toString(t,{type:"svg"}):void 0,eU=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 sne(e),o;if(s&&(o=Yre(s)),i&&o&&(i.replaceChildren(),i.appendChild(o),ine()&&i.appendChild(Jre(e))),i&&r instanceof ZM.WalletConnectV2Provider){let a=r.pairings,u=async f=>{try{f&&(await r.logout({topic:f}),nne(f))}catch(d){let g=qt(d);console.warn(`Something went wrong trying to remove the existing pairing: ${g}`)}finally{Ay[f].abort()}},l=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(rne()),await r.login({approval:d,token:n})}catch(d){let g=qt(d);console.warn(`Something went wrong trying to login the user: ${g}`)}finally{for(let d of Object.values(Ay))d?.abort();for(let d of Object.values(CI))d?.abort()}};if(a&&a.length>0){let f=Xre();i.appendChild(f);let d=Zre();f.appendChild(d);for(let g of a){let E=tne(g,u,l);f.appendChild(E)}}}return i};var by=Ie(El(),1);var tU=async(t,e,r,n)=>{if(!n)throw new Error("You haven't provided the QR code container DOM element id");let i=ty(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 by.WalletConnectV2Provider){Ce.run("onLoginPending");let u=await t.dappProvider.getAddress(),l=await t.dappProvider.getSignature();Se.set("address",u),Se.set("loginMethod","mobile"),Se.set("expires",fu()),await ts(t),l&&Se.set("signature",l),Se.set("loginToken",e);let f=r.getToken(u,e,l);Se.set("accessToken",f),Ce.run("onLoggedIn"),s?.replaceChildren()}},onClientLogout:async()=>{t.dappProvider instanceof by.WalletConnectV2Provider&&(await lu(t),Ce.run("onLogout"))},onClientEvent:u=>{console.log("wc2 session event: ",u)}},a=new by.WalletConnectV2Provider(o,An[t.initOptions.chainType].shortId,i,t.initOptions.walletConnectV2ProjectId);try{if(a){t.dappProvider=a,Ce.run("onQrPending"),await a.init();let{uri:u,approval:l}=await a.connect({methods:["mvx_cancelAction","mvx_signNativeAuthToken"]}),f=e?`${u}&token=${e}`:u;return n&&f&&(s=await eU(n,f,a,e),Ce.run("onQrLoaded")),await a.login({approval:l,token:e}),a}}catch(u){let l=qt(u);console.warn(`Something went wrong trying to login the user: ${l}`),Ce.run("onLogout")}};c();var rU=Ie(Il(),1);var nU=async(t,e,r)=>{let n=new rU.WalletProvider(`${t}${yd}`),s={callbackUrl:typeof window<"u"?encodeURIComponent(`${window.location.origin}${r||"/"}`):"/",token:e};try{return Ce.run("onLoginPending"),Se.set("loginMethod","web-wallet"),await n.login(s),Se.set("expires",fu()),Se.set("loginToken",e),n}catch(o){let a=qt(o);console.warn(`Something went wrong trying to login the user: ${a}`),Se.set("loginMethod",""),Ce.run("onLogout")}};c();var lo=t=>{if(typeof window<"u"){let e=new URL(window.location.href);return new URLSearchParams(e.search).get(t)}};c();var iU=Ie(Il(),1);var sU=Ie(G_(),1),oU=async(t,e)=>{let r=lo("signature"),n=lo("address"),i=Se.get("address"),s=Se.get("loginToken");if(r&&Se.set("signature",r),n||i){n&&(Se.set("address",n),window.history.replaceState(null,"",window.location.pathname));let o=new iU.WalletProvider(`${t}${yd}`);if(r&&e&&n){let u=new sU.NativeAuthClient({apiUrl:e,origin:window.location.origin}).getToken(n,s,r);Se.set("accessToken",u)}return o}};c();var aU=Ie(Ss(),1),uU=Ie(Gh(),1);var _y=async(t,e)=>{Ce.run("onTxSent",t),await new uU.TransactionWatcher(e).awaitCompleted(t);let n=t.getSender(),i=new aU.Account(n),s=await e.getAccount(n);i.update(s),Se.set("address",i.address.bech32()),Se.set("balance",i.balance.toString()),Ce.run("onTxFinalized",t)};c();var Iy=Ie(lU(),1),fU=Ie(Ss(),1),hU=Ie(yn(),1);var dU=async(t,e,r)=>{if(lo(Iy.WALLET_PROVIDER_CALLBACK_PARAM)===Iy.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED&&t&&e&&"getTransactionsFromWalletUrl"in t){let i=t.getTransactionsFromWalletUrl();window.history.replaceState(null,"",window.location.pathname);let s=i?.[0];if(s){s.data=h.Buffer.from(s.data).toString("base64");let o=hU.Transaction.fromPlainObject(s);o.setNonce(r);let a=o.getSender(),u=new fU.Account(a),l=o.getNonce().valueOf();u.incrementNonce(),Se.set("nonce",l+1);try{Ce.run("onTxStarted",o),await e.sendTransaction(o),await _y(o,e)}catch(f){let d=qt(f);throw Ce.run("onTxError",o,d),new Error(`Error: Transaction signing failed! ${d}`)}}}};var EU=Ie(Ss(),1),TI=class{static async init(e){let r=Se.get();if(r.expires&&ey(r.expires)){Se.clear(),this.dappProvider=void 0;return}this.initOptions={chainType:md,apiUrl:gO,apiTimeout:1e4,walletConnectV2ProjectId:"",walletConnectV2RelayAddresses:mO,...e},this.networkProvider=new cy(this.initOptions),this.initOptions.onLoginPending&&Ce.set("onLoginPending",this.initOptions.onLoginPending),this.initOptions.onLoggedIn&&Ce.set("onLoggedIn",this.initOptions.onLoggedIn),this.initOptions.onQrPending&&Ce.set("onQrPending",this.initOptions.onQrPending),this.initOptions.onQrLoaded&&Ce.set("onQrLoaded",this.initOptions.onQrLoaded),this.initOptions.onLogout&&Ce.set("onLogout",this.initOptions.onLogout),this.initOptions.onTxStarted&&Ce.set("onTxStarted",this.initOptions.onTxStarted),this.initOptions.onTxSent&&Ce.set("onTxSent",this.initOptions.onTxSent),this.initOptions.onTxFinalized&&Ce.set("onTxFinalized",this.initOptions.onTxFinalized),this.initOptions.onTxError&&Ce.set("onTxError",this.initOptions.onTxError),(r?.address||r.loginMethod==="web-wallet"&&lo("address"))&&r?.loginMethod&&(Ce.run("onLoginPending"),r.loginMethod==="browser-extension"&&(this.dappProvider=await Ed()),r.loginMethod==="mobile"&&(this.dappProvider=await SF(this)),r.loginMethod==="web-wallet"&&this.initOptions.chainType&&(this.dappProvider=await oU(An[this.initOptions.chainType].walletAddress,this.initOptions.apiUrl)),await ts(this),Ce.run("onLoggedIn"),r.loginMethod==="web-wallet"&&await dU(this.dappProvider,this.networkProvider,r.nonce))}static async login(e,r){if(!Object.values(io).includes(e))throw new Error("Error: Wrong login method!");if(!this.networkProvider)throw new Error("Error: Login failed: Use ElvenJs.init() first!");try{Ce.run("onLoginPending");let i=new mU.NativeAuthClient({apiUrl:this.initOptions?.apiUrl,origin:window.location.origin}),s=await i.initialize();if(e==="browser-extension"){let o=await KF(this,s,i,r?.callbackRoute);this.dappProvider=o}if(e==="mobile"){let o=await tU(this,s,i,r?.qrCodeContainer);this.dappProvider=o}if(e==="web-wallet"&&this.initOptions?.chainType){let o=await nU(An[this.initOptions.chainType].walletAddress,s,r?.callbackRoute);this.dappProvider=o}}catch(i){let s=qt(i);throw new Error(`Error: ${s}`)}}static async logout(){try{let e=await lu(this);return this.dappProvider=void 0,e}catch(e){let r=qt(e);console.warn("Something went wrong when logging out: ",r)}}static async signAndSendTransaction(e){if(!this.dappProvider)throw new Error("Error: Transaction signing failed: There is no active session!");if(!this.networkProvider)throw new Error("Error: Transaction signing failed: There is no active network provider!");try{Ce.run("onTxStarted",e);let r=Se.get();if(e.setNonce(r.nonce),this.dappProvider instanceof pU.ExtensionProvider){let i=(await this.dappProvider.signTransaction(e)).getSignature();e.applySignature(i)}if(this.dappProvider instanceof gU.WalletConnectV2Provider&&await this.dappProvider.signTransaction(e),this.dappProvider instanceof yU.WalletProvider&&await this.dappProvider.signTransaction(e),r.loginMethod!=="web-wallet"){let n=e.getSender(),i=new EU.Account(n),s=e.getNonce().valueOf();i.incrementNonce(),Se.set("nonce",s+1),await this.networkProvider.sendTransaction(e),await _y(e,this.networkProvider)}}catch(r){let n=qt(r);throw Ce.run("onTxError",e,n),new Error(`Error: Transaction signing failed! ${n}`)}return e}static async queryContract({address:e,func:r,args:n=[],value:i=0,caller:s}){if(!this.networkProvider)throw new Error("Error: Query failed: There is no active network provider!");if(!e||!r)throw new Error("Error: Query failed: The Query arguments are not valid! Address and func required");try{return await this.networkProvider.queryContract({address:e,func:r,args:n,value:i,caller:s})}catch(o){let a=qt(o);throw new Error(`Error: Smart contract query failed! ${a}`)}}static{this.storage=Se}static{this.destroy=()=>{this.networkProvider=void 0,this.dappProvider=void 0,this.initOptions=void 0,Ce.clear()}}};var export_Account=fne.Account;var export_Address=lne.Address;var export_AddressType=AU.AddressType;var export_AddressValue=AU.AddressValue;var export_BigUIntType=Rn.BigUIntType;var export_BigUIntValue=Rn.BigUIntValue;var export_BooleanType=vU.BooleanType;var export_BooleanValue=vU.BooleanValue;var export_BytesType=wU.BytesType;var export_BytesValue=wU.BytesValue;var export_ContractFunction=yne.ContractFunction;var export_GasEstimator=cne.GasEstimator;var export_SmartContract=gne.SmartContract;var export_TokenTransfer=ane.TokenTransfer;var export_Transaction=hne.Transaction;var export_TransactionPayload=dne.TransactionPayload;var export_TransactionWatcher=pne.TransactionWatcher;var export_TransferTransactionsFactory=une.TransferTransactionsFactory;var export_U16Type=Rn.U16Type;var export_U16Value=Rn.U16Value;var export_U32Type=Rn.U32Type;var export_U32Value=Rn.U32Value;var export_U64Type=Rn.U64Type;var export_U64Value=Rn.U64Value;var export_U8Type=Rn.U8Type;var export_U8Value=Rn.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,TI as ElvenJS,export_GasEstimator as GasEstimator,io as LoginMethodsEnum,export_SmartContract as SmartContract,export_TokenTransfer as TokenTransfer,export_Transaction as Transaction,export_TransactionPayload as TransactionPayload,export_TransactionWatcher as TransactionWatcher,export_TransferTransactionsFactory as TransferTransactionsFactory,export_U16Type as U16Type,export_U16Value as U16Value,export_U32Type as U32Type,export_U32Value as U32Value,export_U64Type as U64Type,export_U64Value as U64Value,export_U8Type as U8Type,export_U8Value as U8Value}; /*! Bundled license information: ieee754/index.js: diff --git a/build/types/types.d.ts b/build/types/types.d.ts index 1ef844c..02f563f 100644 --- a/build/types/types.d.ts +++ b/build/types/types.d.ts @@ -30,7 +30,8 @@ export interface LoginOptions { callbackRoute?: string; } export declare enum DappCoreWCV2CustomMethodsEnum { - mvx_cancelAction = "mvx_cancelAction" + mvx_cancelAction = "mvx_cancelAction", + mvx_signNativeAuthToken = "mvx_signNativeAuthToken" } export declare enum EventStoreEvents { onLoginPending = "onLoginPending", diff --git a/example/demo-styles.css b/example/demo-styles.css index 57444af..fd58f0b 100644 --- a/example/demo-styles.css +++ b/example/demo-styles.css @@ -80,9 +80,6 @@ a { .overlay { display: none; - position: fixed; - inset: 0; - background-color: rgba(0, 0, 0, .6); justify-content: center; align-items: center; } @@ -91,24 +88,30 @@ a { display: flex; } +.transaction-link { + display: inline-block; + margin-top: 8px; + margin-bottom: 8px; +} + /* SPINNER */ /* https://projects.lukehaas.me/css-loaders/ */ .loader, .loader:after { border-radius: 50%; - width: 10em; - height: 10em; + width: 3em; + height: 3em; } .loader { font-size: 10px; position: relative; text-indent: -9999em; - border-top: 1.1em solid rgba(255, 255, 255, 0.2); - border-right: 1.1em solid rgba(255, 255, 255, 0.2); - border-bottom: 1.1em solid rgba(255, 255, 255, 0.2); - border-left: 1.1em solid #ffffff; + border-top: 0.5em solid rgba(0, 0, 0, 0.2); + border-right: 0.5em solid rgba(0, 0, 0, 0.2); + border-bottom: 0.5em solid rgba(0, 0, 0, 0.2); + border-left: 0.5em solid #000; -webkit-transform: translateZ(0); -ms-transform: translateZ(0); transform: translateZ(0); diff --git a/example/demo-ui-tools.js b/example/demo-ui-tools.js index 29ba9fb..4b33d3d 100644 --- a/example/demo-ui-tools.js +++ b/example/demo-ui-tools.js @@ -45,17 +45,14 @@ export const uiLoggedInState = (loggedIn) => { }; export const updateTxHashContainer = (txHash) => { - const txHashContainer = document.getElementById('tx-hash-or-query-result'); if (txHash) { - txHashContainer?.replaceChildren(); + const txHashContainer = document.getElementById('tx-hash-or-query-result'); const url = `https://devnet-explorer.multiversx.com/transactions/${txHash}`; const link = document.createElement('a'); link.setAttribute('href', url); link.classList.add('transaction-link'); link.innerText = `➡️ ${url}`; txHashContainer?.appendChild(link); - } else { - txHashContainer?.replaceChildren(); } }; diff --git a/example/elven.js b/example/elven.js index 9f7bc6b..0f660a7 100644 --- a/example/elven.js +++ b/example/elven.js @@ -1,9 +1,9 @@ -var a5=Object.create;var _c=Object.defineProperty,u5=Object.defineProperties,c5=Object.getOwnPropertyDescriptor,l5=Object.getOwnPropertyDescriptors,f5=Object.getOwnPropertyNames,O_=Object.getOwnPropertySymbols,h5=Object.getPrototypeOf,P_=Object.prototype.hasOwnProperty,d5=Object.prototype.propertyIsEnumerable;var D_=(t,e,r)=>e in t?_c(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xf=(t,e)=>{for(var r in e||={})P_.call(e,r)&&D_(t,r,e[r]);if(O_)for(var r of O_(e))d5.call(e,r)&&D_(t,r,e[r]);return t},R_=(t,e)=>u5(t,l5(e));var B_=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+t+'" is not supported')});var ge=(t,e)=>()=>(t&&(e=t(t=0)),e);var w=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),at=(t,e)=>{for(var r in e)_c(t,r,{get:e[r],enumerable:!0})},Tf=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of f5(e))!P_.call(t,i)&&i!==r&&_c(t,i,{get:()=>e[i],enumerable:!(n=c5(e,i))||n.enumerable});return t},Mt=(t,e,r)=>(Tf(t,e,"default"),r&&Tf(r,e,"default")),_e=(t,e,r)=>(r=t!=null?a5(h5(t)):{},Tf(e||!t||!t.__esModule?_c(r,"default",{value:t,enumerable:!0}):r,t)),nt=t=>Tf(_c({},"__esModule",{value:!0}),t);var Te=(t,e,r)=>new Promise((n,i)=>{var s=u=>{try{a(r.next(u))}catch(l){i(l)}},o=u=>{try{a(r.throw(u))}catch(l){i(l)}},a=u=>u.done?n(u.value):Promise.resolve(u.value).then(s,o);a((r=r.apply(t,e)).next())});var hy=w(Nf=>{"use strict";c();Nf.byteLength=g5;Nf.toByteArray=m5;Nf.fromByteArray=v5;var Kr=[],pr=[],p5=typeof Uint8Array<"u"?Uint8Array:Array,fy="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(ms=0,L_=fy.length;ms0)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 g5(t){var e=F_(t),r=e[0],n=e[1];return(r+n)*3/4-n}function y5(t,e,r){return(e+r)*3/4-r}function m5(t){var e,r=F_(t),n=r[0],i=r[1],s=new p5(y5(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=pr[t.charCodeAt(u)]<<2|pr[t.charCodeAt(u+1)]>>4,s[o++]=e&255),i===1&&(e=pr[t.charCodeAt(u)]<<10|pr[t.charCodeAt(u+1)]<<4|pr[t.charCodeAt(u+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function w5(t){return Kr[t>>18&63]+Kr[t>>12&63]+Kr[t>>6&63]+Kr[t&63]}function E5(t,e,r){for(var n,i=[],s=e;sa?a:o+s));return n===1?(e=t[r-1],i.push(Kr[e>>2]+Kr[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(Kr[e>>10]+Kr[e>>4&63]+Kr[e<<2&63]+"=")),i.join("")}});var py=w(dy=>{c();dy.read=function(t,e,r,n,i){var s,o,a=i*8-n-1,u=(1<>1,f=-7,d=r?i-1:0,y=r?-1:1,m=t[e+d];for(d+=y,s=m&(1<<-f)-1,m>>=-f,f+=a;f>0;s=s*256+t[e+d],d+=y,f-=8);for(o=s&(1<<-f)-1,s>>=-f,f+=n;f>0;o=o*256+t[e+d],d+=y,f-=8);if(s===0)s=1-l;else{if(s===u)return o?NaN:(m?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-l}return(m?-1:1)*o*Math.pow(2,s-n)};dy.write=function(t,e,r,n,i,s){var o,a,u,l=s*8-i-1,f=(1<>1,y=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,m=n?0:s-1,v=n?1:-1,T=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=f):(o=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-o))<1&&(o--,u*=2),o+d>=1?e+=y/u:e+=y*Math.pow(2,1-d),e*u>=2&&(o++,u/=2),o+d>=f?(a=0,o=f):o+d>=1?(a=(e*u-1)*Math.pow(2,i),o=o+d):(a=e*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;t[r+m]=a&255,m+=v,a/=256,i-=8);for(o=o<0;t[r+m]=o&255,m+=v,o/=256,l-=8);t[r+m-v]|=T*128}});var $_=w(jo=>{"use strict";c();var gy=hy(),Vo=py(),M_=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;jo.Buffer=K;jo.SlowBuffer=C5;jo.INSPECT_MAX_BYTES=50;var Of=2147483647;jo.kMaxLength=Of;K.TYPED_ARRAY_SUPPORT=A5();!K.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 A5(){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(K.prototype,"parent",{enumerable:!0,get:function(){if(K.isBuffer(this))return this.buffer}});Object.defineProperty(K.prototype,"offset",{enumerable:!0,get:function(){if(K.isBuffer(this))return this.byteOffset}});function Fn(t){if(t>Of)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,K.prototype),e}function K(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 Ey(t)}return V_(t,e,r)}K.poolSize=8192;function V_(t,e,r){if(typeof t=="string")return _5(t,e);if(ArrayBuffer.isView(t))return I5(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($r(t,ArrayBuffer)||t&&$r(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&($r(t,SharedArrayBuffer)||t&&$r(t.buffer,SharedArrayBuffer)))return my(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 K.from(n,e,r);var i=S5(t);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return K.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)}K.from=function(t,e,r){return V_(t,e,r)};Object.setPrototypeOf(K.prototype,Uint8Array.prototype);Object.setPrototypeOf(K,Uint8Array);function j_(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 b5(t,e,r){return j_(t),t<=0?Fn(t):e!==void 0?typeof r=="string"?Fn(t).fill(e,r):Fn(t).fill(e):Fn(t)}K.alloc=function(t,e,r){return b5(t,e,r)};function Ey(t){return j_(t),Fn(t<0?0:vy(t)|0)}K.allocUnsafe=function(t){return Ey(t)};K.allocUnsafeSlow=function(t){return Ey(t)};function _5(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!K.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=H_(t,e)|0,n=Fn(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function yy(t){for(var e=t.length<0?0:vy(t.length)|0,r=Fn(e),n=0;n=Of)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Of.toString(16)+" bytes");return t|0}function C5(t){return+t!=t&&(t=0),K.alloc(+t)}K.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==K.prototype};K.compare=function(e,r){if($r(e,Uint8Array)&&(e=K.from(e,e.offset,e.byteLength)),$r(r,Uint8Array)&&(r=K.from(r,r.offset,r.byteLength)),!K.isBuffer(e)||!K.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?K.from(o).copy(i,s):Uint8Array.prototype.set.call(i,o,s);else if(K.isBuffer(o))o.copy(i,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return i};function H_(t,e){if(K.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||$r(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 wy(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return K_(t).length;default:if(i)return n?-1:wy(t).length;e=(""+e).toLowerCase(),i=!0}}K.byteLength=H_;function T5(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 M5(this,e,r);case"utf8":case"utf-8":return Q_(this,e,r);case"ascii":return L5(this,e,r);case"latin1":case"binary":return F5(this,e,r);case"base64":return R5(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return U5(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}K.prototype._isBuffer=!0;function ws(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}K.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+=" ... "),""};M_&&(K.prototype[M_]=K.prototype.inspect);K.prototype.compare=function(e,r,n,i,s){if($r(e,Uint8Array)&&(e=K.from(e,e.offset,e.byteLength)),!K.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),r<0||n>e.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&r>=n)return 0;if(i>=s)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,s>>>=0,this===e)return 0;for(var o=s-i,a=n-r,u=Math.min(o,a),l=this.slice(i,s),f=e.slice(r,n),d=0;d2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,Ay(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=K.from(e,n)),K.isBuffer(e))return e.length===0?-1:U_(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):U_(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function U_(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,v){return s===1?m[v]:m.readUInt16BE(v*s)}var l;if(i){var f=-1;for(l=r;lo&&(r=o-a),l=r;l>=0;l--){for(var d=!0,y=0;yi&&(n=i)):n=i;var s=e.length;n>s/2&&(n=s/2);for(var o=0;o>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var s=this.length-r;if((n===void 0||n>s)&&(n=s),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var o=!1;;)switch(i){case"hex":return x5(this,e,r,n);case"utf8":case"utf-8":return N5(this,e,r,n);case"ascii":case"latin1":case"binary":return O5(this,e,r,n);case"base64":return D5(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P5(this,e,r,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};K.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function R5(t,e,r){return e===0&&r===t.length?gy.fromByteArray(t):gy.fromByteArray(t.slice(e,r))}function Q_(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i239?4:s>223?3:s>191?2:1;if(i+a<=r){var u,l,f,d;switch(a){case 1:s<128&&(o=s);break;case 2:u=t[i+1],(u&192)===128&&(d=(s&31)<<6|u&63,d>127&&(o=d));break;case 3:u=t[i+1],l=t[i+2],(u&192)===128&&(l&192)===128&&(d=(s&15)<<12|(u&63)<<6|l&63,d>2047&&(d<55296||d>57343)&&(o=d));break;case 4:u=t[i+1],l=t[i+2],f=t[i+3],(u&192)===128&&(l&192)===128&&(f&192)===128&&(d=(s&15)<<18|(u&63)<<12|(l&63)<<6|f&63,d>65535&&d<1114112&&(o=d))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),i+=a}return B5(n)}var q_=4096;function B5(t){var e=t.length;if(e<=q_)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")}K.prototype.readUintLE=K.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Ct(e,r,this.length);for(var i=this[e],s=1,o=0;++o>>0,r=r>>>0,n||Ct(e,r,this.length);for(var i=this[e+--r],s=1;r>0&&(s*=256);)i+=this[e+--r]*s;return i};K.prototype.readUint8=K.prototype.readUInt8=function(e,r){return e=e>>>0,r||Ct(e,1,this.length),this[e]};K.prototype.readUint16LE=K.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||Ct(e,2,this.length),this[e]|this[e+1]<<8};K.prototype.readUint16BE=K.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||Ct(e,2,this.length),this[e]<<8|this[e+1]};K.prototype.readUint32LE=K.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||Ct(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};K.prototype.readUint32BE=K.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||Ct(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};K.prototype.readIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Ct(e,r,this.length);for(var i=this[e],s=1,o=0;++o=s&&(i-=Math.pow(2,8*r)),i};K.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||Ct(e,r,this.length);for(var i=r,s=1,o=this[e+--i];i>0&&(s*=256);)o+=this[e+--i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*r)),o};K.prototype.readInt8=function(e,r){return e=e>>>0,r||Ct(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};K.prototype.readInt16LE=function(e,r){e=e>>>0,r||Ct(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};K.prototype.readInt16BE=function(e,r){e=e>>>0,r||Ct(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};K.prototype.readInt32LE=function(e,r){return e=e>>>0,r||Ct(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};K.prototype.readInt32BE=function(e,r){return e=e>>>0,r||Ct(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};K.prototype.readFloatLE=function(e,r){return e=e>>>0,r||Ct(e,4,this.length),Vo.read(this,e,!0,23,4)};K.prototype.readFloatBE=function(e,r){return e=e>>>0,r||Ct(e,4,this.length),Vo.read(this,e,!1,23,4)};K.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||Ct(e,8,this.length),Vo.read(this,e,!0,52,8)};K.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||Ct(e,8,this.length),Vo.read(this,e,!1,52,8)};function Zt(t,e,r,n,i,s){if(!K.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}K.prototype.writeUintLE=K.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;Zt(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;Zt(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};K.prototype.writeUint8=K.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||Zt(this,e,r,1,255,0),this[r]=e&255,r+1};K.prototype.writeUint16LE=K.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||Zt(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};K.prototype.writeUint16BE=K.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||Zt(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};K.prototype.writeUint32LE=K.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||Zt(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};K.prototype.writeUint32BE=K.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||Zt(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};K.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){var s=Math.pow(2,8*n-1);Zt(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};K.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){var s=Math.pow(2,8*n-1);Zt(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};K.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||Zt(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};K.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||Zt(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};K.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||Zt(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};K.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||Zt(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};K.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||Zt(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 k_(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 z_(t,e,r,n,i){return e=+e,r=r>>>0,i||k_(t,e,r,4,34028234663852886e22,-34028234663852886e22),Vo.write(t,e,r,n,23,4),r+4}K.prototype.writeFloatLE=function(e,r,n){return z_(this,e,r,!0,n)};K.prototype.writeFloatBE=function(e,r,n){return z_(this,e,r,!1,n)};function W_(t,e,r,n,i){return e=+e,r=r>>>0,i||k_(t,e,r,8,17976931348623157e292,-17976931348623157e292),Vo.write(t,e,r,n,52,8),r+8}K.prototype.writeDoubleLE=function(e,r,n){return W_(this,e,r,!0,n)};K.prototype.writeDoubleBE=function(e,r,n){return W_(this,e,r,!1,n)};K.prototype.copy=function(e,r,n,i){if(!K.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 j5(t){for(var e=[],r=0;r>8,i=r%256,s.push(i),s.push(n);return s}function K_(t){return gy.toByteArray(V5(t))}function Df(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function $r(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function Ay(t){return t!==t}var G5=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 eI=w((Mte,Z_)=>{c();var ft=Z_.exports={},Yr,Jr;function by(){throw new Error("setTimeout has not been defined")}function _y(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?Yr=setTimeout:Yr=by}catch{Yr=by}try{typeof clearTimeout=="function"?Jr=clearTimeout:Jr=_y}catch{Jr=_y}})();function Y_(t){if(Yr===setTimeout)return setTimeout(t,0);if((Yr===by||!Yr)&&setTimeout)return Yr=setTimeout,setTimeout(t,0);try{return Yr(t,0)}catch{try{return Yr.call(null,t,0)}catch{return Yr.call(this,t,0)}}}function Q5(t){if(Jr===clearTimeout)return clearTimeout(t);if((Jr===_y||!Jr)&&clearTimeout)return Jr=clearTimeout,clearTimeout(t);try{return Jr(t)}catch{try{return Jr.call(null,t)}catch{return Jr.call(this,t)}}}var Mn=[],Ho=!1,Es,Pf=-1;function k5(){!Ho||!Es||(Ho=!1,Es.length?Mn=Es.concat(Mn):Pf=-1,Mn.length&&J_())}function J_(){if(!Ho){var t=Y_(k5);Ho=!0;for(var e=Mn.length;e;){for(Es=Mn,Mn=[];++Pf1)for(var r=1;r{h=_e($_()),p=_e(eI()),z5=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=z5});var Yt=w((tI,Rf)=>{c();(function(t){"use strict";var e,r=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,n=Math.ceil,i=Math.floor,s="[BigNumber Error] ",o=s+"Number primitive has more than 15 significant digits: ",a=1e14,u=14,l=9007199254740991,f=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],d=1e7,y=1e9;function m(P){var L,_,C,M=q.prototype={constructor:q,toString:null,valueOf:null},Z=new q(1),z=20,H=4,G=-7,$=21,de=-1e7,ae=1e7,re=!1,Y=1,ie=0,te={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},ne="0123456789abcdefghijklmnopqrstuvwxyz";function q(g,E){var b,O,I,N,F,S,U,j,V=this;if(!(V instanceof q))return new q(g,E);if(E==null){if(g&&g._isBigNumber===!0){V.s=g.s,!g.c||g.e>ae?V.c=V.e=null:g.e=10;F/=10,N++);N>ae?V.c=V.e=null:(V.e=N,V.c=[g]);return}j=String(g)}else{if(!r.test(j=String(g)))return C(V,j,S);V.s=j.charCodeAt(0)==45?(j=j.slice(1),-1):1}(N=j.indexOf("."))>-1&&(j=j.replace(".","")),(F=j.search(/e/i))>0?(N<0&&(N=F),N+=+j.slice(F+1),j=j.substring(0,F)):N<0&&(N=j.length)}else{if(A(E,2,ne.length,"Base"),E==10)return V=new q(g),se(V,z+V.e+1,H);if(j=String(g),S=typeof g=="number"){if(g*0!=0)return C(V,j,S,E);if(V.s=1/g<0?(j=j.slice(1),-1):1,q.DEBUG&&j.replace(/^0\.0*|\./,"").length>15)throw Error(o+g)}else V.s=j.charCodeAt(0)===45?(j=j.slice(1),-1):1;for(b=ne.slice(0,E),N=F=0,U=j.length;FN){N=U;continue}}else if(!I&&(j==j.toUpperCase()&&(j=j.toLowerCase())||j==j.toLowerCase()&&(j=j.toUpperCase()))){I=!0,F=-1,N=0;continue}return C(V,String(g),S,E)}S=!1,j=_(j,E,10,V.s),(N=j.indexOf("."))>-1?j=j.replace(".",""):N=j.length}for(F=0;j.charCodeAt(F)===48;F++);for(U=j.length;j.charCodeAt(--U)===48;);if(j=j.slice(F,++U)){if(U-=F,S&&q.DEBUG&&U>15&&(g>l||g!==i(g)))throw Error(o+V.s*g);if((N=N-F-1)>ae)V.c=V.e=null;else if(N=-y&&I<=y&&I===i(I)){if(O[0]===0){if(I===0&&O.length===1)return!0;break e}if(E=(I+1)%u,E<1&&(E+=u),String(O[0]).length==E){for(E=0;E=a||b!==i(b))break e;if(b!==0)return!0}}}else if(O===null&&I===null&&(N===null||N===1||N===-1))return!0;throw Error(s+"Invalid BigNumber: "+g)},q.maximum=q.max=function(){return oe(arguments,M.lt)},q.minimum=q.min=function(){return oe(arguments,M.gt)},q.random=function(){var g=9007199254740992,E=Math.random()*g&2097151?function(){return i(Math.random()*g)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(b){var O,I,N,F,S,U=0,j=[],V=new q(Z);if(b==null?b=z:A(b,0,y),F=n(b/u),re)if(crypto.getRandomValues){for(O=crypto.getRandomValues(new Uint32Array(F*=2));U>>11),S>=9e15?(I=crypto.getRandomValues(new Uint32Array(2)),O[U]=I[0],O[U+1]=I[1]):(j.push(S%1e14),U+=2);U=F/2}else if(crypto.randomBytes){for(O=crypto.randomBytes(F*=7);U=9e15?crypto.randomBytes(7).copy(O,U):(j.push(S%1e14),U+=7);U=F/7}else throw re=!1,Error(s+"crypto unavailable");if(!re)for(;U=10;S/=10,U++);UI-1&&(S[F+1]==null&&(S[F+1]=0),S[F+1]+=S[F]/I|0,S[F]%=I)}return S.reverse()}return function(b,O,I,N,F){var S,U,j,V,X,ye,we,Pe,$e=b.indexOf("."),ot=z,Oe=H;for($e>=0&&(V=ie,ie=0,b=b.replace(".",""),Pe=new q(O),ye=Pe.pow(b.length-$e),ie=V,Pe.c=E(R(T(ye.c),ye.e,"0"),10,I,g),Pe.e=Pe.c.length),we=E(b,O,I,F?(S=ne,g):(S=g,ne)),j=V=we.length;we[--V]==0;we.pop());if(!we[0])return S.charAt(0);if($e<0?--j:(ye.c=we,ye.e=j,ye.s=N,ye=L(ye,Pe,ot,Oe,I),we=ye.c,X=ye.r,j=ye.e),U=j+ot+1,$e=we[U],V=I/2,X=X||U<0||we[U+1]!=null,X=Oe<4?($e!=null||X)&&(Oe==0||Oe==(ye.s<0?3:2)):$e>V||$e==V&&(Oe==4||X||Oe==6&&we[U-1]&1||Oe==(ye.s<0?8:7)),U<1||!we[0])b=X?R(S.charAt(1),-ot,S.charAt(0)):S.charAt(0);else{if(we.length=U,X)for(--I;++we[--U]>I;)we[U]=0,U||(++j,we=[1].concat(we));for(V=we.length;!we[--V];);for($e=0,b="";$e<=V;b+=S.charAt(we[$e++]));b=R(b,j,S.charAt(0))}return b}}(),L=function(){function g(O,I,N){var F,S,U,j,V=0,X=O.length,ye=I%d,we=I/d|0;for(O=O.slice();X--;)U=O[X]%d,j=O[X]/d|0,F=we*U+j*ye,S=ye*U+F%d*d+V,V=(S/N|0)+(F/d|0)+we*j,O[X]=S%N;return V&&(O=[V].concat(O)),O}function E(O,I,N,F){var S,U;if(N!=F)U=N>F?1:-1;else for(S=U=0;SI[S]?1:-1;break}return U}function b(O,I,N,F){for(var S=0;N--;)O[N]-=S,S=O[N]1;O.splice(0,1));}return function(O,I,N,F,S){var U,j,V,X,ye,we,Pe,$e,ot,Oe,Me,vt,ci,gs,ys,Xt,Ln,jt=O.s==I.s?1:-1,At=O.c,Qe=I.c;if(!At||!At[0]||!Qe||!Qe[0])return new q(!O.s||!I.s||(At?Qe&&At[0]==Qe[0]:!Qe)?NaN:At&&At[0]==0||!Qe?jt*0:jt/0);for($e=new q(jt),ot=$e.c=[],j=O.e-I.e,jt=N+j+1,S||(S=a,j=v(O.e/u)-v(I.e/u),jt=jt/u|0),V=0;Qe[V]==(At[V]||0);V++);if(Qe[V]>(At[V]||0)&&j--,jt<0)ot.push(1),X=!0;else{for(gs=At.length,Xt=Qe.length,V=0,jt+=2,ye=i(S/(Qe[0]+1)),ye>1&&(Qe=g(Qe,ye,S),At=g(At,ye,S),Xt=Qe.length,gs=At.length),ci=Xt,Oe=At.slice(0,Xt),Me=Oe.length;Me=S/2&&ys++;do{if(ye=0,U=E(Qe,Oe,Xt,Me),U<0){if(vt=Oe[0],Xt!=Me&&(vt=vt*S+(Oe[1]||0)),ye=i(vt/ys),ye>1)for(ye>=S&&(ye=S-1),we=g(Qe,ye,S),Pe=we.length,Me=Oe.length;E(we,Oe,Pe,Me)==1;)ye--,b(we,Xt=10;jt/=10,V++);se($e,N+($e.e=V+j*u-1)+1,F,X)}else $e.e=j,$e.r=+X;return $e}}();function ce(g,E,b,O){var I,N,F,S,U;if(b==null?b=H:A(b,0,8),!g.c)return g.toString();if(I=g.c[0],F=g.e,E==null)U=T(g.c),U=O==1||O==2&&(F<=G||F>=$)?x(U,F):R(U,F,"0");else if(g=se(new q(g),E,b),N=g.e,U=T(g.c),S=U.length,O==1||O==2&&(E<=N||N<=G)){for(;SS){if(--E>0)for(U+=".";E--;U+="0");}else if(E+=N-S,E>0)for(N+1==S&&(U+=".");E--;U+="0");return g.s<0&&I?"-"+U:U}function oe(g,E){for(var b,O=1,I=new q(g[0]);O=10;I/=10,O++);return(b=O+b*u-1)>ae?g.c=g.e=null:b=10;S/=10,I++);if(N=E-I,N<0)N+=u,F=E,U=X[j=0],V=U/ye[I-F-1]%10|0;else if(j=n((N+1)/u),j>=X.length)if(O){for(;X.length<=j;X.push(0));U=V=0,I=1,N%=u,F=N-u+1}else break e;else{for(U=S=X[j],I=1;S>=10;S/=10,I++);N%=u,F=N-u+I,V=F<0?0:U/ye[I-F-1]%10|0}if(O=O||E<0||X[j+1]!=null||(F<0?U:U%ye[I-F-1]),O=b<4?(V||O)&&(b==0||b==(g.s<0?3:2)):V>5||V==5&&(b==4||O||b==6&&(N>0?F>0?U/ye[I-F]:0:X[j-1])%10&1||b==(g.s<0?8:7)),E<1||!X[0])return X.length=0,O?(E-=g.e+1,X[0]=ye[(u-E%u)%u],g.e=-E||0):X[0]=g.e=0,g;if(N==0?(X.length=j,S=1,j--):(X.length=j+1,S=ye[u-N],X[j]=F>0?i(U/ye[I-F]%ye[F])*S:0),O)for(;;)if(j==0){for(N=1,F=X[0];F>=10;F/=10,N++);for(F=X[0]+=S,S=1;F>=10;F/=10,S++);N!=S&&(g.e++,X[0]==a&&(X[0]=1));break}else{if(X[j]+=S,X[j]!=a)break;X[j--]=0,S=1}for(N=X.length;X[--N]===0;X.pop());}g.e>ae?g.c=g.e=null:g.e=$?x(E,b):R(E,b,"0"),g.s<0?"-"+E:E)}return M.absoluteValue=M.abs=function(){var g=new q(this);return g.s<0&&(g.s=1),g},M.comparedTo=function(g,E){return B(this,new q(g,E))},M.decimalPlaces=M.dp=function(g,E){var b,O,I,N=this;if(g!=null)return A(g,0,y),E==null?E=H:A(E,0,8),se(new q(N),g+N.e+1,E);if(!(b=N.c))return null;if(O=((I=b.length-1)-v(this.e/u))*u,I=b[I])for(;I%10==0;I/=10,O--);return O<0&&(O=0),O},M.dividedBy=M.div=function(g,E){return L(this,new q(g,E),z,H)},M.dividedToIntegerBy=M.idiv=function(g,E){return L(this,new q(g,E),0,1)},M.exponentiatedBy=M.pow=function(g,E){var b,O,I,N,F,S,U,j,V,X=this;if(g=new q(g),g.c&&!g.isInteger())throw Error(s+"Exponent not an integer: "+ue(g));if(E!=null&&(E=new q(E)),S=g.e>14,!X.c||!X.c[0]||X.c[0]==1&&!X.e&&X.c.length==1||!g.c||!g.c[0])return V=new q(Math.pow(+ue(X),S?2-D(g):+ue(g))),E?V.mod(E):V;if(U=g.s<0,E){if(E.c?!E.c[0]:!E.s)return new q(NaN);O=!U&&X.isInteger()&&E.isInteger(),O&&(X=X.mod(E))}else{if(g.e>9&&(X.e>0||X.e<-1||(X.e==0?X.c[0]>1||S&&X.c[1]>=24e7:X.c[0]<8e13||S&&X.c[0]<=9999975e7)))return N=X.s<0&&D(g)?-0:0,X.e>-1&&(N=1/N),new q(U?1/N:N);ie&&(N=n(ie/u+2))}for(S?(b=new q(.5),U&&(g.s=1),j=D(g)):(I=Math.abs(+ue(g)),j=I%2),V=new q(Z);;){if(j){if(V=V.times(X),!V.c)break;N?V.c.length>N&&(V.c.length=N):O&&(V=V.mod(E))}if(I){if(I=i(I/2),I===0)break;j=I%2}else if(g=g.times(b),se(g,g.e+1,1),g.e>14)j=D(g);else{if(I=+ue(g),I===0)break;j=I%2}X=X.times(X),N?X.c&&X.c.length>N&&(X.c.length=N):O&&(X=X.mod(E))}return O?V:(U&&(V=Z.div(V)),E?V.mod(E):N?se(V,ie,H,F):V)},M.integerValue=function(g){var E=new q(this);return g==null?g=H:A(g,0,8),se(E,E.e+1,g)},M.isEqualTo=M.eq=function(g,E){return B(this,new q(g,E))===0},M.isFinite=function(){return!!this.c},M.isGreaterThan=M.gt=function(g,E){return B(this,new q(g,E))>0},M.isGreaterThanOrEqualTo=M.gte=function(g,E){return(E=B(this,new q(g,E)))===1||E===0},M.isInteger=function(){return!!this.c&&v(this.e/u)>this.c.length-2},M.isLessThan=M.lt=function(g,E){return B(this,new q(g,E))<0},M.isLessThanOrEqualTo=M.lte=function(g,E){return(E=B(this,new q(g,E)))===-1||E===0},M.isNaN=function(){return!this.s},M.isNegative=function(){return this.s<0},M.isPositive=function(){return this.s>0},M.isZero=function(){return!!this.c&&this.c[0]==0},M.minus=function(g,E){var b,O,I,N,F=this,S=F.s;if(g=new q(g,E),E=g.s,!S||!E)return new q(NaN);if(S!=E)return g.s=-E,F.plus(g);var U=F.e/u,j=g.e/u,V=F.c,X=g.c;if(!U||!j){if(!V||!X)return V?(g.s=-E,g):new q(X?F:NaN);if(!V[0]||!X[0])return X[0]?(g.s=-E,g):new q(V[0]?F:H==3?-0:0)}if(U=v(U),j=v(j),V=V.slice(),S=U-j){for((N=S<0)?(S=-S,I=V):(j=U,I=X),I.reverse(),E=S;E--;I.push(0));I.reverse()}else for(O=(N=(S=V.length)<(E=X.length))?S:E,S=E=0;E0)for(;E--;V[b++]=0);for(E=a-1;O>S;){if(V[--O]=0;){for(b=0,ye=vt[I]%ot,we=vt[I]/ot|0,F=U,N=I+F;N>I;)j=Me[--F]%ot,V=Me[F]/ot|0,S=we*j+V*ye,j=ye*j+S%ot*ot+Pe[N]+b,b=(j/$e|0)+(S/ot|0)+we*V,Pe[N--]=j%$e;Pe[N]=b}return b?++O:Pe.splice(0,1),le(g,Pe,O)},M.negated=function(){var g=new q(this);return g.s=-g.s||null,g},M.plus=function(g,E){var b,O=this,I=O.s;if(g=new q(g,E),E=g.s,!I||!E)return new q(NaN);if(I!=E)return g.s=-E,O.minus(g);var N=O.e/u,F=g.e/u,S=O.c,U=g.c;if(!N||!F){if(!S||!U)return new q(I/0);if(!S[0]||!U[0])return U[0]?g:new q(S[0]?O:I*0)}if(N=v(N),F=v(F),S=S.slice(),I=N-F){for(I>0?(F=N,b=U):(I=-I,b=S),b.reverse();I--;b.push(0));b.reverse()}for(I=S.length,E=U.length,I-E<0&&(b=U,U=S,S=b,E=I),I=0;E;)I=(S[--E]=S[E]+U[E]+I)/a|0,S[E]=a===S[E]?0:S[E]%a;return I&&(S=[I].concat(S),++F),le(g,S,F)},M.precision=M.sd=function(g,E){var b,O,I,N=this;if(g!=null&&g!==!!g)return A(g,1,y),E==null?E=H:A(E,0,8),se(new q(N),g,E);if(!(b=N.c))return null;if(I=b.length-1,O=I*u+1,I=b[I]){for(;I%10==0;I/=10,O--);for(I=b[0];I>=10;I/=10,O++);}return g&&N.e+1>O&&(O=N.e+1),O},M.shiftedBy=function(g){return A(g,-l,l),this.times("1e"+g)},M.squareRoot=M.sqrt=function(){var g,E,b,O,I,N=this,F=N.c,S=N.s,U=N.e,j=z+4,V=new q("0.5");if(S!==1||!F||!F[0])return new q(!S||S<0&&(!F||F[0])?NaN:F?N:1/0);if(S=Math.sqrt(+ue(N)),S==0||S==1/0?(E=T(F),(E.length+U)%2==0&&(E+="0"),S=Math.sqrt(+E),U=v((U+1)/2)-(U<0||U%2),S==1/0?E="5e"+U:(E=S.toExponential(),E=E.slice(0,E.indexOf("e")+1)+U),b=new q(E)):b=new q(S+""),b.c[0]){for(U=b.e,S=U+j,S<3&&(S=0);;)if(I=b,b=V.times(I.plus(L(N,I,j,1))),T(I.c).slice(0,S)===(E=T(b.c)).slice(0,S))if(b.e0&&Pe>0){for(N=Pe%S||S,V=we.substr(0,N);N0&&(V+=j+we.slice(N)),ye&&(V="-"+V)}O=X?V+(b.decimalSeparator||"")+((U=+b.fractionGroupSize)?X.replace(new RegExp("\\d{"+U+"}\\B","g"),"$&"+(b.fractionGroupSeparator||"")):X):V}return(b.prefix||"")+O+(b.suffix||"")},M.toFraction=function(g){var E,b,O,I,N,F,S,U,j,V,X,ye,we=this,Pe=we.c;if(g!=null&&(S=new q(g),!S.isInteger()&&(S.c||S.s!==1)||S.lt(Z)))throw Error(s+"Argument "+(S.isInteger()?"out of range: ":"not an integer: ")+ue(S));if(!Pe)return new q(we);for(E=new q(Z),j=b=new q(Z),O=U=new q(Z),ye=T(Pe),N=E.e=ye.length-we.e-1,E.c[0]=f[(F=N%u)<0?u+F:F],g=!g||S.comparedTo(E)>0?N>0?E:j:S,F=ae,ae=1/0,S=new q(ye),U.c[0]=0;V=L(S,E,0,1),I=b.plus(V.times(O)),I.comparedTo(g)!=1;)b=O,O=I,j=U.plus(V.times(I=j)),U=I,E=S.minus(V.times(I=E)),S=I;return I=L(g.minus(b),O,0,1),U=U.plus(I.times(j)),b=b.plus(I.times(O)),U.s=j.s=we.s,N=N*2,X=L(j,O,N,H).minus(we).abs().comparedTo(L(U,b,N,H).minus(we).abs())<1?[j,O]:[U,b],ae=F,X},M.toNumber=function(){return+ue(this)},M.toPrecision=function(g,E){return g!=null&&A(g,1,y),ce(this,g,E,2)},M.toString=function(g){var E,b=this,O=b.s,I=b.e;return I===null?O?(E="Infinity",O<0&&(E="-"+E)):E="NaN":(g==null?E=I<=G||I>=$?x(T(b.c),I):R(T(b.c),I,"0"):g===10?(b=se(new q(b),z+I+1,H),E=R(T(b.c),b.e,"0")):(A(g,2,ne.length,"Base"),E=_(R(T(b.c),I,"0"),10,g,O,!0)),O<0&&b.c[0]&&(E="-"+E)),E},M.valueOf=M.toJSON=function(){return ue(this)},M._isBigNumber=!0,P!=null&&q.set(P),q}function v(P){var L=P|0;return P>0||P===L?L:L-1}function T(P){for(var L,_,C=1,M=P.length,Z=P[0]+"";C$^_?1:-1;for(H=(G=M.length)<($=Z.length)?G:$,z=0;zZ[z]^_?1:-1;return G==$?0:G>$^_?1:-1}function A(P,L,_,C){if(P_||P!==i(P))throw Error(s+(C||"Argument")+(typeof P=="number"?P_?" out of range: ":" not an integer: ":" not a primitive number: ")+String(P))}function D(P){var L=P.c.length-1;return v(P.e/u)==L&&P.c[L]%2!=0}function x(P,L){return(P.length>1?P.charAt(0)+"."+P.slice(1):P)+(L<0?"e":"e+")+L}function R(P,L,_){var C,M;if(L<0){for(M=_+".";++L;M+=_);P=M+P}else if(C=P.length,++L>C){for(M=_,L-=C;--L;M+=_);P+=M}else L{"use strict";c();Object.defineProperty(pe,"__esModule",{value:!0});pe.ErrGasLimitShouldBe0ForInnerTransaction=pe.ErrInvalidRelayedV2BuilderArguments=pe.ErrInvalidRelayedV1BuilderArguments=pe.ErrNotImplemented=pe.ErrContractInteraction=pe.ErrCodec=pe.ErrCannotParseTransactionOutcome=pe.ErrCannotParseContractResults=pe.ErrMissingFieldOnEnum=pe.ErrMissingFieldOnStruct=pe.ErrTypingSystem=pe.ErrMock=pe.ErrContractHasNoAddress=pe.ErrContract=pe.ErrExpectedTransactionEventsNotFound=pe.ErrExpectedTransactionStatusNotReached=pe.ErrTransactionWatcherTimeout=pe.ErrAsyncTimerAborted=pe.ErrAsyncTimerAlreadyRunning=pe.ErrInvalidFunctionName=pe.ErrSignatureCannotCreate=pe.ErrTransactionOptionsInvalid=pe.ErrTransactionVersionInvalid=pe.ErrNonceInvalid=pe.ErrNotEnoughGas=pe.ErrAddressEmpty=pe.ErrAddressBadHrp=pe.ErrAddressCannotCreate=pe.ErrUnexpectedCondition=pe.ErrInvariantFailed=pe.ErrBadType=pe.ErrUnsupportedOperation=pe.ErrInvalidArgument=pe.Err=void 0;var Re=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=Re;var Iy=class extends Re{constructor(e,r){super(`Invalid argument: ${e}`,r)}};pe.ErrInvalidArgument=Iy;var Sy=class extends Re{constructor(e,r="not specified"){super(`Operation "${e}" not supported. Reason: ${r}`)}};pe.ErrUnsupportedOperation=Sy;var Cy=class extends Re{constructor(e,r,n){super(`Bad type of "${e}": ${n}. Expected type: ${r}`)}};pe.ErrBadType=Cy;var Ty=class extends Re{constructor(e){super(`Invariant failed: [${e}]`)}};pe.ErrInvariantFailed=Ty;var xy=class extends Re{constructor(e){super(`Unexpected condition: [${e}]`)}};pe.ErrUnexpectedCondition=xy;var Ny=class extends Re{constructor(e,r){let n=`Cannot create address from: ${e}`;super(n,r)}};pe.ErrAddressCannotCreate=Ny;var Oy=class extends Re{constructor(e,r){super(`Wrong address HRP. Expected: ${e}, got ${r}`)}};pe.ErrAddressBadHrp=Oy;var Dy=class extends Re{constructor(){super("Address is empty")}};pe.ErrAddressEmpty=Dy;var Py=class extends Re{constructor(e){super(`Not enough gas provided: ${e}`)}};pe.ErrNotEnoughGas=Py;var Ry=class extends Re{constructor(e){super(`Invalid nonce: ${e}`)}};pe.ErrNonceInvalid=Ry;var By=class extends Re{constructor(e){super(`Invalid transaction version: ${e}`)}};pe.ErrTransactionVersionInvalid=By;var Ly=class extends Re{constructor(e){super(`Invalid transaction options: ${e}`)}};pe.ErrTransactionOptionsInvalid=Ly;var Fy=class extends Re{constructor(e,r){let n=`Cannot create signature from: ${e}`;super(n,r)}};pe.ErrSignatureCannotCreate=Fy;var My=class extends Re{constructor(){super("Invalid function name")}};pe.ErrInvalidFunctionName=My;var Uy=class extends Re{constructor(){super("Async timer already running")}};pe.ErrAsyncTimerAlreadyRunning=Uy;var qy=class extends Re{constructor(){super("Async timer aborted")}};pe.ErrAsyncTimerAborted=qy;var Vy=class extends Re{constructor(){super("TransactionWatcher has timed out")}};pe.ErrTransactionWatcherTimeout=Vy;var jy=class extends Re{constructor(){super("Expected transaction status not reached")}};pe.ErrExpectedTransactionStatusNotReached=jy;var Hy=class extends Re{constructor(){super("Expected transaction events not found")}};pe.ErrExpectedTransactionEventsNotFound=Hy;var Bf=class extends Re{constructor(e){super(e)}};pe.ErrContract=Bf;var Gy=class extends Bf{constructor(){super(` +var bU=Object.create;var ql=Object.defineProperty;var _U=Object.getOwnPropertyDescriptor;var IU=Object.getOwnPropertyNames;var SU=Object.getPrototypeOf,CU=Object.prototype.hasOwnProperty;var xI=(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 ge=(t,e)=>()=>(t&&(e=t(t=0)),e);var m=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),ft=(t,e)=>{for(var r in e)ql(t,r,{get:e[r],enumerable:!0})},Ul=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of IU(e))!CU.call(t,i)&&i!==r&&ql(t,i,{get:()=>e[i],enumerable:!(n=_U(e,i))||n.enumerable});return t},Ht=(t,e,r)=>(Ul(t,e,"default"),r&&Ul(r,e,"default")),Ie=(t,e,r)=>(r=t!=null?bU(SU(t)):{},Ul(e||!t||!t.__esModule?ql(r,"default",{value:t,enumerable:!0}):r,t)),ut=t=>Ul(ql({},"__esModule",{value:!0}),t);var p0=m(Vl=>{"use strict";c();Vl.byteLength=xU;Vl.toByteArray=OU;Vl.fromByteArray=RU;var Yr=[],br=[],TU=typeof Uint8Array<"u"?Uint8Array:Array,d0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(fs=0,NI=d0.length;fs0)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 xU(t){var e=OI(t),r=e[0],n=e[1];return(r+n)*3/4-n}function NU(t,e,r){return(e+r)*3/4-r}function OU(t){var e,r=OI(t),n=r[0],i=r[1],s=new TU(NU(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=br[t.charCodeAt(u)]<<2|br[t.charCodeAt(u+1)]>>4,s[o++]=e&255),i===1&&(e=br[t.charCodeAt(u)]<<10|br[t.charCodeAt(u+1)]<<4|br[t.charCodeAt(u+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function DU(t){return Yr[t>>18&63]+Yr[t>>12&63]+Yr[t>>6&63]+Yr[t&63]}function PU(t,e,r){for(var n,i=[],s=e;sa?a:o+s));return n===1?(e=t[r-1],i.push(Yr[e>>2]+Yr[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(Yr[e>>10]+Yr[e>>4&63]+Yr[e<<2&63]+"=")),i.join("")}});var y0=m(g0=>{c();g0.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,E=t[e+d];for(d+=g,s=E&(1<<-f)-1,E>>=-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-l;else{if(s===u)return o?NaN:(E?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-l}return(E?-1:1)*o*Math.pow(2,s-n)};g0.write=function(t,e,r,n,i,s){var o,a,u,l=s*8-i-1,f=(1<>1,g=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,E=n?0:s-1,v=n?1:-1,N=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=f):(o=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-o))<1&&(o--,u*=2),o+d>=1?e+=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+E]=a&255,E+=v,a/=256,i-=8);for(o=o<0;t[r+E]=o&255,E+=v,o/=256,l-=8);t[r+E-v]|=N*128}});var GI=m(ho=>{"use strict";c();var m0=p0(),fo=y0(),DI=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;ho.Buffer=$;ho.SlowBuffer=qU;ho.INSPECT_MAX_BYTES=50;var Hl=2147483647;ho.kMaxLength=Hl;$.TYPED_ARRAY_SUPPORT=BU();!$.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 BU(){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 Ln(t){if(t>Hl)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 A0(t)}return BI(t,e,r)}$.poolSize=8192;function BI(t,e,r){if(typeof t=="string")return FU(t,e);if(ArrayBuffer.isView(t))return MU(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(Jr(t,ArrayBuffer)||t&&Jr(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Jr(t,SharedArrayBuffer)||t&&Jr(t.buffer,SharedArrayBuffer)))return w0(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=UU(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 BI(t,e,r)};Object.setPrototypeOf($.prototype,Uint8Array.prototype);Object.setPrototypeOf($,Uint8Array);function LI(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 LU(t,e,r){return LI(t),t<=0?Ln(t):e!==void 0?typeof r=="string"?Ln(t).fill(e,r):Ln(t).fill(e):Ln(t)}$.alloc=function(t,e,r){return LU(t,e,r)};function A0(t){return LI(t),Ln(t<0?0:b0(t)|0)}$.allocUnsafe=function(t){return A0(t)};$.allocUnsafeSlow=function(t){return A0(t)};function FU(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!$.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=FI(t,e)|0,n=Ln(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function E0(t){for(var e=t.length<0?0:b0(t.length)|0,r=Ln(e),n=0;n=Hl)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Hl.toString(16)+" bytes");return t|0}function qU(t){return+t!=t&&(t=0),$.alloc(+t)}$.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==$.prototype};$.compare=function(e,r){if(Jr(e,Uint8Array)&&(e=$.from(e,e.offset,e.byteLength)),Jr(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 FI(t,e){if($.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Jr(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 v0(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return jI(t).length;default:if(i)return n?-1:v0(t).length;e=(""+e).toLowerCase(),i=!0}}$.byteLength=FI;function VU(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 YU(this,e,r);case"utf8":case"utf-8":return UI(this,e,r);case"ascii":return $U(this,e,r);case"latin1":case"binary":return KU(this,e,r);case"base64":return WU(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return JU(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}$.prototype._isBuffer=!0;function hs(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+=" ... "),""};DI&&($.prototype[DI]=$.prototype.inspect);$.prototype.compare=function(e,r,n,i,s){if(Jr(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),l=this.slice(i,s),f=e.slice(r,n),d=0;d2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,_0(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:PI(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):PI(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function PI(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(E,v){return s===1?E[v]:E.readUInt16BE(v*s)}var l;if(i){var f=-1;for(l=r;lo&&(r=o-a),l=r;l>=0;l--){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 HU(this,e,r,n);case"utf8":case"utf-8":return jU(this,e,r,n);case"ascii":case"latin1":case"binary":return GU(this,e,r,n);case"base64":return kU(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return QU(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 WU(t,e,r){return e===0&&r===t.length?m0.fromByteArray(t):m0.fromByteArray(t.slice(e,r))}function UI(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i239?4:s>223?3:s>191?2:1;if(i+a<=r){var u,l,f,d;switch(a){case 1:s<128&&(o=s);break;case 2:u=t[i+1],(u&192)===128&&(d=(s&31)<<6|u&63,d>127&&(o=d));break;case 3:u=t[i+1],l=t[i+2],(u&192)===128&&(l&192)===128&&(d=(s&15)<<12|(u&63)<<6|l&63,d>2047&&(d<55296||d>57343)&&(o=d));break;case 4:u=t[i+1],l=t[i+2],f=t[i+3],(u&192)===128&&(l&192)===128&&(f&192)===128&&(d=(s&15)<<18|(u&63)<<12|(l&63)<<6|f&63,d>65535&&d<1114112&&(o=d))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),i+=a}return zU(n)}var RI=4096;function zU(t){var e=t.length;if(e<=RI)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||Rt(e,r,this.length);for(var i=this[e],s=1,o=0;++o>>0,r=r>>>0,n||Rt(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||Rt(e,1,this.length),this[e]};$.prototype.readUint16LE=$.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||Rt(e,2,this.length),this[e]|this[e+1]<<8};$.prototype.readUint16BE=$.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||Rt(e,2,this.length),this[e]<<8|this[e+1]};$.prototype.readUint32LE=$.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||Rt(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||Rt(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||Rt(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||Rt(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||Rt(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};$.prototype.readInt16LE=function(e,r){e=e>>>0,r||Rt(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||Rt(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||Rt(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||Rt(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||Rt(e,4,this.length),fo.read(this,e,!0,23,4)};$.prototype.readFloatBE=function(e,r){return e=e>>>0,r||Rt(e,4,this.length),fo.read(this,e,!1,23,4)};$.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||Rt(e,8,this.length),fo.read(this,e,!0,52,8)};$.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||Rt(e,8,this.length),fo.read(this,e,!1,52,8)};function ir(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;ir(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;ir(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||ir(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||ir(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||ir(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||ir(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||ir(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);ir(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);ir(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||ir(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||ir(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||ir(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||ir(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||ir(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 qI(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 VI(t,e,r,n,i){return e=+e,r=r>>>0,i||qI(t,e,r,4,34028234663852886e22,-34028234663852886e22),fo.write(t,e,r,n,23,4),r+4}$.prototype.writeFloatLE=function(e,r,n){return VI(this,e,r,!0,n)};$.prototype.writeFloatBE=function(e,r,n){return VI(this,e,r,!1,n)};function HI(t,e,r,n,i){return e=+e,r=r>>>0,i||qI(t,e,r,8,17976931348623157e292,-17976931348623157e292),fo.write(t,e,r,n,52,8),r+8}$.prototype.writeDoubleLE=function(e,r,n){return HI(this,e,r,!0,n)};$.prototype.writeDoubleBE=function(e,r,n){return HI(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 e5(t){for(var e=[],r=0;r>8,i=r%256,s.push(i),s.push(n);return s}function jI(t){return m0.toByteArray(ZU(t))}function jl(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function Jr(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function _0(t){return t!==t}var r5=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 $I=m((Ine,zI)=>{c();var gt=zI.exports={},Xr,Zr;function I0(){throw new Error("setTimeout has not been defined")}function S0(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?Xr=setTimeout:Xr=I0}catch{Xr=I0}try{typeof clearTimeout=="function"?Zr=clearTimeout:Zr=S0}catch{Zr=S0}})();function kI(t){if(Xr===setTimeout)return setTimeout(t,0);if((Xr===I0||!Xr)&&setTimeout)return Xr=setTimeout,setTimeout(t,0);try{return Xr(t,0)}catch{try{return Xr.call(null,t,0)}catch{return Xr.call(this,t,0)}}}function n5(t){if(Zr===clearTimeout)return clearTimeout(t);if((Zr===S0||!Zr)&&clearTimeout)return Zr=clearTimeout,clearTimeout(t);try{return Zr(t)}catch{try{return Zr.call(null,t)}catch{return Zr.call(this,t)}}}var Fn=[],po=!1,ds,Gl=-1;function i5(){!po||!ds||(po=!1,ds.length?Fn=ds.concat(Fn):Gl=-1,Fn.length&&QI())}function QI(){if(!po){var t=kI(i5);po=!0;for(var e=Fn.length;e;){for(ds=Fn,Fn=[];++Gl1)for(var r=1;r{h=Ie(GI()),p=Ie($I()),s5=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=s5});var jt=m((KI,kl)=>{c();(function(t){"use strict";var e,r=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,n=Math.ceil,i=Math.floor,s="[BigNumber Error] ",o=s+"Number primitive has more than 15 significant digits: ",a=1e14,u=14,l=9007199254740991,f=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],d=1e7,g=1e9;function E(R){var B,b,C,L=q.prototype={constructor:q,toString:null,valueOf:null},X=new q(1),W=20,j=4,G=-7,K=21,de=-1e7,ue=1e7,re=!1,Y=1,se=0,te={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},ie="0123456789abcdefghijklmnopqrstuvwxyz";function q(y,w){var A,P,T,D,M,x,U,H,V=this;if(!(V instanceof q))return new q(y,w);if(w==null){if(y&&y._isBigNumber===!0){V.s=y.s,!y.c||y.e>ue?V.c=V.e=null:y.e=10;M/=10,D++);D>ue?V.c=V.e=null:(V.e=D,V.c=[y]);return}H=String(y)}else{if(!r.test(H=String(y)))return C(V,H,x);V.s=H.charCodeAt(0)==45?(H=H.slice(1),-1):1}(D=H.indexOf("."))>-1&&(H=H.replace(".","")),(M=H.search(/e/i))>0?(D<0&&(D=M),D+=+H.slice(M+1),H=H.substring(0,M)):D<0&&(D=H.length)}else{if(F(w,2,ie.length,"Base"),w==10)return V=new q(y),oe(V,W+V.e+1,j);if(H=String(y),x=typeof y=="number"){if(y*0!=0)return C(V,H,x,w);if(V.s=1/y<0?(H=H.slice(1),-1):1,q.DEBUG&&H.replace(/^0\.0*|\./,"").length>15)throw Error(o+y)}else V.s=H.charCodeAt(0)===45?(H=H.slice(1),-1):1;for(A=ie.slice(0,w),D=M=0,U=H.length;MD){D=U;continue}}else if(!T&&(H==H.toUpperCase()&&(H=H.toLowerCase())||H==H.toLowerCase()&&(H=H.toUpperCase()))){T=!0,M=-1,D=0;continue}return C(V,String(y),x,w)}x=!1,H=b(H,w,10,V.s),(D=H.indexOf("."))>-1?H=H.replace(".",""):D=H.length}for(M=0;H.charCodeAt(M)===48;M++);for(U=H.length;H.charCodeAt(--U)===48;);if(H=H.slice(M,++U)){if(U-=M,x&&q.DEBUG&&U>15&&(y>l||y!==i(y)))throw Error(o+V.s*y);if((D=D-M-1)>ue)V.c=V.e=null;else if(D=-g&&T<=g&&T===i(T)){if(P[0]===0){if(T===0&&P.length===1)return!0;break e}if(w=(T+1)%u,w<1&&(w+=u),String(P[0]).length==w){for(w=0;w=a||A!==i(A))break e;if(A!==0)return!0}}}else if(P===null&&T===null&&(D===null||D===1||D===-1))return!0;throw Error(s+"Invalid BigNumber: "+y)},q.maximum=q.max=function(){return ae(arguments,L.lt)},q.minimum=q.min=function(){return ae(arguments,L.gt)},q.random=function(){var y=9007199254740992,w=Math.random()*y&2097151?function(){return i(Math.random()*y)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(A){var P,T,D,M,x,U=0,H=[],V=new q(X);if(A==null?A=W:F(A,0,g),M=n(A/u),re)if(crypto.getRandomValues){for(P=crypto.getRandomValues(new Uint32Array(M*=2));U>>11),x>=9e15?(T=crypto.getRandomValues(new Uint32Array(2)),P[U]=T[0],P[U+1]=T[1]):(H.push(x%1e14),U+=2);U=M/2}else if(crypto.randomBytes){for(P=crypto.randomBytes(M*=7);U=9e15?crypto.randomBytes(7).copy(P,U):(H.push(x%1e14),U+=7);U=M/7}else throw re=!1,Error(s+"crypto unavailable");if(!re)for(;U=10;x/=10,U++);UT-1&&(x[M+1]==null&&(x[M+1]=0),x[M+1]+=x[M]/T|0,x[M]%=T)}return x.reverse()}return function(A,P,T,D,M){var x,U,H,V,Z,Ee,ve,Pe,Ze=A.indexOf("."),lt=W,Oe=j;for(Ze>=0&&(V=se,se=0,A=A.replace(".",""),Pe=new q(P),Ee=Pe.pow(A.length-Ze),se=V,Pe.c=w(S(N(Ee.c),Ee.e,"0"),10,T,y),Pe.e=Pe.c.length),ve=w(A,P,T,M?(x=ie,y):(x=y,ie)),H=V=ve.length;ve[--V]==0;ve.pop());if(!ve[0])return x.charAt(0);if(Ze<0?--H:(Ee.c=ve,Ee.e=H,Ee.s=D,Ee=B(Ee,Pe,lt,Oe,T),ve=Ee.c,Z=Ee.r,H=Ee.e),U=H+lt+1,Ze=ve[U],V=T/2,Z=Z||U<0||ve[U+1]!=null,Z=Oe<4?(Ze!=null||Z)&&(Oe==0||Oe==(Ee.s<0?3:2)):Ze>V||Ze==V&&(Oe==4||Z||Oe==6&&ve[U-1]&1||Oe==(Ee.s<0?8:7)),U<1||!ve[0])A=Z?S(x.charAt(1),-lt,x.charAt(0)):x.charAt(0);else{if(ve.length=U,Z)for(--T;++ve[--U]>T;)ve[U]=0,U||(++H,ve=[1].concat(ve));for(V=ve.length;!ve[--V];);for(Ze=0,A="";Ze<=V;A+=x.charAt(ve[Ze++]));A=S(A,H,x.charAt(0))}return A}}(),B=function(){function y(P,T,D){var M,x,U,H,V=0,Z=P.length,Ee=T%d,ve=T/d|0;for(P=P.slice();Z--;)U=P[Z]%d,H=P[Z]/d|0,M=ve*U+H*Ee,x=Ee*U+M%d*d+V,V=(x/D|0)+(M/d|0)+ve*H,P[Z]=x%D;return V&&(P=[V].concat(P)),P}function w(P,T,D,M){var x,U;if(D!=M)U=D>M?1:-1;else for(x=U=0;xT[x]?1:-1;break}return U}function A(P,T,D,M){for(var x=0;D--;)P[D]-=x,x=P[D]1;P.splice(0,1));}return function(P,T,D,M,x){var U,H,V,Z,Ee,ve,Pe,Ze,lt,Oe,Ue,xt,ui,cs,ls,nr,Bn,Wt=P.s==T.s?1:-1,Nt=P.c,ze=T.c;if(!Nt||!Nt[0]||!ze||!ze[0])return new q(!P.s||!T.s||(Nt?ze&&Nt[0]==ze[0]:!ze)?NaN:Nt&&Nt[0]==0||!ze?Wt*0:Wt/0);for(Ze=new q(Wt),lt=Ze.c=[],H=P.e-T.e,Wt=D+H+1,x||(x=a,H=v(P.e/u)-v(T.e/u),Wt=Wt/u|0),V=0;ze[V]==(Nt[V]||0);V++);if(ze[V]>(Nt[V]||0)&&H--,Wt<0)lt.push(1),Z=!0;else{for(cs=Nt.length,nr=ze.length,V=0,Wt+=2,Ee=i(x/(ze[0]+1)),Ee>1&&(ze=y(ze,Ee,x),Nt=y(Nt,Ee,x),nr=ze.length,cs=Nt.length),ui=nr,Oe=Nt.slice(0,nr),Ue=Oe.length;Ue=x/2&&ls++;do{if(Ee=0,U=w(ze,Oe,nr,Ue),U<0){if(xt=Oe[0],nr!=Ue&&(xt=xt*x+(Oe[1]||0)),Ee=i(xt/ls),Ee>1)for(Ee>=x&&(Ee=x-1),ve=y(ze,Ee,x),Pe=ve.length,Ue=Oe.length;w(ve,Oe,Pe,Ue)==1;)Ee--,A(ve,nr=10;Wt/=10,V++);oe(Ze,D+(Ze.e=V+H*u-1)+1,M,Z)}else Ze.e=H,Ze.r=+Z;return Ze}}();function le(y,w,A,P){var T,D,M,x,U;if(A==null?A=j:F(A,0,8),!y.c)return y.toString();if(T=y.c[0],M=y.e,w==null)U=N(y.c),U=P==1||P==2&&(M<=G||M>=K)?I(U,M):S(U,M,"0");else if(y=oe(new q(y),w,A),D=y.e,U=N(y.c),x=U.length,P==1||P==2&&(w<=D||D<=G)){for(;xx){if(--w>0)for(U+=".";w--;U+="0");}else if(w+=D-x,w>0)for(D+1==x&&(U+=".");w--;U+="0");return y.s<0&&T?"-"+U:U}function ae(y,w){for(var A,P=1,T=new q(y[0]);P=10;T/=10,P++);return(A=P+A*u-1)>ue?y.c=y.e=null:A=10;x/=10,T++);if(D=w-T,D<0)D+=u,M=w,U=Z[H=0],V=U/Ee[T-M-1]%10|0;else if(H=n((D+1)/u),H>=Z.length)if(P){for(;Z.length<=H;Z.push(0));U=V=0,T=1,D%=u,M=D-u+1}else break e;else{for(U=x=Z[H],T=1;x>=10;x/=10,T++);D%=u,M=D-u+T,V=M<0?0:U/Ee[T-M-1]%10|0}if(P=P||w<0||Z[H+1]!=null||(M<0?U:U%Ee[T-M-1]),P=A<4?(V||P)&&(A==0||A==(y.s<0?3:2)):V>5||V==5&&(A==4||P||A==6&&(D>0?M>0?U/Ee[T-M]:0:Z[H-1])%10&1||A==(y.s<0?8:7)),w<1||!Z[0])return Z.length=0,P?(w-=y.e+1,Z[0]=Ee[(u-w%u)%u],y.e=-w||0):Z[0]=y.e=0,y;if(D==0?(Z.length=H,x=1,H--):(Z.length=H+1,x=Ee[u-D],Z[H]=M>0?i(U/Ee[T-M]%Ee[M])*x:0),P)for(;;)if(H==0){for(D=1,M=Z[0];M>=10;M/=10,D++);for(M=Z[0]+=x,x=1;M>=10;M/=10,x++);D!=x&&(y.e++,Z[0]==a&&(Z[0]=1));break}else{if(Z[H]+=x,Z[H]!=a)break;Z[H--]=0,x=1}for(D=Z.length;Z[--D]===0;Z.pop());}y.e>ue?y.c=y.e=null:y.e=K?I(w,A):S(w,A,"0"),y.s<0?"-"+w:w)}return L.absoluteValue=L.abs=function(){var y=new q(this);return y.s<0&&(y.s=1),y},L.comparedTo=function(y,w){return O(this,new q(y,w))},L.decimalPlaces=L.dp=function(y,w){var A,P,T,D=this;if(y!=null)return F(y,0,g),w==null?w=j:F(w,0,8),oe(new q(D),y+D.e+1,w);if(!(A=D.c))return null;if(P=((T=A.length-1)-v(this.e/u))*u,T=A[T])for(;T%10==0;T/=10,P--);return P<0&&(P=0),P},L.dividedBy=L.div=function(y,w){return B(this,new q(y,w),W,j)},L.dividedToIntegerBy=L.idiv=function(y,w){return B(this,new q(y,w),0,1)},L.exponentiatedBy=L.pow=function(y,w){var A,P,T,D,M,x,U,H,V,Z=this;if(y=new q(y),y.c&&!y.isInteger())throw Error(s+"Exponent not an integer: "+ce(y));if(w!=null&&(w=new q(w)),x=y.e>14,!Z.c||!Z.c[0]||Z.c[0]==1&&!Z.e&&Z.c.length==1||!y.c||!y.c[0])return V=new q(Math.pow(+ce(Z),x?2-_(y):+ce(y))),w?V.mod(w):V;if(U=y.s<0,w){if(w.c?!w.c[0]:!w.s)return new q(NaN);P=!U&&Z.isInteger()&&w.isInteger(),P&&(Z=Z.mod(w))}else{if(y.e>9&&(Z.e>0||Z.e<-1||(Z.e==0?Z.c[0]>1||x&&Z.c[1]>=24e7:Z.c[0]<8e13||x&&Z.c[0]<=9999975e7)))return D=Z.s<0&&_(y)?-0:0,Z.e>-1&&(D=1/D),new q(U?1/D:D);se&&(D=n(se/u+2))}for(x?(A=new q(.5),U&&(y.s=1),H=_(y)):(T=Math.abs(+ce(y)),H=T%2),V=new q(X);;){if(H){if(V=V.times(Z),!V.c)break;D?V.c.length>D&&(V.c.length=D):P&&(V=V.mod(w))}if(T){if(T=i(T/2),T===0)break;H=T%2}else if(y=y.times(A),oe(y,y.e+1,1),y.e>14)H=_(y);else{if(T=+ce(y),T===0)break;H=T%2}Z=Z.times(Z),D?Z.c&&Z.c.length>D&&(Z.c.length=D):P&&(Z=Z.mod(w))}return P?V:(U&&(V=X.div(V)),w?V.mod(w):D?oe(V,se,j,M):V)},L.integerValue=function(y){var w=new q(this);return y==null?y=j:F(y,0,8),oe(w,w.e+1,y)},L.isEqualTo=L.eq=function(y,w){return O(this,new q(y,w))===0},L.isFinite=function(){return!!this.c},L.isGreaterThan=L.gt=function(y,w){return O(this,new q(y,w))>0},L.isGreaterThanOrEqualTo=L.gte=function(y,w){return(w=O(this,new q(y,w)))===1||w===0},L.isInteger=function(){return!!this.c&&v(this.e/u)>this.c.length-2},L.isLessThan=L.lt=function(y,w){return O(this,new q(y,w))<0},L.isLessThanOrEqualTo=L.lte=function(y,w){return(w=O(this,new q(y,w)))===-1||w===0},L.isNaN=function(){return!this.s},L.isNegative=function(){return this.s<0},L.isPositive=function(){return this.s>0},L.isZero=function(){return!!this.c&&this.c[0]==0},L.minus=function(y,w){var A,P,T,D,M=this,x=M.s;if(y=new q(y,w),w=y.s,!x||!w)return new q(NaN);if(x!=w)return y.s=-w,M.plus(y);var U=M.e/u,H=y.e/u,V=M.c,Z=y.c;if(!U||!H){if(!V||!Z)return V?(y.s=-w,y):new q(Z?M:NaN);if(!V[0]||!Z[0])return Z[0]?(y.s=-w,y):new q(V[0]?M:j==3?-0:0)}if(U=v(U),H=v(H),V=V.slice(),x=U-H){for((D=x<0)?(x=-x,T=V):(H=U,T=Z),T.reverse(),w=x;w--;T.push(0));T.reverse()}else for(P=(D=(x=V.length)<(w=Z.length))?x:w,x=w=0;w0)for(;w--;V[A++]=0);for(w=a-1;P>x;){if(V[--P]=0;){for(A=0,Ee=xt[T]%lt,ve=xt[T]/lt|0,M=U,D=T+M;D>T;)H=Ue[--M]%lt,V=Ue[M]/lt|0,x=ve*H+V*Ee,H=Ee*H+x%lt*lt+Pe[D]+A,A=(H/Ze|0)+(x/lt|0)+ve*V,Pe[D--]=H%Ze;Pe[D]=A}return A?++P:Pe.splice(0,1),fe(y,Pe,P)},L.negated=function(){var y=new q(this);return y.s=-y.s||null,y},L.plus=function(y,w){var A,P=this,T=P.s;if(y=new q(y,w),w=y.s,!T||!w)return new q(NaN);if(T!=w)return y.s=-w,P.minus(y);var D=P.e/u,M=y.e/u,x=P.c,U=y.c;if(!D||!M){if(!x||!U)return new q(T/0);if(!x[0]||!U[0])return U[0]?y:new q(x[0]?P:T*0)}if(D=v(D),M=v(M),x=x.slice(),T=D-M){for(T>0?(M=D,A=U):(T=-T,A=x),A.reverse();T--;A.push(0));A.reverse()}for(T=x.length,w=U.length,T-w<0&&(A=U,U=x,x=A,w=T),T=0;w;)T=(x[--w]=x[w]+U[w]+T)/a|0,x[w]=a===x[w]?0:x[w]%a;return T&&(x=[T].concat(x),++M),fe(y,x,M)},L.precision=L.sd=function(y,w){var A,P,T,D=this;if(y!=null&&y!==!!y)return F(y,1,g),w==null?w=j:F(w,0,8),oe(new q(D),y,w);if(!(A=D.c))return null;if(T=A.length-1,P=T*u+1,T=A[T]){for(;T%10==0;T/=10,P--);for(T=A[0];T>=10;T/=10,P++);}return y&&D.e+1>P&&(P=D.e+1),P},L.shiftedBy=function(y){return F(y,-l,l),this.times("1e"+y)},L.squareRoot=L.sqrt=function(){var y,w,A,P,T,D=this,M=D.c,x=D.s,U=D.e,H=W+4,V=new q("0.5");if(x!==1||!M||!M[0])return new q(!x||x<0&&(!M||M[0])?NaN:M?D:1/0);if(x=Math.sqrt(+ce(D)),x==0||x==1/0?(w=N(M),(w.length+U)%2==0&&(w+="0"),x=Math.sqrt(+w),U=v((U+1)/2)-(U<0||U%2),x==1/0?w="5e"+U:(w=x.toExponential(),w=w.slice(0,w.indexOf("e")+1)+U),A=new q(w)):A=new q(x+""),A.c[0]){for(U=A.e,x=U+H,x<3&&(x=0);;)if(T=A,A=V.times(T.plus(B(D,T,H,1))),N(T.c).slice(0,x)===(w=N(A.c)).slice(0,x))if(A.e0&&Pe>0){for(D=Pe%x||x,V=ve.substr(0,D);D0&&(V+=H+ve.slice(D)),Ee&&(V="-"+V)}P=Z?V+(A.decimalSeparator||"")+((U=+A.fractionGroupSize)?Z.replace(new RegExp("\\d{"+U+"}\\B","g"),"$&"+(A.fractionGroupSeparator||"")):Z):V}return(A.prefix||"")+P+(A.suffix||"")},L.toFraction=function(y){var w,A,P,T,D,M,x,U,H,V,Z,Ee,ve=this,Pe=ve.c;if(y!=null&&(x=new q(y),!x.isInteger()&&(x.c||x.s!==1)||x.lt(X)))throw Error(s+"Argument "+(x.isInteger()?"out of range: ":"not an integer: ")+ce(x));if(!Pe)return new q(ve);for(w=new q(X),H=A=new q(X),P=U=new q(X),Ee=N(Pe),D=w.e=Ee.length-ve.e-1,w.c[0]=f[(M=D%u)<0?u+M:M],y=!y||x.comparedTo(w)>0?D>0?w:H:x,M=ue,ue=1/0,x=new q(Ee),U.c[0]=0;V=B(x,w,0,1),T=A.plus(V.times(P)),T.comparedTo(y)!=1;)A=P,P=T,H=U.plus(V.times(T=H)),U=T,w=x.minus(V.times(T=w)),x=T;return T=B(y.minus(A),P,0,1),U=U.plus(T.times(H)),A=A.plus(T.times(P)),U.s=H.s=ve.s,D=D*2,Z=B(H,P,D,j).minus(ve).abs().comparedTo(B(U,A,D,j).minus(ve).abs())<1?[H,P]:[U,A],ue=M,Z},L.toNumber=function(){return+ce(this)},L.toPrecision=function(y,w){return y!=null&&F(y,1,g),le(this,y,w,2)},L.toString=function(y){var w,A=this,P=A.s,T=A.e;return T===null?P?(w="Infinity",P<0&&(w="-"+w)):w="NaN":(y==null?w=T<=G||T>=K?I(N(A.c),T):S(N(A.c),T,"0"):y===10?(A=oe(new q(A),W+T+1,j),w=S(N(A.c),A.e,"0")):(F(y,2,ie.length,"Base"),w=b(S(N(A.c),T,"0"),10,y,P,!0)),P<0&&A.c[0]&&(w="-"+w)),w},L.valueOf=L.toJSON=function(){return ce(this)},L._isBigNumber=!0,R!=null&&q.set(R),q}function v(R){var B=R|0;return R>0||R===B?B:B-1}function N(R){for(var B,b,C=1,L=R.length,X=R[0]+"";CK^b?1:-1;for(j=(G=L.length)<(K=X.length)?G:K,W=0;WX[W]^b?1:-1;return G==K?0:G>K^b?1:-1}function F(R,B,b,C){if(Rb||R!==i(R))throw Error(s+(C||"Argument")+(typeof R=="number"?Rb?" out of range: ":" not an integer: ":" not a primitive number: ")+String(R))}function _(R){var B=R.c.length-1;return v(R.e/u)==B&&R.c[B]%2!=0}function I(R,B){return(R.length>1?R.charAt(0)+"."+R.slice(1):R)+(B<0?"e":"e+")+B}function S(R,B,b){var C,L;if(B<0){for(L=b+".";++B;L+=b);R=L+R}else if(C=R.length,++B>C){for(L=b,B-=C;--B;L+=b);R+=L}else B{"use strict";c();Object.defineProperty(pe,"__esModule",{value:!0});pe.ErrGasLimitShouldBe0ForInnerTransaction=pe.ErrInvalidRelayedV2BuilderArguments=pe.ErrInvalidRelayedV1BuilderArguments=pe.ErrNotImplemented=pe.ErrContractInteraction=pe.ErrCodec=pe.ErrCannotParseTransactionOutcome=pe.ErrCannotParseContractResults=pe.ErrMissingFieldOnEnum=pe.ErrMissingFieldOnStruct=pe.ErrTypingSystem=pe.ErrMock=pe.ErrContractHasNoAddress=pe.ErrContract=pe.ErrExpectedTransactionEventsNotFound=pe.ErrExpectedTransactionStatusNotReached=pe.ErrTransactionWatcherTimeout=pe.ErrAsyncTimerAborted=pe.ErrAsyncTimerAlreadyRunning=pe.ErrInvalidFunctionName=pe.ErrSignatureCannotCreate=pe.ErrTransactionOptionsInvalid=pe.ErrTransactionVersionInvalid=pe.ErrNonceInvalid=pe.ErrNotEnoughGas=pe.ErrAddressEmpty=pe.ErrAddressBadHrp=pe.ErrAddressCannotCreate=pe.ErrUnexpectedCondition=pe.ErrInvariantFailed=pe.ErrBadType=pe.ErrUnsupportedOperation=pe.ErrInvalidArgument=pe.Err=void 0;var Re=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=Re;var C0=class extends Re{constructor(e,r){super(`Invalid argument: ${e}`,r)}};pe.ErrInvalidArgument=C0;var T0=class extends Re{constructor(e,r="not specified"){super(`Operation "${e}" not supported. Reason: ${r}`)}};pe.ErrUnsupportedOperation=T0;var x0=class extends Re{constructor(e,r,n){super(`Bad type of "${e}": ${n}. Expected type: ${r}`)}};pe.ErrBadType=x0;var N0=class extends Re{constructor(e){super(`Invariant failed: [${e}]`)}};pe.ErrInvariantFailed=N0;var O0=class extends Re{constructor(e){super(`Unexpected condition: [${e}]`)}};pe.ErrUnexpectedCondition=O0;var D0=class extends Re{constructor(e,r){let n=`Cannot create address from: ${e}`;super(n,r)}};pe.ErrAddressCannotCreate=D0;var P0=class extends Re{constructor(e,r){super(`Wrong address HRP. Expected: ${e}, got ${r}`)}};pe.ErrAddressBadHrp=P0;var R0=class extends Re{constructor(){super("Address is empty")}};pe.ErrAddressEmpty=R0;var B0=class extends Re{constructor(e){super(`Not enough gas provided: ${e}`)}};pe.ErrNotEnoughGas=B0;var L0=class extends Re{constructor(e){super(`Invalid nonce: ${e}`)}};pe.ErrNonceInvalid=L0;var F0=class extends Re{constructor(e){super(`Invalid transaction version: ${e}`)}};pe.ErrTransactionVersionInvalid=F0;var M0=class extends Re{constructor(e){super(`Invalid transaction options: ${e}`)}};pe.ErrTransactionOptionsInvalid=M0;var U0=class extends Re{constructor(e,r){let n=`Cannot create signature from: ${e}`;super(n,r)}};pe.ErrSignatureCannotCreate=U0;var q0=class extends Re{constructor(){super("Invalid function name")}};pe.ErrInvalidFunctionName=q0;var V0=class extends Re{constructor(){super("Async timer already running")}};pe.ErrAsyncTimerAlreadyRunning=V0;var H0=class extends Re{constructor(){super("Async timer aborted")}};pe.ErrAsyncTimerAborted=H0;var j0=class extends Re{constructor(){super("TransactionWatcher has timed out")}};pe.ErrTransactionWatcherTimeout=j0;var G0=class extends Re{constructor(){super("Expected transaction status not reached")}};pe.ErrExpectedTransactionStatusNotReached=G0;var k0=class extends Re{constructor(){super("Expected transaction events not found")}};pe.ErrExpectedTransactionEventsNotFound=k0;var Ql=class extends Re{constructor(e){super(e)}};pe.ErrContract=Ql;var Q0=class extends Ql{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=Gy;var Qy=class extends Re{constructor(e){super(e)}};pe.ErrMock=Qy;var ky=class extends Re{constructor(e){super(e)}};pe.ErrTypingSystem=ky;var zy=class extends Re{constructor(e,r){super(`field ${e} does not exist on struct ${r}`)}};pe.ErrMissingFieldOnStruct=zy;var Wy=class extends Re{constructor(e,r){super(`field ${e} does not exist on enum ${r}`)}};pe.ErrMissingFieldOnEnum=Wy;var Ky=class extends Re{constructor(e){super(`cannot parse contract results: ${e}`)}};pe.ErrCannotParseContractResults=Ky;var $y=class extends Re{constructor(e,r){super(`cannot parse outcome of transaction ${e}: ${r}`)}};pe.ErrCannotParseTransactionOutcome=$y;var Yy=class extends Re{constructor(e){super(e)}};pe.ErrCodec=Yy;var Jy=class extends Re{constructor(e){super(e)}};pe.ErrContractInteraction=Jy;var Xy=class extends Re{constructor(){super("Method not yet implemented")}};pe.ErrNotImplemented=Xy;var Zy=class extends Re{constructor(){super("invalid arguments for relayed v1 builder")}};pe.ErrInvalidRelayedV1BuilderArguments=Zy;var em=class extends Re{constructor(){super("invalid arguments for relayed v2 builder")}};pe.ErrInvalidRelayedV2BuilderArguments=em;var tm=class extends Re{constructor(){super("gas limit must be 0 for the inner transaction for relayed v2")}};pe.ErrGasLimitShouldBe0ForInnerTransaction=tm});var iI=w(li=>{"use strict";c();var W5=li&&li.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(li,"__esModule",{value:!0});li.TokenPayment=li.TokenTransfer=void 0;var Ic=W5(Yt()),K5=je(),rI="EGLD",nI=18;Ic.default.set({ROUNDING_MODE:1});var Xr=class{constructor(e){let r=new Ic.default(e.amountAsBigInteger);if(!r.isInteger()||r.isNegative())throw new K5.ErrInvalidArgument(`bad amountAsBigInteger: ${e.amountAsBigInteger}`);this.tokenIdentifier=e.tokenIdentifier,this.nonce=e.nonce,this.amountAsBigInteger=r,this.numDecimals=e.numDecimals}static egldFromAmount(e){let r=new Ic.default(e).shiftedBy(nI).decimalPlaces(0);return this.egldFromBigInteger(r)}static egldFromBigInteger(e){return new Xr({tokenIdentifier:rI,nonce:0,amountAsBigInteger:e,numDecimals:nI})}static fungibleFromAmount(e,r,n){let i=new Ic.default(r).shiftedBy(n).decimalPlaces(0);return this.fungibleFromBigInteger(e,i,n)}static fungibleFromBigInteger(e,r,n=0){return new Xr({tokenIdentifier:e,nonce:0,amountAsBigInteger:r,numDecimals:n})}static nonFungible(e,r){return new Xr({tokenIdentifier:e,nonce:r,amountAsBigInteger:1,numDecimals:0})}static semiFungible(e,r,n){return new Xr({tokenIdentifier:e,nonce:r,amountAsBigInteger:n,numDecimals:0})}static metaEsdtFromAmount(e,r,n,i){let s=new Ic.default(n).shiftedBy(i).decimalPlaces(0);return this.metaEsdtFromBigInteger(e,r,s,i)}static metaEsdtFromBigInteger(e,r,n,i=0){return new Xr({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==rI}isFungible(){return this.nonce==0}};li.TokenTransfer=Xr;var rm=class extends Xr{constructor(e,r,n,i){super({tokenIdentifier:e,nonce:r,amountAsBigInteger:n,numDecimals:i})}};li.TokenPayment=rm});var Go=w(ke=>{"use strict";c();Object.defineProperty(ke,"__esModule",{value:!0});ke.ARGUMENTS_SEPARATOR=ke.ESDT_TRANSFER_VALUE=ke.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME=ke.ESDTNFT_TRANSFER_FUNCTION_NAME=ke.ESDT_TRANSFER_FUNCTION_NAME=ke.ESDT_TRANSFER_GAS_LIMIT=ke.TRANSACTION_VERSION_WITH_OPTIONS=ke.TRANSACTION_VERSION_DEFAULT=ke.TRANSACTION_OPTIONS_TX_GUARDED=ke.TRANSACTION_OPTIONS_TX_HASH_SIGN=ke.TRANSACTION_OPTIONS_DEFAULT=ke.TRANSACTION_MIN_GAS_PRICE=void 0;ke.TRANSACTION_MIN_GAS_PRICE=1e9;ke.TRANSACTION_OPTIONS_DEFAULT=0;ke.TRANSACTION_OPTIONS_TX_HASH_SIGN=1;ke.TRANSACTION_OPTIONS_TX_GUARDED=2;ke.TRANSACTION_VERSION_DEFAULT=1;ke.TRANSACTION_VERSION_WITH_OPTIONS=2;ke.ESDT_TRANSFER_GAS_LIMIT=5e5;ke.ESDT_TRANSFER_FUNCTION_NAME="ESDTTransfer";ke.ESDTNFT_TRANSFER_FUNCTION_NAME="ESDTNFTTransfer";ke.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME="MultiESDTNFTTransfer";ke.ESDT_TRANSFER_VALUE="0";ke.ARGUMENTS_SEPARATOR="@"});var gr=w(Je=>{"use strict";c();var $5=Je&&Je.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Y5=Je&&Je.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),J5=Je&&Je.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&$5(e,t,r);return Y5(e,t),e};Object.defineProperty(Je,"__esModule",{value:!0});Je.isEmpty=Je.guardEmpty=Je.guardNotEmpty=Je.guardLength=Je.guardSameLength=Je.guardValueIsSetWithMessage=Je.guardValueIsSet=Je.guardTrue=void 0;var Qo=J5(je());function X5(t,e){if(!t)throw new Qo.ErrInvariantFailed(`[<${e}>] isn't true`)}Je.guardTrue=X5;function Z5(t,e){sI(`${t} isn't set (null or undefined)`,e)}Je.guardValueIsSet=Z5;function sI(t,e){if(e==null||e===void 0)throw new Qo.ErrInvariantFailed(t)}Je.guardValueIsSetWithMessage=sI;function eM(t,e){if(t=t||[],e=e||[],t.length!=e.length)throw new Qo.ErrInvariantFailed("arrays do not have the same length")}Je.guardSameLength=eM;function tM(t,e){let r=t.length||0;if(r!=e)throw new Qo.ErrInvariantFailed(`wrong length, expected: ${e}, actual: ${r}`)}Je.guardLength=tM;function rM(t,e){if(nm(t))throw new Qo.ErrInvariantFailed(`${e} is empty`)}Je.guardNotEmpty=rM;function nM(t,e){if(!nm(t))throw new Qo.ErrInvariantFailed(`${e} is not empty`)}Je.guardEmpty=nM;function nm(t){return t.isEmpty?t.isEmpty():t.length===0}Je.isEmpty=nm});var oI=w(Lf=>{"use strict";c();Object.defineProperty(Lf,"__esModule",{value:!0});Lf.getJavascriptPrototypesInHierarchy=void 0;function iM(t,e){let r=[],n=Object.getPrototypeOf(t);for(;n&&e(n);)r.push(n),n=Object.getPrototypeOf(n);return r}Lf.getJavascriptPrototypesInHierarchy=iM});var mt=w(yt=>{"use strict";c();Object.defineProperty(yt,"__esModule",{value:!0});yt.NullType=yt.TypePlaceholder=yt.isTyped=yt.PrimitiveValue=yt.TypedValue=yt.CustomType=yt.PrimitiveType=yt.TypeCardinality=yt.Type=void 0;var im=oI(),aI=gr(),ur=class{constructor(e,r=[],n=qn.fixed(1)){aI.guardValueIsSet("name",e),this.name=e,this.typeParameters=r,this.cardinality=n}getName(){return this.name}getClassName(){return ur.ClassName}getClassHierarchy(){return im.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 aI.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 ur.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(!ur.equalsMany(this.getTypeParameters(),e.getTypeParameters()))return!1;let n=this.getFullyQualifiedName();return ur.getFullyQualifiedNamesInHierarchy(e).includes(n)?!0:e.hasClassOrSuperclass(this.getClassName())}static getFullyQualifiedNamesInHierarchy(e){return im.getJavascriptPrototypesInHierarchy(e,i=>i.belongsToTypesystem).map(i=>i.getFullyQualifiedName.call(e))}getNamesOfDependencies(){let e=[];for(let r of this.typeParameters)e.push(r.getName()),e.push(...r.getNamesOfDependencies());return[...new Set(e)]}toJSON(){return{name:this.name,typeParameters:this.typeParameters.map(e=>e.toJSON())}}getCardinality(){return this.cardinality}belongsToTypesystem(){}};yt.Type=ur;ur.ClassName="Type";var qn=class{constructor(e,r){this.lowerBound=e,this.upperBound=r}static fixed(e){return new qn(e,e)}static variable(e){return new qn(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||qn.MaxCardinality}};yt.TypeCardinality=qn;qn.MaxCardinality=4096;var ko=class extends ur{constructor(e){super(e)}getClassName(){return ko.ClassName}};yt.PrimitiveType=ko;ko.ClassName="PrimitiveType";var zo=class extends ur{getClassName(){return zo.ClassName}};yt.CustomType=zo;zo.ClassName="CustomType";var vs=class{constructor(e){this.type=e}getClassName(){return vs.ClassName}getClassHierarchy(){return im.getJavascriptPrototypesInHierarchy(this,n=>n.belongsToTypesystem).map(n=>n.getClassName()).reverse()}getType(){return this.type}hasExactClass(e){return this.getClassName()==e}hasClassOrSuperclass(e){return this.getClassHierarchy().includes(e)}belongsToTypesystem(){}};yt.TypedValue=vs;vs.ClassName="TypedValue";var Wo=class extends vs{constructor(e){super(e)}getClassName(){return Wo.ClassName}};yt.PrimitiveValue=Wo;Wo.ClassName="PrimitiveValue";function sM(t){return t.belongsToTypesystem!==void 0}yt.isTyped=sM;var Ko=class extends ur{constructor(){super("...")}getClassName(){return Ko.ClassName}};yt.TypePlaceholder=Ko;Ko.ClassName="TypePlaceholder";var $o=class extends ur{constructor(){super("?")}getClassName(){return $o.ClassName}};yt.NullType=$o;$o.ClassName="NullType"});var uI=w((Yo,Jo)=>{c();(function(t){var e=typeof Yo=="object"&&Yo&&!Yo.nodeType&&Yo,r=typeof Jo=="object"&&Jo&&!Jo.nodeType&&Jo,n=typeof global=="object"&&global;(n.global===n||n.window===n||n.self===n)&&(t=n);var i,s=2147483647,o=36,a=1,u=26,l=38,f=700,d=72,y=128,m="-",v=/^xn--/,T=/[^\x20-\x7E]/,B=/[\x2E\u3002\uFF0E\uFF61]/g,A={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},D=o-a,x=Math.floor,R=String.fromCharCode,P;function L(Y){throw new RangeError(A[Y])}function _(Y,ie){for(var te=Y.length,ne=[];te--;)ne[te]=ie(Y[te]);return ne}function C(Y,ie){var te=Y.split("@"),ne="";te.length>1&&(ne=te[0]+"@",Y=te[1]),Y=Y.replace(B,".");var q=Y.split("."),ce=_(q,ie).join(".");return ne+ce}function M(Y){for(var ie=[],te=0,ne=Y.length,q,ce;te=55296&&q<=56319&&te65535&&(ie-=65536,te+=R(ie>>>10&1023|55296),ie=56320|ie&1023),te+=R(ie),te}).join("")}function z(Y){return Y-48<10?Y-22:Y-65<26?Y-65:Y-97<26?Y-97:o}function H(Y,ie){return Y+22+75*(Y<26)-((ie!=0)<<5)}function G(Y,ie,te){var ne=0;for(Y=te?x(Y/f):Y>>1,Y+=x(Y/ie);Y>D*u>>1;ne+=o)Y=x(Y/D);return x(ne+(D+1)*Y/(Y+l))}function $(Y){var ie=[],te=Y.length,ne,q=0,ce=y,oe=d,le,se,ue,g,E,b,O,I,N;for(le=Y.lastIndexOf(m),le<0&&(le=0),se=0;se=128&&L("not-basic"),ie.push(Y.charCodeAt(se));for(ue=le>0?le+1:0;ue=te&&L("invalid-input"),O=z(Y.charCodeAt(ue++)),(O>=o||O>x((s-q)/E))&&L("overflow"),q+=O*E,I=b<=oe?a:b>=oe+u?u:b-oe,!(Ox(s/N)&&L("overflow"),E*=N;ne=ie.length+1,oe=G(q-g,ne,g==0),x(q/ne)>s-ce&&L("overflow"),ce+=x(q/ne),q%=ne,ie.splice(q++,0,ce)}return Z(ie)}function de(Y){var ie,te,ne,q,ce,oe,le,se,ue,g,E,b=[],O,I,N,F;for(Y=M(Y),O=Y.length,ie=y,te=0,ce=d,oe=0;oe=ie&&Ex((s-te)/I)&&L("overflow"),te+=(le-ie)*I,ie=le,oe=0;oes&&L("overflow"),E==ie){for(se=te,ue=o;g=ue<=ce?a:ue>=ce+u?u:ue-ce,!(se{"use strict";c();var lI=uI();function oM(t,e){this.__proto__=new Error(e),this.__proto__.name="BackslashError",this.offset=t}function sm(t){return t>="0"&&t<="7"}function aM(t){return t>="0"&&t<="9"||t>="a"&&t<="f"||t>="A"&&t<="F"}function cI(t){return t=parseInt(t,16),lI.ucs2.encode([t])}function fI(t,e,r){var n=!1,i=[];function s(u){var l=t[u];if(!aM(l))throw new oM(u,"Unexpected token ILLEGAL");return l}for(;e{c();var gI=hI();wI.exports={validate:uM,parse:cM};function uM(t,e){var r;if(e=e||!1,typeof t!="string")r="Input must be a string";else try{Ff(t,0,e,!1)}catch(n){r=n.message}return r}function cM(t,e){if(typeof t!="string")throw new Error("Input must be a string");e=e||!1;var r=Ff(t,0,e,!0);return r.value}function yI(t,e){for(var r=t.length,n=e,i,s=e;s-1&&t[r]==="\\";)n++,r--;return n%2===0}function dM(t,e,r,n){for(var i=e,s=",",o=[],a=e;As(t[a]);)a++;if(t[a]==="]")return{start:e,end:a,value:o};for(;s===",";){var u=Ff(t,i,r,n),l=yI(t,u.end);n&&o.push(u.value),i=l.end,s=l.value}return{start:e,end:i,value:o}}function pM(t,e){return t.substr(e,4)==="true"}function gM(t,e){return t.substr(e,5)==="false"}function yM(t,e){return t.substr(e,4)==="null"}var mM=new RegExp(/^\s$/);function As(t){return mM.test(t)}var wM=new RegExp(/^\d$/);function dI(t){return wM.test(t)}function Vn(t,e,r){var n=10,i;t.length{"use strict";c();var EM=Zr&&Zr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),vM=Zr&&Zr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),AM=Zr&&Zr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&EM(e,t,r);return vM(e,t),e};Object.defineProperty(Zr,"__esModule",{value:!0});Zr.TypeExpressionParser=void 0;var vI=AM(je()),bM=mt(),_M=EI(),am=class{parse(e){let r=this.doParse(e),n=Object.keys(r);if(n.length!=1)throw new vI.ErrTypingSystem(`bad type expression: ${e}`);let i=n[0];return this.nodeToType(i,r[i])}doParse(e){let r=this.getJsonedString(e);try{return _M.parse(r)}catch{throw new vI.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 bM.Type(e,n)}};Zr.TypeExpressionParser=am});var um=w(fi=>{"use strict";c();Object.defineProperty(fi,"__esModule",{value:!0});fi.EndpointParameterDefinition=fi.EndpointModifiers=fi.EndpointDefinition=void 0;var IM=Mf(),AI="?",SM="N / A",Sc=class{constructor(e,r,n,i){this.input=[],this.output=[],this.name=e,this.input=r||[],this.output=n||[],this.modifiers=i}isConstructor(){return this.name=="constructor"}static fromJSON(e){e.name=e.name==null?AI:e.name,e.payableInTokens=e.payableInTokens||[],e.inputs=e.inputs||[],e.outputs=e.outputs||[];let r=e.inputs.map(s=>bs.fromJSON(s)),n=e.outputs.map(s=>bs.fromJSON(s)),i=new Uf(e.mutability,e.payableInTokens);return new Sc(e.name,r,n,i)}};fi.EndpointDefinition=Sc;var Uf=class{constructor(e,r){this.mutability=e||"",this.payableInTokens=r||[]}isPayableInEGLD(){return this.isPayableInToken("EGLD")}isPayableInToken(e){return this.payableInTokens.includes(e)?!0:this.payableInTokens.includes(`!${e}`)?!1:!!this.payableInTokens.includes("*")}isPayable(){return this.payableInTokens.length!=0}isReadonly(){return this.mutability=="readonly"}};fi.EndpointModifiers=Uf;var bs=class{constructor(e,r,n){this.name=e,this.description=r,this.type=n}static fromJSON(e){let r=new IM.TypeExpressionParser().parse(e.type);return new bs(e.name||AI,e.description||SM,r)}};fi.EndpointParameterDefinition=bs});var Xo=w(er=>{"use strict";c();var CM=er&&er.__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]}),TM=er&&er.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xM=er&&er.__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)&&CM(e,t,r);return TM(e,t),e};Object.defineProperty(er,"__esModule",{value:!0});er.Fields=er.Field=er.FieldDefinition=void 0;var cm=xM(je()),NM=Mf(),Cc=class{constructor(e,r,n){this.name=e,this.description=r,this.type=n}static fromJSON(e){let r=new NM.TypeExpressionParser().parse(e.type);return new Cc(e.name,e.description,r)}};er.FieldDefinition=Cc;var lm=class{constructor(e,r=""){this.value=e,this.name=r}checkTyping(e){let r=this.value.getType();if(!r.equals(e.type))throw new cm.ErrTypingSystem(`check type of field "${e.name}; expected: ${e.type}, actual: ${r}"`);if(this.name!=e.name)throw new cm.ErrTypingSystem(`check name of field "${e.name}"`)}equals(e){return this.name==e.name&&this.value.equals(e.value)}};er.Field=lm;var fm=class{static checkTyping(e,r){if(e.length!=r.length)throw new cm.ErrTypingSystem("fields length vs. field definitions length");for(let n=0;n{"use strict";c();Object.defineProperty(di,"__esModule",{value:!0});di.EnumValue=di.EnumVariantDefinition=di.EnumType=void 0;var OM=je(),hm=gr(),qf=Xo(),_I=mt(),bI=256,_s=class extends _I.CustomType{constructor(e,r){super(e),this.variants=[],this.variants=r}getClassName(){return _s.ClassName}static fromJSON(e){let r=(e.variants||[]).map(n=>Zo.fromJSON(n));return new _s(e.name,r)}getVariantByDiscriminant(e){let r=this.variants.find(n=>n.discriminant==e);return hm.guardValueIsSet(`variant by discriminant (${e})`,r),r}getVariantByName(e){let r=this.variants.find(n=>n.name==e);return hm.guardValueIsSet(`variant by name (${e})`,r),r}getNamesOfDependencies(){let e=[];for(let r of this.variants)e.push(...r.getNamesOfDependencies());return[...new Set(e)]}};di.EnumType=_s;_s.ClassName="EnumType";var Zo=class{constructor(e,r,n=[]){this.fieldsDefinitions=[],hm.guardTrue(rqf.FieldDefinition.fromJSON(n));return new Zo(e.name,e.discriminant,r)}getFieldsDefinitions(){return this.fieldsDefinitions}getFieldDefinition(e){return this.fieldsDefinitions.find(r=>r.name==e)}getNamesOfDependencies(){return qf.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};di.EnumVariantDefinition=Zo;var hi=class extends _I.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();qf.Fields.checkTyping(this.fields,i)}getClassName(){return hi.ClassName}static fromName(e,r){let n=e.getVariantByName(r);return new hi(e,n,[])}static fromDiscriminant(e,r){let n=e.getVariantByDiscriminant(r);return new hi(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=qf.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 OM.ErrMissingFieldOnEnum(e,this.getType().getName())}valueOf(){let e={name:this.name,fields:[]};return this.fields.forEach(r=>e.fields[r.name]=r.value.valueOf()),e}};di.EnumValue=hi;hi.ClassName="EnumValue"});var ra=w(ta=>{"use strict";c();Object.defineProperty(ta,"__esModule",{value:!0});ta.Struct=ta.StructType=void 0;var DM=je(),Vf=Xo(),II=mt(),Is=class extends II.CustomType{constructor(e,r){super(e),this.fieldsDefinitions=[],this.fieldsDefinitions=r}getClassName(){return Is.ClassName}static fromJSON(e){let r=(e.fields||[]).map(n=>Vf.FieldDefinition.fromJSON(n));return new Is(e.name,r)}getFieldsDefinitions(){return this.fieldsDefinitions}getFieldDefinition(e){return this.fieldsDefinitions.find(r=>r.name==e)}getNamesOfDependencies(){return Vf.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};ta.StructType=Is;Is.ClassName="StructType";var ea=class extends II.TypedValue{constructor(e,r){super(e),this.fields=r,this.fieldsByName=new Map(r.map(n=>[n.name,n])),this.checkTyping()}getClassName(){return ea.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 DM.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)}};ta.Struct=ea;ea.ClassName="Struct"});var Qf=w((pre,TI)=>{"use strict";c();var Hf="qpzry9x8gf2tvdw0s3jn54khce6mua7l",dm={};for(xc=0;xc>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 SI(t){for(var e=1,r=0;r126)return"Invalid prefix ("+t+")";e=na(e)^n>>5}for(e=na(e),r=0;rr)throw new TypeError("Exceeds length limit");t=t.toLowerCase();var n=SI(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=na(n)^o,i+=Hf.charAt(o)}for(s=0;s<6;++s)n=na(n);for(n^=1,s=0;s<6;++s){var a=n>>(5-s)*5&31;i+=Hf.charAt(a)}return i}function CI(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=SI(s);if(typeof a=="string")return a;for(var u=[],l=0;l=o.length)&&u.push(d)}return a!==1?"Invalid checksum for "+t:{prefix:s,words:u}}function RM(){var t=CI.apply(null,arguments);if(typeof t=="object")return t}function BM(t){var e=CI.apply(null,arguments);if(typeof e=="object")return e;throw new Error(e)}function Gf(t,e,r,n){for(var i=0,s=0,o=(1<=r;)s-=r,a.push(i>>s&o);if(n)s>0&&a.push(i<=e)return"Excess padding";if(i<{"use strict";c();var qM=en&&en.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),VM=en&&en.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xI=en&&en.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&qM(e,t,r);return VM(e,t),e};Object.defineProperty(en,"__esModule",{value:!0});en.Address=void 0;var kf=xI(Qf()),ia=xI(je()),pm="erd",gm=32,jM="0".repeat(16),bt=class{constructor(e){if(this.valueHex="",!!e){if(e instanceof bt)return bt.fromAddress(e);if(e instanceof h.Buffer)return bt.fromBuffer(e);if(typeof e=="string")return bt.fromString(e);throw new ia.ErrAddressCannotCreate(e)}}static fromAddress(e){return bt.fromValidHex(e.valueHex)}static fromValidHex(e){let r=new bt;return r.valueHex=e,r}static fromBuffer(e){if(e.length!=gm)throw new ia.ErrAddressCannotCreate(e);return bt.fromValidHex(e.toString("hex"))}static fromString(e){return bt.isValidHex(e)?bt.fromValidHex(e):bt.fromBech32(e)}static isValidHex(e){return h.Buffer.from(e,"hex").length==gm}static fromHex(e){if(!bt.isValidHex(e))throw new ia.ErrAddressCannotCreate(e);return bt.fromValidHex(e)}static empty(){return new bt}static fromBech32(e){let r;try{r=kf.decode(e)}catch(s){throw new ia.ErrAddressCannotCreate(e,s)}let n=r.prefix;if(n!=pm)throw new ia.ErrAddressBadHrp(pm,n);let i=h.Buffer.from(kf.fromWords(r.words));if(i.length!=gm)throw new ia.ErrAddressCannotCreate(e);return bt.fromValidHex(i.toString("hex"))}hex(){return this.isEmpty()?"":this.valueHex}bech32(){if(this.isEmpty())return"";let e=kf.toWords(this.pubkey());return kf.encode(pm,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 bt("0".repeat(64))}isContractAddress(){return this.hex().startsWith(jM)}};en.Address=bt});var aa=w(oa=>{"use strict";c();Object.defineProperty(oa,"__esModule",{value:!0});oa.AddressValue=oa.AddressType=void 0;var HM=tr(),NI=mt(),Ss=class extends NI.PrimitiveType{constructor(){super("Address")}getClassName(){return Ss.ClassName}};oa.AddressType=Ss;Ss.ClassName="AddressType";var sa=class extends NI.PrimitiveValue{constructor(e){super(new Ss),this.value=new HM.Address(e.bech32())}getClassName(){return sa.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};oa.AddressValue=sa;sa.ClassName="AddressValue"});var zf=w(ua=>{"use strict";c();Object.defineProperty(ua,"__esModule",{value:!0});ua.OptionalValue=ua.OptionalType=void 0;var GM=gr(),Nc=mt(),pi=class extends Nc.Type{constructor(e){super("Optional",[e],Nc.TypeCardinality.variable(1))}getClassName(){return pi.ClassName}isAssignableFrom(e){if(!e.hasExactClass(pi.ClassName))return!1;let r=this.getFirstTypeParameter().equals(e.getFirstTypeParameter()),n=e.getFirstTypeParameter().hasExactClass(Nc.NullType.ClassName);return r||n}};ua.OptionalType=pi;pi.ClassName="OptionalType";var Cs=class extends Nc.TypedValue{constructor(e,r=null){super(e),this.value=r}getClassName(){return Cs.ClassName}static newMissing(){let e=new pi(new Nc.NullType);return new Cs(e)}isSet(){return!!this.value}getTypedValue(){return GM.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}};ua.OptionalValue=Cs;Cs.ClassName="OptionalValue"});var Oc=w(la=>{"use strict";c();Object.defineProperty(la,"__esModule",{value:!0});la.BooleanValue=la.BooleanType=void 0;var OI=mt(),Ts=class extends OI.PrimitiveType{constructor(){super("bool")}getClassName(){return Ts.ClassName}};la.BooleanType=Ts;Ts.ClassName="BooleanType";var ca=class extends OI.PrimitiveValue{constructor(e){super(new Ts),this.value=e}getClassName(){return ca.ClassName}equals(e){return this.value===e.value}isTrue(){return this.value===!0}isFalse(){return!this.isTrue()}valueOf(){return this.value}};la.BooleanValue=ca;ca.ClassName="BooleanValue"});var yi=w(fa=>{"use strict";c();Object.defineProperty(fa,"__esModule",{value:!0});fa.BytesValue=fa.BytesType=void 0;var DI=mt(),xs=class extends DI.PrimitiveType{constructor(){super("bytes")}getClassName(){return xs.ClassName}};fa.BytesType=xs;xs.ClassName="BytesType";var gi=class extends DI.PrimitiveValue{constructor(e){super(new xs),this.value=e}getClassName(){return gi.ClassName}static fromUTF8(e){let r=h.Buffer.from(e,"utf-8");return new gi(r)}static fromHex(e){let r=h.Buffer.from(e,"hex");return new gi(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()}};fa.BytesValue=gi;gi.ClassName="BytesValue"});var RI=w(ha=>{"use strict";c();Object.defineProperty(ha,"__esModule",{value:!0});ha.CodeMetadataValue=ha.CodeMetadataType=void 0;var PI=mt(),Wf=class extends PI.PrimitiveType{constructor(){super("CodeMetadata")}};ha.CodeMetadataType=Wf;var ym=class extends PI.PrimitiveValue{constructor(e){super(new Wf),this.value=e}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};ha.CodeMetadataValue=ym});var Kf=w(da=>{"use strict";c();Object.defineProperty(da,"__esModule",{value:!0});da.CompositeValue=da.CompositeType=void 0;var QM=gr(),mm=mt(),Ns=class extends mm.Type{constructor(...e){super("Composite",e,mm.TypeCardinality.variable(e.length))}getClassName(){return Ns.ClassName}};da.CompositeType=Ns;Ns.ClassName="CompositeType";var Os=class extends mm.TypedValue{constructor(e,r){super(e),QM.guardLength(r,e.getTypeParameters().length),this.items=r}getClassName(){return Os.ClassName}static fromItems(...e){let r=e.map(i=>i.getType()),n=new Ns(...r);return new Os(n,e)}getItems(){return this.items}valueOf(){return this.items.map(e=>e?.valueOf())}equals(e){if(this.getType().differs(e.getType()))return!1;for(let r=0;r{"use strict";c();Object.defineProperty($f,"__esModule",{value:!0});$f.CollectionOfTypedValues=void 0;var wm=class{constructor(e){this.items=e}getLength(){return this.items.length}getItems(){return this.items}valueOf(){return this.items.map(e=>e.valueOf())}equals(e){if(this.getLength()!=e.getLength())return!1;for(let r=0;r{"use strict";c();Object.defineProperty(tn,"__esModule",{value:!0});tn.List=tn.OptionValue=tn.ListType=tn.OptionType=void 0;var kM=gr(),zM=Em(),Ds=mt(),rn=class extends Ds.Type{constructor(e){super("Option",[e])}getClassName(){return rn.ClassName}isAssignableFrom(e){if(!e.hasExactClass(rn.ClassName))return!1;let r=this.getFirstTypeParameter().equals(e.getFirstTypeParameter()),n=e.getFirstTypeParameter().hasExactClass(Ds.NullType.ClassName);return r||n}};tn.OptionType=rn;rn.ClassName="OptionType";var Ps=class extends Ds.Type{constructor(e){super("List",[e])}getClassName(){return Ps.ClassName}};tn.ListType=Ps;Ps.ClassName="ListType";var jn=class extends Ds.TypedValue{constructor(e,r=null){super(e),this.value=r}getClassName(){return jn.ClassName}static newMissing(){let e=new rn(new Ds.NullType);return new jn(e)}static newMissingTyped(e){return new jn(new rn(e))}static newProvided(e){let r=new rn(e.getType());return new jn(r,e)}isSet(){return!!this.value}getTypedValue(){return kM.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}};tn.OptionValue=jn;jn.ClassName="OptionValue";var mi=class extends Ds.TypedValue{constructor(e,r){super(e),this.backingCollection=new zM.CollectionOfTypedValues(r)}getClassName(){return mi.ClassName}static fromItems(e){if(e.length==0)return new mi(new Ds.TypePlaceholder,[]);let r=e[0].getType(),n=new Ps(r);return new mi(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)}};tn.List=mi;mi.ClassName="List"});var Yf=w(ya=>{"use strict";c();Object.defineProperty(ya,"__esModule",{value:!0});ya.ArrayVec=ya.ArrayVecType=void 0;var BI=gr(),WM=Em(),LI=mt(),pa=class extends LI.Type{constructor(e,r){super("Array",[r]),BI.guardTrue(e>0,"array length > 0"),this.length=e}getClassName(){return pa.ClassName}};ya.ArrayVecType=pa;pa.ClassName="ArrayVecType";var ga=class extends LI.TypedValue{constructor(e,r){super(e),BI.guardLength(r,e.length),this.backingCollection=new WM.CollectionOfTypedValues(r)}getClassName(){return ga.ClassName}getLength(){return this.backingCollection.getLength()}getItems(){return this.backingCollection.getItems()}valueOf(){return this.backingCollection.valueOf()}equals(e){return this.backingCollection.equals(e.backingCollection)}};ya.ArrayVec=ga;ga.ClassName="ArrayVec"});var Pc=w(wa=>{"use strict";c();Object.defineProperty(wa,"__esModule",{value:!0});wa.H256Value=wa.H256Type=void 0;var FI=mt(),Rs=class extends FI.PrimitiveType{constructor(){super("H256")}getClassName(){return Rs.ClassName}};wa.H256Type=Rs;Rs.ClassName="H256Type";var ma=class extends FI.PrimitiveValue{constructor(e){super(new Rs),this.value=e}getClassName(){return ma.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};wa.H256Value=ma;ma.ClassName="H256Value"});var Jf=w(va=>{"use strict";c();Object.defineProperty(va,"__esModule",{value:!0});va.NothingValue=va.NothingType=void 0;var MI=mt(),Bs=class extends MI.PrimitiveType{constructor(){super("nothing")}getClassName(){return Bs.ClassName}};va.NothingType=Bs;Bs.ClassName="NothingType";var Ea=class extends MI.PrimitiveValue{constructor(){super(new Bs)}getClassName(){return Ea.ClassName}equals(e){return!1}valueOf(){return{}}};va.NothingValue=Ea;Ea.ClassName="NothingValue"});var Rc=w(Ae=>{"use strict";c();var KM=Ae&&Ae.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$M=Ae&&Ae.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YM=Ae&&Ae.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&KM(e,t,r);return $M(e,t),e},JM=Ae&&Ae.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ae,"__esModule",{value:!0});Ae.BigIntValue=Ae.BigUIntValue=Ae.I64Value=Ae.U64Value=Ae.I32Value=Ae.U32Value=Ae.I16Value=Ae.U16Value=Ae.I8Value=Ae.U8Value=Ae.NumericalValue=Ae.BigIntType=Ae.BigUIntType=Ae.I64Type=Ae.U64Type=Ae.I32Type=Ae.U32Type=Ae.I16Type=Ae.U16Type=Ae.I8Type=Ae.U8Type=Ae.NumericalType=void 0;var UI=YM(je()),qI=mt(),ks=JM(Yt()),Ht=class extends qI.PrimitiveType{constructor(e,r,n){super(e),this.sizeInBytes=r,this.withSign=n}getClassName(){return Ht.ClassName}hasFixedSize(){return!!this.sizeInBytes}hasArbitrarySize(){return!this.hasFixedSize()}};Ae.NumericalType=Ht;Ht.ClassName="NumericalType";var Ls=class extends Ht{constructor(){super("u8",1,!1)}getClassName(){return Ls.ClassName}};Ae.U8Type=Ls;Ls.ClassName="U8Type";var Fs=class extends Ht{constructor(){super("i8",1,!0)}getClassName(){return Fs.ClassName}};Ae.I8Type=Fs;Fs.ClassName="I8Type";var Ms=class extends Ht{constructor(){super("u16",2,!1)}getClassName(){return Ms.ClassName}};Ae.U16Type=Ms;Ms.ClassName="U16Type";var Us=class extends Ht{constructor(){super("i16",2,!0)}getClassName(){return Us.ClassName}};Ae.I16Type=Us;Us.ClassName="I16Type";var qs=class extends Ht{constructor(){super("u32",4,!1)}getClassName(){return qs.ClassName}};Ae.U32Type=qs;qs.ClassName="U32Type";var Vs=class extends Ht{constructor(){super("i32",4,!0)}getClassName(){return Vs.ClassName}};Ae.I32Type=Vs;Vs.ClassName="I32Type";var js=class extends Ht{constructor(){super("u64",8,!1)}getClassName(){return js.ClassName}};Ae.U64Type=js;js.ClassName="U64Type";var Hs=class extends Ht{constructor(){super("i64",8,!0)}getClassName(){return Hs.ClassName}};Ae.I64Type=Hs;Hs.ClassName="I64Type";var Gs=class extends Ht{constructor(){super("BigUint",0,!1)}getClassName(){return Gs.ClassName}};Ae.BigUIntType=Gs;Gs.ClassName="BigUIntType";var Qs=class extends Ht{constructor(){super("Bigint",0,!0)}getClassName(){return Qs.ClassName}};Ae.BigIntType=Qs;Qs.ClassName="BigIntType";var Gt=class extends qI.PrimitiveValue{constructor(e,r){if(super(e),this.value=new ks.default(r),this.sizeInBytes=e.sizeInBytes,this.withSign=e.withSign,this.value.isNaN())throw new UI.ErrInvalidArgument(`not a number: ${r}`);if(!this.withSign&&this.value.isNegative())throw new UI.ErrInvalidArgument(`negative, but type is unsigned: ${r}`)}getClassName(){return Gt.ClassName}equals(e){return this.value.isEqualTo(e.value)}valueOf(){return this.value}toString(){return this.value.toString()}};Ae.NumericalValue=Gt;Gt.ClassName="NumericalValue";var Aa=class extends Gt{constructor(e){super(new Ls,new ks.default(e))}getClassName(){return Aa.ClassName}};Ae.U8Value=Aa;Aa.ClassName="U8Value";var ba=class extends Gt{constructor(e){super(new Fs,new ks.default(e))}getClassName(){return ba.ClassName}};Ae.I8Value=ba;ba.ClassName="I8Value";var _a=class extends Gt{constructor(e){super(new Ms,new ks.default(e))}getClassName(){return _a.ClassName}};Ae.U16Value=_a;_a.ClassName="U16Value";var Ia=class extends Gt{constructor(e){super(new Us,new ks.default(e))}getClassName(){return Ia.ClassName}};Ae.I16Value=Ia;Ia.ClassName="I16Value";var Sa=class extends Gt{constructor(e){super(new qs,new ks.default(e))}getClassName(){return Sa.ClassName}};Ae.U32Value=Sa;Sa.ClassName="U32Value";var Ca=class extends Gt{constructor(e){super(new Vs,new ks.default(e))}getClassName(){return Ca.ClassName}};Ae.I32Value=Ca;Ca.ClassName="I32Value";var Ta=class extends Gt{constructor(e){super(new js,e)}getClassName(){return Ta.ClassName}};Ae.U64Value=Ta;Ta.ClassName="U64Value";var xa=class extends Gt{constructor(e){super(new Hs,e)}getClassName(){return xa.ClassName}};Ae.I64Value=xa;xa.ClassName="I64Value";var Na=class extends Gt{constructor(e){super(new Gs,e)}getClassName(){return Na.ClassName}};Ae.BigUIntValue=Na;Na.ClassName="BigUIntValue";var Oa=class extends Gt{constructor(e){super(new Qs,e)}getClassName(){return Oa.ClassName}};Ae.BigIntValue=Oa;Oa.ClassName="BigIntValue"});var Xf=w(Da=>{"use strict";c();Object.defineProperty(Da,"__esModule",{value:!0});Da.StringValue=Da.StringType=void 0;var VI=mt(),zs=class extends VI.PrimitiveType{constructor(){super("utf-8 string")}getClassName(){return zs.ClassName}};Da.StringType=zs;zs.ClassName="StringType";var wi=class extends VI.PrimitiveValue{constructor(e){super(new zs),this.value=e}getClassName(){return wi.ClassName}static fromUTF8(e){return new wi(e)}static fromHex(e){let r=h.Buffer.from(e,"hex").toString();return new wi(r)}getLength(){return this.value.length}equals(e){return this.value===e.value}valueOf(){return this.value}};Da.StringValue=wi;wi.ClassName="StringValue"});var Ra=w(Pa=>{"use strict";c();Object.defineProperty(Pa,"__esModule",{value:!0});Pa.TokenIdentifierValue=Pa.TokenIdentifierType=void 0;var jI=mt(),XM="EGLD",Ws=class extends jI.PrimitiveType{constructor(){super("TokenIdentifier")}getClassName(){return Ws.ClassName}};Pa.TokenIdentifierType=Ws;Ws.ClassName="TokenIdentifierType";var Ei=class extends jI.PrimitiveValue{constructor(e){super(new Ws),this.value=e}static egld(){return new Ei(XM)}static esdtTokenIdentifier(e){return new Ei(e)}getClassName(){return Ei.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()}};Pa.TokenIdentifierValue=Ei;Ei.ClassName="TokenIdentifierValue"});var Zf=w(yr=>{"use strict";c();var ZM=yr&&yr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),e4=yr&&yr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),t4=yr&&yr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ZM(e,t,r);return e4(e,t),e};Object.defineProperty(yr,"__esModule",{value:!0});yr.Tuple=yr.TupleType=void 0;var r4=t4(je()),HI=Xo(),GI=ra(),Hn=class extends GI.StructType{constructor(...e){super(Hn.prepareName(e),Hn.prepareFieldDefinitions(e))}getClassName(){return Hn.ClassName}static prepareName(e){return`tuple<${e.map(i=>i.toString()).join(", ")}>`}static prepareFieldDefinitions(e){return e.map((n,i)=>new HI.FieldDefinition(QI(i),"anonymous tuple field",n))}};yr.TupleType=Hn;Hn.ClassName="TupleType";function QI(t){return`field${t}`}var Ks=class extends GI.Struct{constructor(e,r){super(e,r)}getClassName(){return Ks.ClassName}static fromItems(e){if(e.length<1)throw new r4.ErrTypingSystem("bad tuple items");let r=e.map(s=>s.getType()),n=new Hn(...r),i=e.map((s,o)=>new HI.Field(s,QI(o)));return new Ks(n,i)}};yr.Tuple=Ks;Ks.ClassName="Tuple"});var th=w(Ba=>{"use strict";c();Object.defineProperty(Ba,"__esModule",{value:!0});Ba.VariadicValue=Ba.VariadicType=void 0;var eh=mt(),Ai=class extends eh.Type{constructor(e){super("Variadic",[e],eh.TypeCardinality.variable())}getClassName(){return Ai.ClassName}};Ba.VariadicType=Ai;Ai.ClassName="VariadicType";var vi=class extends eh.TypedValue{constructor(e,r){super(e),this.items=r}getClassName(){return vi.ClassName}static fromItems(...e){if(e.length==0)return new vi(new Ai(new eh.TypePlaceholder),[]);let r=e[0].getType();return new vi(new Ai(r),e)}getItems(){return this.items}valueOf(){return this.items.map(e=>e.valueOf())}equals(e){if(this.getType().differs(e.getType()))return!1;for(let r=0;r{"use strict";c();var n4=nn&&nn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),i4=nn&&nn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),s4=nn&&nn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&n4(e,t,r);return i4(e,t),e};Object.defineProperty(nn,"__esModule",{value:!0});nn.TypeMapper=void 0;var kI=s4(je()),o4=aa(),vm=zf(),a4=Oc(),u4=yi(),c4=RI(),rh=Kf(),Am=Tc(),l4=Xo(),zI=Dc(),nh=Yf(),f4=Pc(),WI=Jf(),mr=Rc(),h4=Xf(),KI=ra(),$I=Ra(),bi=Zf(),bm=th(),_m=class{constructor(e=[]){this.openTypesFactories=new Map([["Option",(...r)=>new zI.OptionType(r[0])],["List",(...r)=>new zI.ListType(r[0])],["VarArgs",(...r)=>new bm.VariadicType(r[0])],["MultiResultVec",(...r)=>new bm.VariadicType(r[0])],["variadic",(...r)=>new bm.VariadicType(r[0])],["OptionalArg",(...r)=>new vm.OptionalType(r[0])],["optional",(...r)=>new vm.OptionalType(r[0])],["OptionalResult",(...r)=>new vm.OptionalType(r[0])],["multi",(...r)=>new rh.CompositeType(...r)],["MultiArg",(...r)=>new rh.CompositeType(...r)],["MultiResult",(...r)=>new rh.CompositeType(...r)],["multi",(...r)=>new rh.CompositeType(...r)],["tuple",(...r)=>new bi.TupleType(...r)],["tuple2",(...r)=>new bi.TupleType(...r)],["tuple3",(...r)=>new bi.TupleType(...r)],["tuple4",(...r)=>new bi.TupleType(...r)],["tuple5",(...r)=>new bi.TupleType(...r)],["tuple6",(...r)=>new bi.TupleType(...r)],["tuple7",(...r)=>new bi.TupleType(...r)],["tuple8",(...r)=>new bi.TupleType(...r)],["array20",(...r)=>new nh.ArrayVecType(20,r[0])],["array32",(...r)=>new nh.ArrayVecType(32,r[0])],["array46",(...r)=>new nh.ArrayVecType(46,r[0])],["array64",(...r)=>new nh.ArrayVecType(64,r[0])]]),this.closedTypesMap=new Map([["u8",new mr.U8Type],["u16",new mr.U16Type],["u32",new mr.U32Type],["u64",new mr.U64Type],["U64",new mr.U64Type],["BigUint",new mr.BigUIntType],["i8",new mr.I8Type],["i16",new mr.I16Type],["i32",new mr.I32Type],["i64",new mr.I64Type],["Bigint",new mr.BigIntType],["BigInt",new mr.BigIntType],["bool",new a4.BooleanType],["bytes",new u4.BytesType],["Address",new o4.AddressType],["H256",new f4.H256Type],["utf-8 string",new h4.StringType],["TokenIdentifier",new $I.TokenIdentifierType],["EgldOrEsdtTokenIdentifier",new $I.TokenIdentifierType],["CodeMetadata",new c4.CodeMetadataType],["nothing",new WI.NothingType],["AsyncCall",new WI.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 kI.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(Am.EnumType.ClassName)?this.mapEnumType(e):e.hasExactClass(KI.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 KI.StructType(e.getName(),r)}mapEnumType(e){let r=e.variants.map(i=>new Am.EnumVariantDefinition(i.name,i.discriminant,this.mappedFields(i.getFieldsDefinitions())));return new Am.EnumType(e.getName(),r)}mappedFields(e){return e.map(r=>new l4.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 kI.ErrTypingSystem(`Cannot map the generic type "${e.getName()}" to a known type`);return i(...n)}};nn.TypeMapper=_m});var eS=w(sn=>{"use strict";c();var d4=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]}),p4=sn&&sn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),g4=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)&&d4(e,t,r);return p4(e,t),e};Object.defineProperty(sn,"__esModule",{value:!0});sn.AbiRegistry=void 0;var YI=g4(je()),Sm=gr(),Bc=um(),JI=Tc(),XI=ra(),y4=Im(),m4="?",La=class{constructor(e){this.endpoints=[],this.customTypes=[],this.name=e.name,this.constructorDefinition=e.constructorDefinition,this.endpoints=e.endpoints,this.customTypes=e.customTypes}static create(e){let r=e.name||m4,n=e.constructor||{},i=e.endpoints||[],s=e.types||{},o=Bc.EndpointDefinition.fromJSON(Object.assign({name:"constructor"},n)),a=i.map(d=>Bc.EndpointDefinition.fromJSON(d)),u=[];for(let d in s){let y=s[d];if(y.type=="struct")u.push(XI.StructType.fromJSON({name:d,fields:y.fields}));else if(y.type=="enum")u.push(JI.EnumType.fromJSON({name:d,variants:y.variants}));else throw new YI.ErrTypingSystem(`Cannot handle custom type: ${d}`)}return new La({name:r,constructorDefinition:o,endpoints:a,customTypes:u}).remapToKnownTypes()}getStruct(e){let r=this.customTypes.find(n=>n.getName()==e&&n.hasExactClass(XI.StructType.ClassName));return Sm.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(JI.EnumType.ClassName));return Sm.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 Sm.guardValueIsSetWithMessage(`endpoint [${e}] not found`,r),r}remapToKnownTypes(){let e=new y4.TypeMapper([]),r=[];for(let o of this.customTypes)this.mapCustomTypeDepthFirst(o,this.customTypes,e,r);if(this.customTypes.length!=r.length)throw new YI.ErrTypingSystem("Did not re-map all custom types");let n=ZI(this.constructorDefinition,e),i=[];for(let o of this.endpoints)i.push(ZI(o,e));return new La({name:this.name,constructorDefinition:n,endpoints:i,customTypes:r})}mapCustomTypeDepthFirst(e,r,n,i){if(i.findIndex(a=>a.getName()==e.getName())>=0)return;for(let a of e.getNamesOfDependencies()){let u=r.find(l=>l.getName()==a);u&&this.mapCustomTypeDepthFirst(u,r,n,i)}let o=n.mapType(e);i.push(o)}};sn.AbiRegistry=La;function ZI(t,e){let r=t.input.map(i=>new Bc.EndpointParameterDefinition(i.name,i.description,e.mapType(i.type))),n=t.output.map(i=>new Bc.EndpointParameterDefinition(i.name,i.description,e.mapType(i.type)));return new Bc.EndpointDefinition(t.name,r,n,t.modifiers)}});var rS=w(Fa=>{"use strict";c();Object.defineProperty(Fa,"__esModule",{value:!0});Fa.createListOfTokenIdentifiers=Fa.createListOfAddresses=void 0;var w4=aa(),tS=Dc(),E4=Ra();function v4(t){let e=t.map(n=>new w4.AddressValue(n));return tS.List.fromItems(e)}Fa.createListOfAddresses=v4;function A4(t){let e=t.map(n=>new E4.TokenIdentifierValue(n));return tS.List.fromItems(e)}Fa.createListOfTokenIdentifiers=A4});var yS=w(Qt=>{"use strict";c();var b4=Qt&&Qt.__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]}),_4=Qt&&Qt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),I4=Qt&&Qt.__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)&&b4(e,t,r);return _4(e,t),e};Object.defineProperty(Qt,"__esModule",{value:!0});Qt.onPrimitiveTypeSelect=Qt.onPrimitiveValueSelect=Qt.onTypedValueSelect=Qt.onTypeSelect=void 0;var sh=I4(je()),nS=aa(),iS=Oc(),sS=yi(),oS=Tc(),ih=Dc(),aS=Pc(),uS=Rc(),cS=Jf(),lS=ra(),fS=Ra(),hS=Zf(),dS=mt(),pS=Yf(),gS=Xf();function S4(t,e){if(t.hasExactClass(ih.OptionType.ClassName))return e.onOption();if(t.hasExactClass(ih.ListType.ClassName))return e.onList();if(t.hasExactClass(pS.ArrayVecType.ClassName))return e.onArray();if(t.hasClassOrSuperclass(dS.PrimitiveType.ClassName))return e.onPrimitive();if(t.hasExactClass(lS.StructType.ClassName))return e.onStruct();if(t.hasExactClass(hS.TupleType.ClassName))return e.onTuple();if(t.hasExactClass(oS.EnumType.ClassName))return e.onEnum();if(e.onOther)return e.onOther();throw new sh.ErrTypingSystem(`type isn't known: ${t}`)}Qt.onTypeSelect=S4;function C4(t,e){if(t.hasClassOrSuperclass(dS.PrimitiveValue.ClassName))return e.onPrimitive();if(t.hasExactClass(ih.OptionValue.ClassName))return e.onOption();if(t.hasExactClass(ih.List.ClassName))return e.onList();if(t.hasExactClass(pS.ArrayVec.ClassName))return e.onArray();if(t.hasExactClass(lS.Struct.ClassName))return e.onStruct();if(t.hasExactClass(hS.Tuple.ClassName))return e.onTuple();if(t.hasExactClass(oS.EnumValue.ClassName))return e.onEnum();if(e.onOther)return e.onOther();throw new sh.ErrTypingSystem(`value isn't typed: ${t}`)}Qt.onTypedValueSelect=C4;function T4(t,e){if(t.hasExactClass(iS.BooleanValue.ClassName))return e.onBoolean();if(t.hasClassOrSuperclass(uS.NumericalValue.ClassName))return e.onNumerical();if(t.hasExactClass(nS.AddressValue.ClassName))return e.onAddress();if(t.hasExactClass(sS.BytesValue.ClassName))return e.onBytes();if(t.hasExactClass(gS.StringValue.ClassName))return e.onString();if(t.hasExactClass(aS.H256Value.ClassName))return e.onH256();if(t.hasExactClass(fS.TokenIdentifierValue.ClassName))return e.onTypeIdentifier();if(t.hasExactClass(cS.NothingValue.ClassName))return e.onNothing();if(e.onOther)return e.onOther();throw new sh.ErrTypingSystem(`value isn't a primitive: ${t.getType()}`)}Qt.onPrimitiveValueSelect=T4;function x4(t,e){if(t.hasExactClass(iS.BooleanType.ClassName))return e.onBoolean();if(t.hasClassOrSuperclass(uS.NumericalType.ClassName))return e.onNumerical();if(t.hasExactClass(nS.AddressType.ClassName))return e.onAddress();if(t.hasExactClass(sS.BytesType.ClassName))return e.onBytes();if(t.hasExactClass(gS.StringType.ClassName))return e.onString();if(t.hasExactClass(aS.H256Type.ClassName))return e.onH256();if(t.hasExactClass(fS.TokenIdentifierType.ClassName))return e.onTokenIndetifier();if(t.hasExactClass(cS.NothingType.ClassName))return e.onNothing();if(e.onOther)return e.onOther();throw new sh.ErrTypingSystem(`type isn't a known primitive: ${t}`)}Qt.onPrimitiveTypeSelect=x4});var Tt=w(Ue=>{"use strict";c();var N4=Ue&&Ue.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Xe=Ue&&Ue.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&N4(e,t,r)};Object.defineProperty(Ue,"__esModule",{value:!0});Xe(eS(),Ue);Xe(aa(),Ue);Xe(zf(),Ue);Xe(Oc(),Ue);Xe(yi(),Ue);Xe(Kf(),Ue);Xe(um(),Ue);Xe(Tc(),Ue);Xe(rS(),Ue);Xe(Xo(),Ue);Xe(Dc(),Ue);Xe(Yf(),Ue);Xe(Pc(),Ue);Xe(yS(),Ue);Xe(Jf(),Ue);Xe(Rc(),Ue);Xe(Xf(),Ue);Xe(ra(),Ue);Xe(Ra(),Ue);Xe(Zf(),Ue);Xe(Mf(),Ue);Xe(Im(),Ue);Xe(mt(),Ue);Xe(th(),Ue)});var wS=w(on=>{"use strict";c();var O4=on&&on.__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]}),D4=on&&on.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),P4=on&&on.__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)&&O4(e,t,r);return D4(e,t),e};Object.defineProperty(on,"__esModule",{value:!0});on.OptionValueBinaryCodec=void 0;var mS=P4(je()),oh=Tt(),Cm=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){if(e[0]==0)return[oh.OptionValue.newMissingTyped(r),1];if(e[0]!=1)throw new mS.ErrCodec("invalid buffer for optional value");let[n,i]=this.binaryCodec.decodeNested(e.slice(1),r);return[oh.OptionValue.newProvided(n),i+1]}decodeTopLevel(e,r){if(e.length==0)return new oh.OptionValue(r);if(e[0]!=1)throw new mS.ErrCodec("invalid buffer for optional value");let[n,i]=this.binaryCodec.decodeNested(e.slice(1),r);return new oh.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([])}};on.OptionValueBinaryCodec=Cm});var ES=w(ah=>{"use strict";c();Object.defineProperty(ah,"__esModule",{value:!0});ah.AddressBinaryCodec=void 0;var R4=tr(),B4=Tt(),Tm=class{decodeNested(e){let r=e.slice(0,32),n=new R4.Address(r);return[new B4.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()}};ah.AddressBinaryCodec=Tm});var AS=w(an=>{"use strict";c();var L4=an&&an.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),F4=an&&an.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),M4=an&&an.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&L4(e,t,r);return F4(e,t),e};Object.defineProperty(an,"__esModule",{value:!0});an.BooleanBinaryCodec=void 0;var U4=M4(je()),vS=Tt(),Br=class{decodeNested(e){let r=e.readUInt8(0);return[new vS.BooleanValue(r==Br.TRUE),1]}decodeTopLevel(e){if(e.length>1)throw new U4.ErrInvalidArgument("buffer should be of size <= 1");let r=e[0];return new vS.BooleanValue(r==Br.TRUE)}encodeNested(e){return e.isTrue()?h.Buffer.from([Br.TRUE]):h.Buffer.from([Br.FALSE])}encodeTopLevel(e){return e.isTrue()?h.Buffer.from([Br.TRUE]):h.Buffer.from([])}};an.BooleanBinaryCodec=Br;Br.TRUE=1;Br.FALSE=0});var ch=w(uh=>{"use strict";c();Object.defineProperty(uh,"__esModule",{value:!0});uh.SizeOfU32=void 0;uh.SizeOfU32=4});var xm=w(un=>{"use strict";c();var q4=un&&un.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(un,"__esModule",{value:!0});un.zeroPadStringIfOddLength=un.isPaddedHex=un.numberToPaddedHex=void 0;var V4=q4(Yt());function j4(t){let e=new V4.default(t).toString(16);return bS(e)}un.numberToPaddedHex=j4;function H4(t){t=t||"";let e=h.Buffer.from(t,"hex").toString("hex");return t.toUpperCase()==e.toUpperCase()}un.isPaddedHex=H4;function bS(t){return t=t||"",t.length%2==1?"0"+t:t}un.zeroPadStringIfOddLength=bS});var lh=w(wt=>{"use strict";c();var G4=wt&&wt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(wt,"__esModule",{value:!0});wt.prependByteToBuffer=wt.flipBufferBitsInPlace=wt.getHexMagnitudeOfBigInt=wt.bigIntToBuffer=wt.bufferToBigInt=wt.cloneBuffer=wt.isMsbZero=wt.isMsbOne=void 0;var Nm=G4(Yt()),Q4=xm();function _S(t,e=0){return t[e]>>7==1}wt.isMsbOne=_S;function k4(t,e=0){return!_S(t,e)}wt.isMsbZero=k4;function z4(t){let e=h.Buffer.alloc(t.length);return t.copy(e),e}wt.cloneBuffer=z4;function W4(t){let e=t.toString("hex");return new Nm.default(`0x${e}`,16)}wt.bufferToBigInt=W4;function K4(t){let e=IS(t);return h.Buffer.from(e,"hex")}wt.bigIntToBuffer=K4;function IS(t){return t=new Nm.default(t),t?(t.isNegative()&&(t=t.multipliedBy(new Nm.default(-1))),Q4.numberToPaddedHex(t)):""}wt.getHexMagnitudeOfBigInt=IS;function $4(t){for(let e=0;e{"use strict";c();var J4=Ma&&Ma.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ma,"__esModule",{value:!0});Ma.NumericalBinaryCodec=void 0;var Lc=J4(Yt()),Om=Tt(),SS=ch(),ht=lh(),Dm=class{decodeNested(e,r){let n=0,i=r.sizeInBytes;i||(n=SS.SizeOfU32,i=e.readUInt32BE(0));let s=e.slice(n,n+i),o=this.decodeTopLevel(s,r),a=i+n;return[o,a]}decodeTopLevel(e,r){let n=ht.cloneBuffer(e);if(e.length==0)return new Om.NumericalValue(r,new Lc.default(0));if(!r.withSign||ht.isMsbZero(n)){let l=ht.bufferToBigInt(n);return new Om.NumericalValue(r,l)}ht.flipBufferBitsInPlace(n);let u=ht.bufferToBigInt(n).multipliedBy(new Lc.default(-1)).minus(new Lc.default(1));return new Om.NumericalValue(r,u)}encodeNested(e){if(e.sizeInBytes)return this.encodeNestedFixedSize(e,e.sizeInBytes);let r=this.encodeTopLevel(e),n=h.Buffer.alloc(SS.SizeOfU32);return n.writeUInt32BE(r.length),h.Buffer.concat([n,r])}encodeNestedFixedSize(e,r){if(e.value.isZero())return h.Buffer.alloc(r,0);if(!e.withSign){let o=ht.bigIntToBuffer(e.value),a=h.Buffer.alloc(r-o.length,0);return h.Buffer.concat([a,o])}if(e.value.isPositive()){let o=ht.bigIntToBuffer(e.value);ht.isMsbOne(o)&&(o=ht.prependByteToBuffer(o,0));let a=h.Buffer.alloc(r-o.length,0);return h.Buffer.concat([a,o])}let n=e.value.plus(new Lc.default(1)),i=ht.bigIntToBuffer(n);ht.flipBufferBitsInPlace(i),ht.isMsbZero(i)&&(i=ht.prependByteToBuffer(i,255));let s=h.Buffer.alloc(r-i.length,255);return h.Buffer.concat([s,i])}encodeTopLevel(e){let r=e.withSign;return e.value.isZero()?h.Buffer.alloc(0):r?this.encodePrimitive(e):ht.bigIntToBuffer(e.value)}encodePrimitive(e){if(e.value.isPositive()){let i=ht.bigIntToBuffer(e.value);return ht.isMsbOne(i)&&(i=ht.prependByteToBuffer(i,0)),i}let r=e.value.plus(new Lc.default(1)),n=ht.bigIntToBuffer(r);return ht.flipBufferBitsInPlace(n),ht.isMsbZero(n)&&(n=ht.prependByteToBuffer(n,255)),n}};Ma.NumericalBinaryCodec=Dm});var TS=w(fh=>{"use strict";c();Object.defineProperty(fh,"__esModule",{value:!0});fh.H256BinaryCodec=void 0;var X4=Pc(),Pm=class{decodeNested(e){let r=e.slice(0,32);return[new X4.H256Value(r),32]}decodeTopLevel(e){let[r,n]=this.decodeNested(e);return r}encodeNested(e){return e.valueOf()}encodeTopLevel(e){return e.valueOf()}};fh.H256BinaryCodec=Pm});var ph=w(dh=>{"use strict";c();Object.defineProperty(dh,"__esModule",{value:!0});dh.BytesBinaryCodec=void 0;var xS=yi(),hh=ch(),Rm=class{decodeNested(e){let r=e.readUInt32BE(0),n=e.slice(hh.SizeOfU32,hh.SizeOfU32+r);return[new xS.BytesValue(n),hh.SizeOfU32+r]}decodeTopLevel(e){return new xS.BytesValue(e)}encodeNested(e){let r=h.Buffer.alloc(hh.SizeOfU32);return r.writeUInt32BE(e.getLength()),h.Buffer.concat([r,e.valueOf()])}encodeTopLevel(e){return e.valueOf()}};dh.BytesBinaryCodec=Rm});var OS=w(gh=>{"use strict";c();Object.defineProperty(gh,"__esModule",{value:!0});gh.TokenIdentifierCodec=void 0;var Z4=yi(),NS=Ra(),eU=ph(),Bm=class{constructor(){this.bytesCodec=new eU.BytesBinaryCodec}decodeNested(e){let[r,n]=this.bytesCodec.decodeNested(e);return[new NS.TokenIdentifierValue(r.toString()),n]}decodeTopLevel(e){let r=this.bytesCodec.decodeTopLevel(e);return new NS.TokenIdentifierValue(r.toString())}encodeNested(e){let r=Z4.BytesValue.fromUTF8(e.valueOf());return this.bytesCodec.encodeNested(r)}encodeTopLevel(e){return h.Buffer.from(e.valueOf())}};gh.TokenIdentifierCodec=Bm});var PS=w(yh=>{"use strict";c();Object.defineProperty(yh,"__esModule",{value:!0});yh.NothingCodec=void 0;var DS=Tt(),Lm=class{decodeNested(){return[new DS.NothingValue,0]}decodeTopLevel(){return new DS.NothingValue}encodeNested(){return h.Buffer.from([])}encodeTopLevel(){return h.Buffer.from([])}};yh.NothingCodec=Lm});var BS=w(mh=>{"use strict";c();Object.defineProperty(mh,"__esModule",{value:!0});mh.StringBinaryCodec=void 0;var RS=Tt(),tU=yi(),rU=ph(),Fm=class{constructor(){this.bytesBinaryCodec=new rU.BytesBinaryCodec}decodeNested(e){let[r,n]=this.bytesBinaryCodec.decodeNested(e);return[new RS.StringValue(r.valueOf().toString()),n]}decodeTopLevel(e){return new RS.StringValue(e.toString())}encodeNested(e){let r=tU.BytesValue.fromUTF8(e.valueOf());return this.bytesBinaryCodec.encodeNested(r)}encodeTopLevel(e){return h.Buffer.from(e.valueOf())}};mh.StringBinaryCodec=Fm});var LS=w(Eh=>{"use strict";c();Object.defineProperty(Eh,"__esModule",{value:!0});Eh.PrimitiveBinaryCodec=void 0;var wh=Tt(),nU=ES(),iU=AS(),sU=CS(),oU=TS(),aU=ph(),uU=OS(),cU=PS(),lU=BS(),Mm=class{constructor(e){this.binaryCodec=e,this.booleanCodec=new iU.BooleanBinaryCodec,this.numericalCodec=new sU.NumericalBinaryCodec,this.addressCodec=new nU.AddressBinaryCodec,this.h256Codec=new oU.H256BinaryCodec,this.bytesCodec=new aU.BytesBinaryCodec,this.stringCodec=new lU.StringBinaryCodec,this.tokenIdentifierCodec=new uU.TokenIdentifierCodec,this.nothingCodec=new cU.NothingCodec}decodeNested(e,r){return wh.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 wh.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 wh.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 wh.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()})}};Eh.PrimitiveBinaryCodec=Mm});var US=w(vh=>{"use strict";c();Object.defineProperty(vh,"__esModule",{value:!0});vh.ListBinaryCodec=void 0;var FS=Tt(),MS=ch(),Um=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=MS.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 FS.List(r,i)}encodeNested(e){this.binaryCodec.constraints.checkListLength(e.getLength());let r=h.Buffer.alloc(MS.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)}};vh.ListBinaryCodec=Um});var Vm=w(Ah=>{"use strict";c();Object.defineProperty(Ah,"__esModule",{value:!0});Ah.FieldsBinaryCodec=void 0;var fU=Tt(),qm=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 fU.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)}};Ah.FieldsBinaryCodec=qm});var Hm=w(bh=>{"use strict";c();Object.defineProperty(bh,"__esModule",{value:!0});bh.StructBinaryCodec=void 0;var hU=Tt(),dU=Vm(),jm=class{constructor(e){this.fieldsCodec=new dU.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 hU.Struct(r,i),s]}encodeNested(e){let r=e.getFields();return this.fieldsCodec.encodeNested(r)}encodeTopLevel(e){return this.encodeNested(e)}};bh.StructBinaryCodec=jm});var qS=w(Ih=>{"use strict";c();Object.defineProperty(Ih,"__esModule",{value:!0});Ih.EnumBinaryCodec=void 0;var _h=Tt(),pU=Vm(),Gm=class{constructor(e){this.binaryCodec=e,this.fieldsCodec=new pU.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 _h.EnumValue(r,s,a),i+u]}readDiscriminant(e){let[r,n]=this.binaryCodec.decodeNested(e,new _h.U8Type);return[r.valueOf(),n]}encodeNested(e){let r=new _h.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 _h.U8Value(e.discriminant),o=n?this.binaryCodec.encodeNested(s):this.binaryCodec.encodeTopLevel(s);return h.Buffer.concat([o,i])}};Ih.EnumBinaryCodec=Gm});var VS=w(Sh=>{"use strict";c();Object.defineProperty(Sh,"__esModule",{value:!0});Sh.TupleBinaryCodec=void 0;var gU=Hm(),Qm=class{constructor(e){this.structCodec=new gU.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)}};Sh.TupleBinaryCodec=Qm});var jS=w(Ch=>{"use strict";c();Object.defineProperty(Ch,"__esModule",{value:!0});Ch.ArrayVecBinaryCodec=void 0;var yU=Tt(),km=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){let n=r.length,i=r.getFirstTypeParameter(),s=[],o=0;for(let a=0;a{"use strict";c();var mU=wr&&wr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),wU=wr&&wr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),EU=wr&&wr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&mU(e,t,r);return wU(e,t),e};Object.defineProperty(wr,"__esModule",{value:!0});wr.BinaryCodecConstraints=wr.BinaryCodec=void 0;var HS=EU(je()),Th=Tt(),GS=gr(),vU=wS(),AU=LS(),bU=US(),_U=Hm(),IU=qS(),SU=VS(),CU=jS(),zm=class{constructor(e=null){this.constraints=e||new xh,this.optionCodec=new vU.OptionValueBinaryCodec(this),this.listCodec=new bU.ListBinaryCodec(this),this.arrayCodec=new CU.ArrayVecBinaryCodec(this),this.primitiveCodec=new AU.PrimitiveBinaryCodec(this),this.structCodec=new _U.StructBinaryCodec(this),this.tupleCodec=new SU.TupleBinaryCodec(this),this.enumCodec=new IU.EnumBinaryCodec(this)}decodeTopLevel(e,r){return this.constraints.checkBufferLength(e),Th.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]=Th.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 GS.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),Th.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 GS.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),Th.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)})}};wr.BinaryCodec=zm;var xh=class{constructor(e){this.maxBufferLength=e?.maxBufferLength||256e3,this.maxListLength=e?.maxListLength||128e3}checkBufferLength(e){if(e.length>this.maxBufferLength)throw new HS.ErrCodec(`Buffer too large: ${e.length} > ${this.maxBufferLength}`)}checkListLength(e){if(e>this.maxListLength)throw new HS.ErrCodec(`List too large: ${e} > ${this.maxListLength}`)}};wr.BinaryCodecConstraints=xh});var QS=w(Er=>{"use strict";c();var TU=Er&&Er.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Er,"__esModule",{value:!0});Er.decodeBigNumber=Er.decodeString=Er.decodeBool=Er.decodeUnsignedNumber=void 0;var xU=TU(Yt()),Nh=Tt(),NU=Wm(),Oh=new NU.BinaryCodec;function OU(t){let e=Oh.decodeTopLevel(t,new Nh.BigUIntType);return Number(e.valueOf())}Er.decodeUnsignedNumber=OU;function DU(t){return!!Oh.decodeTopLevel(t,new Nh.BooleanType).valueOf()}Er.decodeBool=DU;function PU(t){let e=Oh.decodeTopLevel(t,new Nh.BytesType);return String(e.valueOf())}Er.decodeString=PU;function RU(t){let e=Oh.decodeTopLevel(t,new Nh.BigUIntType);return new xU.default(e.valueOf())}Er.decodeBigNumber=RU});var zS=w(_i=>{"use strict";c();var BU=_i&&_i.__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]}),kS=_i&&_i.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&BU(e,t,r)};Object.defineProperty(_i,"__esModule",{value:!0});kS(Wm(),_i);kS(QS(),_i)});var Ph=w(Dh=>{"use strict";c();Object.defineProperty(Dh,"__esModule",{value:!0});Dh.ArgSerializer=void 0;var WS=Go(),LU=zS(),Km=zf(),$m=Kf(),Ym=th(),FU={codec:new LU.BinaryCodec},Jm=class{constructor(e){e=Object.assign(Object.assign({},FU),e),this.codec=e.codec}stringToValues(e,r){let n=this.stringToBuffers(e);return this.buffersToValues(n,r)}stringToBuffers(e){return e.split(WS.ARGUMENTS_SEPARATOR).map(r=>h.Buffer.from(r,"hex"))}buffersToValues(e,r){let n=this;e=e||[];let i=[],s=0,o=e.length;for(let f=0;f=o}return i}valuesToString(e){let r=this.valuesToStrings(e),n=r.join(WS.ARGUMENTS_SEPARATOR),i=r.length;return{argumentsString:n,count:i}}valuesToStrings(e){return this.valuesToBuffers(e).map(i=>i.toString("hex"))}valuesToBuffers(e){let r=this,n=[];for(let s of e)i(s);function i(s){if(s.hasExactClass(Km.OptionalValue.ClassName)){let o=s;o.isSet()&&i(o.getTypedValue())}else if(s.hasExactClass(Ym.VariadicValue.ClassName)){let o=s;for(let a of o.getItems())i(a)}else if(s.hasExactClass($m.CompositeValue.ClassName)){let o=s;for(let a of o.getItems())i(a)}else{let o=r.codec.encodeTopLevel(s);n.push(o)}}return n}};Dh.ArgSerializer=Jm});var Lh=w(Bh=>{"use strict";c();Object.defineProperty(Bh,"__esModule",{value:!0});Bh.Compatibility=void 0;var MU=tr(),Rh=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()==MU.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.`))}};Bh.Compatibility=Rh;Rh.areWarningsEnabled=!0});var KS=w(cn=>{"use strict";c();var UU=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]}),qU=cn&&cn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VU=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)&&UU(e,t,r);return qU(e,t),e};Object.defineProperty(cn,"__esModule",{value:!0});cn.Hash=void 0;var jU=VU(je()),Fc=class{constructor(e){if(!e)this.hash=h.Buffer.from([]);else if(e instanceof h.Buffer)this.hash=e;else if(typeof e=="string")this.hash=h.Buffer.from(e,"hex");else throw new jU.ErrBadType("hash","buffer | string",e)}static empty(){return new Fc(h.Buffer.from([]))}isEmpty(){return this.hash.length==0}toString(){return this.hex()}hex(){return this.hash.toString("hex")}valueOf(){return this.hash}};cn.Hash=Fc});var YS=w(vr=>{"use strict";c();var HU=vr&&vr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),GU=vr&&vr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QU=vr&&vr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&HU(e,t,r);return GU(e,t),e};Object.defineProperty(vr,"__esModule",{value:!0});vr.TransactionOptions=vr.TransactionVersion=void 0;var Lr=Go(),$S=QU(je()),Ua=class{constructor(e){if(e=Number(e),e<1)throw new $S.ErrTransactionVersionInvalid(e);this.value=e}static withDefaultVersion(){return new Ua(Lr.TRANSACTION_VERSION_DEFAULT)}static withTxOptions(){return new Ua(Lr.TRANSACTION_VERSION_WITH_OPTIONS)}valueOf(){return this.value}};vr.TransactionVersion=Ua;var qa=class{constructor(e){if(e=Number(e),e<0)throw new $S.ErrTransactionOptionsInvalid(e);this.value=e}static withDefaultOptions(){return new qa(Lr.TRANSACTION_OPTIONS_DEFAULT)}static withOptions(e){let r=0;return e.hashSign&&(r|=Lr.TRANSACTION_OPTIONS_TX_HASH_SIGN),e.guarded&&(r|=Lr.TRANSACTION_OPTIONS_TX_GUARDED),new qa(r)}isWithHashSign(){return(this.value&Lr.TRANSACTION_OPTIONS_TX_HASH_SIGN)==Lr.TRANSACTION_OPTIONS_TX_HASH_SIGN}isWithGuardian(){return(this.value&Lr.TRANSACTION_OPTIONS_TX_GUARDED)==Lr.TRANSACTION_OPTIONS_TX_GUARDED}setWithHashSign(){this.value|=Lr.TRANSACTION_OPTIONS_TX_HASH_SIGN}setWithGuardian(){this.value|=Lr.TRANSACTION_OPTIONS_TX_GUARDED}valueOf(){return this.value}};vr.TransactionOptions=qa});var XS=w((iie,JS)=>{"use strict";c();JS.exports=kU;function kU(t,e){for(var r=new Array(arguments.length-1),n=0,i=2,s=!0;i{"use strict";c();var Fh=tC;Fh.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 Va=new Array(64),eC=new Array(123);for(Fr=0;Fr<64;)eC[Va[Fr]=Fr<26?Fr+65:Fr<52?Fr+71:Fr<62?Fr-4:Fr-59|43]=Fr++;var Fr;Fh.encode=function(e,r,n){for(var i=null,s=[],o=0,a=0,u;r>2],u=(l&3)<<4,a=1;break;case 1:s[o++]=Va[u|l>>4],u=(l&15)<<2,a=2;break;case 2:s[o++]=Va[u|l>>6],s[o++]=Va[l&63],a=0;break}o>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,s)),o=0)}return a&&(s[o++]=Va[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 ZS="invalid encoding";Fh.decode=function(e,r,n){for(var i=n,s=0,o,a=0;a1)break;if((u=eC[u])===void 0)throw Error(ZS);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(ZS);return n-i};Fh.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var iC=w((uie,nC)=>{"use strict";c();nC.exports=Mh;function Mh(){this._listeners={}}Mh.prototype.on=function(e,r,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:r,ctx:n||this}),this};Mh.prototype.off=function(e,r){if(e===void 0)this._listeners={};else if(r===void 0)this._listeners[e]=[];else for(var n=this._listeners[e],i=0;i{"use strict";c();lC.exports=sC(sC);function sC(t){return typeof Float32Array<"u"?function(){var e=new Float32Array([-0]),r=new Uint8Array(e.buffer),n=r[3]===128;function i(u,l,f){e[0]=u,l[f]=r[0],l[f+1]=r[1],l[f+2]=r[2],l[f+3]=r[3]}function s(u,l,f){e[0]=u,l[f]=r[3],l[f+1]=r[2],l[f+2]=r[1],l[f+3]=r[0]}t.writeFloatLE=n?i:s,t.writeFloatBE=n?s:i;function o(u,l){return r[0]=u[l],r[1]=u[l+1],r[2]=u[l+2],r[3]=u[l+3],e[0]}function a(u,l){return r[3]=u[l],r[2]=u[l+1],r[1]=u[l+2],r[0]=u[l+3],e[0]}t.readFloatLE=n?o:a,t.readFloatBE=n?a:o}():function(){function e(n,i,s,o){var a=i<0?1:0;if(a&&(i=-i),i===0)n(1/i>0?0:2147483648,s,o);else if(isNaN(i))n(2143289344,s,o);else if(i>34028234663852886e22)n((a<<31|2139095040)>>>0,s,o);else if(i<11754943508222875e-54)n((a<<31|Math.round(i/1401298464324817e-60))>>>0,s,o);else{var u=Math.floor(Math.log(i)/Math.LN2),l=Math.round(i*Math.pow(2,-u)*8388608)&8388607;n((a<<31|u+127<<23|l)>>>0,s,o)}}t.writeFloatLE=e.bind(null,oC),t.writeFloatBE=e.bind(null,aC);function r(n,i,s){var o=n(i,s),a=(o>>31)*2+1,u=o>>>23&255,l=o&8388607;return u===255?l?NaN:a*(1/0):u===0?a*1401298464324817e-60*l:a*Math.pow(2,u-150)*(l+8388608)}t.readFloatLE=r.bind(null,uC),t.readFloatBE=r.bind(null,cC)}(),typeof Float64Array<"u"?function(){var e=new Float64Array([-0]),r=new Uint8Array(e.buffer),n=r[7]===128;function i(u,l,f){e[0]=u,l[f]=r[0],l[f+1]=r[1],l[f+2]=r[2],l[f+3]=r[3],l[f+4]=r[4],l[f+5]=r[5],l[f+6]=r[6],l[f+7]=r[7]}function s(u,l,f){e[0]=u,l[f]=r[7],l[f+1]=r[6],l[f+2]=r[5],l[f+3]=r[4],l[f+4]=r[3],l[f+5]=r[2],l[f+6]=r[1],l[f+7]=r[0]}t.writeDoubleLE=n?i:s,t.writeDoubleBE=n?s:i;function o(u,l){return r[0]=u[l],r[1]=u[l+1],r[2]=u[l+2],r[3]=u[l+3],r[4]=u[l+4],r[5]=u[l+5],r[6]=u[l+6],r[7]=u[l+7],e[0]}function a(u,l){return r[7]=u[l],r[6]=u[l+1],r[5]=u[l+2],r[4]=u[l+3],r[3]=u[l+4],r[2]=u[l+5],r[1]=u[l+6],r[0]=u[l+7],e[0]}t.readDoubleLE=n?o:a,t.readDoubleBE=n?a:o}():function(){function e(n,i,s,o,a,u){var l=o<0?1:0;if(l&&(o=-o),o===0)n(0,a,u+i),n(1/o>0?0:2147483648,a,u+s);else if(isNaN(o))n(0,a,u+i),n(2146959360,a,u+s);else if(o>17976931348623157e292)n(0,a,u+i),n((l<<31|2146435072)>>>0,a,u+s);else{var f;if(o<22250738585072014e-324)f=o/5e-324,n(f>>>0,a,u+i),n((l<<31|f/4294967296)>>>0,a,u+s);else{var d=Math.floor(Math.log(o)/Math.LN2);d===1024&&(d=1023),f=o*Math.pow(2,-d),n(f*4503599627370496>>>0,a,u+i),n((l<<31|d+1023<<20|f*1048576&1048575)>>>0,a,u+s)}}}t.writeDoubleLE=e.bind(null,oC,0,4),t.writeDoubleBE=e.bind(null,aC,4,0);function r(n,i,s,o,a){var u=n(o,a+i),l=n(o,a+s),f=(l>>31)*2+1,d=l>>>20&2047,y=4294967296*(l&1048575)+u;return d===2047?y?NaN:f*(1/0):d===0?f*5e-324*y:f*Math.pow(2,d-1075)*(y+4503599627370496)}t.readDoubleLE=r.bind(null,uC,0,4),t.readDoubleBE=r.bind(null,cC,4,0)}(),t}function oC(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 aC(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 uC(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0}function cC(t,e){return(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}});var hC=w((exports,module)=>{"use strict";c();module.exports=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(t){}return null}});var pC=w(dC=>{"use strict";c();var Xm=dC;Xm.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))};Xm.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 yC=w((gie,gC)=>{"use strict";c();gC.exports=zU;function zU(t,e,r){var n=r||8192,i=n>>>1,s=null,o=n;return function(u){if(u<1||u>i)return t(u);o+u>n&&(s=t(n),o=0);var l=e.call(s,o,o+=u);return o&7&&(o=(o|7)+1),l}}});var wC=w((mie,mC)=>{"use strict";c();mC.exports=xt;var Mc=Si();function xt(t,e){this.lo=t>>>0,this.hi=e>>>0}var $s=xt.zero=new xt(0,0);$s.toNumber=function(){return 0};$s.zzEncode=$s.zzDecode=function(){return this};$s.length=function(){return 1};var WU=xt.zeroHash="\0\0\0\0\0\0\0\0";xt.fromNumber=function(e){if(e===0)return $s;var r=e<0;r&&(e=-e);var n=e>>>0,i=(e-n)/4294967296>>>0;return r&&(i=~i>>>0,n=~n>>>0,++n>4294967295&&(n=0,++i>4294967295&&(i=0))),new xt(n,i)};xt.from=function(e){if(typeof e=="number")return xt.fromNumber(e);if(Mc.isString(e))if(Mc.Long)e=Mc.Long.fromString(e);else return xt.fromNumber(parseInt(e,10));return e.low||e.high?new xt(e.low>>>0,e.high>>>0):$s};xt.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var r=~this.lo+1>>>0,n=~this.hi>>>0;return r||(n=n+1>>>0),-(r+n*4294967296)}return this.lo+this.hi*4294967296};xt.prototype.toLong=function(e){return Mc.Long?new Mc.Long(this.lo|0,this.hi|0,!!e):{low:this.lo|0,high:this.hi|0,unsigned:!!e}};var Ii=String.prototype.charCodeAt;xt.fromHash=function(e){return e===WU?$s:new xt((Ii.call(e,0)|Ii.call(e,1)<<8|Ii.call(e,2)<<16|Ii.call(e,3)<<24)>>>0,(Ii.call(e,4)|Ii.call(e,5)<<8|Ii.call(e,6)<<16|Ii.call(e,7)<<24)>>>0)};xt.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)};xt.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this};xt.prototype.zzDecode=function(){var e=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this};xt.prototype.length=function(){var e=this.lo,r=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?r===0?e<16384?e<128?1:2:e<2097152?3:4:r<16384?r<128?5:6:r<2097152?7:8:n<128?9:10}});var Si=w(Zm=>{"use strict";c();var me=Zm;me.asPromise=XS();me.base64=rC();me.EventEmitter=iC();me.float=fC();me.inquire=hC();me.utf8=pC();me.pool=yC();me.LongBits=wC();me.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);me.global=me.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||Zm;me.emptyArray=Object.freeze?Object.freeze([]):[];me.emptyObject=Object.freeze?Object.freeze({}):{};me.isInteger=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};me.isString=function(e){return typeof e=="string"||e instanceof String};me.isObject=function(e){return e&&typeof e=="object"};me.isset=me.isSet=function(e,r){var n=e[r];return n!=null&&e.hasOwnProperty(r)?typeof n!="object"||(Array.isArray(n)?n.length:Object.keys(n).length)>0:!1};me.Buffer=function(){try{var t=me.inquire("buffer").Buffer;return t.prototype.utf8Write?t:null}catch{return null}}();me._Buffer_from=null;me._Buffer_allocUnsafe=null;me.newBuffer=function(e){return typeof e=="number"?me.Buffer?me._Buffer_allocUnsafe(e):new me.Array(e):me.Buffer?me._Buffer_from(e):typeof Uint8Array>"u"?e:new Uint8Array(e)};me.Array=typeof Uint8Array<"u"?Uint8Array:Array;me.Long=me.global.dcodeIO&&me.global.dcodeIO.Long||me.global.Long||me.inquire("long");me.key2Re=/^true|false|0|1$/;me.key32Re=/^-?(?:0|[1-9][0-9]*)$/;me.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;me.longToHash=function(e){return e?me.LongBits.from(e).toHash():me.LongBits.zeroHash};me.longFromHash=function(e,r){var n=me.LongBits.fromHash(e);return me.Long?me.Long.fromBits(n.lo,n.hi,r):n.toNumber(!!r)};function EC(t,e,r){for(var n=Object.keys(e),i=0;i-1;--s)if(r[i[s]]===1&&this[i[s]]!==void 0&&this[i[s]]!==null)return i[s]}};me.oneOfSetter=function(e){return function(r){for(var n=0;n{"use strict";c();IC.exports=Le;var Ar=Si(),ew,Uh=Ar.LongBits,AC=Ar.base64,bC=Ar.utf8;function Uc(t,e,r){this.fn=t,this.len=e,this.next=void 0,this.val=r}function rw(){}function KU(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}function Le(){this.len=0,this.head=new Uc(rw,0,0),this.tail=this.head,this.states=null}var _C=function(){return Ar.Buffer?function(){return(Le.create=function(){return new ew})()}:function(){return new Le}};Le.create=_C();Le.alloc=function(e){return new Ar.Array(e)};Ar.Array!==Array&&(Le.alloc=Ar.pool(Le.alloc,Ar.Array.prototype.subarray));Le.prototype._push=function(e,r,n){return this.tail=this.tail.next=new Uc(e,r,n),this.len+=r,this};function nw(t,e,r){e[r]=t&255}function $U(t,e,r){for(;t>127;)e[r++]=t&127|128,t>>>=7;e[r]=t}function iw(t,e){this.len=t,this.next=void 0,this.val=e}iw.prototype=Object.create(Uc.prototype);iw.prototype.fn=$U;Le.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new iw((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this};Le.prototype.int32=function(e){return e<0?this._push(sw,10,Uh.fromNumber(e)):this.uint32(e)};Le.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function sw(t,e,r){for(;t.hi;)e[r++]=t.lo&127|128,t.lo=(t.lo>>>7|t.hi<<25)>>>0,t.hi>>>=7;for(;t.lo>127;)e[r++]=t.lo&127|128,t.lo=t.lo>>>7;e[r++]=t.lo}Le.prototype.uint64=function(e){var r=Uh.from(e);return this._push(sw,r.length(),r)};Le.prototype.int64=Le.prototype.uint64;Le.prototype.sint64=function(e){var r=Uh.from(e).zzEncode();return this._push(sw,r.length(),r)};Le.prototype.bool=function(e){return this._push(nw,1,e?1:0)};function tw(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}Le.prototype.fixed32=function(e){return this._push(tw,4,e>>>0)};Le.prototype.sfixed32=Le.prototype.fixed32;Le.prototype.fixed64=function(e){var r=Uh.from(e);return this._push(tw,4,r.lo)._push(tw,4,r.hi)};Le.prototype.sfixed64=Le.prototype.fixed64;Le.prototype.float=function(e){return this._push(Ar.float.writeFloatLE,4,e)};Le.prototype.double=function(e){return this._push(Ar.float.writeDoubleLE,8,e)};var YU=Ar.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(nw,1,0);if(Ar.isString(e)){var n=Le.alloc(r=AC.length(e));AC.decode(e,n,0),e=n}return this.uint32(r)._push(YU,r,e)};Le.prototype.string=function(e){var r=bC.length(e);return r?this.uint32(r)._push(bC.write,r,e):this._push(nw,1,0)};Le.prototype.fork=function(){return this.states=new KU(this),this.head=this.tail=new Uc(rw,0,0),this.len=0,this};Le.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new Uc(rw,0,0),this.len=0),this};Le.prototype.ldelim=function(){var e=this.head,r=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=e.next,this.tail=r,this.len+=n),this};Le.prototype.finish=function(){for(var e=this.head.next,r=this.constructor.alloc(this.len),n=0;e;)e.fn(e.val,r,n),n+=e.len,e=e.next;return r};Le._configure=function(t){ew=t,Le.create=_C(),ew._configure()}});var TC=w((_ie,CC)=>{"use strict";c();CC.exports=ln;var SC=ow();(ln.prototype=Object.create(SC.prototype)).constructor=ln;var Ci=Si();function ln(){SC.call(this)}ln._configure=function(){ln.alloc=Ci._Buffer_allocUnsafe,ln.writeBytesBuffer=Ci.Buffer&&Ci.Buffer.prototype instanceof Uint8Array&&Ci.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(ln.writeBytesBuffer,r,e),this};function JU(t,e,r){t.length<40?Ci.utf8.write(t,e,r):e.utf8Write?e.utf8Write(t,r):e.write(t,r)}ln.prototype.string=function(e){var r=Ci.Buffer.byteLength(e);return this.uint32(r),r&&this._push(JU,r,e),this};ln._configure()});var cw=w((Sie,PC)=>{"use strict";c();PC.exports=dt;var fn=Si(),uw,OC=fn.LongBits,XU=fn.utf8;function Mr(t,e){return RangeError("index out of range: "+t.pos+" + "+(e||1)+" > "+t.len)}function dt(t){this.buf=t,this.pos=0,this.len=t.length}var xC=typeof Uint8Array<"u"?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new dt(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new dt(e);throw Error("illegal buffer")},DC=function(){return fn.Buffer?function(r){return(dt.create=function(i){return fn.Buffer.isBuffer(i)?new uw(i):xC(i)})(r)}:xC};dt.create=DC();dt.prototype._slice=fn.Array.prototype.subarray||fn.Array.prototype.slice;dt.prototype.uint32=function(){var e=4294967295;return function(){if(e=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(e=(e|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,Mr(this,10);return e}}();dt.prototype.int32=function(){return this.uint32()|0};dt.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(e&1)|0};function aw(){var t=new OC(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 Mr(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 Mr(this);if(t.hi=(t.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}dt.prototype.bool=function(){return this.uint32()!==0};function qh(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}dt.prototype.fixed32=function(){if(this.pos+4>this.len)throw Mr(this,4);return qh(this.buf,this.pos+=4)};dt.prototype.sfixed32=function(){if(this.pos+4>this.len)throw Mr(this,4);return qh(this.buf,this.pos+=4)|0};function NC(){if(this.pos+8>this.len)throw Mr(this,8);return new OC(qh(this.buf,this.pos+=4),qh(this.buf,this.pos+=4))}dt.prototype.float=function(){if(this.pos+4>this.len)throw Mr(this,4);var e=fn.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};dt.prototype.double=function(){if(this.pos+8>this.len)throw Mr(this,4);var e=fn.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e};dt.prototype.bytes=function(){var e=this.uint32(),r=this.pos,n=this.pos+e;if(n>this.len)throw Mr(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(r,n):r===n?new this.buf.constructor(0):this._slice.call(this.buf,r,n)};dt.prototype.string=function(){var e=this.bytes();return XU.read(e,0,e.length)};dt.prototype.skip=function(e){if(typeof e=="number"){if(this.pos+e>this.len)throw Mr(this,e);this.pos+=e}else do if(this.pos>=this.len)throw Mr(this);while(this.buf[this.pos++]&128);return this};dt.prototype.skipType=function(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(t=this.uint32()&7)!==4;)this.skipType(t);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+t+" at offset "+this.pos)}return this};dt._configure=function(t){uw=t,dt.create=DC(),uw._configure();var e=fn.Long?"toLong":"toNumber";fn.merge(dt.prototype,{int64:function(){return aw.call(this)[e](!1)},uint64:function(){return aw.call(this)[e](!0)},sint64:function(){return aw.call(this).zzDecode()[e](!1)},fixed64:function(){return NC.call(this)[e](!0)},sfixed64:function(){return NC.call(this)[e](!1)}})}});var FC=w((Tie,LC)=>{"use strict";c();LC.exports=Ys;var BC=cw();(Ys.prototype=Object.create(BC.prototype)).constructor=Ys;var RC=Si();function Ys(t){BC.call(this,t)}Ys._configure=function(){RC.Buffer&&(Ys.prototype._slice=RC.Buffer.prototype.slice)};Ys.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))};Ys._configure()});var UC=w((Nie,MC)=>{"use strict";c();MC.exports=qc;var lw=Si();(qc.prototype=Object.create(lw.EventEmitter.prototype)).constructor=qc;function qc(t,e,r){if(typeof t!="function")throw TypeError("rpcImpl must be a function");lw.EventEmitter.call(this),this.rpcImpl=t,this.requestDelimited=!!e,this.responseDelimited=!!r}qc.prototype.rpcCall=function t(e,r,n,i,s){if(!i)throw TypeError("request must be specified");var o=this;if(!s)return lw.asPromise(t,o,e,r,n,i);if(!o.rpcImpl){setTimeout(function(){s(Error("already ended"))},0);return}try{return o.rpcImpl(e,r[o.requestDelimited?"encodeDelimited":"encode"](i).finish(),function(u,l){if(u)return o.emit("error",u,e),s(u);if(l===null){o.end(!0);return}if(!(l instanceof n))try{l=n[o.responseDelimited?"decodeDelimited":"decode"](l)}catch(f){return o.emit("error",f,e),s(f)}return o.emit("data",l,e),s(null,l)})}catch(a){o.emit("error",a,e),setTimeout(function(){s(a)},0);return}};qc.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var VC=w(qC=>{"use strict";c();var ZU=qC;ZU.Service=UC()});var HC=w((Rie,jC)=>{"use strict";c();jC.exports={}});var kC=w(QC=>{"use strict";c();var rr=QC;rr.build="minimal";rr.Writer=ow();rr.BufferWriter=TC();rr.Reader=cw();rr.BufferReader=FC();rr.util=Si();rr.rpc=VC();rr.roots=HC();rr.configure=GC;function GC(){rr.util._configure(),rr.Writer._configure(rr.BufferWriter),rr.Reader._configure(rr.BufferReader)}GC()});var WC=w((Mie,zC)=>{"use strict";c();zC.exports=kC()});var $C=w((qie,KC)=>{"use strict";c();var ja=WC(),Vh=ja.Reader,eq=ja.Writer,J=ja.util,Vc=ja.roots.default||(ja.roots.default={});Vc.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 Vh||(n=new Vh(n)),this.decode(n,n.uint32())},e.verify=function(n){return typeof n!="object"||n===null?"object expected":n.Nonce!=null&&n.hasOwnProperty("Nonce")&&!J.isInteger(n.Nonce)&&!(n.Nonce&&J.isInteger(n.Nonce.low)&&J.isInteger(n.Nonce.high))?"Nonce: integer|Long expected":n.Value!=null&&n.hasOwnProperty("Value")&&!(n.Value&&typeof n.Value.length=="number"||J.isString(n.Value))?"Value: buffer expected":n.RcvAddr!=null&&n.hasOwnProperty("RcvAddr")&&!(n.RcvAddr&&typeof n.RcvAddr.length=="number"||J.isString(n.RcvAddr))?"RcvAddr: buffer expected":n.RcvUserName!=null&&n.hasOwnProperty("RcvUserName")&&!(n.RcvUserName&&typeof n.RcvUserName.length=="number"||J.isString(n.RcvUserName))?"RcvUserName: buffer expected":n.SndAddr!=null&&n.hasOwnProperty("SndAddr")&&!(n.SndAddr&&typeof n.SndAddr.length=="number"||J.isString(n.SndAddr))?"SndAddr: buffer expected":n.SndUserName!=null&&n.hasOwnProperty("SndUserName")&&!(n.SndUserName&&typeof n.SndUserName.length=="number"||J.isString(n.SndUserName))?"SndUserName: buffer expected":n.GasPrice!=null&&n.hasOwnProperty("GasPrice")&&!J.isInteger(n.GasPrice)&&!(n.GasPrice&&J.isInteger(n.GasPrice.low)&&J.isInteger(n.GasPrice.high))?"GasPrice: integer|Long expected":n.GasLimit!=null&&n.hasOwnProperty("GasLimit")&&!J.isInteger(n.GasLimit)&&!(n.GasLimit&&J.isInteger(n.GasLimit.low)&&J.isInteger(n.GasLimit.high))?"GasLimit: integer|Long expected":n.Data!=null&&n.hasOwnProperty("Data")&&!(n.Data&&typeof n.Data.length=="number"||J.isString(n.Data))?"Data: buffer expected":n.ChainID!=null&&n.hasOwnProperty("ChainID")&&!(n.ChainID&&typeof n.ChainID.length=="number"||J.isString(n.ChainID))?"ChainID: buffer expected":n.Version!=null&&n.hasOwnProperty("Version")&&!J.isInteger(n.Version)?"Version: integer expected":n.Signature!=null&&n.hasOwnProperty("Signature")&&!(n.Signature&&typeof n.Signature.length=="number"||J.isString(n.Signature))?"Signature: buffer expected":n.Options!=null&&n.hasOwnProperty("Options")&&!J.isInteger(n.Options)?"Options: integer expected":n.GuardAddr!=null&&n.hasOwnProperty("GuardAddr")&&!(n.GuardAddr&&typeof n.GuardAddr.length=="number"||J.isString(n.GuardAddr))?"GuardAddr: buffer expected":n.GuardSignature!=null&&n.hasOwnProperty("GuardSignature")&&!(n.GuardSignature&&typeof n.GuardSignature.length=="number"||J.isString(n.GuardSignature))?"GuardSignature: buffer expected":null},e.fromObject=function(n){if(n instanceof Vc.proto.Transaction)return n;var i=new Vc.proto.Transaction;return n.Nonce!=null&&(J.Long?(i.Nonce=J.Long.fromValue(n.Nonce)).unsigned=!0:typeof n.Nonce=="string"?i.Nonce=parseInt(n.Nonce,10):typeof n.Nonce=="number"?i.Nonce=n.Nonce:typeof n.Nonce=="object"&&(i.Nonce=new J.LongBits(n.Nonce.low>>>0,n.Nonce.high>>>0).toNumber(!0))),n.Value!=null&&(typeof n.Value=="string"?J.base64.decode(n.Value,i.Value=J.newBuffer(J.base64.length(n.Value)),0):n.Value.length&&(i.Value=n.Value)),n.RcvAddr!=null&&(typeof n.RcvAddr=="string"?J.base64.decode(n.RcvAddr,i.RcvAddr=J.newBuffer(J.base64.length(n.RcvAddr)),0):n.RcvAddr.length&&(i.RcvAddr=n.RcvAddr)),n.RcvUserName!=null&&(typeof n.RcvUserName=="string"?J.base64.decode(n.RcvUserName,i.RcvUserName=J.newBuffer(J.base64.length(n.RcvUserName)),0):n.RcvUserName.length&&(i.RcvUserName=n.RcvUserName)),n.SndAddr!=null&&(typeof n.SndAddr=="string"?J.base64.decode(n.SndAddr,i.SndAddr=J.newBuffer(J.base64.length(n.SndAddr)),0):n.SndAddr.length&&(i.SndAddr=n.SndAddr)),n.SndUserName!=null&&(typeof n.SndUserName=="string"?J.base64.decode(n.SndUserName,i.SndUserName=J.newBuffer(J.base64.length(n.SndUserName)),0):n.SndUserName.length&&(i.SndUserName=n.SndUserName)),n.GasPrice!=null&&(J.Long?(i.GasPrice=J.Long.fromValue(n.GasPrice)).unsigned=!0:typeof n.GasPrice=="string"?i.GasPrice=parseInt(n.GasPrice,10):typeof n.GasPrice=="number"?i.GasPrice=n.GasPrice:typeof n.GasPrice=="object"&&(i.GasPrice=new J.LongBits(n.GasPrice.low>>>0,n.GasPrice.high>>>0).toNumber(!0))),n.GasLimit!=null&&(J.Long?(i.GasLimit=J.Long.fromValue(n.GasLimit)).unsigned=!0:typeof n.GasLimit=="string"?i.GasLimit=parseInt(n.GasLimit,10):typeof n.GasLimit=="number"?i.GasLimit=n.GasLimit:typeof n.GasLimit=="object"&&(i.GasLimit=new J.LongBits(n.GasLimit.low>>>0,n.GasLimit.high>>>0).toNumber(!0))),n.Data!=null&&(typeof n.Data=="string"?J.base64.decode(n.Data,i.Data=J.newBuffer(J.base64.length(n.Data)),0):n.Data.length&&(i.Data=n.Data)),n.ChainID!=null&&(typeof n.ChainID=="string"?J.base64.decode(n.ChainID,i.ChainID=J.newBuffer(J.base64.length(n.ChainID)),0):n.ChainID.length&&(i.ChainID=n.ChainID)),n.Version!=null&&(i.Version=n.Version>>>0),n.Signature!=null&&(typeof n.Signature=="string"?J.base64.decode(n.Signature,i.Signature=J.newBuffer(J.base64.length(n.Signature)),0):n.Signature.length&&(i.Signature=n.Signature)),n.Options!=null&&(i.Options=n.Options>>>0),n.GuardAddr!=null&&(typeof n.GuardAddr=="string"?J.base64.decode(n.GuardAddr,i.GuardAddr=J.newBuffer(J.base64.length(n.GuardAddr)),0):n.GuardAddr.length&&(i.GuardAddr=n.GuardAddr)),n.GuardSignature!=null&&(typeof n.GuardSignature=="string"?J.base64.decode(n.GuardSignature,i.GuardSignature=J.newBuffer(J.base64.length(n.GuardSignature)),0):n.GuardSignature.length&&(i.GuardSignature=n.GuardSignature)),i},e.toObject=function(n,i){i||(i={});var s={};if(i.defaults){if(J.Long){var o=new J.Long(0,0,!0);s.Nonce=i.longs===String?o.toString():i.longs===Number?o.toNumber():o}else s.Nonce=i.longs===String?"0":0;if(i.bytes===String?s.Value="":(s.Value=[],i.bytes!==Array&&(s.Value=J.newBuffer(s.Value))),i.bytes===String?s.RcvAddr="":(s.RcvAddr=[],i.bytes!==Array&&(s.RcvAddr=J.newBuffer(s.RcvAddr))),i.bytes===String?s.RcvUserName="":(s.RcvUserName=[],i.bytes!==Array&&(s.RcvUserName=J.newBuffer(s.RcvUserName))),i.bytes===String?s.SndAddr="":(s.SndAddr=[],i.bytes!==Array&&(s.SndAddr=J.newBuffer(s.SndAddr))),i.bytes===String?s.SndUserName="":(s.SndUserName=[],i.bytes!==Array&&(s.SndUserName=J.newBuffer(s.SndUserName))),J.Long){var o=new J.Long(0,0,!0);s.GasPrice=i.longs===String?o.toString():i.longs===Number?o.toNumber():o}else s.GasPrice=i.longs===String?"0":0;if(J.Long){var o=new J.Long(0,0,!0);s.GasLimit=i.longs===String?o.toString():i.longs===Number?o.toNumber():o}else s.GasLimit=i.longs===String?"0":0;i.bytes===String?s.Data="":(s.Data=[],i.bytes!==Array&&(s.Data=J.newBuffer(s.Data))),i.bytes===String?s.ChainID="":(s.ChainID=[],i.bytes!==Array&&(s.ChainID=J.newBuffer(s.ChainID))),s.Version=0,i.bytes===String?s.Signature="":(s.Signature=[],i.bytes!==Array&&(s.Signature=J.newBuffer(s.Signature))),s.Options=0,i.bytes===String?s.GuardAddr="":(s.GuardAddr=[],i.bytes!==Array&&(s.GuardAddr=J.newBuffer(s.GuardAddr))),i.bytes===String?s.GuardSignature="":(s.GuardSignature=[],i.bytes!==Array&&(s.GuardSignature=J.newBuffer(s.GuardSignature)))}return n.Nonce!=null&&n.hasOwnProperty("Nonce")&&(typeof n.Nonce=="number"?s.Nonce=i.longs===String?String(n.Nonce):n.Nonce:s.Nonce=i.longs===String?J.Long.prototype.toString.call(n.Nonce):i.longs===Number?new J.LongBits(n.Nonce.low>>>0,n.Nonce.high>>>0).toNumber(!0):n.Nonce),n.Value!=null&&n.hasOwnProperty("Value")&&(s.Value=i.bytes===String?J.base64.encode(n.Value,0,n.Value.length):i.bytes===Array?Array.prototype.slice.call(n.Value):n.Value),n.RcvAddr!=null&&n.hasOwnProperty("RcvAddr")&&(s.RcvAddr=i.bytes===String?J.base64.encode(n.RcvAddr,0,n.RcvAddr.length):i.bytes===Array?Array.prototype.slice.call(n.RcvAddr):n.RcvAddr),n.RcvUserName!=null&&n.hasOwnProperty("RcvUserName")&&(s.RcvUserName=i.bytes===String?J.base64.encode(n.RcvUserName,0,n.RcvUserName.length):i.bytes===Array?Array.prototype.slice.call(n.RcvUserName):n.RcvUserName),n.SndAddr!=null&&n.hasOwnProperty("SndAddr")&&(s.SndAddr=i.bytes===String?J.base64.encode(n.SndAddr,0,n.SndAddr.length):i.bytes===Array?Array.prototype.slice.call(n.SndAddr):n.SndAddr),n.SndUserName!=null&&n.hasOwnProperty("SndUserName")&&(s.SndUserName=i.bytes===String?J.base64.encode(n.SndUserName,0,n.SndUserName.length):i.bytes===Array?Array.prototype.slice.call(n.SndUserName):n.SndUserName),n.GasPrice!=null&&n.hasOwnProperty("GasPrice")&&(typeof n.GasPrice=="number"?s.GasPrice=i.longs===String?String(n.GasPrice):n.GasPrice:s.GasPrice=i.longs===String?J.Long.prototype.toString.call(n.GasPrice):i.longs===Number?new J.LongBits(n.GasPrice.low>>>0,n.GasPrice.high>>>0).toNumber(!0):n.GasPrice),n.GasLimit!=null&&n.hasOwnProperty("GasLimit")&&(typeof n.GasLimit=="number"?s.GasLimit=i.longs===String?String(n.GasLimit):n.GasLimit:s.GasLimit=i.longs===String?J.Long.prototype.toString.call(n.GasLimit):i.longs===Number?new J.LongBits(n.GasLimit.low>>>0,n.GasLimit.high>>>0).toNumber(!0):n.GasLimit),n.Data!=null&&n.hasOwnProperty("Data")&&(s.Data=i.bytes===String?J.base64.encode(n.Data,0,n.Data.length):i.bytes===Array?Array.prototype.slice.call(n.Data):n.Data),n.ChainID!=null&&n.hasOwnProperty("ChainID")&&(s.ChainID=i.bytes===String?J.base64.encode(n.ChainID,0,n.ChainID.length):i.bytes===Array?Array.prototype.slice.call(n.ChainID):n.ChainID),n.Version!=null&&n.hasOwnProperty("Version")&&(s.Version=n.Version),n.Signature!=null&&n.hasOwnProperty("Signature")&&(s.Signature=i.bytes===String?J.base64.encode(n.Signature,0,n.Signature.length):i.bytes===Array?Array.prototype.slice.call(n.Signature):n.Signature),n.Options!=null&&n.hasOwnProperty("Options")&&(s.Options=n.Options),n.GuardAddr!=null&&n.hasOwnProperty("GuardAddr")&&(s.GuardAddr=i.bytes===String?J.base64.encode(n.GuardAddr,0,n.GuardAddr.length):i.bytes===Array?Array.prototype.slice.call(n.GuardAddr):n.GuardAddr),n.GuardSignature!=null&&n.hasOwnProperty("GuardSignature")&&(s.GuardSignature=i.bytes===String?J.base64.encode(n.GuardSignature,0,n.GuardSignature.length):i.bytes===Array?Array.prototype.slice.call(n.GuardSignature):n.GuardSignature),s},e.prototype.toJSON=function(){return this.constructor.toObject(this,ja.util.toJSONOptions)},e}(),t}();KC.exports=Vc});var YC=w(br=>{"use strict";c();var tq=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]}),rq=br&&br.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nq=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)&&tq(e,t,r);return rq(e,t),e},iq=br&&br.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(br,"__esModule",{value:!0});br.ProtoSerializer=void 0;var sq=iq(Yt()),fw=tr(),oq=Go(),aq=nq(je()),uq=lh(),hw=class{serializeTransaction(e){let r=$C().proto,n=new fw.Address(e.getReceiver().bech32()).pubkey(),i=new fw.Address(e.getSender().bech32()).pubkey(),s=new r.Transaction({Nonce:e.getNonce().valueOf()?e.getNonce().valueOf():void 0,Value:this.serializeTransactionValue(e.getValue()),RcvAddr:n,RcvUserName:null,SndAddr:i,SndUserName:null,GasPrice:e.getGasPrice().valueOf(),GasLimit:e.getGasLimit().valueOf(),Data:e.getData().length()==0?null:e.getData().valueOf(),ChainID:h.Buffer.from(e.getChainID().valueOf()),Version:e.getVersion().valueOf(),Signature:e.getSignature()});if(e.getOptions().valueOf()!==oq.TRANSACTION_OPTIONS_DEFAULT&&(s.Options=e.getOptions().valueOf()),e.isGuardedTransaction()){let u=e.getGuardian();s.GuardAddr=new fw.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 sq.default(e.toString());if(r.isZero())return h.Buffer.from([0,0]);let n=uq.bigIntToBuffer(r);return n=h.Buffer.concat([h.Buffer.from([0]),n]),n}deserializeTransaction(e){throw new aq.ErrUnsupportedOperation("deserializeTransaction")}};br.ProtoSerializer=hw});var JC=w(Js=>{"use strict";c();var cq=Js&&Js.__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]}),lq=Js&&Js.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&cq(e,t,r)};Object.defineProperty(Js,"__esModule",{value:!0});lq(YC(),Js)});var eT=w(hn=>{"use strict";c();var fq=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]}),hq=hn&&hn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dq=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)&&fq(e,t,r);return hq(e,t),e};Object.defineProperty(hn,"__esModule",{value:!0});hn.Signature=void 0;var XC=dq(je()),ZC=64,Ur=class{constructor(e){if(this.valueHex="",!!e){if(typeof e=="string")return Ur.fromHex(e);if(e instanceof h.Buffer)return Ur.fromBuffer(e)}}static empty(){return new Ur}static fromHex(e){if(e.startsWith("0x")&&(e=e.slice(2)),!Ur.isValidHex(e))throw new XC.ErrSignatureCannotCreate(e);return Ur.fromValidHex(e)}static isValidHex(e){return h.Buffer.from(e,"hex").length==ZC}static fromValidHex(e){let r=new Ur;return r.valueHex=e,r}static fromBuffer(e){if(e.length!=ZC)throw new XC.ErrSignatureCannotCreate(e);return Ur.fromValidHex(e.toString("hex"))}hex(){return this.valueHex}};hn.Signature=Ur});var jc=w(jh=>{"use strict";c();Object.defineProperty(jh,"__esModule",{value:!0});jh.TransactionPayload=void 0;var Ha=class{constructor(e){this.data=h.Buffer.from(e||[])}static fromEncoded(e){if(!e)return new Ha("");let r=h.Buffer.from(e,"base64").toString();return new Ha(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}};jh.TransactionPayload=Ha});var dw=w(($ie,tT)=>{c();Gn.notEqual=gq;Gn.notOk=yq;Gn.equal=pq;Gn.ok=Gn;tT.exports=Gn;function pq(t,e,r){Gn(t==e,r)}function gq(t,e,r){Gn(t!=e,r)}function yq(t,e){Gn(!t,e)}function Gn(t,e){if(!t)throw new Error(e||"AssertionError")}});var Wa=w(za=>{"use strict";c();var pw=hy(),Qa=py(),rT=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;za.Buffer=W;za.SlowBuffer=bq;za.INSPECT_MAX_BYTES=50;var Hh=2147483647;za.kMaxLength=Hh;W.TYPED_ARRAY_SUPPORT=mq();!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 mq(){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 Qn(t){if(t>Hh)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 ww(t)}return oT(t,e,r)}W.poolSize=8192;function oT(t,e,r){if(typeof t=="string")return Eq(t,e);if(ArrayBuffer.isView(t))return vq(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(dn(t,ArrayBuffer)||t&&dn(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(dn(t,SharedArrayBuffer)||t&&dn(t.buffer,SharedArrayBuffer)))return yw(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=Aq(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 oT(t,e,r)};Object.setPrototypeOf(W.prototype,Uint8Array.prototype);Object.setPrototypeOf(W,Uint8Array);function aT(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 wq(t,e,r){return aT(t),t<=0?Qn(t):e!==void 0?typeof r=="string"?Qn(t).fill(e,r):Qn(t).fill(e):Qn(t)}W.alloc=function(t,e,r){return wq(t,e,r)};function ww(t){return aT(t),Qn(t<0?0:Ew(t)|0)}W.allocUnsafe=function(t){return ww(t)};W.allocUnsafeSlow=function(t){return ww(t)};function Eq(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!W.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=uT(t,e)|0,n=Qn(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function gw(t){let e=t.length<0?0:Ew(t.length)|0,r=Qn(e);for(let n=0;n=Hh)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Hh.toString(16)+" bytes");return t|0}function bq(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(dn(e,Uint8Array)&&(e=W.from(e,e.offset,e.byteLength)),dn(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 uT(t,e){if(W.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||dn(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 mw(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return mT(t).length;default:if(i)return n?-1:mw(t).length;e=(""+e).toLowerCase(),i=!0}}W.byteLength=uT;function _q(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 Rq(this,e,r);case"utf8":case"utf-8":return lT(this,e,r);case"ascii":return Dq(this,e,r);case"latin1":case"binary":return Pq(this,e,r);case"base64":return Nq(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Bq(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}W.prototype._isBuffer=!0;function Xs(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+=" ... "),""};rT&&(W.prototype[rT]=W.prototype.inspect);W.prototype.compare=function(e,r,n,i,s){if(dn(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),l=this.slice(i,s),f=e.slice(r,n);for(let d=0;d2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,Aw(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:nT(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):nT(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function nT(t,e,r,n,i){let s=1,o=t.length,a=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;s=2,o/=2,a/=2,r/=2}function u(f,d){return s===1?f[d]:f.readUInt16BE(d*s)}let l;if(i){let f=-1;for(l=r;lo&&(r=o-a),l=r;l>=0;l--){let f=!0;for(let d=0;di&&(n=i)):n=i;let s=e.length;n>s/2&&(n=s/2);let o;for(o=0;o>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let s=this.length-r;if((n===void 0||n>s)&&(n=s),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let o=!1;for(;;)switch(i){case"hex":return Iq(this,e,r,n);case"utf8":case"utf-8":return Sq(this,e,r,n);case"ascii":case"latin1":case"binary":return Cq(this,e,r,n);case"base64":return Tq(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return xq(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 Nq(t,e,r){return e===0&&r===t.length?pw.fromByteArray(t):pw.fromByteArray(t.slice(e,r))}function lT(t,e,r){r=Math.min(t.length,r);let n=[],i=e;for(;i239?4:s>223?3:s>191?2:1;if(i+a<=r){let u,l,f,d;switch(a){case 1:s<128&&(o=s);break;case 2:u=t[i+1],(u&192)===128&&(d=(s&31)<<6|u&63,d>127&&(o=d));break;case 3:u=t[i+1],l=t[i+2],(u&192)===128&&(l&192)===128&&(d=(s&15)<<12|(u&63)<<6|l&63,d>2047&&(d<55296||d>57343)&&(o=d));break;case 4:u=t[i+1],l=t[i+2],f=t[i+3],(u&192)===128&&(l&192)===128&&(f&192)===128&&(d=(s&15)<<18|(u&63)<<12|(l&63)<<6|f&63,d>65535&&d<1114112&&(o=d))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),i+=a}return Oq(n)}var iT=4096;function Oq(t){let e=t.length;if(e<=iT)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||Nt(e,r,this.length);let i=this[e],s=1,o=0;for(;++o>>0,r=r>>>0,n||Nt(e,r,this.length);let i=this[e+--r],s=1;for(;r>0&&(s*=256);)i+=this[e+--r]*s;return i};W.prototype.readUint8=W.prototype.readUInt8=function(e,r){return e=e>>>0,r||Nt(e,1,this.length),this[e]};W.prototype.readUint16LE=W.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||Nt(e,2,this.length),this[e]|this[e+1]<<8};W.prototype.readUint16BE=W.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||Nt(e,2,this.length),this[e]<<8|this[e+1]};W.prototype.readUint32LE=W.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||Nt(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};W.prototype.readUint32BE=W.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||Nt(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};W.prototype.readBigUInt64LE=Ti(function(e){e=e>>>0,ka(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Hc(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,ka(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Hc(e,this.length-8);let i=r*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],s=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt(i)<>>0,r=r>>>0,n||Nt(e,r,this.length);let i=this[e],s=1,o=0;for(;++o=s&&(i-=Math.pow(2,8*r)),i};W.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||Nt(e,r,this.length);let i=r,s=1,o=this[e+--i];for(;i>0&&(s*=256);)o+=this[e+--i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*r)),o};W.prototype.readInt8=function(e,r){return e=e>>>0,r||Nt(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};W.prototype.readInt16LE=function(e,r){e=e>>>0,r||Nt(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};W.prototype.readInt16BE=function(e,r){e=e>>>0,r||Nt(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};W.prototype.readInt32LE=function(e,r){return e=e>>>0,r||Nt(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};W.prototype.readInt32BE=function(e,r){return e=e>>>0,r||Nt(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};W.prototype.readBigInt64LE=Ti(function(e){e=e>>>0,ka(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Hc(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,ka(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Hc(e,this.length-8);let i=(r<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(i)<>>0,r||Nt(e,4,this.length),Qa.read(this,e,!0,23,4)};W.prototype.readFloatBE=function(e,r){return e=e>>>0,r||Nt(e,4,this.length),Qa.read(this,e,!1,23,4)};W.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||Nt(e,8,this.length),Qa.read(this,e,!0,52,8)};W.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||Nt(e,8,this.length),Qa.read(this,e,!1,52,8)};function nr(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;nr(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;nr(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||nr(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||nr(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||nr(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||nr(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||nr(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 fT(t,e,r,n,i){yT(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 hT(t,e,r,n,i){yT(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=Ti(function(e,r=0){return fT(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});W.prototype.writeBigUInt64BE=Ti(function(e,r=0){return hT(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);nr(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);nr(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||nr(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||nr(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||nr(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||nr(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||nr(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=Ti(function(e,r=0){return fT(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});W.prototype.writeBigInt64BE=Ti(function(e,r=0){return hT(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function dT(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 pT(t,e,r,n,i){return e=+e,r=r>>>0,i||dT(t,e,r,4,34028234663852886e22,-34028234663852886e22),Qa.write(t,e,r,n,23,4),r+4}W.prototype.writeFloatLE=function(e,r,n){return pT(this,e,r,!0,n)};W.prototype.writeFloatBE=function(e,r,n){return pT(this,e,r,!1,n)};function gT(t,e,r,n,i){return e=+e,r=r>>>0,i||dT(t,e,r,8,17976931348623157e292,-17976931348623157e292),Qa.write(t,e,r,n,52,8),r+8}W.prototype.writeDoubleLE=function(e,r,n){return gT(this,e,r,!0,n)};W.prototype.writeDoubleBE=function(e,r,n){return gT(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=sT(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=sT(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);function sT(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 Lq(t,e,r){ka(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&Hc(e,t.length-(r+1))}function yT(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 Ga.ERR_OUT_OF_RANGE("value",a,t)}Lq(n,i,s)}function ka(t,e){if(typeof t!="number")throw new Ga.ERR_INVALID_ARG_TYPE(e,"number",t)}function Hc(t,e,r){throw Math.floor(t)!==t?(ka(t,r),new Ga.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new Ga.ERR_BUFFER_OUT_OF_BOUNDS:new Ga.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var Fq=/[^+/0-9A-Za-z-_]/g;function Mq(t){if(t=t.split("=")[0],t=t.trim().replace(Fq,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function mw(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 Uq(t){let e=[];for(let r=0;r>8,i=r%256,s.push(i),s.push(n);return s}function mT(t){return pw.toByteArray(Mq(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 dn(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function Aw(t){return t!==t}var Vq=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 Ti(t){return typeof BigInt>"u"?jq:t}function jq(){throw new Error("BigInt not supported")}});var ET=w((ese,wT)=>{c();wT.exports=bw;bw.supported=typeof WebAssembly<"u";function bw(t){if(!bw.supported)return null;var e=t&&t.imports,r=Hq("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 Hq(t){return typeof atob=="function"?new Uint8Array(atob(t).split("").map(Gq)):new(Wa()).Buffer(t,"base64")}function Gq(t){return t.charCodeAt(0)}});var CT=w((ise,gn)=>{c();var pn=dw(),ze=ET()(),kn=64,Qh=[];gn.exports=_r;var vT=gn.exports.BYTES_MIN=16,AT=gn.exports.BYTES_MAX=64,rse=gn.exports.BYTES=32,bT=gn.exports.KEYBYTES_MIN=16,_T=gn.exports.KEYBYTES_MAX=64,nse=gn.exports.KEYBYTES=32,IT=gn.exports.SALTBYTES=16,ST=gn.exports.PERSONALBYTES=16;function _r(t,e,r,n,i){if(!(this instanceof _r))return new _r(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&&(pn(t>=vT,"digestLength must be at least "+vT+", was given "+t),pn(t<=AT,"digestLength must be at most "+AT+", was given "+t),e!=null&&pn(e.length>=bT,"key must be at least "+bT+", was given "+e.length),e!=null&&pn(e.length<=_T,"key must be at least "+_T+", was given "+e.length),r!=null&&pn(r.length===IT,"salt must be exactly "+IT+", was given "+r.length),n!=null&&pn(n.length===ST,"personal must be exactly "+ST+", was given "+n.length)),Qh.length||(Qh.push(kn),kn+=216),this.digestLength=t,this.finalized=!1,this.pointer=Qh.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,kn,kn+e.length),ze.memory[this.pointer+200]=128)}_r.prototype.update=function(t){return pn(this.finalized===!1,"Hash instance finalized"),pn(t,"input must be TypedArray or Buffer"),kn+t.length>ze.memory.length&&ze.realloc(kn+t.length),ze.memory.set(t,kn),ze.exports.blake2b_update(this.pointer,kn,kn+t.length),this};_r.prototype.digest=function(t){if(pn(this.finalized===!1,"Hash instance finalized"),this.finalized=!0,Qh.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 kq(ze.memory,this.pointer+128,this.digestLength);pn(t.length>=this.digestLength,"input must be TypedArray or Buffer");for(var e=0;e{c();var Oi=dw(),Qc=CT();function kh(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 TT(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 BT(t,e){return t[e]^t[e+1]<<8^t[e+2]<<16^t[e+3]<<24}function xi(t,e,r,n,i,s){var o=Gc[i],a=Gc[i+1],u=Gc[s],l=Gc[s+1];kh(Se,t,e),TT(Se,t,o,a);var f=Se[n]^Se[t],d=Se[n+1]^Se[t+1];Se[n]=d,Se[n+1]=f,kh(Se,r,n),f=Se[e]^Se[r],d=Se[e+1]^Se[r+1],Se[e]=f>>>24^d<<8,Se[e+1]=d>>>24^f<<8,kh(Se,t,e),TT(Se,t,u,l),f=Se[n]^Se[t],d=Se[n+1]^Se[t+1],Se[n]=f>>>16^d<<16,Se[n+1]=d>>>16^f<<16,kh(Se,r,n),f=Se[e]^Se[r],d=Se[e+1]^Se[r+1],Se[e]=d>>>31^f<<1,Se[e+1]=f>>>31^d<<1}var LT=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),Wq=[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],kt=new Uint8Array(Wq.map(function(t){return t*2})),Se=new Uint32Array(32),Gc=new Uint32Array(32);function FT(t,e){var r=0;for(r=0;r<16;r++)Se[r]=t.h[r],Se[r+16]=LT[r];for(Se[24]=Se[24]^t.t,Se[25]=Se[25]^t.t/4294967296,e&&(Se[28]=~Se[28],Se[29]=~Se[29]),r=0;r<32;r++)Gc[r]=BT(t.b,4*r);for(r=0;r<12;r++)xi(0,8,16,24,kt[r*16+0],kt[r*16+1]),xi(2,10,18,26,kt[r*16+2],kt[r*16+3]),xi(4,12,20,28,kt[r*16+4],kt[r*16+5]),xi(6,14,22,30,kt[r*16+6],kt[r*16+7]),xi(0,10,20,30,kt[r*16+8],kt[r*16+9]),xi(2,12,22,24,kt[r*16+10],kt[r*16+11]),xi(4,14,16,26,kt[r*16+12],kt[r*16+13]),xi(6,8,18,28,kt[r*16+14],kt[r*16+15]);for(r=0;r<16;r++)t.h[r]=t.h[r]^Se[r]^Se[r+16]}var Ni=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 Ka(t,e,r,n){Ni.fill(0),this.b=new Uint8Array(128),this.h=new Uint32Array(16),this.t=0,this.c=0,this.outlen=t,Ni[0]=t,e&&(Ni[1]=e.length),Ni[2]=1,Ni[3]=1,r&&Ni.set(r,32),n&&Ni.set(n,48);for(var i=0;i<16;i++)this.h[i]=LT[i]^BT(Ni,i*4);e&&(MT(this,e),this.c=128)}Ka.prototype.update=function(t){return Oi(t!=null,"input must be Uint8Array or Buffer"),MT(this,t),this};Ka.prototype.digest=function(t){var e=!t||t==="binary"||t==="hex"?new Uint8Array(this.outlen):t;return Oi(e.length>=this.outlen,"out must have at least outlen bytes of space"),Kq(this,e),t==="hex"?$q(e):e};Ka.prototype.final=Ka.prototype.digest;Ka.ready=function(t){Qc.ready(function(){t()})};function MT(t,e){for(var r=0;r>2]>>8*(r&3);return e}function $q(t){for(var e="",r=0;r=xT,"outlen must be at least "+xT+", was given "+e),Oi(e<=NT,"outlen must be at most "+NT+", was given "+e),r!=null&&Oi(r.length>=OT,"key must be at least "+OT+", was given "+r.length),r!=null&&Oi(r.length<=DT,"key must be at most "+DT+", was given "+r.length),n!=null&&Oi(n.length===PT,"salt must be exactly "+PT+", was given "+n.length),i!=null&&Oi(i.length===RT,"personal must be exactly "+RT+", was given "+i.length)),new UT(e,r,n,i)};ir.exports.ready=function(t){Qc.ready(function(){t()})};ir.exports.WASM_SUPPORTED=Qc.SUPPORTED;ir.exports.WASM_LOADED=!1;var xT=ir.exports.BYTES_MIN=16,NT=ir.exports.BYTES_MAX=64,ose=ir.exports.BYTES=32,OT=ir.exports.KEYBYTES_MIN=16,DT=ir.exports.KEYBYTES_MAX=64,ase=ir.exports.KEYBYTES=32,PT=ir.exports.SALTBYTES=16,RT=ir.exports.PERSONALBYTES=16;Qc.ready(function(t){t||(ir.exports.WASM_LOADED=!0,UT=Qc)})});var Wc=w(Ir=>{"use strict";c();var Jq=Ir&&Ir.__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]}),Xq=Ir&&Ir.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Zq=Ir&&Ir.__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)&&Jq(e,t,r);return Xq(e,t),e};Object.defineProperty(Ir,"__esModule",{value:!0});Ir.TransactionHash=Ir.Transaction=void 0;var $a=Yt(),kc=tr(),eV=Lh(),tV=Go(),rV=Zq(je()),nV=KS(),zn=YS(),iV=JC(),VT=eT(),jT=jc(),sV=gr(),oV=qT(),aV=32,zc=class{constructor({nonce:e,value:r,receiver:n,sender:i,gasPrice:s,gasLimit:o,data:a,chainID:u,version:l,options:f,guardian:d}){this.nonce=e||0,this.value=r?new $a.BigNumber(r.toString()).toFixed(0):0,this.sender=i,this.receiver=n,this.gasPrice=s||tV.TRANSACTION_MIN_GAS_PRICE,this.gasLimit=o,this.data=a||new jT.TransactionPayload,this.chainID=u,this.version=l?new zn.TransactionVersion(l.valueOf()):zn.TransactionVersion.withDefaultVersion(),this.options=f?new zn.TransactionOptions(f.valueOf()):zn.TransactionOptions.withDefaultOptions(),this.guardian=d||kc.Address.empty(),this.signature=h.Buffer.from([]),this.guardianSignature=h.Buffer.from([]),this.hash=Di.empty()}getNonce(){return this.nonce}setNonce(e){this.nonce=e}getValue(){return this.value}setValue(e){this.value=e}getSender(){return this.sender}setSender(e){this.sender=e}getReceiver(){return this.receiver}getGuardian(){return this.guardian}getGasPrice(){return this.gasPrice}setGasPrice(e){this.gasPrice=e}getGasLimit(){return this.gasLimit}setGasLimit(e){this.gasLimit=e}getData(){return this.data}getChainID(){return this.chainID}setChainID(e){this.chainID=e}getVersion(){return this.version}setVersion(e){this.version=new zn.TransactionVersion(e.valueOf())}getOptions(){return new zn.TransactionOptions(this.options.valueOf())}setOptions(e){this.options=new zn.TransactionOptions(e.valueOf())}getSignature(){return this.signature}getGuardianSignature(){return this.guardianSignature}setGuardian(e){this.guardian=e}getHash(){return sV.guardNotEmpty(this.hash,"hash"),this.hash}serializeForSigning(){let e=this.toPlainObject();e.signature&&delete e.signature,e.guardianSignature&&delete e.guardianSignature,e.guardian||delete e.guardian;let r=JSON.stringify(e);return h.Buffer.from(r)}isGuardedTransaction(){let e=this.guardian.bech32().length>0,r=this.guardianSignature.length>0;return this.getOptions().isWithGuardian()&&e&&r}toPlainObject(){var e;let r={nonce:this.nonce.valueOf(),value:this.value.toString(),receiver:this.receiver.bech32(),sender:this.sender.bech32(),gasPrice:this.gasPrice.valueOf(),gasLimit:this.gasLimit.valueOf(),data:this.data.length()==0?void 0:this.data.encoded(),chainID:this.chainID.valueOf(),version:this.version.valueOf(),options:this.options.valueOf()==0?void 0:this.options.valueOf(),guardian:!((e=this.guardian)===null||e===void 0)&&e.bech32()?this.guardian.bech32()==""?void 0:this.guardian.bech32():void 0,signature:this.signature.toString("hex")?this.signature.toString("hex"):void 0,guardianSignature:this.guardianSignature.toString("hex")?this.guardianSignature.toString("hex"):void 0};return eV.Compatibility.guardAddressIsSetAndNonZero(new kc.Address(r.sender),"'sender' of transaction","pass the actual sender to the Transaction constructor"),r}static fromPlainObject(e){let r=new zc({nonce:Number(e.nonce),value:new $a.BigNumber(e.value).toFixed(0),receiver:kc.Address.fromString(e.receiver),sender:kc.Address.fromString(e.sender),guardian:e.guardian==null?void 0:kc.Address.fromString(e.guardian||""),gasPrice:Number(e.gasPrice),gasLimit:Number(e.gasLimit),data:new jT.TransactionPayload(h.Buffer.from(e.data||"","base64")),chainID:String(e.chainID),version:new zn.TransactionVersion(e.version),options:e.options==null?void 0:new zn.TransactionOptions(e.options)});return e.signature&&r.applySignature(new VT.Signature(e.signature)),e.guardianSignature&&r.applyGuardianSignature(new VT.Signature(e.guardianSignature)),r}applySignature(e){e instanceof h.Buffer?this.signature=e:this.signature=h.Buffer.from(e.hex(),"hex"),this.hash=Di.compute(this)}applyGuardianSignature(e){e instanceof h.Buffer?this.guardianSignature=e:this.guardianSignature=h.Buffer.from(e.hex(),"hex"),this.hash=Di.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 rV.ErrNotEnoughGas(this.gasLimit.valueOf());let n=new $a.BigNumber(this.gasPrice.valueOf()),i=new $a.BigNumber(r).multipliedBy(n);if(r===this.gasLimit.valueOf())return i;let s=new $a.BigNumber(this.gasLimit.valueOf()-r),o=n.multipliedBy(new $a.BigNumber(e.GasPriceModifier.valueOf())),a=s.multipliedBy(o);return i.plus(a)}};Ir.Transaction=zc;var Di=class extends nV.Hash{constructor(e){super(e)}static compute(e){let n=new iV.ProtoSerializer().serializeTransaction(e),i=oV(aV).update(n).digest("hex");return new Di(i)}};Ir.TransactionHash=Di});var HT=w(Wh=>{"use strict";c();Object.defineProperty(Wh,"__esModule",{value:!0});Wh.TransferTransactionsFactory=void 0;var _w=Ph(),qr=Tt(),zh=Wc(),Iw=jc(),Sw=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 zh.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 _w.ArgSerializer().valuesToString([qr.BytesValue.fromUTF8(e.tokenTransfer.tokenIdentifier),new qr.BigUIntValue(e.tokenTransfer.valueOf())]),n=`ESDTTransfer@${r}`,i=new Iw.TransactionPayload(n),s=i.length()||0,o=this.gasEstimator.forESDTTransfer(s);return new zh.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 _w.ArgSerializer().valuesToString([qr.BytesValue.fromUTF8(e.tokenTransfer.tokenIdentifier),new qr.U64Value(e.tokenTransfer.nonce),new qr.BigUIntValue(e.tokenTransfer.valueOf()),new qr.AddressValue(e.destination)]),n=`ESDTNFTTransfer@${r}`,i=new Iw.TransactionPayload(n),s=i.length()||0,o=this.gasEstimator.forESDTNFTTransfer(s);return new zh.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 qr.AddressValue(e.destination),new qr.U16Value(e.tokenTransfers.length)];for(let u of e.tokenTransfers)r.push(qr.BytesValue.fromUTF8(u.tokenIdentifier),new qr.U64Value(u.nonce),new qr.BigUIntValue(u.valueOf()));let{argumentsString:n}=new _w.ArgSerializer().valuesToString(r),i=`MultiESDTNFTTransfer@${n}`,s=new Iw.TransactionPayload(i),o=s.length()||0,a=this.gasEstimator.forMultiESDTNFTTransfer(o,e.tokenTransfers.length);return new zh.Transaction({nonce:e.nonce,receiver:e.sender,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||a,data:s,chainID:e.chainID})}};Wh.TransferTransactionsFactory=Sw});var QT=w(Zs=>{"use strict";c();Object.defineProperty(Zs,"__esModule",{value:!0});Zs.GasEstimator=Zs.DefaultGasConfiguration=void 0;Zs.DefaultGasConfiguration={minGasLimit:5e4,gasPerDataByte:1500,gasCostESDTTransfer:2e5,gasCostESDTNFTTransfer:2e5,gasCostESDTNFTMultiTransfer:2e5};var uV=1e5,GT=8e5,Cw=class{constructor(e){this.gasConfiguration=e||Zs.DefaultGasConfiguration}forEGLDTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasPerDataByte*e}forESDTTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasCostESDTTransfer+this.gasConfiguration.gasPerDataByte*e+uV}forESDTNFTTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasCostESDTNFTTransfer+this.gasConfiguration.gasPerDataByte*e+GT}forMultiESDTNFTTransfer(e,r){return this.gasConfiguration.minGasLimit+(this.gasConfiguration.gasCostESDTNFTMultiTransfer+GT)*r+this.gasConfiguration.gasPerDataByte*e}};Zs.GasEstimator=Cw});var $h=w(Kh=>{"use strict";c();Object.defineProperty(Kh,"__esModule",{value:!0});Kh.Account=void 0;var cV=tr(),Tw=class{constructor(e){this.address=new cV.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()}}};Kh.Account=Tw});var xw=w(to=>{"use strict";c();Object.defineProperty(to,"__esModule",{value:!0});to.Logger=to.LogLevel=void 0;var eo;(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"})(eo=to.LogLevel||(to.LogLevel={}));var Vr=class{static setLevel(e){Vr.logLevel=e}static trace(e,...r){Vr.logLevel>=eo.Debug||console.debug(e,r)}static debug(e,...r){Vr.logLevel>=eo.Debug||console.debug(e,r)}static info(e,...r){Vr.logLevel>=eo.Info||console.log(e,r)}static warn(e,...r){Vr.logLevel>=eo.Warn||console.warn(e,r)}static error(e,...r){Vr.logLevel>=eo.Error||console.error(e,r)}};to.Logger=Vr;Vr.logLevel=eo.Debug});var kT=w(yn=>{"use strict";c();var lV=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]}),fV=yn&&yn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hV=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)&&lV(e,t,r);return fV(e,t),e};Object.defineProperty(yn,"__esModule",{value:!0});yn.AsyncTimer=void 0;var dV=hV(je()),pV=je(),Nw=xw(),Ow=class{constructor(e){this.timeoutHandle=null,this.rejectionFunc=null,this.name=e,this.correlationTag=0}start(e){if(this.timeoutHandle)throw new dV.ErrAsyncTimerAlreadyRunning;return this.correlationTag++,Nw.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(){Nw.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].abort()`),this.rejectionFunc&&(this.rejectionFunc(new pV.ErrAsyncTimerAborted),this.rejectionFunc=null),this.stop()}stop(){this.isStopped()||(Nw.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].stop()`),this.timeoutHandle&&(clearTimeout(this.timeoutHandle),this.timeoutHandle=null))}isStopped(){return!this.timeoutHandle}};yn.AsyncTimer=Ow});var Rw=w(Ja=>{"use strict";c();var Sr=Ja&&Ja.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(Ja,"__esModule",{value:!0});Ja.TransactionWatcher=void 0;var Dw=kT(),Ya=je(),zT=xw(),Cr=class{constructor(e,r={}){this.fetcher=new Pw(e),this.pollingIntervalMilliseconds=r.pollingIntervalMilliseconds||Cr.DefaultPollingInterval,this.timeoutMilliseconds=r.timeoutMilliseconds||Cr.DefaultTimeout,this.patienceMilliseconds=r.patienceMilliseconds||Cr.DefaultPatience}awaitPending(e){return Sr(this,void 0,void 0,function*(){let r=s=>s.status.isPending(),n=()=>Sr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),i=()=>new Ya.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)})}awaitCompleted(e){return Sr(this,void 0,void 0,function*(){let r=s=>s.isCompleted,n=()=>Sr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),i=()=>new Ya.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)})}awaitAllEvents(e,r){return Sr(this,void 0,void 0,function*(){let n=o=>{let a=this.getAllTransactionEvents(o).map(l=>l.identifier);return r.every(l=>a.includes(l))},i=()=>Sr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),s=()=>new Ya.ErrExpectedTransactionEventsNotFound;return this.awaitConditionally(n,i,s)})}awaitAnyEvent(e,r){return Sr(this,void 0,void 0,function*(){let n=o=>{let a=this.getAllTransactionEvents(o).map(l=>l.identifier);return r.find(l=>a.includes(l))!=null},i=()=>Sr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),s=()=>new Ya.ErrExpectedTransactionEventsNotFound;return this.awaitConditionally(n,i,s)})}awaitOnCondition(e,r){return Sr(this,void 0,void 0,function*(){let n=()=>Sr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),i=()=>new Ya.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)})}awaitConditionally(e,r,n){return Sr(this,void 0,void 0,function*(){let i=new Dw.AsyncTimer("watcher:periodic"),s=new Dw.AsyncTimer("watcher:patience"),o=new Dw.AsyncTimer("watcher:timeout"),a=!1,u,l=!1;for(o.start(this.timeoutMilliseconds).finally(()=>{o.stop(),a=!0});!a;){yield i.start(this.pollingIntervalMilliseconds);try{if(u=yield r(),l=e(u),l||a)break}catch(f){if(zT.Logger.debug("TransactionWatcher.awaitConditionally(): cannot (yet) fetch data."),!(f instanceof Ya.Err))throw f}}if(l&&(yield s.start(this.patienceMilliseconds)),o.isStopped()||o.stop(),!u||!l)throw n();return u})}getAllTransactionEvents(e){let r=[...e.logs.events];for(let n of e.contractResults.items)r.push(...n.logs.events);return r}};Ja.TransactionWatcher=Cr;Cr.DefaultPollingInterval=6e3;Cr.DefaultTimeout=Cr.DefaultPollingInterval*15;Cr.DefaultPatience=0;Cr.NoopOnStatusReceived=t=>{};var Pw=class{constructor(e){this.fetcher=e}getTransaction(e){return Sr(this,void 0,void 0,function*(){return zT.Logger.debug(`transactionWatcher, getTransaction(${e})`),yield this.fetcher.getTransaction(e)})}}});var WT=w(Xh=>{"use strict";c();Object.defineProperty(Xh,"__esModule",{value:!0});Xh.CodeMetadata=void 0;var Bw=class{constructor(e=!0,r=!1,n=!1,i=!1){this.upgradeable=e,this.readable=r,this.payable=n,this.payableBySc=i}toggleUpgradeable(e){this.upgradeable=e}toggleReadable(e){this.readable=e}togglePayable(e){this.payable=e}togglePayableBySc(e){this.payableBySc=e}toBuffer(){let e=0,r=0;return this.upgradeable&&(e|=Yh.Upgradeable),this.readable&&(e|=Yh.Readable),this.payable&&(r|=Jh.Payable),this.payableBySc&&(r|=Jh.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}};Xh.CodeMetadata=Bw;var Yh;(function(t){t[t.Upgradeable=1]="Upgradeable",t[t.Reserved2=2]="Reserved2",t[t.Readable=4]="Readable"})(Yh||(Yh={}));var Jh;(function(t){t[t.Reserved1=1]="Reserved1",t[t.Payable=2]="Payable",t[t.PayableBySc=4]="PayableBySc"})(Jh||(Jh={}))});var Zh=w(mn=>{"use strict";c();var gV=mn&&mn.__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]}),yV=mn&&mn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mV=mn&&mn.__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)&&gV(e,t,r);return yV(e,t),e};Object.defineProperty(mn,"__esModule",{value:!0});mn.ContractFunction=void 0;var wV=mV(je()),Kc=class{constructor(e){if(this.name=e,e==null)throw new wV.ErrInvalidFunctionName}static none(){return new Kc("untitled")}toString(){return this.name}valueOf(){return this.name}};mn.ContractFunction=Kc});var KT=w(Tr=>{"use strict";c();var EV=Tr&&Tr.__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]}),vV=Tr&&Tr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),AV=Tr&&Tr.__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 vV(e,t),e},bV=Tr&&Tr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Tr,"__esModule",{value:!0});Tr.InteractionChecker=void 0;var Lw=AV(je()),_V=bV(Yt()),Fw=class{checkInteraction(e,r){this.checkPayable(e,r),this.checkArguments(e,r)}checkPayable(e,r){let n=!new _V.default(e.getValue().toString()).isZero(),i=r.modifiers.isPayableInEGLD();if(n&&!i)throw new Lw.ErrContractInteraction("cannot send EGLD value to non-payable")}checkArguments(e,r){let n=r.input,i=e.getArguments(),s=n.length,o=i.length;if(s!=o)throw new Lw.ErrContractInteraction(`bad arguments, expected: ${s}, got: ${o}`);for(let a=0;a{"use strict";c();Object.defineProperty(ed,"__esModule",{value:!0});ed.Query=void 0;var IV=tr(),SV=Ph(),Mw=class{constructor(e){this.caller=e.caller||new IV.Address,this.address=e.address,this.func=e.func,this.args=e.args||[],this.value=e.value||0}getEncodedArguments(){return new SV.ArgSerializer().valuesToStrings(this.args)}};ed.Query=Mw});var YT=w(rd=>{"use strict";c();Object.defineProperty(rd,"__esModule",{value:!0});rd.Interaction=void 0;var $T=tr(),CV=Lh(),Uw=Go(),qw=Zh(),TV=KT(),xV=td(),Xa=Tt(),Vw=class{constructor(e,r,n){this.nonce=0,this.value="0",this.gasLimit=0,this.gasPrice=void 0,this.chainID="",this.querent=new $T.Address,this.sender=new $T.Address,this.isWithSingleESDTTransfer=!1,this.isWithSingleESDTNFTTransfer=!1,this.isWithMultiESDTNFTTransfer=!1,this.contract=e,this.function=r,this.args=n,this.tokenTransfers=new Za([],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(){CV.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 qw.ContractFunction(Uw.ESDT_TRANSFER_FUNCTION_NAME),n=this.tokenTransfers.buildArgsForSingleESDTTransfer()):this.isWithSingleESDTNFTTransfer?(e=this.sender,r=new qw.ContractFunction(Uw.ESDTNFT_TRANSFER_FUNCTION_NAME),n=this.tokenTransfers.buildArgsForSingleESDTNFTTransfer()):this.isWithMultiESDTNFTTransfer&&(e=this.sender,r=new qw.ContractFunction(Uw.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 xV.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 Za([e],this),this}withSingleESDTNFTTransfer(e,r){return this.isWithSingleESDTNFTTransfer=!0,this.tokenTransfers=new Za([e],this),r&&(this.sender=r),this}withMultiESDTNFTTransfer(e,r){return this.isWithMultiESDTNFTTransfer=!0,this.tokenTransfers=new Za(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 TV.InteractionChecker().checkInteraction(this,this.getEndpoint()),this}};rd.Interaction=Vw;var Za=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 Xa.U8Value(this.transfers.length)}getTypedTokenIdentifier(e){return Xa.BytesValue.fromUTF8(e.tokenIdentifier)}getTypedTokenNonce(e){return new Xa.U64Value(e.nonce)}getTypedTokenQuantity(e){return new Xa.BigUIntValue(e.amountAsBigInteger)}getTypedTokensReceiver(){return new Xa.AddressValue(this.interaction.getContractAddress())}getTypedInteractionFunction(){return Xa.BytesValue.fromUTF8(this.interaction.getFunction().valueOf())}getInteractionArguments(){return this.interaction.getArguments()}}});var JT=w(nd=>{"use strict";c();Object.defineProperty(nd,"__esModule",{value:!0});nd.ArgumentErrorContext=void 0;var NV=je(),jw=class{constructor(e,r,n){this.endpointName=e,this.argumentIndex=r,this.parameterDefinition=n}throwError(e){throw new NV.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)})`)}};nd.ArgumentErrorContext=jw});var ZT=w(ro=>{"use strict";c();var OV=ro&&ro.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ro,"__esModule",{value:!0});ro.NativeSerializer=void 0;var DV=OV(Yt()),PV=tr(),XT=je(),RV=xm(),BV=JT(),be=Tt(),LV;(function(t){function e(A,D){A=A||[],A=r(A,D);let x=D.input,R=[];for(let P=0;P0&&D[0].type.getCardinality().isComposite()&&(R=1/0,P=!0);for(let L of D){if(L.type.getCardinality().isSingular())break;x-=1}return{min:x,max:R,variadic:P}}function i(A,D,x){if(A&&A.belongsToTypesystem)return A;if(D instanceof be.OptionType)return s(A,D,x);if(D instanceof be.OptionalType)return o(A,D,x);if(D instanceof be.VariadicType)return a(A,D,x);if(D instanceof be.CompositeType)return l(A,D,x);if(D instanceof be.TupleType)return f(A,D,x);if(D instanceof be.StructType)return d(A,D,x);if(D instanceof be.ListType)return u(A,D,x);if(D instanceof be.PrimitiveType)return y(A,D,x);x.throwError(`convertToTypedValue: unhandled type ${D}`)}function s(A,D,x){if(A==null)return be.OptionValue.newMissing();let R=i(A,D.getFirstTypeParameter(),x);return be.OptionValue.newProvided(R)}function o(A,D,x){if(A==null)return new be.OptionalValue(D);let R=i(A,D.getFirstTypeParameter(),x);return new be.OptionalValue(D,R)}function a(A,D,x){A==null&&(A=[]),A.map===void 0&&x.convertError(A,"Variadic");let R=A.map(function(P){return i(P,D.getFirstTypeParameter(),x)});return new be.VariadicValue(D,R)}function u(A,D,x){A.map===void 0&&x.convertError(A,"List");let R=A.map(function(P){return i(P,D.getFirstTypeParameter(),x)});return new be.List(D,R)}function l(A,D,x){let R=[],P=D.getTypeParameters();x.guardSameLength(A,P);for(let L=0;L{"use strict";c();Object.defineProperty(jr,"__esModule",{value:!0});jr.ContractCallPayloadBuilder=jr.ContractUpgradePayloadBuilder=jr.ContractDeployPayloadBuilder=jr.ArwenVirtualMachine=void 0;var kw=jc(),zw=gr(),FV=Ph();jr.ArwenVirtualMachine="0500";var Hw=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(){zw.guardValueIsSet("code",this.code);let e=this.code.toString(),r=this.codeMetadata.toString(),n=`${e}@${jr.ArwenVirtualMachine}@${r}`;return n=Ww(n,this.arguments),new kw.TransactionPayload(n)}};jr.ContractDeployPayloadBuilder=Hw;var Gw=class{constructor(){this.code=null,this.codeMetadata="",this.arguments=[]}setCode(e){return this.code=e,this}setCodeMetadata(e){return this.codeMetadata=e,this}addInitArg(e){return this.arguments.push(e),this}setInitArgs(e){return this.arguments=e,this}build(){zw.guardValueIsSet("code",this.code);let e=this.code.toString(),r=this.codeMetadata.toString(),n=`upgradeContract@${e}@${r}`;return n=Ww(n,this.arguments),new kw.TransactionPayload(n)}};jr.ContractUpgradePayloadBuilder=Gw;var Qw=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(){zw.guardValueIsSet("calledFunction",this.contractFunction);let e=this.contractFunction.name;return e=Ww(e,this.arguments),new kw.TransactionPayload(e)}};jr.ContractCallPayloadBuilder=Qw;function Ww(t,e){let{argumentsString:r,count:n}=new FV.ArgSerializer().valuesToString(e);return n==0?t:`${t}@${r}`}});var Wn=w((Vse,Kw)=>{"use strict";c();var eu=typeof Reflect=="object"?Reflect:null,tx=eu&&typeof eu.apply=="function"?eu.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},id;eu&&typeof eu.ownKeys=="function"?id=eu.ownKeys:Object.getOwnPropertySymbols?id=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:id=function(e){return Object.getOwnPropertyNames(e)};function MV(t){console&&console.warn&&console.warn(t)}var nx=Number.isNaN||function(e){return e!==e};function He(){He.init.call(this)}Kw.exports=He;Kw.exports.once=jV;He.EventEmitter=He;He.prototype._events=void 0;He.prototype._eventsCount=0;He.prototype._maxListeners=void 0;var rx=10;function sd(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(He,"defaultMaxListeners",{enumerable:!0,get:function(){return rx},set:function(t){if(typeof t!="number"||t<0||nx(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");rx=t}});He.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};He.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||nx(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 ix(t){return t._maxListeners===void 0?He.defaultMaxListeners:t._maxListeners}He.prototype.getMaxListeners=function(){return ix(this)};He.prototype.emit=function(e){for(var r=[],n=1;n0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var u=s[e];if(u===void 0)return!1;if(typeof u=="function")tx(u,this,r);else for(var l=u.length,f=cx(u,l),n=0;n0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,MV(a)}return t}He.prototype.addListener=function(e,r){return sx(this,e,r,!1)};He.prototype.on=He.prototype.addListener;He.prototype.prependListener=function(e,r){return sx(this,e,r,!0)};function UV(){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 ox(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=UV.bind(n);return i.listener=r,n.wrapFn=i,i}He.prototype.once=function(e,r){return sd(r),this.on(e,ox(this,e,r)),this};He.prototype.prependOnceListener=function(e,r){return sd(r),this.prependListener(e,ox(this,e,r)),this};He.prototype.removeListener=function(e,r){var n,i,s,o,a;if(sd(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():qV(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};He.prototype.off=He.prototype.removeListener;He.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i=0;i--)this.removeListener(e,r[i]);return this};function ax(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?VV(i):cx(i,i.length)}He.prototype.listeners=function(e){return ax(this,e,!0)};He.prototype.rawListeners=function(e){return ax(this,e,!1)};He.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):ux.call(t,e)};He.prototype.listenerCount=ux;function ux(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}He.prototype.eventNames=function(){return this._eventsCount>0?id(this._events):[]};function cx(t,e){for(var r=new Array(e),n=0;n{c();fx.exports=Wn().EventEmitter});var Yw=w(()=>{c()});var mx=w((Wse,yx)=>{"use strict";c();function hx(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 dx(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 od.alloc(0);for(var n=od.allocUnsafe(r>>>0),i=this.head,s=0;i;)YV(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=od.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:$V,value:function(r,n){return Jw(this,dx(dx({},n),{},{depth:0,customInspect:!1}))}}]),t}()});var Zw=w(($se,Ex)=>{"use strict";c();function JV(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(Xw,this,t)):p.default.nextTick(Xw,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(ad,r):(r._writableState.errorEmitted=!0,p.default.nextTick(wx,r,s)):p.default.nextTick(wx,r,s):e?(p.default.nextTick(ad,r),e(s)):p.default.nextTick(ad,r)}),this)}function wx(t,e){Xw(t,e),ad(t)}function ad(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function XV(){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 Xw(t,e){t.emit("error",e)}function ZV(t,e){var r=t._readableState,n=t._writableState;r&&r.autoDestroy||n&&n.autoDestroy?t.destroy(e):t.emit("error",e)}Ex.exports={destroy:JV,undestroy:XV,errorOrDestroy:ZV}});var no=w((Jse,bx)=>{"use strict";c();function ej(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var Ax={};function xr(t,e,r){r||(r=Error);function n(s,o,a){return typeof e=="string"?e:e(s,o,a)}var i=function(s){ej(o,s);function o(a,u,l){return s.call(this,n(a,u,l))||this}return o}(r);i.prototype.name=r.name,i.prototype.code=t,Ax[t]=i}function vx(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 tj(t,e,r){return t.substr(!r||r<0?0:+r,e.length)===e}function rj(t,e,r){return(r===void 0||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}function nj(t,e,r){return typeof r!="number"&&(r=0),r+e.length>t.length?!1:t.indexOf(e,r)!==-1}xr("ERR_INVALID_OPT_VALUE",function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'},TypeError);xr("ERR_INVALID_ARG_TYPE",function(t,e,r){var n;typeof e=="string"&&tj(e,"not ")?(n="must not be",e=e.replace(/^not /,"")):n="must be";var i;if(rj(t," argument"))i="The ".concat(t," ").concat(n," ").concat(vx(e,"type"));else{var s=nj(t,".")?"property":"argument";i='The "'.concat(t,'" ').concat(s," ").concat(n," ").concat(vx(e,"type"))}return i+=". Received type ".concat(typeof r),i},TypeError);xr("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");xr("ERR_METHOD_NOT_IMPLEMENTED",function(t){return"The "+t+" method is not implemented"});xr("ERR_STREAM_PREMATURE_CLOSE","Premature close");xr("ERR_STREAM_DESTROYED",function(t){return"Cannot call "+t+" after a stream was destroyed"});xr("ERR_MULTIPLE_CALLBACK","Callback called multiple times");xr("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");xr("ERR_STREAM_WRITE_AFTER_END","write after end");xr("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);xr("ERR_UNKNOWN_ENCODING",function(t){return"Unknown encoding: "+t},TypeError);xr("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");bx.exports.codes=Ax});var eE=w((Zse,_x)=>{"use strict";c();var ij=no().codes.ERR_INVALID_OPT_VALUE;function sj(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function oj(t,e,r,n){var i=sj(e,n,r);if(i!=null){if(!(isFinite(i)&&Math.floor(i)===i)||i<0){var s=n?r:"highWaterMark";throw new ij(s,i)}return Math.floor(i)}return t.objectMode?16:16*1024}_x.exports={getHighWaterMark:oj}});var tu=w((toe,tE)=>{c();typeof Object.create=="function"?tE.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:tE.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 Sx=w((noe,Ix)=>{c();Ix.exports=aj;function aj(t,e){if(rE("noDeprecation"))return t;var r=!1;function n(){if(!r){if(rE("throwDeprecation"))throw new Error(e);rE("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}return n}function rE(t){try{if(!global.localStorage)return!1}catch{return!1}var e=global.localStorage[t];return e==null?!1:String(e).toLowerCase()==="true"}});var sE=w((soe,Dx)=>{"use strict";c();Dx.exports=ut;function Tx(t){var e=this;this.next=null,this.entry=null,this.finish=function(){Bj(e,t)}}var ru;ut.WritableState=Yc;var uj={deprecate:Sx()},xx=$w(),cd=Wa().Buffer,cj=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function lj(t){return cd.from(t)}function fj(t){return cd.isBuffer(t)||t instanceof cj}var iE=Zw(),hj=eE(),dj=hj.getHighWaterMark,Pi=no().codes,pj=Pi.ERR_INVALID_ARG_TYPE,gj=Pi.ERR_METHOD_NOT_IMPLEMENTED,yj=Pi.ERR_MULTIPLE_CALLBACK,mj=Pi.ERR_STREAM_CANNOT_PIPE,wj=Pi.ERR_STREAM_DESTROYED,Ej=Pi.ERR_STREAM_NULL_VALUES,vj=Pi.ERR_STREAM_WRITE_AFTER_END,Aj=Pi.ERR_UNKNOWN_ENCODING,nu=iE.errorOrDestroy;tu()(ut,xx);function bj(){}function Yc(t,e,r){ru=ru||io(),t=t||{},typeof r!="boolean"&&(r=e instanceof ru),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=dj(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){Nj(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 Tx(this)}Yc.prototype.getBuffer=function(){for(var e=this.bufferedRequest,r=[];e;)r.push(e),e=e.next;return r};(function(){try{Object.defineProperty(Yc.prototype,"buffer",{get:uj.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var ud;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(ud=Function.prototype[Symbol.hasInstance],Object.defineProperty(ut,Symbol.hasInstance,{value:function(e){return ud.call(this,e)?!0:this!==ut?!1:e&&e._writableState instanceof Yc}})):ud=function(e){return e instanceof this};function ut(t){ru=ru||io();var e=this instanceof ru;if(!e&&!ud.call(ut,this))return new ut(t);this._writableState=new Yc(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)),xx.call(this)}ut.prototype.pipe=function(){nu(this,new mj)};function _j(t,e){var r=new vj;nu(t,r),p.default.nextTick(e,r)}function Ij(t,e,r,n){var i;return r===null?i=new Ej:typeof r!="string"&&!e.objectMode&&(i=new pj("chunk",["string","Buffer"],r)),i?(nu(t,i),p.default.nextTick(n,i),!1):!0}ut.prototype.write=function(t,e,r){var n=this._writableState,i=!1,s=!n.objectMode&&fj(t);return s&&!cd.isBuffer(t)&&(t=lj(t)),typeof e=="function"&&(r=e,e=null),s?e="buffer":e||(e=n.defaultEncoding),typeof r!="function"&&(r=bj),n.ending?_j(this,r):(s||Ij(this,n,t,r))&&(n.pendingcb++,i=Cj(this,n,s,t,e,r)),i};ut.prototype.cork=function(){this._writableState.corked++};ut.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,!t.writing&&!t.corked&&!t.bufferProcessing&&t.bufferedRequest&&Nx(this,t))};ut.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new Aj(e);return this._writableState.defaultEncoding=e,this};Object.defineProperty(ut.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function Sj(t,e,r){return!t.objectMode&&t.decodeStrings!==!1&&typeof e=="string"&&(e=cd.from(e,r)),e}Object.defineProperty(ut.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function Cj(t,e,r,n,i,s){if(!r){var o=Sj(e,n,i);n!==o&&(r=!0,i="buffer",n=o)}var a=e.objectMode?1:n.length;e.length+=a;var u=e.length{"use strict";c();var Lj=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};Rx.exports=wn;var Px=uE(),aE=sE();tu()(wn,Px);for(oE=Lj(aE.prototype),ld=0;ld{c();var hd=Wa(),En=hd.Buffer;function Bx(t,e){for(var r in t)e[r]=t[r]}En.from&&En.alloc&&En.allocUnsafe&&En.allocUnsafeSlow?Lx.exports=hd:(Bx(hd,cE),cE.Buffer=so);function so(t,e,r){return En(t,e,r)}so.prototype=Object.create(En.prototype);Bx(En,so);so.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return En(t,e,r)};so.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=En(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};so.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return En(t)};so.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return hd.SlowBuffer(t)}});var hE=w(Ux=>{"use strict";c();var fE=Fx().Buffer,Mx=fE.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 qj(t){var e=Uj(t);if(typeof e!="string"&&(fE.isEncoding===Mx||!Mx(t)))throw new Error("Unknown encoding: "+t);return e||t}Ux.StringDecoder=Jc;function Jc(t){this.encoding=qj(t);var e;switch(this.encoding){case"utf16le":this.text=kj,this.end=zj,e=4;break;case"utf8":this.fillLast=Hj,e=4;break;case"base64":this.text=Wj,this.end=Kj,e=3;break;default:this.write=$j,this.end=Yj;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=fE.allocUnsafe(e)}Jc.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 Vj(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 jj(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=jj(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 Gj(t,e){var r=Vj(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 Qj(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function kj(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 zj(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 Kj(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function $j(t){return t.toString(this.encoding)}function Yj(t){return t&&t.length?this.write(t):""}});var dd=w((hoe,jx)=>{"use strict";c();var qx=no().codes.ERR_STREAM_PREMATURE_CLOSE;function Jj(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,n=new Array(r),i=0;i{"use strict";c();var pd;function Ri(t,e,r){return e=eH(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function eH(t){var e=tH(t,"string");return typeof e=="symbol"?e:String(e)}function tH(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 rH=dd(),Bi=Symbol("lastResolve"),oo=Symbol("lastReject"),Xc=Symbol("error"),gd=Symbol("ended"),ao=Symbol("lastPromise"),dE=Symbol("handlePromise"),uo=Symbol("stream");function Li(t,e){return{value:t,done:e}}function nH(t){var e=t[Bi];if(e!==null){var r=t[uo].read();r!==null&&(t[ao]=null,t[Bi]=null,t[oo]=null,e(Li(r,!1)))}}function iH(t){p.default.nextTick(nH,t)}function sH(t,e){return function(r,n){t.then(function(){if(e[gd]){r(Li(void 0,!0));return}e[dE](r,n)},n)}}var oH=Object.getPrototypeOf(function(){}),aH=Object.setPrototypeOf((pd={get stream(){return this[uo]},next:function(){var e=this,r=this[Xc];if(r!==null)return Promise.reject(r);if(this[gd])return Promise.resolve(Li(void 0,!0));if(this[uo].destroyed)return new Promise(function(o,a){p.default.nextTick(function(){e[Xc]?a(e[Xc]):o(Li(void 0,!0))})});var n=this[ao],i;if(n)i=new Promise(sH(n,this));else{var s=this[uo].read();if(s!==null)return Promise.resolve(Li(s,!1));i=new Promise(this[dE])}return this[ao]=i,i}},Ri(pd,Symbol.asyncIterator,function(){return this}),Ri(pd,"return",function(){var e=this;return new Promise(function(r,n){e[uo].destroy(null,function(i){if(i){n(i);return}r(Li(void 0,!0))})})}),pd),oH),uH=function(e){var r,n=Object.create(aH,(r={},Ri(r,uo,{value:e,writable:!0}),Ri(r,Bi,{value:null,writable:!0}),Ri(r,oo,{value:null,writable:!0}),Ri(r,Xc,{value:null,writable:!0}),Ri(r,gd,{value:e._readableState.endEmitted,writable:!0}),Ri(r,dE,{value:function(s,o){var a=n[uo].read();a?(n[ao]=null,n[Bi]=null,n[oo]=null,s(Li(a,!1))):(n[Bi]=s,n[oo]=o)},writable:!0}),r));return n[ao]=null,rH(e,function(i){if(i&&i.code!=="ERR_STREAM_PREMATURE_CLOSE"){var s=n[oo];s!==null&&(n[ao]=null,n[Bi]=null,n[oo]=null,s(i)),n[Xc]=i;return}var o=n[Bi];o!==null&&(n[ao]=null,n[Bi]=null,n[oo]=null,o(Li(void 0,!0))),n[gd]=!0}),e.on("readable",iH.bind(null,n)),n};Hx.exports=uH});var kx=w((yoe,Qx)=>{c();Qx.exports=function(){throw new Error("Readable.from is not available in the browser")}});var uE=w((Eoe,t2)=>{"use strict";c();t2.exports=Fe;var iu;Fe.ReadableState=$x;var woe=Wn().EventEmitter,Kx=function(e,r){return e.listeners(r).length},el=$w(),yd=Wa().Buffer,cH=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function lH(t){return yd.from(t)}function fH(t){return yd.isBuffer(t)||t instanceof cH}var pE=Yw(),xe;pE&&pE.debuglog?xe=pE.debuglog("stream"):xe=function(){};var hH=mx(),AE=Zw(),dH=eE(),pH=dH.getHighWaterMark,md=no().codes,gH=md.ERR_INVALID_ARG_TYPE,yH=md.ERR_STREAM_PUSH_AFTER_EOF,mH=md.ERR_METHOD_NOT_IMPLEMENTED,wH=md.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,su,gE,yE;tu()(Fe,el);var Zc=AE.errorOrDestroy,mE=["error","close","destroy","pause","resume"];function EH(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 $x(t,e,r){iu=iu||io(),t=t||{},typeof r!="boolean"&&(r=e instanceof iu),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=pH(this,t,"readableHighWaterMark",r),this.buffer=new hH,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&&(su||(su=hE().StringDecoder),this.decoder=new su(t.encoding),this.encoding=t.encoding)}function Fe(t){if(iu=iu||io(),!(this instanceof Fe))return new Fe(t);var e=this instanceof iu;this._readableState=new $x(t,this,e),this.readable=!0,t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy)),el.call(this)}Object.defineProperty(Fe.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}});Fe.prototype.destroy=AE.destroy;Fe.prototype._undestroy=AE.undestroy;Fe.prototype._destroy=function(t,e){e(t)};Fe.prototype.push=function(t,e){var r=this._readableState,n;return r.objectMode?n=!0:typeof t=="string"&&(e=e||r.defaultEncoding,e!==r.encoding&&(t=yd.from(t,e),e=""),n=!0),Yx(this,t,e,!1,n)};Fe.prototype.unshift=function(t){return Yx(this,t,null,!0,!1)};function Yx(t,e,r,n,i){xe("readableAddChunk",e);var s=t._readableState;if(e===null)s.reading=!1,bH(t,s);else{var o;if(i||(o=vH(s,e)),o)Zc(t,o);else if(s.objectMode||e&&e.length>0)if(typeof e!="string"&&!s.objectMode&&Object.getPrototypeOf(e)!==yd.prototype&&(e=lH(e)),n)s.endEmitted?Zc(t,new wH):wE(t,s,e,!0);else if(s.ended)Zc(t,new yH);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(e=s.decoder.write(e),s.objectMode||e.length!==0?wE(t,s,e,!1):vE(t,s)):wE(t,s,e,!1)}else n||(s.reading=!1,vE(t,s))}return!s.ended&&(s.length=zx?t=zx:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}function Wx(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=AH(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}Fe.prototype.read=function(t){xe("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(t!==0&&(e.emittedReadable=!1),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return xe("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?EE(this):wd(this),null;if(t=Wx(t,e),t===0&&e.ended)return e.length===0&&EE(this),null;var n=e.needReadable;xe("need readable",n),(e.length===0||e.length-t0?i=Zx(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&&EE(this)),i!==null&&this.emit("data",i),i};function bH(t,e){if(xe("onEofChunk"),!e.ended){if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?wd(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,Jx(t)))}}function wd(t){var e=t._readableState;xe("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(xe("emitReadable",e.flowing),e.emittedReadable=!0,p.default.nextTick(Jx,t))}function Jx(t){var e=t._readableState;xe("emitReadable_",e.destroyed,e.length,e.ended),!e.destroyed&&(e.length||e.ended)&&(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,bE(t)}function vE(t,e){e.readingMore||(e.readingMore=!0,p.default.nextTick(_H,t,e))}function _H(t,e){for(;!e.reading&&!e.ended&&(e.length1&&e2(n.pipes,t)!==-1)&&!l&&(xe("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function y(B){xe("onerror",B),T(),t.removeListener("error",y),Kx(t,"error")===0&&Zc(t,B)}EH(t,"error",y);function m(){t.removeListener("finish",v),T()}t.once("close",m);function v(){xe("onfinish"),t.removeListener("close",m),T()}t.once("finish",v);function T(){xe("unpipe"),r.unpipe(t)}return t.emit("pipe",r),n.flowing||(xe("pipe resume"),r.resume()),t};function IH(t){return function(){var r=t._readableState;xe("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,r.awaitDrain===0&&Kx(t,"data")&&(r.flowing=!0,bE(t))}}Fe.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(e.pipesCount===0)return this;if(e.pipesCount===1)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r),this);if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var s=0;s0,n.flowing!==!1&&this.resume()):t==="readable"&&!n.endEmitted&&!n.readableListening&&(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,xe("on readable",n.length,n.reading),n.length?wd(this):n.reading||p.default.nextTick(SH,this)),r};Fe.prototype.addListener=Fe.prototype.on;Fe.prototype.removeListener=function(t,e){var r=el.prototype.removeListener.call(this,t,e);return t==="readable"&&p.default.nextTick(Xx,this),r};Fe.prototype.removeAllListeners=function(t){var e=el.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&p.default.nextTick(Xx,this),e};function Xx(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 SH(t){xe("readable nexttick read 0"),t.read(0)}Fe.prototype.resume=function(){var t=this._readableState;return t.flowing||(xe("resume"),t.flowing=!t.readableListening,CH(this,t)),t.paused=!1,this};function CH(t,e){e.resumeScheduled||(e.resumeScheduled=!0,p.default.nextTick(TH,t,e))}function TH(t,e){xe("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),bE(t),e.flowing&&!e.reading&&t.read(0)}Fe.prototype.pause=function(){return xe("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(xe("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function bE(t){var e=t._readableState;for(xe("flow",e.flowing);e.flowing&&t.read()!==null;);}Fe.prototype.wrap=function(t){var e=this,r=this._readableState,n=!1;t.on("end",function(){if(xe("wrapped end"),r.decoder&&!r.ended){var o=r.decoder.end();o&&o.length&&e.push(o)}e.push(null)}),t.on("data",function(o){if(xe("wrapped data"),r.decoder&&(o=r.decoder.write(o)),!(r.objectMode&&o==null)&&!(!r.objectMode&&(!o||!o.length))){var a=e.push(o);a||(n=!0,t.pause())}});for(var i in t)this[i]===void 0&&typeof t[i]=="function"&&(this[i]=function(a){return function(){return t[a].apply(t,arguments)}}(i));for(var s=0;s=e.length?(e.decoder?r=e.buffer.join(""):e.buffer.length===1?r=e.buffer.first():r=e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r}function EE(t){var e=t._readableState;xe("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,p.default.nextTick(xH,e,t))}function xH(t,e){if(xe("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&t.length===0&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}typeof Symbol=="function"&&(Fe.from=function(t,e){return yE===void 0&&(yE=kx()),yE(Fe,t,e)});function e2(t,e){for(var r=0,n=t.length;r{"use strict";c();n2.exports=Kn;var Ed=no().codes,NH=Ed.ERR_METHOD_NOT_IMPLEMENTED,OH=Ed.ERR_MULTIPLE_CALLBACK,DH=Ed.ERR_TRANSFORM_ALREADY_TRANSFORMING,PH=Ed.ERR_TRANSFORM_WITH_LENGTH_0,vd=io();tu()(Kn,vd);function RH(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(n===null)return this.emit("error",new OH);r.writechunk=null,r.writecb=null,e!=null&&this.push(e),n(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length{"use strict";c();s2.exports=tl;var i2=_E();tu()(tl,i2);function tl(t){if(!(this instanceof tl))return new tl(t);i2.call(this,t)}tl.prototype._transform=function(t,e,r){r(null,t)}});var f2=w((Soe,l2)=>{"use strict";c();var IE;function LH(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}var c2=no().codes,FH=c2.ERR_MISSING_ARGS,MH=c2.ERR_STREAM_DESTROYED;function a2(t){if(t)throw t}function UH(t){return t.setHeader&&typeof t.abort=="function"}function qH(t,e,r,n){n=LH(n);var i=!1;t.on("close",function(){i=!0}),IE===void 0&&(IE=dd()),IE(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,UH(t))return t.abort();if(typeof t.destroy=="function")return t.destroy();n(o||new MH("pipe"))}}}function u2(t){t()}function VH(t,e){return t.pipe(e)}function jH(t){return!t.length||typeof t[t.length-1]!="function"?a2:t.pop()}function HH(){for(var t=arguments.length,e=new Array(t),r=0;r0;return qH(o,u,l,function(f){i||(i=f),f&&s.forEach(u2),!u&&(s.forEach(u2),n(i))})});return e.reduce(VH)}l2.exports=HH});var SE=w((Nr,h2)=>{c();Nr=h2.exports=uE();Nr.Stream=Nr;Nr.Readable=Nr;Nr.Writable=sE();Nr.Duplex=io();Nr.Transform=_E();Nr.PassThrough=o2();Nr.finished=dd();Nr.pipeline=f2()});var g2=w((xoe,p2)=>{c();var{Transform:GH}=SE();p2.exports=t=>class d2 extends GH{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 d2(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}}});var w2=w((Ooe,m2)=>{c();var{Transform:QH}=SE();m2.exports=t=>class y2 extends QH{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 y2(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}}});var v2=w((Poe,E2)=>{c();var kH=g2(),zH=w2();E2.exports=function(t){let e=kH(t),r=zH(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 _2=w(b2=>{c();var A2=[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];b2.p1600=function(t){for(let e=0;e<24;++e){let r=t[0]^t[10]^t[20]^t[30]^t[40],n=t[1]^t[11]^t[21]^t[31]^t[41],i=t[2]^t[12]^t[22]^t[32]^t[42],s=t[3]^t[13]^t[23]^t[33]^t[43],o=t[4]^t[14]^t[24]^t[34]^t[44],a=t[5]^t[15]^t[25]^t[35]^t[45],u=t[6]^t[16]^t[26]^t[36]^t[46],l=t[7]^t[17]^t[27]^t[37]^t[47],f=t[8]^t[18]^t[28]^t[38]^t[48],d=t[9]^t[19]^t[29]^t[39]^t[49],y=f^(i<<1|s>>>31),m=d^(s<<1|i>>>31),v=t[0]^y,T=t[1]^m,B=t[10]^y,A=t[11]^m,D=t[20]^y,x=t[21]^m,R=t[30]^y,P=t[31]^m,L=t[40]^y,_=t[41]^m;y=r^(o<<1|a>>>31),m=n^(a<<1|o>>>31);let C=t[2]^y,M=t[3]^m,Z=t[12]^y,z=t[13]^m,H=t[22]^y,G=t[23]^m,$=t[32]^y,de=t[33]^m,ae=t[42]^y,re=t[43]^m;y=i^(u<<1|l>>>31),m=s^(l<<1|u>>>31);let Y=t[4]^y,ie=t[5]^m,te=t[14]^y,ne=t[15]^m,q=t[24]^y,ce=t[25]^m,oe=t[34]^y,le=t[35]^m,se=t[44]^y,ue=t[45]^m;y=o^(f<<1|d>>>31),m=a^(d<<1|f>>>31);let g=t[6]^y,E=t[7]^m,b=t[16]^y,O=t[17]^m,I=t[26]^y,N=t[27]^m,F=t[36]^y,S=t[37]^m,U=t[46]^y,j=t[47]^m;y=u^(r<<1|n>>>31),m=l^(n<<1|r>>>31);let V=t[8]^y,X=t[9]^m,ye=t[18]^y,we=t[19]^m,Pe=t[28]^y,$e=t[29]^m,ot=t[38]^y,Oe=t[39]^m,Me=t[48]^y,vt=t[49]^m,ci=v,gs=T,ys=A<<4|B>>>28,Xt=B<<4|A>>>28,Ln=D<<3|x>>>29,jt=x<<3|D>>>29,At=P<<9|R>>>23,Qe=R<<9|P>>>23,_0=L<<18|_>>>14,I0=_<<18|L>>>14,S0=C<<1|M>>>31,C0=M<<1|C>>>31,T0=z<<12|Z>>>20,x0=Z<<12|z>>>20,N0=H<<10|G>>>22,O0=G<<10|H>>>22,D0=de<<13|$>>>19,P0=$<<13|de>>>19,R0=ae<<2|re>>>30,B0=re<<2|ae>>>30,L0=ie<<30|Y>>>2,F0=Y<<30|ie>>>2,M0=te<<6|ne>>>26,U0=ne<<6|te>>>26,q0=ce<<11|q>>>21,V0=q<<11|ce>>>21,j0=oe<<15|le>>>17,H0=le<<15|oe>>>17,G0=ue<<29|se>>>3,Q0=se<<29|ue>>>3,k0=g<<28|E>>>4,z0=E<<28|g>>>4,W0=O<<23|b>>>9,K0=b<<23|O>>>9,$0=I<<25|N>>>7,Y0=N<<25|I>>>7,J0=F<<21|S>>>11,X0=S<<21|F>>>11,Z0=j<<24|U>>>8,ey=U<<24|j>>>8,ty=V<<27|X>>>5,ry=X<<27|V>>>5,ny=ye<<20|we>>>12,iy=we<<20|ye>>>12,sy=$e<<7|Pe>>>25,oy=Pe<<7|$e>>>25,ay=ot<<8|Oe>>>24,uy=Oe<<8|ot>>>24,cy=Me<<14|vt>>>18,ly=vt<<14|Me>>>18;t[0]=ci^~T0&q0,t[1]=gs^~x0&V0,t[10]=k0^~ny&Ln,t[11]=z0^~iy&jt,t[20]=S0^~M0&$0,t[21]=C0^~U0&Y0,t[30]=ty^~ys&N0,t[31]=ry^~Xt&O0,t[40]=L0^~W0&sy,t[41]=F0^~K0&oy,t[2]=T0^~q0&J0,t[3]=x0^~V0&X0,t[12]=ny^~Ln&D0,t[13]=iy^~jt&P0,t[22]=M0^~$0&ay,t[23]=U0^~Y0&uy,t[32]=ys^~N0&j0,t[33]=Xt^~O0&H0,t[42]=W0^~sy&At,t[43]=K0^~oy&Qe,t[4]=q0^~J0&cy,t[5]=V0^~X0&ly,t[14]=Ln^~D0&G0,t[15]=jt^~P0&Q0,t[24]=$0^~ay&_0,t[25]=Y0^~uy&I0,t[34]=N0^~j0&Z0,t[35]=O0^~H0&ey,t[44]=sy^~At&R0,t[45]=oy^~Qe&B0,t[6]=J0^~cy&ci,t[7]=X0^~ly&gs,t[16]=D0^~G0&k0,t[17]=P0^~Q0&z0,t[26]=ay^~_0&S0,t[27]=uy^~I0&C0,t[36]=j0^~Z0&ty,t[37]=H0^~ey&ry,t[46]=At^~R0&L0,t[47]=Qe^~B0&F0,t[8]=cy^~ci&T0,t[9]=ly^~gs&x0,t[18]=G0^~k0&ny,t[19]=Q0^~z0&iy,t[28]=_0^~S0&M0,t[29]=I0^~C0&U0,t[38]=Z0^~ty&ys,t[39]=ey^~ry&Xt,t[48]=R0^~L0&W0,t[49]=B0^~F0&K0,t[0]^=A2[e*2],t[1]^=A2[e*2+1]}}});var S2=w((Foe,I2)=>{c();var Ad=_2();function ou(){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}ou.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};ou.prototype.absorb=function(t){for(let e=0;e>>8*(this.count%4)&255,this.count+=1,this.count===this.blockSize&&(Ad.p1600(this.state),this.count=0);return e};ou.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=ou});var T2=w((Uoe,C2)=>{c();C2.exports=v2()(S2())});var D2=w(au=>{"use strict";c();var WH=au&&au.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(au,"__esModule",{value:!0});au.SmartContract=void 0;var KH=WH(Yt()),rl=tr(),CE=Lh(),$H=je(),TE=Wc(),YH=gr(),JH=lh(),x2=WT(),N2=Zh(),O2=YT(),XH=ZT(),ZH=td(),bd=ex(),e7=T2(),xE=class{constructor(e={}){this.address=new rl.Address,this.methodsExplicit={},this.methods={},this.address=e.address||new rl.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 N2.ContractFunction(i);return new O2.Interaction(e,o,s||[])},this.methods[i]=function(s){let o=new N2.ContractFunction(i),a=XH.NativeSerializer.nativeToTypedValues(s||[],n);return new O2.Interaction(e,o,a||[])}}}setAddress(e){this.address=e}getAddress(){return this.address}getAbi(){return YH.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}){CE.Compatibility.guardAddressIsSetAndNonZero(e,"'deployer' of SmartContract.deploy()","pass the actual address to deploy()"),n=n||new x2.CodeMetadata,i=i||[],s=s||0;let l=new bd.ContractDeployPayloadBuilder().setCode(r).setCodeMetadata(n).setInitArgs(i).build();return new TE.Transaction({receiver:rl.Address.Zero(),sender:e,value:s,gasLimit:o,gasPrice:a,data:l,chainID:u})}upgrade({caller:e,code:r,codeMetadata:n,initArguments:i,value:s,gasLimit:o,gasPrice:a,chainID:u}){CE.Compatibility.guardAddressIsSetAndNonZero(e,"'caller' of SmartContract.upgrade()","pass the actual address to upgrade()"),this.ensureHasAddress(),n=n||new x2.CodeMetadata,i=i||[],s=s||0;let l=new bd.ContractUpgradePayloadBuilder().setCode(r).setCodeMetadata(n).setInitArgs(i).build();return new TE.Transaction({sender:e,receiver:this.getAddress(),value:s,gasLimit:o,gasPrice:a,data:l,chainID:u})}call({func:e,args:r,value:n,gasLimit:i,receiver:s,gasPrice:o,chainID:a,caller:u}){CE.Compatibility.guardAddressIsSetAndNonZero(u,"'caller' of SmartContract.call()","pass the actual address to call()"),this.ensureHasAddress(),r=r||[],n=n||0;let l=new bd.ContractCallPayloadBuilder().setFunction(e).setArgs(r).build();return new TE.Transaction({sender:u,receiver:s||this.getAddress(),value:n,gasLimit:i,gasPrice:o,data:l,chainID:a})}createQuery({func:e,args:r,value:n,caller:i}){return this.ensureHasAddress(),new ZH.Query({address:this.getAddress(),func:e,args:r,value:n,caller:i})}ensureHasAddress(){if(!this.getAddress().bech32())throw new $H.ErrContractHasNoAddress}static computeAddress(e,r){let n=h.Buffer.alloc(8,0),i=new rl.Address(e.bech32()).pubkey(),s=i.slice(30),o=h.Buffer.alloc(8),a=new KH.default(r.valueOf().toString(10)),u=JH.bigIntToBuffer(a);o.write(u.reverse().toString("hex"),"hex");let l=h.Buffer.concat([i,o]),f=e7("keccak256").update(l).digest(),d=h.Buffer.from(bd.ArwenVirtualMachine,"hex"),y=h.Buffer.concat([n,d,f.slice(10,30),s]);return new rl.Address(y)}};au.SmartContract=xE});var P2=w(uu=>{"use strict";c();Object.defineProperty(uu,"__esModule",{value:!0});uu.Signature=uu.Address=void 0;var NE=class{constructor(e){this.value=e}bech32(){return this.value}};uu.Address=NE;var OE=class{constructor(e){this.value=e}hex(){return this.value}};uu.Signature=OE});var R2=w(nl=>{"use strict";c();Object.defineProperty(nl,"__esModule",{value:!0});nl.Operation=void 0;var t7;(function(t){t.Connect="connect",t.Logout="logout",t.SignTransactions="signTransactions",t.SignMessage="signMessage",t.CancelAction="cancelAction"})(t7=nl.Operation||(nl.Operation={}))});var B2=w(Fi=>{"use strict";c();Object.defineProperty(Fi,"__esModule",{value:!0});Fi.ErrAccountNotConnected=Fi.ErrCannotSignSingleTransaction=Fi.Err=void 0;var il=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};Fi.Err=il;var DE=class extends il{constructor(){super("Cannot sign single transaction.")}};Fi.ErrCannotSignSingleTransaction=DE;var PE=class extends il{constructor(){super("Account is not connected.")}};Fi.ErrAccountNotConnected=PE});var RE=w(cu=>{"use strict";c();var Mi=cu&&cu.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(cu,"__esModule",{value:!0});cu.ExtensionProvider=void 0;var _d=P2(),sl=R2(),L2=B2(),vn=class{constructor(){if(this.account={address:""},this.initialized=!1,vn._instance)throw new Error("Error: Instantiation failed: Use ExtensionProvider.getInstance() instead of new.");vn._instance=this}static getInstance(){return vn._instance}setAddress(e){return this.account.address=e,vn._instance}init(){return Mi(this,void 0,void 0,function*(){return window&&window.elrondWallet&&(this.initialized=!0),this.initialized})}login(e={}){return Mi(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(sl.Operation.Connect,n),this.account.address})}logout(){return Mi(this,void 0,void 0,function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");try{yield this.startBgrMsgChannel(sl.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 Mi(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 Mi(this,void 0,void 0,function*(){return!!this.account.address})}signTransaction(e){return Mi(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 Mi(this,void 0,void 0,function*(){this.ensureConnected();let r=yield this.startBgrMsgChannel(sl.Operation.SignTransactions,{from:this.account.address,transactions:e.map(n=>n.toPlainObject())});try{for(let n=0;n{window.postMessage({target:"erdw-inpage",type:e,data:r},window.origin);let i=s=>{s.isTrusted&&s.data.target==="erdw-contentScript"&&(s.data.type==="connectResponse"?(s.data.data&&s.data.data.address&&(this.account=s.data.data),window.removeEventListener("message",i),n(s.data.data)):(window.removeEventListener("message",i),n(s.data.data)))};window.addEventListener("message",i,!1)})}};cu.ExtensionProvider=vn;vn._instance=new vn});var j2=w((sae,V2)=>{"use strict";c();function r7(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}V2.exports=n7;function n7(t,e,r){var n=r&&r.stringify||r7,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}l+=n(e[f]),d=m+2,m++;break;case 115:if(f>=u)break;d{"use strict";c();var H2=j2();k2.exports=bn;var ol=d7().console||{},i7={mapHttpRequest:xd,mapHttpResponse:xd,wrapRequestSerializer:BE,wrapResponseSerializer:BE,wrapErrorSerializer:BE,req:xd,res:xd,err:c7};function s7(t,e){return Array.isArray(t)?t.filter(function(n){return n!=="!stdSerializers.err"}):t===!0?Object.keys(e):!1}function bn(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||ol;t.browser.write&&(t.browser.asObject=!0);let n=t.serializers||{},i=s7(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=al),Object.defineProperty(u,"levelVal",{get:f}),Object.defineProperty(u,"level",{get:d,set:y});let l={transmit:e,serialize:i,asObject:t.browser.asObject,levels:o,timestamp:l7(t)};u.levels=bn.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=al,u.serializers=n,u._serialize=i,u._stdErrSerialize=s,u.child=m,e&&(u._logEvent=LE());function f(){return this.level==="silent"?1/0:this.levels.values[this.level]}function d(){return this._level}function y(v){if(v!=="silent"&&!this.levels.values[v])throw Error("unknown level "+v);this._level=v,lu(l,u,"error","log"),lu(l,u,"fatal","error"),lu(l,u,"warn","error"),lu(l,u,"info","log"),lu(l,u,"debug","log"),lu(l,u,"trace","log")}function m(v,T){if(!v)throw new Error("missing bindings for child Pino");T=T||{},i&&v.serializers&&(T.serializers=v.serializers);let B=T.serializers;if(i&&B){var A=Object.assign({},n,B),D=t.browser.serialize===!0?Object.keys(A):i;delete v.serializers,Nd([v],D,A,this._stdErrSerialize)}function x(R){this._childLevel=(R._childLevel|0)+1,this.error=fu(R,v,"error"),this.fatal=fu(R,v,"fatal"),this.warn=fu(R,v,"warn"),this.info=fu(R,v,"info"),this.debug=fu(R,v,"debug"),this.trace=fu(R,v,"trace"),A&&(this.serializers=A,this._serialize=D),e&&(this._logEvent=LE([].concat(R._logEvent.bindings,v)))}return x.prototype=this,new x(this)}return u}bn.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"}};bn.stdSerializers=i7;bn.stdTimeFunctions=Object.assign({},{nullTime:G2,epochTime:Q2,unixTime:f7,isoTime:h7});function lu(t,e,r,n){let i=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?al:i[r]?i[r]:ol[r]||ol[n]||al,o7(t,e,r)}function o7(t,e,r){!t.transmit&&e[r]===al||(e[r]=function(n){return function(){let s=t.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===ol?ol:this;for(var u=0;u-1&&s in r&&(t[i][s]=r[s](t[i][s]))}function fu(t,e,r){return function(){let n=new Array(1+arguments.length);n[0]=e;for(var i=1;iME,__asyncDelegator:()=>C7,__asyncGenerator:()=>S7,__asyncValues:()=>T7,__await:()=>ul,__awaiter:()=>E7,__classPrivateFieldGet:()=>D7,__classPrivateFieldSet:()=>P7,__createBinding:()=>A7,__decorate:()=>y7,__exportStar:()=>b7,__extends:()=>p7,__generator:()=>v7,__importDefault:()=>O7,__importStar:()=>N7,__makeTemplateObject:()=>x7,__metadata:()=>w7,__param:()=>m7,__read:()=>z2,__rest:()=>g7,__spread:()=>_7,__spreadArrays:()=>I7,__values:()=>UE});function p7(t,e){FE(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function g7(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 m7(t,e){return function(r,n){e(r,n,t)}}function w7(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function E7(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})}function v7(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(f){return u([l,f])}}function u(l){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=l[0]&2?i.return:l[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,l[1])).done)return s;switch(i=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,i=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function z2(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 _7(){for(var t=[],e=0;e1||a(y,m)})})}function a(y,m){try{u(n[y](m))}catch(v){d(s[0][3],v)}}function u(y){y.value instanceof ul?Promise.resolve(y.value.v).then(l,f):d(s[0][2],y)}function l(y){a("next",y)}function f(y){a("throw",y)}function d(y,m){y(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:ul(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function T7(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 UE=="function"?UE(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(a,u){o=t[s](o),i(a,u,o.done,o.value)})}}function i(s,o,a,u){Promise.resolve(u).then(function(l){s({value:l,done:a})},o)}}function x7(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function N7(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 O7(t){return t&&t.__esModule?t:{default:t}}function D7(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function P7(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}var FE,ME,lr=ge(()=>{c();FE=function(t,e){return FE=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},FE(t,e)};ME=function(){return ME=Object.assign||function(e){for(var r,n=1,i=arguments.length;n{"use strict";c();Object.defineProperty(Dd,"__esModule",{value:!0});function R7(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return JSON.parse(t)}catch{return t}}Dd.safeJsonParse=R7;function B7(t){return typeof t=="string"?t:JSON.stringify(t,(e,r)=>typeof r>"u"?null:r)}Dd.safeJsonStringify=B7});var W2=w((hae,Pd)=>{"use strict";c();(function(){"use strict";let t;function e(){}t=e,t.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},t.prototype.setItem=function(r,n){this[r]=String(n)},t.prototype.removeItem=function(r){delete this[r]},t.prototype.clear=function(){let r=this;Object.keys(r).forEach(function(n){r[n]=void 0,delete r[n]})},t.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof global<"u"&&global.localStorage?Pd.exports=global.localStorage:typeof window<"u"&&window.localStorage?Pd.exports=window.localStorage:Pd.exports=new e})()});var K2=w(Rd=>{"use strict";c();Object.defineProperty(Rd,"__esModule",{value:!0});Rd.IKeyValueStorage=void 0;var VE=class{};Rd.IKeyValueStorage=VE});var $2=w(Bd=>{"use strict";c();Object.defineProperty(Bd,"__esModule",{value:!0});Bd.parseEntry=void 0;var L7=qE();function F7(t){var e;return[t[0],L7.safeJsonParse((e=t[1])!==null&&e!==void 0?e:"")]}Bd.parseEntry=F7});var J2=w(Ld=>{"use strict";c();Object.defineProperty(Ld,"__esModule",{value:!0});var Y2=(lr(),nt(cr));Y2.__exportStar(K2(),Ld);Y2.__exportStar($2(),Ld)});var Z2=w(cl=>{"use strict";c();Object.defineProperty(cl,"__esModule",{value:!0});cl.KeyValueStorage=void 0;var hu=(lr(),nt(cr)),X2=qE(),M7=hu.__importDefault(W2()),U7=J2(),Fd=class{constructor(){this.localStorage=M7.default}getKeys(){return hu.__awaiter(this,void 0,void 0,function*(){return Object.keys(this.localStorage)})}getEntries(){return hu.__awaiter(this,void 0,void 0,function*(){return Object.entries(this.localStorage).map(U7.parseEntry)})}getItem(e){return hu.__awaiter(this,void 0,void 0,function*(){let r=this.localStorage.getItem(e);if(r!==null)return X2.safeJsonParse(r)})}setItem(e,r){return hu.__awaiter(this,void 0,void 0,function*(){this.localStorage.setItem(e,X2.safeJsonStringify(r))})}removeItem(e){return hu.__awaiter(this,void 0,void 0,function*(){this.localStorage.removeItem(e)})}};cl.KeyValueStorage=Fd;cl.default=Fd});var eN=w(Md=>{"use strict";c();Object.defineProperty(Md,"__esModule",{value:!0});Md.delay=void 0;function q7(t){return new Promise(e=>{setTimeout(()=>{e(!0)},t)})}Md.delay=q7});var tN=w(du=>{"use strict";c();Object.defineProperty(du,"__esModule",{value:!0});du.ONE_THOUSAND=du.ONE_HUNDRED=void 0;du.ONE_HUNDRED=100;du.ONE_THOUSAND=1e3});var rN=w(fe=>{"use strict";c();Object.defineProperty(fe,"__esModule",{value:!0});fe.ONE_YEAR=fe.FOUR_WEEKS=fe.THREE_WEEKS=fe.TWO_WEEKS=fe.ONE_WEEK=fe.THIRTY_DAYS=fe.SEVEN_DAYS=fe.FIVE_DAYS=fe.THREE_DAYS=fe.ONE_DAY=fe.TWENTY_FOUR_HOURS=fe.TWELVE_HOURS=fe.SIX_HOURS=fe.THREE_HOURS=fe.ONE_HOUR=fe.SIXTY_MINUTES=fe.THIRTY_MINUTES=fe.TEN_MINUTES=fe.FIVE_MINUTES=fe.ONE_MINUTE=fe.SIXTY_SECONDS=fe.THIRTY_SECONDS=fe.TEN_SECONDS=fe.FIVE_SECONDS=fe.ONE_SECOND=void 0;fe.ONE_SECOND=1;fe.FIVE_SECONDS=5;fe.TEN_SECONDS=10;fe.THIRTY_SECONDS=30;fe.SIXTY_SECONDS=60;fe.ONE_MINUTE=fe.SIXTY_SECONDS;fe.FIVE_MINUTES=fe.ONE_MINUTE*5;fe.TEN_MINUTES=fe.ONE_MINUTE*10;fe.THIRTY_MINUTES=fe.ONE_MINUTE*30;fe.SIXTY_MINUTES=fe.ONE_MINUTE*60;fe.ONE_HOUR=fe.SIXTY_MINUTES;fe.THREE_HOURS=fe.ONE_HOUR*3;fe.SIX_HOURS=fe.ONE_HOUR*6;fe.TWELVE_HOURS=fe.ONE_HOUR*12;fe.TWENTY_FOUR_HOURS=fe.ONE_HOUR*24;fe.ONE_DAY=fe.TWENTY_FOUR_HOURS;fe.THREE_DAYS=fe.ONE_DAY*3;fe.FIVE_DAYS=fe.ONE_DAY*5;fe.SEVEN_DAYS=fe.ONE_DAY*7;fe.THIRTY_DAYS=fe.ONE_DAY*30;fe.ONE_WEEK=fe.SEVEN_DAYS;fe.TWO_WEEKS=fe.ONE_WEEK*2;fe.THREE_WEEKS=fe.ONE_WEEK*3;fe.FOUR_WEEKS=fe.ONE_WEEK*4;fe.ONE_YEAR=fe.ONE_DAY*365});var jE=w(Ud=>{"use strict";c();Object.defineProperty(Ud,"__esModule",{value:!0});var nN=(lr(),nt(cr));nN.__exportStar(tN(),Ud);nN.__exportStar(rN(),Ud)});var sN=w(pu=>{"use strict";c();Object.defineProperty(pu,"__esModule",{value:!0});pu.fromMiliseconds=pu.toMiliseconds=void 0;var iN=jE();function V7(t){return t*iN.ONE_THOUSAND}pu.toMiliseconds=V7;function j7(t){return Math.floor(t/iN.ONE_THOUSAND)}pu.fromMiliseconds=j7});var aN=w(qd=>{"use strict";c();Object.defineProperty(qd,"__esModule",{value:!0});var oN=(lr(),nt(cr));oN.__exportStar(eN(),qd);oN.__exportStar(sN(),qd)});var uN=w(ll=>{"use strict";c();Object.defineProperty(ll,"__esModule",{value:!0});ll.Watch=void 0;var Vd=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}};ll.Watch=Vd;ll.default=Vd});var cN=w(jd=>{"use strict";c();Object.defineProperty(jd,"__esModule",{value:!0});jd.IWatch=void 0;var HE=class{};jd.IWatch=HE});var lN=w(GE=>{"use strict";c();Object.defineProperty(GE,"__esModule",{value:!0});var H7=(lr(),nt(cr));H7.__exportStar(cN(),GE)});var co=w(gu=>{"use strict";c();Object.defineProperty(gu,"__esModule",{value:!0});var Hd=(lr(),nt(cr));Hd.__exportStar(aN(),gu);Hd.__exportStar(uN(),gu);Hd.__exportStar(lN(),gu);Hd.__exportStar(jE(),gu)});var QE,fN=ge(()=>{c();QE=class{}});var kE={};at(kE,{IEvents:()=>QE});var zE=ge(()=>{c();fN()});var hN=w(Gd=>{"use strict";c();Object.defineProperty(Gd,"__esModule",{value:!0});Gd.IHeartBeat=void 0;var G7=(zE(),nt(kE)),WE=class extends G7.IEvents{constructor(e){super()}};Gd.IHeartBeat=WE});var $E=w(KE=>{"use strict";c();Object.defineProperty(KE,"__esModule",{value:!0});var Q7=(lr(),nt(cr));Q7.__exportStar(hN(),KE)});var dN=w(yu=>{"use strict";c();Object.defineProperty(yu,"__esModule",{value:!0});yu.HEARTBEAT_EVENTS=yu.HEARTBEAT_INTERVAL=void 0;var k7=co();yu.HEARTBEAT_INTERVAL=k7.FIVE_SECONDS;yu.HEARTBEAT_EVENTS={pulse:"heartbeat_pulse"}});var JE=w(YE=>{"use strict";c();Object.defineProperty(YE,"__esModule",{value:!0});var z7=(lr(),nt(cr));z7.__exportStar(dN(),YE)});var pN=w(Qd=>{"use strict";c();Object.defineProperty(Qd,"__esModule",{value:!0});Qd.HeartBeat=void 0;var XE=(lr(),nt(cr)),W7=Wn(),K7=co(),$7=$E(),ZE=JE(),fl=class extends $7.IHeartBeat{constructor(e){super(e),this.events=new W7.EventEmitter,this.interval=ZE.HEARTBEAT_INTERVAL,this.interval=e?.interval||ZE.HEARTBEAT_INTERVAL}static init(e){return XE.__awaiter(this,void 0,void 0,function*(){let r=new fl(e);return yield r.init(),r})}init(){return XE.__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 XE.__awaiter(this,void 0,void 0,function*(){this.intervalRef=setInterval(()=>this.pulse(),K7.toMiliseconds(this.interval))})}pulse(){this.events.emit(ZE.HEARTBEAT_EVENTS.pulse)}};Qd.HeartBeat=fl});var gN=w(hl=>{"use strict";c();Object.defineProperty(hl,"__esModule",{value:!0});var e1=(lr(),nt(cr));e1.__exportStar(pN(),hl);e1.__exportStar($E(),hl);e1.__exportStar(JE(),hl)});var t1=w(mu=>{"use strict";c();Object.defineProperty(mu,"__esModule",{value:!0});mu.PINO_CUSTOM_CONTEXT_KEY=mu.PINO_LOGGER_DEFAULTS=void 0;mu.PINO_LOGGER_DEFAULTS={level:"info"};mu.PINO_CUSTOM_CONTEXT_KEY="custom_context"});var vN=w(sr=>{"use strict";c();Object.defineProperty(sr,"__esModule",{value:!0});sr.generateChildLogger=sr.formatChildLoggerContext=sr.getLoggerContext=sr.setBrowserLoggerContext=sr.getBrowserLoggerContext=sr.getDefaultLoggerOptions=void 0;var wu=t1();function Y7(t){return Object.assign(Object.assign({},t),{level:t?.level||wu.PINO_LOGGER_DEFAULTS.level})}sr.getDefaultLoggerOptions=Y7;function yN(t,e=wu.PINO_CUSTOM_CONTEXT_KEY){return t[e]||""}sr.getBrowserLoggerContext=yN;function mN(t,e,r=wu.PINO_CUSTOM_CONTEXT_KEY){return t[r]=e,t}sr.setBrowserLoggerContext=mN;function wN(t,e=wu.PINO_CUSTOM_CONTEXT_KEY){let r="";return typeof t.bindings>"u"?r=yN(t,e):r=t.bindings().context||"",r}sr.getLoggerContext=wN;function EN(t,e,r=wu.PINO_CUSTOM_CONTEXT_KEY){let n=wN(t,r);return n.trim()?`${n}/${e}`:e}sr.formatChildLoggerContext=EN;function J7(t,e,r=wu.PINO_CUSTOM_CONTEXT_KEY){let n=EN(t,e,r),i=t.child({context:n});return mN(i,n,r)}sr.generateChildLogger=J7});var n1=w(Eu=>{"use strict";c();Object.defineProperty(Eu,"__esModule",{value:!0});Eu.pino=void 0;var r1=(lr(),nt(cr)),X7=r1.__importDefault(Od());Object.defineProperty(Eu,"pino",{enumerable:!0,get:function(){return X7.default}});r1.__exportStar(t1(),Eu);r1.__exportStar(vN(),Eu)});var v1=w(Ot=>{"use strict";c();Object.defineProperty(Ot,"__esModule",{value:!0});var vu=(zE(),nt(kE)),AN=Wn();function Z7(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var eG=Z7(AN),i1=class extends vu.IEvents{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},s1=class{constructor(e,r,n){this.core=e,this.logger=r}},o1=class extends vu.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}},u1=class extends vu.IEvents{constructor(e,r){super(),this.relayer=e,this.logger=r}},c1=class extends vu.IEvents{constructor(e){super()}},l1=class{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}},f1=class{constructor(){this.map=new Map}},h1=class extends vu.IEvents{constructor(e,r){super(),this.relayer=e,this.logger=r}},d1=class{constructor(e,r){this.core=e,this.logger=r}},p1=class extends vu.IEvents{constructor(e,r){super(),this.core=e,this.logger=r}},g1=class{constructor(e,r){this.logger=e,this.core=r}},y1=class extends eG.default{constructor(){super()}},m1=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},w1=class extends AN.EventEmitter{constructor(){super()}},E1=class{constructor(e){this.client=e}};Ot.ICore=i1,Ot.ICrypto=s1,Ot.IEngine=E1,Ot.IEngineEvents=w1,Ot.IExpirer=p1,Ot.IJsonRpcHistory=o1,Ot.IKeyChain=d1,Ot.IMessageTracker=a1,Ot.IPairing=g1,Ot.IPublisher=u1,Ot.IRelayer=c1,Ot.ISignClient=m1,Ot.ISignClientEvents=y1,Ot.IStore=l1,Ot.ISubscriber=h1,Ot.ISubscriberTopicMap=f1});var bN={};at(bN,{safeJsonParse:()=>dl,safeJsonStringify:()=>pl});function dl(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return rG(t)}catch{return t}}function pl(t){return typeof t=="string"?t:tG(t)||""}var tG,rG,kd=ge(()=>{c();tG=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),rG=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 IN=w(zd=>{"use strict";c();Object.defineProperty(zd,"__esModule",{value:!0});zd.BrowserRandomSource=void 0;var _N=65536,A1=class{constructor(){this.isAvailable=!1,this.isInstantiated=!1;let e=typeof self<"u"?self.crypto||self.msCrypto:null;e&&e.getRandomValues!==void 0&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");let r=new Uint8Array(e);for(let n=0;n{"use strict";c();Object.defineProperty(b1,"__esModule",{value:!0});function nG(t){for(var e=0;e{c()});var CN=w(Wd=>{"use strict";c();Object.defineProperty(Wd,"__esModule",{value:!0});Wd.NodeRandomSource=void 0;var iG=Or(),_1=class{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof B_<"u"){let e=SN();e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let r=this._crypto.randomBytes(e);if(r.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");let n=new Uint8Array(e);for(let i=0;i{"use strict";c();Object.defineProperty(Kd,"__esModule",{value:!0});Kd.SystemRandomSource=void 0;var sG=IN(),oG=CN(),I1=class{constructor(){if(this.isAvailable=!1,this.name="",this._source=new sG.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new oG.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)}};Kd.SystemRandomSource=I1});var xN=w(fr=>{"use strict";c();Object.defineProperty(fr,"__esModule",{value:!0});function aG(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}fr.mul=Math.imul||aG;function uG(t,e){return t+e|0}fr.add=uG;function cG(t,e){return t-e|0}fr.sub=cG;function lG(t,e){return t<>>32-e}fr.rotl=lG;function fG(t,e){return t<<32-e|t>>>e}fr.rotr=fG;function hG(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t}fr.isInteger=Number.isInteger||hG;fr.MAX_SAFE_INTEGER=9007199254740991;fr.isSafeInteger=function(t){return fr.isInteger(t)&&t>=-fr.MAX_SAFE_INTEGER&&t<=fr.MAX_SAFE_INTEGER}});var Au=w(Ne=>{"use strict";c();Object.defineProperty(Ne,"__esModule",{value:!0});var NN=xN();function dG(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}Ne.readInt16BE=dG;function pG(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}Ne.readUint16BE=pG;function gG(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}Ne.readInt16LE=gG;function yG(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}Ne.readUint16LE=yG;function ON(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}Ne.writeUint16BE=ON;Ne.writeInt16BE=ON;function DN(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}Ne.writeUint16LE=DN;Ne.writeInt16LE=DN;function S1(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}Ne.readInt32BE=S1;function C1(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}Ne.readUint32BE=C1;function T1(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}Ne.readInt32LE=T1;function x1(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}Ne.readUint32LE=x1;function $d(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}Ne.writeUint32BE=$d;Ne.writeInt32BE=$d;function Yd(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}Ne.writeUint32LE=Yd;Ne.writeInt32LE=Yd;function mG(t,e){e===void 0&&(e=0);var r=S1(t,e),n=S1(t,e+4);return r*4294967296+n-(n>>31)*4294967296}Ne.readInt64BE=mG;function wG(t,e){e===void 0&&(e=0);var r=C1(t,e),n=C1(t,e+4);return r*4294967296+n}Ne.readUint64BE=wG;function EG(t,e){e===void 0&&(e=0);var r=T1(t,e),n=T1(t,e+4);return n*4294967296+r-(r>>31)*4294967296}Ne.readInt64LE=EG;function vG(t,e){e===void 0&&(e=0);var r=x1(t,e),n=x1(t,e+4);return n*4294967296+r}Ne.readUint64LE=vG;function PN(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),$d(t/4294967296>>>0,e,r),$d(t>>>0,e,r+4),e}Ne.writeUint64BE=PN;Ne.writeInt64BE=PN;function RN(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),Yd(t>>>0,e,r),Yd(t/4294967296>>>0,e,r+4),e}Ne.writeUint64LE=RN;Ne.writeInt64LE=RN;function AG(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,s=t/8+r-1;s>=r;s--)n+=e[s]*i,i*=256;return n}Ne.readUintBE=AG;function bG(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,s=r;s=n;s--)r[s]=e/i&255,i*=256;return r}Ne.writeUintBE=_G;function IG(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(!NN.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,s=n;s{"use strict";c();Object.defineProperty(zt,"__esModule",{value:!0});zt.randomStringForEntropy=zt.randomString=zt.randomUint32=zt.randomBytes=zt.defaultRandomSource=void 0;var RG=TN(),BG=Au(),BN=Or();zt.defaultRandomSource=new RG.SystemRandomSource;function N1(t,e=zt.defaultRandomSource){return e.randomBytes(t)}zt.randomBytes=N1;function LG(t=zt.defaultRandomSource){let e=N1(4,t),r=(0,BG.readUint32LE)(e);return(0,BN.wipe)(e),r}zt.randomUint32=LG;var LN="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function FN(t,e=LN,r=zt.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=N1(Math.ceil(t*256/s),r);for(let a=0;a0;a++){let u=o[a];u{"use strict";c();Object.defineProperty($n,"__esModule",{value:!0});var _u=Au(),bu=Or();$n.DIGEST_LENGTH=64;$n.BLOCK_SIZE=128;var UN=function(){function t(){this.digestLength=$n.DIGEST_LENGTH,this.blockSize=$n.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(){bu.wipe(this._buffer),bu.wipe(this._tempHi),bu.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._bufferLength<$n.BLOCK_SIZE&&r>0;)this._buffer[this._bufferLength++]=e[n++],r--;this._bufferLength===this.blockSize&&(O1(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(n=O1(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){bu.wipe(e.stateHi),bu.wipe(e.stateLo),e.buffer&&bu.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},t}();$n.SHA512=UN;var MN=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 O1(t,e,r,n,i,s,o){for(var a=r[0],u=r[1],l=r[2],f=r[3],d=r[4],y=r[5],m=r[6],v=r[7],T=n[0],B=n[1],A=n[2],D=n[3],x=n[4],R=n[5],P=n[6],L=n[7],_,C,M,Z,z,H,G,$;o>=128;){for(var de=0;de<16;de++){var ae=8*de+s;t[de]=_u.readUint32BE(i,ae),e[de]=_u.readUint32BE(i,ae+4)}for(var de=0;de<80;de++){var re=a,Y=u,ie=l,te=f,ne=d,q=y,ce=m,oe=v,le=T,se=B,ue=A,g=D,E=x,b=R,O=P,I=L;if(_=v,C=L,z=C&65535,H=C>>>16,G=_&65535,$=_>>>16,_=(d>>>14|x<<32-14)^(d>>>18|x<<32-18)^(x>>>41-32|d<<32-(41-32)),C=(x>>>14|d<<32-14)^(x>>>18|d<<32-18)^(d>>>41-32|x<<32-(41-32)),z+=C&65535,H+=C>>>16,G+=_&65535,$+=_>>>16,_=d&y^~d&m,C=x&R^~x&P,z+=C&65535,H+=C>>>16,G+=_&65535,$+=_>>>16,_=MN[de*2],C=MN[de*2+1],z+=C&65535,H+=C>>>16,G+=_&65535,$+=_>>>16,_=t[de%16],C=e[de%16],z+=C&65535,H+=C>>>16,G+=_&65535,$+=_>>>16,H+=z>>>16,G+=H>>>16,$+=G>>>16,M=G&65535|$<<16,Z=z&65535|H<<16,_=M,C=Z,z=C&65535,H=C>>>16,G=_&65535,$=_>>>16,_=(a>>>28|T<<32-28)^(T>>>34-32|a<<32-(34-32))^(T>>>39-32|a<<32-(39-32)),C=(T>>>28|a<<32-28)^(a>>>34-32|T<<32-(34-32))^(a>>>39-32|T<<32-(39-32)),z+=C&65535,H+=C>>>16,G+=_&65535,$+=_>>>16,_=a&u^a&l^u&l,C=T&B^T&A^B&A,z+=C&65535,H+=C>>>16,G+=_&65535,$+=_>>>16,H+=z>>>16,G+=H>>>16,$+=G>>>16,oe=G&65535|$<<16,I=z&65535|H<<16,_=te,C=g,z=C&65535,H=C>>>16,G=_&65535,$=_>>>16,_=M,C=Z,z+=C&65535,H+=C>>>16,G+=_&65535,$+=_>>>16,H+=z>>>16,G+=H>>>16,$+=G>>>16,te=G&65535|$<<16,g=z&65535|H<<16,u=re,l=Y,f=ie,d=te,y=ne,m=q,v=ce,a=oe,B=le,A=se,D=ue,x=g,R=E,P=b,L=O,T=I,de%16===15)for(var ae=0;ae<16;ae++)_=t[ae],C=e[ae],z=C&65535,H=C>>>16,G=_&65535,$=_>>>16,_=t[(ae+9)%16],C=e[(ae+9)%16],z+=C&65535,H+=C>>>16,G+=_&65535,$+=_>>>16,M=t[(ae+1)%16],Z=e[(ae+1)%16],_=(M>>>1|Z<<32-1)^(M>>>8|Z<<32-8)^M>>>7,C=(Z>>>1|M<<32-1)^(Z>>>8|M<<32-8)^(Z>>>7|M<<32-7),z+=C&65535,H+=C>>>16,G+=_&65535,$+=_>>>16,M=t[(ae+14)%16],Z=e[(ae+14)%16],_=(M>>>19|Z<<32-19)^(Z>>>61-32|M<<32-(61-32))^M>>>6,C=(Z>>>19|M<<32-19)^(M>>>61-32|Z<<32-(61-32))^(Z>>>6|M<<32-6),z+=C&65535,H+=C>>>16,G+=_&65535,$+=_>>>16,H+=z>>>16,G+=H>>>16,$+=G>>>16,t[ae]=G&65535|$<<16,e[ae]=z&65535|H<<16}_=a,C=T,z=C&65535,H=C>>>16,G=_&65535,$=_>>>16,_=r[0],C=n[0],z+=C&65535,H+=C>>>16,G+=_&65535,$+=_>>>16,H+=z>>>16,G+=H>>>16,$+=G>>>16,r[0]=a=G&65535|$<<16,n[0]=T=z&65535|H<<16,_=u,C=B,z=C&65535,H=C>>>16,G=_&65535,$=_>>>16,_=r[1],C=n[1],z+=C&65535,H+=C>>>16,G+=_&65535,$+=_>>>16,H+=z>>>16,G+=H>>>16,$+=G>>>16,r[1]=u=G&65535|$<<16,n[1]=B=z&65535|H<<16,_=l,C=A,z=C&65535,H=C>>>16,G=_&65535,$=_>>>16,_=r[2],C=n[2],z+=C&65535,H+=C>>>16,G+=_&65535,$+=_>>>16,H+=z>>>16,G+=H>>>16,$+=G>>>16,r[2]=l=G&65535|$<<16,n[2]=A=z&65535|H<<16,_=f,C=D,z=C&65535,H=C>>>16,G=_&65535,$=_>>>16,_=r[3],C=n[3],z+=C&65535,H+=C>>>16,G+=_&65535,$+=_>>>16,H+=z>>>16,G+=H>>>16,$+=G>>>16,r[3]=f=G&65535|$<<16,n[3]=D=z&65535|H<<16,_=d,C=x,z=C&65535,H=C>>>16,G=_&65535,$=_>>>16,_=r[4],C=n[4],z+=C&65535,H+=C>>>16,G+=_&65535,$+=_>>>16,H+=z>>>16,G+=H>>>16,$+=G>>>16,r[4]=d=G&65535|$<<16,n[4]=x=z&65535|H<<16,_=y,C=R,z=C&65535,H=C>>>16,G=_&65535,$=_>>>16,_=r[5],C=n[5],z+=C&65535,H+=C>>>16,G+=_&65535,$+=_>>>16,H+=z>>>16,G+=H>>>16,$+=G>>>16,r[5]=y=G&65535|$<<16,n[5]=R=z&65535|H<<16,_=m,C=P,z=C&65535,H=C>>>16,G=_&65535,$=_>>>16,_=r[6],C=n[6],z+=C&65535,H+=C>>>16,G+=_&65535,$+=_>>>16,H+=z>>>16,G+=H>>>16,$+=G>>>16,r[6]=m=G&65535|$<<16,n[6]=P=z&65535|H<<16,_=v,C=L,z=C&65535,H=C>>>16,G=_&65535,$=_>>>16,_=r[7],C=n[7],z+=C&65535,H+=C>>>16,G+=_&65535,$+=_>>>16,H+=z>>>16,G+=H>>>16,$+=G>>>16,r[7]=v=G&65535|$<<16,n[7]=L=z&65535|H<<16,s+=128,o-=128}return s}function MG(t){var e=new UN;e.update(t);var r=e.digest();return e.clean(),r}$n.hash=MG});var ZN=w(qe=>{"use strict";c();Object.defineProperty(qe,"__esModule",{value:!0});qe.convertSecretKeyToX25519=qe.convertPublicKeyToX25519=qe.verify=qe.sign=qe.extractPublicKeyFromSecretKey=qe.generateKeyPair=qe.generateKeyPairFromSeed=qe.SEED_LENGTH=qe.SECRET_KEY_LENGTH=qe.PUBLIC_KEY_LENGTH=qe.SIGNATURE_LENGTH=void 0;var UG=gl(),yl=qN(),QN=Or();qe.SIGNATURE_LENGTH=64;qe.PUBLIC_KEY_LENGTH=32;qe.SECRET_KEY_LENGTH=64;qe.SEED_LENGTH=32;function Ee(t){let e=new Float64Array(16);if(t)for(let r=0;r>16&1),r[o-1]&=65535;r[15]=n[15]-32767-(r[14]>>16&1);let s=r[15]>>16&1;r[14]&=65535,kN(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 zN(t,e){let r=0;for(let n=0;n<32;n++)r|=t[n]^e[n];return(1&r-1>>>8)-1}function HN(t,e){let r=new Uint8Array(32),n=new Uint8Array(32);return ml(r,t),ml(n,e),zN(r,n)}function WN(t){let e=new Uint8Array(32);return ml(e,t),e[0]&1}function GG(t,e){for(let r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function lo(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]+r[n]}function ho(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]-r[n]}function Ge(t,e,r){let n,i,s=0,o=0,a=0,u=0,l=0,f=0,d=0,y=0,m=0,v=0,T=0,B=0,A=0,D=0,x=0,R=0,P=0,L=0,_=0,C=0,M=0,Z=0,z=0,H=0,G=0,$=0,de=0,ae=0,re=0,Y=0,ie=0,te=r[0],ne=r[1],q=r[2],ce=r[3],oe=r[4],le=r[5],se=r[6],ue=r[7],g=r[8],E=r[9],b=r[10],O=r[11],I=r[12],N=r[13],F=r[14],S=r[15];n=e[0],s+=n*te,o+=n*ne,a+=n*q,u+=n*ce,l+=n*oe,f+=n*le,d+=n*se,y+=n*ue,m+=n*g,v+=n*E,T+=n*b,B+=n*O,A+=n*I,D+=n*N,x+=n*F,R+=n*S,n=e[1],o+=n*te,a+=n*ne,u+=n*q,l+=n*ce,f+=n*oe,d+=n*le,y+=n*se,m+=n*ue,v+=n*g,T+=n*E,B+=n*b,A+=n*O,D+=n*I,x+=n*N,R+=n*F,P+=n*S,n=e[2],a+=n*te,u+=n*ne,l+=n*q,f+=n*ce,d+=n*oe,y+=n*le,m+=n*se,v+=n*ue,T+=n*g,B+=n*E,A+=n*b,D+=n*O,x+=n*I,R+=n*N,P+=n*F,L+=n*S,n=e[3],u+=n*te,l+=n*ne,f+=n*q,d+=n*ce,y+=n*oe,m+=n*le,v+=n*se,T+=n*ue,B+=n*g,A+=n*E,D+=n*b,x+=n*O,R+=n*I,P+=n*N,L+=n*F,_+=n*S,n=e[4],l+=n*te,f+=n*ne,d+=n*q,y+=n*ce,m+=n*oe,v+=n*le,T+=n*se,B+=n*ue,A+=n*g,D+=n*E,x+=n*b,R+=n*O,P+=n*I,L+=n*N,_+=n*F,C+=n*S,n=e[5],f+=n*te,d+=n*ne,y+=n*q,m+=n*ce,v+=n*oe,T+=n*le,B+=n*se,A+=n*ue,D+=n*g,x+=n*E,R+=n*b,P+=n*O,L+=n*I,_+=n*N,C+=n*F,M+=n*S,n=e[6],d+=n*te,y+=n*ne,m+=n*q,v+=n*ce,T+=n*oe,B+=n*le,A+=n*se,D+=n*ue,x+=n*g,R+=n*E,P+=n*b,L+=n*O,_+=n*I,C+=n*N,M+=n*F,Z+=n*S,n=e[7],y+=n*te,m+=n*ne,v+=n*q,T+=n*ce,B+=n*oe,A+=n*le,D+=n*se,x+=n*ue,R+=n*g,P+=n*E,L+=n*b,_+=n*O,C+=n*I,M+=n*N,Z+=n*F,z+=n*S,n=e[8],m+=n*te,v+=n*ne,T+=n*q,B+=n*ce,A+=n*oe,D+=n*le,x+=n*se,R+=n*ue,P+=n*g,L+=n*E,_+=n*b,C+=n*O,M+=n*I,Z+=n*N,z+=n*F,H+=n*S,n=e[9],v+=n*te,T+=n*ne,B+=n*q,A+=n*ce,D+=n*oe,x+=n*le,R+=n*se,P+=n*ue,L+=n*g,_+=n*E,C+=n*b,M+=n*O,Z+=n*I,z+=n*N,H+=n*F,G+=n*S,n=e[10],T+=n*te,B+=n*ne,A+=n*q,D+=n*ce,x+=n*oe,R+=n*le,P+=n*se,L+=n*ue,_+=n*g,C+=n*E,M+=n*b,Z+=n*O,z+=n*I,H+=n*N,G+=n*F,$+=n*S,n=e[11],B+=n*te,A+=n*ne,D+=n*q,x+=n*ce,R+=n*oe,P+=n*le,L+=n*se,_+=n*ue,C+=n*g,M+=n*E,Z+=n*b,z+=n*O,H+=n*I,G+=n*N,$+=n*F,de+=n*S,n=e[12],A+=n*te,D+=n*ne,x+=n*q,R+=n*ce,P+=n*oe,L+=n*le,_+=n*se,C+=n*ue,M+=n*g,Z+=n*E,z+=n*b,H+=n*O,G+=n*I,$+=n*N,de+=n*F,ae+=n*S,n=e[13],D+=n*te,x+=n*ne,R+=n*q,P+=n*ce,L+=n*oe,_+=n*le,C+=n*se,M+=n*ue,Z+=n*g,z+=n*E,H+=n*b,G+=n*O,$+=n*I,de+=n*N,ae+=n*F,re+=n*S,n=e[14],x+=n*te,R+=n*ne,P+=n*q,L+=n*ce,_+=n*oe,C+=n*le,M+=n*se,Z+=n*ue,z+=n*g,H+=n*E,G+=n*b,$+=n*O,de+=n*I,ae+=n*N,re+=n*F,Y+=n*S,n=e[15],R+=n*te,P+=n*ne,L+=n*q,_+=n*ce,C+=n*oe,M+=n*le,Z+=n*se,z+=n*ue,H+=n*g,G+=n*E,$+=n*b,de+=n*O,ae+=n*I,re+=n*N,Y+=n*F,ie+=n*S,s+=38*P,o+=38*L,a+=38*_,u+=38*C,l+=38*M,f+=38*Z,d+=38*z,y+=38*H,m+=38*G,v+=38*$,T+=38*de,B+=38*ae,A+=38*re,D+=38*Y,x+=38*ie,i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=l+i+65535,i=Math.floor(n/65536),l=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=m+i+65535,i=Math.floor(n/65536),m=n-i*65536,n=v+i+65535,i=Math.floor(n/65536),v=n-i*65536,n=T+i+65535,i=Math.floor(n/65536),T=n-i*65536,n=B+i+65535,i=Math.floor(n/65536),B=n-i*65536,n=A+i+65535,i=Math.floor(n/65536),A=n-i*65536,n=D+i+65535,i=Math.floor(n/65536),D=n-i*65536,n=x+i+65535,i=Math.floor(n/65536),x=n-i*65536,n=R+i+65535,i=Math.floor(n/65536),R=n-i*65536,s+=i-1+37*(i-1),i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=l+i+65535,i=Math.floor(n/65536),l=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=m+i+65535,i=Math.floor(n/65536),m=n-i*65536,n=v+i+65535,i=Math.floor(n/65536),v=n-i*65536,n=T+i+65535,i=Math.floor(n/65536),T=n-i*65536,n=B+i+65535,i=Math.floor(n/65536),B=n-i*65536,n=A+i+65535,i=Math.floor(n/65536),A=n-i*65536,n=D+i+65535,i=Math.floor(n/65536),D=n-i*65536,n=x+i+65535,i=Math.floor(n/65536),x=n-i*65536,n=R+i+65535,i=Math.floor(n/65536),R=n-i*65536,s+=i-1+37*(i-1),t[0]=s,t[1]=o,t[2]=a,t[3]=u,t[4]=l,t[5]=f,t[6]=d,t[7]=y,t[8]=m,t[9]=v,t[10]=T,t[11]=B,t[12]=A,t[13]=D,t[14]=x,t[15]=R}function fo(t,e){Ge(t,e,e)}function KN(t,e){let r=Ee(),n;for(n=0;n<16;n++)r[n]=e[n];for(n=253;n>=0;n--)fo(r,r),n!==2&&n!==4&&Ge(r,r,e);for(n=0;n<16;n++)t[n]=r[n]}function QG(t,e){let r=Ee(),n;for(n=0;n<16;n++)r[n]=e[n];for(n=250;n>=0;n--)fo(r,r),n!==1&&Ge(r,r,e);for(n=0;n<16;n++)t[n]=r[n]}function B1(t,e){let r=Ee(),n=Ee(),i=Ee(),s=Ee(),o=Ee(),a=Ee(),u=Ee(),l=Ee(),f=Ee();ho(r,t[1],t[0]),ho(f,e[1],e[0]),Ge(r,r,f),lo(n,t[0],t[1]),lo(f,e[0],e[1]),Ge(n,n,f),Ge(i,t[3],e[3]),Ge(i,i,jG),Ge(s,t[2],e[2]),lo(s,s,s),ho(o,n,r),ho(a,s,i),lo(u,s,i),lo(l,n,r),Ge(t[0],o,a),Ge(t[1],l,u),Ge(t[2],u,a),Ge(t[3],o,l)}function GN(t,e,r){for(let n=0;n<4;n++)kN(t[n],e[n],r)}function F1(t,e){let r=Ee(),n=Ee(),i=Ee();KN(i,e[2]),Ge(r,e[0],i),Ge(n,e[1],i),ml(t,n),t[31]^=WN(r)<<7}function $N(t,e,r){Ui(t[0],R1),Ui(t[1],Iu),Ui(t[2],Iu),Ui(t[3],R1);for(let n=255;n>=0;--n){let i=r[n/8|0]>>(n&7)&1;GN(t,e,i),B1(e,t),B1(t,t),GN(t,e,i)}}function M1(t,e){let r=[Ee(),Ee(),Ee(),Ee()];Ui(r[0],VN),Ui(r[1],jN),Ui(r[2],Iu),Ge(r[3],VN,jN),$N(t,r,e)}function YN(t){if(t.length!==qe.SEED_LENGTH)throw new Error(`ed25519: seed must be ${qe.SEED_LENGTH} bytes`);let e=(0,yl.hash)(t);e[0]&=248,e[31]&=127,e[31]|=64;let r=new Uint8Array(32),n=[Ee(),Ee(),Ee(),Ee()];M1(n,e),F1(r,n);let i=new Uint8Array(64);return i.set(t),i.set(r,32),{publicKey:r,secretKey:i}}qe.generateKeyPairFromSeed=YN;function kG(t){let e=(0,UG.randomBytes)(32,t),r=YN(e);return(0,QN.wipe)(e),r}qe.generateKeyPair=kG;function zG(t){if(t.length!==qe.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${qe.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(t.subarray(32))}qe.extractPublicKeyFromSecretKey=zG;var P1=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 JN(t,e){let r,n,i,s;for(n=63;n>=32;--n){for(r=0,i=n-32,s=n-12;i>4)*P1[i],r=e[i]>>8,e[i]&=255;for(i=0;i<32;i++)e[i]-=r*P1[i];for(n=0;n<32;n++)e[n+1]+=e[n]>>8,t[n]=e[n]&255}function L1(t){let e=new Float64Array(64);for(let r=0;r<64;r++)e[r]=t[r];for(let r=0;r<64;r++)t[r]=0;JN(t,e)}function WG(t,e){let r=new Float64Array(64),n=[Ee(),Ee(),Ee(),Ee()],i=(0,yl.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 yl.SHA512;o.update(s.subarray(32)),o.update(e);let a=o.digest();o.clean(),L1(a),M1(n,a),F1(s,n),o.reset(),o.update(s.subarray(0,32)),o.update(t.subarray(32)),o.update(e);let u=o.digest();L1(u);for(let l=0;l<32;l++)r[l]=a[l];for(let l=0;l<32;l++)for(let f=0;f<32;f++)r[l+f]+=u[l]*i[f];return JN(s.subarray(32),r),s}qe.sign=WG;function XN(t,e){let r=Ee(),n=Ee(),i=Ee(),s=Ee(),o=Ee(),a=Ee(),u=Ee();return Ui(t[2],Iu),GG(t[1],e),fo(i,t[1]),Ge(s,i,VG),ho(i,i,t[2]),lo(s,t[2],s),fo(o,s),fo(a,o),Ge(u,a,o),Ge(r,u,i),Ge(r,r,s),QG(r,r),Ge(r,r,i),Ge(r,r,s),Ge(r,r,s),Ge(t[0],r,s),fo(n,t[0]),Ge(n,n,s),HN(n,i)&&Ge(t[0],t[0],HG),fo(n,t[0]),Ge(n,n,s),HN(n,i)?-1:(WN(t[0])===e[31]>>7&&ho(t[0],R1,t[0]),Ge(t[3],t[0],t[1]),0)}function KG(t,e,r){let n=new Uint8Array(32),i=[Ee(),Ee(),Ee(),Ee()],s=[Ee(),Ee(),Ee(),Ee()];if(r.length!==qe.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${qe.SIGNATURE_LENGTH} bytes`);if(XN(s,t))return!1;let o=new yl.SHA512;o.update(r.subarray(0,32)),o.update(t),o.update(e);let a=o.digest();return L1(a),$N(i,s,a),M1(s,r.subarray(32)),B1(i,s),F1(n,i),!zN(r,n)}qe.verify=KG;function $G(t){let e=[Ee(),Ee(),Ee(),Ee()];if(XN(e,t))throw new Error("Ed25519: invalid public key");let r=Ee(),n=Ee(),i=e[1];lo(r,Iu,i),ho(n,Iu,i),KN(n,n),Ge(r,r,n);let s=new Uint8Array(32);return ml(s,r),s}qe.convertPublicKeyToX25519=$G;function YG(t){let e=(0,yl.hash)(t.subarray(0,32));e[0]&=248,e[31]&=127,e[31]|=64;let r=new Uint8Array(e.subarray(0,32));return(0,QN.wipe)(e),r}qe.convertSecretKeyToX25519=YG});var Jd,Xd,po,Su,Zd,wl,ep,tp,rp,Cu,np,ip,eO,tO,sp=ge(()=>{c();Jd="EdDSA",Xd="JWT",po=".",Su="base64url",Zd="utf8",wl="utf8",ep=":",tp="did",rp="key",Cu="base58btc",np="z",ip="K36",eO=32,tO=32});function qi(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}var El=ge(()=>{c()});function Tu(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?qi(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}var op=ge(()=>{c();El()});function ap(t,e){e||(e=t.reduce((i,s)=>i+s.length,0));let r=Tu(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return qi(r)}var U1=ge(()=>{c();op();El()});function JG(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,R=new Uint8Array(x);A!==D;){for(var P=v[A],L=0,_=x-1;(P!==0||L>>0,R[_]=P%a>>>0,P=P/a>>>0;if(P!==0)throw new Error("Non-zero carry");B=L,A++}for(var C=x-B;C!==x&&R[C]===0;)C++;for(var M=u.repeat(T);C>>0,x=new Uint8Array(D);v[T];){var R=r[v.charCodeAt(T)];if(R===255)return;for(var P=0,L=D-1;(R!==0||P>>0,x[L]=R%256>>>0,R=R/256>>>0;if(R!==0)throw new Error("Non-zero carry");A=P,T++}if(v[T]!==" "){for(var _=D-A;_!==D&&x[_]===0;)_++;for(var C=new Uint8Array(B+(D-_)),M=B;_!==D;)C[M++]=x[_++];return C}}}function m(v){var T=y(v);if(T)return T;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:y,decode:m}}var XG,ZG,rO,nO=ge(()=>{c();XG=JG,ZG=XG,rO=ZG});var Kue,iO,Yn,sO,oO,Vi=ge(()=>{c();Kue=new Uint8Array(0),iO=(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")},sO=t=>new TextEncoder().encode(t),oO=t=>new TextDecoder().decode(t)});var q1,V1,j1,uO,H1,xu,ji,e9,t9,ct,Hr=ge(()=>{c();nO();Vi();q1=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")}},V1=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 uO(this,e)}},j1=class{constructor(e){this.decoders=e}or(e){return uO(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`)}},uO=(t,e)=>new j1({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),H1=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new q1(e,r,n),this.decoder=new V1(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},xu=({name:t,prefix:e,encode:r,decode:n})=>new H1(t,e,r,n),ji=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=rO(r,e);return xu({prefix:t,name:e,encode:n,decode:s=>Yn(i(s))})},e9=(t,e,r,n)=>{let i={};for(let f=0;f=8&&(a-=8,o[l++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},t9=(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<xu({prefix:e,name:t,encode(i){return t9(i,n,r)},decode(i){return e9(i,n,r,t)}})});var G1={};at(G1,{identity:()=>r9});var r9,cO=ge(()=>{c();Hr();Vi();r9=xu({prefix:"\0",name:"identity",encode:t=>oO(t),decode:t=>sO(t)})});var Q1={};at(Q1,{base2:()=>n9});var n9,lO=ge(()=>{c();Hr();n9=ct({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1})});var k1={};at(k1,{base8:()=>i9});var i9,fO=ge(()=>{c();Hr();i9=ct({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3})});var z1={};at(z1,{base10:()=>s9});var s9,hO=ge(()=>{c();Hr();s9=ji({prefix:"9",name:"base10",alphabet:"0123456789"})});var W1={};at(W1,{base16:()=>o9,base16upper:()=>a9});var o9,a9,dO=ge(()=>{c();Hr();o9=ct({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),a9=ct({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})});var K1={};at(K1,{base32:()=>Nu,base32hex:()=>f9,base32hexpad:()=>d9,base32hexpadupper:()=>p9,base32hexupper:()=>h9,base32pad:()=>c9,base32padupper:()=>l9,base32upper:()=>u9,base32z:()=>g9});var Nu,u9,c9,l9,f9,h9,d9,p9,g9,$1=ge(()=>{c();Hr();Nu=ct({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),u9=ct({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),c9=ct({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),l9=ct({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),f9=ct({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),h9=ct({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),d9=ct({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),p9=ct({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),g9=ct({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})});var Y1={};at(Y1,{base36:()=>y9,base36upper:()=>m9});var y9,m9,pO=ge(()=>{c();Hr();y9=ji({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),m9=ji({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})});var J1={};at(J1,{base58btc:()=>_n,base58flickr:()=>w9});var _n,w9,X1=ge(()=>{c();Hr();_n=ji({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),w9=ji({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})});var Z1={};at(Z1,{base64:()=>E9,base64pad:()=>v9,base64url:()=>A9,base64urlpad:()=>b9});var E9,v9,A9,b9,gO=ge(()=>{c();Hr();E9=ct({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),v9=ct({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),A9=ct({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),b9=ct({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})});var ev={};at(ev,{base256emoji:()=>T9});function S9(t){return t.reduce((e,r)=>(e+=_9[r],e),"")}function C9(t){let e=[];for(let r of t){let n=I9[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var yO,_9,I9,T9,mO=ge(()=>{c();Hr();yO=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}"),_9=yO.reduce((t,e,r)=>(t[r]=e,t),[]),I9=yO.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);T9=xu({prefix:"\u{1F680}",name:"base256emoji",encode:S9,decode:C9})});function vO(t,e,r){e=e||[],r=r||0;for(var n=r;t>=D9;)e[r++]=t&255|wO,t/=128;for(;t&O9;)e[r++]=t&255|wO,t>>>=7;return e[r]=t|0,vO.bytes=r-n+1,e}function tv(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw tv.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&EO)<=R9);return tv.bytes=s-n,r}var x9,wO,N9,O9,D9,P9,R9,EO,B9,L9,F9,M9,U9,q9,V9,j9,H9,G9,Q9,k9,vl,AO=ge(()=>{c();x9=vO,wO=128,N9=127,O9=~N9,D9=Math.pow(2,31);P9=tv,R9=128,EO=127;B9=Math.pow(2,7),L9=Math.pow(2,14),F9=Math.pow(2,21),M9=Math.pow(2,28),U9=Math.pow(2,35),q9=Math.pow(2,42),V9=Math.pow(2,49),j9=Math.pow(2,56),H9=Math.pow(2,63),G9=function(t){return t{c();AO();Al=(t,e=0)=>[vl.decode(t,e),vl.decode.bytes],Ou=(t,e,r=0)=>(vl.encode(t,e,r),e),Du=t=>vl.encodingLength(t)});var go,bO,_O,Pu,_l=ge(()=>{c();Vi();cp();go=(t,e)=>{let r=e.byteLength,n=Du(t),i=n+Du(r),s=new Uint8Array(i+r);return Ou(t,s,0),Ou(r,s,n),s.set(e,i),new Pu(t,r,e,s)},bO=t=>{let e=Yn(t),[r,n]=Al(e),[i,s]=Al(e.subarray(n)),o=e.subarray(n+s);if(o.byteLength!==i)throw new Error("Incorrect length");return new Pu(r,i,o,e)},_O=(t,e)=>t===e?!0:t.code===e.code&&t.size===e.size&&iO(t.bytes,e.bytes),Pu=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}});var nv,rv,iv=ge(()=>{c();_l();nv=({name:t,code:e,encode:r})=>new rv(t,e,r),rv=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?go(this.code,r):r.then(n=>go(this.code,n))}else throw Error("Unknown type, must be binary type")}}});var sv={};at(sv,{sha256:()=>z9,sha512:()=>W9});var SO,z9,W9,CO=ge(()=>{c();iv();SO=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),z9=nv({name:"sha2-256",code:18,encode:SO("SHA-256")}),W9=nv({name:"sha2-512",code:19,encode:SO("SHA-512")})});var ov={};at(ov,{identity:()=>Y9});var TO,K9,xO,$9,Y9,NO=ge(()=>{c();Vi();_l();TO=0,K9="identity",xO=Yn,$9=t=>go(TO,xO(t)),Y9={code:TO,name:K9,encode:xO,digest:$9}});var OO=ge(()=>{c();Vi()});var Bce,Lce,DO=ge(()=>{c();Bce=new TextEncoder,Lce=new TextDecoder});var _t,Z9,eQ,tQ,Il,rQ,PO,RO,lp,fp,nQ,iQ,sQ,BO=ge(()=>{c();cp();_l();X1();$1();Vi();_t=class{constructor(e,r,n,i){this.code=r,this.version=e,this.multihash=n,this.bytes=i,this.byteOffset=i.byteOffset,this.byteLength=i.byteLength,this.asCID=this,this._baseCache=new Map,Object.defineProperties(this,{byteOffset:fp,byteLength:fp,code:lp,version:lp,multihash:lp,bytes:lp,_baseCache:fp,asCID:fp})}toV0(){switch(this.version){case 0:return this;default:{let{code:e,multihash:r}=this;if(e!==Il)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==rQ)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=go(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&&_O(this.multihash,e.multihash)}toString(e){let{bytes:r,version:n,_baseCache:i}=this;switch(n){case 0:return eQ(r,i,e||_n.encoder);default:return tQ(r,i,e||Nu.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 iQ(/^0\.0/,sQ),!!(e&&(e[RO]||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||PO(r,n,i.bytes))}else if(e!=null&&e[RO]===!0){let{version:r,multihash:n,code:i}=e,s=bO(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!==Il)throw new Error(`Version 0 CID must use dag-pb (code: ${Il}) block encoding`);return new _t(e,r,n,n.bytes)}case 1:{let i=PO(e,r,n.bytes);return new _t(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return _t.create(0,Il,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=Yn(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 Pu(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,y]=Al(e.subarray(r));return r+=y,d},i=n(),s=Il;if(i===18?(i=0,r=0):i===1&&(s=n()),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let o=r,a=n(),u=n(),l=r+u,f=l-o;return{version:i,codec:s,multihashCode:a,digestSize:u,multihashSize:f,size:l}}static parse(e,r){let[n,i]=Z9(e,r),s=_t.decode(i);return s._baseCache.set(n,e),s}},Z9=(t,e)=>{switch(t[0]){case"Q":{let r=e||_n;return[_n.prefix,r.decode(`${_n.prefix}${t}`)]}case _n.prefix:{let r=e||_n;return[_n.prefix,r.decode(t)]}case Nu.prefix:{let r=e||Nu;return[Nu.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)]}}},eQ=(t,e,r)=>{let{prefix:n}=r;if(n!==_n.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},tQ=(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},Il=112,rQ=18,PO=(t,e,r)=>{let n=Du(t),i=n+Du(e),s=new Uint8Array(i+r.byteLength);return Ou(t,s,0),Ou(e,s,n),s.set(r,i),s},RO=Symbol.for("@ipld/js-cid/CID"),lp={writable:!1,configurable:!1,enumerable:!0},fp={writable:!1,enumerable:!1,configurable:!1},nQ="0.0.0-dev",iQ=(t,e)=>{if(t.test(nQ))console.warn(e);else throw new Error(e)},sQ=`CID.isCID(v) is deprecated and will be removed in the next major release. +`)}};pe.ErrContractHasNoAddress=Q0;var W0=class extends Re{constructor(e){super(e)}};pe.ErrMock=W0;var z0=class extends Re{constructor(e){super(e)}};pe.ErrTypingSystem=z0;var $0=class extends Re{constructor(e,r){super(`field ${e} does not exist on struct ${r}`)}};pe.ErrMissingFieldOnStruct=$0;var K0=class extends Re{constructor(e,r){super(`field ${e} does not exist on enum ${r}`)}};pe.ErrMissingFieldOnEnum=K0;var Y0=class extends Re{constructor(e){super(`cannot parse contract results: ${e}`)}};pe.ErrCannotParseContractResults=Y0;var J0=class extends Re{constructor(e,r){super(`cannot parse outcome of transaction ${e}: ${r}`)}};pe.ErrCannotParseTransactionOutcome=J0;var X0=class extends Re{constructor(e){super(e)}};pe.ErrCodec=X0;var Z0=class extends Re{constructor(e){super(e)}};pe.ErrContractInteraction=Z0;var em=class extends Re{constructor(){super("Method not yet implemented")}};pe.ErrNotImplemented=em;var tm=class extends Re{constructor(){super("invalid arguments for relayed v1 builder")}};pe.ErrInvalidRelayedV1BuilderArguments=tm;var rm=class extends Re{constructor(){super("invalid arguments for relayed v2 builder")}};pe.ErrInvalidRelayedV2BuilderArguments=rm;var nm=class extends Re{constructor(){super("gas limit must be 0 for the inner transaction for relayed v2")}};pe.ErrGasLimitShouldBe0ForInnerTransaction=nm});var sm=m(ci=>{"use strict";c();var o5=ci&&ci.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ci,"__esModule",{value:!0});ci.TokenPayment=ci.TokenTransfer=void 0;var Au=o5(jt()),a5=Be(),YI="EGLD",JI=18;Au.default.set({ROUNDING_MODE:1});var Wl=class t{constructor(e){let r=new Au.default(e.amountAsBigInteger);if(!r.isInteger()||r.isNegative())throw new a5.ErrInvalidArgument(`bad amountAsBigInteger: ${e.amountAsBigInteger}`);this.tokenIdentifier=e.tokenIdentifier,this.nonce=e.nonce,this.amountAsBigInteger=r,this.numDecimals=e.numDecimals}static egldFromAmount(e){let r=new Au.default(e).shiftedBy(JI).decimalPlaces(0);return this.egldFromBigInteger(r)}static egldFromBigInteger(e){return new t({tokenIdentifier:YI,nonce:0,amountAsBigInteger:e,numDecimals:JI})}static fungibleFromAmount(e,r,n){let i=new Au.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 Au.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==YI}isFungible(){return this.nonce==0}};ci.TokenTransfer=Wl;var im=class extends Wl{constructor(e,r,n,i){super({tokenIdentifier:e,nonce:r,amountAsBigInteger:n,numDecimals:i})}};ci.TokenPayment=im});var ps=m($e=>{"use strict";c();Object.defineProperty($e,"__esModule",{value:!0});$e.ARGUMENTS_SEPARATOR=$e.ESDT_TRANSFER_VALUE=$e.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME=$e.ESDTNFT_TRANSFER_FUNCTION_NAME=$e.ESDT_TRANSFER_FUNCTION_NAME=$e.ESDT_TRANSFER_GAS_LIMIT=$e.TRANSACTION_VERSION_WITH_OPTIONS=$e.TRANSACTION_VERSION_DEFAULT=$e.TRANSACTION_OPTIONS_TX_GUARDED=$e.TRANSACTION_OPTIONS_TX_HASH_SIGN=$e.TRANSACTION_OPTIONS_DEFAULT=$e.TRANSACTION_MIN_GAS_PRICE=void 0;$e.TRANSACTION_MIN_GAS_PRICE=1e9;$e.TRANSACTION_OPTIONS_DEFAULT=0;$e.TRANSACTION_OPTIONS_TX_HASH_SIGN=1;$e.TRANSACTION_OPTIONS_TX_GUARDED=2;$e.TRANSACTION_VERSION_DEFAULT=1;$e.TRANSACTION_VERSION_WITH_OPTIONS=2;$e.ESDT_TRANSFER_GAS_LIMIT=5e5;$e.ESDT_TRANSFER_FUNCTION_NAME="ESDTTransfer";$e.ESDTNFT_TRANSFER_FUNCTION_NAME="ESDTNFTTransfer";$e.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME="MultiESDTNFTTransfer";$e.ESDT_TRANSFER_VALUE="0";$e.ARGUMENTS_SEPARATOR="@"});var gr=m(rt=>{"use strict";c();var u5=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]}),c5=rt&&rt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),l5=rt&&rt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&u5(e,t,r);return c5(e,t),e};Object.defineProperty(rt,"__esModule",{value:!0});rt.isEmpty=rt.guardEmpty=rt.guardNotEmpty=rt.guardLength=rt.guardSameLength=rt.guardValueIsSetWithMessage=rt.guardValueIsSet=rt.guardTrue=void 0;var go=l5(Be());function f5(t,e){if(!t)throw new go.ErrInvariantFailed(`[<${e}>] isn't true`)}rt.guardTrue=f5;function h5(t,e){XI(`${t} isn't set (null or undefined)`,e)}rt.guardValueIsSet=h5;function XI(t,e){if(e==null||e===void 0)throw new go.ErrInvariantFailed(t)}rt.guardValueIsSetWithMessage=XI;function d5(t,e){if(t=t||[],e=e||[],t.length!=e.length)throw new go.ErrInvariantFailed("arrays do not have the same length")}rt.guardSameLength=d5;function p5(t,e){let r=t.length||0;if(r!=e)throw new go.ErrInvariantFailed(`wrong length, expected: ${e}, actual: ${r}`)}rt.guardLength=p5;function g5(t,e){if(om(t))throw new go.ErrInvariantFailed(`${e} is empty`)}rt.guardNotEmpty=g5;function y5(t,e){if(!om(t))throw new go.ErrInvariantFailed(`${e} is not empty`)}rt.guardEmpty=y5;function om(t){return t.isEmpty?t.isEmpty():t.length===0}rt.isEmpty=om});var ZI=m(zl=>{"use strict";c();Object.defineProperty(zl,"__esModule",{value:!0});zl.getJavascriptPrototypesInHierarchy=void 0;function m5(t,e){let r=[],n=Object.getPrototypeOf(t);for(;n&&e(n);)r.push(n),n=Object.getPrototypeOf(n);return r}zl.getJavascriptPrototypesInHierarchy=m5});var _t=m(bt=>{"use strict";c();Object.defineProperty(bt,"__esModule",{value:!0});bt.NullType=bt.TypePlaceholder=bt.isTyped=bt.PrimitiveValue=bt.TypedValue=bt.CustomType=bt.PrimitiveType=bt.TypeCardinality=bt.Type=void 0;var am=ZI(),eS=gr(),li=class t{constructor(e,r=[],n=bu.fixed(1)){eS.guardValueIsSet("name",e),this.name=e,this.typeParameters=r,this.cardinality=n}getName(){return this.name}getClassName(){return t.ClassName}getClassHierarchy(){return am.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 eS.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 am.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(){}};bt.Type=li;li.ClassName="Type";var bu=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}};bt.TypeCardinality=bu;bu.MaxCardinality=4096;var $l=class t extends li{constructor(e){super(e)}getClassName(){return t.ClassName}};bt.PrimitiveType=$l;$l.ClassName="PrimitiveType";var Kl=class t extends li{getClassName(){return t.ClassName}};bt.CustomType=Kl;Kl.ClassName="CustomType";var _u=class t{constructor(e){this.type=e}getClassName(){return t.ClassName}getClassHierarchy(){return am.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(){}};bt.TypedValue=_u;_u.ClassName="TypedValue";var Yl=class t extends _u{constructor(e){super(e)}getClassName(){return t.ClassName}};bt.PrimitiveValue=Yl;Yl.ClassName="PrimitiveValue";function E5(t){return t.belongsToTypesystem!==void 0}bt.isTyped=E5;var Jl=class t extends li{constructor(){super("...")}getClassName(){return t.ClassName}};bt.TypePlaceholder=Jl;Jl.ClassName="TypePlaceholder";var Xl=class t extends li{constructor(){super("?")}getClassName(){return t.ClassName}};bt.NullType=Xl;Xl.ClassName="NullType"});var tS=m((yo,mo)=>{c();(function(t){var e=typeof yo=="object"&&yo&&!yo.nodeType&&yo,r=typeof mo=="object"&&mo&&!mo.nodeType&&mo,n=typeof global=="object"&&global;(n.global===n||n.window===n||n.self===n)&&(t=n);var i,s=2147483647,o=36,a=1,u=26,l=38,f=700,d=72,g=128,E="-",v=/^xn--/,N=/[^\x20-\x7E]/,O=/[\x2E\u3002\uFF0E\uFF61]/g,F={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},_=o-a,I=Math.floor,S=String.fromCharCode,R;function B(Y){throw new RangeError(F[Y])}function b(Y,se){for(var te=Y.length,ie=[];te--;)ie[te]=se(Y[te]);return ie}function C(Y,se){var te=Y.split("@"),ie="";te.length>1&&(ie=te[0]+"@",Y=te[1]),Y=Y.replace(O,".");var q=Y.split("."),le=b(q,se).join(".");return ie+le}function L(Y){for(var se=[],te=0,ie=Y.length,q,le;te=55296&&q<=56319&&te65535&&(se-=65536,te+=S(se>>>10&1023|55296),se=56320|se&1023),te+=S(se),te}).join("")}function W(Y){return Y-48<10?Y-22:Y-65<26?Y-65:Y-97<26?Y-97:o}function j(Y,se){return Y+22+75*(Y<26)-((se!=0)<<5)}function G(Y,se,te){var ie=0;for(Y=te?I(Y/f):Y>>1,Y+=I(Y/se);Y>_*u>>1;ie+=o)Y=I(Y/_);return I(ie+(_+1)*Y/(Y+l))}function K(Y){var se=[],te=Y.length,ie,q=0,le=g,ae=d,fe,oe,ce,y,w,A,P,T,D;for(fe=Y.lastIndexOf(E),fe<0&&(fe=0),oe=0;oe=128&&B("not-basic"),se.push(Y.charCodeAt(oe));for(ce=fe>0?fe+1:0;ce=te&&B("invalid-input"),P=W(Y.charCodeAt(ce++)),(P>=o||P>I((s-q)/w))&&B("overflow"),q+=P*w,T=A<=ae?a:A>=ae+u?u:A-ae,!(PI(s/D)&&B("overflow"),w*=D;ie=se.length+1,ae=G(q-y,ie,y==0),I(q/ie)>s-le&&B("overflow"),le+=I(q/ie),q%=ie,se.splice(q++,0,le)}return X(se)}function de(Y){var se,te,ie,q,le,ae,fe,oe,ce,y,w,A=[],P,T,D,M;for(Y=L(Y),P=Y.length,se=g,te=0,le=d,ae=0;ae=se&&wI((s-te)/T)&&B("overflow"),te+=(fe-se)*T,se=fe,ae=0;aes&&B("overflow"),w==se){for(oe=te,ce=o;y=ce<=le?a:ce>=le+u?u:ce-le,!(oe{"use strict";c();var nS=tS();function w5(t,e){this.__proto__=new Error(e),this.__proto__.name="BackslashError",this.offset=t}function um(t){return t>="0"&&t<="7"}function v5(t){return t>="0"&&t<="9"||t>="a"&&t<="f"||t>="A"&&t<="F"}function rS(t){return t=parseInt(t,16),nS.ucs2.encode([t])}function iS(t,e,r){var n=!1,i=[];function s(u){var l=t[u];if(!v5(l))throw new w5(u,"Unexpected token ILLEGAL");return l}for(;e{c();var uS=sS();fS.exports={validate:A5,parse:b5};function A5(t,e){var r;if(e=e||!1,typeof t!="string")r="Input must be a string";else try{Zl(t,0,e,!1)}catch(n){r=n.message}return r}function b5(t,e){if(typeof t!="string")throw new Error("Input must be a string");e=e||!1;var r=Zl(t,0,e,!0);return r.value}function cS(t,e){for(var r=t.length,n=e,i,s=e;s-1&&t[r]==="\\";)n++,r--;return n%2===0}function C5(t,e,r,n){for(var i=e,s=",",o=[],a=e;gs(t[a]);)a++;if(t[a]==="]")return{start:e,end:a,value:o};for(;s===",";){var u=Zl(t,i,r,n),l=cS(t,u.end);n&&o.push(u.value),i=l.end,s=l.value}return{start:e,end:i,value:o}}function T5(t,e){return t.substr(e,4)==="true"}function x5(t,e){return t.substr(e,5)==="false"}function N5(t,e){return t.substr(e,4)==="null"}var O5=new RegExp(/^\s$/);function gs(t){return O5.test(t)}var D5=new RegExp(/^\d$/);function oS(t){return D5.test(t)}function Un(t,e,r){var n=10,i;t.length{"use strict";c();var P5=en&&en.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),R5=en&&en.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),B5=en&&en.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&P5(e,t,r);return R5(e,t),e};Object.defineProperty(en,"__esModule",{value:!0});en.TypeExpressionParser=void 0;var dS=B5(Be()),L5=_t(),F5=hS(),lm=class{parse(e){let r=this.doParse(e),n=Object.keys(r);if(n.length!=1)throw new dS.ErrTypingSystem(`bad type expression: ${e}`);let i=n[0];return this.nodeToType(i,r[i])}doParse(e){let r=this.getJsonedString(e);try{return F5.parse(r)}catch{throw new dS.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 L5.Type(e,n)}};en.TypeExpressionParser=lm});var hm=m(fi=>{"use strict";c();Object.defineProperty(fi,"__esModule",{value:!0});fi.EndpointParameterDefinition=fi.EndpointModifiers=fi.EndpointDefinition=void 0;var M5=ef(),pS="?",U5="N / A",fm=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?pS:e.name,e.payableInTokens=e.payableInTokens||[],e.inputs=e.inputs||[],e.outputs=e.outputs||[];let r=e.inputs.map(s=>Iu.fromJSON(s)),n=e.outputs.map(s=>Iu.fromJSON(s)),i=new tf(e.mutability,e.payableInTokens);return new t(e.name,r,n,i)}};fi.EndpointDefinition=fm;var tf=class{constructor(e,r){this.mutability=e||"",this.payableInTokens=r||[]}isPayableInEGLD(){return this.isPayableInToken("EGLD")}isPayableInToken(e){return this.payableInTokens.includes(e)?!0:this.payableInTokens.includes(`!${e}`)?!1:!!this.payableInTokens.includes("*")}isPayable(){return this.payableInTokens.length!=0}isReadonly(){return this.mutability=="readonly"}};fi.EndpointModifiers=tf;var Iu=class t{constructor(e,r,n){this.name=e,this.description=r,this.type=n}static fromJSON(e){let r=new M5.TypeExpressionParser().parse(e.type);return new t(e.name||pS,e.description||U5,r)}};fi.EndpointParameterDefinition=Iu});var Eo=m(sr=>{"use strict";c();var q5=sr&&sr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),V5=sr&&sr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),H5=sr&&sr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&q5(e,t,r);return V5(e,t),e};Object.defineProperty(sr,"__esModule",{value:!0});sr.Fields=sr.Field=sr.FieldDefinition=void 0;var dm=H5(Be()),j5=ef(),pm=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)}};sr.FieldDefinition=pm;var gm=class{constructor(e,r=""){this.value=e,this.name=r}checkTyping(e){let r=this.value.getType();if(!r.equals(e.type))throw new dm.ErrTypingSystem(`check type of field "${e.name}; expected: ${e.type}, actual: ${r}"`);if(this.name!=e.name)throw new dm.ErrTypingSystem(`check name of field "${e.name}"`)}equals(e){return this.name==e.name&&this.value.equals(e.value)}};sr.Field=gm;var ym=class{static checkTyping(e,r){if(e.length!=r.length)throw new dm.ErrTypingSystem("fields length vs. field definitions length");for(let n=0;n{"use strict";c();Object.defineProperty(hi,"__esModule",{value:!0});hi.EnumValue=hi.EnumVariantDefinition=hi.EnumType=void 0;var G5=Be(),mm=gr(),rf=Eo(),yS=_t(),gS=256,nf=class t extends yS.CustomType{constructor(e,r){super(e),this.variants=[],this.variants=r}getClassName(){return t.ClassName}static fromJSON(e){let r=(e.variants||[]).map(n=>sf.fromJSON(n));return new t(e.name,r)}getVariantByDiscriminant(e){let r=this.variants.find(n=>n.discriminant==e);return mm.guardValueIsSet(`variant by discriminant (${e})`,r),r}getVariantByName(e){let r=this.variants.find(n=>n.name==e);return mm.guardValueIsSet(`variant by name (${e})`,r),r}getNamesOfDependencies(){let e=[];for(let r of this.variants)e.push(...r.getNamesOfDependencies());return[...new Set(e)]}};hi.EnumType=nf;nf.ClassName="EnumType";var sf=class t{constructor(e,r,n=[]){this.fieldsDefinitions=[],mm.guardTrue(rrf.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 rf.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};hi.EnumVariantDefinition=sf;var of=class t extends yS.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();rf.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=rf.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 G5.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}};hi.EnumValue=of;of.ClassName="EnumValue"});var vo=m(wo=>{"use strict";c();Object.defineProperty(wo,"__esModule",{value:!0});wo.Struct=wo.StructType=void 0;var k5=Be(),af=Eo(),mS=_t(),uf=class t extends mS.CustomType{constructor(e,r){super(e),this.fieldsDefinitions=[],this.fieldsDefinitions=r}getClassName(){return t.ClassName}static fromJSON(e){let r=(e.fields||[]).map(n=>af.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 af.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};wo.StructType=uf;uf.ClassName="StructType";var cf=class t extends mS.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();af.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 k5.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 af.Fields.equals(r,n)}};wo.Struct=cf;cf.ClassName="Struct"});var wm=m((tie,vS)=>{"use strict";c();var ff="qpzry9x8gf2tvdw0s3jn54khce6mua7l",Em={};for(Cu=0;Cu>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 ES(t){for(var e=1,r=0;r126)return"Invalid prefix ("+t+")";e=Ao(e)^n>>5}for(e=Ao(e),r=0;rr)throw new TypeError("Exceeds length limit");t=t.toLowerCase();var n=ES(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=Ao(n)^o,i+=ff.charAt(o)}for(s=0;s<6;++s)n=Ao(n);for(n^=1,s=0;s<6;++s){var a=n>>(5-s)*5&31;i+=ff.charAt(a)}return i}function wS(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=ES(s);if(typeof a=="string")return a;for(var u=[],l=0;l=o.length)&&u.push(d)}return a!==1?"Invalid checksum for "+t:{prefix:s,words:u}}function W5(){var t=wS.apply(null,arguments);if(typeof t=="object")return t}function z5(t){var e=wS.apply(null,arguments);if(typeof e=="object")return e;throw new Error(e)}function hf(t,e,r,n){for(var i=0,s=0,o=(1<=r;)s-=r,a.push(i>>s&o);if(n)s>0&&a.push(i<=e)return"Excess padding";if(i<{"use strict";c();var X5=tn&&tn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Z5=tn&&tn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),AS=tn&&tn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&X5(e,t,r);return Z5(e,t),e};Object.defineProperty(tn,"__esModule",{value:!0});tn.Address=void 0;var df=AS(wm()),bo=AS(Be()),vm="erd",Am=32,e4="0".repeat(16),bm=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 bo.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!=Am)throw new bo.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==Am}static fromHex(e){if(!t.isValidHex(e))throw new bo.ErrAddressCannotCreate(e);return t.fromValidHex(e)}static empty(){return new t}static fromBech32(e){let r;try{r=df.decode(e)}catch(s){throw new bo.ErrAddressCannotCreate(e,s)}let n=r.prefix;if(n!=vm)throw new bo.ErrAddressBadHrp(vm,n);let i=h.Buffer.from(df.fromWords(r.words));if(i.length!=Am)throw new bo.ErrAddressCannotCreate(e);return t.fromValidHex(i.toString("hex"))}hex(){return this.isEmpty()?"":this.valueHex}bech32(){if(this.isEmpty())return"";let e=df.toWords(this.pubkey());return df.encode(vm,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(e4)}};tn.Address=bm});var Io=m(_o=>{"use strict";c();Object.defineProperty(_o,"__esModule",{value:!0});_o.AddressValue=_o.AddressType=void 0;var t4=yt(),bS=_t(),Tu=class t extends bS.PrimitiveType{constructor(){super("Address")}getClassName(){return t.ClassName}};_o.AddressType=Tu;Tu.ClassName="AddressType";var pf=class t extends bS.PrimitiveValue{constructor(e){super(new Tu),this.value=new t4.Address(e.bech32())}getClassName(){return t.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};_o.AddressValue=pf;pf.ClassName="AddressValue"});var yf=m(So=>{"use strict";c();Object.defineProperty(So,"__esModule",{value:!0});So.OptionalValue=So.OptionalType=void 0;var r4=gr(),xu=_t(),Nu=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}};So.OptionalType=Nu;Nu.ClassName="OptionalType";var gf=class t extends xu.TypedValue{constructor(e,r=null){super(e),this.value=r}getClassName(){return t.ClassName}static newMissing(){let e=new Nu(new xu.NullType);return new t(e)}isSet(){return!!this.value}getTypedValue(){return r4.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}};So.OptionalValue=gf;gf.ClassName="OptionalValue"});var Du=m(Co=>{"use strict";c();Object.defineProperty(Co,"__esModule",{value:!0});Co.BooleanValue=Co.BooleanType=void 0;var _S=_t(),Ou=class t extends _S.PrimitiveType{constructor(){super("bool")}getClassName(){return t.ClassName}};Co.BooleanType=Ou;Ou.ClassName="BooleanType";var mf=class t extends _S.PrimitiveValue{constructor(e){super(new Ou),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}};Co.BooleanValue=mf;mf.ClassName="BooleanValue"});var di=m(To=>{"use strict";c();Object.defineProperty(To,"__esModule",{value:!0});To.BytesValue=To.BytesType=void 0;var IS=_t(),Pu=class t extends IS.PrimitiveType{constructor(){super("bytes")}getClassName(){return t.ClassName}};To.BytesType=Pu;Pu.ClassName="BytesType";var Ef=class t extends IS.PrimitiveValue{constructor(e){super(new Pu),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()}};To.BytesValue=Ef;Ef.ClassName="BytesValue"});var CS=m(xo=>{"use strict";c();Object.defineProperty(xo,"__esModule",{value:!0});xo.CodeMetadataValue=xo.CodeMetadataType=void 0;var SS=_t(),wf=class extends SS.PrimitiveType{constructor(){super("CodeMetadata")}};xo.CodeMetadataType=wf;var _m=class extends SS.PrimitiveValue{constructor(e){super(new wf),this.value=e}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};xo.CodeMetadataValue=_m});var Af=m(No=>{"use strict";c();Object.defineProperty(No,"__esModule",{value:!0});No.CompositeValue=No.CompositeType=void 0;var n4=gr(),Im=_t(),Ru=class t extends Im.Type{constructor(...e){super("Composite",e,Im.TypeCardinality.variable(e.length))}getClassName(){return t.ClassName}};No.CompositeType=Ru;Ru.ClassName="CompositeType";var vf=class t extends Im.TypedValue{constructor(e,r){super(e),n4.guardLength(r,e.getTypeParameters().length),this.items=r}getClassName(){return t.ClassName}static fromItems(...e){let r=e.map(i=>i.getType()),n=new Ru(...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";c();Object.defineProperty(bf,"__esModule",{value:!0});bf.CollectionOfTypedValues=void 0;var Sm=class{constructor(e){this.items=e}getLength(){return this.items.length}getItems(){return this.items}valueOf(){return this.items.map(e=>e.valueOf())}equals(e){if(this.getLength()!=e.getLength())return!1;for(let r=0;r{"use strict";c();Object.defineProperty(rn,"__esModule",{value:!0});rn.List=rn.OptionValue=rn.ListType=rn.OptionType=void 0;var i4=gr(),s4=Cm(),ms=_t(),ys=class t extends ms.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(ms.NullType.ClassName);return r||n}};rn.OptionType=ys;ys.ClassName="OptionType";var Bu=class t extends ms.Type{constructor(e){super("List",[e])}getClassName(){return t.ClassName}};rn.ListType=Bu;Bu.ClassName="ListType";var _f=class t extends ms.TypedValue{constructor(e,r=null){super(e),this.value=r}getClassName(){return t.ClassName}static newMissing(){let e=new ys(new ms.NullType);return new t(e)}static newMissingTyped(e){return new t(new ys(e))}static newProvided(e){let r=new ys(e.getType());return new t(r,e)}isSet(){return!!this.value}getTypedValue(){return i4.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}};rn.OptionValue=_f;_f.ClassName="OptionValue";var If=class t extends ms.TypedValue{constructor(e,r){super(e),this.backingCollection=new s4.CollectionOfTypedValues(r)}getClassName(){return t.ClassName}static fromItems(e){if(e.length==0)return new t(new ms.TypePlaceholder,[]);let r=e[0].getType(),n=new Bu(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)}};rn.List=If;If.ClassName="List"});var Tf=m(Oo=>{"use strict";c();Object.defineProperty(Oo,"__esModule",{value:!0});Oo.ArrayVec=Oo.ArrayVecType=void 0;var TS=gr(),o4=Cm(),xS=_t(),Sf=class t extends xS.Type{constructor(e,r){super("Array",[r]),TS.guardTrue(e>0,"array length > 0"),this.length=e}getClassName(){return t.ClassName}};Oo.ArrayVecType=Sf;Sf.ClassName="ArrayVecType";var Cf=class t extends xS.TypedValue{constructor(e,r){super(e),TS.guardLength(r,e.length),this.backingCollection=new o4.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)}};Oo.ArrayVec=Cf;Cf.ClassName="ArrayVec"});var Mu=m(Do=>{"use strict";c();Object.defineProperty(Do,"__esModule",{value:!0});Do.H256Value=Do.H256Type=void 0;var NS=_t(),Fu=class t extends NS.PrimitiveType{constructor(){super("H256")}getClassName(){return t.ClassName}};Do.H256Type=Fu;Fu.ClassName="H256Type";var xf=class t extends NS.PrimitiveValue{constructor(e){super(new Fu),this.value=e}getClassName(){return t.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};Do.H256Value=xf;xf.ClassName="H256Value"});var Of=m(Po=>{"use strict";c();Object.defineProperty(Po,"__esModule",{value:!0});Po.NothingValue=Po.NothingType=void 0;var OS=_t(),Uu=class t extends OS.PrimitiveType{constructor(){super("nothing")}getClassName(){return t.ClassName}};Po.NothingType=Uu;Uu.ClassName="NothingType";var Nf=class t extends OS.PrimitiveValue{constructor(){super(new Uu)}getClassName(){return t.ClassName}equals(e){return!1}valueOf(){return{}}};Po.NothingValue=Nf;Nf.ClassName="NothingValue"});var Ku=m(_e=>{"use strict";c();var a4=_e&&_e.__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]}),u4=_e&&_e.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),c4=_e&&_e.__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)&&a4(e,t,r);return u4(e,t),e},l4=_e&&_e.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(_e,"__esModule",{value:!0});_e.BigIntValue=_e.BigUIntValue=_e.I64Value=_e.U64Value=_e.I32Value=_e.U32Value=_e.I16Value=_e.U16Value=_e.I8Value=_e.U8Value=_e.NumericalValue=_e.BigIntType=_e.BigUIntType=_e.I64Type=_e.U64Type=_e.I32Type=_e.U32Type=_e.I16Type=_e.U16Type=_e.I8Type=_e.U8Type=_e.NumericalType=void 0;var DS=c4(Be()),PS=_t(),Es=l4(jt()),or=class t extends PS.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()}};_e.NumericalType=or;or.ClassName="NumericalType";var qu=class t extends or{constructor(){super("u8",1,!1)}getClassName(){return t.ClassName}};_e.U8Type=qu;qu.ClassName="U8Type";var Vu=class t extends or{constructor(){super("i8",1,!0)}getClassName(){return t.ClassName}};_e.I8Type=Vu;Vu.ClassName="I8Type";var Hu=class t extends or{constructor(){super("u16",2,!1)}getClassName(){return t.ClassName}};_e.U16Type=Hu;Hu.ClassName="U16Type";var ju=class t extends or{constructor(){super("i16",2,!0)}getClassName(){return t.ClassName}};_e.I16Type=ju;ju.ClassName="I16Type";var Gu=class t extends or{constructor(){super("u32",4,!1)}getClassName(){return t.ClassName}};_e.U32Type=Gu;Gu.ClassName="U32Type";var ku=class t extends or{constructor(){super("i32",4,!0)}getClassName(){return t.ClassName}};_e.I32Type=ku;ku.ClassName="I32Type";var Qu=class t extends or{constructor(){super("u64",8,!1)}getClassName(){return t.ClassName}};_e.U64Type=Qu;Qu.ClassName="U64Type";var Wu=class t extends or{constructor(){super("i64",8,!0)}getClassName(){return t.ClassName}};_e.I64Type=Wu;Wu.ClassName="I64Type";var zu=class t extends or{constructor(){super("BigUint",0,!1)}getClassName(){return t.ClassName}};_e.BigUIntType=zu;zu.ClassName="BigUIntType";var $u=class t extends or{constructor(){super("Bigint",0,!0)}getClassName(){return t.ClassName}};_e.BigIntType=$u;$u.ClassName="BigIntType";var ar=class t extends PS.PrimitiveValue{constructor(e,r){if(super(e),this.value=new Es.default(r),this.sizeInBytes=e.sizeInBytes,this.withSign=e.withSign,this.value.isNaN())throw new DS.ErrInvalidArgument(`not a number: ${r}`);if(!this.withSign&&this.value.isNegative())throw new DS.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()}};_e.NumericalValue=ar;ar.ClassName="NumericalValue";var Df=class t extends ar{constructor(e){super(new qu,new Es.default(e))}getClassName(){return t.ClassName}};_e.U8Value=Df;Df.ClassName="U8Value";var Pf=class t extends ar{constructor(e){super(new Vu,new Es.default(e))}getClassName(){return t.ClassName}};_e.I8Value=Pf;Pf.ClassName="I8Value";var Rf=class t extends ar{constructor(e){super(new Hu,new Es.default(e))}getClassName(){return t.ClassName}};_e.U16Value=Rf;Rf.ClassName="U16Value";var Bf=class t extends ar{constructor(e){super(new ju,new Es.default(e))}getClassName(){return t.ClassName}};_e.I16Value=Bf;Bf.ClassName="I16Value";var Lf=class t extends ar{constructor(e){super(new Gu,new Es.default(e))}getClassName(){return t.ClassName}};_e.U32Value=Lf;Lf.ClassName="U32Value";var Ff=class t extends ar{constructor(e){super(new ku,new Es.default(e))}getClassName(){return t.ClassName}};_e.I32Value=Ff;Ff.ClassName="I32Value";var Mf=class t extends ar{constructor(e){super(new Qu,e)}getClassName(){return t.ClassName}};_e.U64Value=Mf;Mf.ClassName="U64Value";var Uf=class t extends ar{constructor(e){super(new Wu,e)}getClassName(){return t.ClassName}};_e.I64Value=Uf;Uf.ClassName="I64Value";var qf=class t extends ar{constructor(e){super(new zu,e)}getClassName(){return t.ClassName}};_e.BigUIntValue=qf;qf.ClassName="BigUIntValue";var Vf=class t extends ar{constructor(e){super(new $u,e)}getClassName(){return t.ClassName}};_e.BigIntValue=Vf;Vf.ClassName="BigIntValue"});var jf=m(Ro=>{"use strict";c();Object.defineProperty(Ro,"__esModule",{value:!0});Ro.StringValue=Ro.StringType=void 0;var RS=_t(),Yu=class t extends RS.PrimitiveType{constructor(){super("utf-8 string")}getClassName(){return t.ClassName}};Ro.StringType=Yu;Yu.ClassName="StringType";var Hf=class t extends RS.PrimitiveValue{constructor(e){super(new Yu),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}};Ro.StringValue=Hf;Hf.ClassName="StringValue"});var Lo=m(Bo=>{"use strict";c();Object.defineProperty(Bo,"__esModule",{value:!0});Bo.TokenIdentifierValue=Bo.TokenIdentifierType=void 0;var BS=_t(),f4="EGLD",Ju=class t extends BS.PrimitiveType{constructor(){super("TokenIdentifier")}getClassName(){return t.ClassName}};Bo.TokenIdentifierType=Ju;Ju.ClassName="TokenIdentifierType";var Gf=class t extends BS.PrimitiveValue{constructor(e){super(new Ju),this.value=e}static egld(){return new t(f4)}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()}};Bo.TokenIdentifierValue=Gf;Gf.ClassName="TokenIdentifierValue"});var Qf=m(_r=>{"use strict";c();var h4=_r&&_r.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),d4=_r&&_r.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),p4=_r&&_r.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&h4(e,t,r);return d4(e,t),e};Object.defineProperty(_r,"__esModule",{value:!0});_r.Tuple=_r.TupleType=void 0;var g4=p4(Be()),LS=Eo(),FS=vo(),Xu=class t extends FS.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 LS.FieldDefinition(MS(i),"anonymous tuple field",n))}};_r.TupleType=Xu;Xu.ClassName="TupleType";function MS(t){return`field${t}`}var kf=class t extends FS.Struct{constructor(e,r){super(e,r)}getClassName(){return t.ClassName}static fromItems(e){if(e.length<1)throw new g4.ErrTypingSystem("bad tuple items");let r=e.map(s=>s.getType()),n=new Xu(...r),i=e.map((s,o)=>new LS.Field(s,MS(o)));return new t(n,i)}};_r.Tuple=kf;kf.ClassName="Tuple"});var $f=m(Mo=>{"use strict";c();Object.defineProperty(Mo,"__esModule",{value:!0});Mo.VariadicValue=Mo.VariadicType=void 0;var Wf=_t(),Fo=class t extends Wf.Type{constructor(e){super("Variadic",[e],Wf.TypeCardinality.variable())}getClassName(){return t.ClassName}};Mo.VariadicType=Fo;Fo.ClassName="VariadicType";var zf=class t extends Wf.TypedValue{constructor(e,r){super(e),this.items=r}getClassName(){return t.ClassName}static fromItems(...e){if(e.length==0)return new t(new Fo(new Wf.TypePlaceholder),[]);let r=e[0].getType();return new t(new Fo(r),e)}getItems(){return this.items}valueOf(){return this.items.map(e=>e.valueOf())}equals(e){if(this.getType().differs(e.getType()))return!1;for(let r=0;r{"use strict";c();var y4=nn&&nn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),m4=nn&&nn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),E4=nn&&nn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&y4(e,t,r);return m4(e,t),e};Object.defineProperty(nn,"__esModule",{value:!0});nn.TypeMapper=void 0;var US=E4(Be()),w4=Io(),Tm=yf(),v4=Du(),A4=di(),b4=CS(),Kf=Af(),xm=Su(),_4=Eo(),qS=Lu(),pi=Tf(),I4=Mu(),VS=Of(),Ir=Ku(),S4=jf(),HS=vo(),jS=Lo(),gi=Qf(),Nm=$f(),Om=class{constructor(e=[]){this.openTypesFactories=new Map([["Option",(...r)=>new qS.OptionType(r[0])],["List",(...r)=>new qS.ListType(r[0])],["VarArgs",(...r)=>new Nm.VariadicType(r[0])],["MultiResultVec",(...r)=>new Nm.VariadicType(r[0])],["variadic",(...r)=>new Nm.VariadicType(r[0])],["OptionalArg",(...r)=>new Tm.OptionalType(r[0])],["optional",(...r)=>new Tm.OptionalType(r[0])],["OptionalResult",(...r)=>new Tm.OptionalType(r[0])],["multi",(...r)=>new Kf.CompositeType(...r)],["MultiArg",(...r)=>new Kf.CompositeType(...r)],["MultiResult",(...r)=>new Kf.CompositeType(...r)],["multi",(...r)=>new Kf.CompositeType(...r)],["tuple",(...r)=>new gi.TupleType(...r)],["tuple2",(...r)=>new gi.TupleType(...r)],["tuple3",(...r)=>new gi.TupleType(...r)],["tuple4",(...r)=>new gi.TupleType(...r)],["tuple5",(...r)=>new gi.TupleType(...r)],["tuple6",(...r)=>new gi.TupleType(...r)],["tuple7",(...r)=>new gi.TupleType(...r)],["tuple8",(...r)=>new gi.TupleType(...r)],["array8",(...r)=>new pi.ArrayVecType(8,r[0])],["array16",(...r)=>new pi.ArrayVecType(16,r[0])],["array20",(...r)=>new pi.ArrayVecType(20,r[0])],["array32",(...r)=>new pi.ArrayVecType(32,r[0])],["array46",(...r)=>new pi.ArrayVecType(46,r[0])],["array64",(...r)=>new pi.ArrayVecType(64,r[0])],["array128",(...r)=>new pi.ArrayVecType(128,r[0])],["array256",(...r)=>new pi.ArrayVecType(256,r[0])]]),this.closedTypesMap=new Map([["u8",new Ir.U8Type],["u16",new Ir.U16Type],["u32",new Ir.U32Type],["u64",new Ir.U64Type],["U64",new Ir.U64Type],["BigUint",new Ir.BigUIntType],["i8",new Ir.I8Type],["i16",new Ir.I16Type],["i32",new Ir.I32Type],["i64",new Ir.I64Type],["Bigint",new Ir.BigIntType],["BigInt",new Ir.BigIntType],["bool",new v4.BooleanType],["bytes",new A4.BytesType],["Address",new w4.AddressType],["H256",new I4.H256Type],["utf-8 string",new S4.StringType],["TokenIdentifier",new jS.TokenIdentifierType],["EgldOrEsdtTokenIdentifier",new jS.TokenIdentifierType],["CodeMetadata",new b4.CodeMetadataType],["nothing",new VS.NothingType],["AsyncCall",new VS.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 US.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(xm.EnumType.ClassName)?this.mapEnumType(e):e.hasExactClass(HS.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 HS.StructType(e.getName(),r)}mapEnumType(e){let r=e.variants.map(i=>new xm.EnumVariantDefinition(i.name,i.discriminant,this.mappedFields(i.getFieldsDefinitions())));return new xm.EnumType(e.getName(),r)}mappedFields(e){return e.map(r=>new _4.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 US.ErrTypingSystem(`Cannot map the generic type "${e.getName()}" to a known type`);return i(...n)}};nn.TypeMapper=Om});var zS=m(sn=>{"use strict";c();var C4=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]}),T4=sn&&sn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),x4=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)&&C4(e,t,r);return T4(e,t),e};Object.defineProperty(sn,"__esModule",{value:!0});sn.AbiRegistry=void 0;var GS=x4(Be()),Pm=gr(),Zu=hm(),kS=Su(),QS=vo(),N4=Dm(),O4="?",Rm=class t{constructor(e){this.endpoints=[],this.customTypes=[],this.name=e.name,this.constructorDefinition=e.constructorDefinition,this.endpoints=e.endpoints,this.customTypes=e.customTypes}static create(e){let r=e.name||O4,n=e.constructor||{},i=e.endpoints||[],s=e.types||{},o=Zu.EndpointDefinition.fromJSON(Object.assign({name:"constructor"},n)),a=i.map(d=>Zu.EndpointDefinition.fromJSON(d)),u=[];for(let d in s){let g=s[d];if(g.type=="struct")u.push(QS.StructType.fromJSON({name:d,fields:g.fields}));else if(g.type=="enum")u.push(kS.EnumType.fromJSON({name:d,variants:g.variants}));else throw new GS.ErrTypingSystem(`Cannot handle custom type: ${d}`)}return new t({name:r,constructorDefinition:o,endpoints:a,customTypes:u}).remapToKnownTypes()}getStruct(e){let r=this.customTypes.find(n=>n.getName()==e&&n.hasExactClass(QS.StructType.ClassName));return Pm.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(kS.EnumType.ClassName));return Pm.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 Pm.guardValueIsSetWithMessage(`endpoint [${e}] not found`,r),r}remapToKnownTypes(){let e=new N4.TypeMapper([]),r=[];for(let o of this.customTypes)this.mapCustomTypeDepthFirst(o,this.customTypes,e,r);if(this.customTypes.length!=r.length)throw new GS.ErrTypingSystem("Did not re-map all custom types");let n=WS(this.constructorDefinition,e),i=[];for(let o of this.endpoints)i.push(WS(o,e));return new t({name:this.name,constructorDefinition:n,endpoints:i,customTypes:r})}mapCustomTypeDepthFirst(e,r,n,i){if(i.findIndex(a=>a.getName()==e.getName())>=0)return;for(let a of e.getNamesOfDependencies()){let u=r.find(l=>l.getName()==a);u&&this.mapCustomTypeDepthFirst(u,r,n,i)}let o=n.mapType(e);i.push(o)}};sn.AbiRegistry=Rm;function WS(t,e){let r=t.input.map(i=>new Zu.EndpointParameterDefinition(i.name,i.description,e.mapType(i.type))),n=t.output.map(i=>new Zu.EndpointParameterDefinition(i.name,i.description,e.mapType(i.type)));return new Zu.EndpointDefinition(t.name,r,n,t.modifiers)}});var KS=m(Uo=>{"use strict";c();Object.defineProperty(Uo,"__esModule",{value:!0});Uo.createListOfTokenIdentifiers=Uo.createListOfAddresses=void 0;var D4=Io(),$S=Lu(),P4=Lo();function R4(t){let e=t.map(n=>new D4.AddressValue(n));return $S.List.fromItems(e)}Uo.createListOfAddresses=R4;function B4(t){let e=t.map(n=>new P4.TokenIdentifierValue(n));return $S.List.fromItems(e)}Uo.createListOfTokenIdentifiers=B4});var cC=m(zt=>{"use strict";c();var L4=zt&&zt.__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]}),F4=zt&&zt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),M4=zt&&zt.__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)&&L4(e,t,r);return F4(e,t),e};Object.defineProperty(zt,"__esModule",{value:!0});zt.onPrimitiveTypeSelect=zt.onPrimitiveValueSelect=zt.onTypedValueSelect=zt.onTypeSelect=void 0;var Jf=M4(Be()),YS=Io(),JS=Du(),XS=di(),ZS=Su(),Yf=Lu(),eC=Mu(),tC=Ku(),rC=Of(),nC=vo(),iC=Lo(),sC=Qf(),oC=_t(),aC=Tf(),uC=jf();function U4(t,e){if(t.hasExactClass(Yf.OptionType.ClassName))return e.onOption();if(t.hasExactClass(Yf.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(ZS.EnumType.ClassName))return e.onEnum();if(e.onOther)return e.onOther();throw new Jf.ErrTypingSystem(`type isn't known: ${t}`)}zt.onTypeSelect=U4;function q4(t,e){if(t.hasClassOrSuperclass(oC.PrimitiveValue.ClassName))return e.onPrimitive();if(t.hasExactClass(Yf.OptionValue.ClassName))return e.onOption();if(t.hasExactClass(Yf.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(ZS.EnumValue.ClassName))return e.onEnum();if(e.onOther)return e.onOther();throw new Jf.ErrTypingSystem(`value isn't typed: ${t}`)}zt.onTypedValueSelect=q4;function V4(t,e){if(t.hasExactClass(JS.BooleanValue.ClassName))return e.onBoolean();if(t.hasClassOrSuperclass(tC.NumericalValue.ClassName))return e.onNumerical();if(t.hasExactClass(YS.AddressValue.ClassName))return e.onAddress();if(t.hasExactClass(XS.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 Jf.ErrTypingSystem(`value isn't a primitive: ${t.getType()}`)}zt.onPrimitiveValueSelect=V4;function H4(t,e){if(t.hasExactClass(JS.BooleanType.ClassName))return e.onBoolean();if(t.hasClassOrSuperclass(tC.NumericalType.ClassName))return e.onNumerical();if(t.hasExactClass(YS.AddressType.ClassName))return e.onAddress();if(t.hasExactClass(XS.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 Jf.ErrTypingSystem(`type isn't a known primitive: ${t}`)}zt.onPrimitiveTypeSelect=H4});var Ot=m(qe=>{"use strict";c();var j4=qe&&qe.__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]}),nt=qe&&qe.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&j4(e,t,r)};Object.defineProperty(qe,"__esModule",{value:!0});nt(zS(),qe);nt(Io(),qe);nt(yf(),qe);nt(Du(),qe);nt(di(),qe);nt(Af(),qe);nt(hm(),qe);nt(Su(),qe);nt(KS(),qe);nt(Eo(),qe);nt(Lu(),qe);nt(Tf(),qe);nt(Mu(),qe);nt(cC(),qe);nt(Of(),qe);nt(Ku(),qe);nt(jf(),qe);nt(vo(),qe);nt(Lo(),qe);nt(Qf(),qe);nt(ef(),qe);nt(Dm(),qe);nt(_t(),qe);nt($f(),qe)});var fC=m(on=>{"use strict";c();var G4=on&&on.__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]}),k4=on&&on.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Q4=on&&on.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&G4(e,t,r);return k4(e,t),e};Object.defineProperty(on,"__esModule",{value:!0});on.OptionValueBinaryCodec=void 0;var lC=Q4(Be()),Xf=Ot(),Bm=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){if(e[0]==0)return[Xf.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[Xf.OptionValue.newProvided(n),i+1]}decodeTopLevel(e,r){if(e.length==0)return new Xf.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 Xf.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([])}};on.OptionValueBinaryCodec=Bm});var hC=m(Zf=>{"use strict";c();Object.defineProperty(Zf,"__esModule",{value:!0});Zf.AddressBinaryCodec=void 0;var W4=yt(),z4=Ot(),Lm=class{decodeNested(e){let r=e.slice(0,32),n=new W4.Address(r);return[new z4.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()}};Zf.AddressBinaryCodec=Lm});var pC=m(an=>{"use strict";c();var $4=an&&an.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),K4=an&&an.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Y4=an&&an.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&$4(e,t,r);return K4(e,t),e};Object.defineProperty(an,"__esModule",{value:!0});an.BooleanBinaryCodec=void 0;var J4=Y4(Be()),dC=Ot(),ec=class t{decodeNested(e){let r=e.readUInt8(0);return[new dC.BooleanValue(r==t.TRUE),1]}decodeTopLevel(e){if(e.length>1)throw new J4.ErrInvalidArgument("buffer should be of size <= 1");let r=e[0];return new dC.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([])}};an.BooleanBinaryCodec=ec;ec.TRUE=1;ec.FALSE=0});var th=m(eh=>{"use strict";c();Object.defineProperty(eh,"__esModule",{value:!0});eh.SizeOfU32=void 0;eh.SizeOfU32=4});var rh=m(un=>{"use strict";c();var X4=un&&un.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(un,"__esModule",{value:!0});un.zeroPadStringIfOddLength=un.isPaddedHex=un.numberToPaddedHex=void 0;var Z4=X4(jt());function eq(t){let e=new Z4.default(t).toString(16);return gC(e)}un.numberToPaddedHex=eq;function tq(t){t=t||"";let e=h.Buffer.from(t,"hex").toString("hex");return t.toUpperCase()==e.toUpperCase()}un.isPaddedHex=tq;function gC(t){return t=t||"",t.length%2==1?"0"+t:t}un.zeroPadStringIfOddLength=gC});var tc=m(It=>{"use strict";c();var rq=It&&It.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(It,"__esModule",{value:!0});It.prependByteToBuffer=It.flipBufferBitsInPlace=It.getHexMagnitudeOfBigInt=It.bigIntToBuffer=It.bufferToBigInt=It.cloneBuffer=It.isMsbZero=It.isMsbOne=void 0;var Fm=rq(jt()),nq=rh();function yC(t,e=0){return t[e]>>7==1}It.isMsbOne=yC;function iq(t,e=0){return!yC(t,e)}It.isMsbZero=iq;function sq(t){let e=h.Buffer.alloc(t.length);return t.copy(e),e}It.cloneBuffer=sq;function oq(t){let e=t.toString("hex");return new Fm.default(`0x${e}`,16)}It.bufferToBigInt=oq;function aq(t){let e=mC(t);return h.Buffer.from(e,"hex")}It.bigIntToBuffer=aq;function mC(t){return t=new Fm.default(t),t?(t.isNegative()&&(t=t.multipliedBy(new Fm.default(-1))),nq.numberToPaddedHex(t)):""}It.getHexMagnitudeOfBigInt=mC;function uq(t){for(let e=0;e{"use strict";c();var lq=qo&&qo.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(qo,"__esModule",{value:!0});qo.NumericalBinaryCodec=void 0;var rc=lq(jt()),Mm=Ot(),EC=th(),mt=tc(),Um=class{decodeNested(e,r){let n=0,i=r.sizeInBytes;i||(n=EC.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=mt.cloneBuffer(e);if(e.length==0)return new Mm.NumericalValue(r,new rc.default(0));if(!r.withSign||mt.isMsbZero(n)){let l=mt.bufferToBigInt(n);return new Mm.NumericalValue(r,l)}mt.flipBufferBitsInPlace(n);let u=mt.bufferToBigInt(n).multipliedBy(new rc.default(-1)).minus(new rc.default(1));return new Mm.NumericalValue(r,u)}encodeNested(e){if(e.sizeInBytes)return this.encodeNestedFixedSize(e,e.sizeInBytes);let r=this.encodeTopLevel(e),n=h.Buffer.alloc(EC.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=mt.bigIntToBuffer(e.value),a=h.Buffer.alloc(r-o.length,0);return h.Buffer.concat([a,o])}if(e.value.isPositive()){let o=mt.bigIntToBuffer(e.value);mt.isMsbOne(o)&&(o=mt.prependByteToBuffer(o,0));let a=h.Buffer.alloc(r-o.length,0);return h.Buffer.concat([a,o])}let n=e.value.plus(new rc.default(1)),i=mt.bigIntToBuffer(n);mt.flipBufferBitsInPlace(i),mt.isMsbZero(i)&&(i=mt.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):mt.bigIntToBuffer(e.value)}encodePrimitive(e){if(e.value.isPositive()){let i=mt.bigIntToBuffer(e.value);return mt.isMsbOne(i)&&(i=mt.prependByteToBuffer(i,0)),i}let r=e.value.plus(new rc.default(1)),n=mt.bigIntToBuffer(r);return mt.flipBufferBitsInPlace(n),mt.isMsbZero(n)&&(n=mt.prependByteToBuffer(n,255)),n}};qo.NumericalBinaryCodec=Um});var vC=m(nh=>{"use strict";c();Object.defineProperty(nh,"__esModule",{value:!0});nh.H256BinaryCodec=void 0;var fq=Mu(),qm=class{decodeNested(e){let r=e.slice(0,32);return[new fq.H256Value(r),32]}decodeTopLevel(e){let[r,n]=this.decodeNested(e);return r}encodeNested(e){return e.valueOf()}encodeTopLevel(e){return e.valueOf()}};nh.H256BinaryCodec=qm});var oh=m(sh=>{"use strict";c();Object.defineProperty(sh,"__esModule",{value:!0});sh.BytesBinaryCodec=void 0;var AC=di(),ih=th(),Vm=class{decodeNested(e){let r=e.readUInt32BE(0),n=e.slice(ih.SizeOfU32,ih.SizeOfU32+r);return[new AC.BytesValue(n),ih.SizeOfU32+r]}decodeTopLevel(e){return new AC.BytesValue(e)}encodeNested(e){let r=h.Buffer.alloc(ih.SizeOfU32);return r.writeUInt32BE(e.getLength()),h.Buffer.concat([r,e.valueOf()])}encodeTopLevel(e){return e.valueOf()}};sh.BytesBinaryCodec=Vm});var _C=m(ah=>{"use strict";c();Object.defineProperty(ah,"__esModule",{value:!0});ah.TokenIdentifierCodec=void 0;var hq=di(),bC=Lo(),dq=oh(),Hm=class{constructor(){this.bytesCodec=new dq.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=hq.BytesValue.fromUTF8(e.valueOf());return this.bytesCodec.encodeNested(r)}encodeTopLevel(e){return h.Buffer.from(e.valueOf())}};ah.TokenIdentifierCodec=Hm});var SC=m(uh=>{"use strict";c();Object.defineProperty(uh,"__esModule",{value:!0});uh.NothingCodec=void 0;var IC=Ot(),jm=class{decodeNested(){return[new IC.NothingValue,0]}decodeTopLevel(){return new IC.NothingValue}encodeNested(){return h.Buffer.from([])}encodeTopLevel(){return h.Buffer.from([])}};uh.NothingCodec=jm});var TC=m(ch=>{"use strict";c();Object.defineProperty(ch,"__esModule",{value:!0});ch.StringBinaryCodec=void 0;var CC=Ot(),pq=di(),gq=oh(),Gm=class{constructor(){this.bytesBinaryCodec=new gq.BytesBinaryCodec}decodeNested(e){let[r,n]=this.bytesBinaryCodec.decodeNested(e);return[new CC.StringValue(r.valueOf().toString()),n]}decodeTopLevel(e){return new CC.StringValue(e.toString())}encodeNested(e){let r=pq.BytesValue.fromUTF8(e.valueOf());return this.bytesBinaryCodec.encodeNested(r)}encodeTopLevel(e){return h.Buffer.from(e.valueOf())}};ch.StringBinaryCodec=Gm});var xC=m(fh=>{"use strict";c();Object.defineProperty(fh,"__esModule",{value:!0});fh.PrimitiveBinaryCodec=void 0;var lh=Ot(),yq=hC(),mq=pC(),Eq=wC(),wq=vC(),vq=oh(),Aq=_C(),bq=SC(),_q=TC(),km=class{constructor(e){this.binaryCodec=e,this.booleanCodec=new mq.BooleanBinaryCodec,this.numericalCodec=new Eq.NumericalBinaryCodec,this.addressCodec=new yq.AddressBinaryCodec,this.h256Codec=new wq.H256BinaryCodec,this.bytesCodec=new vq.BytesBinaryCodec,this.stringCodec=new _q.StringBinaryCodec,this.tokenIdentifierCodec=new Aq.TokenIdentifierCodec,this.nothingCodec=new bq.NothingCodec}decodeNested(e,r){return lh.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 lh.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 lh.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 lh.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()})}};fh.PrimitiveBinaryCodec=km});var DC=m(hh=>{"use strict";c();Object.defineProperty(hh,"__esModule",{value:!0});hh.ListBinaryCodec=void 0;var NC=Ot(),OC=th(),Qm=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)}};hh.ListBinaryCodec=Qm});var zm=m(dh=>{"use strict";c();Object.defineProperty(dh,"__esModule",{value:!0});dh.FieldsBinaryCodec=void 0;var Iq=Ot(),Wm=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 Iq.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)}};dh.FieldsBinaryCodec=Wm});var Km=m(ph=>{"use strict";c();Object.defineProperty(ph,"__esModule",{value:!0});ph.StructBinaryCodec=void 0;var Sq=Ot(),Cq=zm(),$m=class{constructor(e){this.fieldsCodec=new Cq.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 Sq.Struct(r,i),s]}encodeNested(e){let r=e.getFields();return this.fieldsCodec.encodeNested(r)}encodeTopLevel(e){return this.encodeNested(e)}};ph.StructBinaryCodec=$m});var PC=m(yh=>{"use strict";c();Object.defineProperty(yh,"__esModule",{value:!0});yh.EnumBinaryCodec=void 0;var gh=Ot(),Tq=zm(),Ym=class{constructor(e){this.binaryCodec=e,this.fieldsCodec=new Tq.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 gh.EnumValue(r,s,a),i+u]}readDiscriminant(e){let[r,n]=this.binaryCodec.decodeNested(e,new gh.U8Type);return[r.valueOf(),n]}encodeNested(e){let r=new gh.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 gh.U8Value(e.discriminant),o=n?this.binaryCodec.encodeNested(s):this.binaryCodec.encodeTopLevel(s);return h.Buffer.concat([o,i])}};yh.EnumBinaryCodec=Ym});var RC=m(mh=>{"use strict";c();Object.defineProperty(mh,"__esModule",{value:!0});mh.TupleBinaryCodec=void 0;var xq=Km(),Jm=class{constructor(e){this.structCodec=new xq.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)}};mh.TupleBinaryCodec=Jm});var BC=m(Eh=>{"use strict";c();Object.defineProperty(Eh,"__esModule",{value:!0});Eh.ArrayVecBinaryCodec=void 0;var Nq=Ot(),Xm=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){let n=r.length,i=r.getFirstTypeParameter(),s=[],o=0;for(let a=0;a{"use strict";c();var Oq=Sr&&Sr.__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]}),Dq=Sr&&Sr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Pq=Sr&&Sr.__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)&&Oq(e,t,r);return Dq(e,t),e};Object.defineProperty(Sr,"__esModule",{value:!0});Sr.BinaryCodecConstraints=Sr.BinaryCodec=void 0;var LC=Pq(Be()),wh=Ot(),FC=gr(),Rq=fC(),Bq=xC(),Lq=DC(),Fq=Km(),Mq=PC(),Uq=RC(),qq=BC(),Zm=class{constructor(e=null){this.constraints=e||new vh,this.optionCodec=new Rq.OptionValueBinaryCodec(this),this.listCodec=new Lq.ListBinaryCodec(this),this.arrayCodec=new qq.ArrayVecBinaryCodec(this),this.primitiveCodec=new Bq.PrimitiveBinaryCodec(this),this.structCodec=new Fq.StructBinaryCodec(this),this.tupleCodec=new Uq.TupleBinaryCodec(this),this.enumCodec=new Mq.EnumBinaryCodec(this)}decodeTopLevel(e,r){return this.constraints.checkBufferLength(e),wh.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]=wh.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"),wh.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"),wh.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)})}};Sr.BinaryCodec=Zm;var vh=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}`)}};Sr.BinaryCodecConstraints=vh});var MC=m(Cr=>{"use strict";c();var Vq=Cr&&Cr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Cr,"__esModule",{value:!0});Cr.decodeBigNumber=Cr.decodeString=Cr.decodeBool=Cr.decodeUnsignedNumber=void 0;var Hq=Vq(jt()),Ah=Ot(),jq=eE(),bh=new jq.BinaryCodec;function Gq(t){let e=bh.decodeTopLevel(t,new Ah.BigUIntType);return Number(e.valueOf())}Cr.decodeUnsignedNumber=Gq;function kq(t){return!!bh.decodeTopLevel(t,new Ah.BooleanType).valueOf()}Cr.decodeBool=kq;function Qq(t){let e=bh.decodeTopLevel(t,new Ah.BytesType);return String(e.valueOf())}Cr.decodeString=Qq;function Wq(t){let e=bh.decodeTopLevel(t,new Ah.BigUIntType);return new Hq.default(e.valueOf())}Cr.decodeBigNumber=Wq});var tE=m(yi=>{"use strict";c();var zq=yi&&yi.__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=yi&&yi.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&zq(e,t,r)};Object.defineProperty(yi,"__esModule",{value:!0});UC(eE(),yi);UC(MC(),yi)});var Vo=m(_h=>{"use strict";c();Object.defineProperty(_h,"__esModule",{value:!0});_h.ArgSerializer=void 0;var qC=ps(),$q=tE(),rE=yf(),nE=Af(),iE=$f(),Kq={codec:new $q.BinaryCodec},sE=class{constructor(e){e=Object.assign(Object.assign({},Kq),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 f=0;f=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 s of e)i(s);function i(s){if(s.hasExactClass(rE.OptionalValue.ClassName)){let o=s;o.isSet()&&i(o.getTypedValue())}else if(s.hasExactClass(iE.VariadicValue.ClassName)){let o=s;for(let a of o.getItems())i(a)}else if(s.hasExactClass(nE.CompositeValue.ClassName)){let o=s;for(let a of o.getItems())i(a)}else{let o=r.codec.encodeTopLevel(s);n.push(o)}}return n}};_h.ArgSerializer=sE});var Ch=m(Sh=>{"use strict";c();Object.defineProperty(Sh,"__esModule",{value:!0});Sh.Compatibility=void 0;var Yq=yt(),Ih=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()==Yq.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.`))}};Sh.Compatibility=Ih;Ih.areWarningsEnabled=!0});var VC=m(cn=>{"use strict";c();var Jq=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]}),Xq=cn&&cn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Zq=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)&&Jq(e,t,r);return Xq(e,t),e};Object.defineProperty(cn,"__esModule",{value:!0});cn.Hash=void 0;var eV=Zq(Be()),oE=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 eV.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}};cn.Hash=oE});var Th=m(Tr=>{"use strict";c();var tV=Tr&&Tr.__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]}),rV=Tr&&Tr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nV=Tr&&Tr.__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)&&tV(e,t,r);return rV(e,t),e};Object.defineProperty(Tr,"__esModule",{value:!0});Tr.TransactionOptions=Tr.TransactionVersion=void 0;var Hr=ps(),HC=nV(Be()),aE=class t{constructor(e){if(e=Number(e),e<1)throw new HC.ErrTransactionVersionInvalid(e);this.value=e}static withDefaultVersion(){return new t(Hr.TRANSACTION_VERSION_DEFAULT)}static withTxOptions(){return new t(Hr.TRANSACTION_VERSION_WITH_OPTIONS)}valueOf(){return this.value}};Tr.TransactionVersion=aE;var uE=class t{constructor(e){if(e=Number(e),e<0)throw new HC.ErrTransactionOptionsInvalid(e);this.value=e}static withDefaultOptions(){return new t(Hr.TRANSACTION_OPTIONS_DEFAULT)}static withOptions(e){let r=0;return e.hashSign&&(r|=Hr.TRANSACTION_OPTIONS_TX_HASH_SIGN),e.guarded&&(r|=Hr.TRANSACTION_OPTIONS_TX_GUARDED),new t(r)}isWithHashSign(){return(this.value&Hr.TRANSACTION_OPTIONS_TX_HASH_SIGN)==Hr.TRANSACTION_OPTIONS_TX_HASH_SIGN}isWithGuardian(){return(this.value&Hr.TRANSACTION_OPTIONS_TX_GUARDED)==Hr.TRANSACTION_OPTIONS_TX_GUARDED}setWithHashSign(){this.value|=Hr.TRANSACTION_OPTIONS_TX_HASH_SIGN}setWithGuardian(){this.value|=Hr.TRANSACTION_OPTIONS_TX_GUARDED}valueOf(){return this.value}};Tr.TransactionOptions=uE});var GC=m((Qse,jC)=>{"use strict";c();jC.exports=iV;function iV(t,e){for(var r=new Array(arguments.length-1),n=0,i=2,s=!0;i{"use strict";c();var xh=WC;xh.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 Ho=new Array(64),QC=new Array(123);for(jr=0;jr<64;)QC[Ho[jr]=jr<26?jr+65:jr<52?jr+71:jr<62?jr-4:jr-59|43]=jr++;var jr;xh.encode=function(e,r,n){for(var i=null,s=[],o=0,a=0,u;r>2],u=(l&3)<<4,a=1;break;case 1:s[o++]=Ho[u|l>>4],u=(l&15)<<2,a=2;break;case 2:s[o++]=Ho[u|l>>6],s[o++]=Ho[l&63],a=0;break}o>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,s)),o=0)}return a&&(s[o++]=Ho[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 kC="invalid encoding";xh.decode=function(e,r,n){for(var i=n,s=0,o,a=0;a1)break;if((u=QC[u])===void 0)throw Error(kC);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(kC);return n-i};xh.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var KC=m((Kse,$C)=>{"use strict";c();$C.exports=Nh;function Nh(){this._listeners={}}Nh.prototype.on=function(e,r,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:r,ctx:n||this}),this};Nh.prototype.off=function(e,r){if(e===void 0)this._listeners={};else if(r===void 0)this._listeners[e]=[];else for(var n=this._listeners[e],i=0;i{"use strict";c();tT.exports=YC(YC);function YC(t){return typeof Float32Array<"u"?function(){var e=new Float32Array([-0]),r=new Uint8Array(e.buffer),n=r[3]===128;function i(u,l,f){e[0]=u,l[f]=r[0],l[f+1]=r[1],l[f+2]=r[2],l[f+3]=r[3]}function s(u,l,f){e[0]=u,l[f]=r[3],l[f+1]=r[2],l[f+2]=r[1],l[f+3]=r[0]}t.writeFloatLE=n?i:s,t.writeFloatBE=n?s:i;function o(u,l){return r[0]=u[l],r[1]=u[l+1],r[2]=u[l+2],r[3]=u[l+3],e[0]}function a(u,l){return r[3]=u[l],r[2]=u[l+1],r[1]=u[l+2],r[0]=u[l+3],e[0]}t.readFloatLE=n?o:a,t.readFloatBE=n?a:o}():function(){function e(n,i,s,o){var a=i<0?1:0;if(a&&(i=-i),i===0)n(1/i>0?0:2147483648,s,o);else if(isNaN(i))n(2143289344,s,o);else if(i>34028234663852886e22)n((a<<31|2139095040)>>>0,s,o);else if(i<11754943508222875e-54)n((a<<31|Math.round(i/1401298464324817e-60))>>>0,s,o);else{var u=Math.floor(Math.log(i)/Math.LN2),l=Math.round(i*Math.pow(2,-u)*8388608)&8388607;n((a<<31|u+127<<23|l)>>>0,s,o)}}t.writeFloatLE=e.bind(null,JC),t.writeFloatBE=e.bind(null,XC);function r(n,i,s){var o=n(i,s),a=(o>>31)*2+1,u=o>>>23&255,l=o&8388607;return u===255?l?NaN:a*(1/0):u===0?a*1401298464324817e-60*l:a*Math.pow(2,u-150)*(l+8388608)}t.readFloatLE=r.bind(null,ZC),t.readFloatBE=r.bind(null,eT)}(),typeof Float64Array<"u"?function(){var e=new Float64Array([-0]),r=new Uint8Array(e.buffer),n=r[7]===128;function i(u,l,f){e[0]=u,l[f]=r[0],l[f+1]=r[1],l[f+2]=r[2],l[f+3]=r[3],l[f+4]=r[4],l[f+5]=r[5],l[f+6]=r[6],l[f+7]=r[7]}function s(u,l,f){e[0]=u,l[f]=r[7],l[f+1]=r[6],l[f+2]=r[5],l[f+3]=r[4],l[f+4]=r[3],l[f+5]=r[2],l[f+6]=r[1],l[f+7]=r[0]}t.writeDoubleLE=n?i:s,t.writeDoubleBE=n?s:i;function o(u,l){return r[0]=u[l],r[1]=u[l+1],r[2]=u[l+2],r[3]=u[l+3],r[4]=u[l+4],r[5]=u[l+5],r[6]=u[l+6],r[7]=u[l+7],e[0]}function a(u,l){return r[7]=u[l],r[6]=u[l+1],r[5]=u[l+2],r[4]=u[l+3],r[3]=u[l+4],r[2]=u[l+5],r[1]=u[l+6],r[0]=u[l+7],e[0]}t.readDoubleLE=n?o:a,t.readDoubleBE=n?a:o}():function(){function e(n,i,s,o,a,u){var l=o<0?1:0;if(l&&(o=-o),o===0)n(0,a,u+i),n(1/o>0?0:2147483648,a,u+s);else if(isNaN(o))n(0,a,u+i),n(2146959360,a,u+s);else if(o>17976931348623157e292)n(0,a,u+i),n((l<<31|2146435072)>>>0,a,u+s);else{var f;if(o<22250738585072014e-324)f=o/5e-324,n(f>>>0,a,u+i),n((l<<31|f/4294967296)>>>0,a,u+s);else{var d=Math.floor(Math.log(o)/Math.LN2);d===1024&&(d=1023),f=o*Math.pow(2,-d),n(f*4503599627370496>>>0,a,u+i),n((l<<31|d+1023<<20|f*1048576&1048575)>>>0,a,u+s)}}}t.writeDoubleLE=e.bind(null,JC,0,4),t.writeDoubleBE=e.bind(null,XC,4,0);function r(n,i,s,o,a){var u=n(o,a+i),l=n(o,a+s),f=(l>>31)*2+1,d=l>>>20&2047,g=4294967296*(l&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,ZC,0,4),t.readDoubleBE=r.bind(null,eT,4,0)}(),t}function JC(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 XC(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 ZC(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0}function eT(t,e){return(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}});var nT=m((exports,module)=>{"use strict";c();module.exports=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(t){}return null}});var sT=m(iT=>{"use strict";c();var cE=iT;cE.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))};cE.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 aT=m((roe,oT)=>{"use strict";c();oT.exports=sV;function sV(t,e,r){var n=r||8192,i=n>>>1,s=null,o=n;return function(u){if(u<1||u>i)return t(u);o+u>n&&(s=t(n),o=0);var l=e.call(s,o,o+=u);return o&7&&(o=(o|7)+1),l}}});var cT=m((ioe,uT)=>{"use strict";c();uT.exports=Bt;var nc=Ei();function Bt(t,e){this.lo=t>>>0,this.hi=e>>>0}var ws=Bt.zero=new Bt(0,0);ws.toNumber=function(){return 0};ws.zzEncode=ws.zzDecode=function(){return this};ws.length=function(){return 1};var oV=Bt.zeroHash="\0\0\0\0\0\0\0\0";Bt.fromNumber=function(e){if(e===0)return ws;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 Bt(n,i)};Bt.from=function(e){if(typeof e=="number")return Bt.fromNumber(e);if(nc.isString(e))if(nc.Long)e=nc.Long.fromString(e);else return Bt.fromNumber(parseInt(e,10));return e.low||e.high?new Bt(e.low>>>0,e.high>>>0):ws};Bt.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};Bt.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 mi=String.prototype.charCodeAt;Bt.fromHash=function(e){return e===oV?ws:new Bt((mi.call(e,0)|mi.call(e,1)<<8|mi.call(e,2)<<16|mi.call(e,3)<<24)>>>0,(mi.call(e,4)|mi.call(e,5)<<8|mi.call(e,6)<<16|mi.call(e,7)<<24)>>>0)};Bt.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)};Bt.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};Bt.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};Bt.prototype.length=function(){var e=this.lo,r=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?r===0?e<16384?e<128?1:2:e<2097152?3:4:r<16384?r<128?5:6:r<2097152?7:8:n<128?9:10}});var Ei=m(lE=>{"use strict";c();var we=lE;we.asPromise=GC();we.base64=zC();we.EventEmitter=KC();we.float=rT();we.inquire=nT();we.utf8=sT();we.pool=aT();we.LongBits=cT();we.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);we.global=we.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||lE;we.emptyArray=Object.freeze?Object.freeze([]):[];we.emptyObject=Object.freeze?Object.freeze({}):{};we.isInteger=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};we.isString=function(e){return typeof e=="string"||e instanceof String};we.isObject=function(e){return e&&typeof e=="object"};we.isset=we.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};we.Buffer=function(){try{var t=we.inquire("buffer").Buffer;return t.prototype.utf8Write?t:null}catch{return null}}();we._Buffer_from=null;we._Buffer_allocUnsafe=null;we.newBuffer=function(e){return typeof e=="number"?we.Buffer?we._Buffer_allocUnsafe(e):new we.Array(e):we.Buffer?we._Buffer_from(e):typeof Uint8Array>"u"?e:new Uint8Array(e)};we.Array=typeof Uint8Array<"u"?Uint8Array:Array;we.Long=we.global.dcodeIO&&we.global.dcodeIO.Long||we.global.Long||we.inquire("long");we.key2Re=/^true|false|0|1$/;we.key32Re=/^-?(?:0|[1-9][0-9]*)$/;we.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;we.longToHash=function(e){return e?we.LongBits.from(e).toHash():we.LongBits.zeroHash};we.longFromHash=function(e,r){var n=we.LongBits.fromHash(e);return we.Long?we.Long.fromBits(n.lo,n.hi,r):n.toNumber(!!r)};function lT(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]}};we.oneOfSetter=function(e){return function(r){for(var n=0;n{"use strict";c();gT.exports=Fe;var xr=Ei(),fE,Oh=xr.LongBits,hT=xr.base64,dT=xr.utf8;function ic(t,e,r){this.fn=t,this.len=e,this.next=void 0,this.val=r}function dE(){}function aV(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}function Fe(){this.len=0,this.head=new ic(dE,0,0),this.tail=this.head,this.states=null}var pT=function(){return xr.Buffer?function(){return(Fe.create=function(){return new fE})()}:function(){return new Fe}};Fe.create=pT();Fe.alloc=function(e){return new xr.Array(e)};xr.Array!==Array&&(Fe.alloc=xr.pool(Fe.alloc,xr.Array.prototype.subarray));Fe.prototype._push=function(e,r,n){return this.tail=this.tail.next=new ic(e,r,n),this.len+=r,this};function pE(t,e,r){e[r]=t&255}function uV(t,e,r){for(;t>127;)e[r++]=t&127|128,t>>>=7;e[r]=t}function gE(t,e){this.len=t,this.next=void 0,this.val=e}gE.prototype=Object.create(ic.prototype);gE.prototype.fn=uV;Fe.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new gE((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this};Fe.prototype.int32=function(e){return e<0?this._push(yE,10,Oh.fromNumber(e)):this.uint32(e)};Fe.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function yE(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}Fe.prototype.uint64=function(e){var r=Oh.from(e);return this._push(yE,r.length(),r)};Fe.prototype.int64=Fe.prototype.uint64;Fe.prototype.sint64=function(e){var r=Oh.from(e).zzEncode();return this._push(yE,r.length(),r)};Fe.prototype.bool=function(e){return this._push(pE,1,e?1:0)};function hE(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}Fe.prototype.fixed32=function(e){return this._push(hE,4,e>>>0)};Fe.prototype.sfixed32=Fe.prototype.fixed32;Fe.prototype.fixed64=function(e){var r=Oh.from(e);return this._push(hE,4,r.lo)._push(hE,4,r.hi)};Fe.prototype.sfixed64=Fe.prototype.fixed64;Fe.prototype.float=function(e){return this._push(xr.float.writeFloatLE,4,e)};Fe.prototype.double=function(e){return this._push(xr.float.writeDoubleLE,8,e)};var cV=xr.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(pE,1,0);if(xr.isString(e)){var n=Fe.alloc(r=hT.length(e));hT.decode(e,n,0),e=n}return this.uint32(r)._push(cV,r,e)};Fe.prototype.string=function(e){var r=dT.length(e);return r?this.uint32(r)._push(dT.write,r,e):this._push(pE,1,0)};Fe.prototype.fork=function(){return this.states=new aV(this),this.head=this.tail=new ic(dE,0,0),this.len=0,this};Fe.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 ic(dE,0,0),this.len=0),this};Fe.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};Fe.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};Fe._configure=function(t){fE=t,Fe.create=pT(),fE._configure()}});var ET=m((loe,mT)=>{"use strict";c();mT.exports=ln;var yT=mE();(ln.prototype=Object.create(yT.prototype)).constructor=ln;var wi=Ei();function ln(){yT.call(this)}ln._configure=function(){ln.alloc=wi._Buffer_allocUnsafe,ln.writeBytesBuffer=wi.Buffer&&wi.Buffer.prototype instanceof Uint8Array&&wi.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(ln.writeBytesBuffer,r,e),this};function lV(t,e,r){t.length<40?wi.utf8.write(t,e,r):e.utf8Write?e.utf8Write(t,r):e.write(t,r)}ln.prototype.string=function(e){var r=wi.Buffer.byteLength(e);return this.uint32(r),r&&this._push(lV,r,e),this};ln._configure()});var vE=m((hoe,_T)=>{"use strict";c();_T.exports=Et;var fn=Ei(),wE,AT=fn.LongBits,fV=fn.utf8;function Gr(t,e){return RangeError("index out of range: "+t.pos+" + "+(e||1)+" > "+t.len)}function Et(t){this.buf=t,this.pos=0,this.len=t.length}var wT=typeof Uint8Array<"u"?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new Et(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new Et(e);throw Error("illegal buffer")},bT=function(){return fn.Buffer?function(r){return(Et.create=function(i){return fn.Buffer.isBuffer(i)?new wE(i):wT(i)})(r)}:wT};Et.create=bT();Et.prototype._slice=fn.Array.prototype.subarray||fn.Array.prototype.slice;Et.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,Gr(this,10);return e}}();Et.prototype.int32=function(){return this.uint32()|0};Et.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(e&1)|0};function EE(){var t=new AT(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 Gr(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 Gr(this);if(t.hi=(t.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}Et.prototype.bool=function(){return this.uint32()!==0};function Dh(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}Et.prototype.fixed32=function(){if(this.pos+4>this.len)throw Gr(this,4);return Dh(this.buf,this.pos+=4)};Et.prototype.sfixed32=function(){if(this.pos+4>this.len)throw Gr(this,4);return Dh(this.buf,this.pos+=4)|0};function vT(){if(this.pos+8>this.len)throw Gr(this,8);return new AT(Dh(this.buf,this.pos+=4),Dh(this.buf,this.pos+=4))}Et.prototype.float=function(){if(this.pos+4>this.len)throw Gr(this,4);var e=fn.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};Et.prototype.double=function(){if(this.pos+8>this.len)throw Gr(this,4);var e=fn.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e};Et.prototype.bytes=function(){var e=this.uint32(),r=this.pos,n=this.pos+e;if(n>this.len)throw Gr(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)};Et.prototype.string=function(){var e=this.bytes();return fV.read(e,0,e.length)};Et.prototype.skip=function(e){if(typeof e=="number"){if(this.pos+e>this.len)throw Gr(this,e);this.pos+=e}else do if(this.pos>=this.len)throw Gr(this);while(this.buf[this.pos++]&128);return this};Et.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};Et._configure=function(t){wE=t,Et.create=bT(),wE._configure();var e=fn.Long?"toLong":"toNumber";fn.merge(Et.prototype,{int64:function(){return EE.call(this)[e](!1)},uint64:function(){return EE.call(this)[e](!0)},sint64:function(){return EE.call(this).zzDecode()[e](!1)},fixed64:function(){return vT.call(this)[e](!0)},sfixed64:function(){return vT.call(this)[e](!1)}})}});var TT=m((poe,CT)=>{"use strict";c();CT.exports=vs;var ST=vE();(vs.prototype=Object.create(ST.prototype)).constructor=vs;var IT=Ei();function vs(t){ST.call(this,t)}vs._configure=function(){IT.Buffer&&(vs.prototype._slice=IT.Buffer.prototype.slice)};vs.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))};vs._configure()});var NT=m((yoe,xT)=>{"use strict";c();xT.exports=sc;var AE=Ei();(sc.prototype=Object.create(AE.EventEmitter.prototype)).constructor=sc;function sc(t,e,r){if(typeof t!="function")throw TypeError("rpcImpl must be a function");AE.EventEmitter.call(this),this.rpcImpl=t,this.requestDelimited=!!e,this.responseDelimited=!!r}sc.prototype.rpcCall=function t(e,r,n,i,s){if(!i)throw TypeError("request must be specified");var o=this;if(!s)return AE.asPromise(t,o,e,r,n,i);if(!o.rpcImpl){setTimeout(function(){s(Error("already ended"))},0);return}try{return o.rpcImpl(e,r[o.requestDelimited?"encodeDelimited":"encode"](i).finish(),function(u,l){if(u)return o.emit("error",u,e),s(u);if(l===null){o.end(!0);return}if(!(l instanceof n))try{l=n[o.responseDelimited?"decodeDelimited":"decode"](l)}catch(f){return o.emit("error",f,e),s(f)}return o.emit("data",l,e),s(null,l)})}catch(a){o.emit("error",a,e),setTimeout(function(){s(a)},0);return}};sc.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var DT=m(OT=>{"use strict";c();var hV=OT;hV.Service=NT()});var RT=m((voe,PT)=>{"use strict";c();PT.exports={}});var FT=m(LT=>{"use strict";c();var ur=LT;ur.build="minimal";ur.Writer=mE();ur.BufferWriter=ET();ur.Reader=vE();ur.BufferReader=TT();ur.util=Ei();ur.rpc=DT();ur.roots=RT();ur.configure=BT;function BT(){ur.util._configure(),ur.Writer._configure(ur.BufferWriter),ur.Reader._configure(ur.BufferReader)}BT()});var UT=m((Ioe,MT)=>{"use strict";c();MT.exports=FT()});var VT=m((Coe,qT)=>{"use strict";c();var jo=UT(),Ph=jo.Reader,dV=jo.Writer,J=jo.util,oc=jo.roots.default||(jo.roots.default={});oc.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 Ph||(n=new Ph(n)),this.decode(n,n.uint32())},e.verify=function(n){return typeof n!="object"||n===null?"object expected":n.Nonce!=null&&n.hasOwnProperty("Nonce")&&!J.isInteger(n.Nonce)&&!(n.Nonce&&J.isInteger(n.Nonce.low)&&J.isInteger(n.Nonce.high))?"Nonce: integer|Long expected":n.Value!=null&&n.hasOwnProperty("Value")&&!(n.Value&&typeof n.Value.length=="number"||J.isString(n.Value))?"Value: buffer expected":n.RcvAddr!=null&&n.hasOwnProperty("RcvAddr")&&!(n.RcvAddr&&typeof n.RcvAddr.length=="number"||J.isString(n.RcvAddr))?"RcvAddr: buffer expected":n.RcvUserName!=null&&n.hasOwnProperty("RcvUserName")&&!(n.RcvUserName&&typeof n.RcvUserName.length=="number"||J.isString(n.RcvUserName))?"RcvUserName: buffer expected":n.SndAddr!=null&&n.hasOwnProperty("SndAddr")&&!(n.SndAddr&&typeof n.SndAddr.length=="number"||J.isString(n.SndAddr))?"SndAddr: buffer expected":n.SndUserName!=null&&n.hasOwnProperty("SndUserName")&&!(n.SndUserName&&typeof n.SndUserName.length=="number"||J.isString(n.SndUserName))?"SndUserName: buffer expected":n.GasPrice!=null&&n.hasOwnProperty("GasPrice")&&!J.isInteger(n.GasPrice)&&!(n.GasPrice&&J.isInteger(n.GasPrice.low)&&J.isInteger(n.GasPrice.high))?"GasPrice: integer|Long expected":n.GasLimit!=null&&n.hasOwnProperty("GasLimit")&&!J.isInteger(n.GasLimit)&&!(n.GasLimit&&J.isInteger(n.GasLimit.low)&&J.isInteger(n.GasLimit.high))?"GasLimit: integer|Long expected":n.Data!=null&&n.hasOwnProperty("Data")&&!(n.Data&&typeof n.Data.length=="number"||J.isString(n.Data))?"Data: buffer expected":n.ChainID!=null&&n.hasOwnProperty("ChainID")&&!(n.ChainID&&typeof n.ChainID.length=="number"||J.isString(n.ChainID))?"ChainID: buffer expected":n.Version!=null&&n.hasOwnProperty("Version")&&!J.isInteger(n.Version)?"Version: integer expected":n.Signature!=null&&n.hasOwnProperty("Signature")&&!(n.Signature&&typeof n.Signature.length=="number"||J.isString(n.Signature))?"Signature: buffer expected":n.Options!=null&&n.hasOwnProperty("Options")&&!J.isInteger(n.Options)?"Options: integer expected":n.GuardAddr!=null&&n.hasOwnProperty("GuardAddr")&&!(n.GuardAddr&&typeof n.GuardAddr.length=="number"||J.isString(n.GuardAddr))?"GuardAddr: buffer expected":n.GuardSignature!=null&&n.hasOwnProperty("GuardSignature")&&!(n.GuardSignature&&typeof n.GuardSignature.length=="number"||J.isString(n.GuardSignature))?"GuardSignature: buffer expected":null},e.fromObject=function(n){if(n instanceof oc.proto.Transaction)return n;var i=new oc.proto.Transaction;return n.Nonce!=null&&(J.Long?(i.Nonce=J.Long.fromValue(n.Nonce)).unsigned=!0:typeof n.Nonce=="string"?i.Nonce=parseInt(n.Nonce,10):typeof n.Nonce=="number"?i.Nonce=n.Nonce:typeof n.Nonce=="object"&&(i.Nonce=new J.LongBits(n.Nonce.low>>>0,n.Nonce.high>>>0).toNumber(!0))),n.Value!=null&&(typeof n.Value=="string"?J.base64.decode(n.Value,i.Value=J.newBuffer(J.base64.length(n.Value)),0):n.Value.length&&(i.Value=n.Value)),n.RcvAddr!=null&&(typeof n.RcvAddr=="string"?J.base64.decode(n.RcvAddr,i.RcvAddr=J.newBuffer(J.base64.length(n.RcvAddr)),0):n.RcvAddr.length&&(i.RcvAddr=n.RcvAddr)),n.RcvUserName!=null&&(typeof n.RcvUserName=="string"?J.base64.decode(n.RcvUserName,i.RcvUserName=J.newBuffer(J.base64.length(n.RcvUserName)),0):n.RcvUserName.length&&(i.RcvUserName=n.RcvUserName)),n.SndAddr!=null&&(typeof n.SndAddr=="string"?J.base64.decode(n.SndAddr,i.SndAddr=J.newBuffer(J.base64.length(n.SndAddr)),0):n.SndAddr.length&&(i.SndAddr=n.SndAddr)),n.SndUserName!=null&&(typeof n.SndUserName=="string"?J.base64.decode(n.SndUserName,i.SndUserName=J.newBuffer(J.base64.length(n.SndUserName)),0):n.SndUserName.length&&(i.SndUserName=n.SndUserName)),n.GasPrice!=null&&(J.Long?(i.GasPrice=J.Long.fromValue(n.GasPrice)).unsigned=!0:typeof n.GasPrice=="string"?i.GasPrice=parseInt(n.GasPrice,10):typeof n.GasPrice=="number"?i.GasPrice=n.GasPrice:typeof n.GasPrice=="object"&&(i.GasPrice=new J.LongBits(n.GasPrice.low>>>0,n.GasPrice.high>>>0).toNumber(!0))),n.GasLimit!=null&&(J.Long?(i.GasLimit=J.Long.fromValue(n.GasLimit)).unsigned=!0:typeof n.GasLimit=="string"?i.GasLimit=parseInt(n.GasLimit,10):typeof n.GasLimit=="number"?i.GasLimit=n.GasLimit:typeof n.GasLimit=="object"&&(i.GasLimit=new J.LongBits(n.GasLimit.low>>>0,n.GasLimit.high>>>0).toNumber(!0))),n.Data!=null&&(typeof n.Data=="string"?J.base64.decode(n.Data,i.Data=J.newBuffer(J.base64.length(n.Data)),0):n.Data.length&&(i.Data=n.Data)),n.ChainID!=null&&(typeof n.ChainID=="string"?J.base64.decode(n.ChainID,i.ChainID=J.newBuffer(J.base64.length(n.ChainID)),0):n.ChainID.length&&(i.ChainID=n.ChainID)),n.Version!=null&&(i.Version=n.Version>>>0),n.Signature!=null&&(typeof n.Signature=="string"?J.base64.decode(n.Signature,i.Signature=J.newBuffer(J.base64.length(n.Signature)),0):n.Signature.length&&(i.Signature=n.Signature)),n.Options!=null&&(i.Options=n.Options>>>0),n.GuardAddr!=null&&(typeof n.GuardAddr=="string"?J.base64.decode(n.GuardAddr,i.GuardAddr=J.newBuffer(J.base64.length(n.GuardAddr)),0):n.GuardAddr.length&&(i.GuardAddr=n.GuardAddr)),n.GuardSignature!=null&&(typeof n.GuardSignature=="string"?J.base64.decode(n.GuardSignature,i.GuardSignature=J.newBuffer(J.base64.length(n.GuardSignature)),0):n.GuardSignature.length&&(i.GuardSignature=n.GuardSignature)),i},e.toObject=function(n,i){i||(i={});var s={};if(i.defaults){if(J.Long){var o=new J.Long(0,0,!0);s.Nonce=i.longs===String?o.toString():i.longs===Number?o.toNumber():o}else s.Nonce=i.longs===String?"0":0;if(i.bytes===String?s.Value="":(s.Value=[],i.bytes!==Array&&(s.Value=J.newBuffer(s.Value))),i.bytes===String?s.RcvAddr="":(s.RcvAddr=[],i.bytes!==Array&&(s.RcvAddr=J.newBuffer(s.RcvAddr))),i.bytes===String?s.RcvUserName="":(s.RcvUserName=[],i.bytes!==Array&&(s.RcvUserName=J.newBuffer(s.RcvUserName))),i.bytes===String?s.SndAddr="":(s.SndAddr=[],i.bytes!==Array&&(s.SndAddr=J.newBuffer(s.SndAddr))),i.bytes===String?s.SndUserName="":(s.SndUserName=[],i.bytes!==Array&&(s.SndUserName=J.newBuffer(s.SndUserName))),J.Long){var o=new J.Long(0,0,!0);s.GasPrice=i.longs===String?o.toString():i.longs===Number?o.toNumber():o}else s.GasPrice=i.longs===String?"0":0;if(J.Long){var o=new J.Long(0,0,!0);s.GasLimit=i.longs===String?o.toString():i.longs===Number?o.toNumber():o}else s.GasLimit=i.longs===String?"0":0;i.bytes===String?s.Data="":(s.Data=[],i.bytes!==Array&&(s.Data=J.newBuffer(s.Data))),i.bytes===String?s.ChainID="":(s.ChainID=[],i.bytes!==Array&&(s.ChainID=J.newBuffer(s.ChainID))),s.Version=0,i.bytes===String?s.Signature="":(s.Signature=[],i.bytes!==Array&&(s.Signature=J.newBuffer(s.Signature))),s.Options=0,i.bytes===String?s.GuardAddr="":(s.GuardAddr=[],i.bytes!==Array&&(s.GuardAddr=J.newBuffer(s.GuardAddr))),i.bytes===String?s.GuardSignature="":(s.GuardSignature=[],i.bytes!==Array&&(s.GuardSignature=J.newBuffer(s.GuardSignature)))}return n.Nonce!=null&&n.hasOwnProperty("Nonce")&&(typeof n.Nonce=="number"?s.Nonce=i.longs===String?String(n.Nonce):n.Nonce:s.Nonce=i.longs===String?J.Long.prototype.toString.call(n.Nonce):i.longs===Number?new J.LongBits(n.Nonce.low>>>0,n.Nonce.high>>>0).toNumber(!0):n.Nonce),n.Value!=null&&n.hasOwnProperty("Value")&&(s.Value=i.bytes===String?J.base64.encode(n.Value,0,n.Value.length):i.bytes===Array?Array.prototype.slice.call(n.Value):n.Value),n.RcvAddr!=null&&n.hasOwnProperty("RcvAddr")&&(s.RcvAddr=i.bytes===String?J.base64.encode(n.RcvAddr,0,n.RcvAddr.length):i.bytes===Array?Array.prototype.slice.call(n.RcvAddr):n.RcvAddr),n.RcvUserName!=null&&n.hasOwnProperty("RcvUserName")&&(s.RcvUserName=i.bytes===String?J.base64.encode(n.RcvUserName,0,n.RcvUserName.length):i.bytes===Array?Array.prototype.slice.call(n.RcvUserName):n.RcvUserName),n.SndAddr!=null&&n.hasOwnProperty("SndAddr")&&(s.SndAddr=i.bytes===String?J.base64.encode(n.SndAddr,0,n.SndAddr.length):i.bytes===Array?Array.prototype.slice.call(n.SndAddr):n.SndAddr),n.SndUserName!=null&&n.hasOwnProperty("SndUserName")&&(s.SndUserName=i.bytes===String?J.base64.encode(n.SndUserName,0,n.SndUserName.length):i.bytes===Array?Array.prototype.slice.call(n.SndUserName):n.SndUserName),n.GasPrice!=null&&n.hasOwnProperty("GasPrice")&&(typeof n.GasPrice=="number"?s.GasPrice=i.longs===String?String(n.GasPrice):n.GasPrice:s.GasPrice=i.longs===String?J.Long.prototype.toString.call(n.GasPrice):i.longs===Number?new J.LongBits(n.GasPrice.low>>>0,n.GasPrice.high>>>0).toNumber(!0):n.GasPrice),n.GasLimit!=null&&n.hasOwnProperty("GasLimit")&&(typeof n.GasLimit=="number"?s.GasLimit=i.longs===String?String(n.GasLimit):n.GasLimit:s.GasLimit=i.longs===String?J.Long.prototype.toString.call(n.GasLimit):i.longs===Number?new J.LongBits(n.GasLimit.low>>>0,n.GasLimit.high>>>0).toNumber(!0):n.GasLimit),n.Data!=null&&n.hasOwnProperty("Data")&&(s.Data=i.bytes===String?J.base64.encode(n.Data,0,n.Data.length):i.bytes===Array?Array.prototype.slice.call(n.Data):n.Data),n.ChainID!=null&&n.hasOwnProperty("ChainID")&&(s.ChainID=i.bytes===String?J.base64.encode(n.ChainID,0,n.ChainID.length):i.bytes===Array?Array.prototype.slice.call(n.ChainID):n.ChainID),n.Version!=null&&n.hasOwnProperty("Version")&&(s.Version=n.Version),n.Signature!=null&&n.hasOwnProperty("Signature")&&(s.Signature=i.bytes===String?J.base64.encode(n.Signature,0,n.Signature.length):i.bytes===Array?Array.prototype.slice.call(n.Signature):n.Signature),n.Options!=null&&n.hasOwnProperty("Options")&&(s.Options=n.Options),n.GuardAddr!=null&&n.hasOwnProperty("GuardAddr")&&(s.GuardAddr=i.bytes===String?J.base64.encode(n.GuardAddr,0,n.GuardAddr.length):i.bytes===Array?Array.prototype.slice.call(n.GuardAddr):n.GuardAddr),n.GuardSignature!=null&&n.hasOwnProperty("GuardSignature")&&(s.GuardSignature=i.bytes===String?J.base64.encode(n.GuardSignature,0,n.GuardSignature.length):i.bytes===Array?Array.prototype.slice.call(n.GuardSignature):n.GuardSignature),s},e.prototype.toJSON=function(){return this.constructor.toObject(this,jo.util.toJSONOptions)},e}(),t}();qT.exports=oc});var HT=m(Nr=>{"use strict";c();var pV=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]}),gV=Nr&&Nr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yV=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)&&pV(e,t,r);return gV(e,t),e},mV=Nr&&Nr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Nr,"__esModule",{value:!0});Nr.ProtoSerializer=void 0;var EV=mV(jt()),bE=yt(),wV=ps(),vV=yV(Be()),AV=tc(),_E=class{serializeTransaction(e){let r=VT().proto,n=new bE.Address(e.getReceiver().bech32()).pubkey(),i=new bE.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()!==wV.TRANSACTION_OPTIONS_DEFAULT&&(s.Options=e.getOptions().valueOf()),e.isGuardedTransaction()){let u=e.getGuardian();s.GuardAddr=new bE.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 EV.default(e.toString());if(r.isZero())return h.Buffer.from([0,0]);let n=AV.bigIntToBuffer(r);return n=h.Buffer.concat([h.Buffer.from([0]),n]),n}deserializeTransaction(e){throw new vV.ErrUnsupportedOperation("deserializeTransaction")}};Nr.ProtoSerializer=_E});var jT=m(As=>{"use strict";c();var bV=As&&As.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_V=As&&As.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&bV(e,t,r)};Object.defineProperty(As,"__esModule",{value:!0});_V(HT(),As)});var Rh=m(hn=>{"use strict";c();var IV=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]}),SV=hn&&hn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CV=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)&&IV(e,t,r);return SV(e,t),e};Object.defineProperty(hn,"__esModule",{value:!0});hn.Signature=void 0;var GT=CV(Be()),kT=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 GT.ErrSignatureCannotCreate(e);return t.fromValidHex(e)}static isValidHex(e){return h.Buffer.from(e,"hex").length==kT}static fromValidHex(e){let r=new t;return r.valueHex=e,r}static fromBuffer(e){if(e.length!=kT)throw new GT.ErrSignatureCannotCreate(e);return t.fromValidHex(e.toString("hex"))}hex(){return this.valueHex}};hn.Signature=IE});var qn=m(Bh=>{"use strict";c();Object.defineProperty(Bh,"__esModule",{value:!0});Bh.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}};Bh.TransactionPayload=SE});var CE=m((Foe,QT)=>{c();Vn.notEqual=xV;Vn.notOk=NV;Vn.equal=TV;Vn.ok=Vn;QT.exports=Vn;function TV(t,e,r){Vn(t==e,r)}function xV(t,e,r){Vn(t!=e,r)}function NV(t,e){Vn(!t,e)}function Vn(t,e){if(!t)throw new Error(e||"AssertionError")}});var _s=m(Wo=>{"use strict";c();var TE=p0(),ko=y0(),WT=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Wo.Buffer=z;Wo.SlowBuffer=LV;Wo.INSPECT_MAX_BYTES=50;var Lh=2147483647;Wo.kMaxLength=Lh;z.TYPED_ARRAY_SUPPORT=OV();!z.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function OV(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return!1}}Object.defineProperty(z.prototype,"parent",{enumerable:!0,get:function(){if(z.isBuffer(this))return this.buffer}});Object.defineProperty(z.prototype,"offset",{enumerable:!0,get:function(){if(z.isBuffer(this))return this.byteOffset}});function Hn(t){if(t>Lh)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,z.prototype),e}function z(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return DE(t)}return YT(t,e,r)}z.poolSize=8192;function YT(t,e,r){if(typeof t=="string")return PV(t,e);if(ArrayBuffer.isView(t))return RV(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(dn(t,ArrayBuffer)||t&&dn(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(dn(t,SharedArrayBuffer)||t&&dn(t.buffer,SharedArrayBuffer)))return NE(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=t.valueOf&&t.valueOf();if(n!=null&&n!==t)return z.from(n,e,r);let i=BV(t);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return z.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}z.from=function(t,e,r){return YT(t,e,r)};Object.setPrototypeOf(z.prototype,Uint8Array.prototype);Object.setPrototypeOf(z,Uint8Array);function JT(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 DV(t,e,r){return JT(t),t<=0?Hn(t):e!==void 0?typeof r=="string"?Hn(t).fill(e,r):Hn(t).fill(e):Hn(t)}z.alloc=function(t,e,r){return DV(t,e,r)};function DE(t){return JT(t),Hn(t<0?0:PE(t)|0)}z.allocUnsafe=function(t){return DE(t)};z.allocUnsafeSlow=function(t){return DE(t)};function PV(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!z.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=XT(t,e)|0,n=Hn(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function xE(t){let e=t.length<0?0:PE(t.length)|0,r=Hn(e);for(let n=0;n=Lh)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Lh.toString(16)+" bytes");return t|0}function LV(t){return+t!=t&&(t=0),z.alloc(+t)}z.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==z.prototype};z.compare=function(e,r){if(dn(e,Uint8Array)&&(e=z.from(e,e.offset,e.byteLength)),dn(r,Uint8Array)&&(r=z.from(r,r.offset,r.byteLength)),!z.isBuffer(e)||!z.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;let n=e.length,i=r.length;for(let s=0,o=Math.min(n,i);si.length?(z.isBuffer(o)||(o=z.from(o)),o.copy(i,s)):Uint8Array.prototype.set.call(i,o,s);else if(z.isBuffer(o))o.copy(i,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return i};function XT(t,e){if(z.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||dn(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 OE(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return ax(t).length;default:if(i)return n?-1:OE(t).length;e=(""+e).toLowerCase(),i=!0}}z.byteLength=XT;function FV(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 WV(this,e,r);case"utf8":case"utf-8":return ex(this,e,r);case"ascii":return kV(this,e,r);case"latin1":case"binary":return QV(this,e,r);case"base64":return jV(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return zV(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}z.prototype._isBuffer=!0;function bs(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}z.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let r=0;rr&&(e+=" ... "),""};WT&&(z.prototype[WT]=z.prototype.inspect);z.prototype.compare=function(e,r,n,i,s){if(dn(e,Uint8Array)&&(e=z.from(e,e.offset,e.byteLength)),!z.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),r<0||n>e.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&r>=n)return 0;if(i>=s)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,s>>>=0,this===e)return 0;let o=s-i,a=n-r,u=Math.min(o,a),l=this.slice(i,s),f=e.slice(r,n);for(let d=0;d2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,BE(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof e=="string"&&(e=z.from(e,n)),z.isBuffer(e))return e.length===0?-1:zT(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):zT(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function zT(t,e,r,n,i){let s=1,o=t.length,a=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;s=2,o/=2,a/=2,r/=2}function u(f,d){return s===1?f[d]:f.readUInt16BE(d*s)}let l;if(i){let f=-1;for(l=r;lo&&(r=o-a),l=r;l>=0;l--){let f=!0;for(let d=0;di&&(n=i)):n=i;let s=e.length;n>s/2&&(n=s/2);let o;for(o=0;o>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let s=this.length-r;if((n===void 0||n>s)&&(n=s),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let o=!1;for(;;)switch(i){case"hex":return MV(this,e,r,n);case"utf8":case"utf-8":return UV(this,e,r,n);case"ascii":case"latin1":case"binary":return qV(this,e,r,n);case"base64":return VV(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return HV(this,e,r,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};z.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function jV(t,e,r){return e===0&&r===t.length?TE.fromByteArray(t):TE.fromByteArray(t.slice(e,r))}function ex(t,e,r){r=Math.min(t.length,r);let n=[],i=e;for(;i239?4:s>223?3:s>191?2:1;if(i+a<=r){let u,l,f,d;switch(a){case 1:s<128&&(o=s);break;case 2:u=t[i+1],(u&192)===128&&(d=(s&31)<<6|u&63,d>127&&(o=d));break;case 3:u=t[i+1],l=t[i+2],(u&192)===128&&(l&192)===128&&(d=(s&15)<<12|(u&63)<<6|l&63,d>2047&&(d<55296||d>57343)&&(o=d));break;case 4:u=t[i+1],l=t[i+2],f=t[i+3],(u&192)===128&&(l&192)===128&&(f&192)===128&&(d=(s&15)<<18|(u&63)<<12|(l&63)<<6|f&63,d>65535&&d<1114112&&(o=d))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),i+=a}return GV(n)}var $T=4096;function GV(t){let e=t.length;if(e<=$T)return String.fromCharCode.apply(String,t);let r="",n=0;for(;nn)&&(r=n);let i="";for(let s=e;sn&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),rr)throw new RangeError("Trying to access beyond buffer length")}z.prototype.readUintLE=z.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Lt(e,r,this.length);let i=this[e],s=1,o=0;for(;++o>>0,r=r>>>0,n||Lt(e,r,this.length);let i=this[e+--r],s=1;for(;r>0&&(s*=256);)i+=this[e+--r]*s;return i};z.prototype.readUint8=z.prototype.readUInt8=function(e,r){return e=e>>>0,r||Lt(e,1,this.length),this[e]};z.prototype.readUint16LE=z.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||Lt(e,2,this.length),this[e]|this[e+1]<<8};z.prototype.readUint16BE=z.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||Lt(e,2,this.length),this[e]<<8|this[e+1]};z.prototype.readUint32LE=z.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||Lt(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};z.prototype.readUint32BE=z.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||Lt(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};z.prototype.readBigUInt64LE=vi(function(e){e=e>>>0,Qo(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&ac(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,Qo(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&ac(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||Lt(e,r,this.length);let i=this[e],s=1,o=0;for(;++o=s&&(i-=Math.pow(2,8*r)),i};z.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||Lt(e,r,this.length);let i=r,s=1,o=this[e+--i];for(;i>0&&(s*=256);)o+=this[e+--i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*r)),o};z.prototype.readInt8=function(e,r){return e=e>>>0,r||Lt(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};z.prototype.readInt16LE=function(e,r){e=e>>>0,r||Lt(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};z.prototype.readInt16BE=function(e,r){e=e>>>0,r||Lt(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};z.prototype.readInt32LE=function(e,r){return e=e>>>0,r||Lt(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};z.prototype.readInt32BE=function(e,r){return e=e>>>0,r||Lt(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};z.prototype.readBigInt64LE=vi(function(e){e=e>>>0,Qo(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&ac(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,Qo(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&ac(e,this.length-8);let i=(r<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(i)<>>0,r||Lt(e,4,this.length),ko.read(this,e,!0,23,4)};z.prototype.readFloatBE=function(e,r){return e=e>>>0,r||Lt(e,4,this.length),ko.read(this,e,!1,23,4)};z.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||Lt(e,8,this.length),ko.read(this,e,!0,52,8)};z.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||Lt(e,8,this.length),ko.read(this,e,!1,52,8)};function cr(t,e,r,n,i,s){if(!z.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}z.prototype.writeUintLE=z.prototype.writeUIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){let a=Math.pow(2,8*n)-1;cr(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;cr(this,e,r,n,a,0)}let s=n-1,o=1;for(this[r+s]=e&255;--s>=0&&(o*=256);)this[r+s]=e/o&255;return r+n};z.prototype.writeUint8=z.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||cr(this,e,r,1,255,0),this[r]=e&255,r+1};z.prototype.writeUint16LE=z.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||cr(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};z.prototype.writeUint16BE=z.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||cr(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};z.prototype.writeUint32LE=z.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||cr(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4};z.prototype.writeUint32BE=z.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||cr(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 tx(t,e,r,n,i){ox(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 rx(t,e,r,n,i){ox(e,n,i,t,r,7);let s=Number(e&BigInt(4294967295));t[r+7]=s,s=s>>8,t[r+6]=s,s=s>>8,t[r+5]=s,s=s>>8,t[r+4]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=o,o=o>>8,t[r+2]=o,o=o>>8,t[r+1]=o,o=o>>8,t[r]=o,r+8}z.prototype.writeBigUInt64LE=vi(function(e,r=0){return tx(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});z.prototype.writeBigUInt64BE=vi(function(e,r=0){return rx(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});z.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let u=Math.pow(2,8*n-1);cr(this,e,r,n,u-1,-u)}let s=0,o=1,a=0;for(this[r]=e&255;++s>0)-a&255;return r+n};z.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let u=Math.pow(2,8*n-1);cr(this,e,r,n,u-1,-u)}let s=n-1,o=1,a=0;for(this[r+s]=e&255;--s>=0&&(o*=256);)e<0&&a===0&&this[r+s+1]!==0&&(a=1),this[r+s]=(e/o>>0)-a&255;return r+n};z.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||cr(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};z.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||cr(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};z.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||cr(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};z.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||cr(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4};z.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||cr(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};z.prototype.writeBigInt64LE=vi(function(e,r=0){return tx(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});z.prototype.writeBigInt64BE=vi(function(e,r=0){return rx(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function nx(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 ix(t,e,r,n,i){return e=+e,r=r>>>0,i||nx(t,e,r,4,34028234663852886e22,-34028234663852886e22),ko.write(t,e,r,n,23,4),r+4}z.prototype.writeFloatLE=function(e,r,n){return ix(this,e,r,!0,n)};z.prototype.writeFloatBE=function(e,r,n){return ix(this,e,r,!1,n)};function sx(t,e,r,n,i){return e=+e,r=r>>>0,i||nx(t,e,r,8,17976931348623157e292,-17976931348623157e292),ko.write(t,e,r,n,52,8),r+8}z.prototype.writeDoubleLE=function(e,r,n){return sx(this,e,r,!0,n)};z.prototype.writeDoubleBE=function(e,r,n){return sx(this,e,r,!1,n)};z.prototype.copy=function(e,r,n,i){if(!z.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),r>=e.length&&(r=e.length),r||(r=0),i>0&&i=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-r>>0,n=n===void 0?this.length:n>>>0,e||(e=0);let s;if(typeof e=="number")for(s=r;s2**32?i=KT(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=KT(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);function KT(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 $V(t,e,r){Qo(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&ac(e,t.length-(r+1))}function ox(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 Go.ERR_OUT_OF_RANGE("value",a,t)}$V(n,i,s)}function Qo(t,e){if(typeof t!="number")throw new Go.ERR_INVALID_ARG_TYPE(e,"number",t)}function ac(t,e,r){throw Math.floor(t)!==t?(Qo(t,r),new Go.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new Go.ERR_BUFFER_OUT_OF_BOUNDS:new Go.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var KV=/[^+/0-9A-Za-z-_]/g;function YV(t){if(t=t.split("=")[0],t=t.trim().replace(KV,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function OE(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 JV(t){let e=[];for(let r=0;r>8,i=r%256,s.push(i),s.push(n);return s}function ax(t){return TE.toByteArray(YV(t))}function Fh(t,e,r,n){let i;for(i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function dn(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function BE(t){return t!==t}var ZV=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 vi(t){return typeof BigInt>"u"?eH:t}function eH(){throw new Error("BigInt not supported")}});var cx=m((Hoe,ux)=>{c();ux.exports=LE;LE.supported=typeof WebAssembly<"u";function LE(t){if(!LE.supported)return null;var e=t&&t.imports,r=tH("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 tH(t){return typeof atob=="function"?new Uint8Array(atob(t).split("").map(rH)):new(_s()).Buffer(t,"base64")}function rH(t){return t.charCodeAt(0)}});var yx=m((Qoe,gn)=>{c();var pn=CE(),Ke=cx()(),jn=64,Mh=[];gn.exports=Or;var lx=gn.exports.BYTES_MIN=16,fx=gn.exports.BYTES_MAX=64,Goe=gn.exports.BYTES=32,hx=gn.exports.KEYBYTES_MIN=16,dx=gn.exports.KEYBYTES_MAX=64,koe=gn.exports.KEYBYTES=32,px=gn.exports.SALTBYTES=16,gx=gn.exports.PERSONALBYTES=16;function Or(t,e,r,n,i){if(!(this instanceof Or))return new Or(t,e,r,n,i);if(!(Ke&&Ke.exports))throw new Error("WASM not loaded. Wait for Blake2b.ready(cb)");t||(t=32),i!==!0&&(pn(t>=lx,"digestLength must be at least "+lx+", was given "+t),pn(t<=fx,"digestLength must be at most "+fx+", was given "+t),e!=null&&pn(e.length>=hx,"key must be at least "+hx+", was given "+e.length),e!=null&&pn(e.length<=dx,"key must be at least "+dx+", was given "+e.length),r!=null&&pn(r.length===px,"salt must be exactly "+px+", was given "+r.length),n!=null&&pn(n.length===gx,"personal must be exactly "+gx+", was given "+n.length)),Mh.length||(Mh.push(jn),jn+=216),this.digestLength=t,this.finalized=!1,this.pointer=Mh.pop(),Ke.memory.fill(0,0,64),Ke.memory[0]=this.digestLength,Ke.memory[1]=e?e.length:0,Ke.memory[2]=1,Ke.memory[3]=1,r&&Ke.memory.set(r,32),n&&Ke.memory.set(n,48),this.pointer+216>Ke.memory.length&&Ke.realloc(this.pointer+216),Ke.exports.blake2b_init(this.pointer,this.digestLength),e&&(this.update(e),Ke.memory.fill(0,jn,jn+e.length),Ke.memory[this.pointer+200]=128)}Or.prototype.update=function(t){return pn(this.finalized===!1,"Hash instance finalized"),pn(t,"input must be TypedArray or Buffer"),jn+t.length>Ke.memory.length&&Ke.realloc(jn+t.length),Ke.memory.set(t,jn),Ke.exports.blake2b_update(this.pointer,jn,jn+t.length),this};Or.prototype.digest=function(t){if(pn(this.finalized===!1,"Hash instance finalized"),this.finalized=!0,Mh.push(this.pointer),Ke.exports.blake2b_final(this.pointer),!t||t==="binary")return Ke.memory.slice(this.pointer+128,this.pointer+128+this.digestLength);if(t==="hex")return iH(Ke.memory,this.pointer+128,this.digestLength);pn(t.length>=this.digestLength,"input must be TypedArray or Buffer");for(var e=0;e{c();var _i=CE(),cc=yx();function Uh(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 mx(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 Ix(t,e){return t[e]^t[e+1]<<8^t[e+2]<<16^t[e+3]<<24}function Ai(t,e,r,n,i,s){var o=uc[i],a=uc[i+1],u=uc[s],l=uc[s+1];Uh(Te,t,e),mx(Te,t,o,a);var f=Te[n]^Te[t],d=Te[n+1]^Te[t+1];Te[n]=d,Te[n+1]=f,Uh(Te,r,n),f=Te[e]^Te[r],d=Te[e+1]^Te[r+1],Te[e]=f>>>24^d<<8,Te[e+1]=d>>>24^f<<8,Uh(Te,t,e),mx(Te,t,u,l),f=Te[n]^Te[t],d=Te[n+1]^Te[t+1],Te[n]=f>>>16^d<<16,Te[n+1]=d>>>16^f<<16,Uh(Te,r,n),f=Te[e]^Te[r],d=Te[e+1]^Te[r+1],Te[e]=d>>>31^f<<1,Te[e+1]=f>>>31^d<<1}var Sx=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),oH=[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],$t=new Uint8Array(oH.map(function(t){return t*2})),Te=new Uint32Array(32),uc=new Uint32Array(32);function Cx(t,e){var r=0;for(r=0;r<16;r++)Te[r]=t.h[r],Te[r+16]=Sx[r];for(Te[24]=Te[24]^t.t,Te[25]=Te[25]^t.t/4294967296,e&&(Te[28]=~Te[28],Te[29]=~Te[29]),r=0;r<32;r++)uc[r]=Ix(t.b,4*r);for(r=0;r<12;r++)Ai(0,8,16,24,$t[r*16+0],$t[r*16+1]),Ai(2,10,18,26,$t[r*16+2],$t[r*16+3]),Ai(4,12,20,28,$t[r*16+4],$t[r*16+5]),Ai(6,14,22,30,$t[r*16+6],$t[r*16+7]),Ai(0,10,20,30,$t[r*16+8],$t[r*16+9]),Ai(2,12,22,24,$t[r*16+10],$t[r*16+11]),Ai(4,14,16,26,$t[r*16+12],$t[r*16+13]),Ai(6,8,18,28,$t[r*16+14],$t[r*16+15]);for(r=0;r<16;r++)t.h[r]=t.h[r]^Te[r]^Te[r+16]}var bi=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);function zo(t,e,r,n){bi.fill(0),this.b=new Uint8Array(128),this.h=new Uint32Array(16),this.t=0,this.c=0,this.outlen=t,bi[0]=t,e&&(bi[1]=e.length),bi[2]=1,bi[3]=1,r&&bi.set(r,32),n&&bi.set(n,48);for(var i=0;i<16;i++)this.h[i]=Sx[i]^Ix(bi,i*4);e&&(Tx(this,e),this.c=128)}zo.prototype.update=function(t){return _i(t!=null,"input must be Uint8Array or Buffer"),Tx(this,t),this};zo.prototype.digest=function(t){var e=!t||t==="binary"||t==="hex"?new Uint8Array(this.outlen):t;return _i(e.length>=this.outlen,"out must have at least outlen bytes of space"),aH(this,e),t==="hex"?uH(e):e};zo.prototype.final=zo.prototype.digest;zo.ready=function(t){cc.ready(function(){t()})};function Tx(t,e){for(var r=0;r>2]>>8*(r&3);return e}function uH(t){for(var e="",r=0;r=Ex,"outlen must be at least "+Ex+", was given "+e),_i(e<=wx,"outlen must be at most "+wx+", was given "+e),r!=null&&_i(r.length>=vx,"key must be at least "+vx+", was given "+r.length),r!=null&&_i(r.length<=Ax,"key must be at most "+Ax+", was given "+r.length),n!=null&&_i(n.length===bx,"salt must be exactly "+bx+", was given "+n.length),i!=null&&_i(i.length===_x,"personal must be exactly "+_x+", was given "+i.length)),new xx(e,r,n,i)};lr.exports.ready=function(t){cc.ready(function(){t()})};lr.exports.WASM_SUPPORTED=cc.SUPPORTED;lr.exports.WASM_LOADED=!1;var Ex=lr.exports.BYTES_MIN=16,wx=lr.exports.BYTES_MAX=64,zoe=lr.exports.BYTES=32,vx=lr.exports.KEYBYTES_MIN=16,Ax=lr.exports.KEYBYTES_MAX=64,$oe=lr.exports.KEYBYTES=32,bx=lr.exports.SALTBYTES=16,_x=lr.exports.PERSONALBYTES=16;cc.ready(function(t){t||(lr.exports.WASM_LOADED=!0,xx=cc)})});var yn=m(Dr=>{"use strict";c();var lH=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]}),fH=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)&&lH(e,t,r);return fH(e,t),e};Object.defineProperty(Dr,"__esModule",{value:!0});Dr.TransactionHash=Dr.Transaction=void 0;var $o=jt(),lc=yt(),dH=Ch(),pH=ps(),gH=hH(Be()),yH=VC(),Gn=Th(),mH=jT(),Ox=Rh(),Dx=qn(),EH=gr(),wH=Nx(),vH=32,FE=class t{constructor({nonce:e,value:r,sender:n,receiver:i,senderUsername:s,receiverUsername:o,gasPrice:a,gasLimit:u,data:l,chainID:f,version:d,options:g,guardian:E}){this.nonce=e||0,this.value=r?new $o.BigNumber(r.toString()).toFixed(0):0,this.sender=n,this.receiver=i,this.senderUsername=s||"",this.receiverUsername=o||"",this.gasPrice=a||pH.TRANSACTION_MIN_GAS_PRICE,this.gasLimit=u,this.data=l||new Dx.TransactionPayload,this.chainID=f,this.version=d?new Gn.TransactionVersion(d.valueOf()):Gn.TransactionVersion.withDefaultVersion(),this.options=g?new Gn.TransactionOptions(g.valueOf()):Gn.TransactionOptions.withDefaultOptions(),this.guardian=E||lc.Address.empty(),this.signature=h.Buffer.from([]),this.guardianSignature=h.Buffer.from([]),this.hash=Ko.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 Gn.TransactionVersion(e.valueOf())}getOptions(){return new Gn.TransactionOptions(this.options.valueOf())}setOptions(e){this.options=new Gn.TransactionOptions(e.valueOf())}getSignature(){return this.signature}getGuardianSignature(){return this.guardianSignature}setGuardian(e){this.guardian=e}getHash(){return EH.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 dH.Compatibility.guardAddressIsSetAndNonZero(new lc.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 $o.BigNumber(e.value).toFixed(0),receiver:lc.Address.fromString(e.receiver),receiverUsername:e.receiverUsername?h.Buffer.from(e.receiverUsername,"base64").toString():void 0,sender:lc.Address.fromString(e.sender),senderUsername:e.senderUsername?h.Buffer.from(e.senderUsername,"base64").toString():void 0,guardian:e.guardian?lc.Address.fromString(e.guardian):void 0,gasPrice:Number(e.gasPrice),gasLimit:Number(e.gasLimit),data:new Dx.TransactionPayload(h.Buffer.from(e.data||"","base64")),chainID:String(e.chainID),version:new Gn.TransactionVersion(e.version),options:e.options!=null?new Gn.TransactionOptions(e.options):void 0});return e.signature&&r.applySignature(new Ox.Signature(e.signature)),e.guardianSignature&&r.applyGuardianSignature(new Ox.Signature(e.guardianSignature)),r}applySignature(e){this.signature=this.interpretSignatureAsBuffer(e),this.hash=Ko.compute(this)}interpretSignatureAsBuffer(e){if(ArrayBuffer.isView(e))return h.Buffer.from(e);if(e.hex!=null)return h.Buffer.from(e.hex(),"hex");throw new Error(`Object cannot be interpreted as a signature: ${e}`)}applyGuardianSignature(e){this.guardianSignature=this.interpretSignatureAsBuffer(e),this.hash=Ko.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 gH.ErrNotEnoughGas(this.gasLimit.valueOf());let n=new $o.BigNumber(this.gasPrice.valueOf()),i=new $o.BigNumber(r).multipliedBy(n);if(r===this.gasLimit.valueOf())return i;let s=new $o.BigNumber(this.gasLimit.valueOf()-r),o=n.multipliedBy(new $o.BigNumber(e.GasPriceModifier.valueOf())),a=s.multipliedBy(o);return i.plus(a)}};Dr.Transaction=FE;var Ko=class t extends yH.Hash{constructor(e){super(e)}static compute(e){let n=new mH.ProtoSerializer().serializeTransaction(e),i=wH(vH).update(n).digest("hex");return new t(i)}};Dr.TransactionHash=Ko});var VE=m(Vh=>{"use strict";c();Object.defineProperty(Vh,"__esModule",{value:!0});Vh.TransferTransactionsFactory=void 0;var ME=Vo(),kr=Ot(),qh=yn(),UE=qn(),qE=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 qh.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([kr.BytesValue.fromUTF8(e.tokenTransfer.tokenIdentifier),new kr.BigUIntValue(e.tokenTransfer.valueOf())]),n=`ESDTTransfer@${r}`,i=new UE.TransactionPayload(n),s=i.length()||0,o=this.gasEstimator.forESDTTransfer(s);return new qh.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([kr.BytesValue.fromUTF8(e.tokenTransfer.tokenIdentifier),new kr.U64Value(e.tokenTransfer.nonce),new kr.BigUIntValue(e.tokenTransfer.valueOf()),new kr.AddressValue(e.destination)]),n=`ESDTNFTTransfer@${r}`,i=new UE.TransactionPayload(n),s=i.length()||0,o=this.gasEstimator.forESDTNFTTransfer(s);return new qh.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 kr.AddressValue(e.destination),new kr.U16Value(e.tokenTransfers.length)];for(let u of e.tokenTransfers)r.push(kr.BytesValue.fromUTF8(u.tokenIdentifier),new kr.U64Value(u.nonce),new kr.BigUIntValue(u.valueOf()));let{argumentsString:n}=new ME.ArgSerializer().valuesToString(r),i=`MultiESDTNFTTransfer@${n}`,s=new UE.TransactionPayload(i),o=s.length()||0,a=this.gasEstimator.forMultiESDTNFTTransfer(o,e.tokenTransfers.length);return new qh.Transaction({nonce:e.nonce,receiver:e.sender,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||a,data:s,chainID:e.chainID})}};Vh.TransferTransactionsFactory=qE});var jE=m(Is=>{"use strict";c();Object.defineProperty(Is,"__esModule",{value:!0});Is.GasEstimator=Is.DefaultGasConfiguration=void 0;Is.DefaultGasConfiguration={minGasLimit:5e4,gasPerDataByte:1500,gasCostESDTTransfer:2e5,gasCostESDTNFTTransfer:2e5,gasCostESDTNFTMultiTransfer:2e5};var AH=1e5,Px=8e5,HE=class{constructor(e){this.gasConfiguration=e||Is.DefaultGasConfiguration}forEGLDTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasPerDataByte*e}forESDTTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasCostESDTTransfer+this.gasConfiguration.gasPerDataByte*e+AH}forESDTNFTTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasCostESDTNFTTransfer+this.gasConfiguration.gasPerDataByte*e+Px}forMultiESDTNFTTransfer(e,r){return this.gasConfiguration.minGasLimit+(this.gasConfiguration.gasCostESDTNFTMultiTransfer+Px)*r+this.gasConfiguration.gasPerDataByte*e}};Is.GasEstimator=HE});var Ss=m(Hh=>{"use strict";c();Object.defineProperty(Hh,"__esModule",{value:!0});Hh.Account=void 0;var bH=yt(),GE=class{constructor(e){this.address=new bH.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()}}};Hh.Account=GE});var Yo=m(Ts=>{"use strict";c();Object.defineProperty(Ts,"__esModule",{value:!0});Ts.Logger=Ts.LogLevel=void 0;var Cs;(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"})(Cs=Ts.LogLevel||(Ts.LogLevel={}));var jh=class t{static setLevel(e){t.logLevel=e}static trace(e,...r){t.logLevel>=Cs.Debug||console.debug(e,r)}static debug(e,...r){t.logLevel>=Cs.Debug||console.debug(e,r)}static info(e,...r){t.logLevel>=Cs.Info||console.log(e,r)}static warn(e,...r){t.logLevel>=Cs.Warn||console.warn(e,r)}static error(e,...r){t.logLevel>=Cs.Error||console.error(e,r)}};Ts.Logger=jh;jh.logLevel=Cs.Debug});var WE=m(mn=>{"use strict";c();var _H=mn&&mn.__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]}),IH=mn&&mn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SH=mn&&mn.__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 IH(e,t),e};Object.defineProperty(mn,"__esModule",{value:!0});mn.AsyncTimer=void 0;var CH=SH(Be()),TH=Be(),kE=Yo(),QE=class{constructor(e){this.timeoutHandle=null,this.rejectionFunc=null,this.name=e,this.correlationTag=0}start(e){if(this.timeoutHandle)throw new CH.ErrAsyncTimerAlreadyRunning;return this.correlationTag++,kE.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(){kE.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].abort()`),this.rejectionFunc&&(this.rejectionFunc(new TH.ErrAsyncTimerAborted),this.rejectionFunc=null),this.stop()}stop(){this.isStopped()||(kE.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].stop()`),this.timeoutHandle&&(clearTimeout(this.timeoutHandle),this.timeoutHandle=null))}isStopped(){return!this.timeoutHandle}};mn.AsyncTimer=QE});var Gh=m(Xo=>{"use strict";c();var Pr=Xo&&Xo.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(Xo,"__esModule",{value:!0});Xo.TransactionWatcher=void 0;var zE=WE(),Jo=Be(),Rx=Yo(),Ii=class t{constructor(e,r={}){this.fetcher=new $E(e),this.pollingIntervalMilliseconds=r.pollingIntervalMilliseconds||t.DefaultPollingInterval,this.timeoutMilliseconds=r.timeoutMilliseconds||t.DefaultTimeout,this.patienceMilliseconds=r.patienceMilliseconds||t.DefaultPatience}awaitPending(e){return Pr(this,void 0,void 0,function*(){let r=s=>s.status.isPending(),n=()=>Pr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),i=()=>new Jo.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)})}awaitCompleted(e){return Pr(this,void 0,void 0,function*(){let r=s=>s.isCompleted,n=()=>Pr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),i=()=>new Jo.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)})}awaitAllEvents(e,r){return Pr(this,void 0,void 0,function*(){let n=o=>{let a=this.getAllTransactionEvents(o).map(l=>l.identifier);return r.every(l=>a.includes(l))},i=()=>Pr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),s=()=>new Jo.ErrExpectedTransactionEventsNotFound;return this.awaitConditionally(n,i,s)})}awaitAnyEvent(e,r){return Pr(this,void 0,void 0,function*(){let n=o=>{let a=this.getAllTransactionEvents(o).map(l=>l.identifier);return r.find(l=>a.includes(l))!=null},i=()=>Pr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),s=()=>new Jo.ErrExpectedTransactionEventsNotFound;return this.awaitConditionally(n,i,s)})}awaitOnCondition(e,r){return Pr(this,void 0,void 0,function*(){let n=()=>Pr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),i=()=>new Jo.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)})}awaitConditionally(e,r,n){return Pr(this,void 0,void 0,function*(){let i=new zE.AsyncTimer("watcher:periodic"),s=new zE.AsyncTimer("watcher:patience"),o=new zE.AsyncTimer("watcher:timeout"),a=!1,u,l=!1;for(o.start(this.timeoutMilliseconds).finally(()=>{o.stop(),a=!0});!a;){yield i.start(this.pollingIntervalMilliseconds);try{if(u=yield r(),l=e(u),l||a)break}catch(f){if(Rx.Logger.debug("TransactionWatcher.awaitConditionally(): cannot (yet) fetch data."),!(f instanceof Jo.Err))throw f}}if(l&&(yield s.start(this.patienceMilliseconds)),o.isStopped()||o.stop(),!u||!l)throw n();return u})}getAllTransactionEvents(e){let r=[...e.logs.events];for(let n of e.contractResults.items)r.push(...n.logs.events);return r}};Xo.TransactionWatcher=Ii;Ii.DefaultPollingInterval=6e3;Ii.DefaultTimeout=Ii.DefaultPollingInterval*15;Ii.DefaultPatience=0;Ii.NoopOnStatusReceived=t=>{};var $E=class{constructor(e){this.fetcher=e}getTransaction(e){return Pr(this,void 0,void 0,function*(){return Rx.Logger.debug(`transactionWatcher, getTransaction(${e})`),yield this.fetcher.getTransaction(e)})}}});var YE=m(Wh=>{"use strict";c();Object.defineProperty(Wh,"__esModule",{value:!0});Wh.CodeMetadata=void 0;var KE=class{constructor(e=!0,r=!1,n=!1,i=!1){this.upgradeable=e,this.readable=r,this.payable=n,this.payableBySc=i}toggleUpgradeable(e){this.upgradeable=e}toggleReadable(e){this.readable=e}togglePayable(e){this.payable=e}togglePayableBySc(e){this.payableBySc=e}toBuffer(){let e=0,r=0;return this.upgradeable&&(e|=kh.Upgradeable),this.readable&&(e|=kh.Readable),this.payable&&(r|=Qh.Payable),this.payableBySc&&(r|=Qh.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}};Wh.CodeMetadata=KE;var kh;(function(t){t[t.Upgradeable=1]="Upgradeable",t[t.Reserved2=2]="Reserved2",t[t.Readable=4]="Readable"})(kh||(kh={}));var Qh;(function(t){t[t.Reserved1=1]="Reserved1",t[t.Payable=2]="Payable",t[t.PayableBySc=4]="PayableBySc"})(Qh||(Qh={}))});var fc=m(En=>{"use strict";c();var xH=En&&En.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),NH=En&&En.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),OH=En&&En.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&xH(e,t,r);return NH(e,t),e};Object.defineProperty(En,"__esModule",{value:!0});En.ContractFunction=void 0;var DH=OH(Be()),JE=class t{constructor(e){if(this.name=e,e==null)throw new DH.ErrInvalidFunctionName}static none(){return new t("untitled")}toString(){return this.name}valueOf(){return this.name}};En.ContractFunction=JE});var ew=m(Rr=>{"use strict";c();var PH=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]}),RH=Rr&&Rr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),BH=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)&&PH(e,t,r);return RH(e,t),e},LH=Rr&&Rr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Rr,"__esModule",{value:!0});Rr.InteractionChecker=void 0;var XE=BH(Be()),FH=LH(jt()),ZE=class{checkInteraction(e,r){this.checkPayable(e,r),this.checkArguments(e,r)}checkPayable(e,r){let n=!new FH.default(e.getValue().toString()).isZero(),i=r.modifiers.isPayableInEGLD();if(n&&!i)throw new XE.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 XE.ErrContractInteraction(`bad arguments, expected: ${s}, got: ${o}`);for(let a=0;a{"use strict";c();Object.defineProperty(zh,"__esModule",{value:!0});zh.Query=void 0;var MH=yt(),UH=Vo(),tw=class{constructor(e){this.caller=e.caller||new MH.Address,this.address=e.address,this.func=e.func,this.args=e.args||[],this.value=e.value||0}getEncodedArguments(){return new UH.ArgSerializer().valuesToStrings(this.args)}};zh.Query=tw});var sw=m($h=>{"use strict";c();Object.defineProperty($h,"__esModule",{value:!0});$h.Interaction=void 0;var Bx=yt(),qH=Ch(),rw=ps(),nw=fc(),VH=ew(),HH=hc(),Zo=Ot(),iw=class{constructor(e,r,n){this.nonce=0,this.value="0",this.gasLimit=0,this.gasPrice=void 0,this.chainID="",this.querent=new Bx.Address,this.sender=new Bx.Address,this.isWithSingleESDTTransfer=!1,this.isWithSingleESDTNFTTransfer=!1,this.isWithMultiESDTNFTTransfer=!1,this.contract=e,this.function=r,this.args=n,this.tokenTransfers=new ea([],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(){qH.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 nw.ContractFunction(rw.ESDT_TRANSFER_FUNCTION_NAME),n=this.tokenTransfers.buildArgsForSingleESDTTransfer()):this.isWithSingleESDTNFTTransfer?(e=this.sender,r=new nw.ContractFunction(rw.ESDTNFT_TRANSFER_FUNCTION_NAME),n=this.tokenTransfers.buildArgsForSingleESDTNFTTransfer()):this.isWithMultiESDTNFTTransfer&&(e=this.sender,r=new nw.ContractFunction(rw.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 HH.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 ea([e],this),this}withSingleESDTNFTTransfer(e,r){return this.isWithSingleESDTNFTTransfer=!0,this.tokenTransfers=new ea([e],this),r&&(this.sender=r),this}withMultiESDTNFTTransfer(e,r){return this.isWithMultiESDTNFTTransfer=!0,this.tokenTransfers=new ea(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 VH.InteractionChecker().checkInteraction(this,this.getEndpoint()),this}};$h.Interaction=iw;var ea=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 Zo.U8Value(this.transfers.length)}getTypedTokenIdentifier(e){return Zo.BytesValue.fromUTF8(e.tokenIdentifier)}getTypedTokenNonce(e){return new Zo.U64Value(e.nonce)}getTypedTokenQuantity(e){return new Zo.BigUIntValue(e.amountAsBigInteger)}getTypedTokensReceiver(){return new Zo.AddressValue(this.interaction.getContractAddress())}getTypedInteractionFunction(){return Zo.BytesValue.fromUTF8(this.interaction.getFunction().valueOf())}getInteractionArguments(){return this.interaction.getArguments()}}});var Lx=m(Kh=>{"use strict";c();Object.defineProperty(Kh,"__esModule",{value:!0});Kh.ArgumentErrorContext=void 0;var jH=Be(),ow=class{constructor(e,r,n){this.endpointName=e,this.argumentIndex=r,this.parameterDefinition=n}throwError(e){throw new jH.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)})`)}};Kh.ArgumentErrorContext=ow});var aw=m(xs=>{"use strict";c();var GH=xs&&xs.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(xs,"__esModule",{value:!0});xs.NativeSerializer=void 0;var kH=GH(jt()),QH=yt(),Fx=Be(),WH=rh(),zH=Lx(),Ae=Ot(),$H;(function(t){function e(_,I){_=_||[],_=r(_,I);let S=I.input,R=[];for(let B=0;B0&&I[0].type.getCardinality().isComposite()&&(R=1/0,B=!0);for(let b of I){if(b.type.getCardinality().isSingular())break;S-=1}return{min:S,max:R,variadic:B}}function i(_,I,S){if(_&&_.belongsToTypesystem)return _;if(I instanceof Ae.OptionType)return s(_,I,S);if(I instanceof Ae.OptionalType)return o(_,I,S);if(I instanceof Ae.VariadicType)return a(_,I,S);if(I instanceof Ae.CompositeType)return l(_,I,S);if(I instanceof Ae.TupleType)return f(_,I,S);if(I instanceof Ae.StructType)return d(_,I,S);if(I instanceof Ae.ListType)return u(_,I,S);if(I instanceof Ae.PrimitiveType)return g(_,I,S);if(I instanceof Ae.EnumType)return E(_,I,S);S.throwError(`convertToTypedValue: unhandled type ${I}`)}function s(_,I,S){if(_==null)return Ae.OptionValue.newMissing();let R=i(_,I.getFirstTypeParameter(),S);return Ae.OptionValue.newProvided(R)}function o(_,I,S){if(_==null)return new Ae.OptionalValue(I);let R=i(_,I.getFirstTypeParameter(),S);return new Ae.OptionalValue(I,R)}function a(_,I,S){_==null&&(_=[]),_.map===void 0&&S.convertError(_,"Variadic");let R=_.map(function(B){return i(B,I.getFirstTypeParameter(),S)});return new Ae.VariadicValue(I,R)}function u(_,I,S){_.map===void 0&&S.convertError(_,"List");let R=_.map(function(B){return i(B,I.getFirstTypeParameter(),S)});return new Ae.List(I,R)}function l(_,I,S){let R=[],B=I.getTypeParameters();S.guardSameLength(_,B);for(let b=0;b{"use strict";c();Object.defineProperty(Qr,"__esModule",{value:!0});Qr.ContractCallPayloadBuilder=Qr.ContractUpgradePayloadBuilder=Qr.ContractDeployPayloadBuilder=Qr.ArwenVirtualMachine=void 0;var fw=qn(),hw=gr(),KH=Vo();Qr.ArwenVirtualMachine="0500";var uw=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(){hw.guardValueIsSet("code",this.code);let e=this.code.toString(),r=this.codeMetadata.toString(),n=`${e}@${Qr.ArwenVirtualMachine}@${r}`;return n=dw(n,this.arguments),new fw.TransactionPayload(n)}};Qr.ContractDeployPayloadBuilder=uw;var cw=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(){hw.guardValueIsSet("code",this.code);let e=this.code.toString(),r=this.codeMetadata.toString(),n=`upgradeContract@${e}@${r}`;return n=dw(n,this.arguments),new fw.TransactionPayload(n)}};Qr.ContractUpgradePayloadBuilder=cw;var lw=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(){hw.guardValueIsSet("calledFunction",this.contractFunction);let e=this.contractFunction.name;return e=dw(e,this.arguments),new fw.TransactionPayload(e)}};Qr.ContractCallPayloadBuilder=lw;function dw(t,e){let{argumentsString:r,count:n}=new KH.ArgSerializer().valuesToString(e);return n==0?t:`${t}@${r}`}});var kn=m((Tae,gw)=>{"use strict";c();var ta=typeof Reflect=="object"?Reflect:null,Mx=ta&&typeof ta.apply=="function"?ta.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},Yh;ta&&typeof ta.ownKeys=="function"?Yh=ta.ownKeys:Object.getOwnPropertySymbols?Yh=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Yh=function(e){return Object.getOwnPropertyNames(e)};function YH(t){console&&console.warn&&console.warn(t)}var qx=Number.isNaN||function(e){return e!==e};function ke(){ke.init.call(this)}gw.exports=ke;gw.exports.once=ej;ke.EventEmitter=ke;ke.prototype._events=void 0;ke.prototype._eventsCount=0;ke.prototype._maxListeners=void 0;var Ux=10;function Jh(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(ke,"defaultMaxListeners",{enumerable:!0,get:function(){return Ux},set:function(t){if(typeof t!="number"||t<0||qx(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Ux=t}});ke.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};ke.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||qx(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 Vx(t){return t._maxListeners===void 0?ke.defaultMaxListeners:t._maxListeners}ke.prototype.getMaxListeners=function(){return Vx(this)};ke.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")Mx(u,this,r);else for(var l=u.length,f=Qx(u,l),n=0;n0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,YH(a)}return t}ke.prototype.addListener=function(e,r){return Hx(this,e,r,!1)};ke.prototype.on=ke.prototype.addListener;ke.prototype.prependListener=function(e,r){return Hx(this,e,r,!0)};function JH(){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 jx(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=JH.bind(n);return i.listener=r,n.wrapFn=i,i}ke.prototype.once=function(e,r){return Jh(r),this.on(e,jx(this,e,r)),this};ke.prototype.prependOnceListener=function(e,r){return Jh(r),this.prependListener(e,jx(this,e,r)),this};ke.prototype.removeListener=function(e,r){var n,i,s,o,a;if(Jh(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():XH(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};ke.prototype.off=ke.prototype.removeListener;ke.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 Gx(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?ZH(i):Qx(i,i.length)}ke.prototype.listeners=function(e){return Gx(this,e,!0)};ke.prototype.rawListeners=function(e){return Gx(this,e,!1)};ke.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):kx.call(t,e)};ke.prototype.listenerCount=kx;function kx(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}ke.prototype.eventNames=function(){return this._eventsCount>0?Yh(this._events):[]};function Qx(t,e){for(var r=new Array(e),n=0;n{c();zx.exports=kn().EventEmitter});var mw=m(()=>{c()});var Zx=m((Bae,Xx)=>{"use strict";c();function $x(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 Kx(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 Xh.alloc(0);for(var n=Xh.allocUnsafe(r>>>0),i=this.head,s=0;i;)cj(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=Xh.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:uj,value:function(r,n){return Ew(this,Kx(Kx({},n),{},{depth:0,customInspect:!1}))}}]),t}()});var vw=m((Fae,tN)=>{"use strict";c();function lj(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(ww,this,t)):p.default.nextTick(ww,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(Zh,r):(r._writableState.errorEmitted=!0,p.default.nextTick(eN,r,s)):p.default.nextTick(eN,r,s):e?(p.default.nextTick(Zh,r),e(s)):p.default.nextTick(Zh,r)}),this)}function eN(t,e){ww(t,e),Zh(t)}function Zh(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function fj(){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 ww(t,e){t.emit("error",e)}function hj(t,e){var r=t._readableState,n=t._writableState;r&&r.autoDestroy||n&&n.autoDestroy?t.destroy(e):t.emit("error",e)}tN.exports={destroy:lj,undestroy:fj,errorOrDestroy:hj}});var Ns=m((Uae,iN)=>{"use strict";c();function dj(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var nN={};function Br(t,e,r){r||(r=Error);function n(s,o,a){return typeof e=="string"?e:e(s,o,a)}var i=function(s){dj(o,s);function o(a,u,l){return s.call(this,n(a,u,l))||this}return o}(r);i.prototype.name=r.name,i.prototype.code=t,nN[t]=i}function rN(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 pj(t,e,r){return t.substr(!r||r<0?0:+r,e.length)===e}function gj(t,e,r){return(r===void 0||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}function yj(t,e,r){return typeof r!="number"&&(r=0),r+e.length>t.length?!1:t.indexOf(e,r)!==-1}Br("ERR_INVALID_OPT_VALUE",function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'},TypeError);Br("ERR_INVALID_ARG_TYPE",function(t,e,r){var n;typeof e=="string"&&pj(e,"not ")?(n="must not be",e=e.replace(/^not /,"")):n="must be";var i;if(gj(t," argument"))i="The ".concat(t," ").concat(n," ").concat(rN(e,"type"));else{var s=yj(t,".")?"property":"argument";i='The "'.concat(t,'" ').concat(s," ").concat(n," ").concat(rN(e,"type"))}return i+=". Received type ".concat(typeof r),i},TypeError);Br("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");Br("ERR_METHOD_NOT_IMPLEMENTED",function(t){return"The "+t+" method is not implemented"});Br("ERR_STREAM_PREMATURE_CLOSE","Premature close");Br("ERR_STREAM_DESTROYED",function(t){return"Cannot call "+t+" after a stream was destroyed"});Br("ERR_MULTIPLE_CALLBACK","Callback called multiple times");Br("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");Br("ERR_STREAM_WRITE_AFTER_END","write after end");Br("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Br("ERR_UNKNOWN_ENCODING",function(t){return"Unknown encoding: "+t},TypeError);Br("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");iN.exports.codes=nN});var Aw=m((Vae,sN)=>{"use strict";c();var mj=Ns().codes.ERR_INVALID_OPT_VALUE;function Ej(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function wj(t,e,r,n){var i=Ej(e,n,r);if(i!=null){if(!(isFinite(i)&&Math.floor(i)===i)||i<0){var s=n?r:"highWaterMark";throw new mj(s,i)}return Math.floor(i)}return t.objectMode?16:16*1024}sN.exports={getHighWaterMark:wj}});var ra=m((jae,bw)=>{c();typeof Object.create=="function"?bw.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:bw.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 aN=m((kae,oN)=>{c();oN.exports=vj;function vj(t,e){if(_w("noDeprecation"))return t;var r=!1;function n(){if(!r){if(_w("throwDeprecation"))throw new Error(e);_w("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}return n}function _w(t){try{if(!global.localStorage)return!1}catch{return!1}var e=global.localStorage[t];return e==null?!1:String(e).toLowerCase()==="true"}});var Cw=m((Wae,dN)=>{"use strict";c();dN.exports=ht;function cN(t){var e=this;this.next=null,this.entry=null,this.finish=function(){zj(e,t)}}var na;ht.WritableState=pc;var Aj={deprecate:aN()},lN=yw(),td=_s().Buffer,bj=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function _j(t){return td.from(t)}function Ij(t){return td.isBuffer(t)||t instanceof bj}var Sw=vw(),Sj=Aw(),Cj=Sj.getHighWaterMark,Si=Ns().codes,Tj=Si.ERR_INVALID_ARG_TYPE,xj=Si.ERR_METHOD_NOT_IMPLEMENTED,Nj=Si.ERR_MULTIPLE_CALLBACK,Oj=Si.ERR_STREAM_CANNOT_PIPE,Dj=Si.ERR_STREAM_DESTROYED,Pj=Si.ERR_STREAM_NULL_VALUES,Rj=Si.ERR_STREAM_WRITE_AFTER_END,Bj=Si.ERR_UNKNOWN_ENCODING,ia=Sw.errorOrDestroy;ra()(ht,lN);function Lj(){}function pc(t,e,r){na=na||Os(),t=t||{},typeof r!="boolean"&&(r=e instanceof na),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=Cj(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){jj(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 cN(this)}pc.prototype.getBuffer=function(){for(var e=this.bufferedRequest,r=[];e;)r.push(e),e=e.next;return r};(function(){try{Object.defineProperty(pc.prototype,"buffer",{get:Aj.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var ed;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(ed=Function.prototype[Symbol.hasInstance],Object.defineProperty(ht,Symbol.hasInstance,{value:function(e){return ed.call(this,e)?!0:this!==ht?!1:e&&e._writableState instanceof pc}})):ed=function(e){return e instanceof this};function ht(t){na=na||Os();var e=this instanceof na;if(!e&&!ed.call(ht,this))return new ht(t);this._writableState=new pc(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)),lN.call(this)}ht.prototype.pipe=function(){ia(this,new Oj)};function Fj(t,e){var r=new Rj;ia(t,r),p.default.nextTick(e,r)}function Mj(t,e,r,n){var i;return r===null?i=new Pj:typeof r!="string"&&!e.objectMode&&(i=new Tj("chunk",["string","Buffer"],r)),i?(ia(t,i),p.default.nextTick(n,i),!1):!0}ht.prototype.write=function(t,e,r){var n=this._writableState,i=!1,s=!n.objectMode&&Ij(t);return s&&!td.isBuffer(t)&&(t=_j(t)),typeof e=="function"&&(r=e,e=null),s?e="buffer":e||(e=n.defaultEncoding),typeof r!="function"&&(r=Lj),n.ending?Fj(this,r):(s||Mj(this,n,t,r))&&(n.pendingcb++,i=qj(this,n,s,t,e,r)),i};ht.prototype.cork=function(){this._writableState.corked++};ht.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,!t.writing&&!t.corked&&!t.bufferProcessing&&t.bufferedRequest&&fN(this,t))};ht.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 Bj(e);return this._writableState.defaultEncoding=e,this};Object.defineProperty(ht.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function Uj(t,e,r){return!t.objectMode&&t.decodeStrings!==!1&&typeof e=="string"&&(e=td.from(e,r)),e}Object.defineProperty(ht.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function qj(t,e,r,n,i,s){if(!r){var o=Uj(e,n,i);n!==o&&(r=!0,i="buffer",n=o)}var a=e.objectMode?1:n.length;e.length+=a;var u=e.length{"use strict";c();var $j=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};gN.exports=wn;var pN=Nw(),xw=Cw();ra()(wn,pN);for(Tw=$j(xw.prototype),rd=0;rd{c();var id=_s(),vn=id.Buffer;function yN(t,e){for(var r in t)e[r]=t[r]}vn.from&&vn.alloc&&vn.allocUnsafe&&vn.allocUnsafeSlow?mN.exports=id:(yN(id,Ow),Ow.Buffer=Ds);function Ds(t,e,r){return vn(t,e,r)}Ds.prototype=Object.create(vn.prototype);yN(vn,Ds);Ds.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return vn(t,e,r)};Ds.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=vn(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};Ds.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return vn(t)};Ds.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return id.SlowBuffer(t)}});var Rw=m(vN=>{"use strict";c();var Pw=EN().Buffer,wN=Pw.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 Jj(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 Xj(t){var e=Jj(t);if(typeof e!="string"&&(Pw.isEncoding===wN||!wN(t)))throw new Error("Unknown encoding: "+t);return e||t}vN.StringDecoder=gc;function gc(t){this.encoding=Xj(t);var e;switch(this.encoding){case"utf16le":this.text=iG,this.end=sG,e=4;break;case"utf8":this.fillLast=tG,e=4;break;case"base64":this.text=oG,this.end=aG,e=3;break;default:this.write=uG,this.end=cG;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Pw.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 Zj(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 eG(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 tG(t){var e=this.lastTotal-this.lastNeed,r=eG(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 rG(t,e){var r=Zj(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 nG(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function iG(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 sG(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 oG(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 aG(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function uG(t){return t.toString(this.encoding)}function cG(t){return t&&t.length?this.write(t):""}});var sd=m((Zae,_N)=>{"use strict";c();var AN=Ns().codes.ERR_STREAM_PREMATURE_CLOSE;function lG(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,n=new Array(r),i=0;i{"use strict";c();var od;function Ci(t,e,r){return e=dG(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function dG(t){var e=pG(t,"string");return typeof e=="symbol"?e:String(e)}function pG(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 gG=sd(),Ti=Symbol("lastResolve"),Ps=Symbol("lastReject"),yc=Symbol("error"),ad=Symbol("ended"),Rs=Symbol("lastPromise"),Bw=Symbol("handlePromise"),Bs=Symbol("stream");function xi(t,e){return{value:t,done:e}}function yG(t){var e=t[Ti];if(e!==null){var r=t[Bs].read();r!==null&&(t[Rs]=null,t[Ti]=null,t[Ps]=null,e(xi(r,!1)))}}function mG(t){p.default.nextTick(yG,t)}function EG(t,e){return function(r,n){t.then(function(){if(e[ad]){r(xi(void 0,!0));return}e[Bw](r,n)},n)}}var wG=Object.getPrototypeOf(function(){}),vG=Object.setPrototypeOf((od={get stream(){return this[Bs]},next:function(){var e=this,r=this[yc];if(r!==null)return Promise.reject(r);if(this[ad])return Promise.resolve(xi(void 0,!0));if(this[Bs].destroyed)return new Promise(function(o,a){p.default.nextTick(function(){e[yc]?a(e[yc]):o(xi(void 0,!0))})});var n=this[Rs],i;if(n)i=new Promise(EG(n,this));else{var s=this[Bs].read();if(s!==null)return Promise.resolve(xi(s,!1));i=new Promise(this[Bw])}return this[Rs]=i,i}},Ci(od,Symbol.asyncIterator,function(){return this}),Ci(od,"return",function(){var e=this;return new Promise(function(r,n){e[Bs].destroy(null,function(i){if(i){n(i);return}r(xi(void 0,!0))})})}),od),wG),AG=function(e){var r,n=Object.create(vG,(r={},Ci(r,Bs,{value:e,writable:!0}),Ci(r,Ti,{value:null,writable:!0}),Ci(r,Ps,{value:null,writable:!0}),Ci(r,yc,{value:null,writable:!0}),Ci(r,ad,{value:e._readableState.endEmitted,writable:!0}),Ci(r,Bw,{value:function(s,o){var a=n[Bs].read();a?(n[Rs]=null,n[Ti]=null,n[Ps]=null,s(xi(a,!1))):(n[Ti]=s,n[Ps]=o)},writable:!0}),r));return n[Rs]=null,gG(e,function(i){if(i&&i.code!=="ERR_STREAM_PREMATURE_CLOSE"){var s=n[Ps];s!==null&&(n[Rs]=null,n[Ti]=null,n[Ps]=null,s(i)),n[yc]=i;return}var o=n[Ti];o!==null&&(n[Rs]=null,n[Ti]=null,n[Ps]=null,o(xi(void 0,!0))),n[ad]=!0}),e.on("readable",mG.bind(null,n)),n};IN.exports=AG});var TN=m((nue,CN)=>{c();CN.exports=function(){throw new Error("Readable.from is not available in the browser")}});var Nw=m((oue,MN)=>{"use strict";c();MN.exports=Me;var sa;Me.ReadableState=DN;var sue=kn().EventEmitter,ON=function(e,r){return e.listeners(r).length},Ec=yw(),ud=_s().Buffer,bG=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function _G(t){return ud.from(t)}function IG(t){return ud.isBuffer(t)||t instanceof bG}var Lw=mw(),xe;Lw&&Lw.debuglog?xe=Lw.debuglog("stream"):xe=function(){};var SG=Zx(),jw=vw(),CG=Aw(),TG=CG.getHighWaterMark,cd=Ns().codes,xG=cd.ERR_INVALID_ARG_TYPE,NG=cd.ERR_STREAM_PUSH_AFTER_EOF,OG=cd.ERR_METHOD_NOT_IMPLEMENTED,DG=cd.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,oa,Fw,Mw;ra()(Me,Ec);var mc=jw.errorOrDestroy,Uw=["error","close","destroy","pause","resume"];function PG(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 DN(t,e,r){sa=sa||Os(),t=t||{},typeof r!="boolean"&&(r=e instanceof sa),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=TG(this,t,"readableHighWaterMark",r),this.buffer=new SG,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&&(oa||(oa=Rw().StringDecoder),this.decoder=new oa(t.encoding),this.encoding=t.encoding)}function Me(t){if(sa=sa||Os(),!(this instanceof Me))return new Me(t);var e=this instanceof sa;this._readableState=new DN(t,this,e),this.readable=!0,t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy)),Ec.call(this)}Object.defineProperty(Me.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}});Me.prototype.destroy=jw.destroy;Me.prototype._undestroy=jw.undestroy;Me.prototype._destroy=function(t,e){e(t)};Me.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=ud.from(t,e),e=""),n=!0),PN(this,t,e,!1,n)};Me.prototype.unshift=function(t){return PN(this,t,null,!0,!1)};function PN(t,e,r,n,i){xe("readableAddChunk",e);var s=t._readableState;if(e===null)s.reading=!1,LG(t,s);else{var o;if(i||(o=RG(s,e)),o)mc(t,o);else if(s.objectMode||e&&e.length>0)if(typeof e!="string"&&!s.objectMode&&Object.getPrototypeOf(e)!==ud.prototype&&(e=_G(e)),n)s.endEmitted?mc(t,new DG):qw(t,s,e,!0);else if(s.ended)mc(t,new NG);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(e=s.decoder.write(e),s.objectMode||e.length!==0?qw(t,s,e,!1):Hw(t,s)):qw(t,s,e,!1)}else n||(s.reading=!1,Hw(t,s))}return!s.ended&&(s.length=xN?t=xN:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}function NN(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=BG(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}Me.prototype.read=function(t){xe("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(t!==0&&(e.emittedReadable=!1),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return xe("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?Vw(this):ld(this),null;if(t=NN(t,e),t===0&&e.ended)return e.length===0&&Vw(this),null;var n=e.needReadable;xe("need readable",n),(e.length===0||e.length-t0?i=LN(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&&Vw(this)),i!==null&&this.emit("data",i),i};function LG(t,e){if(xe("onEofChunk"),!e.ended){if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?ld(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,RN(t)))}}function ld(t){var e=t._readableState;xe("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(xe("emitReadable",e.flowing),e.emittedReadable=!0,p.default.nextTick(RN,t))}function RN(t){var e=t._readableState;xe("emitReadable_",e.destroyed,e.length,e.ended),!e.destroyed&&(e.length||e.ended)&&(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,Gw(t)}function Hw(t,e){e.readingMore||(e.readingMore=!0,p.default.nextTick(FG,t,e))}function FG(t,e){for(;!e.reading&&!e.ended&&(e.length1&&FN(n.pipes,t)!==-1)&&!l&&(xe("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function g(O){xe("onerror",O),N(),t.removeListener("error",g),ON(t,"error")===0&&mc(t,O)}PG(t,"error",g);function E(){t.removeListener("finish",v),N()}t.once("close",E);function v(){xe("onfinish"),t.removeListener("close",E),N()}t.once("finish",v);function N(){xe("unpipe"),r.unpipe(t)}return t.emit("pipe",r),n.flowing||(xe("pipe resume"),r.resume()),t};function MG(t){return function(){var r=t._readableState;xe("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,r.awaitDrain===0&&ON(t,"data")&&(r.flowing=!0,Gw(t))}}Me.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(e.pipesCount===0)return this;if(e.pipesCount===1)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r),this);if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var s=0;s0,n.flowing!==!1&&this.resume()):t==="readable"&&!n.endEmitted&&!n.readableListening&&(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,xe("on readable",n.length,n.reading),n.length?ld(this):n.reading||p.default.nextTick(UG,this)),r};Me.prototype.addListener=Me.prototype.on;Me.prototype.removeListener=function(t,e){var r=Ec.prototype.removeListener.call(this,t,e);return t==="readable"&&p.default.nextTick(BN,this),r};Me.prototype.removeAllListeners=function(t){var e=Ec.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&p.default.nextTick(BN,this),e};function BN(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 UG(t){xe("readable nexttick read 0"),t.read(0)}Me.prototype.resume=function(){var t=this._readableState;return t.flowing||(xe("resume"),t.flowing=!t.readableListening,qG(this,t)),t.paused=!1,this};function qG(t,e){e.resumeScheduled||(e.resumeScheduled=!0,p.default.nextTick(VG,t,e))}function VG(t,e){xe("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),Gw(t),e.flowing&&!e.reading&&t.read(0)}Me.prototype.pause=function(){return xe("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(xe("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function Gw(t){var e=t._readableState;for(xe("flow",e.flowing);e.flowing&&t.read()!==null;);}Me.prototype.wrap=function(t){var e=this,r=this._readableState,n=!1;t.on("end",function(){if(xe("wrapped end"),r.decoder&&!r.ended){var o=r.decoder.end();o&&o.length&&e.push(o)}e.push(null)}),t.on("data",function(o){if(xe("wrapped data"),r.decoder&&(o=r.decoder.write(o)),!(r.objectMode&&o==null)&&!(!r.objectMode&&(!o||!o.length))){var a=e.push(o);a||(n=!0,t.pause())}});for(var i in t)this[i]===void 0&&typeof t[i]=="function"&&(this[i]=function(a){return function(){return t[a].apply(t,arguments)}}(i));for(var s=0;s=e.length?(e.decoder?r=e.buffer.join(""):e.buffer.length===1?r=e.buffer.first():r=e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r}function Vw(t){var e=t._readableState;xe("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,p.default.nextTick(HG,e,t))}function HG(t,e){if(xe("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&t.length===0&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}typeof Symbol=="function"&&(Me.from=function(t,e){return Mw===void 0&&(Mw=TN()),Mw(Me,t,e)});function FN(t,e){for(var r=0,n=t.length;r{"use strict";c();qN.exports=Qn;var fd=Ns().codes,jG=fd.ERR_METHOD_NOT_IMPLEMENTED,GG=fd.ERR_MULTIPLE_CALLBACK,kG=fd.ERR_TRANSFORM_ALREADY_TRANSFORMING,QG=fd.ERR_TRANSFORM_WITH_LENGTH_0,hd=Os();ra()(Qn,hd);function WG(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(n===null)return this.emit("error",new GG);r.writechunk=null,r.writecb=null,e!=null&&this.push(e),n(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length{"use strict";c();HN.exports=wc;var VN=kw();ra()(wc,VN);function wc(t){if(!(this instanceof wc))return new wc(t);VN.call(this,t)}wc.prototype._transform=function(t,e,r){r(null,t)}});var zN=m((hue,WN)=>{"use strict";c();var Qw;function $G(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}var QN=Ns().codes,KG=QN.ERR_MISSING_ARGS,YG=QN.ERR_STREAM_DESTROYED;function GN(t){if(t)throw t}function JG(t){return t.setHeader&&typeof t.abort=="function"}function XG(t,e,r,n){n=$G(n);var i=!1;t.on("close",function(){i=!0}),Qw===void 0&&(Qw=sd()),Qw(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,JG(t))return t.abort();if(typeof t.destroy=="function")return t.destroy();n(o||new YG("pipe"))}}}function kN(t){t()}function ZG(t,e){return t.pipe(e)}function ek(t){return!t.length||typeof t[t.length-1]!="function"?GN:t.pop()}function tk(){for(var t=arguments.length,e=new Array(t),r=0;r0;return XG(o,u,l,function(f){i||(i=f),f&&s.forEach(kN),!u&&(s.forEach(kN),n(i))})});return e.reduce(ZG)}WN.exports=tk});var Ww=m((Lr,$N)=>{c();Lr=$N.exports=Nw();Lr.Stream=Lr;Lr.Readable=Lr;Lr.Writable=Cw();Lr.Duplex=Os();Lr.Transform=kw();Lr.PassThrough=jN();Lr.finished=sd();Lr.pipeline=zN()});var JN=m((gue,YN)=>{c();var{Transform:rk}=Ww();YN.exports=t=>class KN extends rk{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 KN(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}}});var eO=m((mue,ZN)=>{c();var{Transform:nk}=Ww();ZN.exports=t=>class XN extends nk{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 XN(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}}});var rO=m((wue,tO)=>{c();var ik=JN(),sk=eO();tO.exports=function(t){let e=ik(t),r=sk(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 sO=m(iO=>{c();var nO=[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];iO.p1600=function(t){for(let e=0;e<24;++e){let r=t[0]^t[10]^t[20]^t[30]^t[40],n=t[1]^t[11]^t[21]^t[31]^t[41],i=t[2]^t[12]^t[22]^t[32]^t[42],s=t[3]^t[13]^t[23]^t[33]^t[43],o=t[4]^t[14]^t[24]^t[34]^t[44],a=t[5]^t[15]^t[25]^t[35]^t[45],u=t[6]^t[16]^t[26]^t[36]^t[46],l=t[7]^t[17]^t[27]^t[37]^t[47],f=t[8]^t[18]^t[28]^t[38]^t[48],d=t[9]^t[19]^t[29]^t[39]^t[49],g=f^(i<<1|s>>>31),E=d^(s<<1|i>>>31),v=t[0]^g,N=t[1]^E,O=t[10]^g,F=t[11]^E,_=t[20]^g,I=t[21]^E,S=t[30]^g,R=t[31]^E,B=t[40]^g,b=t[41]^E;g=r^(o<<1|a>>>31),E=n^(a<<1|o>>>31);let C=t[2]^g,L=t[3]^E,X=t[12]^g,W=t[13]^E,j=t[22]^g,G=t[23]^E,K=t[32]^g,de=t[33]^E,ue=t[42]^g,re=t[43]^E;g=i^(u<<1|l>>>31),E=s^(l<<1|u>>>31);let Y=t[4]^g,se=t[5]^E,te=t[14]^g,ie=t[15]^E,q=t[24]^g,le=t[25]^E,ae=t[34]^g,fe=t[35]^E,oe=t[44]^g,ce=t[45]^E;g=o^(f<<1|d>>>31),E=a^(d<<1|f>>>31);let y=t[6]^g,w=t[7]^E,A=t[16]^g,P=t[17]^E,T=t[26]^g,D=t[27]^E,M=t[36]^g,x=t[37]^E,U=t[46]^g,H=t[47]^E;g=u^(r<<1|n>>>31),E=l^(n<<1|r>>>31);let V=t[8]^g,Z=t[9]^E,Ee=t[18]^g,ve=t[19]^E,Pe=t[28]^g,Ze=t[29]^E,lt=t[38]^g,Oe=t[39]^E,Ue=t[48]^g,xt=t[49]^E,ui=v,cs=N,ls=F<<4|O>>>28,nr=O<<4|F>>>28,Bn=_<<3|I>>>29,Wt=I<<3|_>>>29,Nt=R<<9|S>>>23,ze=S<<9|R>>>23,Sy=B<<18|b>>>14,Cy=b<<18|B>>>14,Ty=C<<1|L>>>31,xy=L<<1|C>>>31,Ny=W<<12|X>>>20,Oy=X<<12|W>>>20,Dy=j<<10|G>>>22,Py=G<<10|j>>>22,Ry=de<<13|K>>>19,By=K<<13|de>>>19,Ly=ue<<2|re>>>30,Fy=re<<2|ue>>>30,My=se<<30|Y>>>2,Uy=Y<<30|se>>>2,qy=te<<6|ie>>>26,Vy=ie<<6|te>>>26,Hy=le<<11|q>>>21,jy=q<<11|le>>>21,Gy=ae<<15|fe>>>17,ky=fe<<15|ae>>>17,Qy=ce<<29|oe>>>3,Wy=oe<<29|ce>>>3,zy=y<<28|w>>>4,$y=w<<28|y>>>4,Ky=P<<23|A>>>9,Yy=A<<23|P>>>9,Jy=T<<25|D>>>7,Xy=D<<25|T>>>7,Zy=M<<21|x>>>11,e0=x<<21|M>>>11,t0=H<<24|U>>>8,r0=U<<24|H>>>8,n0=V<<27|Z>>>5,i0=Z<<27|V>>>5,s0=Ee<<20|ve>>>12,o0=ve<<20|Ee>>>12,a0=Ze<<7|Pe>>>25,u0=Pe<<7|Ze>>>25,c0=lt<<8|Oe>>>24,l0=Oe<<8|lt>>>24,f0=Ue<<14|xt>>>18,h0=xt<<14|Ue>>>18;t[0]=ui^~Ny&Hy,t[1]=cs^~Oy&jy,t[10]=zy^~s0&Bn,t[11]=$y^~o0&Wt,t[20]=Ty^~qy&Jy,t[21]=xy^~Vy&Xy,t[30]=n0^~ls&Dy,t[31]=i0^~nr&Py,t[40]=My^~Ky&a0,t[41]=Uy^~Yy&u0,t[2]=Ny^~Hy&Zy,t[3]=Oy^~jy&e0,t[12]=s0^~Bn&Ry,t[13]=o0^~Wt&By,t[22]=qy^~Jy&c0,t[23]=Vy^~Xy&l0,t[32]=ls^~Dy&Gy,t[33]=nr^~Py&ky,t[42]=Ky^~a0&Nt,t[43]=Yy^~u0&ze,t[4]=Hy^~Zy&f0,t[5]=jy^~e0&h0,t[14]=Bn^~Ry&Qy,t[15]=Wt^~By&Wy,t[24]=Jy^~c0&Sy,t[25]=Xy^~l0&Cy,t[34]=Dy^~Gy&t0,t[35]=Py^~ky&r0,t[44]=a0^~Nt&Ly,t[45]=u0^~ze&Fy,t[6]=Zy^~f0&ui,t[7]=e0^~h0&cs,t[16]=Ry^~Qy&zy,t[17]=By^~Wy&$y,t[26]=c0^~Sy&Ty,t[27]=l0^~Cy&xy,t[36]=Gy^~t0&n0,t[37]=ky^~r0&i0,t[46]=Nt^~Ly&My,t[47]=ze^~Fy&Uy,t[8]=f0^~ui&Ny,t[9]=h0^~cs&Oy,t[18]=Qy^~zy&s0,t[19]=Wy^~$y&o0,t[28]=Sy^~Ty&qy,t[29]=Cy^~xy&Vy,t[38]=t0^~n0&ls,t[39]=r0^~i0&nr,t[48]=Ly^~My&Ky,t[49]=Fy^~Uy&Yy,t[0]^=nO[e*2],t[1]^=nO[e*2+1]}}});var aO=m((_ue,oO)=>{c();var dd=sO();function aa(){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}aa.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};aa.prototype.absorb=function(t){for(let e=0;e>>8*(this.count%4)&255,this.count+=1,this.count===this.blockSize&&(dd.p1600(this.state),this.count=0);return e};aa.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};oO.exports=aa});var zw=m((Sue,uO)=>{c();uO.exports=rO()(aO())});var Jw=m(ua=>{"use strict";c();var ok=ua&&ua.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ua,"__esModule",{value:!0});ua.SmartContract=void 0;var ak=ok(jt()),vc=yt(),$w=Ch(),uk=Be(),Kw=yn(),ck=gr(),lk=tc(),cO=YE(),lO=fc(),fO=sw(),fk=aw(),hk=hc(),pd=pw(),dk=zw(),Yw=class{constructor(e={}){this.address=new vc.Address,this.methodsExplicit={},this.methods={},this.address=e.address||new vc.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 lO.ContractFunction(i);return new fO.Interaction(e,o,s||[])},this.methods[i]=function(s){let o=new lO.ContractFunction(i),a=fk.NativeSerializer.nativeToTypedValues(s||[],n);return new fO.Interaction(e,o,a||[])}}}setAddress(e){this.address=e}getAddress(){return this.address}getAbi(){return ck.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}){$w.Compatibility.guardAddressIsSetAndNonZero(e,"'deployer' of SmartContract.deploy()","pass the actual address to deploy()"),n=n||new cO.CodeMetadata,i=i||[],s=s||0;let l=new pd.ContractDeployPayloadBuilder().setCode(r).setCodeMetadata(n).setInitArgs(i).build();return new Kw.Transaction({receiver:vc.Address.Zero(),sender:e,value:s,gasLimit:o,gasPrice:a,data:l,chainID:u})}upgrade({caller:e,code:r,codeMetadata:n,initArguments:i,value:s,gasLimit:o,gasPrice:a,chainID:u}){$w.Compatibility.guardAddressIsSetAndNonZero(e,"'caller' of SmartContract.upgrade()","pass the actual address to upgrade()"),this.ensureHasAddress(),n=n||new cO.CodeMetadata,i=i||[],s=s||0;let l=new pd.ContractUpgradePayloadBuilder().setCode(r).setCodeMetadata(n).setInitArgs(i).build();return new Kw.Transaction({sender:e,receiver:this.getAddress(),value:s,gasLimit:o,gasPrice:a,data:l,chainID:u})}call({func:e,args:r,value:n,gasLimit:i,receiver:s,gasPrice:o,chainID:a,caller:u}){$w.Compatibility.guardAddressIsSetAndNonZero(u,"'caller' of SmartContract.call()","pass the actual address to call()"),this.ensureHasAddress(),r=r||[],n=n||0;let l=new pd.ContractCallPayloadBuilder().setFunction(e).setArgs(r).build();return new Kw.Transaction({sender:u,receiver:s||this.getAddress(),value:n,gasLimit:i,gasPrice:o,data:l,chainID:a})}createQuery({func:e,args:r,value:n,caller:i}){return this.ensureHasAddress(),new hk.Query({address:this.getAddress(),func:e,args:r,value:n,caller:i})}ensureHasAddress(){if(!this.getAddress().bech32())throw new uk.ErrContractHasNoAddress}static computeAddress(e,r){let n=h.Buffer.alloc(8,0),i=new vc.Address(e.bech32()).pubkey(),s=i.slice(30),o=h.Buffer.alloc(8),a=new ak.default(r.valueOf().toString(10)),u=lk.bigIntToBuffer(a);o.write(u.reverse().toString("hex"),"hex");let l=h.Buffer.concat([i,o]),f=dk("keccak256").update(l).digest(),d=h.Buffer.from(pd.ArwenVirtualMachine,"hex"),g=h.Buffer.concat([n,d,f.slice(10,30),s]);return new vc.Address(g)}};ua.SmartContract=Yw});var hO=m(Ni=>{"use strict";c();Object.defineProperty(Ni,"__esModule",{value:!0});Ni.ErrAccountNotConnected=Ni.ErrCannotSignSingleTransaction=Ni.Err=void 0;var Ac=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};Ni.Err=Ac;var Xw=class extends Ac{constructor(){super("Cannot sign single transaction.")}};Ni.ErrCannotSignSingleTransaction=Xw;var Zw=class extends Ac{constructor(){super("Account is not connected.")}};Ni.ErrAccountNotConnected=Zw});var dO=m(bc=>{"use strict";c();Object.defineProperty(bc,"__esModule",{value:!0});bc.Operation=void 0;var pk;(function(t){t.Connect="connect",t.Logout="logout",t.SignTransactions="signTransactions",t.SignMessage="signMessage",t.CancelAction="cancelAction"})(pk=bc.Operation||(bc.Operation={}))});var ev=m(ca=>{"use strict";c();var Oi=ca&&ca.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(ca,"__esModule",{value:!0});ca.ExtensionProvider=void 0;var gk=yn(),pO=hO(),_c=dO(),Ic=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 Oi(this,void 0,void 0,function*(){return window&&window.elrondWallet&&(this.initialized=!0),this.initialized})}login(e={}){return Oi(this,void 0,void 0,function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");let{token:r}=e,n=r||"";return yield this.startBgrMsgChannel(_c.Operation.Connect,n),this.account.address})}logout(){return Oi(this,void 0,void 0,function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");try{yield this.startBgrMsgChannel(_c.Operation.Logout,this.account.address),this.disconnect()}catch(e){console.warn("Extension origin url is already cleared!",e)}return!0})}disconnect(){this.account={address:""}}getAddress(){return Oi(this,void 0,void 0,function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");return this.account?this.account.address:""})}isInitialized(){return this.initialized}isConnected(){return Oi(this,void 0,void 0,function*(){return!!this.account.address})}signTransaction(e){return Oi(this,void 0,void 0,function*(){this.ensureConnected();let r=yield this.signTransactions([e]);if(r.length!=1)throw new pO.ErrCannotSignSingleTransaction;return r[0]})}ensureConnected(){if(!this.account.address)throw new pO.ErrAccountNotConnected}signTransactions(e){return Oi(this,void 0,void 0,function*(){this.ensureConnected();let r=yield this.startBgrMsgChannel(_c.Operation.SignTransactions,{from:this.account.address,transactions:e.map(n=>n.toPlainObject())});try{return r.map(i=>gk.Transaction.fromPlainObject(i))}catch(n){throw new Error(`Transaction canceled: ${n.message}.`)}})}signMessage(e){return Oi(this,void 0,void 0,function*(){this.ensureConnected();let r={account:this.account.address,message:e.message.toString()},i=(yield this.startBgrMsgChannel(_c.Operation.SignMessage,r)).signature,s=h.Buffer.from(i,"hex");return e.applySignature(s),e})}cancelAction(){return this.startBgrMsgChannel(_c.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)})}};ca.ExtensionProvider=Ic;Ic._instance=new Ic});var yr={};ft(yr,{__assign:()=>rv,__asyncDelegator:()=>xk,__asyncGenerator:()=>Tk,__asyncValues:()=>Nk,__await:()=>Sc,__awaiter:()=>Ak,__classPrivateFieldGet:()=>Rk,__classPrivateFieldSet:()=>Bk,__createBinding:()=>_k,__decorate:()=>Ek,__exportStar:()=>Ik,__extends:()=>yk,__generator:()=>bk,__importDefault:()=>Pk,__importStar:()=>Dk,__makeTemplateObject:()=>Ok,__metadata:()=>vk,__param:()=>wk,__read:()=>wO,__rest:()=>mk,__spread:()=>Sk,__spreadArrays:()=>Ck,__values:()=>nv});function yk(t,e){tv(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function mk(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 wk(t,e){return function(r,n){e(r,n,t)}}function vk(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function Ak(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})}function bk(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(f){return u([l,f])}}function u(l){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=l[0]&2?i.return:l[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,l[1])).done)return s;switch(i=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,i=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function wO(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 Sk(){for(var t=[],e=0;e1||a(g,E)})})}function a(g,E){try{u(n[g](E))}catch(v){d(s[0][3],v)}}function u(g){g.value instanceof Sc?Promise.resolve(g.value.v).then(l,f):d(s[0][2],g)}function l(g){a("next",g)}function f(g){a("throw",g)}function d(g,E){g(E),s.shift(),s.length&&a(s[0][0],s[0][1])}}function xk(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:Sc(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function Nk(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 nv=="function"?nv(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(a,u){o=t[s](o),i(a,u,o.done,o.value)})}}function i(s,o,a,u){Promise.resolve(u).then(function(l){s({value:l,done:a})},o)}}function Ok(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function Dk(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 Pk(t){return t&&t.__esModule?t:{default:t}}function Rk(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function Bk(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 tv,rv,mr=ge(()=>{c();tv=function(t,e){return tv=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])},tv(t,e)};rv=function(){return rv=Object.assign||function(e){for(var r,n=1,i=arguments.length;n{"use strict";c();Object.defineProperty(wd,"__esModule",{value:!0});function Lk(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return JSON.parse(t)}catch{return t}}wd.safeJsonParse=Lk;function Fk(t){return typeof t=="string"?t:JSON.stringify(t,(e,r)=>typeof r>"u"?null:r)}wd.safeJsonStringify=Fk});var vO=m((Wue,vd)=>{"use strict";c();(function(){"use strict";let t;function e(){}t=e,t.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},t.prototype.setItem=function(r,n){this[r]=String(n)},t.prototype.removeItem=function(r){delete this[r]},t.prototype.clear=function(){let r=this;Object.keys(r).forEach(function(n){r[n]=void 0,delete r[n]})},t.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof global<"u"&&global.localStorage?vd.exports=global.localStorage:typeof window<"u"&&window.localStorage?vd.exports=window.localStorage:vd.exports=new e})()});var AO=m(Ad=>{"use strict";c();Object.defineProperty(Ad,"__esModule",{value:!0});Ad.IKeyValueStorage=void 0;var sv=class{};Ad.IKeyValueStorage=sv});var bO=m(bd=>{"use strict";c();Object.defineProperty(bd,"__esModule",{value:!0});bd.parseEntry=void 0;var Mk=iv();function Uk(t){var e;return[t[0],Mk.safeJsonParse((e=t[1])!==null&&e!==void 0?e:"")]}bd.parseEntry=Uk});var IO=m(_d=>{"use strict";c();Object.defineProperty(_d,"__esModule",{value:!0});var _O=(mr(),ut(yr));_O.__exportStar(AO(),_d);_O.__exportStar(bO(),_d)});var CO=m(Cc=>{"use strict";c();Object.defineProperty(Cc,"__esModule",{value:!0});Cc.KeyValueStorage=void 0;var la=(mr(),ut(yr)),SO=iv(),qk=la.__importDefault(vO()),Vk=IO(),Id=class{constructor(){this.localStorage=qk.default}getKeys(){return la.__awaiter(this,void 0,void 0,function*(){return Object.keys(this.localStorage)})}getEntries(){return la.__awaiter(this,void 0,void 0,function*(){return Object.entries(this.localStorage).map(Vk.parseEntry)})}getItem(e){return la.__awaiter(this,void 0,void 0,function*(){let r=this.localStorage.getItem(e);if(r!==null)return SO.safeJsonParse(r)})}setItem(e,r){return la.__awaiter(this,void 0,void 0,function*(){this.localStorage.setItem(e,SO.safeJsonStringify(r))})}removeItem(e){return la.__awaiter(this,void 0,void 0,function*(){this.localStorage.removeItem(e)})}};Cc.KeyValueStorage=Id;Cc.default=Id});var TO=m(Sd=>{"use strict";c();Object.defineProperty(Sd,"__esModule",{value:!0});Sd.delay=void 0;function Hk(t){return new Promise(e=>{setTimeout(()=>{e(!0)},t)})}Sd.delay=Hk});var xO=m(fa=>{"use strict";c();Object.defineProperty(fa,"__esModule",{value:!0});fa.ONE_THOUSAND=fa.ONE_HUNDRED=void 0;fa.ONE_HUNDRED=100;fa.ONE_THOUSAND=1e3});var NO=m(he=>{"use strict";c();Object.defineProperty(he,"__esModule",{value:!0});he.ONE_YEAR=he.FOUR_WEEKS=he.THREE_WEEKS=he.TWO_WEEKS=he.ONE_WEEK=he.THIRTY_DAYS=he.SEVEN_DAYS=he.FIVE_DAYS=he.THREE_DAYS=he.ONE_DAY=he.TWENTY_FOUR_HOURS=he.TWELVE_HOURS=he.SIX_HOURS=he.THREE_HOURS=he.ONE_HOUR=he.SIXTY_MINUTES=he.THIRTY_MINUTES=he.TEN_MINUTES=he.FIVE_MINUTES=he.ONE_MINUTE=he.SIXTY_SECONDS=he.THIRTY_SECONDS=he.TEN_SECONDS=he.FIVE_SECONDS=he.ONE_SECOND=void 0;he.ONE_SECOND=1;he.FIVE_SECONDS=5;he.TEN_SECONDS=10;he.THIRTY_SECONDS=30;he.SIXTY_SECONDS=60;he.ONE_MINUTE=he.SIXTY_SECONDS;he.FIVE_MINUTES=he.ONE_MINUTE*5;he.TEN_MINUTES=he.ONE_MINUTE*10;he.THIRTY_MINUTES=he.ONE_MINUTE*30;he.SIXTY_MINUTES=he.ONE_MINUTE*60;he.ONE_HOUR=he.SIXTY_MINUTES;he.THREE_HOURS=he.ONE_HOUR*3;he.SIX_HOURS=he.ONE_HOUR*6;he.TWELVE_HOURS=he.ONE_HOUR*12;he.TWENTY_FOUR_HOURS=he.ONE_HOUR*24;he.ONE_DAY=he.TWENTY_FOUR_HOURS;he.THREE_DAYS=he.ONE_DAY*3;he.FIVE_DAYS=he.ONE_DAY*5;he.SEVEN_DAYS=he.ONE_DAY*7;he.THIRTY_DAYS=he.ONE_DAY*30;he.ONE_WEEK=he.SEVEN_DAYS;he.TWO_WEEKS=he.ONE_WEEK*2;he.THREE_WEEKS=he.ONE_WEEK*3;he.FOUR_WEEKS=he.ONE_WEEK*4;he.ONE_YEAR=he.ONE_DAY*365});var ov=m(Cd=>{"use strict";c();Object.defineProperty(Cd,"__esModule",{value:!0});var OO=(mr(),ut(yr));OO.__exportStar(xO(),Cd);OO.__exportStar(NO(),Cd)});var PO=m(ha=>{"use strict";c();Object.defineProperty(ha,"__esModule",{value:!0});ha.fromMiliseconds=ha.toMiliseconds=void 0;var DO=ov();function jk(t){return t*DO.ONE_THOUSAND}ha.toMiliseconds=jk;function Gk(t){return Math.floor(t/DO.ONE_THOUSAND)}ha.fromMiliseconds=Gk});var BO=m(Td=>{"use strict";c();Object.defineProperty(Td,"__esModule",{value:!0});var RO=(mr(),ut(yr));RO.__exportStar(TO(),Td);RO.__exportStar(PO(),Td)});var LO=m(Tc=>{"use strict";c();Object.defineProperty(Tc,"__esModule",{value:!0});Tc.Watch=void 0;var xd=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}};Tc.Watch=xd;Tc.default=xd});var FO=m(Nd=>{"use strict";c();Object.defineProperty(Nd,"__esModule",{value:!0});Nd.IWatch=void 0;var av=class{};Nd.IWatch=av});var MO=m(uv=>{"use strict";c();Object.defineProperty(uv,"__esModule",{value:!0});var kk=(mr(),ut(yr));kk.__exportStar(FO(),uv)});var Ls=m(da=>{"use strict";c();Object.defineProperty(da,"__esModule",{value:!0});var Od=(mr(),ut(yr));Od.__exportStar(BO(),da);Od.__exportStar(LO(),da);Od.__exportStar(MO(),da);Od.__exportStar(ov(),da)});var cv,UO=ge(()=>{c();cv=class{}});var lv={};ft(lv,{IEvents:()=>cv});var fv=ge(()=>{c();UO()});var qO=m(Dd=>{"use strict";c();Object.defineProperty(Dd,"__esModule",{value:!0});Dd.IHeartBeat=void 0;var Qk=(fv(),ut(lv)),hv=class extends Qk.IEvents{constructor(e){super()}};Dd.IHeartBeat=hv});var pv=m(dv=>{"use strict";c();Object.defineProperty(dv,"__esModule",{value:!0});var Wk=(mr(),ut(yr));Wk.__exportStar(qO(),dv)});var VO=m(pa=>{"use strict";c();Object.defineProperty(pa,"__esModule",{value:!0});pa.HEARTBEAT_EVENTS=pa.HEARTBEAT_INTERVAL=void 0;var zk=Ls();pa.HEARTBEAT_INTERVAL=zk.FIVE_SECONDS;pa.HEARTBEAT_EVENTS={pulse:"heartbeat_pulse"}});var yv=m(gv=>{"use strict";c();Object.defineProperty(gv,"__esModule",{value:!0});var $k=(mr(),ut(yr));$k.__exportStar(VO(),gv)});var HO=m(Pd=>{"use strict";c();Object.defineProperty(Pd,"__esModule",{value:!0});Pd.HeartBeat=void 0;var mv=(mr(),ut(yr)),Kk=kn(),Yk=Ls(),Jk=pv(),Ev=yv(),wv=class t extends Jk.IHeartBeat{constructor(e){super(e),this.events=new Kk.EventEmitter,this.interval=Ev.HEARTBEAT_INTERVAL,this.interval=e?.interval||Ev.HEARTBEAT_INTERVAL}static init(e){return mv.__awaiter(this,void 0,void 0,function*(){let r=new t(e);return yield r.init(),r})}init(){return mv.__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 mv.__awaiter(this,void 0,void 0,function*(){this.intervalRef=setInterval(()=>this.pulse(),Yk.toMiliseconds(this.interval))})}pulse(){this.events.emit(Ev.HEARTBEAT_EVENTS.pulse)}};Pd.HeartBeat=wv});var jO=m(xc=>{"use strict";c();Object.defineProperty(xc,"__esModule",{value:!0});var vv=(mr(),ut(yr));vv.__exportStar(HO(),xc);vv.__exportStar(pv(),xc);vv.__exportStar(yv(),xc)});var kO=m((Uce,GO)=>{"use strict";c();function Xk(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}GO.exports=Zk;function Zk(t,e,r){var n=r&&r.stringify||Xk,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(E+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=E+2,E++;break}l+=n(e[f]),d=E+2,E++;break;case 115:if(f>=u)break;d{"use strict";c();var QO=kO();$O.exports=bn;var Nc=c7().console||{},e7={mapHttpRequest:Rd,mapHttpResponse:Rd,wrapRequestSerializer:Av,wrapResponseSerializer:Av,wrapErrorSerializer:Av,req:Rd,res:Rd,err:s7};function t7(t,e){return Array.isArray(t)?t.filter(function(n){return n!=="!stdSerializers.err"}):t===!0?Object.keys(e):!1}function bn(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||Nc;t.browser.write&&(t.browser.asObject=!0);let n=t.serializers||{},i=t7(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=Oc),Object.defineProperty(u,"levelVal",{get:f}),Object.defineProperty(u,"level",{get:d,set:g});let l={transmit:e,serialize:i,asObject:t.browser.asObject,levels:o,timestamp:o7(t)};u.levels=bn.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=Oc,u.serializers=n,u._serialize=i,u._stdErrSerialize=s,u.child=E,e&&(u._logEvent=bv());function f(){return this.level==="silent"?1/0:this.levels.values[this.level]}function d(){return this._level}function g(v){if(v!=="silent"&&!this.levels.values[v])throw Error("unknown level "+v);this._level=v,ga(l,u,"error","log"),ga(l,u,"fatal","error"),ga(l,u,"warn","error"),ga(l,u,"info","log"),ga(l,u,"debug","log"),ga(l,u,"trace","log")}function E(v,N){if(!v)throw new Error("missing bindings for child Pino");N=N||{},i&&v.serializers&&(N.serializers=v.serializers);let O=N.serializers;if(i&&O){var F=Object.assign({},n,O),_=t.browser.serialize===!0?Object.keys(F):i;delete v.serializers,Bd([v],_,F,this._stdErrSerialize)}function I(S){this._childLevel=(S._childLevel|0)+1,this.error=ya(S,v,"error"),this.fatal=ya(S,v,"fatal"),this.warn=ya(S,v,"warn"),this.info=ya(S,v,"info"),this.debug=ya(S,v,"debug"),this.trace=ya(S,v,"trace"),F&&(this.serializers=F,this._serialize=_),e&&(this._logEvent=bv([].concat(S._logEvent.bindings,v)))}return I.prototype=this,new I(this)}return u}bn.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"}};bn.stdSerializers=e7;bn.stdTimeFunctions=Object.assign({},{nullTime:WO,epochTime:zO,unixTime:a7,isoTime:u7});function ga(t,e,r,n){let i=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?Oc:i[r]?i[r]:Nc[r]||Nc[n]||Oc,r7(t,e,r)}function r7(t,e,r){!t.transmit&&e[r]===Oc||(e[r]=function(n){return function(){let s=t.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Nc?Nc:this;for(var u=0;u-1&&s in r&&(t[i][s]=r[s](t[i][s]))}function ya(t,e,r){return function(){let n=new Array(1+arguments.length);n[0]=e;for(var i=1;i{"use strict";c();Object.defineProperty(ma,"__esModule",{value:!0});ma.PINO_CUSTOM_CONTEXT_KEY=ma.PINO_LOGGER_DEFAULTS=void 0;ma.PINO_LOGGER_DEFAULTS={level:"info"};ma.PINO_CUSTOM_CONTEXT_KEY="custom_context"});var e2=m(fr=>{"use strict";c();Object.defineProperty(fr,"__esModule",{value:!0});fr.generateChildLogger=fr.formatChildLoggerContext=fr.getLoggerContext=fr.setBrowserLoggerContext=fr.getBrowserLoggerContext=fr.getDefaultLoggerOptions=void 0;var Ea=_v();function l7(t){return Object.assign(Object.assign({},t),{level:t?.level||Ea.PINO_LOGGER_DEFAULTS.level})}fr.getDefaultLoggerOptions=l7;function YO(t,e=Ea.PINO_CUSTOM_CONTEXT_KEY){return t[e]||""}fr.getBrowserLoggerContext=YO;function JO(t,e,r=Ea.PINO_CUSTOM_CONTEXT_KEY){return t[r]=e,t}fr.setBrowserLoggerContext=JO;function XO(t,e=Ea.PINO_CUSTOM_CONTEXT_KEY){let r="";return typeof t.bindings>"u"?r=YO(t,e):r=t.bindings().context||"",r}fr.getLoggerContext=XO;function ZO(t,e,r=Ea.PINO_CUSTOM_CONTEXT_KEY){let n=XO(t,r);return n.trim()?`${n}/${e}`:e}fr.formatChildLoggerContext=ZO;function f7(t,e,r=Ea.PINO_CUSTOM_CONTEXT_KEY){let n=ZO(t,e,r),i=t.child({context:n});return JO(i,n,r)}fr.generateChildLogger=f7});var Sv=m(wa=>{"use strict";c();Object.defineProperty(wa,"__esModule",{value:!0});wa.pino=void 0;var Iv=(mr(),ut(yr)),h7=Iv.__importDefault(KO());Object.defineProperty(wa,"pino",{enumerable:!0,get:function(){return h7.default}});Iv.__exportStar(_v(),wa);Iv.__exportStar(e2(),wa)});var Gv=m(Dt=>{"use strict";c();Object.defineProperty(Dt,"__esModule",{value:!0});var va=(fv(),ut(lv)),t2=kn();function d7(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var p7=d7(t2),Cv=class extends va.IEvents{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},Tv=class{constructor(e,r,n){this.core=e,this.logger=r}},xv=class extends va.IEvents{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}},Nv=class{constructor(e,r){this.logger=e,this.core=r}},Ov=class extends va.IEvents{constructor(e,r){super(),this.relayer=e,this.logger=r}},Dv=class extends va.IEvents{constructor(e){super()}},Pv=class{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}},Rv=class{constructor(){this.map=new Map}},Bv=class extends va.IEvents{constructor(e,r){super(),this.relayer=e,this.logger=r}},Lv=class{constructor(e,r){this.core=e,this.logger=r}},Fv=class extends va.IEvents{constructor(e,r){super(),this.core=e,this.logger=r}},Mv=class{constructor(e,r){this.logger=e,this.core=r}},Uv=class{constructor(e,r){this.projectId=e,this.logger=r}},qv=class extends p7.default{constructor(){super()}},Vv=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},Hv=class extends t2.EventEmitter{constructor(){super()}},jv=class{constructor(e){this.client=e}};Dt.ICore=Cv,Dt.ICrypto=Tv,Dt.IEngine=jv,Dt.IEngineEvents=Hv,Dt.IExpirer=Fv,Dt.IJsonRpcHistory=xv,Dt.IKeyChain=Lv,Dt.IMessageTracker=Nv,Dt.IPairing=Mv,Dt.IPublisher=Ov,Dt.IRelayer=Dv,Dt.ISignClient=Vv,Dt.ISignClientEvents=qv,Dt.IStore=Pv,Dt.ISubscriber=Bv,Dt.ISubscriberTopicMap=Rv,Dt.IVerify=Uv});var r2={};ft(r2,{safeJsonParse:()=>Dc,safeJsonStringify:()=>Pc});function Dc(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return y7(t)}catch{return t}}function Pc(t){return typeof t=="string"?t:g7(t)||""}var g7,y7,Ld=ge(()=>{c();g7=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),y7=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 i2=m(Fd=>{"use strict";c();Object.defineProperty(Fd,"__esModule",{value:!0});Fd.BrowserRandomSource=void 0;var n2=65536,kv=class{constructor(){this.isAvailable=!1,this.isInstantiated=!1;let e=typeof self<"u"?self.crypto||self.msCrypto:null;e&&e.getRandomValues!==void 0&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");let r=new Uint8Array(e);for(let n=0;n{"use strict";c();Object.defineProperty(Qv,"__esModule",{value:!0});function m7(t){for(var e=0;e{c()});var o2=m(Md=>{"use strict";c();Object.defineProperty(Md,"__esModule",{value:!0});Md.NodeRandomSource=void 0;var E7=Fr(),Wv=class{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof xI<"u"){let e=s2();e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let r=this._crypto.randomBytes(e);if(r.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");let n=new Uint8Array(e);for(let i=0;i{"use strict";c();Object.defineProperty(Ud,"__esModule",{value:!0});Ud.SystemRandomSource=void 0;var w7=i2(),v7=o2(),zv=class{constructor(){if(this.isAvailable=!1,this.name="",this._source=new w7.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new v7.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)}};Ud.SystemRandomSource=zv});var u2=m(Er=>{"use strict";c();Object.defineProperty(Er,"__esModule",{value:!0});function A7(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}Er.mul=Math.imul||A7;function b7(t,e){return t+e|0}Er.add=b7;function _7(t,e){return t-e|0}Er.sub=_7;function I7(t,e){return t<>>32-e}Er.rotl=I7;function S7(t,e){return t<<32-e|t>>>e}Er.rotr=S7;function C7(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t}Er.isInteger=Number.isInteger||C7;Er.MAX_SAFE_INTEGER=9007199254740991;Er.isSafeInteger=function(t){return Er.isInteger(t)&&t>=-Er.MAX_SAFE_INTEGER&&t<=Er.MAX_SAFE_INTEGER}});var Aa=m(Ne=>{"use strict";c();Object.defineProperty(Ne,"__esModule",{value:!0});var c2=u2();function T7(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}Ne.readInt16BE=T7;function x7(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}Ne.readUint16BE=x7;function N7(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}Ne.readInt16LE=N7;function O7(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}Ne.readUint16LE=O7;function l2(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}Ne.writeUint16BE=l2;Ne.writeInt16BE=l2;function f2(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}Ne.writeUint16LE=f2;Ne.writeInt16LE=f2;function $v(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}Ne.readInt32BE=$v;function Kv(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}Ne.readUint32BE=Kv;function Yv(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}Ne.readInt32LE=Yv;function Jv(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}Ne.readUint32LE=Jv;function qd(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}Ne.writeUint32BE=qd;Ne.writeInt32BE=qd;function Vd(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}Ne.writeUint32LE=Vd;Ne.writeInt32LE=Vd;function D7(t,e){e===void 0&&(e=0);var r=$v(t,e),n=$v(t,e+4);return r*4294967296+n-(n>>31)*4294967296}Ne.readInt64BE=D7;function P7(t,e){e===void 0&&(e=0);var r=Kv(t,e),n=Kv(t,e+4);return r*4294967296+n}Ne.readUint64BE=P7;function R7(t,e){e===void 0&&(e=0);var r=Yv(t,e),n=Yv(t,e+4);return n*4294967296+r-(r>>31)*4294967296}Ne.readInt64LE=R7;function B7(t,e){e===void 0&&(e=0);var r=Jv(t,e),n=Jv(t,e+4);return n*4294967296+r}Ne.readUint64LE=B7;function h2(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),qd(t/4294967296>>>0,e,r),qd(t>>>0,e,r+4),e}Ne.writeUint64BE=h2;Ne.writeInt64BE=h2;function d2(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),Vd(t>>>0,e,r),Vd(t/4294967296>>>0,e,r+4),e}Ne.writeUint64LE=d2;Ne.writeInt64LE=d2;function L7(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,s=t/8+r-1;s>=r;s--)n+=e[s]*i,i*=256;return n}Ne.readUintBE=L7;function F7(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,s=r;s=n;s--)r[s]=e/i&255,i*=256;return r}Ne.writeUintBE=M7;function U7(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(!c2.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,s=n;s{"use strict";c();Object.defineProperty(Kt,"__esModule",{value:!0});Kt.randomStringForEntropy=Kt.randomString=Kt.randomUint32=Kt.randomBytes=Kt.defaultRandomSource=void 0;var z7=a2(),$7=Aa(),p2=Fr();Kt.defaultRandomSource=new z7.SystemRandomSource;function Xv(t,e=Kt.defaultRandomSource){return e.randomBytes(t)}Kt.randomBytes=Xv;function K7(t=Kt.defaultRandomSource){let e=Xv(4,t),r=(0,$7.readUint32LE)(e);return(0,p2.wipe)(e),r}Kt.randomUint32=K7;var g2="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function y2(t,e=g2,r=Kt.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=Xv(Math.ceil(t*256/s),r);for(let a=0;a0;a++){let u=o[a];u{"use strict";c();Object.defineProperty(Wn,"__esModule",{value:!0});var _a=Aa(),ba=Fr();Wn.DIGEST_LENGTH=64;Wn.BLOCK_SIZE=128;var E2=function(){function t(){this.digestLength=Wn.DIGEST_LENGTH,this.blockSize=Wn.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(){ba.wipe(this._buffer),ba.wipe(this._tempHi),ba.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&&(Zv(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(n=Zv(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){ba.wipe(e.stateHi),ba.wipe(e.stateLo),e.buffer&&ba.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},t}();Wn.SHA512=E2;var m2=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 Zv(t,e,r,n,i,s,o){for(var a=r[0],u=r[1],l=r[2],f=r[3],d=r[4],g=r[5],E=r[6],v=r[7],N=n[0],O=n[1],F=n[2],_=n[3],I=n[4],S=n[5],R=n[6],B=n[7],b,C,L,X,W,j,G,K;o>=128;){for(var de=0;de<16;de++){var ue=8*de+s;t[de]=_a.readUint32BE(i,ue),e[de]=_a.readUint32BE(i,ue+4)}for(var de=0;de<80;de++){var re=a,Y=u,se=l,te=f,ie=d,q=g,le=E,ae=v,fe=N,oe=O,ce=F,y=_,w=I,A=S,P=R,T=B;if(b=v,C=B,W=C&65535,j=C>>>16,G=b&65535,K=b>>>16,b=(d>>>14|I<<32-14)^(d>>>18|I<<32-18)^(I>>>41-32|d<<32-(41-32)),C=(I>>>14|d<<32-14)^(I>>>18|d<<32-18)^(d>>>41-32|I<<32-(41-32)),W+=C&65535,j+=C>>>16,G+=b&65535,K+=b>>>16,b=d&g^~d&E,C=I&S^~I&R,W+=C&65535,j+=C>>>16,G+=b&65535,K+=b>>>16,b=m2[de*2],C=m2[de*2+1],W+=C&65535,j+=C>>>16,G+=b&65535,K+=b>>>16,b=t[de%16],C=e[de%16],W+=C&65535,j+=C>>>16,G+=b&65535,K+=b>>>16,j+=W>>>16,G+=j>>>16,K+=G>>>16,L=G&65535|K<<16,X=W&65535|j<<16,b=L,C=X,W=C&65535,j=C>>>16,G=b&65535,K=b>>>16,b=(a>>>28|N<<32-28)^(N>>>34-32|a<<32-(34-32))^(N>>>39-32|a<<32-(39-32)),C=(N>>>28|a<<32-28)^(a>>>34-32|N<<32-(34-32))^(a>>>39-32|N<<32-(39-32)),W+=C&65535,j+=C>>>16,G+=b&65535,K+=b>>>16,b=a&u^a&l^u&l,C=N&O^N&F^O&F,W+=C&65535,j+=C>>>16,G+=b&65535,K+=b>>>16,j+=W>>>16,G+=j>>>16,K+=G>>>16,ae=G&65535|K<<16,T=W&65535|j<<16,b=te,C=y,W=C&65535,j=C>>>16,G=b&65535,K=b>>>16,b=L,C=X,W+=C&65535,j+=C>>>16,G+=b&65535,K+=b>>>16,j+=W>>>16,G+=j>>>16,K+=G>>>16,te=G&65535|K<<16,y=W&65535|j<<16,u=re,l=Y,f=se,d=te,g=ie,E=q,v=le,a=ae,O=fe,F=oe,_=ce,I=y,S=w,R=A,B=P,N=T,de%16===15)for(var ue=0;ue<16;ue++)b=t[ue],C=e[ue],W=C&65535,j=C>>>16,G=b&65535,K=b>>>16,b=t[(ue+9)%16],C=e[(ue+9)%16],W+=C&65535,j+=C>>>16,G+=b&65535,K+=b>>>16,L=t[(ue+1)%16],X=e[(ue+1)%16],b=(L>>>1|X<<32-1)^(L>>>8|X<<32-8)^L>>>7,C=(X>>>1|L<<32-1)^(X>>>8|L<<32-8)^(X>>>7|L<<32-7),W+=C&65535,j+=C>>>16,G+=b&65535,K+=b>>>16,L=t[(ue+14)%16],X=e[(ue+14)%16],b=(L>>>19|X<<32-19)^(X>>>61-32|L<<32-(61-32))^L>>>6,C=(X>>>19|L<<32-19)^(L>>>61-32|X<<32-(61-32))^(X>>>6|L<<32-6),W+=C&65535,j+=C>>>16,G+=b&65535,K+=b>>>16,j+=W>>>16,G+=j>>>16,K+=G>>>16,t[ue]=G&65535|K<<16,e[ue]=W&65535|j<<16}b=a,C=N,W=C&65535,j=C>>>16,G=b&65535,K=b>>>16,b=r[0],C=n[0],W+=C&65535,j+=C>>>16,G+=b&65535,K+=b>>>16,j+=W>>>16,G+=j>>>16,K+=G>>>16,r[0]=a=G&65535|K<<16,n[0]=N=W&65535|j<<16,b=u,C=O,W=C&65535,j=C>>>16,G=b&65535,K=b>>>16,b=r[1],C=n[1],W+=C&65535,j+=C>>>16,G+=b&65535,K+=b>>>16,j+=W>>>16,G+=j>>>16,K+=G>>>16,r[1]=u=G&65535|K<<16,n[1]=O=W&65535|j<<16,b=l,C=F,W=C&65535,j=C>>>16,G=b&65535,K=b>>>16,b=r[2],C=n[2],W+=C&65535,j+=C>>>16,G+=b&65535,K+=b>>>16,j+=W>>>16,G+=j>>>16,K+=G>>>16,r[2]=l=G&65535|K<<16,n[2]=F=W&65535|j<<16,b=f,C=_,W=C&65535,j=C>>>16,G=b&65535,K=b>>>16,b=r[3],C=n[3],W+=C&65535,j+=C>>>16,G+=b&65535,K+=b>>>16,j+=W>>>16,G+=j>>>16,K+=G>>>16,r[3]=f=G&65535|K<<16,n[3]=_=W&65535|j<<16,b=d,C=I,W=C&65535,j=C>>>16,G=b&65535,K=b>>>16,b=r[4],C=n[4],W+=C&65535,j+=C>>>16,G+=b&65535,K+=b>>>16,j+=W>>>16,G+=j>>>16,K+=G>>>16,r[4]=d=G&65535|K<<16,n[4]=I=W&65535|j<<16,b=g,C=S,W=C&65535,j=C>>>16,G=b&65535,K=b>>>16,b=r[5],C=n[5],W+=C&65535,j+=C>>>16,G+=b&65535,K+=b>>>16,j+=W>>>16,G+=j>>>16,K+=G>>>16,r[5]=g=G&65535|K<<16,n[5]=S=W&65535|j<<16,b=E,C=R,W=C&65535,j=C>>>16,G=b&65535,K=b>>>16,b=r[6],C=n[6],W+=C&65535,j+=C>>>16,G+=b&65535,K+=b>>>16,j+=W>>>16,G+=j>>>16,K+=G>>>16,r[6]=E=G&65535|K<<16,n[6]=R=W&65535|j<<16,b=v,C=B,W=C&65535,j=C>>>16,G=b&65535,K=b>>>16,b=r[7],C=n[7],W+=C&65535,j+=C>>>16,G+=b&65535,K+=b>>>16,j+=W>>>16,G+=j>>>16,K+=G>>>16,r[7]=v=G&65535|K<<16,n[7]=B=W&65535|j<<16,s+=128,o-=128}return s}function J7(t){var e=new E2;e.update(t);var r=e.digest();return e.clean(),r}Wn.hash=J7});var R2=m(Ve=>{"use strict";c();Object.defineProperty(Ve,"__esModule",{value:!0});Ve.convertSecretKeyToX25519=Ve.convertPublicKeyToX25519=Ve.verify=Ve.sign=Ve.extractPublicKeyFromSecretKey=Ve.generateKeyPair=Ve.generateKeyPairFromSeed=Ve.SEED_LENGTH=Ve.SECRET_KEY_LENGTH=Ve.PUBLIC_KEY_LENGTH=Ve.SIGNATURE_LENGTH=void 0;var X7=Rc(),Bc=w2(),I2=Fr();Ve.SIGNATURE_LENGTH=64;Ve.PUBLIC_KEY_LENGTH=32;Ve.SECRET_KEY_LENGTH=64;Ve.SEED_LENGTH=32;function be(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,S2(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 C2(t,e){let r=0;for(let n=0;n<32;n++)r|=t[n]^e[n];return(1&r-1>>>8)-1}function b2(t,e){let r=new Uint8Array(32),n=new Uint8Array(32);return Lc(r,t),Lc(n,e),C2(r,n)}function T2(t){let e=new Uint8Array(32);return Lc(e,t),e[0]&1}function n9(t,e){for(let r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function Fs(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]+r[n]}function Us(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]-r[n]}function Qe(t,e,r){let n,i,s=0,o=0,a=0,u=0,l=0,f=0,d=0,g=0,E=0,v=0,N=0,O=0,F=0,_=0,I=0,S=0,R=0,B=0,b=0,C=0,L=0,X=0,W=0,j=0,G=0,K=0,de=0,ue=0,re=0,Y=0,se=0,te=r[0],ie=r[1],q=r[2],le=r[3],ae=r[4],fe=r[5],oe=r[6],ce=r[7],y=r[8],w=r[9],A=r[10],P=r[11],T=r[12],D=r[13],M=r[14],x=r[15];n=e[0],s+=n*te,o+=n*ie,a+=n*q,u+=n*le,l+=n*ae,f+=n*fe,d+=n*oe,g+=n*ce,E+=n*y,v+=n*w,N+=n*A,O+=n*P,F+=n*T,_+=n*D,I+=n*M,S+=n*x,n=e[1],o+=n*te,a+=n*ie,u+=n*q,l+=n*le,f+=n*ae,d+=n*fe,g+=n*oe,E+=n*ce,v+=n*y,N+=n*w,O+=n*A,F+=n*P,_+=n*T,I+=n*D,S+=n*M,R+=n*x,n=e[2],a+=n*te,u+=n*ie,l+=n*q,f+=n*le,d+=n*ae,g+=n*fe,E+=n*oe,v+=n*ce,N+=n*y,O+=n*w,F+=n*A,_+=n*P,I+=n*T,S+=n*D,R+=n*M,B+=n*x,n=e[3],u+=n*te,l+=n*ie,f+=n*q,d+=n*le,g+=n*ae,E+=n*fe,v+=n*oe,N+=n*ce,O+=n*y,F+=n*w,_+=n*A,I+=n*P,S+=n*T,R+=n*D,B+=n*M,b+=n*x,n=e[4],l+=n*te,f+=n*ie,d+=n*q,g+=n*le,E+=n*ae,v+=n*fe,N+=n*oe,O+=n*ce,F+=n*y,_+=n*w,I+=n*A,S+=n*P,R+=n*T,B+=n*D,b+=n*M,C+=n*x,n=e[5],f+=n*te,d+=n*ie,g+=n*q,E+=n*le,v+=n*ae,N+=n*fe,O+=n*oe,F+=n*ce,_+=n*y,I+=n*w,S+=n*A,R+=n*P,B+=n*T,b+=n*D,C+=n*M,L+=n*x,n=e[6],d+=n*te,g+=n*ie,E+=n*q,v+=n*le,N+=n*ae,O+=n*fe,F+=n*oe,_+=n*ce,I+=n*y,S+=n*w,R+=n*A,B+=n*P,b+=n*T,C+=n*D,L+=n*M,X+=n*x,n=e[7],g+=n*te,E+=n*ie,v+=n*q,N+=n*le,O+=n*ae,F+=n*fe,_+=n*oe,I+=n*ce,S+=n*y,R+=n*w,B+=n*A,b+=n*P,C+=n*T,L+=n*D,X+=n*M,W+=n*x,n=e[8],E+=n*te,v+=n*ie,N+=n*q,O+=n*le,F+=n*ae,_+=n*fe,I+=n*oe,S+=n*ce,R+=n*y,B+=n*w,b+=n*A,C+=n*P,L+=n*T,X+=n*D,W+=n*M,j+=n*x,n=e[9],v+=n*te,N+=n*ie,O+=n*q,F+=n*le,_+=n*ae,I+=n*fe,S+=n*oe,R+=n*ce,B+=n*y,b+=n*w,C+=n*A,L+=n*P,X+=n*T,W+=n*D,j+=n*M,G+=n*x,n=e[10],N+=n*te,O+=n*ie,F+=n*q,_+=n*le,I+=n*ae,S+=n*fe,R+=n*oe,B+=n*ce,b+=n*y,C+=n*w,L+=n*A,X+=n*P,W+=n*T,j+=n*D,G+=n*M,K+=n*x,n=e[11],O+=n*te,F+=n*ie,_+=n*q,I+=n*le,S+=n*ae,R+=n*fe,B+=n*oe,b+=n*ce,C+=n*y,L+=n*w,X+=n*A,W+=n*P,j+=n*T,G+=n*D,K+=n*M,de+=n*x,n=e[12],F+=n*te,_+=n*ie,I+=n*q,S+=n*le,R+=n*ae,B+=n*fe,b+=n*oe,C+=n*ce,L+=n*y,X+=n*w,W+=n*A,j+=n*P,G+=n*T,K+=n*D,de+=n*M,ue+=n*x,n=e[13],_+=n*te,I+=n*ie,S+=n*q,R+=n*le,B+=n*ae,b+=n*fe,C+=n*oe,L+=n*ce,X+=n*y,W+=n*w,j+=n*A,G+=n*P,K+=n*T,de+=n*D,ue+=n*M,re+=n*x,n=e[14],I+=n*te,S+=n*ie,R+=n*q,B+=n*le,b+=n*ae,C+=n*fe,L+=n*oe,X+=n*ce,W+=n*y,j+=n*w,G+=n*A,K+=n*P,de+=n*T,ue+=n*D,re+=n*M,Y+=n*x,n=e[15],S+=n*te,R+=n*ie,B+=n*q,b+=n*le,C+=n*ae,L+=n*fe,X+=n*oe,W+=n*ce,j+=n*y,G+=n*w,K+=n*A,de+=n*P,ue+=n*T,re+=n*D,Y+=n*M,se+=n*x,s+=38*R,o+=38*B,a+=38*b,u+=38*C,l+=38*L,f+=38*X,d+=38*W,g+=38*j,E+=38*G,v+=38*K,N+=38*de,O+=38*ue,F+=38*re,_+=38*Y,I+=38*se,i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=l+i+65535,i=Math.floor(n/65536),l=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=g+i+65535,i=Math.floor(n/65536),g=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=v+i+65535,i=Math.floor(n/65536),v=n-i*65536,n=N+i+65535,i=Math.floor(n/65536),N=n-i*65536,n=O+i+65535,i=Math.floor(n/65536),O=n-i*65536,n=F+i+65535,i=Math.floor(n/65536),F=n-i*65536,n=_+i+65535,i=Math.floor(n/65536),_=n-i*65536,n=I+i+65535,i=Math.floor(n/65536),I=n-i*65536,n=S+i+65535,i=Math.floor(n/65536),S=n-i*65536,s+=i-1+37*(i-1),i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=l+i+65535,i=Math.floor(n/65536),l=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=g+i+65535,i=Math.floor(n/65536),g=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=v+i+65535,i=Math.floor(n/65536),v=n-i*65536,n=N+i+65535,i=Math.floor(n/65536),N=n-i*65536,n=O+i+65535,i=Math.floor(n/65536),O=n-i*65536,n=F+i+65535,i=Math.floor(n/65536),F=n-i*65536,n=_+i+65535,i=Math.floor(n/65536),_=n-i*65536,n=I+i+65535,i=Math.floor(n/65536),I=n-i*65536,n=S+i+65535,i=Math.floor(n/65536),S=n-i*65536,s+=i-1+37*(i-1),t[0]=s,t[1]=o,t[2]=a,t[3]=u,t[4]=l,t[5]=f,t[6]=d,t[7]=g,t[8]=E,t[9]=v,t[10]=N,t[11]=O,t[12]=F,t[13]=_,t[14]=I,t[15]=S}function Ms(t,e){Qe(t,e,e)}function x2(t,e){let r=be(),n;for(n=0;n<16;n++)r[n]=e[n];for(n=253;n>=0;n--)Ms(r,r),n!==2&&n!==4&&Qe(r,r,e);for(n=0;n<16;n++)t[n]=r[n]}function i9(t,e){let r=be(),n;for(n=0;n<16;n++)r[n]=e[n];for(n=250;n>=0;n--)Ms(r,r),n!==1&&Qe(r,r,e);for(n=0;n<16;n++)t[n]=r[n]}function n1(t,e){let r=be(),n=be(),i=be(),s=be(),o=be(),a=be(),u=be(),l=be(),f=be();Us(r,t[1],t[0]),Us(f,e[1],e[0]),Qe(r,r,f),Fs(n,t[0],t[1]),Fs(f,e[0],e[1]),Qe(n,n,f),Qe(i,t[3],e[3]),Qe(i,i,t9),Qe(s,t[2],e[2]),Fs(s,s,s),Us(o,n,r),Us(a,s,i),Fs(u,s,i),Fs(l,n,r),Qe(t[0],o,a),Qe(t[1],l,u),Qe(t[2],u,a),Qe(t[3],o,l)}function _2(t,e,r){for(let n=0;n<4;n++)S2(t[n],e[n],r)}function s1(t,e){let r=be(),n=be(),i=be();x2(i,e[2]),Qe(r,e[0],i),Qe(n,e[1],i),Lc(t,n),t[31]^=T2(r)<<7}function N2(t,e,r){Di(t[0],r1),Di(t[1],Ia),Di(t[2],Ia),Di(t[3],r1);for(let n=255;n>=0;--n){let i=r[n/8|0]>>(n&7)&1;_2(t,e,i),n1(e,t),n1(t,t),_2(t,e,i)}}function o1(t,e){let r=[be(),be(),be(),be()];Di(r[0],v2),Di(r[1],A2),Di(r[2],Ia),Qe(r[3],v2,A2),N2(t,r,e)}function O2(t){if(t.length!==Ve.SEED_LENGTH)throw new Error(`ed25519: seed must be ${Ve.SEED_LENGTH} bytes`);let e=(0,Bc.hash)(t);e[0]&=248,e[31]&=127,e[31]|=64;let r=new Uint8Array(32),n=[be(),be(),be(),be()];o1(n,e),s1(r,n);let i=new Uint8Array(64);return i.set(t),i.set(r,32),{publicKey:r,secretKey:i}}Ve.generateKeyPairFromSeed=O2;function s9(t){let e=(0,X7.randomBytes)(32,t),r=O2(e);return(0,I2.wipe)(e),r}Ve.generateKeyPair=s9;function o9(t){if(t.length!==Ve.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${Ve.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(t.subarray(32))}Ve.extractPublicKeyFromSecretKey=o9;var t1=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 D2(t,e){let r,n,i,s;for(n=63;n>=32;--n){for(r=0,i=n-32,s=n-12;i>4)*t1[i],r=e[i]>>8,e[i]&=255;for(i=0;i<32;i++)e[i]-=r*t1[i];for(n=0;n<32;n++)e[n+1]+=e[n]>>8,t[n]=e[n]&255}function i1(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;D2(t,e)}function a9(t,e){let r=new Float64Array(64),n=[be(),be(),be(),be()],i=(0,Bc.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 Bc.SHA512;o.update(s.subarray(32)),o.update(e);let a=o.digest();o.clean(),i1(a),o1(n,a),s1(s,n),o.reset(),o.update(s.subarray(0,32)),o.update(t.subarray(32)),o.update(e);let u=o.digest();i1(u);for(let l=0;l<32;l++)r[l]=a[l];for(let l=0;l<32;l++)for(let f=0;f<32;f++)r[l+f]+=u[l]*i[f];return D2(s.subarray(32),r),s}Ve.sign=a9;function P2(t,e){let r=be(),n=be(),i=be(),s=be(),o=be(),a=be(),u=be();return Di(t[2],Ia),n9(t[1],e),Ms(i,t[1]),Qe(s,i,e9),Us(i,i,t[2]),Fs(s,t[2],s),Ms(o,s),Ms(a,o),Qe(u,a,o),Qe(r,u,i),Qe(r,r,s),i9(r,r),Qe(r,r,i),Qe(r,r,s),Qe(r,r,s),Qe(t[0],r,s),Ms(n,t[0]),Qe(n,n,s),b2(n,i)&&Qe(t[0],t[0],r9),Ms(n,t[0]),Qe(n,n,s),b2(n,i)?-1:(T2(t[0])===e[31]>>7&&Us(t[0],r1,t[0]),Qe(t[3],t[0],t[1]),0)}function u9(t,e,r){let n=new Uint8Array(32),i=[be(),be(),be(),be()],s=[be(),be(),be(),be()];if(r.length!==Ve.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${Ve.SIGNATURE_LENGTH} bytes`);if(P2(s,t))return!1;let o=new Bc.SHA512;o.update(r.subarray(0,32)),o.update(t),o.update(e);let a=o.digest();return i1(a),N2(i,s,a),o1(s,r.subarray(32)),n1(i,s),s1(n,i),!C2(r,n)}Ve.verify=u9;function c9(t){let e=[be(),be(),be(),be()];if(P2(e,t))throw new Error("Ed25519: invalid public key");let r=be(),n=be(),i=e[1];Fs(r,Ia,i),Us(n,Ia,i),x2(n,n),Qe(r,r,n);let s=new Uint8Array(32);return Lc(s,r),s}Ve.convertPublicKeyToX25519=c9;function l9(t){let e=(0,Bc.hash)(t.subarray(0,32));e[0]&=248,e[31]&=127,e[31]|=64;let r=new Uint8Array(e.subarray(0,32));return(0,I2.wipe)(e),r}Ve.convertSecretKeyToX25519=l9});var Hd,jd,qs,Sa,Gd,Fc,kd,Qd,Wd,Ca,zd,$d,B2,L2,Kd=ge(()=>{c();Hd="EdDSA",jd="JWT",qs=".",Sa="base64url",Gd="utf8",Fc="utf8",kd=":",Qd="did",Wd="key",Ca="base58btc",zd="z",$d="K36",B2=32,L2=32});function Pi(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}var Mc=ge(()=>{c()});function Ta(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?Pi(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}var Yd=ge(()=>{c();Mc()});function Jd(t,e){e||(e=t.reduce((i,s)=>i+s.length,0));let r=Ta(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return Pi(r)}var a1=ge(()=>{c();Yd();Mc()});function f9(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,S=new Uint8Array(I);F!==_;){for(var R=v[F],B=0,b=I-1;(R!==0||B>>0,S[b]=R%a>>>0,R=R/a>>>0;if(R!==0)throw new Error("Non-zero carry");O=B,F++}for(var C=I-O;C!==I&&S[C]===0;)C++;for(var L=u.repeat(N);C>>0,I=new Uint8Array(_);v[N];){var S=r[v.charCodeAt(N)];if(S===255)return;for(var R=0,B=_-1;(S!==0||R>>0,I[B]=S%256>>>0,S=S/256>>>0;if(S!==0)throw new Error("Non-zero carry");F=R,N++}if(v[N]!==" "){for(var b=_-F;b!==_&&I[b]===0;)b++;for(var C=new Uint8Array(O+(_-b)),L=O;b!==_;)C[L++]=I[b++];return C}}}function E(v){var N=g(v);if(N)return N;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:g,decode:E}}var h9,d9,F2,M2=ge(()=>{c();h9=f9,d9=h9,F2=d9});var Ple,U2,zn,q2,V2,Ri=ge(()=>{c();Ple=new Uint8Array(0),U2=(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")},q2=t=>new TextEncoder().encode(t),V2=t=>new TextDecoder().decode(t)});var u1,c1,l1,j2,f1,xa,Bi,p9,g9,dt,Wr=ge(()=>{c();M2();Ri();u1=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")}},c1=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 j2(this,e)}},l1=class{constructor(e){this.decoders=e}or(e){return j2(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`)}},j2=(t,e)=>new l1({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),f1=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new u1(e,r,n),this.decoder=new c1(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},xa=({name:t,prefix:e,encode:r,decode:n})=>new f1(t,e,r,n),Bi=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=F2(r,e);return xa({prefix:t,name:e,encode:n,decode:s=>zn(i(s))})},p9=(t,e,r,n)=>{let i={};for(let f=0;f=8&&(a-=8,o[l++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},g9=(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<xa({prefix:e,name:t,encode(i){return g9(i,n,r)},decode(i){return p9(i,n,r,t)}})});var h1={};ft(h1,{identity:()=>y9});var y9,G2=ge(()=>{c();Wr();Ri();y9=xa({prefix:"\0",name:"identity",encode:t=>V2(t),decode:t=>q2(t)})});var d1={};ft(d1,{base2:()=>m9});var m9,k2=ge(()=>{c();Wr();m9=dt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1})});var p1={};ft(p1,{base8:()=>E9});var E9,Q2=ge(()=>{c();Wr();E9=dt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3})});var g1={};ft(g1,{base10:()=>w9});var w9,W2=ge(()=>{c();Wr();w9=Bi({prefix:"9",name:"base10",alphabet:"0123456789"})});var y1={};ft(y1,{base16:()=>v9,base16upper:()=>A9});var v9,A9,z2=ge(()=>{c();Wr();v9=dt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),A9=dt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})});var m1={};ft(m1,{base32:()=>Na,base32hex:()=>S9,base32hexpad:()=>T9,base32hexpadupper:()=>x9,base32hexupper:()=>C9,base32pad:()=>_9,base32padupper:()=>I9,base32upper:()=>b9,base32z:()=>N9});var Na,b9,_9,I9,S9,C9,T9,x9,N9,E1=ge(()=>{c();Wr();Na=dt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),b9=dt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),_9=dt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),I9=dt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),S9=dt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),C9=dt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),T9=dt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),x9=dt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),N9=dt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})});var w1={};ft(w1,{base36:()=>O9,base36upper:()=>D9});var O9,D9,$2=ge(()=>{c();Wr();O9=Bi({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),D9=Bi({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})});var v1={};ft(v1,{base58btc:()=>_n,base58flickr:()=>P9});var _n,P9,A1=ge(()=>{c();Wr();_n=Bi({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),P9=Bi({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})});var b1={};ft(b1,{base64:()=>R9,base64pad:()=>B9,base64url:()=>L9,base64urlpad:()=>F9});var R9,B9,L9,F9,K2=ge(()=>{c();Wr();R9=dt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),B9=dt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),L9=dt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),F9=dt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})});var _1={};ft(_1,{base256emoji:()=>H9});function q9(t){return t.reduce((e,r)=>(e+=M9[r],e),"")}function V9(t){let e=[];for(let r of t){let n=U9[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var Y2,M9,U9,H9,J2=ge(()=>{c();Wr();Y2=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}"),M9=Y2.reduce((t,e,r)=>(t[r]=e,t),[]),U9=Y2.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);H9=xa({prefix:"\u{1F680}",name:"base256emoji",encode:q9,decode:V9})});function eD(t,e,r){e=e||[],r=r||0;for(var n=r;t>=Q9;)e[r++]=t&255|X2,t/=128;for(;t&k9;)e[r++]=t&255|X2,t>>>=7;return e[r]=t|0,eD.bytes=r-n+1,e}function I1(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw I1.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&Z2)<=z9);return I1.bytes=s-n,r}var j9,X2,G9,k9,Q9,W9,z9,Z2,$9,K9,Y9,J9,X9,Z9,eQ,tQ,rQ,nQ,iQ,sQ,Uc,tD=ge(()=>{c();j9=eD,X2=128,G9=127,k9=~G9,Q9=Math.pow(2,31);W9=I1,z9=128,Z2=127;$9=Math.pow(2,7),K9=Math.pow(2,14),Y9=Math.pow(2,21),J9=Math.pow(2,28),X9=Math.pow(2,35),Z9=Math.pow(2,42),eQ=Math.pow(2,49),tQ=Math.pow(2,56),rQ=Math.pow(2,63),nQ=function(t){return t<$9?1:t{c();tD();qc=(t,e=0)=>[Uc.decode(t,e),Uc.decode.bytes],Oa=(t,e,r=0)=>(Uc.encode(t,e,r),e),Da=t=>Uc.encodingLength(t)});var Vs,rD,nD,Pa,Hc=ge(()=>{c();Ri();Zd();Vs=(t,e)=>{let r=e.byteLength,n=Da(t),i=n+Da(r),s=new Uint8Array(i+r);return Oa(t,s,0),Oa(r,s,n),s.set(e,i),new Pa(t,r,e,s)},rD=t=>{let e=zn(t),[r,n]=qc(e),[i,s]=qc(e.subarray(n)),o=e.subarray(n+s);if(o.byteLength!==i)throw new Error("Incorrect length");return new Pa(r,i,o,e)},nD=(t,e)=>t===e?!0:t.code===e.code&&t.size===e.size&&U2(t.bytes,e.bytes),Pa=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}});var C1,S1,T1=ge(()=>{c();Hc();C1=({name:t,code:e,encode:r})=>new S1(t,e,r),S1=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?Vs(this.code,r):r.then(n=>Vs(this.code,n))}else throw Error("Unknown type, must be binary type")}}});var x1={};ft(x1,{sha256:()=>oQ,sha512:()=>aQ});var sD,oQ,aQ,oD=ge(()=>{c();T1();sD=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),oQ=C1({name:"sha2-256",code:18,encode:sD("SHA-256")}),aQ=C1({name:"sha2-512",code:19,encode:sD("SHA-512")})});var N1={};ft(N1,{identity:()=>lQ});var aD,uQ,uD,cQ,lQ,cD=ge(()=>{c();Ri();Hc();aD=0,uQ="identity",uD=zn,cQ=t=>Vs(aD,uD(t)),lQ={code:aD,name:uQ,encode:uD,digest:cQ}});var lD=ge(()=>{c();Ri()});var Efe,wfe,fD=ge(()=>{c();Efe=new TextEncoder,wfe=new TextDecoder});var rp,dQ,pQ,gQ,jc,yQ,hD,dD,ep,tp,mQ,EQ,wQ,pD=ge(()=>{c();Zd();Hc();A1();E1();Ri();rp=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:tp,byteLength:tp,code:ep,version:ep,multihash:ep,bytes:ep,_baseCache:tp,asCID:tp})}toV0(){switch(this.version){case 0:return this;default:{let{code:e,multihash:r}=this;if(e!==jc)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==yQ)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=Vs(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&&nD(this.multihash,e.multihash)}toString(e){let{bytes:r,version:n,_baseCache:i}=this;switch(n){case 0:return pQ(r,i,e||_n.encoder);default:return gQ(r,i,e||Na.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 EQ(/^0\.0/,wQ),!!(e&&(e[dD]||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||hD(r,n,i.bytes))}else if(e!=null&&e[dD]===!0){let{version:r,multihash:n,code:i}=e,s=rD(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!==jc)throw new Error(`Version 0 CID must use dag-pb (code: ${jc}) block encoding`);return new t(e,r,n,n.bytes)}case 1:{let i=hD(e,r,n.bytes);return new t(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return t.create(0,jc,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=zn(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 Pa(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]=qc(e.subarray(r));return r+=g,d},i=n(),s=jc;if(i===18?(i=0,r=0):i===1&&(s=n()),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let o=r,a=n(),u=n(),l=r+u,f=l-o;return{version:i,codec:s,multihashCode:a,digestSize:u,multihashSize:f,size:l}}static parse(e,r){let[n,i]=dQ(e,r),s=t.decode(i);return s._baseCache.set(n,e),s}},dQ=(t,e)=>{switch(t[0]){case"Q":{let r=e||_n;return[_n.prefix,r.decode(`${_n.prefix}${t}`)]}case _n.prefix:{let r=e||_n;return[_n.prefix,r.decode(t)]}case Na.prefix:{let r=e||Na;return[Na.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)]}}},pQ=(t,e,r)=>{let{prefix:n}=r;if(n!==_n.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},gQ=(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},jc=112,yQ=18,hD=(t,e,r)=>{let n=Da(t),i=n+Da(e),s=new Uint8Array(i+r.byteLength);return Oa(t,s,0),Oa(e,s,n),s.set(r,i),s},dD=Symbol.for("@ipld/js-cid/CID"),ep={writable:!1,configurable:!1,enumerable:!0},tp={writable:!1,enumerable:!1,configurable:!1},mQ="0.0.0-dev",EQ=(t,e)=>{if(t.test(mQ))console.warn(e);else throw new Error(e)},wQ=`CID.isCID(v) is deprecated and will be removed in the next major release. Following code pattern: if (CID.isCID(value)) { @@ -17,27 +17,33 @@ if (cid) { // Make sure to use cid instead of value doSomethingWithCID(cid) } -`});var LO=ge(()=>{c();BO();cp();Vi();iv();_l()});var av,zce,FO=ge(()=>{c();cO();lO();fO();hO();dO();$1();pO();X1();gO();mO();CO();NO();OO();DO();LO();av={...G1,...Q1,...k1,...z1,...W1,...K1,...Y1,...J1,...Z1,...ev},zce={...sv,...ov}});function UO(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var MO,uv,oQ,hp,cv=ge(()=>{c();FO();op();MO=UO("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),uv=UO("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);let e=Tu(t.length);for(let r=0;r{c();cv()});function In(t,e="utf8"){let r=hp[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?qi(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}var fv=ge(()=>{c();cv();El()});function Sl(t){return dl(Jn(In(t,Su),Zd))}function Cl(t){return Jn(In(pl(t),Zd),Su)}function hv(t){let e=In(ip,Cu),r=np+Jn(ap([e,t]),Cu);return[tp,rp,r].join(ep)}function dv(t){let[e,r,n]=t.split(ep);if(e!==tp||r!==rp)throw new Error('Issuer must be a DID with method "key"');if(n.slice(0,1)!==np)throw new Error("Issuer must be a key in mulicodec format");let s=In(n.slice(1),Cu);if(Jn(s.slice(0,2),Cu)!==ip)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 qO(t){return Jn(t,Su)}function VO(t){return In(t,Su)}function pv(t){return In([Cl(t.header),Cl(t.payload)].join(po),wl)}function aQ(t){let e=Jn(t,wl).split(po),r=Sl(e[0]),n=Sl(e[1]);return{header:r,payload:n}}function gv(t){return[Cl(t.header),Cl(t.payload),qO(t.signature)].join(po)}function yv(t){let e=t.split(po),r=Sl(e[0]),n=Sl(e[1]),i=VO(e[2]),s=In(e.slice(0,2).join(po),wl);return{header:r,payload:n,signature:i,data:s}}var mv=ge(()=>{c();U1();lv();fv();kd();sp()});function uQ(t=(0,jO.randomBytes)(32)){return Ru.generateKeyPairFromSeed(t)}async function cQ(t,e,r,n,i=(0,HO.fromMiliseconds)(Date.now())){let s={alg:Jd,typ:Xd},o=hv(n.publicKey),a=i+r,u={iss:o,sub:t,aud:e,iat:i,exp:a},l=pv({header:s,payload:u}),f=Ru.sign(n.secretKey,l);return gv({header:s,payload:u,signature:f})}async function lQ(t){let{header:e,payload:r,data:n,signature:i}=yv(t);if(e.alg!==Jd||e.typ!==Xd)throw new Error("JWT must use EdDSA algorithm");let s=dv(r.iss);return Ru.verify(s,n,i)}var Ru,jO,HO,GO=ge(()=>{c();Ru=_e(ZN()),jO=_e(gl()),HO=_e(co());sp();mv()});var QO=ge(()=>{c()});var kO={};at(kO,{DATA_ENCODING:()=>wl,DID_DELIMITER:()=>ep,DID_METHOD:()=>rp,DID_PREFIX:()=>tp,JSON_ENCODING:()=>Zd,JWT_DELIMITER:()=>po,JWT_ENCODING:()=>Su,JWT_IRIDIUM_ALG:()=>Jd,JWT_IRIDIUM_TYP:()=>Xd,KEY_PAIR_SEED_LENGTH:()=>tO,MULTICODEC_ED25519_BASE:()=>np,MULTICODEC_ED25519_ENCODING:()=>Cu,MULTICODEC_ED25519_HEADER:()=>ip,MULTICODEC_ED25519_LENGTH:()=>eO,decodeData:()=>aQ,decodeIss:()=>dv,decodeJSON:()=>Sl,decodeJWT:()=>yv,decodeSig:()=>VO,encodeData:()=>pv,encodeIss:()=>hv,encodeJSON:()=>Cl,encodeJWT:()=>gv,encodeSig:()=>qO,generateKeyPair:()=>uQ,signJWT:()=>cQ,verifyJWT:()=>lQ});var zO=ge(()=>{c();GO();sp();QO();mv()});var KO=w(dp=>{"use strict";c();Object.defineProperty(dp,"__esModule",{value:!0});var Wt=Au(),wv=Or(),fQ=20;function hQ(t,e,r){for(var n=1634760805,i=857760878,s=2036477234,o=1797285236,a=r[3]<<24|r[2]<<16|r[1]<<8|r[0],u=r[7]<<24|r[6]<<16|r[5]<<8|r[4],l=r[11]<<24|r[10]<<16|r[9]<<8|r[8],f=r[15]<<24|r[14]<<16|r[13]<<8|r[12],d=r[19]<<24|r[18]<<16|r[17]<<8|r[16],y=r[23]<<24|r[22]<<16|r[21]<<8|r[20],m=r[27]<<24|r[26]<<16|r[25]<<8|r[24],v=r[31]<<24|r[30]<<16|r[29]<<8|r[28],T=e[3]<<24|e[2]<<16|e[1]<<8|e[0],B=e[7]<<24|e[6]<<16|e[5]<<8|e[4],A=e[11]<<24|e[10]<<16|e[9]<<8|e[8],D=e[15]<<24|e[14]<<16|e[13]<<8|e[12],x=n,R=i,P=s,L=o,_=a,C=u,M=l,Z=f,z=d,H=y,G=m,$=v,de=T,ae=B,re=A,Y=D,ie=0;ie>>32-16|de<<16,z=z+de|0,_^=z,_=_>>>32-12|_<<12,R=R+C|0,ae^=R,ae=ae>>>32-16|ae<<16,H=H+ae|0,C^=H,C=C>>>32-12|C<<12,P=P+M|0,re^=P,re=re>>>32-16|re<<16,G=G+re|0,M^=G,M=M>>>32-12|M<<12,L=L+Z|0,Y^=L,Y=Y>>>32-16|Y<<16,$=$+Y|0,Z^=$,Z=Z>>>32-12|Z<<12,P=P+M|0,re^=P,re=re>>>32-8|re<<8,G=G+re|0,M^=G,M=M>>>32-7|M<<7,L=L+Z|0,Y^=L,Y=Y>>>32-8|Y<<8,$=$+Y|0,Z^=$,Z=Z>>>32-7|Z<<7,R=R+C|0,ae^=R,ae=ae>>>32-8|ae<<8,H=H+ae|0,C^=H,C=C>>>32-7|C<<7,x=x+_|0,de^=x,de=de>>>32-8|de<<8,z=z+de|0,_^=z,_=_>>>32-7|_<<7,x=x+C|0,Y^=x,Y=Y>>>32-16|Y<<16,G=G+Y|0,C^=G,C=C>>>32-12|C<<12,R=R+M|0,de^=R,de=de>>>32-16|de<<16,$=$+de|0,M^=$,M=M>>>32-12|M<<12,P=P+Z|0,ae^=P,ae=ae>>>32-16|ae<<16,z=z+ae|0,Z^=z,Z=Z>>>32-12|Z<<12,L=L+_|0,re^=L,re=re>>>32-16|re<<16,H=H+re|0,_^=H,_=_>>>32-12|_<<12,P=P+Z|0,ae^=P,ae=ae>>>32-8|ae<<8,z=z+ae|0,Z^=z,Z=Z>>>32-7|Z<<7,L=L+_|0,re^=L,re=re>>>32-8|re<<8,H=H+re|0,_^=H,_=_>>>32-7|_<<7,R=R+M|0,de^=R,de=de>>>32-8|de<<8,$=$+de|0,M^=$,M=M>>>32-7|M<<7,x=x+C|0,Y^=x,Y=Y>>>32-8|Y<<8,G=G+Y|0,C^=G,C=C>>>32-7|C<<7;Wt.writeUint32LE(x+n|0,t,0),Wt.writeUint32LE(R+i|0,t,4),Wt.writeUint32LE(P+s|0,t,8),Wt.writeUint32LE(L+o|0,t,12),Wt.writeUint32LE(_+a|0,t,16),Wt.writeUint32LE(C+u|0,t,20),Wt.writeUint32LE(M+l|0,t,24),Wt.writeUint32LE(Z+f|0,t,28),Wt.writeUint32LE(z+d|0,t,32),Wt.writeUint32LE(H+y|0,t,36),Wt.writeUint32LE(G+m|0,t,40),Wt.writeUint32LE($+v|0,t,44),Wt.writeUint32LE(de+T|0,t,48),Wt.writeUint32LE(ae+B|0,t,52),Wt.writeUint32LE(re+A|0,t,56),Wt.writeUint32LE(Y+D|0,t,60)}function WO(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 pp=w(Bu=>{"use strict";c();Object.defineProperty(Bu,"__esModule",{value:!0});function gQ(t,e,r){return~(t-1)&e|t-1&r}Bu.select=gQ;function yQ(t,e){return(t|0)-(e|0)-1>>>31&1}Bu.lessOrEqual=yQ;function $O(t,e){if(t.length!==e.length)return 0;for(var r=0,n=0;n>>8}Bu.compare=$O;function mQ(t,e){return t.length===0||e.length===0?!1:$O(t,e)!==0}Bu.equal=mQ});var JO=w(Xn=>{"use strict";c();Object.defineProperty(Xn,"__esModule",{value:!0});var wQ=pp(),gp=Or();Xn.DIGEST_LENGTH=16;var YO=function(){function t(e){this.digestLength=Xn.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var r=e[0]|e[1]<<8;this._r[0]=r&8191;var n=e[2]|e[3]<<8;this._r[1]=(r>>>13|n<<3)&8191;var i=e[4]|e[5]<<8;this._r[2]=(n>>>10|i<<6)&7939;var s=e[6]|e[7]<<8;this._r[3]=(i>>>7|s<<9)&8191;var o=e[8]|e[9]<<8;this._r[4]=(s>>>4|o<<12)&255,this._r[5]=o>>>1&8190;var a=e[10]|e[11]<<8;this._r[6]=(o>>>14|a<<2)&8191;var u=e[12]|e[13]<<8;this._r[7]=(a>>>11|u<<5)&8065;var l=e[14]|e[15]<<8;this._r[8]=(u>>>8|l<<8)&8191,this._r[9]=l>>>5&127,this._pad[0]=e[16]|e[17]<<8,this._pad[1]=e[18]|e[19]<<8,this._pad[2]=e[20]|e[21]<<8,this._pad[3]=e[22]|e[23]<<8,this._pad[4]=e[24]|e[25]<<8,this._pad[5]=e[26]|e[27]<<8,this._pad[6]=e[28]|e[29]<<8,this._pad[7]=e[30]|e[31]<<8}return t.prototype._blocks=function(e,r,n){for(var i=this._fin?0:2048,s=this._h[0],o=this._h[1],a=this._h[2],u=this._h[3],l=this._h[4],f=this._h[5],d=this._h[6],y=this._h[7],m=this._h[8],v=this._h[9],T=this._r[0],B=this._r[1],A=this._r[2],D=this._r[3],x=this._r[4],R=this._r[5],P=this._r[6],L=this._r[7],_=this._r[8],C=this._r[9];n>=16;){var M=e[r+0]|e[r+1]<<8;s+=M&8191;var Z=e[r+2]|e[r+3]<<8;o+=(M>>>13|Z<<3)&8191;var z=e[r+4]|e[r+5]<<8;a+=(Z>>>10|z<<6)&8191;var H=e[r+6]|e[r+7]<<8;u+=(z>>>7|H<<9)&8191;var G=e[r+8]|e[r+9]<<8;l+=(H>>>4|G<<12)&8191,f+=G>>>1&8191;var $=e[r+10]|e[r+11]<<8;d+=(G>>>14|$<<2)&8191;var de=e[r+12]|e[r+13]<<8;y+=($>>>11|de<<5)&8191;var ae=e[r+14]|e[r+15]<<8;m+=(de>>>8|ae<<8)&8191,v+=ae>>>5|i;var re=0,Y=re;Y+=s*T,Y+=o*(5*C),Y+=a*(5*_),Y+=u*(5*L),Y+=l*(5*P),re=Y>>>13,Y&=8191,Y+=f*(5*R),Y+=d*(5*x),Y+=y*(5*D),Y+=m*(5*A),Y+=v*(5*B),re+=Y>>>13,Y&=8191;var ie=re;ie+=s*B,ie+=o*T,ie+=a*(5*C),ie+=u*(5*_),ie+=l*(5*L),re=ie>>>13,ie&=8191,ie+=f*(5*P),ie+=d*(5*R),ie+=y*(5*x),ie+=m*(5*D),ie+=v*(5*A),re+=ie>>>13,ie&=8191;var te=re;te+=s*A,te+=o*B,te+=a*T,te+=u*(5*C),te+=l*(5*_),re=te>>>13,te&=8191,te+=f*(5*L),te+=d*(5*P),te+=y*(5*R),te+=m*(5*x),te+=v*(5*D),re+=te>>>13,te&=8191;var ne=re;ne+=s*D,ne+=o*A,ne+=a*B,ne+=u*T,ne+=l*(5*C),re=ne>>>13,ne&=8191,ne+=f*(5*_),ne+=d*(5*L),ne+=y*(5*P),ne+=m*(5*R),ne+=v*(5*x),re+=ne>>>13,ne&=8191;var q=re;q+=s*x,q+=o*D,q+=a*A,q+=u*B,q+=l*T,re=q>>>13,q&=8191,q+=f*(5*C),q+=d*(5*_),q+=y*(5*L),q+=m*(5*P),q+=v*(5*R),re+=q>>>13,q&=8191;var ce=re;ce+=s*R,ce+=o*x,ce+=a*D,ce+=u*A,ce+=l*B,re=ce>>>13,ce&=8191,ce+=f*T,ce+=d*(5*C),ce+=y*(5*_),ce+=m*(5*L),ce+=v*(5*P),re+=ce>>>13,ce&=8191;var oe=re;oe+=s*P,oe+=o*R,oe+=a*x,oe+=u*D,oe+=l*A,re=oe>>>13,oe&=8191,oe+=f*B,oe+=d*T,oe+=y*(5*C),oe+=m*(5*_),oe+=v*(5*L),re+=oe>>>13,oe&=8191;var le=re;le+=s*L,le+=o*P,le+=a*R,le+=u*x,le+=l*D,re=le>>>13,le&=8191,le+=f*A,le+=d*B,le+=y*T,le+=m*(5*C),le+=v*(5*_),re+=le>>>13,le&=8191;var se=re;se+=s*_,se+=o*L,se+=a*P,se+=u*R,se+=l*x,re=se>>>13,se&=8191,se+=f*D,se+=d*A,se+=y*B,se+=m*T,se+=v*(5*C),re+=se>>>13,se&=8191;var ue=re;ue+=s*C,ue+=o*_,ue+=a*L,ue+=u*P,ue+=l*R,re=ue>>>13,ue&=8191,ue+=f*x,ue+=d*D,ue+=y*A,ue+=m*B,ue+=v*T,re+=ue>>>13,ue&=8191,re=(re<<2)+re|0,re=re+Y|0,Y=re&8191,re=re>>>13,ie+=re,s=Y,o=ie,a=te,u=ne,l=q,f=ce,d=oe,y=le,m=se,v=ue,r+=16,n-=16}this._h[0]=s,this._h[1]=o,this._h[2]=a,this._h[3]=u,this._h[4]=l,this._h[5]=f,this._h[6]=d,this._h[7]=y,this._h[8]=m,this._h[9]=v},t.prototype.finish=function(e,r){r===void 0&&(r=0);var n=new Uint16Array(10),i,s,o,a;if(this._leftover){for(a=this._leftover,this._buffer[a++]=1;a<16;a++)this._buffer[a]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(i=this._h[1]>>>13,this._h[1]&=8191,a=2;a<10;a++)this._h[a]+=i,i=this._h[a]>>>13,this._h[a]&=8191;for(this._h[0]+=i*5,i=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=i,i=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=i,n[0]=this._h[0]+5,i=n[0]>>>13,n[0]&=8191,a=1;a<10;a++)n[a]=this._h[a]+i,i=n[a]>>>13,n[a]&=8191;for(n[9]-=8192,s=(i^1)-1,a=0;a<10;a++)n[a]&=s;for(s=~s,a=0;a<10;a++)this._h[a]=this._h[a]&s|n[a];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,o=this._h[0]+this._pad[0],this._h[0]=o&65535,a=1;a<8;a++)o=(this._h[a]+this._pad[a]|0)+(o>>>16)|0,this._h[a]=o&65535;return e[r+0]=this._h[0]>>>0,e[r+1]=this._h[0]>>>8,e[r+2]=this._h[1]>>>0,e[r+3]=this._h[1]>>>8,e[r+4]=this._h[2]>>>0,e[r+5]=this._h[2]>>>8,e[r+6]=this._h[3]>>>0,e[r+7]=this._h[3]>>>8,e[r+8]=this._h[4]>>>0,e[r+9]=this._h[4]>>>8,e[r+10]=this._h[5]>>>0,e[r+11]=this._h[5]>>>8,e[r+12]=this._h[6]>>>0,e[r+13]=this._h[6]>>>8,e[r+14]=this._h[7]>>>0,e[r+15]=this._h[7]>>>8,this._finished=!0,this},t.prototype.update=function(e){var r=0,n=e.length,i;if(this._leftover){i=16-this._leftover,i>n&&(i=n);for(var s=0;s=16&&(i=n-n%16,this._blocks(e,r,i),r+=i,n-=i),n){for(var s=0;s{"use strict";c();Object.defineProperty(Zn,"__esModule",{value:!0});var yp=KO(),AQ=JO(),Tl=Or(),XO=Au(),bQ=pp();Zn.KEY_LENGTH=32;Zn.NONCE_LENGTH=12;Zn.TAG_LENGTH=16;var ZO=new Uint8Array(16),_Q=function(){function t(e){if(this.nonceLength=Zn.NONCE_LENGTH,this.tagLength=Zn.TAG_LENGTH,e.length!==Zn.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);yp.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 yp.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),Tl.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(ZO.subarray(i.length%16))),s.update(n),n.length%16>0&&s.update(ZO.subarray(n.length%16));var o=new Uint8Array(8);i&&XO.writeUint64LE(i.length,o),s.update(o),XO.writeUint64LE(n.length,o),s.update(o);for(var a=s.digest(),u=0;u{"use strict";c();Object.defineProperty(Ev,"__esModule",{value:!0});function IQ(t){return typeof t.saveState<"u"&&typeof t.restoreState<"u"&&typeof t.cleanSavedState<"u"}Ev.isSerializableHash=IQ});var nD=w(xl=>{"use strict";c();Object.defineProperty(xl,"__esModule",{value:!0});var Sn=tD(),SQ=pp(),CQ=Or(),rD=function(){function t(e,r){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var n=new Uint8Array(this.blockSize);r.length>this.blockSize?this._inner.update(r).finish(n).clean():n.set(r);for(var i=0;i{"use strict";c();Object.defineProperty(vv,"__esModule",{value:!0});var iD=nD(),sD=Or(),xQ=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=iD.hmac(this._hash,n,r);this._hmac=new iD.HMAC(e,s),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return t.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(e===0)throw new Error("hkdf: cannot expand more");this._hmac.reset(),e>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},t.prototype.expand=function(e){for(var r=new Uint8Array(e),n=0;n{"use strict";c();Object.defineProperty(Hi,"__esModule",{value:!0});var wp=Au(),mp=Or();Hi.DIGEST_LENGTH=32;Hi.BLOCK_SIZE=64;var aD=function(){function t(){this.digestLength=Hi.DIGEST_LENGTH,this.blockSize=Hi.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(){mp.wipe(this._buffer),mp.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&&(Av(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(n=Av(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){mp.wipe(e.state),e.buffer&&mp.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},t}();Hi.SHA256=aD;var NQ=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 Av(t,e,r,n,i){for(;i>=64;){for(var s=e[0],o=e[1],a=e[2],u=e[3],l=e[4],f=e[5],d=e[6],y=e[7],m=0;m<16;m++){var v=n+m*4;t[m]=wp.readUint32BE(r,v)}for(var m=16;m<64;m++){var T=t[m-2],B=(T>>>17|T<<32-17)^(T>>>19|T<<32-19)^T>>>10;T=t[m-15];var A=(T>>>7|T<<32-7)^(T>>>18|T<<32-18)^T>>>3;t[m]=(B+t[m-7]|0)+(A+t[m-16]|0)}for(var m=0;m<64;m++){var B=(((l>>>6|l<<26)^(l>>>11|l<<21)^(l>>>25|l<<7))+(l&f^~l&d)|0)+(y+(NQ[m]+t[m]|0)|0)|0,A=((s>>>2|s<<32-2)^(s>>>13|s<<32-13)^(s>>>22|s<<32-22))+(s&o^s&a^o&a)|0;y=d,d=f,f=l,l=u+B|0,u=a,a=o,o=s,s=B+A|0}e[0]+=s,e[1]+=o,e[2]+=a,e[3]+=u,e[4]+=l,e[5]+=f,e[6]+=d,e[7]+=y,n+=64,i-=64}return n}function OQ(t){var e=new aD;e.update(t);var r=e.digest();return e.clean(),r}Hi.hash=OQ});var hD=w(lt=>{"use strict";c();Object.defineProperty(lt,"__esModule",{value:!0});lt.sharedKey=lt.generateKeyPair=lt.generateKeyPairFromSeed=lt.scalarMultBase=lt.scalarMult=lt.SHARED_KEY_LENGTH=lt.SECRET_KEY_LENGTH=lt.PUBLIC_KEY_LENGTH=void 0;var DQ=gl(),PQ=Or();lt.PUBLIC_KEY_LENGTH=32;lt.SECRET_KEY_LENGTH=32;lt.SHARED_KEY_LENGTH=32;function Cn(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,Nl(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 LQ(t,e){for(let r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function Ep(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]+r[n]}function vp(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]-r[n]}function ei(t,e,r){let n,i,s=0,o=0,a=0,u=0,l=0,f=0,d=0,y=0,m=0,v=0,T=0,B=0,A=0,D=0,x=0,R=0,P=0,L=0,_=0,C=0,M=0,Z=0,z=0,H=0,G=0,$=0,de=0,ae=0,re=0,Y=0,ie=0,te=r[0],ne=r[1],q=r[2],ce=r[3],oe=r[4],le=r[5],se=r[6],ue=r[7],g=r[8],E=r[9],b=r[10],O=r[11],I=r[12],N=r[13],F=r[14],S=r[15];n=e[0],s+=n*te,o+=n*ne,a+=n*q,u+=n*ce,l+=n*oe,f+=n*le,d+=n*se,y+=n*ue,m+=n*g,v+=n*E,T+=n*b,B+=n*O,A+=n*I,D+=n*N,x+=n*F,R+=n*S,n=e[1],o+=n*te,a+=n*ne,u+=n*q,l+=n*ce,f+=n*oe,d+=n*le,y+=n*se,m+=n*ue,v+=n*g,T+=n*E,B+=n*b,A+=n*O,D+=n*I,x+=n*N,R+=n*F,P+=n*S,n=e[2],a+=n*te,u+=n*ne,l+=n*q,f+=n*ce,d+=n*oe,y+=n*le,m+=n*se,v+=n*ue,T+=n*g,B+=n*E,A+=n*b,D+=n*O,x+=n*I,R+=n*N,P+=n*F,L+=n*S,n=e[3],u+=n*te,l+=n*ne,f+=n*q,d+=n*ce,y+=n*oe,m+=n*le,v+=n*se,T+=n*ue,B+=n*g,A+=n*E,D+=n*b,x+=n*O,R+=n*I,P+=n*N,L+=n*F,_+=n*S,n=e[4],l+=n*te,f+=n*ne,d+=n*q,y+=n*ce,m+=n*oe,v+=n*le,T+=n*se,B+=n*ue,A+=n*g,D+=n*E,x+=n*b,R+=n*O,P+=n*I,L+=n*N,_+=n*F,C+=n*S,n=e[5],f+=n*te,d+=n*ne,y+=n*q,m+=n*ce,v+=n*oe,T+=n*le,B+=n*se,A+=n*ue,D+=n*g,x+=n*E,R+=n*b,P+=n*O,L+=n*I,_+=n*N,C+=n*F,M+=n*S,n=e[6],d+=n*te,y+=n*ne,m+=n*q,v+=n*ce,T+=n*oe,B+=n*le,A+=n*se,D+=n*ue,x+=n*g,R+=n*E,P+=n*b,L+=n*O,_+=n*I,C+=n*N,M+=n*F,Z+=n*S,n=e[7],y+=n*te,m+=n*ne,v+=n*q,T+=n*ce,B+=n*oe,A+=n*le,D+=n*se,x+=n*ue,R+=n*g,P+=n*E,L+=n*b,_+=n*O,C+=n*I,M+=n*N,Z+=n*F,z+=n*S,n=e[8],m+=n*te,v+=n*ne,T+=n*q,B+=n*ce,A+=n*oe,D+=n*le,x+=n*se,R+=n*ue,P+=n*g,L+=n*E,_+=n*b,C+=n*O,M+=n*I,Z+=n*N,z+=n*F,H+=n*S,n=e[9],v+=n*te,T+=n*ne,B+=n*q,A+=n*ce,D+=n*oe,x+=n*le,R+=n*se,P+=n*ue,L+=n*g,_+=n*E,C+=n*b,M+=n*O,Z+=n*I,z+=n*N,H+=n*F,G+=n*S,n=e[10],T+=n*te,B+=n*ne,A+=n*q,D+=n*ce,x+=n*oe,R+=n*le,P+=n*se,L+=n*ue,_+=n*g,C+=n*E,M+=n*b,Z+=n*O,z+=n*I,H+=n*N,G+=n*F,$+=n*S,n=e[11],B+=n*te,A+=n*ne,D+=n*q,x+=n*ce,R+=n*oe,P+=n*le,L+=n*se,_+=n*ue,C+=n*g,M+=n*E,Z+=n*b,z+=n*O,H+=n*I,G+=n*N,$+=n*F,de+=n*S,n=e[12],A+=n*te,D+=n*ne,x+=n*q,R+=n*ce,P+=n*oe,L+=n*le,_+=n*se,C+=n*ue,M+=n*g,Z+=n*E,z+=n*b,H+=n*O,G+=n*I,$+=n*N,de+=n*F,ae+=n*S,n=e[13],D+=n*te,x+=n*ne,R+=n*q,P+=n*ce,L+=n*oe,_+=n*le,C+=n*se,M+=n*ue,Z+=n*g,z+=n*E,H+=n*b,G+=n*O,$+=n*I,de+=n*N,ae+=n*F,re+=n*S,n=e[14],x+=n*te,R+=n*ne,P+=n*q,L+=n*ce,_+=n*oe,C+=n*le,M+=n*se,Z+=n*ue,z+=n*g,H+=n*E,G+=n*b,$+=n*O,de+=n*I,ae+=n*N,re+=n*F,Y+=n*S,n=e[15],R+=n*te,P+=n*ne,L+=n*q,_+=n*ce,C+=n*oe,M+=n*le,Z+=n*se,z+=n*ue,H+=n*g,G+=n*E,$+=n*b,de+=n*O,ae+=n*I,re+=n*N,Y+=n*F,ie+=n*S,s+=38*P,o+=38*L,a+=38*_,u+=38*C,l+=38*M,f+=38*Z,d+=38*z,y+=38*H,m+=38*G,v+=38*$,T+=38*de,B+=38*ae,A+=38*re,D+=38*Y,x+=38*ie,i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=l+i+65535,i=Math.floor(n/65536),l=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=m+i+65535,i=Math.floor(n/65536),m=n-i*65536,n=v+i+65535,i=Math.floor(n/65536),v=n-i*65536,n=T+i+65535,i=Math.floor(n/65536),T=n-i*65536,n=B+i+65535,i=Math.floor(n/65536),B=n-i*65536,n=A+i+65535,i=Math.floor(n/65536),A=n-i*65536,n=D+i+65535,i=Math.floor(n/65536),D=n-i*65536,n=x+i+65535,i=Math.floor(n/65536),x=n-i*65536,n=R+i+65535,i=Math.floor(n/65536),R=n-i*65536,s+=i-1+37*(i-1),i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=l+i+65535,i=Math.floor(n/65536),l=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=m+i+65535,i=Math.floor(n/65536),m=n-i*65536,n=v+i+65535,i=Math.floor(n/65536),v=n-i*65536,n=T+i+65535,i=Math.floor(n/65536),T=n-i*65536,n=B+i+65535,i=Math.floor(n/65536),B=n-i*65536,n=A+i+65535,i=Math.floor(n/65536),A=n-i*65536,n=D+i+65535,i=Math.floor(n/65536),D=n-i*65536,n=x+i+65535,i=Math.floor(n/65536),x=n-i*65536,n=R+i+65535,i=Math.floor(n/65536),R=n-i*65536,s+=i-1+37*(i-1),t[0]=s,t[1]=o,t[2]=a,t[3]=u,t[4]=l,t[5]=f,t[6]=d,t[7]=y,t[8]=m,t[9]=v,t[10]=T,t[11]=B,t[12]=A,t[13]=D,t[14]=x,t[15]=R}function Ol(t,e){ei(t,e,e)}function FQ(t,e){let r=Cn();for(let n=0;n<16;n++)r[n]=e[n];for(let n=253;n>=0;n--)Ol(r,r),n!==2&&n!==4&&ei(r,r,e);for(let n=0;n<16;n++)t[n]=r[n]}function _v(t,e){let r=new Uint8Array(32),n=new Float64Array(80),i=Cn(),s=Cn(),o=Cn(),a=Cn(),u=Cn(),l=Cn();for(let m=0;m<31;m++)r[m]=t[m];r[31]=t[31]&127|64,r[0]&=248,LQ(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 v=r[m>>>3]>>>(m&7)&1;Nl(i,s,v),Nl(o,a,v),Ep(u,i,o),vp(i,i,o),Ep(o,s,a),vp(s,s,a),Ol(a,u),Ol(l,i),ei(i,o,i),ei(o,s,u),Ep(u,i,o),vp(i,i,o),Ol(s,i),vp(o,a,l),ei(i,o,RQ),Ep(i,i,a),ei(o,o,i),ei(i,a,l),ei(a,s,n),Ol(s,u),Nl(i,s,v),Nl(o,a,v)}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);FQ(f,f),ei(d,d,f);let y=new Uint8Array(32);return BQ(y,d),y}lt.scalarMult=_v;function lD(t){return _v(t,cD)}lt.scalarMultBase=lD;function fD(t){if(t.length!==lt.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${lt.SECRET_KEY_LENGTH} bytes`);let e=new Uint8Array(t);return{publicKey:lD(e),secretKey:e}}lt.generateKeyPairFromSeed=fD;function MQ(t){let e=(0,DQ.randomBytes)(32,t),r=fD(e);return(0,PQ.wipe)(e),r}lt.generateKeyPair=MQ;function UQ(t,e,r=!1){if(t.length!==lt.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(e.length!==lt.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");let n=_v(t,e);if(r){let i=0;for(let s=0;se[r])return 1}return t.byteLength>e.byteLength?1:t.byteLength{c()});function gD(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r{c()});function mD(t,e){if(t.length!==e.length)throw new Error("Inputs should have the same length");let r=Tu(t.length);for(let n=0;n{c();op();El()});var Iv={};at(Iv,{compare:()=>dD,concat:()=>ap,equals:()=>gD,fromString:()=>In,toString:()=>Jn,xor:()=>mD});var Sv=ge(()=>{c();pD();U1();yD();fv();lv();wD()});var OD=w(Ze=>{"use strict";c();var ED=Ze&&Ze.__spreadArray||function(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,s;n"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new CD:typeof navigator<"u"?Cv(navigator.userAgent):ND()}Ze.detect=HQ;function TD(t){return t!==""&&jQ.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 GQ(t){var e=TD(t);return e?e[0]:null}Ze.browserName=GQ;function Cv(t){var e=TD(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new SD;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length{"use strict";c();Object.defineProperty(We,"__esModule",{value:!0});We.getLocalStorage=We.getLocalStorageOrThrow=We.getCrypto=We.getCryptoOrThrow=We.getLocation=We.getLocationOrThrow=We.getNavigator=We.getNavigatorOrThrow=We.getDocument=We.getDocumentOrThrow=We.getFromWindowOrThrow=We.getFromWindow=void 0;function yo(t){let e;return typeof window<"u"&&typeof window[t]<"u"&&(e=window[t]),e}We.getFromWindow=yo;function Lu(t){let e=yo(t);if(!e)throw new Error(`${t} is not defined in Window`);return e}We.getFromWindowOrThrow=Lu;function kQ(){return Lu("document")}We.getDocumentOrThrow=kQ;function zQ(){return yo("document")}We.getDocument=zQ;function WQ(){return Lu("navigator")}We.getNavigatorOrThrow=WQ;function KQ(){return yo("navigator")}We.getNavigator=KQ;function $Q(){return Lu("location")}We.getLocationOrThrow=$Q;function YQ(){return yo("location")}We.getLocation=YQ;function JQ(){return Lu("crypto")}We.getCryptoOrThrow=JQ;function XQ(){return yo("crypto")}We.getCrypto=XQ;function ZQ(){return Lu("localStorage")}We.getLocalStorageOrThrow=ZQ;function ek(){return yo("localStorage")}We.getLocalStorage=ek});var PD=w(Ap=>{"use strict";c();Object.defineProperty(Ap,"__esModule",{value:!0});Ap.getWindowMetadata=void 0;var DD=Tv();function tk(){let t,e;try{t=DD.getDocumentOrThrow(),e=DD.getLocationOrThrow()}catch{return null}function r(){let d=t.getElementsByTagName("link"),y=[];for(let m=0;m-1){let B=v.getAttribute("href");if(B)if(B.toLowerCase().indexOf("https:")===-1&&B.toLowerCase().indexOf("http:")===-1&&B.indexOf("//")!==0){let A=e.protocol+"//"+e.host;if(B.indexOf("/")===0)A+=B;else{let D=e.pathname.split("/");D.pop();let x=D.join("/");A+=x+"/"+B}y.push(A)}else if(B.indexOf("//")===0){let A=e.protocol+B;y.push(A)}else y.push(B)}}return y}function n(...d){let y=t.getElementsByTagName("meta");for(let m=0;mv.getAttribute(B)).filter(B=>B?d.includes(B):!1);if(T.length&&T){let B=v.getAttribute("content");if(B)return B}}return""}function i(){let d=n("name","og:site_name","og:title","twitter:title");return d||(d=t.title),d}function s(){return n("description","og:description","twitter:description","keywords")}let o=i(),a=s(),u=e.origin,l=r();return{description:a,url:u,icons:l,name:o}}Ap.getWindowMetadata=tk});var BD=w((ufe,RD)=>{"use strict";c();RD.exports=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)});var qD=w((lfe,UD)=>{"use strict";c();var MD="%[a-f0-9]{2}",LD=new RegExp("("+MD+")|([^%]+?)","gi"),FD=new RegExp("("+MD+")+","gi");function xv(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([],xv(r),xv(n))}function rk(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(LD)||[],r=1;r{"use strict";c();VD.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 GD=w((pfe,HD)=>{"use strict";c();HD.exports=function(t,e){for(var r={},n=Object.keys(t),i=Array.isArray(e),s=0;s{"use strict";c();var ik=BD(),sk=qD(),kD=jD(),ok=GD(),ak=t=>t==null,Nv=Symbol("encodeFragmentIdentifier");function uk(t){switch(t.arrayFormat){case"index":return e=>(r,n)=>{let i=r.length;return n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[pt(e,t),"[",i,"]"].join("")]:[...r,[pt(e,t),"[",pt(i,t),"]=",pt(n,t)].join("")]};case"bracket":return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[pt(e,t),"[]"].join("")]:[...r,[pt(e,t),"[]=",pt(n,t)].join("")];case"colon-list-separator":return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[pt(e,t),":list="].join("")]:[...r,[pt(e,t),":list=",pt(n,t)].join("")];case"comma":case"separator":case"bracket-separator":{let e=t.arrayFormat==="bracket-separator"?"[]=":"=";return r=>(n,i)=>i===void 0||t.skipNull&&i===null||t.skipEmptyString&&i===""?n:(i=i===null?"":i,n.length===0?[[pt(r,t),e,pt(i,t)].join("")]:[[n,pt(i,t)].join(t.arrayFormatSeparator)])}default:return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,pt(e,t)]:[...r,[pt(e,t),"=",pt(n,t)].join("")]}}function ck(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&&ti(n,t).includes(t.arrayFormatSeparator);n=o?ti(n,t):n;let a=s||o?n.split(t.arrayFormatSeparator).map(u=>ti(u,t)):n===null?n:ti(n,t);i[r]=a};case"bracket-separator":return(r,n,i)=>{let s=/(\[\])$/.test(r);if(r=r.replace(/\[\]$/,""),!s){i[r]=n&&ti(n,t);return}let o=n===null?[]:n.split(t.arrayFormatSeparator).map(a=>ti(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 zD(t){if(typeof t!="string"||t.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function pt(t,e){return e.encode?e.strict?ik(t):encodeURIComponent(t):t}function ti(t,e){return e.decode?sk(t):t}function WD(t){return Array.isArray(t)?t.sort():typeof t=="object"?WD(Object.keys(t)).sort((e,r)=>Number(e)-Number(r)).map(e=>t[e]):t}function KD(t){let e=t.indexOf("#");return e!==-1&&(t=t.slice(0,e)),t}function lk(t){let e="",r=t.indexOf("#");return r!==-1&&(e=t.slice(r)),e}function $D(t){t=KD(t);let e=t.indexOf("?");return e===-1?"":t.slice(e+1)}function QD(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 YD(t,e){e=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},e),zD(e.arrayFormatSeparator);let r=ck(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]=kD(e.decode?i.replace(/\+/g," "):i,"=");o=o===void 0?null:["comma","separator","bracket-separator"].includes(e.arrayFormat)?o:ti(o,e),r(ti(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]=QD(s[o],e);else n[i]=QD(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]=WD(o):i[s]=o,i},Object.create(null))}or.extract=$D;or.parse=YD;or.stringify=(t,e)=>{if(!t)return"";e=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},e),zD(e.arrayFormatSeparator);let r=o=>e.skipNull&&ak(t[o])||e.skipEmptyString&&t[o]==="",n=uk(e),i={};for(let o of Object.keys(t))r(o)||(i[o]=t[o]);let s=Object.keys(i);return e.sort!==!1&&s.sort(e.sort),s.map(o=>{let a=t[o];return a===void 0?"":a===null?pt(o,e):Array.isArray(a)?a.length===0&&e.arrayFormat==="bracket-separator"?pt(o,e)+"[]":a.reduce(n(o),[]).join("&"):pt(o,e)+"="+pt(a,e)}).filter(o=>o.length>0).join("&")};or.parseUrl=(t,e)=>{e=Object.assign({decode:!0},e);let[r,n]=kD(t,"#");return Object.assign({url:r.split("?")[0]||"",query:YD($D(t),e)},e&&e.parseFragmentIdentifier&&n?{fragmentIdentifier:ti(n,e)}:{})};or.stringifyUrl=(t,e)=>{e=Object.assign({encode:!0,strict:!0,[Nv]:!0},e);let r=KD(t.url).split("?")[0]||"",n=or.extract(t.url),i=or.parse(n,{sort:!1}),s=Object.assign(i,t.query),o=or.stringify(s,e);o&&(o=`?${o}`);let a=lk(t.url);return t.fragmentIdentifier&&(a=`#${e[Nv]?pt(t.fragmentIdentifier,e):t.fragmentIdentifier}`),`${r}${o}${a}`};or.pick=(t,e,r)=>{r=Object.assign({parseFragmentIdentifier:!0,[Nv]:!1},r);let{url:n,query:i,fragmentIdentifier:s}=or.parseUrl(t,r);return or.stringifyUrl({url:n,query:ok(i,e),fragmentIdentifier:s},r)};or.exclude=(t,e,r)=>{let n=Array.isArray(e)?i=>!e.includes(i):(i,s)=>!e(i,s);return or.pick(t,n,r)}});var XD=ge(()=>{c()});function Gi(t,e,r="string"){if(!t[e]||typeof t[e]!==r)throw new Error(`Missing or invalid "${e}" param`)}function fk(t,e){let r=!0;return e.forEach(n=>{n in t||(r=!1)}),r}function hk(t,e){return Array.isArray(t)?t.length===e:Object.keys(t).length===e}function dk(t,e){return Array.isArray(t)?t.length>=e:Object.keys(t).length>=e}function Dl(t,e,r){return(!r.length?hk(t,e.length):dk(t,e.length))?fk(t,e):!1}function Pl(t,e,r="_"){let n=t.split(r);return n[n.length-1].trim().toLowerCase()===e.trim().toLowerCase()}var Ov=ge(()=>{c()});function pk(t){return bp(t.method)&&_p(t.params)}function bp(t){return Pl(t,"subscribe")}function _p(t){return Dl(t,["topic"],[])}function gk(t){return Ip(t.method)&&Sp(t.params)}function Ip(t){return Pl(t,"publish")}function Sp(t){return Dl(t,["message","topic","ttl"],["prompt","tag"])}function yk(t){return Cp(t.method)&&Tp(t.params)}function Cp(t){return Pl(t,"unsubscribe")}function Tp(t){return Dl(t,["id","topic"],[])}function mk(t){return xp(t.method)&&Np(t.params)}function xp(t){return Pl(t,"subscription")}function Np(t){return Dl(t,["id","data"],[])}var Dv=ge(()=>{c();Ov()});function wk(t){if(!bp(t.method))throw new Error("JSON-RPC Request has invalid subscribe method");if(!_p(t.params))throw new Error("JSON-RPC Request has invalid subscribe params");let e=t.params;return Gi(e,"topic"),e}function Ek(t){if(!Ip(t.method))throw new Error("JSON-RPC Request has invalid publish method");if(!Sp(t.params))throw new Error("JSON-RPC Request has invalid publish params");let e=t.params;return Gi(e,"topic"),Gi(e,"message"),Gi(e,"ttl","number"),e}function vk(t){if(!Cp(t.method))throw new Error("JSON-RPC Request has invalid unsubscribe method");if(!Tp(t.params))throw new Error("JSON-RPC Request has invalid unsubscribe params");let e=t.params;return Gi(e,"id"),e}function Ak(t){if(!xp(t.method))throw new Error("JSON-RPC Request has invalid subscription method");if(!Np(t.params))throw new Error("JSON-RPC Request has invalid subscription params");let e=t.params;return Gi(e,"id"),Gi(e,"data"),e}var ZD=ge(()=>{c();Ov();Dv()});var bk,e3=ge(()=>{c();bk={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 t3={};at(t3,{RELAY_JSONRPC:()=>bk,isPublishMethod:()=>Ip,isPublishParams:()=>Sp,isPublishRequest:()=>gk,isSubscribeMethod:()=>bp,isSubscribeParams:()=>_p,isSubscribeRequest:()=>pk,isSubscriptionMethod:()=>xp,isSubscriptionParams:()=>Np,isSubscriptionRequest:()=>mk,isUnsubscribeMethod:()=>Cp,isUnsubscribeParams:()=>Tp,isUnsubscribeRequest:()=>yk,parsePublishRequest:()=>Ek,parseSubscribeRequest:()=>wk,parseSubscriptionRequest:()=>Ak,parseUnsubscribeRequest:()=>vk});var r3=ge(()=>{c();XD();ZD();e3();Dv()});var Vp=w(Q=>{"use strict";c();Object.defineProperty(Q,"__esModule",{value:!0});var h3=eD(),_k=oD(),d3=gl(),Lv=uD(),Ik=hD(),et=(Sv(),nt(Iv)),Sk=OD(),Mu=co(),Rl=Tv(),Ck=PD(),Tk=JD(),xk=(r3(),nt(t3));function p3(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 g3=p3(Ik),Op=p3(Tk),Rp=":";function y3(t){let[e,r]=t.split(Rp);return{namespace:e,reference:r}}function m3(t){let{namespace:e,reference:r}=t;return[e,r].join(Rp)}function Fv(t){let[e,r,n]=t.split(Rp);return{namespace:e,reference:r,address:n}}function w3(t){let{namespace:e,reference:r,address:n}=t;return[e,r,n].join(Rp)}function Mv(t,e){let r=[];return t.forEach(n=>{let i=e(n);r.includes(i)||r.push(i)}),r}function E3(t){let{address:e}=Fv(t);return e}function v3(t){let{namespace:e,reference:r}=Fv(t);return m3({namespace:e,reference:r})}function Nk(t,e){let{namespace:r,reference:n}=y3(e);return w3({namespace:r,reference:n,address:t})}function Ok(t){return Mv(t,E3)}function A3(t){return Mv(t,v3)}function Dk(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 Pk(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...A3(i.accounts))}),r}function Rk(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...Bp(n,i))}),r}function Bp(t,e){return t.includes(":")?[t]:e.chains||[]}var Lp=t=>t?.split(":"),b3=t=>{let e=t&&Lp(t);if(e)return e[3]},Bk=t=>{let e=t&&Lp(t);if(e)return e[2]+":"+e[3]},_3=t=>{let e=t&&Lp(t);if(e)return e.pop()},Lk=(t,e)=>{let r=`${t.domain} wants you to sign in with your Ethereum account:`,n=_3(e),i=t.statement,s=`URI: ${t.aud}`,o=`Version: ${t.version}`,a=`Chain ID: ${b3(e)}`,u=`Nonce: ${t.nonce}`,l=`Issued At: ${t.iat}`,f=t.resources&&t.resources.length>0?`Resources: +`});var gD=ge(()=>{c();pD();Zd();Ri();T1();Hc()});var O1,Ofe,yD=ge(()=>{c();G2();k2();Q2();W2();z2();E1();$2();A1();K2();J2();oD();cD();lD();fD();gD();O1={...h1,...d1,...p1,...g1,...y1,...m1,...w1,...v1,...b1,..._1},Ofe={...x1,...N1}});function ED(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var mD,D1,vQ,np,P1=ge(()=>{c();yD();Yd();mD=ED("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),D1=ED("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);let e=Ta(t.length);for(let r=0;r{c();P1()});function In(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?Pi(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}var B1=ge(()=>{c();P1();Mc()});function Gc(t){return Dc($n(In(t,Sa),Gd))}function kc(t){return $n(In(Pc(t),Gd),Sa)}function L1(t){let e=In($d,Ca),r=zd+$n(Jd([e,t]),Ca);return[Qd,Wd,r].join(kd)}function F1(t){let[e,r,n]=t.split(kd);if(e!==Qd||r!==Wd)throw new Error('Issuer must be a DID with method "key"');if(n.slice(0,1)!==zd)throw new Error("Issuer must be a key in mulicodec format");let s=In(n.slice(1),Ca);if($n(s.slice(0,2),Ca)!==$d)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 wD(t){return $n(t,Sa)}function vD(t){return In(t,Sa)}function M1(t){return In([kc(t.header),kc(t.payload)].join(qs),Fc)}function AQ(t){let e=$n(t,Fc).split(qs),r=Gc(e[0]),n=Gc(e[1]);return{header:r,payload:n}}function U1(t){return[kc(t.header),kc(t.payload),wD(t.signature)].join(qs)}function q1(t){let e=t.split(qs),r=Gc(e[0]),n=Gc(e[1]),i=vD(e[2]),s=In(e.slice(0,2).join(qs),Fc);return{header:r,payload:n,signature:i,data:s}}var V1=ge(()=>{c();a1();R1();B1();Ld();Kd()});function bQ(t=(0,AD.randomBytes)(32)){return Ra.generateKeyPairFromSeed(t)}async function _Q(t,e,r,n,i=(0,bD.fromMiliseconds)(Date.now())){let s={alg:Hd,typ:jd},o=L1(n.publicKey),a=i+r,u={iss:o,sub:t,aud:e,iat:i,exp:a},l=M1({header:s,payload:u}),f=Ra.sign(n.secretKey,l);return U1({header:s,payload:u,signature:f})}async function IQ(t){let{header:e,payload:r,data:n,signature:i}=q1(t);if(e.alg!==Hd||e.typ!==jd)throw new Error("JWT must use EdDSA algorithm");let s=F1(r.iss);return Ra.verify(s,n,i)}var Ra,AD,bD,_D=ge(()=>{c();Ra=Ie(R2()),AD=Ie(Rc()),bD=Ie(Ls());Kd();V1()});var ID=ge(()=>{c()});var SD={};ft(SD,{DATA_ENCODING:()=>Fc,DID_DELIMITER:()=>kd,DID_METHOD:()=>Wd,DID_PREFIX:()=>Qd,JSON_ENCODING:()=>Gd,JWT_DELIMITER:()=>qs,JWT_ENCODING:()=>Sa,JWT_IRIDIUM_ALG:()=>Hd,JWT_IRIDIUM_TYP:()=>jd,KEY_PAIR_SEED_LENGTH:()=>L2,MULTICODEC_ED25519_BASE:()=>zd,MULTICODEC_ED25519_ENCODING:()=>Ca,MULTICODEC_ED25519_HEADER:()=>$d,MULTICODEC_ED25519_LENGTH:()=>B2,decodeData:()=>AQ,decodeIss:()=>F1,decodeJSON:()=>Gc,decodeJWT:()=>q1,decodeSig:()=>vD,encodeData:()=>M1,encodeIss:()=>L1,encodeJSON:()=>kc,encodeJWT:()=>U1,encodeSig:()=>wD,generateKeyPair:()=>bQ,signJWT:()=>_Q,verifyJWT:()=>IQ});var CD=ge(()=>{c();_D();Kd();ID();V1()});var xD=m(ip=>{"use strict";c();Object.defineProperty(ip,"__esModule",{value:!0});var Yt=Aa(),H1=Fr(),SQ=20;function CQ(t,e,r){for(var n=1634760805,i=857760878,s=2036477234,o=1797285236,a=r[3]<<24|r[2]<<16|r[1]<<8|r[0],u=r[7]<<24|r[6]<<16|r[5]<<8|r[4],l=r[11]<<24|r[10]<<16|r[9]<<8|r[8],f=r[15]<<24|r[14]<<16|r[13]<<8|r[12],d=r[19]<<24|r[18]<<16|r[17]<<8|r[16],g=r[23]<<24|r[22]<<16|r[21]<<8|r[20],E=r[27]<<24|r[26]<<16|r[25]<<8|r[24],v=r[31]<<24|r[30]<<16|r[29]<<8|r[28],N=e[3]<<24|e[2]<<16|e[1]<<8|e[0],O=e[7]<<24|e[6]<<16|e[5]<<8|e[4],F=e[11]<<24|e[10]<<16|e[9]<<8|e[8],_=e[15]<<24|e[14]<<16|e[13]<<8|e[12],I=n,S=i,R=s,B=o,b=a,C=u,L=l,X=f,W=d,j=g,G=E,K=v,de=N,ue=O,re=F,Y=_,se=0;se>>32-16|de<<16,W=W+de|0,b^=W,b=b>>>32-12|b<<12,S=S+C|0,ue^=S,ue=ue>>>32-16|ue<<16,j=j+ue|0,C^=j,C=C>>>32-12|C<<12,R=R+L|0,re^=R,re=re>>>32-16|re<<16,G=G+re|0,L^=G,L=L>>>32-12|L<<12,B=B+X|0,Y^=B,Y=Y>>>32-16|Y<<16,K=K+Y|0,X^=K,X=X>>>32-12|X<<12,R=R+L|0,re^=R,re=re>>>32-8|re<<8,G=G+re|0,L^=G,L=L>>>32-7|L<<7,B=B+X|0,Y^=B,Y=Y>>>32-8|Y<<8,K=K+Y|0,X^=K,X=X>>>32-7|X<<7,S=S+C|0,ue^=S,ue=ue>>>32-8|ue<<8,j=j+ue|0,C^=j,C=C>>>32-7|C<<7,I=I+b|0,de^=I,de=de>>>32-8|de<<8,W=W+de|0,b^=W,b=b>>>32-7|b<<7,I=I+C|0,Y^=I,Y=Y>>>32-16|Y<<16,G=G+Y|0,C^=G,C=C>>>32-12|C<<12,S=S+L|0,de^=S,de=de>>>32-16|de<<16,K=K+de|0,L^=K,L=L>>>32-12|L<<12,R=R+X|0,ue^=R,ue=ue>>>32-16|ue<<16,W=W+ue|0,X^=W,X=X>>>32-12|X<<12,B=B+b|0,re^=B,re=re>>>32-16|re<<16,j=j+re|0,b^=j,b=b>>>32-12|b<<12,R=R+X|0,ue^=R,ue=ue>>>32-8|ue<<8,W=W+ue|0,X^=W,X=X>>>32-7|X<<7,B=B+b|0,re^=B,re=re>>>32-8|re<<8,j=j+re|0,b^=j,b=b>>>32-7|b<<7,S=S+L|0,de^=S,de=de>>>32-8|de<<8,K=K+de|0,L^=K,L=L>>>32-7|L<<7,I=I+C|0,Y^=I,Y=Y>>>32-8|Y<<8,G=G+Y|0,C^=G,C=C>>>32-7|C<<7;Yt.writeUint32LE(I+n|0,t,0),Yt.writeUint32LE(S+i|0,t,4),Yt.writeUint32LE(R+s|0,t,8),Yt.writeUint32LE(B+o|0,t,12),Yt.writeUint32LE(b+a|0,t,16),Yt.writeUint32LE(C+u|0,t,20),Yt.writeUint32LE(L+l|0,t,24),Yt.writeUint32LE(X+f|0,t,28),Yt.writeUint32LE(W+d|0,t,32),Yt.writeUint32LE(j+g|0,t,36),Yt.writeUint32LE(G+E|0,t,40),Yt.writeUint32LE(K+v|0,t,44),Yt.writeUint32LE(de+N|0,t,48),Yt.writeUint32LE(ue+O|0,t,52),Yt.writeUint32LE(re+F|0,t,56),Yt.writeUint32LE(Y+_|0,t,60)}function TD(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 sp=m(Ba=>{"use strict";c();Object.defineProperty(Ba,"__esModule",{value:!0});function NQ(t,e,r){return~(t-1)&e|t-1&r}Ba.select=NQ;function OQ(t,e){return(t|0)-(e|0)-1>>>31&1}Ba.lessOrEqual=OQ;function ND(t,e){if(t.length!==e.length)return 0;for(var r=0,n=0;n>>8}Ba.compare=ND;function DQ(t,e){return t.length===0||e.length===0?!1:ND(t,e)!==0}Ba.equal=DQ});var DD=m(Kn=>{"use strict";c();Object.defineProperty(Kn,"__esModule",{value:!0});var PQ=sp(),op=Fr();Kn.DIGEST_LENGTH=16;var OD=function(){function t(e){this.digestLength=Kn.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var r=e[0]|e[1]<<8;this._r[0]=r&8191;var n=e[2]|e[3]<<8;this._r[1]=(r>>>13|n<<3)&8191;var i=e[4]|e[5]<<8;this._r[2]=(n>>>10|i<<6)&7939;var s=e[6]|e[7]<<8;this._r[3]=(i>>>7|s<<9)&8191;var o=e[8]|e[9]<<8;this._r[4]=(s>>>4|o<<12)&255,this._r[5]=o>>>1&8190;var a=e[10]|e[11]<<8;this._r[6]=(o>>>14|a<<2)&8191;var u=e[12]|e[13]<<8;this._r[7]=(a>>>11|u<<5)&8065;var l=e[14]|e[15]<<8;this._r[8]=(u>>>8|l<<8)&8191,this._r[9]=l>>>5&127,this._pad[0]=e[16]|e[17]<<8,this._pad[1]=e[18]|e[19]<<8,this._pad[2]=e[20]|e[21]<<8,this._pad[3]=e[22]|e[23]<<8,this._pad[4]=e[24]|e[25]<<8,this._pad[5]=e[26]|e[27]<<8,this._pad[6]=e[28]|e[29]<<8,this._pad[7]=e[30]|e[31]<<8}return t.prototype._blocks=function(e,r,n){for(var i=this._fin?0:2048,s=this._h[0],o=this._h[1],a=this._h[2],u=this._h[3],l=this._h[4],f=this._h[5],d=this._h[6],g=this._h[7],E=this._h[8],v=this._h[9],N=this._r[0],O=this._r[1],F=this._r[2],_=this._r[3],I=this._r[4],S=this._r[5],R=this._r[6],B=this._r[7],b=this._r[8],C=this._r[9];n>=16;){var L=e[r+0]|e[r+1]<<8;s+=L&8191;var X=e[r+2]|e[r+3]<<8;o+=(L>>>13|X<<3)&8191;var W=e[r+4]|e[r+5]<<8;a+=(X>>>10|W<<6)&8191;var j=e[r+6]|e[r+7]<<8;u+=(W>>>7|j<<9)&8191;var G=e[r+8]|e[r+9]<<8;l+=(j>>>4|G<<12)&8191,f+=G>>>1&8191;var K=e[r+10]|e[r+11]<<8;d+=(G>>>14|K<<2)&8191;var de=e[r+12]|e[r+13]<<8;g+=(K>>>11|de<<5)&8191;var ue=e[r+14]|e[r+15]<<8;E+=(de>>>8|ue<<8)&8191,v+=ue>>>5|i;var re=0,Y=re;Y+=s*N,Y+=o*(5*C),Y+=a*(5*b),Y+=u*(5*B),Y+=l*(5*R),re=Y>>>13,Y&=8191,Y+=f*(5*S),Y+=d*(5*I),Y+=g*(5*_),Y+=E*(5*F),Y+=v*(5*O),re+=Y>>>13,Y&=8191;var se=re;se+=s*O,se+=o*N,se+=a*(5*C),se+=u*(5*b),se+=l*(5*B),re=se>>>13,se&=8191,se+=f*(5*R),se+=d*(5*S),se+=g*(5*I),se+=E*(5*_),se+=v*(5*F),re+=se>>>13,se&=8191;var te=re;te+=s*F,te+=o*O,te+=a*N,te+=u*(5*C),te+=l*(5*b),re=te>>>13,te&=8191,te+=f*(5*B),te+=d*(5*R),te+=g*(5*S),te+=E*(5*I),te+=v*(5*_),re+=te>>>13,te&=8191;var ie=re;ie+=s*_,ie+=o*F,ie+=a*O,ie+=u*N,ie+=l*(5*C),re=ie>>>13,ie&=8191,ie+=f*(5*b),ie+=d*(5*B),ie+=g*(5*R),ie+=E*(5*S),ie+=v*(5*I),re+=ie>>>13,ie&=8191;var q=re;q+=s*I,q+=o*_,q+=a*F,q+=u*O,q+=l*N,re=q>>>13,q&=8191,q+=f*(5*C),q+=d*(5*b),q+=g*(5*B),q+=E*(5*R),q+=v*(5*S),re+=q>>>13,q&=8191;var le=re;le+=s*S,le+=o*I,le+=a*_,le+=u*F,le+=l*O,re=le>>>13,le&=8191,le+=f*N,le+=d*(5*C),le+=g*(5*b),le+=E*(5*B),le+=v*(5*R),re+=le>>>13,le&=8191;var ae=re;ae+=s*R,ae+=o*S,ae+=a*I,ae+=u*_,ae+=l*F,re=ae>>>13,ae&=8191,ae+=f*O,ae+=d*N,ae+=g*(5*C),ae+=E*(5*b),ae+=v*(5*B),re+=ae>>>13,ae&=8191;var fe=re;fe+=s*B,fe+=o*R,fe+=a*S,fe+=u*I,fe+=l*_,re=fe>>>13,fe&=8191,fe+=f*F,fe+=d*O,fe+=g*N,fe+=E*(5*C),fe+=v*(5*b),re+=fe>>>13,fe&=8191;var oe=re;oe+=s*b,oe+=o*B,oe+=a*R,oe+=u*S,oe+=l*I,re=oe>>>13,oe&=8191,oe+=f*_,oe+=d*F,oe+=g*O,oe+=E*N,oe+=v*(5*C),re+=oe>>>13,oe&=8191;var ce=re;ce+=s*C,ce+=o*b,ce+=a*B,ce+=u*R,ce+=l*S,re=ce>>>13,ce&=8191,ce+=f*I,ce+=d*_,ce+=g*F,ce+=E*O,ce+=v*N,re+=ce>>>13,ce&=8191,re=(re<<2)+re|0,re=re+Y|0,Y=re&8191,re=re>>>13,se+=re,s=Y,o=se,a=te,u=ie,l=q,f=le,d=ae,g=fe,E=oe,v=ce,r+=16,n-=16}this._h[0]=s,this._h[1]=o,this._h[2]=a,this._h[3]=u,this._h[4]=l,this._h[5]=f,this._h[6]=d,this._h[7]=g,this._h[8]=E,this._h[9]=v},t.prototype.finish=function(e,r){r===void 0&&(r=0);var n=new Uint16Array(10),i,s,o,a;if(this._leftover){for(a=this._leftover,this._buffer[a++]=1;a<16;a++)this._buffer[a]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(i=this._h[1]>>>13,this._h[1]&=8191,a=2;a<10;a++)this._h[a]+=i,i=this._h[a]>>>13,this._h[a]&=8191;for(this._h[0]+=i*5,i=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=i,i=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=i,n[0]=this._h[0]+5,i=n[0]>>>13,n[0]&=8191,a=1;a<10;a++)n[a]=this._h[a]+i,i=n[a]>>>13,n[a]&=8191;for(n[9]-=8192,s=(i^1)-1,a=0;a<10;a++)n[a]&=s;for(s=~s,a=0;a<10;a++)this._h[a]=this._h[a]&s|n[a];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,o=this._h[0]+this._pad[0],this._h[0]=o&65535,a=1;a<8;a++)o=(this._h[a]+this._pad[a]|0)+(o>>>16)|0,this._h[a]=o&65535;return e[r+0]=this._h[0]>>>0,e[r+1]=this._h[0]>>>8,e[r+2]=this._h[1]>>>0,e[r+3]=this._h[1]>>>8,e[r+4]=this._h[2]>>>0,e[r+5]=this._h[2]>>>8,e[r+6]=this._h[3]>>>0,e[r+7]=this._h[3]>>>8,e[r+8]=this._h[4]>>>0,e[r+9]=this._h[4]>>>8,e[r+10]=this._h[5]>>>0,e[r+11]=this._h[5]>>>8,e[r+12]=this._h[6]>>>0,e[r+13]=this._h[6]>>>8,e[r+14]=this._h[7]>>>0,e[r+15]=this._h[7]>>>8,this._finished=!0,this},t.prototype.update=function(e){var r=0,n=e.length,i;if(this._leftover){i=16-this._leftover,i>n&&(i=n);for(var s=0;s=16&&(i=n-n%16,this._blocks(e,r,i),r+=i,n-=i),n){for(var s=0;s{"use strict";c();Object.defineProperty(Yn,"__esModule",{value:!0});var ap=xD(),LQ=DD(),Qc=Fr(),PD=Aa(),FQ=sp();Yn.KEY_LENGTH=32;Yn.NONCE_LENGTH=12;Yn.TAG_LENGTH=16;var RD=new Uint8Array(16),MQ=function(){function t(e){if(this.nonceLength=Yn.NONCE_LENGTH,this.tagLength=Yn.TAG_LENGTH,e.length!==Yn.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);ap.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 ap.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),Qc.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(RD.subarray(i.length%16))),s.update(n),n.length%16>0&&s.update(RD.subarray(n.length%16));var o=new Uint8Array(8);i&&PD.writeUint64LE(i.length,o),s.update(o),PD.writeUint64LE(n.length,o),s.update(o);for(var a=s.digest(),u=0;u{"use strict";c();Object.defineProperty(j1,"__esModule",{value:!0});function UQ(t){return typeof t.saveState<"u"&&typeof t.restoreState<"u"&&typeof t.cleanSavedState<"u"}j1.isSerializableHash=UQ});var MD=m(Wc=>{"use strict";c();Object.defineProperty(Wc,"__esModule",{value:!0});var Sn=LD(),qQ=sp(),VQ=Fr(),FD=function(){function t(e,r){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var n=new Uint8Array(this.blockSize);r.length>this.blockSize?this._inner.update(r).finish(n).clean():n.set(r);for(var i=0;i{"use strict";c();Object.defineProperty(G1,"__esModule",{value:!0});var UD=MD(),qD=Fr(),jQ=function(){function t(e,r,n,i){n===void 0&&(n=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=i;var s=UD.hmac(this._hash,n,r);this._hmac=new UD.HMAC(e,s),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return t.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(e===0)throw new Error("hkdf: cannot expand more");this._hmac.reset(),e>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},t.prototype.expand=function(e){for(var r=new Uint8Array(e),n=0;n{"use strict";c();Object.defineProperty(Li,"__esModule",{value:!0});var cp=Aa(),up=Fr();Li.DIGEST_LENGTH=32;Li.BLOCK_SIZE=64;var HD=function(){function t(){this.digestLength=Li.DIGEST_LENGTH,this.blockSize=Li.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(){up.wipe(this._buffer),up.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&&(k1(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(n=k1(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){up.wipe(e.state),e.buffer&&up.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},t}();Li.SHA256=HD;var GQ=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 k1(t,e,r,n,i){for(;i>=64;){for(var s=e[0],o=e[1],a=e[2],u=e[3],l=e[4],f=e[5],d=e[6],g=e[7],E=0;E<16;E++){var v=n+E*4;t[E]=cp.readUint32BE(r,v)}for(var E=16;E<64;E++){var N=t[E-2],O=(N>>>17|N<<32-17)^(N>>>19|N<<32-19)^N>>>10;N=t[E-15];var F=(N>>>7|N<<32-7)^(N>>>18|N<<32-18)^N>>>3;t[E]=(O+t[E-7]|0)+(F+t[E-16]|0)}for(var E=0;E<64;E++){var O=(((l>>>6|l<<26)^(l>>>11|l<<21)^(l>>>25|l<<7))+(l&f^~l&d)|0)+(g+(GQ[E]+t[E]|0)|0)|0,F=((s>>>2|s<<32-2)^(s>>>13|s<<32-13)^(s>>>22|s<<32-22))+(s&o^s&a^o&a)|0;g=d,d=f,f=l,l=u+O|0,u=a,a=o,o=s,s=O+F|0}e[0]+=s,e[1]+=o,e[2]+=a,e[3]+=u,e[4]+=l,e[5]+=f,e[6]+=d,e[7]+=g,n+=64,i-=64}return n}function kQ(t){var e=new HD;e.update(t);var r=e.digest();return e.clean(),r}Li.hash=kQ});var WD=m(pt=>{"use strict";c();Object.defineProperty(pt,"__esModule",{value:!0});pt.sharedKey=pt.generateKeyPair=pt.generateKeyPairFromSeed=pt.scalarMultBase=pt.scalarMult=pt.SHARED_KEY_LENGTH=pt.SECRET_KEY_LENGTH=pt.PUBLIC_KEY_LENGTH=void 0;var QQ=Rc(),WQ=Fr();pt.PUBLIC_KEY_LENGTH=32;pt.SECRET_KEY_LENGTH=32;pt.SHARED_KEY_LENGTH=32;function Cn(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,zc(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 KQ(t,e){for(let r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function lp(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]+r[n]}function fp(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]-r[n]}function Jn(t,e,r){let n,i,s=0,o=0,a=0,u=0,l=0,f=0,d=0,g=0,E=0,v=0,N=0,O=0,F=0,_=0,I=0,S=0,R=0,B=0,b=0,C=0,L=0,X=0,W=0,j=0,G=0,K=0,de=0,ue=0,re=0,Y=0,se=0,te=r[0],ie=r[1],q=r[2],le=r[3],ae=r[4],fe=r[5],oe=r[6],ce=r[7],y=r[8],w=r[9],A=r[10],P=r[11],T=r[12],D=r[13],M=r[14],x=r[15];n=e[0],s+=n*te,o+=n*ie,a+=n*q,u+=n*le,l+=n*ae,f+=n*fe,d+=n*oe,g+=n*ce,E+=n*y,v+=n*w,N+=n*A,O+=n*P,F+=n*T,_+=n*D,I+=n*M,S+=n*x,n=e[1],o+=n*te,a+=n*ie,u+=n*q,l+=n*le,f+=n*ae,d+=n*fe,g+=n*oe,E+=n*ce,v+=n*y,N+=n*w,O+=n*A,F+=n*P,_+=n*T,I+=n*D,S+=n*M,R+=n*x,n=e[2],a+=n*te,u+=n*ie,l+=n*q,f+=n*le,d+=n*ae,g+=n*fe,E+=n*oe,v+=n*ce,N+=n*y,O+=n*w,F+=n*A,_+=n*P,I+=n*T,S+=n*D,R+=n*M,B+=n*x,n=e[3],u+=n*te,l+=n*ie,f+=n*q,d+=n*le,g+=n*ae,E+=n*fe,v+=n*oe,N+=n*ce,O+=n*y,F+=n*w,_+=n*A,I+=n*P,S+=n*T,R+=n*D,B+=n*M,b+=n*x,n=e[4],l+=n*te,f+=n*ie,d+=n*q,g+=n*le,E+=n*ae,v+=n*fe,N+=n*oe,O+=n*ce,F+=n*y,_+=n*w,I+=n*A,S+=n*P,R+=n*T,B+=n*D,b+=n*M,C+=n*x,n=e[5],f+=n*te,d+=n*ie,g+=n*q,E+=n*le,v+=n*ae,N+=n*fe,O+=n*oe,F+=n*ce,_+=n*y,I+=n*w,S+=n*A,R+=n*P,B+=n*T,b+=n*D,C+=n*M,L+=n*x,n=e[6],d+=n*te,g+=n*ie,E+=n*q,v+=n*le,N+=n*ae,O+=n*fe,F+=n*oe,_+=n*ce,I+=n*y,S+=n*w,R+=n*A,B+=n*P,b+=n*T,C+=n*D,L+=n*M,X+=n*x,n=e[7],g+=n*te,E+=n*ie,v+=n*q,N+=n*le,O+=n*ae,F+=n*fe,_+=n*oe,I+=n*ce,S+=n*y,R+=n*w,B+=n*A,b+=n*P,C+=n*T,L+=n*D,X+=n*M,W+=n*x,n=e[8],E+=n*te,v+=n*ie,N+=n*q,O+=n*le,F+=n*ae,_+=n*fe,I+=n*oe,S+=n*ce,R+=n*y,B+=n*w,b+=n*A,C+=n*P,L+=n*T,X+=n*D,W+=n*M,j+=n*x,n=e[9],v+=n*te,N+=n*ie,O+=n*q,F+=n*le,_+=n*ae,I+=n*fe,S+=n*oe,R+=n*ce,B+=n*y,b+=n*w,C+=n*A,L+=n*P,X+=n*T,W+=n*D,j+=n*M,G+=n*x,n=e[10],N+=n*te,O+=n*ie,F+=n*q,_+=n*le,I+=n*ae,S+=n*fe,R+=n*oe,B+=n*ce,b+=n*y,C+=n*w,L+=n*A,X+=n*P,W+=n*T,j+=n*D,G+=n*M,K+=n*x,n=e[11],O+=n*te,F+=n*ie,_+=n*q,I+=n*le,S+=n*ae,R+=n*fe,B+=n*oe,b+=n*ce,C+=n*y,L+=n*w,X+=n*A,W+=n*P,j+=n*T,G+=n*D,K+=n*M,de+=n*x,n=e[12],F+=n*te,_+=n*ie,I+=n*q,S+=n*le,R+=n*ae,B+=n*fe,b+=n*oe,C+=n*ce,L+=n*y,X+=n*w,W+=n*A,j+=n*P,G+=n*T,K+=n*D,de+=n*M,ue+=n*x,n=e[13],_+=n*te,I+=n*ie,S+=n*q,R+=n*le,B+=n*ae,b+=n*fe,C+=n*oe,L+=n*ce,X+=n*y,W+=n*w,j+=n*A,G+=n*P,K+=n*T,de+=n*D,ue+=n*M,re+=n*x,n=e[14],I+=n*te,S+=n*ie,R+=n*q,B+=n*le,b+=n*ae,C+=n*fe,L+=n*oe,X+=n*ce,W+=n*y,j+=n*w,G+=n*A,K+=n*P,de+=n*T,ue+=n*D,re+=n*M,Y+=n*x,n=e[15],S+=n*te,R+=n*ie,B+=n*q,b+=n*le,C+=n*ae,L+=n*fe,X+=n*oe,W+=n*ce,j+=n*y,G+=n*w,K+=n*A,de+=n*P,ue+=n*T,re+=n*D,Y+=n*M,se+=n*x,s+=38*R,o+=38*B,a+=38*b,u+=38*C,l+=38*L,f+=38*X,d+=38*W,g+=38*j,E+=38*G,v+=38*K,N+=38*de,O+=38*ue,F+=38*re,_+=38*Y,I+=38*se,i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=l+i+65535,i=Math.floor(n/65536),l=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=g+i+65535,i=Math.floor(n/65536),g=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=v+i+65535,i=Math.floor(n/65536),v=n-i*65536,n=N+i+65535,i=Math.floor(n/65536),N=n-i*65536,n=O+i+65535,i=Math.floor(n/65536),O=n-i*65536,n=F+i+65535,i=Math.floor(n/65536),F=n-i*65536,n=_+i+65535,i=Math.floor(n/65536),_=n-i*65536,n=I+i+65535,i=Math.floor(n/65536),I=n-i*65536,n=S+i+65535,i=Math.floor(n/65536),S=n-i*65536,s+=i-1+37*(i-1),i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=l+i+65535,i=Math.floor(n/65536),l=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=g+i+65535,i=Math.floor(n/65536),g=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=v+i+65535,i=Math.floor(n/65536),v=n-i*65536,n=N+i+65535,i=Math.floor(n/65536),N=n-i*65536,n=O+i+65535,i=Math.floor(n/65536),O=n-i*65536,n=F+i+65535,i=Math.floor(n/65536),F=n-i*65536,n=_+i+65535,i=Math.floor(n/65536),_=n-i*65536,n=I+i+65535,i=Math.floor(n/65536),I=n-i*65536,n=S+i+65535,i=Math.floor(n/65536),S=n-i*65536,s+=i-1+37*(i-1),t[0]=s,t[1]=o,t[2]=a,t[3]=u,t[4]=l,t[5]=f,t[6]=d,t[7]=g,t[8]=E,t[9]=v,t[10]=N,t[11]=O,t[12]=F,t[13]=_,t[14]=I,t[15]=S}function $c(t,e){Jn(t,e,e)}function YQ(t,e){let r=Cn();for(let n=0;n<16;n++)r[n]=e[n];for(let n=253;n>=0;n--)$c(r,r),n!==2&&n!==4&&Jn(r,r,e);for(let n=0;n<16;n++)t[n]=r[n]}function W1(t,e){let r=new Uint8Array(32),n=new Float64Array(80),i=Cn(),s=Cn(),o=Cn(),a=Cn(),u=Cn(),l=Cn();for(let E=0;E<31;E++)r[E]=t[E];r[31]=t[31]&127|64,r[0]&=248,KQ(n,e);for(let E=0;E<16;E++)s[E]=n[E];i[0]=a[0]=1;for(let E=254;E>=0;--E){let v=r[E>>>3]>>>(E&7)&1;zc(i,s,v),zc(o,a,v),lp(u,i,o),fp(i,i,o),lp(o,s,a),fp(s,s,a),$c(a,u),$c(l,i),Jn(i,o,i),Jn(o,s,u),lp(u,i,o),fp(i,i,o),$c(s,i),fp(o,a,l),Jn(i,o,zQ),lp(i,i,a),Jn(o,o,i),Jn(i,a,l),Jn(a,s,n),$c(s,u),zc(i,s,v),zc(o,a,v)}for(let E=0;E<16;E++)n[E+16]=i[E],n[E+32]=o[E],n[E+48]=s[E],n[E+64]=a[E];let f=n.subarray(32),d=n.subarray(16);YQ(f,f),Jn(d,d,f);let g=new Uint8Array(32);return $Q(g,d),g}pt.scalarMult=W1;function kD(t){return W1(t,GD)}pt.scalarMultBase=kD;function QD(t){if(t.length!==pt.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${pt.SECRET_KEY_LENGTH} bytes`);let e=new Uint8Array(t);return{publicKey:kD(e),secretKey:e}}pt.generateKeyPairFromSeed=QD;function JQ(t){let e=(0,QQ.randomBytes)(32,t),r=QD(e);return(0,WQ.wipe)(e),r}pt.generateKeyPair=JQ;function XQ(t,e,r=!1){if(t.length!==pt.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(e.length!==pt.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");let n=W1(t,e);if(r){let i=0;for(let s=0;se[r])return 1}return t.byteLength>e.byteLength?1:t.byteLength{c()});function KD(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r{c()});function JD(t,e){if(t.length!==e.length)throw new Error("Inputs should have the same length");let r=Ta(t.length);for(let n=0;n{c();Yd();Mc()});var z1={};ft(z1,{compare:()=>zD,concat:()=>Jd,equals:()=>KD,fromString:()=>In,toString:()=>$n,xor:()=>JD});var $1=ge(()=>{c();$D();a1();YD();B1();R1();XD()});var lP=m(it=>{"use strict";c();var ZD=it&&it.__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 oP:typeof navigator<"u"?K1(navigator.userAgent):cP()}it.detect=rW;function aP(t){return t!==""&&tW.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 nW(t){var e=aP(t);return e?e[0]:null}it.browserName=nW;function K1(t){var e=aP(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new sP;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length{"use strict";c();Object.defineProperty(Ye,"__esModule",{value:!0});Ye.getLocalStorage=Ye.getLocalStorageOrThrow=Ye.getCrypto=Ye.getCryptoOrThrow=Ye.getLocation=Ye.getLocationOrThrow=Ye.getNavigator=Ye.getNavigatorOrThrow=Ye.getDocument=Ye.getDocumentOrThrow=Ye.getFromWindowOrThrow=Ye.getFromWindow=void 0;function Hs(t){let e;return typeof window<"u"&&typeof window[t]<"u"&&(e=window[t]),e}Ye.getFromWindow=Hs;function La(t){let e=Hs(t);if(!e)throw new Error(`${t} is not defined in Window`);return e}Ye.getFromWindowOrThrow=La;function sW(){return La("document")}Ye.getDocumentOrThrow=sW;function oW(){return Hs("document")}Ye.getDocument=oW;function aW(){return La("navigator")}Ye.getNavigatorOrThrow=aW;function uW(){return Hs("navigator")}Ye.getNavigator=uW;function cW(){return La("location")}Ye.getLocationOrThrow=cW;function lW(){return Hs("location")}Ye.getLocation=lW;function fW(){return La("crypto")}Ye.getCryptoOrThrow=fW;function hW(){return Hs("crypto")}Ye.getCrypto=hW;function dW(){return La("localStorage")}Ye.getLocalStorageOrThrow=dW;function pW(){return Hs("localStorage")}Ye.getLocalStorage=pW});var hP=m(hp=>{"use strict";c();Object.defineProperty(hp,"__esModule",{value:!0});hp.getWindowMetadata=void 0;var fP=Y1();function gW(){let t,e;try{t=fP.getDocumentOrThrow(),e=fP.getLocationOrThrow()}catch{return null}function r(){let d=t.getElementsByTagName("link"),g=[];for(let E=0;E-1){let O=v.getAttribute("href");if(O)if(O.toLowerCase().indexOf("https:")===-1&&O.toLowerCase().indexOf("http:")===-1&&O.indexOf("//")!==0){let F=e.protocol+"//"+e.host;if(O.indexOf("/")===0)F+=O;else{let _=e.pathname.split("/");_.pop();let I=_.join("/");F+=I+"/"+O}g.push(F)}else if(O.indexOf("//")===0){let F=e.protocol+O;g.push(F)}else g.push(O)}}return g}function n(...d){let g=t.getElementsByTagName("meta");for(let E=0;Ev.getAttribute(O)).filter(O=>O?d.includes(O):!1);if(N.length&&N){let O=v.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,l=r();return{description:a,url:u,icons:l,name:o}}hp.getWindowMetadata=gW});var pP=m((Whe,dP)=>{"use strict";c();dP.exports=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)});var wP=m(($he,EP)=>{"use strict";c();var mP="%[a-f0-9]{2}",gP=new RegExp("("+mP+")|([^%]+?)","gi"),yP=new RegExp("("+mP+")+","gi");function J1(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([],J1(r),J1(n))}function yW(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(gP)||[],r=1;r{"use strict";c();vP.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 _P=m((Xhe,bP)=>{"use strict";c();bP.exports=function(t,e){for(var r={},n=Object.keys(t),i=Array.isArray(e),s=0;s{"use strict";c();var EW=pP(),wW=wP(),SP=AP(),vW=_P(),AW=t=>t==null,X1=Symbol("encodeFragmentIdentifier");function bW(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,[wt(e,t),"[",i,"]"].join("")]:[...r,[wt(e,t),"[",wt(i,t),"]=",wt(n,t)].join("")]};case"bracket":return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[wt(e,t),"[]"].join("")]:[...r,[wt(e,t),"[]=",wt(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,[wt(e,t),":list="].join("")]:[...r,[wt(e,t),":list=",wt(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?[[wt(r,t),e,wt(i,t)].join("")]:[[n,wt(i,t)].join(t.arrayFormatSeparator)])}default:return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,wt(e,t)]:[...r,[wt(e,t),"=",wt(n,t)].join("")]}}function _W(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&&Xn(n,t).includes(t.arrayFormatSeparator);n=o?Xn(n,t):n;let a=s||o?n.split(t.arrayFormatSeparator).map(u=>Xn(u,t)):n===null?n:Xn(n,t);i[r]=a};case"bracket-separator":return(r,n,i)=>{let s=/(\[\])$/.test(r);if(r=r.replace(/\[\]$/,""),!s){i[r]=n&&Xn(n,t);return}let o=n===null?[]:n.split(t.arrayFormatSeparator).map(a=>Xn(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 CP(t){if(typeof t!="string"||t.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function wt(t,e){return e.encode?e.strict?EW(t):encodeURIComponent(t):t}function Xn(t,e){return e.decode?wW(t):t}function TP(t){return Array.isArray(t)?t.sort():typeof t=="object"?TP(Object.keys(t)).sort((e,r)=>Number(e)-Number(r)).map(e=>t[e]):t}function xP(t){let e=t.indexOf("#");return e!==-1&&(t=t.slice(0,e)),t}function IW(t){let e="",r=t.indexOf("#");return r!==-1&&(e=t.slice(r)),e}function NP(t){t=xP(t);let e=t.indexOf("?");return e===-1?"":t.slice(e+1)}function IP(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 OP(t,e){e=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},e),CP(e.arrayFormatSeparator);let r=_W(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]=SP(e.decode?i.replace(/\+/g," "):i,"=");o=o===void 0?null:["comma","separator","bracket-separator"].includes(e.arrayFormat)?o:Xn(o,e),r(Xn(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]=IP(s[o],e);else n[i]=IP(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]=TP(o):i[s]=o,i},Object.create(null))}hr.extract=NP;hr.parse=OP;hr.stringify=(t,e)=>{if(!t)return"";e=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},e),CP(e.arrayFormatSeparator);let r=o=>e.skipNull&&AW(t[o])||e.skipEmptyString&&t[o]==="",n=bW(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?wt(o,e):Array.isArray(a)?a.length===0&&e.arrayFormat==="bracket-separator"?wt(o,e)+"[]":a.reduce(n(o),[]).join("&"):wt(o,e)+"="+wt(a,e)}).filter(o=>o.length>0).join("&")};hr.parseUrl=(t,e)=>{e=Object.assign({decode:!0},e);let[r,n]=SP(t,"#");return Object.assign({url:r.split("?")[0]||"",query:OP(NP(t),e)},e&&e.parseFragmentIdentifier&&n?{fragmentIdentifier:Xn(n,e)}:{})};hr.stringifyUrl=(t,e)=>{e=Object.assign({encode:!0,strict:!0,[X1]:!0},e);let r=xP(t.url).split("?")[0]||"",n=hr.extract(t.url),i=hr.parse(n,{sort:!1}),s=Object.assign(i,t.query),o=hr.stringify(s,e);o&&(o=`?${o}`);let a=IW(t.url);return t.fragmentIdentifier&&(a=`#${e[X1]?wt(t.fragmentIdentifier,e):t.fragmentIdentifier}`),`${r}${o}${a}`};hr.pick=(t,e,r)=>{r=Object.assign({parseFragmentIdentifier:!0,[X1]:!1},r);let{url:n,query:i,fragmentIdentifier:s}=hr.parseUrl(t,r);return hr.stringifyUrl({url:n,query:vW(i,e),fragmentIdentifier:s},r)};hr.exclude=(t,e,r)=>{let n=Array.isArray(e)?i=>!e.includes(i):(i,s)=>!e(i,s);return hr.pick(t,n,r)}});var PP=ge(()=>{c()});function Fi(t,e,r="string"){if(!t[e]||typeof t[e]!==r)throw new Error(`Missing or invalid "${e}" param`)}function SW(t,e){let r=!0;return e.forEach(n=>{n in t||(r=!1)}),r}function CW(t,e){return Array.isArray(t)?t.length===e:Object.keys(t).length===e}function TW(t,e){return Array.isArray(t)?t.length>=e:Object.keys(t).length>=e}function Kc(t,e,r){return(!r.length?CW(t,e.length):TW(t,e.length))?SW(t,e):!1}function Yc(t,e,r="_"){let n=t.split(r);return n[n.length-1].trim().toLowerCase()===e.trim().toLowerCase()}var Z1=ge(()=>{c()});function xW(t){return dp(t.method)&&pp(t.params)}function dp(t){return Yc(t,"subscribe")}function pp(t){return Kc(t,["topic"],[])}function NW(t){return gp(t.method)&&yp(t.params)}function gp(t){return Yc(t,"publish")}function yp(t){return Kc(t,["message","topic","ttl"],["prompt","tag"])}function OW(t){return mp(t.method)&&Ep(t.params)}function mp(t){return Yc(t,"unsubscribe")}function Ep(t){return Kc(t,["id","topic"],[])}function DW(t){return wp(t.method)&&vp(t.params)}function wp(t){return Yc(t,"subscription")}function vp(t){return Kc(t,["id","data"],[])}var eA=ge(()=>{c();Z1()});function PW(t){if(!dp(t.method))throw new Error("JSON-RPC Request has invalid subscribe method");if(!pp(t.params))throw new Error("JSON-RPC Request has invalid subscribe params");let e=t.params;return Fi(e,"topic"),e}function RW(t){if(!gp(t.method))throw new Error("JSON-RPC Request has invalid publish method");if(!yp(t.params))throw new Error("JSON-RPC Request has invalid publish params");let e=t.params;return Fi(e,"topic"),Fi(e,"message"),Fi(e,"ttl","number"),e}function BW(t){if(!mp(t.method))throw new Error("JSON-RPC Request has invalid unsubscribe method");if(!Ep(t.params))throw new Error("JSON-RPC Request has invalid unsubscribe params");let e=t.params;return Fi(e,"id"),e}function LW(t){if(!wp(t.method))throw new Error("JSON-RPC Request has invalid subscription method");if(!vp(t.params))throw new Error("JSON-RPC Request has invalid subscription params");let e=t.params;return Fi(e,"id"),Fi(e,"data"),e}var RP=ge(()=>{c();Z1();eA()});var FW,BP=ge(()=>{c();FW={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 LP={};ft(LP,{RELAY_JSONRPC:()=>FW,isPublishMethod:()=>gp,isPublishParams:()=>yp,isPublishRequest:()=>NW,isSubscribeMethod:()=>dp,isSubscribeParams:()=>pp,isSubscribeRequest:()=>xW,isSubscriptionMethod:()=>wp,isSubscriptionParams:()=>vp,isSubscriptionRequest:()=>DW,isUnsubscribeMethod:()=>mp,isUnsubscribeParams:()=>Ep,isUnsubscribeRequest:()=>OW,parsePublishRequest:()=>RW,parseSubscribeRequest:()=>PW,parseSubscriptionRequest:()=>LW,parseUnsubscribeRequest:()=>BW});var FP=ge(()=>{c();PP();RP();BP();eA()});var rl=m(k=>{"use strict";c();Object.defineProperty(k,"__esModule",{value:!0});var WP=BD(),MW=VD(),zP=Rc(),iA=jD(),UW=WD(),st=($1(),ut(z1)),qW=lP(),Fa=Ls(),Jc=Y1(),VW=hP(),HW=DP(),jW=(FP(),ut(LP));function $P(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 KP=$P(UW),Ap=$P(HW),Ip=":";function YP(t){let[e,r]=t.split(Ip);return{namespace:e,reference:r}}function JP(t){let{namespace:e,reference:r}=t;return[e,r].join(Ip)}function sA(t){let[e,r,n]=t.split(Ip);return{namespace:e,reference:r,address:n}}function XP(t){let{namespace:e,reference:r,address:n}=t;return[e,r,n].join(Ip)}function oA(t,e){let r=[];return t.forEach(n=>{let i=e(n);r.includes(i)||r.push(i)}),r}function ZP(t){let{address:e}=sA(t);return e}function e3(t){let{namespace:e,reference:r}=sA(t);return JP({namespace:e,reference:r})}function GW(t,e){let{namespace:r,reference:n}=YP(e);return XP({namespace:r,reference:n,address:t})}function kW(t){return oA(t,ZP)}function t3(t){return oA(t,e3)}function QW(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 WW(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...t3(i.accounts))}),r}function zW(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...Sp(n,i))}),r}function Sp(t,e){return t.includes(":")?[t]:e.chains||[]}var Cp=t=>t?.split(":"),r3=t=>{let e=t&&Cp(t);if(e)return e[3]},$W=t=>{let e=t&&Cp(t);if(e)return e[2]+":"+e[3]},n3=t=>{let e=t&&Cp(t);if(e)return e.pop()},KW=(t,e)=>{let r=`${t.domain} wants you to sign in with your Ethereum account:`,n=n3(e),i=t.statement,s=`URI: ${t.aud}`,o=`Version: ${t.version}`,a=`Chain ID: ${r3(e)}`,u=`Nonce: ${t.nonce}`,l=`Issued At: ${t.iat}`,f=t.resources&&t.resources.length>0?`Resources: ${t.resources.map(d=>`- ${d}`).join(` `)}`:void 0;return[r,n,"",i,"",s,o,a,u,l,f].filter(d=>d!=null).join(` -`)},Uv="base10",Jt="base16",Dp="base64pad",Fp="utf8",qv=0,Uu=1,Fk=0,n3=1,Pv=12,Vv=32;function Mk(){let t=g3.generateKeyPair();return{privateKey:et.toString(t.secretKey,Jt),publicKey:et.toString(t.publicKey,Jt)}}function Uk(){let t=d3.randomBytes(Vv);return et.toString(t,Jt)}function qk(t,e){let r=g3.sharedKey(et.fromString(t,Jt),et.fromString(e,Jt)),n=new _k.HKDF(Lv.SHA256,r).expand(Vv);return et.toString(n,Jt)}function Vk(t){let e=Lv.hash(et.fromString(t,Jt));return et.toString(e,Jt)}function jk(t){let e=Lv.hash(et.fromString(t,Fp));return et.toString(e,Jt)}function I3(t){return et.fromString(`${t}`,Uv)}function Bl(t){return Number(et.toString(t,Uv))}function Hk(t){let e=I3(typeof t.type<"u"?t.type:qv);if(Bl(e)===Uu&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");let r=typeof t.senderPublicKey<"u"?et.fromString(t.senderPublicKey,Jt):void 0,n=typeof t.iv<"u"?et.fromString(t.iv,Jt):d3.randomBytes(Pv),i=new h3.ChaCha20Poly1305(et.fromString(t.symKey,Jt)).seal(n,et.fromString(t.message,Fp));return S3({type:e,sealed:i,iv:n,senderPublicKey:r})}function Gk(t){let e=new h3.ChaCha20Poly1305(et.fromString(t.symKey,Jt)),{sealed:r,iv:n}=jv(t.encoded),i=e.open(n,r);if(i===null)throw new Error("Failed to decrypt");return et.toString(i,Fp)}function S3(t){if(Bl(t.type)===Uu){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return et.toString(et.concat([t.type,t.senderPublicKey,t.iv,t.sealed]),Dp)}return et.toString(et.concat([t.type,t.iv,t.sealed]),Dp)}function jv(t){let e=et.fromString(t,Dp),r=e.slice(Fk,n3),n=n3;if(Bl(r)===Uu){let a=n+Vv,u=a+Pv,l=e.slice(n,a),f=e.slice(a,u),d=e.slice(u);return{type:r,sealed:d,iv:f,senderPublicKey:l}}let i=n+Pv,s=e.slice(n,i),o=e.slice(i);return{type:r,sealed:o,iv:s}}function Qk(t,e){let r=jv(t);return C3({type:Bl(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?et.toString(r.senderPublicKey,Jt):void 0,receiverPublicKey:e?.receiverPublicKey})}function C3(t){let e=t?.type||qv;if(e===Uu){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 kk(t){return t.type===Uu&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}var zk=Object.defineProperty,i3=Object.getOwnPropertySymbols,Wk=Object.prototype.hasOwnProperty,Kk=Object.prototype.propertyIsEnumerable,s3=(t,e,r)=>e in t?zk(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,o3=(t,e)=>{for(var r in e||(e={}))Wk.call(e,r)&&s3(t,r,e[r]);if(i3)for(var r of i3(e))Kk.call(e,r)&&s3(t,r,e[r]);return t},T3="ReactNative",Fu={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},Pp=" ",$k=":",x3="/",Hv=2,Yk=1e3,N3="js";function Gv(){return typeof p.default<"u"&&typeof p.default.versions<"u"&&typeof p.default.versions.node<"u"}function O3(){return!Rl.getDocument()&&!!Rl.getNavigator()&&navigator.product===T3}function D3(){return!Gv()&&!!Rl.getNavigator()}function Qv(){return O3()?Fu.reactNative:Gv()?Fu.node:D3()?Fu.browser:Fu.unknown}function P3(t,e){let r=Op.parse(t);return r=o3(o3({},r),e),t=Op.stringify(r),t}function Jk(){return Ck.getWindowMetadata()||{name:"",description:"",url:"",icons:[""]}}function Xk(t,e){var r;let n=Qv(),i={protocol:t,version:e,env:n};return n==="browser"&&(i.host=((r=Rl.getLocation())==null?void 0:r.host)||"unknown"),i}function R3(){let t=Sk.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 B3(){var t;let e=Qv();return e===Fu.browser?[e,((t=Rl.getLocation())==null?void 0:t.host)||"unknown"].join(":"):e}function L3(t,e,r){let n=R3(),i=B3();return[[t,e].join("-"),[N3,r].join("-"),n,i].join("/")}function Zk({protocol:t,version:e,relayUrl:r,sdkVersion:n,auth:i,projectId:s,useOnCloseEvent:o}){let a=r.split("?"),u=L3(t,e,n),l={auth:i,ua:u,projectId:s,useOnCloseEvent:o||void 0},f=P3(a[1]||"",l);return a[0]+"?"+f}function ez(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 tz(t,e,r){if(!t[e]||typeof t[e]!==r)throw new Error(`Missing or invalid "${e}" param`)}function F3(t,e=Hv){return M3(t.split(x3),e)}function rz(t){return F3(t).join(Pp)}function Qi(t,e){return t.filter(r=>e.includes(r)).length===t.length}function M3(t,e=Hv){return t.slice(Math.max(t.length-e,0))}function nz(t){return Object.fromEntries(t.entries())}function iz(t){return new Map(Object.entries(t))}function sz(t,e){let r={};return Object.keys(t).forEach(n=>{r[n]=e(t[n])}),r}var oz=t=>t;function U3(t){return t.trim().replace(/^\w/,e=>e.toUpperCase())}function az(t){return t.split(Pp).map(e=>U3(e)).join(Pp)}function uz(t=Mu.FIVE_MINUTES,e){let r=Mu.toMiliseconds(t||Mu.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 cz(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 kv(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 lz(t){return kv("topic",t)}function fz(t){return kv("id",t)}function hz(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 dz(t,e){return Mu.fromMiliseconds((e||Date.now())+Mu.toMiliseconds(t))}function pz(t){return Date.now()>=Mu.toMiliseconds(t)}function gz(t,e){return`${t}${e?`:${e}`:""}`}function ki(t=[],e=[]){return[...new Set([...t,...e])]}var q3="irn";function yz(t){return t?.relay||{protocol:q3}}function mz(t){let e=xk.RELAY_JSONRPC[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var wz=Object.defineProperty,a3=Object.getOwnPropertySymbols,Ez=Object.prototype.hasOwnProperty,vz=Object.prototype.propertyIsEnumerable,u3=(t,e,r)=>e in t?wz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Az=(t,e)=>{for(var r in e||(e={}))Ez.call(e,r)&&u3(t,r,e[r]);if(a3)for(var r of a3(e))vz.call(e,r)&&u3(t,r,e[r]);return t};function V3(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 bz(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=Op.parse(s);return{protocol:n,topic:i[0],version:parseInt(i[1],10),symKey:o.symKey,relay:V3(o)}}function j3(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 _z(t){return`${t.protocol}:${t.topic}@${t.version}?`+Op.stringify(Az({symKey:t.symKey},j3(t.relay)))}var Iz=Object.defineProperty,Sz=Object.defineProperties,Cz=Object.getOwnPropertyDescriptors,c3=Object.getOwnPropertySymbols,Tz=Object.prototype.hasOwnProperty,xz=Object.prototype.propertyIsEnumerable,l3=(t,e,r)=>e in t?Iz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Nz=(t,e)=>{for(var r in e||(e={}))Tz.call(e,r)&&l3(t,r,e[r]);if(c3)for(var r of c3(e))xz.call(e,r)&&l3(t,r,e[r]);return t},Oz=(t,e)=>Sz(t,Cz(e));function wo(t){let e=[];return t.forEach(r=>{let[n,i]=r.split(":");e.push(`${n}:${i}`)}),e}function H3(t){let e=[];return Object.values(t).forEach(r=>{e.push(...wo(r.accounts))}),e}function G3(t,e){let r=[];return Object.values(t).forEach(n=>{wo(n.accounts).includes(e)&&r.push(...n.methods)}),r}function Q3(t,e){let r=[];return Object.values(t).forEach(n=>{wo(n.accounts).includes(e)&&r.push(...n.events)}),r}function Dz(t,e){let r=X3(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 Pz(t){let{proposal:{requiredNamespaces:e,optionalNamespaces:r={}},supportedNamespaces:n}=t,i=Rv(e),s=Rv(r),o={};Object.keys(n).forEach(l=>{let f=n[l].chains,d=n[l].methods,y=n[l].events,m=n[l].accounts;o[l]={chains:f,methods:d,events:y,accounts:m}});let a=eP(e,o,"approve()");if(a)throw new Error(a.message);let u={};return Object.keys(i).forEach(l=>{let f=n[l].chains.filter(v=>{var T,B;return(B=(T=i[l])==null?void 0:T.chains)==null?void 0:B.includes(v)}),d=n[l].methods.filter(v=>{var T,B;return(B=(T=i[l])==null?void 0:T.methods)==null?void 0:B.includes(v)}),y=n[l].events.filter(v=>{var T,B;return(B=(T=i[l])==null?void 0:T.events)==null?void 0:B.includes(v)}),m=f.map(v=>n[l].accounts.filter(T=>T.includes(v))).flat();u[l]={chains:f,methods:d,events:y,accounts:m}}),Object.keys(s).forEach(l=>{var f,d,y,m,v,T;if(!n[l])return;let B=(d=(f=s[l])==null?void 0:f.chains)==null?void 0:d.filter(R=>n[l].chains.includes(R)),A=n[l].methods.filter(R=>{var P,L;return(L=(P=s[l])==null?void 0:P.methods)==null?void 0:L.includes(R)}),D=n[l].events.filter(R=>{var P,L;return(L=(P=s[l])==null?void 0:P.events)==null?void 0:L.includes(R)}),x=B?.map(R=>n[l].accounts.filter(P=>P.includes(R))).flat();u[l]={chains:ki((y=u[l])==null?void 0:y.chains,B),methods:ki((m=u[l])==null?void 0:m.methods,A),events:ki((v=u[l])==null?void 0:v.events,D),accounts:ki((T=u[l])==null?void 0:T.accounts,x)}}),u}function zv(t){return t.includes(":")}function k3(t){return zv(t)?t.split(":")[0]:t}function Rv(t){var e,r,n;let i={};if(!Mp(t))return i;for(let[s,o]of Object.entries(t)){let a=zv(s)?[s]:o.chains,u=o.methods||[],l=o.events||[],f=k3(s);i[f]=Oz(Nz({},i[f]),{chains:ki(a,(e=i[f])==null?void 0:e.chains),methods:ki(u,(r=i[f])==null?void 0:r.methods),events:ki(l,(n=i[f])==null?void 0:n.events)})}return i}var Rz={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}},Bz={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 ri(t,e){let{message:r,code:n}=Bz[t];return{message:e?`${r} ${e}`:r,code:n}}function mo(t,e){let{message:r,code:n}=Rz[t];return{message:e?`${r} ${e}`:r,code:n}}function Ll(t,e){return Array.isArray(t)?typeof e<"u"&&t.length?t.every(e):!0:!1}function Mp(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function zi(t){return typeof t>"u"}function hr(t,e){return e&&zi(t)?!0:typeof t=="string"&&!!t.trim().length}function Up(t,e){return e&&zi(t)?!0:typeof t=="number"&&!isNaN(t)}function Lz(t,e){let{requiredNamespaces:r}=e,n=Object.keys(t.namespaces),i=Object.keys(r),s=!0;return Qi(i,n)?(n.forEach(o=>{let{accounts:a,methods:u,events:l}=t.namespaces[o],f=wo(a),d=r[o];(!Qi(Bp(o,d),f)||!Qi(d.methods,u)||!Qi(d.events,l))&&(s=!1)}),s):!1}function qp(t){return hr(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function z3(t){if(hr(t,!1)&&t.includes(":")){let e=t.split(":");if(e.length===3){let r=e[0]+":"+e[1];return!!e[2]&&qp(r)}}return!1}function Fz(t){if(hr(t,!1))try{return typeof new URL(t)<"u"}catch{return!1}return!1}function Mz(t){var e;return(e=t?.proposer)==null?void 0:e.publicKey}function Uz(t){return t?.topic}function qz(t,e){let r=null;return hr(t?.publicKey,!1)||(r=ri("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function Bv(t){let e=!0;return Ll(t)?t.length&&(e=t.every(r=>hr(r,!1))):e=!1,e}function W3(t,e,r){let n=null;return Ll(e)?e.forEach(i=>{n||(!qp(i)||!i.includes(t))&&(n=mo("UNSUPPORTED_CHAINS",`${r}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):n=mo("UNSUPPORTED_CHAINS",`${r}, chains ${e} should be an array of strings conforming to "namespace:chainId" format`),n}function K3(t,e){let r=null;return Object.entries(t).forEach(([n,i])=>{if(r)return;let s=W3(n,Bp(n,i),`${e} requiredNamespace`);s&&(r=s)}),r}function $3(t,e){let r=null;return Ll(t)?t.forEach(n=>{r||z3(n)||(r=mo("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):r=mo("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function Y3(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;let i=$3(n?.accounts,`${e} namespace`);i&&(r=i)}),r}function J3(t,e){let r=null;return Bv(t?.methods)?Bv(t?.events)||(r=mo("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=mo("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function Wv(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;let i=J3(n,`${e}, namespace`);i&&(r=i)}),r}function Vz(t,e,r){let n=null;if(t&&Mp(t)){let i=Wv(t,e);i&&(n=i);let s=K3(t,e);s&&(n=s)}else n=ri("MISSING_OR_INVALID",`${e}, ${r} should be an object with data`);return n}function X3(t,e){let r=null;if(t&&Mp(t)){let n=Wv(t,e);n&&(r=n);let i=Y3(t,e);i&&(r=i)}else r=ri("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function Z3(t){return hr(t.protocol,!0)}function jz(t,e){let r=!1;return e&&!t?r=!0:t&&Ll(t)&&t.length&&t.forEach(n=>{r=Z3(n)}),r}function Hz(t){return typeof t=="number"}function Gz(t){return typeof t<"u"&&typeof t!==null}function Qz(t){return!(!t||typeof t!="object"||!t.code||!Up(t.code,!1)||!t.message||!hr(t.message,!1))}function kz(t){return!(zi(t)||!hr(t.method,!1))}function zz(t){return!(zi(t)||zi(t.result)&&zi(t.error)||!Up(t.id,!1)||!hr(t.jsonrpc,!1))}function Wz(t){return!(zi(t)||!hr(t.name,!1))}function Kz(t,e){return!(!qp(e)||!H3(t).includes(e))}function $z(t,e,r){return hr(r,!1)?G3(t,e).includes(r):!1}function Yz(t,e,r){return hr(r,!1)?Q3(t,e).includes(r):!1}function eP(t,e,r){let n=null,i=Jz(t),s=Xz(e),o=Object.keys(i),a=Object.keys(s),u=f3(Object.keys(t)),l=f3(Object.keys(e)),f=u.filter(d=>!l.includes(d));return f.length&&(n=ri("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces. +`)},aA="base10",tr="base16",bp="base64pad",Tp="utf8",uA=0,Ma=1,YW=0,MP=1,tA=12,cA=32;function JW(){let t=KP.generateKeyPair();return{privateKey:st.toString(t.secretKey,tr),publicKey:st.toString(t.publicKey,tr)}}function XW(){let t=zP.randomBytes(cA);return st.toString(t,tr)}function ZW(t,e){let r=KP.sharedKey(st.fromString(t,tr),st.fromString(e,tr)),n=new MW.HKDF(iA.SHA256,r).expand(cA);return st.toString(n,tr)}function ez(t){let e=iA.hash(st.fromString(t,tr));return st.toString(e,tr)}function tz(t){let e=iA.hash(st.fromString(t,Tp));return st.toString(e,tr)}function i3(t){return st.fromString(`${t}`,aA)}function Zc(t){return Number(st.toString(t,aA))}function rz(t){let e=i3(typeof t.type<"u"?t.type:uA);if(Zc(e)===Ma&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");let r=typeof t.senderPublicKey<"u"?st.fromString(t.senderPublicKey,tr):void 0,n=typeof t.iv<"u"?st.fromString(t.iv,tr):zP.randomBytes(tA),i=new WP.ChaCha20Poly1305(st.fromString(t.symKey,tr)).seal(n,st.fromString(t.message,Tp));return s3({type:e,sealed:i,iv:n,senderPublicKey:r})}function nz(t){let e=new WP.ChaCha20Poly1305(st.fromString(t.symKey,tr)),{sealed:r,iv:n}=lA(t.encoded),i=e.open(n,r);if(i===null)throw new Error("Failed to decrypt");return st.toString(i,Tp)}function s3(t){if(Zc(t.type)===Ma){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return st.toString(st.concat([t.type,t.senderPublicKey,t.iv,t.sealed]),bp)}return st.toString(st.concat([t.type,t.iv,t.sealed]),bp)}function lA(t){let e=st.fromString(t,bp),r=e.slice(YW,MP),n=MP;if(Zc(r)===Ma){let a=n+cA,u=a+tA,l=e.slice(n,a),f=e.slice(a,u),d=e.slice(u);return{type:r,sealed:d,iv:f,senderPublicKey:l}}let i=n+tA,s=e.slice(n,i),o=e.slice(i);return{type:r,sealed:o,iv:s}}function iz(t,e){let r=lA(t);return o3({type:Zc(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?st.toString(r.senderPublicKey,tr):void 0,receiverPublicKey:e?.receiverPublicKey})}function o3(t){let e=t?.type||uA;if(e===Ma){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 sz(t){return t.type===Ma&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}var oz=Object.defineProperty,UP=Object.getOwnPropertySymbols,az=Object.prototype.hasOwnProperty,uz=Object.prototype.propertyIsEnumerable,qP=(t,e,r)=>e in t?oz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,VP=(t,e)=>{for(var r in e||(e={}))az.call(e,r)&&qP(t,r,e[r]);if(UP)for(var r of UP(e))uz.call(e,r)&&qP(t,r,e[r]);return t},a3="ReactNative",ei={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},_p=" ",cz=":",u3="/",fA=2,lz=1e3,c3="js";function hA(){return typeof p.default<"u"&&typeof p.default.versions<"u"&&typeof p.default.versions.node<"u"}function l3(){return!Jc.getDocument()&&!!Jc.getNavigator()&&navigator.product===a3}function f3(){return!hA()&&!!Jc.getNavigator()}function el(){return l3()?ei.reactNative:hA()?ei.node:f3()?ei.browser:ei.unknown}function h3(t,e){let r=Ap.parse(t);return r=VP(VP({},r),e),t=Ap.stringify(r),t}function fz(){return VW.getWindowMetadata()||{name:"",description:"",url:"",icons:[""]}}function hz(t,e){var r;let n=el(),i={protocol:t,version:e,env:n};return n==="browser"&&(i.host=((r=Jc.getLocation())==null?void 0:r.host)||"unknown"),i}function d3(){if(el()===ei.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=qW.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 p3(){var t;let e=el();return e===ei.browser?[e,((t=Jc.getLocation())==null?void 0:t.host)||"unknown"].join(":"):e}function g3(t,e,r){let n=d3(),i=p3();return[[t,e].join("-"),[c3,r].join("-"),n,i].join("/")}function dz({protocol:t,version:e,relayUrl:r,sdkVersion:n,auth:i,projectId:s,useOnCloseEvent:o}){let a=r.split("?"),u=g3(t,e,n),l={auth:i,ua:u,projectId:s,useOnCloseEvent:o||void 0},f=h3(a[1]||"",l);return a[0]+"?"+f}function pz(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 gz(t,e,r){if(!t[e]||typeof t[e]!==r)throw new Error(`Missing or invalid "${e}" param`)}function y3(t,e=fA){return m3(t.split(u3),e)}function yz(t){return y3(t).join(_p)}function Mi(t,e){return t.filter(r=>e.includes(r)).length===t.length}function m3(t,e=fA){return t.slice(Math.max(t.length-e,0))}function mz(t){return Object.fromEntries(t.entries())}function Ez(t){return new Map(Object.entries(t))}function wz(t,e){let r={};return Object.keys(t).forEach(n=>{r[n]=e(t[n])}),r}var vz=t=>t;function E3(t){return t.trim().replace(/^\w/,e=>e.toUpperCase())}function Az(t){return t.split(_p).map(e=>E3(e)).join(_p)}function bz(t=Fa.FIVE_MINUTES,e){let r=Fa.toMiliseconds(t||Fa.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 _z(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 dA(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 Iz(t){return dA("topic",t)}function Sz(t){return dA("id",t)}function Cz(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 Tz(t,e){return Fa.fromMiliseconds((e||Date.now())+Fa.toMiliseconds(t))}function xz(t){return Date.now()>=Fa.toMiliseconds(t)}function Nz(t,e){return`${t}${e?`:${e}`:""}`}function Ui(t=[],e=[]){return[...new Set([...t,...e])]}async function Oz({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=el();o===ei.browser?s.startsWith("https://")?window.open(s,"_blank","noreferrer noopener"):window.open(s,"_self","noreferrer noopener"):o===ei.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(s)}catch(n){console.error(n)}}var w3="irn";function Dz(t){return t?.relay||{protocol:w3}}function Pz(t){let e=jW.RELAY_JSONRPC[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var Rz=Object.defineProperty,HP=Object.getOwnPropertySymbols,Bz=Object.prototype.hasOwnProperty,Lz=Object.prototype.propertyIsEnumerable,jP=(t,e,r)=>e in t?Rz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Fz=(t,e)=>{for(var r in e||(e={}))Bz.call(e,r)&&jP(t,r,e[r]);if(HP)for(var r of HP(e))Lz.call(e,r)&&jP(t,r,e[r]);return t};function v3(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 Mz(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=Ap.parse(s);return{protocol:n,topic:A3(i[0]),version:parseInt(i[1],10),symKey:o.symKey,relay:v3(o)}}function A3(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 Uz(t){return`${t.protocol}:${t.topic}@${t.version}?`+Ap.stringify(Fz({symKey:t.symKey},b3(t.relay)))}var qz=Object.defineProperty,Vz=Object.defineProperties,Hz=Object.getOwnPropertyDescriptors,GP=Object.getOwnPropertySymbols,jz=Object.prototype.hasOwnProperty,Gz=Object.prototype.propertyIsEnumerable,kP=(t,e,r)=>e in t?qz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,kz=(t,e)=>{for(var r in e||(e={}))jz.call(e,r)&&kP(t,r,e[r]);if(GP)for(var r of GP(e))Gz.call(e,r)&&kP(t,r,e[r]);return t},Qz=(t,e)=>Vz(t,Hz(e));function Gs(t){let e=[];return t.forEach(r=>{let[n,i]=r.split(":");e.push(`${n}:${i}`)}),e}function _3(t){let e=[];return Object.values(t).forEach(r=>{e.push(...Gs(r.accounts))}),e}function I3(t,e){let r=[];return Object.values(t).forEach(n=>{Gs(n.accounts).includes(e)&&r.push(...n.methods)}),r}function S3(t,e){let r=[];return Object.values(t).forEach(n=>{Gs(n.accounts).includes(e)&&r.push(...n.events)}),r}function Wz(t,e){let r=R3(t,e);if(r)throw new Error(r.message);let n={};for(let[i,s]of Object.entries(t))n[i]={methods:s.methods,events:s.events,chains:s.accounts.map(o=>`${o.split(":")[0]}:${o.split(":")[1]}`)};return n}function zz(t){let{proposal:{requiredNamespaces:e,optionalNamespaces:r={}},supportedNamespaces:n}=t,i=rA(e),s=rA(r),o={};Object.keys(n).forEach(l=>{let f=n[l].chains,d=n[l].methods,g=n[l].events,E=n[l].accounts;o[l]={chains:f,methods:d,events:g,accounts:E}});let a=L3(e,o,"approve()");if(a)throw new Error(a.message);let u={};return Object.keys(i).forEach(l=>{let f=n[l].chains.filter(v=>{var N,O;return(O=(N=i[l])==null?void 0:N.chains)==null?void 0:O.includes(v)}),d=n[l].methods.filter(v=>{var N,O;return(O=(N=i[l])==null?void 0:N.methods)==null?void 0:O.includes(v)}),g=n[l].events.filter(v=>{var N,O;return(O=(N=i[l])==null?void 0:N.events)==null?void 0:O.includes(v)}),E=f.map(v=>n[l].accounts.filter(N=>N.includes(`${v}:`))).flat();u[l]={chains:f,methods:d,events:g,accounts:E}}),Object.keys(s).forEach(l=>{var f,d,g,E,v,N;if(!n[l])return;let O=(d=(f=s[l])==null?void 0:f.chains)==null?void 0:d.filter(S=>n[l].chains.includes(S)),F=n[l].methods.filter(S=>{var R,B;return(B=(R=s[l])==null?void 0:R.methods)==null?void 0:B.includes(S)}),_=n[l].events.filter(S=>{var R,B;return(B=(R=s[l])==null?void 0:R.events)==null?void 0:B.includes(S)}),I=O?.map(S=>n[l].accounts.filter(R=>R.includes(S))).flat();u[l]={chains:Ui((g=u[l])==null?void 0:g.chains,O),methods:Ui((E=u[l])==null?void 0:E.methods,F),events:Ui((v=u[l])==null?void 0:v.events,_),accounts:Ui((N=u[l])==null?void 0:N.accounts,I)}}),u}function pA(t){return t.includes(":")}function C3(t){return pA(t)?t.split(":")[0]:t}function rA(t){var e,r,n;let i={};if(!xp(t))return i;for(let[s,o]of Object.entries(t)){let a=pA(s)?[s]:o.chains,u=o.methods||[],l=o.events||[],f=C3(s);i[f]=Qz(kz({},i[f]),{chains:Ui(a,(e=i[f])==null?void 0:e.chains),methods:Ui(u,(r=i[f])==null?void 0:r.methods),events:Ui(l,(n=i[f])==null?void 0:n.events)})}return i}var $z={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}},Kz={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 Zn(t,e){let{message:r,code:n}=Kz[t];return{message:e?`${r} ${e}`:r,code:n}}function js(t,e){let{message:r,code:n}=$z[t];return{message:e?`${r} ${e}`:r,code:n}}function tl(t,e){return Array.isArray(t)?typeof e<"u"&&t.length?t.every(e):!0:!1}function xp(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function qi(t){return typeof t>"u"}function wr(t,e){return e&&qi(t)?!0:typeof t=="string"&&!!t.trim().length}function Np(t,e){return e&&qi(t)?!0:typeof t=="number"&&!isNaN(t)}function Yz(t,e){let{requiredNamespaces:r}=e,n=Object.keys(t.namespaces),i=Object.keys(r),s=!0;return Mi(i,n)?(n.forEach(o=>{let{accounts:a,methods:u,events:l}=t.namespaces[o],f=Gs(a),d=r[o];(!Mi(Sp(o,d),f)||!Mi(d.methods,u)||!Mi(d.events,l))&&(s=!1)}),s):!1}function Xc(t){return wr(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function T3(t){if(wr(t,!1)&&t.includes(":")){let e=t.split(":");if(e.length===3){let r=e[0]+":"+e[1];return!!e[2]&&Xc(r)}}return!1}function Jz(t){if(wr(t,!1))try{return typeof new URL(t)<"u"}catch{return!1}return!1}function Xz(t){var e;return(e=t?.proposer)==null?void 0:e.publicKey}function Zz(t){return t?.topic}function e$(t,e){let r=null;return wr(t?.publicKey,!1)||(r=Zn("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function nA(t){let e=!0;return tl(t)?t.length&&(e=t.every(r=>wr(r,!1))):e=!1,e}function x3(t,e,r){let n=null;return tl(e)&&e.length?e.forEach(i=>{n||Xc(i)||(n=js("UNSUPPORTED_CHAINS",`${r}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):Xc(t)||(n=js("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 N3(t,e,r){let n=null;return Object.entries(t).forEach(([i,s])=>{if(n)return;let o=x3(i,Sp(i,s),`${e} ${r}`);o&&(n=o)}),n}function O3(t,e){let r=null;return tl(t)?t.forEach(n=>{r||T3(n)||(r=js("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):r=js("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function D3(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;let i=O3(n?.accounts,`${e} namespace`);i&&(r=i)}),r}function P3(t,e){let r=null;return nA(t?.methods)?nA(t?.events)||(r=js("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=js("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function gA(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;let i=P3(n,`${e}, namespace`);i&&(r=i)}),r}function t$(t,e,r){let n=null;if(t&&xp(t)){let i=gA(t,e);i&&(n=i);let s=N3(t,e,r);s&&(n=s)}else n=Zn("MISSING_OR_INVALID",`${e}, ${r} should be an object with data`);return n}function R3(t,e){let r=null;if(t&&xp(t)){let n=gA(t,e);n&&(r=n);let i=D3(t,e);i&&(r=i)}else r=Zn("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function B3(t){return wr(t.protocol,!0)}function r$(t,e){let r=!1;return e&&!t?r=!0:t&&tl(t)&&t.length&&t.forEach(n=>{r=B3(n)}),r}function n$(t){return typeof t=="number"}function i$(t){return typeof t<"u"&&typeof t!==null}function s$(t){return!(!t||typeof t!="object"||!t.code||!Np(t.code,!1)||!t.message||!wr(t.message,!1))}function o$(t){return!(qi(t)||!wr(t.method,!1))}function a$(t){return!(qi(t)||qi(t.result)&&qi(t.error)||!Np(t.id,!1)||!wr(t.jsonrpc,!1))}function u$(t){return!(qi(t)||!wr(t.name,!1))}function c$(t,e){return!(!Xc(e)||!_3(t).includes(e))}function l$(t,e,r){return wr(r,!1)?I3(t,e).includes(r):!1}function f$(t,e,r){return wr(r,!1)?S3(t,e).includes(r):!1}function L3(t,e,r){let n=null,i=h$(t),s=d$(e),o=Object.keys(i),a=Object.keys(s),u=QP(Object.keys(t)),l=QP(Object.keys(e)),f=u.filter(d=>!l.includes(d));return f.length&&(n=Zn("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces. Required: ${f.toString()} - Received: ${Object.keys(e).toString()}`)),Qi(o,a)||(n=ri("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces. + Received: ${Object.keys(e).toString()}`)),Mi(o,a)||(n=Zn("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces. Required: ${o.toString()} - Approved: ${a.toString()}`)),Object.keys(e).forEach(d=>{if(!d.includes(":")||n)return;let y=wo(e[d].accounts);y.includes(d)||(n=ri("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${d} + Approved: ${a.toString()}`)),Object.keys(e).forEach(d=>{if(!d.includes(":")||n)return;let g=Gs(e[d].accounts);g.includes(d)||(n=Zn("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${d} Required: ${d} - Approved: ${y.toString()}`))}),o.forEach(d=>{n||(Qi(i[d].methods,s[d].methods)?Qi(i[d].events,s[d].events)||(n=ri("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${d}`)):n=ri("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${d}`))}),n}function Jz(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 f3(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function Xz(t){let e={};return Object.keys(t).forEach(r=>{r.includes(":")?e[r]=t[r]:wo(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 Zz(t,e){return Up(t,!1)&&t<=e.max&&t>=e.min}Q.BASE10=Uv,Q.BASE16=Jt,Q.BASE64=Dp,Q.COLON=$k,Q.DEFAULT_DEPTH=Hv,Q.EMPTY_SPACE=Pp,Q.ENV_MAP=Fu,Q.ONE_THOUSAND=Yk,Q.REACT_NATIVE_PRODUCT=T3,Q.RELAYER_DEFAULT_PROTOCOL=q3,Q.SDK_TYPE=N3,Q.SLASH=x3,Q.TYPE_0=qv,Q.TYPE_1=Uu,Q.UTF8=Fp,Q.appendToQueryString=P3,Q.assertType=tz,Q.buildApprovedNamespaces=Pz,Q.calcExpiry=dz,Q.capitalize=az,Q.capitalizeWord=U3,Q.createDelayedPromise=uz,Q.createExpiringPromise=cz,Q.decodeTypeByte=Bl,Q.decrypt=Gk,Q.deriveSymKey=qk,Q.deserialize=jv,Q.encodeTypeByte=I3,Q.encrypt=Hk,Q.engineEvent=gz,Q.enumify=oz,Q.formatAccountId=w3,Q.formatAccountWithChain=Nk,Q.formatChainId=m3,Q.formatExpirerTarget=kv,Q.formatIdTarget=fz,Q.formatMessage=Lk,Q.formatMessageContext=rz,Q.formatRelayParams=j3,Q.formatRelayRpcUrl=Zk,Q.formatTopicTarget=lz,Q.formatUA=L3,Q.formatUri=_z,Q.generateKeyPair=Mk,Q.generateRandomBytes32=Uk,Q.getAccountsChains=wo,Q.getAccountsFromNamespaces=Dk,Q.getAddressFromAccount=E3,Q.getAddressesFromAccounts=Ok,Q.getAppMetadata=Jk,Q.getChainFromAccount=v3,Q.getChainsFromAccounts=A3,Q.getChainsFromNamespace=Bp,Q.getChainsFromNamespaces=Pk,Q.getChainsFromRequiredNamespaces=Rk,Q.getDidAddress=_3,Q.getDidAddressSegments=Lp,Q.getDidChainId=b3,Q.getEnvironment=Qv,Q.getHttpUrl=ez,Q.getInternalError=ri,Q.getJavascriptID=B3,Q.getJavascriptOS=R3,Q.getLastItems=M3,Q.getNamespacedDidChainId=Bk,Q.getNamespacesChains=H3,Q.getNamespacesEventsForChainId=Q3,Q.getNamespacesMethodsForChainId=G3,Q.getRelayClientMetadata=Xk,Q.getRelayProtocolApi=mz,Q.getRelayProtocolName=yz,Q.getRequiredNamespacesFromNamespaces=Dz,Q.getSdkError=mo,Q.getUniqueValues=Mv,Q.hasOverlap=Qi,Q.hashKey=Vk,Q.hashMessage=jk,Q.isBrowser=D3,Q.isCaipNamespace=zv,Q.isConformingNamespaces=eP,Q.isExpired=pz,Q.isNode=Gv,Q.isProposalStruct=Mz,Q.isReactNative=O3,Q.isSessionCompatible=Lz,Q.isSessionStruct=Uz,Q.isTypeOneEnvelope=kk,Q.isUndefined=zi,Q.isValidAccountId=z3,Q.isValidAccounts=$3,Q.isValidActions=J3,Q.isValidArray=Ll,Q.isValidChainId=qp,Q.isValidChains=W3,Q.isValidController=qz,Q.isValidErrorReason=Qz,Q.isValidEvent=Wz,Q.isValidId=Hz,Q.isValidNamespaceAccounts=Y3,Q.isValidNamespaceActions=Wv,Q.isValidNamespaceChains=K3,Q.isValidNamespaceMethodsOrEvents=Bv,Q.isValidNamespaces=X3,Q.isValidNamespacesChainId=Kz,Q.isValidNamespacesEvent=Yz,Q.isValidNamespacesRequest=$z,Q.isValidNumber=Up,Q.isValidObject=Mp,Q.isValidParams=Gz,Q.isValidRelay=Z3,Q.isValidRelays=jz,Q.isValidRequest=kz,Q.isValidRequestExpiry=Zz,Q.isValidRequiredNamespaces=Vz,Q.isValidResponse=zz,Q.isValidString=hr,Q.isValidUrl=Fz,Q.mapEntries=sz,Q.mapToObj=nz,Q.mergeArrays=ki,Q.normalizeNamespaces=Rv,Q.objToMap=iz,Q.parseAccountId=Fv,Q.parseChainId=y3,Q.parseContextNames=F3,Q.parseExpirerTarget=hz,Q.parseNamespaceKey=k3,Q.parseRelayParams=V3,Q.parseUri=bz,Q.serialize=S3,Q.validateDecoding=Qk,Q.validateEncoding=C3});var tP,rP,nP,iP,jp,Fl,Kv,Hp,Wi,Ml,Gp=ge(()=>{c();tP="PARSE_ERROR",rP="INVALID_REQUEST",nP="METHOD_NOT_FOUND",iP="INVALID_PARAMS",jp="INTERNAL_ERROR",Fl="SERVER_ERROR",Kv=[-32700,-32600,-32601,-32602,-32603],Hp=[-32e3,-32099],Wi={[tP]:{code:-32700,message:"Parse error"},[rP]:{code:-32600,message:"Invalid Request"},[nP]:{code:-32601,message:"Method not found"},[iP]:{code:-32602,message:"Invalid params"},[jp]:{code:-32603,message:"Internal error"},[Fl]:{code:-32e3,message:"Server error"}},Ml=Fl});function eW(t){return t<=Hp[0]&&t>=Hp[1]}function Qp(t){return Kv.includes(t)}function sP(t){return typeof t=="number"}function kp(t){return Object.keys(Wi).includes(t)?Wi[t]:Wi[Ml]}function zp(t){let e=Object.values(Wi).find(r=>r.code===t);return e||Wi[Ml]}function tW(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(!sP(t.error.code))return{valid:!1,error:`Invalid error code type for JSON-RPC: ${t.error.code}`};if(Qp(t.error.code)){let e=zp(t.error.code);if(e.message!==Wi[Ml].message&&t.error.message===e.message)return{valid:!1,error:`Invalid error code message for JSON-RPC: ${t.error.code}`}}return{valid:!0}}function $v(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var Yv=ge(()=>{c();Gp()});var aP=w(Ki=>{"use strict";c();Object.defineProperty(Ki,"__esModule",{value:!0});Ki.isBrowserCryptoAvailable=Ki.getSubtleCrypto=Ki.getBrowerCrypto=void 0;function Jv(){return(global===null||global===void 0?void 0:global.crypto)||(global===null||global===void 0?void 0:global.msCrypto)||{}}Ki.getBrowerCrypto=Jv;function oP(){let t=Jv();return t.subtle||t.webkitSubtle}Ki.getSubtleCrypto=oP;function rW(){return!!Jv()&&!!oP()}Ki.isBrowserCryptoAvailable=rW});var lP=w($i=>{"use strict";c();Object.defineProperty($i,"__esModule",{value:!0});$i.isBrowser=$i.isNode=$i.isReactNative=void 0;function uP(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}$i.isReactNative=uP;function cP(){return typeof p.default<"u"&&typeof p.default.versions<"u"&&typeof p.default.versions.node<"u"}$i.isNode=cP;function nW(){return!uP()&&!cP()}$i.isBrowser=nW});var Xv=w(Wp=>{"use strict";c();Object.defineProperty(Wp,"__esModule",{value:!0});var fP=(lr(),nt(cr));fP.__exportStar(aP(),Wp);fP.__exportStar(lP(),Wp)});var Dt={};at(Dt,{isNodeJs:()=>dP});var hP,dP,pP=ge(()=>{c();hP=_e(Xv());Mt(Dt,_e(Xv()));dP=hP.isNode});function Zv(t=3){let e=Date.now()*Math.pow(10,t),r=Math.floor(Math.random()*Math.pow(10,t));return e+r}function eA(t=6){return BigInt(Zv(t))}function tA(t,e,r){return{id:r||Zv(),jsonrpc:"2.0",method:t,params:e}}function iW(t,e){return{id:t,jsonrpc:"2.0",result:e}}function rA(t,e,r){return{id:t,jsonrpc:"2.0",error:gP(e,r)}}function gP(t,e){return typeof t>"u"?kp(jp):(typeof t=="string"&&(t=Object.assign(Object.assign({},kp(Fl)),{message:t})),typeof e<"u"&&(t.data=e),Qp(t.code)&&(t=zp(t.code)),t)}var yP=ge(()=>{c();Yv();Gp()});function sW(t){return t.includes("*")?$p(t):!/\W/g.test(t)}function Kp(t){return t==="*"}function $p(t){return Kp(t)?!0:!(!t.includes("*")||t.split("*").length!==2||t.split("*").filter(e=>e.trim()==="").length!==1)}function oW(t){return!Kp(t)&&$p(t)&&!t.split("*")[0].trim()}function aW(t){return!Kp(t)&&$p(t)&&!t.split("*")[1].trim()}var mP=ge(()=>{c()});var wP=ge(()=>{c()});var qu,nA=ge(()=>{c();qu=class{}});var iA,Yp,Ul,EP=ge(()=>{c();nA();iA=class extends qu{constructor(e){super()}},Yp=class extends qu{constructor(){super()}},Ul=class extends Yp{constructor(e){super()}}});var vP=ge(()=>{c()});var AP=ge(()=>{c();wP();nA();EP();vP()});var bP=ge(()=>{c();AP()});function lW(t){let e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function _P(t,e){let r=lW(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function fW(t){return _P(t,uW)}function Jp(t){return _P(t,cW)}function sA(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}var uW,cW,IP=ge(()=>{c();uW="^https?:",cW="^wss?:"});function oA(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function hW(t){return oA(t)&&"method"in t}function aA(t){return oA(t)&&(SP(t)||Xp(t))}function SP(t){return"result"in t}function Xp(t){return"error"in t}function dW(t){return"error"in t&&t.valid===!1}var CP=ge(()=>{c()});var Kt={};at(Kt,{DEFAULT_ERROR:()=>Ml,IBaseJsonRpcProvider:()=>Yp,IEvents:()=>qu,IJsonRpcConnection:()=>iA,IJsonRpcProvider:()=>Ul,INTERNAL_ERROR:()=>jp,INVALID_PARAMS:()=>iP,INVALID_REQUEST:()=>rP,METHOD_NOT_FOUND:()=>nP,PARSE_ERROR:()=>tP,RESERVED_ERROR_CODES:()=>Kv,SERVER_ERROR:()=>Fl,SERVER_ERROR_CODE_RANGE:()=>Hp,STANDARD_ERROR_MAP:()=>Wi,formatErrorMessage:()=>gP,formatJsonRpcError:()=>rA,formatJsonRpcRequest:()=>tA,formatJsonRpcResult:()=>iW,getBigIntRpcId:()=>eA,getError:()=>kp,getErrorByCode:()=>zp,isHttpUrl:()=>fW,isJsonRpcError:()=>Xp,isJsonRpcPayload:()=>oA,isJsonRpcRequest:()=>hW,isJsonRpcResponse:()=>aA,isJsonRpcResult:()=>SP,isJsonRpcValidationInvalid:()=>dW,isLocalhostUrl:()=>sA,isNodeJs:()=>dP,isReservedErrorCode:()=>Qp,isServerErrorCode:()=>eW,isValidDefaultRoute:()=>Kp,isValidErrorCode:()=>sP,isValidLeadingWildcardRoute:()=>oW,isValidRoute:()=>sW,isValidTrailingWildcardRoute:()=>aW,isValidWildcardRoute:()=>$p,isWsUrl:()=>Jp,parseConnectionError:()=>$v,payloadId:()=>Zv,validateJsonRpcError:()=>tW});var ql=ge(()=>{c();Gp();Yv();pP();Mt(Kt,Dt);yP();mP();bP();IP();CP()});var TP,Zp,xP,uA=ge(()=>{c();TP=_e(Wn());ql();Zp=class extends Ul{constructor(e){super(e),this.events=new TP.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(tA(e.method,e.params||[],eA().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=>{Xp(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),aA(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)}},xP=Zp});var NP={};at(NP,{JsonRpcProvider:()=>Zp,default:()=>pW});var pW,OP=ge(()=>{c();uA();uA();pW=xP});var PP=w((Mhe,DP)=>{"use strict";c();DP.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}});var BP,RP,gW,yW,mW,eg,LP,cA=ge(()=>{c();BP=_e(Wn());kd();ql();RP=10,gW=()=>typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:PP(),yW=()=>typeof window<"u",mW=gW(),eg=class{constructor(e){if(this.url=e,this.events=new BP.EventEmitter,this.registering=!1,!Jp(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,r)=>{if(typeof this.socket>"u"){r(new Error("Connection already closed"));return}this.socket.onclose=n=>{this.onClose(n),e()},this.socket.close()})}async send(e,r){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(pl(e))}catch(n){this.onError(e.id,n)}}register(e=this.url){if(!Jp(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){let r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return i(new Error("WebSocket connection is missing or invalid"));n(this.socket)})})}return this.url=e,this.registering=!0,new Promise((r,n)=>{let i=(0,Kt.isReactNative)()?void 0:{rejectUnauthorized:!sA(e)},s=new mW(e,[],i);yW()?s.onerror=o=>{let a=o;n(this.emitError(a.error))}:s.on("error",o=>{n(this.emitError(o))}),s.onopen=()=>{this.onOpen(s),r(s)}})}onOpen(e){e.onmessage=r=>this.onPayload(r),e.onclose=r=>this.onClose(r),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;let r=typeof e.data=="string"?dl(e.data):e.data;this.events.emit("payload",r)}onError(e,r){let n=this.parseError(r),i=n.message||n.toString(),s=rA(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return $v(e,r,"WS")}resetMaxListeners(){this.events.getMaxListeners()>RP&&this.events.setMaxListeners(RP)}emitError(e){let r=this.parseError(new Error(e?.message||`WebSocket connection failed for URL: ${this.url}`));return this.events.emit("register_error",r),r}},LP=eg});var FP={};at(FP,{WsConnection:()=>eg,default:()=>wW});var wW,MP=ge(()=>{c();cA();cA();wW=LP});var w6=w((Vl,ju)=>{c();var EW=200,vA="__lodash_hash_undefined__",ug=1,$P=2,YP=9007199254740991,tg="[object Arguments]",dA="[object Array]",vW="[object AsyncFunction]",JP="[object Boolean]",XP="[object Date]",ZP="[object Error]",e6="[object Function]",AW="[object GeneratorFunction]",rg="[object Map]",t6="[object Number]",bW="[object Null]",Vu="[object Object]",UP="[object Promise]",_W="[object Proxy]",r6="[object RegExp]",ng="[object Set]",n6="[object String]",IW="[object Symbol]",SW="[object Undefined]",pA="[object WeakMap]",i6="[object ArrayBuffer]",ig="[object DataView]",CW="[object Float32Array]",TW="[object Float64Array]",xW="[object Int8Array]",NW="[object Int16Array]",OW="[object Int32Array]",DW="[object Uint8Array]",PW="[object Uint8ClampedArray]",RW="[object Uint16Array]",BW="[object Uint32Array]",LW=/[\\^$.*+?()[\]{}|]/g,FW=/^\[object .+?Constructor\]$/,MW=/^(?:0|[1-9]\d*)$/,Ye={};Ye[CW]=Ye[TW]=Ye[xW]=Ye[NW]=Ye[OW]=Ye[DW]=Ye[PW]=Ye[RW]=Ye[BW]=!0;Ye[tg]=Ye[dA]=Ye[i6]=Ye[JP]=Ye[ig]=Ye[XP]=Ye[ZP]=Ye[e6]=Ye[rg]=Ye[t6]=Ye[Vu]=Ye[r6]=Ye[ng]=Ye[n6]=Ye[pA]=!1;var s6=typeof global=="object"&&global&&global.Object===Object&&global,UW=typeof self=="object"&&self&&self.Object===Object&&self,ni=s6||UW||Function("return this")(),o6=typeof Vl=="object"&&Vl&&!Vl.nodeType&&Vl,qP=o6&&typeof ju=="object"&&ju&&!ju.nodeType&&ju,a6=qP&&qP.exports===o6,lA=a6&&s6.process,VP=function(){try{return lA&&lA.binding&&lA.binding("util")}catch{}}(),jP=VP&&VP.isTypedArray;function qW(t,e){for(var r=-1,n=t==null?0:t.length,i=0,s=[];++r-1}function gK(t,e){var r=this.__data__,n=lg(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}ii.prototype.clear=fK;ii.prototype.delete=hK;ii.prototype.get=dK;ii.prototype.has=pK;ii.prototype.set=gK;function Ao(t){var e=-1,r=t==null?0:t.length;for(this.clear();++ea))return!1;var l=s.get(t);if(l&&s.get(e))return l==e;var f=-1,d=!0,y=r&$P?new og:void 0;for(s.set(t,e),s.set(e,t);++f-1&&t%1==0&&t-1&&t%1==0&&t<=YP}function y6(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}function Gl(t){return t!=null&&typeof t=="object"}var m6=jP?GW(jP):PK;function zK(t){return QK(t)?xK(t):RK(t)}function WK(){return[]}function KK(){return!1}ju.exports=kK});var v8=w(ve=>{"use strict";c();Object.defineProperty(ve,"__esModule",{value:!0});var _o=Wn(),$K=Od(),YK=Z2(),bg=gN(),tt=n1(),Xi=v1(),E6=(kd(),nt(bN)),JK=(zO(),nt(kO)),ee=Vp(),XK=(Sv(),nt(Iv)),It=co(),ZK=(OP(),nt(NP)),kr=(ql(),nt(Kt)),e$=(MP(),nt(FP)),t$=w6();function Wl(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}function r$(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 n$=Wl(_o),F6=Wl($K),i$=Wl(YK),hg=r$(JK),s$=Wl(e$),o$=Wl(t$);function a$(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,R=new Uint8Array(x);A!==D;){for(var P=v[A],L=0,_=x-1;(P!==0||L>>0,R[_]=P%a>>>0,P=P/a>>>0;if(P!==0)throw new Error("Non-zero carry");B=L,A++}for(var C=x-B;C!==x&&R[C]===0;)C++;for(var M=u.repeat(T);C>>0,x=new Uint8Array(D);v[T];){var R=r[v.charCodeAt(T)];if(R===255)return;for(var P=0,L=D-1;(R!==0||P>>0,x[L]=R%256>>>0,R=R/256>>>0;if(R!==0)throw new Error("Non-zero carry");A=P,T++}if(v[T]!==" "){for(var _=D-A;_!==D&&x[_]===0;)_++;for(var C=new Uint8Array(B+(D-_)),M=B;_!==D;)C[M++]=x[_++];return C}}}function m(v){var T=y(v);if(T)return T;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:y,decode:m}}var u$=a$,c$=u$,M6=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")},l$=t=>new TextEncoder().encode(t),f$=t=>new TextDecoder().decode(t),_A=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")}},IA=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 U6(this,e)}},SA=class{constructor(e){this.decoders=e}or(e){return U6(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`)}},U6=(t,e)=>new SA({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),CA=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new _A(e,r,n),this.decoder=new IA(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},_g=({name:t,prefix:e,encode:r,decode:n})=>new CA(t,e,r,n),Kl=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=c$(r,e);return _g({prefix:t,name:e,encode:n,decode:s=>M6(i(s))})},h$=(t,e,r,n)=>{let i={};for(let f=0;f=8&&(a-=8,o[l++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},d$=(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<_g({prefix:e,name:t,encode(i){return d$(i,n,r)},decode(i){return h$(i,n,r,t)}}),p$=_g({prefix:"\0",name:"identity",encode:t=>f$(t),decode:t=>l$(t)}),g$=Object.freeze({__proto__:null,identity:p$}),y$=qt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),m$=Object.freeze({__proto__:null,base2:y$}),w$=qt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),E$=Object.freeze({__proto__:null,base8:w$}),v$=Kl({prefix:"9",name:"base10",alphabet:"0123456789"}),A$=Object.freeze({__proto__:null,base10:v$}),b$=qt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),_$=qt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),I$=Object.freeze({__proto__:null,base16:b$,base16upper:_$}),S$=qt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),C$=qt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),T$=qt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),x$=qt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),N$=qt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),O$=qt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),D$=qt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),P$=qt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),R$=qt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),B$=Object.freeze({__proto__:null,base32:S$,base32upper:C$,base32pad:T$,base32padupper:x$,base32hex:N$,base32hexupper:O$,base32hexpad:D$,base32hexpadupper:P$,base32z:R$}),L$=Kl({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),F$=Kl({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),M$=Object.freeze({__proto__:null,base36:L$,base36upper:F$}),U$=Kl({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),q$=Kl({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),V$=Object.freeze({__proto__:null,base58btc:U$,base58flickr:q$}),j$=qt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),H$=qt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),G$=qt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Q$=qt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),k$=Object.freeze({__proto__:null,base64:j$,base64pad:H$,base64url:G$,base64urlpad:Q$}),q6=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}"),z$=q6.reduce((t,e,r)=>(t[r]=e,t),[]),W$=q6.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function K$(t){return t.reduce((e,r)=>(e+=z$[r],e),"")}function $$(t){let e=[];for(let r of t){let n=W$[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var Y$=_g({prefix:"\u{1F680}",name:"base256emoji",encode:K$,decode:$$}),J$=Object.freeze({__proto__:null,base256emoji:Y$}),X$=V6,v6=128,Z$=127,eY=~Z$,tY=Math.pow(2,31);function V6(t,e,r){e=e||[],r=r||0;for(var n=r;t>=tY;)e[r++]=t&255|v6,t/=128;for(;t&eY;)e[r++]=t&255|v6,t>>>=7;return e[r]=t|0,V6.bytes=r-n+1,e}var rY=TA,nY=128,A6=127;function TA(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw TA.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&A6)<=nY);return TA.bytes=s-n,r}var iY=Math.pow(2,7),sY=Math.pow(2,14),oY=Math.pow(2,21),aY=Math.pow(2,28),uY=Math.pow(2,35),cY=Math.pow(2,42),lY=Math.pow(2,49),fY=Math.pow(2,56),hY=Math.pow(2,63),dY=function(t){return t(j6.encode(t,e,r),e),_6=t=>j6.encodingLength(t),xA=(t,e)=>{let r=e.byteLength,n=_6(t),i=n+_6(r),s=new Uint8Array(i+r);return b6(t,s,0),b6(r,s,n),s.set(e,i),new NA(t,r,e,s)},NA=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}},H6=({name:t,code:e,encode:r})=>new OA(t,e,r),OA=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?xA(this.code,r):r.then(n=>xA(this.code,n))}else throw Error("Unknown type, must be binary type")}},G6=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),gY=H6({name:"sha2-256",code:18,encode:G6("SHA-256")}),yY=H6({name:"sha2-512",code:19,encode:G6("SHA-512")}),mY=Object.freeze({__proto__:null,sha256:gY,sha512:yY}),Q6=0,wY="identity",k6=M6,EY=t=>xA(Q6,k6(t)),vY={code:Q6,name:wY,encode:k6,digest:EY},AY=Object.freeze({__proto__:null,identity:vY});new TextEncoder,new TextDecoder;var I6={...g$,...m$,...E$,...A$,...I$,...B$,...M$,...V$,...k$,...J$};({...mY,...AY});function bY(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function z6(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var S6=z6("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),AA=z6("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);let e=bY(t.length);for(let r=0;r{if(!this.initialized){let n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}},this.has=n=>(this.isInitialized(),this.keychain.has(n)),this.set=async(n,i)=>{this.isInitialized(),this.keychain.set(n,i),await this.persist()},this.get=n=>{this.isInitialized();let i=this.keychain.get(n);if(typeof i>"u"){let{message:s}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(s)}return i},this.del=async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()},this.core=e,this.logger=tt.generateChildLogger(r,this.name)}get context(){return tt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,ee.mapToObj(e))}async getKeyChain(){let e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?ee.objToMap(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},pg=class{constructor(e,r,n){this.core=e,this.logger=r,this.name=Y6,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=hg.generateKeyPair(i);return hg.encodeIss(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();let i=ee.generateKeyPair();return this.setPrivateKey(i.publicKey,i.privateKey)},this.signJWT=async i=>{this.isInitialized();let s=await this.getClientSeed(),o=hg.generateKeyPair(s),a=ee.generateRandomBytes32(),u=J6;return await hg.signJWT(a,i,u,o)},this.generateSharedKey=(i,s,o)=>{this.isInitialized();let a=this.getPrivateKey(i),u=ee.deriveSymKey(a,s);return this.setSymKey(u,o)},this.setSymKey=async(i,s)=>{this.isInitialized();let o=s||ee.hashKey(i);return await this.keychain.set(o,i),o},this.deleteKeyPair=async i=>{this.isInitialized(),await this.keychain.del(i)},this.deleteSymKey=async i=>{this.isInitialized(),await this.keychain.del(i)},this.encode=async(i,s,o)=>{this.isInitialized();let a=ee.validateEncoding(o),u=E6.safeJsonStringify(s);if(ee.isTypeOneEnvelope(a)){let y=a.senderPublicKey,m=a.receiverPublicKey;i=await this.generateSharedKey(y,m)}let l=this.getSymKey(i),{type:f,senderPublicKey:d}=a;return ee.encrypt({type:f,symKey:l,message:u,senderPublicKey:d})},this.decode=async(i,s,o)=>{this.isInitialized();let a=ee.validateDecoding(s,o);if(ee.isTypeOneEnvelope(a)){let f=a.receiverPublicKey,d=a.senderPublicKey;i=await this.generateSharedKey(f,d)}let u=this.getSymKey(i),l=ee.decrypt({symKey:u,encoded:s});return E6.safeJsonParse(l)},this.getPayloadType=i=>{let s=ee.deserialize(i);return ee.decodeTypeByte(s.type)},this.getPayloadSenderPublicKey=i=>{let s=ee.deserialize(i);return s.senderPublicKey?XK.toString(s.senderPublicKey,ee.BASE16):void 0},this.core=e,this.logger=tt.generateChildLogger(r,this.name),this.keychain=n||new dg(this.core,this.logger)}get context(){return tt.getLoggerContext(this.logger)}async setPrivateKey(e,r){return await this.keychain.set(e,r),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(DA)}catch{e=ee.generateRandomBytes32(),await this.keychain.set(DA,e)}return IY(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},gg=class extends Xi.IMessageTracker{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=e8,this.version=t8,this.initialized=!1,this.storagePrefix=si,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{let n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}},this.set=async(n,i)=>{this.isInitialized();let s=ee.hashMessage(i),o=this.messages.get(n);return typeof o>"u"&&(o={}),typeof o[s]<"u"||(o[s]=i,this.messages.set(n,o),await this.persist()),s},this.get=n=>{this.isInitialized();let i=this.messages.get(n);return typeof i>"u"&&(i={}),i},this.has=(n,i)=>{this.isInitialized();let s=this.get(n),o=ee.hashMessage(i);return typeof s[o]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=tt.generateChildLogger(e,this.name),this.core=r}get context(){return tt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,ee.mapToObj(e))}async getRelayerMessages(){let e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?ee.objToMap(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},PA=class extends Xi.IPublisher{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new _o.EventEmitter,this.name=n8,this.queue=new Map,this.publishTimeout=1e4,this.publish=async(n,i,s)=>{this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}});try{let o=s?.ttl||r8,a=ee.getRelayProtocolName(s),u=s?.prompt||!1,l=s?.tag||0,f={topic:n,message:i,opts:{ttl:o,relay:a,prompt:u,tag:l}},d=ee.hashMessage(i);this.queue.set(d,f);try{await await ee.createExpiringPromise(this.rpcPublish(n,i,o,a,u,l),this.publishTimeout),this.relayer.events.emit(Ut.publish,f)}catch{this.logger.debug("Publishing Payload stalled"),this.relayer.events.emit(Ut.connection_stalled);return}this.onPublish(d,f),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}})}catch(o){throw this.logger.debug("Failed to Publish Payload"),this.logger.error(o),o}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.relayer=e,this.logger=tt.generateChildLogger(r,this.name),this.registerEventListeners()}get context(){return tt.getLoggerContext(this.logger)}rpcPublish(e,r,n,i,s,o){var a,u,l,f;let d={method:ee.getRelayProtocolApi(i.protocol).publish,params:{topic:e,message:r,ttl:n,prompt:s,tag:o}};return ee.isUndefined((a=d.params)==null?void 0:a.prompt)&&((u=d.params)==null||delete u.prompt),ee.isUndefined((l=d.params)==null?void 0:l.tag)&&((f=d.params)==null||delete f.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:d}),this.relayer.request(d)}onPublish(e,r){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{let{topic:r,message:n,opts:i}=e;await this.publish(r,n,i)})}registerEventListeners(){this.relayer.core.heartbeat.on(bg.HEARTBEAT_EVENTS.pulse,()=>{this.checkQueue()})}},RA=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())}},NY=Object.defineProperty,OY=Object.defineProperties,DY=Object.getOwnPropertyDescriptors,C6=Object.getOwnPropertySymbols,PY=Object.prototype.hasOwnProperty,RY=Object.prototype.propertyIsEnumerable,T6=(t,e,r)=>e in t?NY(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,kl=(t,e)=>{for(var r in e||(e={}))PY.call(e,r)&&T6(t,r,e[r]);if(C6)for(var r of C6(e))RY.call(e,r)&&T6(t,r,e[r]);return t},bA=(t,e)=>OY(t,DY(e)),yg=class extends Xi.ISubscriber{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new RA,this.events=new _o.EventEmitter,this.name=f8,this.version=h8,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=si,this.subscribeTimeout=1e4,this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restart(),this.registerEventListeners(),this.onEnable(),this.clientId=await this.relayer.core.crypto.getClientId())},this.subscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}});try{let s=ee.getRelayProtocolName(i),o={topic:n,relay:s};this.pending.set(n,o);let a=await this.rpcSubscribe(n,s);return this.onSubscribe(a,o),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}}),a}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}},this.unsubscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),typeof i?.id<"u"?await this.unsubscribeById(n,i.id,i):await this.unsubscribeByTopic(n,i)},this.isSubscribed=async n=>this.topics.includes(n)?!0:await new Promise((i,s)=>{let o=new It.Watch;o.start(this.pendingSubscriptionWatchLabel);let a=setInterval(()=>{!this.pending.has(n)&&this.topics.includes(n)&&(clearInterval(a),o.stop(this.pendingSubscriptionWatchLabel),i(!0)),o.elapsed(this.pendingSubscriptionWatchLabel)>=d8&&(clearInterval(a),o.stop(this.pendingSubscriptionWatchLabel),s(!1))},this.pollingInterval)}),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=tt.generateChildLogger(r,this.name),this.clientId=""}get context(){return tt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,r){let n=!1;try{n=this.getSubscription(e).topic===r}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,r){let n=this.topicMap.get(e);await Promise.all(n.map(async i=>await this.unsubscribeById(e,i,r)))}async unsubscribeById(e,r,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}});try{let i=ee.getRelayProtocolName(n);await this.rpcUnsubscribe(e,r,i);let s=ee.getSdkError("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,r,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}})}catch(i){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(i),i}}async rpcSubscribe(e,r){let n={method:ee.getRelayProtocolApi(r.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{await await ee.createExpiringPromise(this.relayer.request(n),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(Ut.connection_stalled)}return ee.hashMessage(e+this.clientId)}async rpcBatchSubscribe(e){if(!e.length)return;let r=e[0].relay,n={method:ee.getRelayProtocolApi(r.protocol).batchSubscribe,params:{topics:e.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await ee.createExpiringPromise(this.relayer.request(n),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Payload stalled"),this.relayer.events.emit(Ut.connection_stalled)}}rpcUnsubscribe(e,r,n){let i={method:ee.getRelayProtocolApi(n.protocol).unsubscribe,params:{topic:e,id:r}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(e,r){this.setSubscription(e,bA(kl({},r),{id:e})),this.pending.delete(r.topic)}onBatchSubscribe(e){e.length&&e.forEach(r=>{this.setSubscription(r.id,kl({},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,kl({},r)),this.topicMap.set(r.topic,e),this.events.emit(Qr.created,r)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});let r=this.subscriptions.get(e);if(!r){let{message:n}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}deleteSubscription(e,r){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:r});let n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit(Qr.deleted,bA(kl({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Qr.sync)}async reset(){if(!this.cached.length)return;let e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r"u"||!e.length)return;if(this.subscriptions.size){let{message:r}=ee.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;let r=await this.rpcBatchSubscribe(e);ee.isValidArray(r)&&this.onBatchSubscribe(r.map((n,i)=>bA(kl({},e[i]),{id:n})))}async onConnect(){this.restartInProgress||(await this.restart(),this.onEnable())}onDisconnect(){this.onDisable()}async checkPending(){if(this.relayer.transportExplicitlyClosed)return;let e=[];this.pending.forEach(r=>{e.push(r)}),await this.batchSubscribe(e)}registerEventListeners(){this.relayer.core.heartbeat.on(bg.HEARTBEAT_EVENTS.pulse,async()=>{await this.checkPending()}),this.relayer.on(Ut.connect,async()=>{await this.onConnect()}),this.relayer.on(Ut.disconnect,()=>{this.onDisconnect()}),this.events.on(Qr.created,async e=>{let r=Qr.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()}),this.events.on(Qr.deleted,async e=>{let r=Qr.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){this.restartInProgress&&await new Promise(e=>{let r=setInterval(()=>{this.restartInProgress||(clearInterval(r),e())},this.pollingInterval)})}},BY=Object.defineProperty,x6=Object.getOwnPropertySymbols,LY=Object.prototype.hasOwnProperty,FY=Object.prototype.propertyIsEnumerable,N6=(t,e,r)=>e in t?BY(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,MY=(t,e)=>{for(var r in e||(e={}))LY.call(e,r)&&N6(t,r,e[r]);if(x6)for(var r of x6(e))FY.call(e,r)&&N6(t,r,e[r]);return t},mg=class extends Xi.IRelayer{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new _o.EventEmitter,this.name=o8,this.transportExplicitlyClosed=!1,this.initialized=!1,this.reconnecting=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","socket stalled"],this.request=async r=>{this.logger.debug("Publishing Request Payload");try{return await this.toEstablishConnection(),await this.provider.request(r)}catch(n){throw this.logger.debug("Failed to Publish Request"),this.logger.error(n),n}},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?tt.generateChildLogger(e.logger,this.name):F6.default(tt.getDefaultLoggerOptions({level:e.logger||s8})),this.messages=new gg(this.logger,e.core),this.subscriber=new yg(this,this.logger),this.publisher=new PA(this,this.logger),this.relayUrl=e?.relayUrl||LA,this.projectId=e.projectId,this.provider={}}async init(){this.logger.trace("Initialized"),await this.createProvider(),await Promise.all([this.messages.init(),this.transportOpen(),this.subscriber.init()]),this.registerEventListeners(),this.initialized=!0}get context(){return tt.getLoggerContext(this.logger)}get connected(){return this.provider.connection.connected}get connecting(){return this.provider.connection.connecting}async publish(e,r,n){this.isInitialized(),await this.publisher.publish(e,r,n),await this.recordMessageEvent({topic:e,message:r,publishedAt:Date.now()})}async subscribe(e,r){this.isInitialized();let n="";return await Promise.all([new Promise(i=>{this.subscriber.once(Qr.created,s=>{s.topic===e&&i()})}),new Promise(async i=>{n=await this.subscriber.subscribe(e,r),i()})]),n}async unsubscribe(e,r){this.isInitialized(),await this.subscriber.unsubscribe(e,r)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async transportClose(){this.transportExplicitlyClosed=!0,this.connected&&(await this.provider.disconnect(),this.events.emit(Ut.transport_closed))}async transportOpen(e){if(!this.reconnecting){this.relayUrl=e||this.relayUrl,this.transportExplicitlyClosed=!1,this.reconnecting=!0;try{await Promise.all([new Promise(r=>{this.initialized||r(),this.subscriber.once(Qr.resubscribed,()=>{r()})}),await Promise.race([new Promise(async(r,n)=>{await ee.createExpiringPromise(this.provider.connect(),5e3,"socket stalled").catch(i=>n(i)).then(()=>r()).finally(()=>this.removeListener(Ut.transport_closed,this.rejectTransportOpen))}),new Promise(r=>this.once(Ut.transport_closed,this.rejectTransportOpen))])])}catch(r){this.logger.error(r);let n=r;if(!this.isConnectionStalled(n.message))throw r;this.events.emit(Ut.transport_closed)}finally{this.reconnecting=!1}}}async restartTransport(e){this.transportExplicitlyClosed||(this.relayUrl=e||this.relayUrl,await this.transportClose(),await new Promise(r=>setTimeout(r,500)),await this.createProvider(),await this.transportOpen())}isConnectionStalled(e){return this.staleConnectionErrors.some(r=>e.includes(r))}rejectTransportOpen(){throw new Error("closeTransport called before connection was established")}async createProvider(){let e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new ZK.JsonRpcProvider(new s$.default(ee.formatRelayRpcUrl({sdkVersion:c8,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0}))),this.registerProviderListeners()}async recordMessageEvent(e){let{topic:r,message:n}=e;await this.messages.set(r,n)}async shouldIgnoreMessageEvent(e){let{topic:r,message:n}=e;return await this.subscriber.isSubscribed(r)?this.messages.has(r,n):!0}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),kr.isJsonRpcRequest(e)){if(!e.method.endsWith(a8))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(MY({type:"event",event:r.id},o)),this.events.emit(r.id,o),await this.acknowledgePayload(e),await this.onMessageEvent(o)}}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(Ut.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){let r=kr.formatJsonRpcResult(e.id,!0);await this.provider.connection.send(r)}registerProviderListeners(){this.provider.on(zl.payload,e=>this.onProviderPayload(e)),this.provider.on(zl.connect,()=>{this.events.emit(Ut.connect)}),this.provider.on(zl.disconnect,()=>{this.onProviderDisconnect()}),this.provider.on(zl.error,e=>{this.logger.error(e),this.events.emit(Ut.error,e)})}registerEventListeners(){this.events.on(Ut.connection_stalled,async()=>{await this.restartTransport()})}onProviderDisconnect(){this.events.emit(Ut.disconnect),this.attemptToReconnect()}attemptToReconnect(){this.transportExplicitlyClosed||setTimeout(async()=>{await this.restartTransport()},It.toMiliseconds(u8))}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){if(!this.connected){if(this.connecting)return await new Promise(e=>{let r=setInterval(()=>{this.connected&&(clearInterval(r),e())},this.connectionStatusPollingInterval)});await this.restartTransport()}}},UY=Object.defineProperty,O6=Object.getOwnPropertySymbols,qY=Object.prototype.hasOwnProperty,VY=Object.prototype.propertyIsEnumerable,D6=(t,e,r)=>e in t?UY(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,P6=(t,e)=>{for(var r in e||(e={}))qY.call(e,r)&&D6(t,r,e[r]);if(O6)for(var r of O6(e))VY.call(e,r)&&D6(t,r,e[r]);return t},wg=class extends Xi.IStore{constructor(e,r,n,i=si,s=void 0){super(e,r,n,i),this.core=e,this.logger=r,this.name=n,this.map=new Map,this.version=l8,this.cached=[],this.initialized=!1,this.storagePrefix=si,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!ee.isUndefined(o)?this.map.set(this.getKey(o),o):ee.isProposalStruct(o)?this.map.set(o.id,o):ee.isSessionStruct(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)},this.set=async(o,a)=>{this.isInitialized(),this.map.has(o)?await this.update(o,a):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:a}),this.map.set(o,a),await this.persist())},this.get=o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o)),this.getAll=o=>(this.isInitialized(),o?this.values.filter(a=>Object.keys(o).every(u=>o$.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=P6(P6({},this.getData(o)),a);this.map.set(o,u),await this.persist()},this.delete=async(o,a)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:a}),this.map.delete(o),await this.persist())},this.logger=tt.generateChildLogger(r,this.name),this.storagePrefix=i,this.getKey=s}get context(){return tt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){let r=this.map.get(e);if(!r){let{message:n}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}async persist(){await this.setDataStore(this.values)}async restore(){try{let e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){let{message:r}=ee.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Eg=class{constructor(e,r){this.core=e,this.logger=r,this.name=p8,this.version=g8,this.events=new n$.default,this.initialized=!1,this.storagePrefix=si,this.ignoredPayloadTypes=[ee.TYPE_1],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]},this.create=async()=>{this.isInitialized();let n=ee.generateRandomBytes32(),i=await this.core.crypto.setSymKey(n),s=ee.calcExpiry(It.FIVE_MINUTES),o={protocol:i8},a={topic:i,expiry:s,relay:o,active:!1},u=ee.formatUri({protocol:this.core.protocol,version:this.core.version,topic:i,symKey:n,relay:o});return await this.pairings.set(i,a),await this.core.relayer.subscribe(i),this.core.expirer.set(i,s),{topic:i,uri:u}},this.pair=async n=>{this.isInitialized(),this.isValidPair(n);let{topic:i,symKey:s,relay:o}=ee.parseUri(n.uri);if(this.pairings.keys.includes(i))throw new Error(`Pairing already exists: ${i}`);if(this.core.crypto.hasKeys(i))throw new Error(`Keychain already exists: ${i}`);let a=ee.calcExpiry(It.FIVE_MINUTES),u={topic:i,relay:o,expiry:a,active:!1};return await this.pairings.set(i,u),await this.core.crypto.setSymKey(s,i),await this.core.relayer.subscribe(i,{relay:o}),this.core.expirer.set(i,a),n.activatePairing&&await this.activate({topic:i}),u},this.activate=async({topic:n})=>{this.isInitialized();let i=ee.calcExpiry(It.THIRTY_DAYS);await this.pairings.update(n,{active:!0,expiry:i}),this.core.expirer.set(n,i)},this.ping=async n=>{this.isInitialized(),await this.isValidPing(n);let{topic:i}=n;if(this.pairings.keys.includes(i)){let s=await this.sendRequest(i,"wc_pairingPing",{}),{done:o,resolve:a,reject:u}=ee.createDelayedPromise();this.events.once(ee.engineEvent("pairing_ping",s),({error:l})=>{l?u(l):a()}),await o()}},this.updateExpiry=async({topic:n,expiry:i})=>{this.isInitialized(),await this.pairings.update(n,{expiry:i})},this.updateMetadata=async({topic:n,metadata:i})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:i})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async n=>{this.isInitialized(),await this.isValidDisconnect(n);let{topic:i}=n;this.pairings.keys.includes(i)&&(await this.sendRequest(i,"wc_pairingDelete",ee.getSdkError("USER_DISCONNECTED")),await this.deletePairing(i))},this.sendRequest=async(n,i,s)=>{let o=kr.formatJsonRpcRequest(i,s),a=await this.core.crypto.encode(n,o),u=Gu[i].req;return this.core.history.set(n,o),await this.core.relayer.publish(n,a,u),o.id},this.sendResult=async(n,i,s)=>{let o=kr.formatJsonRpcResult(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=Gu[u.request.method].res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.sendError=async(n,i,s)=>{let o=kr.formatJsonRpcError(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=Gu[u.request.method]?Gu[u.request.method].res:Gu.unregistered_method.res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.deletePairing=async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,ee.getSdkError("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),i?Promise.resolve():this.core.expirer.del(n)])},this.cleanup=async()=>{let n=this.pairings.getAll().filter(i=>ee.isExpired(i.expiry));await Promise.all(n.map(i=>this.deletePairing(i.topic)))},this.onRelayEventRequest=n=>{let{topic:i,payload:s}=n,o=s.method;if(this.pairings.keys.includes(i))switch(o){case"wc_pairingPing":return this.onPairingPingRequest(i,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(i,s);default:return this.onUnknownRpcMethodRequest(i,s)}},this.onRelayEventResponse=async n=>{let{topic:i,payload:s}=n,o=(await this.core.history.get(i,s.id)).request.method;if(this.pairings.keys.includes(i))switch(o){case"wc_pairingPing":return this.onPairingPingResponse(i,s);default:return this.onUnknownRpcMethodResponse(o)}},this.onPairingPingRequest=async(n,i)=>{let{id:s}=i;try{this.isValidPing({topic:n}),await this.sendResult(s,n,!0),this.events.emit("pairing_ping",{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onPairingPingResponse=(n,i)=>{let{id:s}=i;setTimeout(()=>{kr.isJsonRpcResult(i)?this.events.emit(ee.engineEvent("pairing_ping",s),{}):kr.isJsonRpcError(i)&&this.events.emit(ee.engineEvent("pairing_ping",s),{error:i.error})},500)},this.onPairingDeleteRequest=async(n,i)=>{let{id:s}=i;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit("pairing_delete",{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onUnknownRpcMethodRequest=async(n,i)=>{let{id:s,method:o}=i;try{if(this.registeredMethods.includes(o))return;let a=ee.getSdkError("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,n,a),this.logger.error(a)}catch(a){await this.sendError(s,n,a),this.logger.error(a)}},this.onUnknownRpcMethodResponse=n=>{this.registeredMethods.includes(n)||this.logger.error(ee.getSdkError("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=n=>{if(!ee.isValidParams(n)){let{message:i}=ee.getInternalError("MISSING_OR_INVALID",`pair() params: ${n}`);throw new Error(i)}if(!ee.isValidUrl(n.uri)){let{message:i}=ee.getInternalError("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw new Error(i)}},this.isValidPing=async n=>{if(!ee.isValidParams(n)){let{message:s}=ee.getInternalError("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}let{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidDisconnect=async n=>{if(!ee.isValidParams(n)){let{message:s}=ee.getInternalError("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}let{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidPairingTopic=async n=>{if(!ee.isValidString(n,!1)){let{message:i}=ee.getInternalError("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){let{message:i}=ee.getInternalError("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(ee.isExpired(this.pairings.get(n).expiry)){await this.deletePairing(n);let{message:i}=ee.getInternalError("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}},this.core=e,this.logger=tt.generateChildLogger(r,this.name),this.pairings=new wg(this.core,this.logger,this.name,this.storagePrefix)}get context(){return tt.getLoggerContext(this.logger)}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(Ut.message,async e=>{let{topic:r,message:n}=e;if(this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;let i=await this.core.crypto.decode(r,n);kr.isJsonRpcRequest(i)?(this.core.history.set(r,i),this.onRelayEventRequest({topic:r,payload:i})):kr.isJsonRpcResponse(i)&&(await this.core.history.resolve(i),this.onRelayEventResponse({topic:r,payload:i}))})}registerExpirerEvents(){this.core.expirer.on(Dr.expired,async e=>{let{topic:r}=ee.parseExpirerTarget(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit("pairing_expire",{topic:r}))})}},vg=class extends Xi.IJsonRpcHistory{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new _o.EventEmitter,this.name=y8,this.version=m8,this.cached=[],this.initialized=!1,this.storagePrefix=si,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.records.set(n.id,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(n,i,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:i,chainId:s}),this.records.has(i.id))return;let o={id:i.id,topic:n,request:{method:i.method,params:i.params||null},chainId:s};this.records.set(o.id,o),this.events.emit(Gr.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=kr.isJsonRpcError(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.events.emit(Gr.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(Gr.deleted,s)}})},this.exists=async(n,i)=>(this.isInitialized(),this.records.has(i)?(await this.getRecord(i)).topic===n:!1),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=tt.generateChildLogger(r,this.name)}get context(){return tt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){let e=[];return this.values.forEach(r=>{if(typeof r.response<"u")return;let n={topic:r.topic,request:kr.formatJsonRpcRequest(r.request.method,r.request.params,r.id),chainId:r.chainId};return e.push(n)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();let r=this.records.get(e);if(!r){let{message:n}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(Gr.sync)}async restore(){try{let e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){let{message:r}=ee.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(Gr.created,e=>{let r=Gr.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.events.on(Gr.updated,e=>{let r=Gr.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.events.on(Gr.deleted,e=>{let r=Gr.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Ag=class extends Xi.IExpirer{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new _o.EventEmitter,this.name=w8,this.version=E8,this.cached=[],this.initialized=!1,this.storagePrefix=si,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(Dr.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(Dr.deleted,{target:i,expiration:s})}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=tt.generateChildLogger(r,this.name)}get context(){return tt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return ee.formatTopicTarget(e);if(typeof e=="number")return ee.formatIdTarget(e);let{message:r}=ee.getInternalError("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(r)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(Dr.sync)}async restore(){try{let e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){let{message:r}=ee.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){let r=this.expirations.get(e);if(!r){let{message:n}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}checkExpiry(e,r){let{expiry:n}=r;It.toMiliseconds(n)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(Dr.expired,{target:e,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(bg.HEARTBEAT_EVENTS.pulse,()=>this.checkExpirations()),this.events.on(Dr.created,e=>{let r=Dr.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Dr.expired,e=>{let r=Dr.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Dr.deleted,e=>{let r=Dr.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},jY=Object.defineProperty,R6=Object.getOwnPropertySymbols,HY=Object.prototype.hasOwnProperty,GY=Object.prototype.propertyIsEnumerable,B6=(t,e,r)=>e in t?jY(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,L6=(t,e)=>{for(var r in e||(e={}))HY.call(e,r)&&B6(t,r,e[r]);if(R6)for(var r of R6(e))GY.call(e,r)&&B6(t,r,e[r]);return t},Qu=class extends Xi.ICore{constructor(e){super(e),this.protocol=BA,this.version=W6,this.name=Ig,this.events=new _o.EventEmitter,this.initialized=!1,this.on=(n,i)=>this.events.on(n,i),this.once=(n,i)=>this.events.once(n,i),this.off=(n,i)=>this.events.off(n,i),this.removeListener=(n,i)=>this.events.removeListener(n,i),this.projectId=e?.projectId,this.relayUrl=e?.relayUrl||LA;let r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:F6.default(tt.getDefaultLoggerOptions({level:e?.logger||K6.logger}));this.logger=tt.generateChildLogger(r,this.name),this.heartbeat=new bg.HeartBeat,this.crypto=new pg(this,this.logger,e?.keychain),this.history=new vg(this,this.logger),this.expirer=new Ag(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new i$.default(L6(L6({},$6),e?.storageOptions)),this.relayer=new mg({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new Eg(this,this.logger)}static async init(e){let r=new Qu(e);return await r.initialize(),r}get context(){return tt.getLoggerContext(this.logger)}async start(){this.initialized||await this.initialize()}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}},QY=Qu;ve.CORE_CONTEXT=Ig,ve.CORE_DEFAULT=K6,ve.CORE_PROTOCOL=BA,ve.CORE_STORAGE_OPTIONS=$6,ve.CORE_STORAGE_PREFIX=si,ve.CORE_VERSION=W6,ve.CRYPTO_CLIENT_SEED=DA,ve.CRYPTO_CONTEXT=Y6,ve.CRYPTO_JWT_TTL=J6,ve.Core=QY,ve.Crypto=pg,ve.EXPIRER_CONTEXT=w8,ve.EXPIRER_DEFAULT_TTL=xY,ve.EXPIRER_EVENTS=Dr,ve.EXPIRER_STORAGE_VERSION=E8,ve.Expirer=Ag,ve.HISTORY_CONTEXT=y8,ve.HISTORY_EVENTS=Gr,ve.HISTORY_STORAGE_VERSION=m8,ve.JsonRpcHistory=vg,ve.KEYCHAIN_CONTEXT=X6,ve.KEYCHAIN_STORAGE_VERSION=Z6,ve.KeyChain=dg,ve.MESSAGES_CONTEXT=e8,ve.MESSAGES_STORAGE_VERSION=t8,ve.MessageTracker=gg,ve.PAIRING_CONTEXT=p8,ve.PAIRING_DEFAULT_TTL=TY,ve.PAIRING_RPC_OPTS=Gu,ve.PAIRING_STORAGE_VERSION=g8,ve.PENDING_SUB_RESOLUTION_TIMEOUT=d8,ve.PUBLISHER_CONTEXT=n8,ve.PUBLISHER_DEFAULT_TTL=r8,ve.Pairing=Eg,ve.RELAYER_CONTEXT=o8,ve.RELAYER_DEFAULT_LOGGER=s8,ve.RELAYER_DEFAULT_PROTOCOL=i8,ve.RELAYER_DEFAULT_RELAY_URL=LA,ve.RELAYER_EVENTS=Ut,ve.RELAYER_PROVIDER_EVENTS=zl,ve.RELAYER_RECONNECT_TIMEOUT=u8,ve.RELAYER_SDK_VERSION=c8,ve.RELAYER_STORAGE_OPTIONS=SY,ve.RELAYER_SUBSCRIBER_SUFFIX=a8,ve.Relayer=mg,ve.STORE_STORAGE_VERSION=l8,ve.SUBSCRIBER_CONTEXT=f8,ve.SUBSCRIBER_DEFAULT_TTL=CY,ve.SUBSCRIBER_EVENTS=Qr,ve.SUBSCRIBER_STORAGE_VERSION=h8,ve.Store=wg,ve.Subscriber=yg,ve.default=Qu});var D8=w(it=>{"use strict";c();Object.defineProperty(it,"__esModule",{value:!0});var kY=Od(),Zi=v8(),FA=n1(),_8=v1(),k=Vp(),I8=Wn(),st=co(),St=(ql(),nt(Kt));function S8(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var zY=S8(kY),WY=S8(I8),HA="wc",GA=2,QA="client",Tg=`${HA}@${GA}:${QA}:`,Sg={name:QA,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},KY={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"},$Y={database:":memory:"},YY={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},JY="history",XY="0.3",C8="proposal",ZY=st.THIRTY_DAYS,T8="Proposal expired",x8="session",$l=st.SEVEN_DAYS,N8="engine",ku={wc_sessionPropose:{req:{ttl:st.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:st.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:st.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:st.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:st.ONE_DAY,prompt:!1,tag:1104},res:{ttl:st.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:st.ONE_DAY,prompt:!1,tag:1106},res:{ttl:st.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:st.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:st.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:st.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:st.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:st.ONE_DAY,prompt:!1,tag:1112},res:{ttl:st.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:st.THIRTY_SECONDS,prompt:!1,tag:1114},res:{ttl:st.THIRTY_SECONDS,prompt:!1,tag:1115}}},Cg={min:st.FIVE_MINUTES,max:st.SEVEN_DAYS},O8="request",eJ=Object.defineProperty,tJ=Object.defineProperties,rJ=Object.getOwnPropertyDescriptors,A8=Object.getOwnPropertySymbols,nJ=Object.prototype.hasOwnProperty,iJ=Object.prototype.propertyIsEnumerable,b8=(t,e,r)=>e in t?eJ(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Pr=(t,e)=>{for(var r in e||(e={}))nJ.call(e,r)&&b8(t,r,e[r]);if(A8)for(var r of A8(e))iJ.call(e,r)&&b8(t,r,e[r]);return t},MA=(t,e)=>tJ(t,rJ(e)),UA=class extends _8.IEngine{constructor(e){super(e),this.name=N8,this.events=new WY.default,this.initialized=!1,this.ignoredPayloadTypes=[k.TYPE_1],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.client.core.pairing.register({methods:Object.keys(ku)}),this.initialized=!0)},this.connect=async r=>{this.isInitialized();let n=MA(Pr({},r),{requiredNamespaces:r.requiredNamespaces||{},optionalNamespaces:r.optionalNamespaces||{}});await this.isValidConnect(n);let{pairingTopic:i,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:a,relays:u}=n,l=i,f,d=!1;if(l&&(d=this.client.core.pairing.pairings.get(l).active),!l||!d){let{topic:x,uri:R}=await this.client.core.pairing.create();l=x,f=R}let y=await this.client.core.crypto.generateKeyPair(),m=Pr({requiredNamespaces:s,optionalNamespaces:o,relays:u??[{protocol:Zi.RELAYER_DEFAULT_PROTOCOL}],proposer:{publicKey:y,metadata:this.client.metadata}},a&&{sessionProperties:a}),{reject:v,resolve:T,done:B}=k.createDelayedPromise(st.FIVE_MINUTES,T8);if(this.events.once(k.engineEvent("session_connect"),async({error:x,session:R})=>{if(x)v(x);else if(R){R.self.publicKey=y;let P=MA(Pr({},R),{requiredNamespaces:R.requiredNamespaces,optionalNamespaces:R.optionalNamespaces});await this.client.session.set(R.topic,P),await this.setExpiry(R.topic,R.expiry),l&&await this.client.core.pairing.updateMetadata({topic:l,metadata:R.peer.metadata}),T(P)}}),!l){let{message:x}=k.getInternalError("NO_MATCHING_KEY",`connect() pairing topic: ${l}`);throw new Error(x)}let A=await this.sendRequest(l,"wc_sessionPropose",m),D=k.calcExpiry(st.FIVE_MINUTES);return await this.setProposal(A,Pr({id:A,expiry:D},m)),{uri:f,approval:B}},this.pair=async r=>(this.isInitialized(),await this.client.core.pairing.pair(r)),this.approve=async r=>{this.isInitialized(),await this.isValidApprove(r);let{id:n,relayProtocol:i,namespaces:s,sessionProperties:o}=r,a=this.client.proposal.get(n),{pairingTopic:u,proposer:l,requiredNamespaces:f,optionalNamespaces:d}=a;u=u||"",k.isValidObject(f)||(f=k.getRequiredNamespacesFromNamespaces(s,"approve()"));let y=await this.client.core.crypto.generateKeyPair(),m=l.publicKey,v=await this.client.core.crypto.generateSharedKey(y,m);u&&n&&(await this.client.core.pairing.updateMetadata({topic:u,metadata:l.metadata}),await this.sendResult(n,u,{relay:{protocol:i??"irn"},responderPublicKey:y}),await this.client.proposal.delete(n,k.getSdkError("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:u}));let T=Pr({relay:{protocol:i??"irn"},namespaces:s,requiredNamespaces:f,optionalNamespaces:d,pairingTopic:u,controller:{publicKey:y,metadata:this.client.metadata},expiry:k.calcExpiry($l)},o&&{sessionProperties:o});await this.client.core.relayer.subscribe(v),await this.sendRequest(v,"wc_sessionSettle",T);let B=MA(Pr({},T),{topic:v,pairingTopic:u,acknowledged:!1,self:T.controller,peer:{publicKey:l.publicKey,metadata:l.metadata},controller:y});return await this.client.session.set(v,B),await this.setExpiry(v,k.calcExpiry($l)),{topic:v,acknowledged:()=>new Promise(A=>A(this.client.session.get(v)))}},this.reject=async r=>{this.isInitialized(),await this.isValidReject(r);let{id:n,reason:i}=r,{pairingTopic:s}=this.client.proposal.get(n);s&&(await this.sendError(n,s,i),await this.client.proposal.delete(n,k.getSdkError("USER_DISCONNECTED")))},this.update=async r=>{this.isInitialized(),await this.isValidUpdate(r);let{topic:n,namespaces:i}=r,s=await this.sendRequest(n,"wc_sessionUpdate",{namespaces:i}),{done:o,resolve:a,reject:u}=k.createDelayedPromise();return this.events.once(k.engineEvent("session_update",s),({error:l})=>{l?u(l):a()}),await this.client.session.update(n,{namespaces:i}),{acknowledged:o}},this.extend=async r=>{this.isInitialized(),await this.isValidExtend(r);let{topic:n}=r,i=await this.sendRequest(n,"wc_sessionExtend",{}),{done:s,resolve:o,reject:a}=k.createDelayedPromise();return this.events.once(k.engineEvent("session_extend",i),({error:u})=>{u?a(u):o()}),await this.setExpiry(n,k.calcExpiry($l)),{acknowledged:s}},this.request=async r=>{this.isInitialized(),await this.isValidRequest(r);let{chainId:n,request:i,topic:s,expiry:o}=r,a=await this.sendRequest(s,"wc_sessionRequest",{request:i,chainId:n},o),{done:u,resolve:l,reject:f}=k.createDelayedPromise(o);return this.events.once(k.engineEvent("session_request",a),({error:d,result:y})=>{d?f(d):l(y)}),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:a}),await u()},this.respond=async r=>{this.isInitialized(),await this.isValidRespond(r);let{topic:n,response:i}=r,{id:s}=i;St.isJsonRpcResult(i)?await this.sendResult(s,n,i.result):St.isJsonRpcError(i)&&await this.sendError(s,n,i.error),this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0})},this.ping=async r=>{this.isInitialized(),await this.isValidPing(r);let{topic:n}=r;if(this.client.session.keys.includes(n)){let i=await this.sendRequest(n,"wc_sessionPing",{}),{done:s,resolve:o,reject:a}=k.createDelayedPromise();this.events.once(k.engineEvent("session_ping",i),({error:u})=>{u?a(u):o()}),await s()}else this.client.core.pairing.pairings.keys.includes(n)&&await this.client.core.pairing.ping({topic:n})},this.emit=async r=>{this.isInitialized(),await this.isValidEmit(r);let{topic:n,event:i,chainId:s}=r;await this.sendRequest(n,"wc_sessionEvent",{event:i,chainId:s})},this.disconnect=async r=>{this.isInitialized(),await this.isValidDisconnect(r);let{topic:n}=r;this.client.session.keys.includes(n)?(await this.sendRequest(n,"wc_sessionDelete",k.getSdkError("USER_DISCONNECTED")),await this.deleteSession(n)):await this.client.core.pairing.disconnect({topic:n})},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(n=>k.isSessionCompatible(n,r))),this.getPendingSessionRequests=()=>(this.isInitialized(),this.client.pendingRequest.getAll()),this.deleteSession=async(r,n)=>{let{self:i}=this.client.session.get(r);await this.client.core.relayer.unsubscribe(r),await Promise.all([this.client.session.delete(r,k.getSdkError("USER_DISCONNECTED")),this.client.core.crypto.deleteKeyPair(i.publicKey),this.client.core.crypto.deleteSymKey(r),n?Promise.resolve():this.client.core.expirer.del(r)])},this.deleteProposal=async(r,n)=>{await Promise.all([this.client.proposal.delete(r,k.getSdkError("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(r)])},this.deletePendingSessionRequest=async(r,n,i=!1)=>{await Promise.all([this.client.pendingRequest.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)])},this.setExpiry=async(r,n)=>{this.client.session.keys.includes(r)&&await this.client.session.update(r,{expiry:n}),this.client.core.expirer.set(r,n)},this.setProposal=async(r,n)=>{await this.client.proposal.set(r,n),this.client.core.expirer.set(r,n.expiry)},this.setPendingSessionRequest=async r=>{let n=ku.wc_sessionRequest.req.ttl,{id:i,topic:s,params:o}=r;await this.client.pendingRequest.set(i,{id:i,topic:s,params:o}),n&&this.client.core.expirer.set(i,k.calcExpiry(n))},this.sendRequest=async(r,n,i,s)=>{let o=St.formatJsonRpcRequest(n,i),a=await this.client.core.crypto.encode(r,o),u=ku[n].req;return s&&(u.ttl=s),this.client.core.history.set(r,o),this.client.core.relayer.publish(r,a,u),o.id},this.sendResult=async(r,n,i)=>{let s=St.formatJsonRpcResult(r,i),o=await this.client.core.crypto.encode(n,s),a=await this.client.core.history.get(n,r),u=ku[a.request.method].res;this.client.core.relayer.publish(n,o,u),await this.client.core.history.resolve(s)},this.sendError=async(r,n,i)=>{let s=St.formatJsonRpcError(r,i),o=await this.client.core.crypto.encode(n,s),a=await this.client.core.history.get(n,r),u=ku[a.request.method].res;this.client.core.relayer.publish(n,o,u),await this.client.core.history.resolve(s)},this.cleanup=async()=>{let r=[],n=[];this.client.session.getAll().forEach(i=>{k.isExpired(i.expiry)&&r.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{k.isExpired(i.expiry)&&n.push(i.id)}),await Promise.all([...r.map(i=>this.deleteSession(i)),...n.map(i=>this.deleteProposal(i))])},this.onRelayEventRequest=r=>{let{topic:n,payload:i}=r,s=i.method;switch(s){case"wc_sessionPropose":return this.onSessionProposeRequest(n,i);case"wc_sessionSettle":return this.onSessionSettleRequest(n,i);case"wc_sessionUpdate":return this.onSessionUpdateRequest(n,i);case"wc_sessionExtend":return this.onSessionExtendRequest(n,i);case"wc_sessionPing":return this.onSessionPingRequest(n,i);case"wc_sessionDelete":return this.onSessionDeleteRequest(n,i);case"wc_sessionRequest":return this.onSessionRequest(n,i);case"wc_sessionEvent":return this.onSessionEventRequest(n,i);default:return this.client.logger.info(`Unsupported request method ${s}`)}},this.onRelayEventResponse=async r=>{let{topic:n,payload:i}=r,s=(await this.client.core.history.get(n,i.id)).request.method;switch(s){case"wc_sessionPropose":return this.onSessionProposeResponse(n,i);case"wc_sessionSettle":return this.onSessionSettleResponse(n,i);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,i);case"wc_sessionExtend":return this.onSessionExtendResponse(n,i);case"wc_sessionPing":return this.onSessionPingResponse(n,i);case"wc_sessionRequest":return this.onSessionRequestResponse(n,i);default:return this.client.logger.info(`Unsupported response method ${s}`)}},this.onSessionProposeRequest=async(r,n)=>{let{params:i,id:s}=n;try{this.isValidConnect(Pr({},n.params));let o=k.calcExpiry(st.FIVE_MINUTES),a=Pr({id:s,pairingTopic:r,expiry:o},i);await this.setProposal(s,a),this.client.events.emit("session_proposal",{id:s,params:a})}catch(o){await this.sendError(s,r,o),this.client.logger.error(o)}},this.onSessionProposeResponse=async(r,n)=>{let{id:i}=n;if(St.isJsonRpcResult(n)){let{result:s}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:s});let o=this.client.proposal.get(i);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:o});let a=o.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:a});let u=s.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:u});let l=await this.client.core.crypto.generateSharedKey(a,u);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:l});let f=await this.client.core.relayer.subscribe(l);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:f}),await this.client.core.pairing.activate({topic:r})}else St.isJsonRpcError(n)&&(await this.client.proposal.delete(i,k.getSdkError("USER_DISCONNECTED")),this.events.emit(k.engineEvent("session_connect"),{error:n.error}))},this.onSessionSettleRequest=async(r,n)=>{let{id:i,params:s}=n;try{this.isValidSessionSettleRequest(s);let{relay:o,controller:a,expiry:u,namespaces:l,requiredNamespaces:f,optionalNamespaces:d,sessionProperties:y,pairingTopic:m}=n.params,v=Pr({topic:r,relay:o,expiry:u,namespaces:l,acknowledged:!0,pairingTopic:m,requiredNamespaces:f,optionalNamespaces:d,controller:a.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}},y&&{sessionProperties:y});await this.sendResult(n.id,r,!0),this.events.emit(k.engineEvent("session_connect"),{session:v})}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.onSessionSettleResponse=async(r,n)=>{let{id:i}=n;St.isJsonRpcResult(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(k.engineEvent("session_approve",i),{})):St.isJsonRpcError(n)&&(await this.client.session.delete(r,k.getSdkError("USER_DISCONNECTED")),this.events.emit(k.engineEvent("session_approve",i),{error:n.error}))},this.onSessionUpdateRequest=async(r,n)=>{let{params:i,id:s}=n;try{this.isValidUpdate(Pr({topic:r},i)),await this.client.session.update(r,{namespaces:i.namespaces}),await this.sendResult(s,r,!0),this.client.events.emit("session_update",{id:s,topic:r,params:i})}catch(o){await this.sendError(s,r,o),this.client.logger.error(o)}},this.onSessionUpdateResponse=(r,n)=>{let{id:i}=n;St.isJsonRpcResult(n)?this.events.emit(k.engineEvent("session_update",i),{}):St.isJsonRpcError(n)&&this.events.emit(k.engineEvent("session_update",i),{error:n.error})},this.onSessionExtendRequest=async(r,n)=>{let{id:i}=n;try{this.isValidExtend({topic:r}),await this.setExpiry(r,k.calcExpiry($l)),await this.sendResult(i,r,!0),this.client.events.emit("session_extend",{id:i,topic:r})}catch(s){await this.sendError(i,r,s),this.client.logger.error(s)}},this.onSessionExtendResponse=(r,n)=>{let{id:i}=n;St.isJsonRpcResult(n)?this.events.emit(k.engineEvent("session_extend",i),{}):St.isJsonRpcError(n)&&this.events.emit(k.engineEvent("session_extend",i),{error:n.error})},this.onSessionPingRequest=async(r,n)=>{let{id:i}=n;try{this.isValidPing({topic:r}),await this.sendResult(i,r,!0),this.client.events.emit("session_ping",{id:i,topic:r})}catch(s){await this.sendError(i,r,s),this.client.logger.error(s)}},this.onSessionPingResponse=(r,n)=>{let{id:i}=n;setTimeout(()=>{St.isJsonRpcResult(n)?this.events.emit(k.engineEvent("session_ping",i),{}):St.isJsonRpcError(n)&&this.events.emit(k.engineEvent("session_ping",i),{error:n.error})},500)},this.onSessionDeleteRequest=async(r,n)=>{let{id:i}=n;try{this.isValidDisconnect({topic:r,reason:n.params}),this.client.core.relayer.once(Zi.RELAYER_EVENTS.publish,async()=>{await this.deleteSession(r)}),await this.sendResult(i,r,!0),this.client.events.emit("session_delete",{id:i,topic:r})}catch(s){await this.sendError(i,r,s),this.client.logger.error(s)}},this.onSessionRequest=async(r,n)=>{let{id:i,params:s}=n;try{this.isValidRequest(Pr({topic:r},s)),await this.setPendingSessionRequest({id:i,topic:r,params:s}),this.client.events.emit("session_request",{id:i,topic:r,params:s})}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.onSessionRequestResponse=(r,n)=>{let{id:i}=n;St.isJsonRpcResult(n)?this.events.emit(k.engineEvent("session_request",i),{result:n.result}):St.isJsonRpcError(n)&&this.events.emit(k.engineEvent("session_request",i),{error:n.error})},this.onSessionEventRequest=async(r,n)=>{let{id:i,params:s}=n;try{this.isValidEmit(Pr({topic:r},s)),this.client.events.emit("session_event",{id:i,topic:r,params:s})}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.isValidConnect=async r=>{if(!k.isValidParams(r)){let{message:u}=k.getInternalError("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(r)}`);throw new Error(u)}let{pairingTopic:n,requiredNamespaces:i,optionalNamespaces:s,sessionProperties:o,relays:a}=r;if(k.isUndefined(n)||await this.isValidPairingTopic(n),!k.isValidRelays(a,!0)){let{message:u}=k.getInternalError("MISSING_OR_INVALID",`connect() relays: ${a}`);throw new Error(u)}!k.isUndefined(i)&&k.isValidObject(i)!==0&&this.validateNamespaces(i,"requiredNamespaces"),!k.isUndefined(s)&&k.isValidObject(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),k.isUndefined(o)||this.validateSessionProps(o,"sessionProperties")},this.validateNamespaces=(r,n)=>{let i=k.isValidRequiredNamespaces(r,"connect()",n);if(i)throw new Error(i.message)},this.isValidApprove=async r=>{if(!k.isValidParams(r))throw new Error(k.getInternalError("MISSING_OR_INVALID",`approve() params: ${r}`).message);let{id:n,namespaces:i,relayProtocol:s,sessionProperties:o}=r;await this.isValidProposalId(n);let a=this.client.proposal.get(n),u=k.isValidNamespaces(i,"approve()");if(u)throw new Error(u.message);let l=k.isConformingNamespaces(a.requiredNamespaces,i,"approve()");if(l)throw new Error(l.message);if(!k.isValidString(s,!0)){let{message:f}=k.getInternalError("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(f)}k.isUndefined(o)||this.validateSessionProps(o,"sessionProperties")},this.isValidReject=async r=>{if(!k.isValidParams(r)){let{message:s}=k.getInternalError("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(s)}let{id:n,reason:i}=r;if(await this.isValidProposalId(n),!k.isValidErrorReason(i)){let{message:s}=k.getInternalError("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidSessionSettleRequest=r=>{if(!k.isValidParams(r)){let{message:l}=k.getInternalError("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(l)}let{relay:n,controller:i,namespaces:s,expiry:o}=r;if(!k.isValidRelay(n)){let{message:l}=k.getInternalError("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(l)}let a=k.isValidController(i,"onSessionSettleRequest()");if(a)throw new Error(a.message);let u=k.isValidNamespaces(s,"onSessionSettleRequest()");if(u)throw new Error(u.message);if(k.isExpired(o)){let{message:l}=k.getInternalError("EXPIRED","onSessionSettleRequest()");throw new Error(l)}},this.isValidUpdate=async r=>{if(!k.isValidParams(r)){let{message:u}=k.getInternalError("MISSING_OR_INVALID",`update() params: ${r}`);throw new Error(u)}let{topic:n,namespaces:i}=r;await this.isValidSessionTopic(n);let s=this.client.session.get(n),o=k.isValidNamespaces(i,"update()");if(o)throw new Error(o.message);let a=k.isConformingNamespaces(s.requiredNamespaces,i,"update()");if(a)throw new Error(a.message)},this.isValidExtend=async r=>{if(!k.isValidParams(r)){let{message:i}=k.getInternalError("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionTopic(n)},this.isValidRequest=async r=>{if(!k.isValidParams(r)){let{message:u}=k.getInternalError("MISSING_OR_INVALID",`request() params: ${r}`);throw new Error(u)}let{topic:n,request:i,chainId:s,expiry:o}=r;await this.isValidSessionTopic(n);let{namespaces:a}=this.client.session.get(n);if(!k.isValidNamespacesChainId(a,s)){let{message:u}=k.getInternalError("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(u)}if(!k.isValidRequest(i)){let{message:u}=k.getInternalError("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(u)}if(!k.isValidNamespacesRequest(a,s,i.method)){let{message:u}=k.getInternalError("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(u)}if(o&&!k.isValidRequestExpiry(o,Cg)){let{message:u}=k.getInternalError("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${Cg.min} and ${Cg.max}`);throw new Error(u)}},this.isValidRespond=async r=>{if(!k.isValidParams(r)){let{message:s}=k.getInternalError("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(s)}let{topic:n,response:i}=r;if(await this.isValidSessionTopic(n),!k.isValidResponse(i)){let{message:s}=k.getInternalError("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidPing=async r=>{if(!k.isValidParams(r)){let{message:i}=k.getInternalError("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async r=>{if(!k.isValidParams(r)){let{message:a}=k.getInternalError("MISSING_OR_INVALID",`emit() params: ${r}`);throw new Error(a)}let{topic:n,event:i,chainId:s}=r;await this.isValidSessionTopic(n);let{namespaces:o}=this.client.session.get(n);if(!k.isValidNamespacesChainId(o,s)){let{message:a}=k.getInternalError("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(a)}if(!k.isValidEvent(i)){let{message:a}=k.getInternalError("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}if(!k.isValidNamespacesEvent(o,s,i.name)){let{message:a}=k.getInternalError("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}},this.isValidDisconnect=async r=>{if(!k.isValidParams(r)){let{message:i}=k.getInternalError("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.validateSessionProps=(r,n)=>{Object.values(r).forEach(i=>{if(!k.isValidString(i,!1)){let{message:s}=k.getInternalError("MISSING_OR_INVALID",`${n} must be in Record format. Received: ${JSON.stringify(i)}`);throw new Error(s)}})}}isInitialized(){if(!this.initialized){let{message:e}=k.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.client.core.relayer.on(Zi.RELAYER_EVENTS.message,async e=>{let{topic:r,message:n}=e;if(this.ignoredPayloadTypes.includes(this.client.core.crypto.getPayloadType(n)))return;let i=await this.client.core.crypto.decode(r,n);St.isJsonRpcRequest(i)?(this.client.core.history.set(r,i),this.onRelayEventRequest({topic:r,payload:i})):St.isJsonRpcResponse(i)&&(await this.client.core.history.resolve(i),this.onRelayEventResponse({topic:r,payload:i}))})}registerExpirerEvents(){this.client.core.expirer.on(Zi.EXPIRER_EVENTS.expired,async e=>{let{topic:r,id:n}=k.parseExpirerTarget(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,k.getInternalError("EXPIRED"),!0);r?this.client.session.keys.includes(r)&&(await this.deleteSession(r,!0),this.client.events.emit("session_expire",{topic:r})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}isValidPairingTopic(e){if(!k.isValidString(e,!1)){let{message:r}=k.getInternalError("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(r)}if(!this.client.core.pairing.pairings.keys.includes(e)){let{message:r}=k.getInternalError("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(k.isExpired(this.client.core.pairing.pairings.get(e).expiry)){let{message:r}=k.getInternalError("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!k.isValidString(e,!1)){let{message:r}=k.getInternalError("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(r)}if(!this.client.session.keys.includes(e)){let{message:r}=k.getInternalError("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(k.isExpired(this.client.session.get(e).expiry)){await this.deleteSession(e);let{message:r}=k.getInternalError("EXPIRED",`session topic: ${e}`);throw new Error(r)}}async isValidSessionOrPairingTopic(e){if(this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(k.isValidString(e,!1)){let{message:r}=k.getInternalError("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{let{message:r}=k.getInternalError("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!k.isValidId(e)){let{message:r}=k.getInternalError("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(r)}if(!this.client.proposal.keys.includes(e)){let{message:r}=k.getInternalError("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(k.isExpired(this.client.proposal.get(e).expiry)){await this.deleteProposal(e);let{message:r}=k.getInternalError("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}},qA=class extends Zi.Store{constructor(e,r){super(e,r,C8,Tg),this.core=e,this.logger=r}},VA=class extends Zi.Store{constructor(e,r){super(e,r,x8,Tg),this.core=e,this.logger=r}},jA=class extends Zi.Store{constructor(e,r){super(e,r,O8,Tg,n=>n.id),this.core=e,this.logger=r}},zu=class extends _8.ISignClient{constructor(e){super(e),this.protocol=HA,this.version=GA,this.name=Sg.name,this.events=new I8.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||Sg.name,this.metadata=e?.metadata||k.getAppMetadata();let r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:zY.default(FA.getDefaultLoggerOptions({level:e?.logger||Sg.logger}));this.core=e?.core||new Zi.Core(e),this.logger=FA.generateChildLogger(r,this.name),this.session=new VA(this.core,this.logger),this.proposal=new qA(this.core,this.logger),this.pendingRequest=new jA(this.core,this.logger),this.engine=new UA(this)}static async init(e){let r=new zu(e);return await r.initialize(),r}get context(){return FA.getLoggerContext(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success")}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}},sJ=zu;it.ENGINE_CONTEXT=N8,it.ENGINE_RPC_OPTS=ku,it.HISTORY_CONTEXT=JY,it.HISTORY_EVENTS=YY,it.HISTORY_STORAGE_VERSION=XY,it.PROPOSAL_CONTEXT=C8,it.PROPOSAL_EXPIRY=ZY,it.PROPOSAL_EXPIRY_MESSAGE=T8,it.REQUEST_CONTEXT=O8,it.SESSION_CONTEXT=x8,it.SESSION_EXPIRY=$l,it.SESSION_REQUEST_EXPIRY_BOUNDARIES=Cg,it.SIGN_CLIENT_CONTEXT=QA,it.SIGN_CLIENT_DEFAULT=Sg,it.SIGN_CLIENT_EVENTS=KY,it.SIGN_CLIENT_PROTOCOL=HA,it.SIGN_CLIENT_STORAGE_OPTIONS=$Y,it.SIGN_CLIENT_STORAGE_PREFIX=Tg,it.SIGN_CLIENT_VERSION=GA,it.SignClient=sJ,it.default=zu});var kA=w(Yl=>{"use strict";c();Object.defineProperty(Yl,"__esModule",{value:!0});Yl.Operation=void 0;var oJ;(function(t){t.SIGN_TRANSACTION="mvx_signTransaction",t.SIGN_TRANSACTIONS="mvx_signTransactions",t.SIGN_MESSAGE="mvx_signMessage",t.SIGN_LOGIN_TOKEN="mvx_signLoginToken"})(oJ=Yl.Operation||(Yl.Operation={}))});var P8=w(es=>{"use strict";c();Object.defineProperty(es,"__esModule",{value:!0});es.WALLETCONNECT_MULTIVERSX_METHODS=es.WALLETCONNECT_MULTIVERSX_NAMESPACE=es.WALLETCONNECT_MULTIVERSX_CHAIN_ID=void 0;var aJ=kA();es.WALLETCONNECT_MULTIVERSX_CHAIN_ID=508;es.WALLETCONNECT_MULTIVERSX_NAMESPACE="mvx";es.WALLETCONNECT_MULTIVERSX_METHODS=Object.values(aJ.Operation)});var R8=w(xg=>{"use strict";c();Object.defineProperty(xg,"__esModule",{value:!0});xg.Logger=void 0;var zA=class{static error(e){console.error(e)}static trace(e){console.trace(e)}};xg.Logger=zA});var B8=w(Wu=>{"use strict";c();Object.defineProperty(Wu,"__esModule",{value:!0});Wu.Signature=Wu.Address=void 0;var WA=class{constructor(e){this.value=e}bech32(){return this.value}};Wu.Address=WA;var Jl=class{constructor(e){this.buffer=e}static fromHex(e){return new Jl(h.Buffer.from(e,"hex"))}hex(){return this.buffer.toString("hex")}};Wu.Signature=Jl});var YA=w(zr=>{"use strict";c();Object.defineProperty(zr,"__esModule",{value:!0});zr.WalletConnectV2ProviderErrorMessagesEnum=zr.ErrBadAddress=zr.ErrNotImplemented=zr.Err=void 0;var Xl=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};zr.Err=Xl;var KA=class extends Xl{constructor(){super("Method not yet implemented")}};zr.ErrNotImplemented=KA;var $A=class extends Xl{constructor(e,r){super(`Bad address: ${e}`,r)}};zr.ErrBadAddress=$A;var uJ;(function(t){t.unableToInit="WalletConnect is unable to init",t.notInitialized="WalletConnect is not initialized",t.unableToConnect="WalletConnect is unable to connect",t.unableToConnectExisting="WalletConnect is unable to connect to existing pairing",t.unableToSignLoginToken="WalletConnect could not sign login token",t.unableToLogin="WalletConnect is unable to login",t.unableToHandleTopic="WalletConnect: Unable to handle topic update",t.unableToHandleEvent="WalletConnect: Unable to handle events",t.unableToHandleCleanup="WalletConnect: Unable to handle cleanup",t.sessionNotConnected="WalletConnect Session is not connected",t.sessionDeleted="WalletConnect Session Deleted",t.sessionExpired="WalletConnect Session Expired",t.alreadyLoggedOut="WalletConnect: Already logged out",t.pingFailed="WalletConnect Ping Failed",t.invalidAddress="WalletConnect: Invalid address",t.requestDifferentChain="WalletConnect: Request Chain Id different than Connection Chain Id",t.invalidMessageResponse="WalletConnect could not sign the message",t.invalidMessageSignature="WalletConnect: Invalid message signature",t.invalidTransactionResponse="WalletConnect could not sign the transactions. Invalid signatures",t.invalidCustomRequestResponse="WalletConnect could not send the custom request",t.transactionError="Transaction canceled",t.connectionError="WalletConnect could not establish a connection"})(uJ=zr.WalletConnectV2ProviderErrorMessagesEnum||(zr.WalletConnectV2ProviderErrorMessagesEnum={}))});var F8=w(xn=>{"use strict";c();var cJ=xn&&xn.__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]}),lJ=xn&&xn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fJ=xn&&xn.__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)&&cJ(e,t,r);return lJ(e,t),e};Object.defineProperty(xn,"__esModule",{value:!0});xn.UserAddress=void 0;var hJ=fJ(Qf()),L8=YA(),dJ="erd",Zl=class{constructor(e){this.value=e}static fromBech32(e){let r;try{r=hJ.decode(e)}catch(n){throw new L8.ErrBadAddress(e,n)}if(r.prefix!=dJ)throw new L8.ErrBadAddress(e);return new Zl(e)}bech32(){return this.value}};xn.UserAddress=Zl});var tf=w(Nn=>{"use strict";c();var gt=Nn&&Nn.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})},pJ=Nn&&Nn.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Nn,"__esModule",{value:!0});Nn.WalletConnectV2Provider=Nn.WalletConnectV2ProviderErrorMessagesEnum=void 0;var gJ=pJ(D8()),JA=Vp(),Io=P8(),Ng=kA(),Be=R8(),ef=B8(),he=YA();Object.defineProperty(Nn,"WalletConnectV2ProviderErrorMessagesEnum",{enumerable:!0,get:function(){return he.WalletConnectV2ProviderErrorMessagesEnum}});var Og=F8(),XA=class{constructor(e,r,n,i,s){this.chainId="",this.address="",this.signature="",this.namespace=Io.WALLETCONNECT_MULTIVERSX_NAMESPACE,this.isInitializing=!1,this.events=[],this.methods=[],this.processingTopic="",this.options={},this.onClientConnect=e,this.chainId=r,this.walletConnectV2Relay=n,this.walletConnectV2ProjectId=i,this.options=s}reset(){this.address="",this.signature="",this.namespace=Io.WALLETCONNECT_MULTIVERSX_NAMESPACE,this.session=void 0}init(){return gt(this,void 0,void 0,function*(){if(this.isInitialized())return this.isInitialized();try{if(!this.isInitializing){this.isInitializing=!0,this.reset();let e=yield gJ.default.init(Object.assign({relayUrl:this.walletConnectV2Relay,projectId:this.walletConnectV2ProjectId},this.options));this.walletConnector=e,this.isInitializing=!1,yield this.subscribeToEvents(e),yield this.checkPersistedState(e)}}catch{throw new Error(he.WalletConnectV2ProviderErrorMessagesEnum.unableToInit)}finally{return this.isInitializing=!1,this.isInitialized()}})}isInitialized(){return!!this.walletConnector&&!this.isInitializing}isConnected(){return new Promise((e,r)=>e(!!(this.isInitialized()&&typeof this.session<"u")))}connect(e){var r,n,i,s;return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let o=this.getConnectionParams(e);try{let a=yield this.walletConnector.connect(Object.assign({pairingTopic:e?.topic},o));return this.events=(n=(r=o?.requiredNamespaces)===null||r===void 0?void 0:r[Io.WALLETCONNECT_MULTIVERSX_NAMESPACE])===null||n===void 0?void 0:n.events,this.methods=(s=(i=o?.requiredNamespaces)===null||i===void 0?void 0:i[Io.WALLETCONNECT_MULTIVERSX_NAMESPACE])===null||s===void 0?void 0:s.methods,a}catch{throw this.reset(),Be.Logger.error(e?.topic?he.WalletConnectV2ProviderErrorMessagesEnum.unableToConnectExisting:he.WalletConnectV2ProviderErrorMessagesEnum.unableToConnect),new Error(e?.topic?he.WalletConnectV2ProviderErrorMessagesEnum.unableToConnectExisting:he.WalletConnectV2ProviderErrorMessagesEnum.unableToConnect)}})}login(e){var r;return gt(this,void 0,void 0,function*(){if(this.isInitializing=!0,typeof this.walletConnector>"u"&&(yield this.connect()),typeof this.walletConnector>"u")throw new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);typeof this.session<"u"&&(yield this.logout({topic:(r=this.session)===null||r===void 0?void 0:r.topic}));try{if(e&&e.approval){let n=yield e.approval();if(e.token){let i=this.getAddressFromSession(n),{signature:s}=yield this.walletConnector.request({chainId:`${this.namespace}:${this.chainId}`,topic:n.topic,request:{method:Ng.Operation.SIGN_LOGIN_TOKEN,params:{token:e.token,address:i}}});if(!s)throw Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.unableToSignLoginToken),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.unableToSignLoginToken);return yield this.onSessionConnected({session:n,signature:s})}return yield this.onSessionConnected({session:n,signature:""})}}catch{throw this.reset(),Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.unableToLogin),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.unableToLogin)}finally{this.isInitializing=!1}return""})}logout(e){return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);try{if(this.processingTopic===(e?.topic||this.getCurrentTopic(this.walletConnector)))return!0;if(e?.topic)this.processingTopic=e.topic,yield this.walletConnector.disconnect({topic:e.topic,reason:JA.getSdkError("USER_DISCONNECTED")});else{let r=this.getCurrentTopic(this.walletConnector);this.processingTopic=r,yield this.walletConnector.disconnect({topic:r,reason:JA.getSdkError("USER_DISCONNECTED")}),this.reset(),yield this.cleanupPendingPairings({deletePairings:!0})}}catch{Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.alreadyLoggedOut)}finally{this.processingTopic=""}return!0})}getAddress(){return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return this.address})}getSignature(){return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return this.signature})}getPairings(){var e,r,n,i,s;return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return(s=(i=(n=(r=(e=this.walletConnector)===null||e===void 0?void 0:e.core)===null||r===void 0?void 0:r.pairing)===null||n===void 0?void 0:n.pairings)===null||i===void 0?void 0:i.getAll({active:!0}))!==null&&s!==void 0?s:[]})}signMessage(e){return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let r=yield this.getAddress(),{signature:n}=yield this.walletConnector.request({chainId:`${this.namespace}:${this.chainId}`,topic:this.getCurrentTopic(this.walletConnector),request:{method:Ng.Operation.SIGN_MESSAGE,params:{address:r,message:e.message.toString()}}});if(!n)throw Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageResponse),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageResponse);try{e.applySignature(new ef.Signature(n),Og.UserAddress.fromBech32(r))}catch{throw Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageSignature),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageSignature)}return e})}signTransaction(e){return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let r=yield this.getAddress(),n=new ef.Address(r),i=e.toPlainObject(n);if(this.chainId!==e.getChainID().valueOf())throw Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);try{let{signature:s}=yield this.walletConnector.request({chainId:`${this.namespace}:${this.chainId}`,topic:this.getCurrentTopic(this.walletConnector),request:{method:Ng.Operation.SIGN_TRANSACTION,params:{transaction:i}}});if(!s)throw Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);return e.applySignature(ef.Signature.fromHex(s),Og.UserAddress.fromBech32(r)),e}catch{throw new Error(he.WalletConnectV2ProviderErrorMessagesEnum.transactionError)}})}signTransactions(e){return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let r=yield this.getAddress(),n=new ef.Address(r),i=e.map(s=>{if(this.chainId!==s.getChainID().valueOf())throw Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);return s.toPlainObject(n)});try{let{signatures:s}=yield this.walletConnector.request({chainId:`${this.namespace}:${this.chainId}`,topic:this.getCurrentTopic(this.walletConnector),request:{method:Ng.Operation.SIGN_TRANSACTIONS,params:{transactions:i}}});(!s||!Array.isArray(s))&&Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse),e.length!==s.length&&Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse);for(let[o,a]of e.entries())a.applySignature(ef.Signature.fromHex(s[o].signature),Og.UserAddress.fromBech32(r));return e}catch{throw new Error(he.WalletConnectV2ProviderErrorMessagesEnum.transactionError)}})}sendCustomRequest(e){var r;return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);if(!((r=e?.request)===null||r===void 0)&&r.method){let n=Object.assign({},e.request),{method:i}=n,{response:s}=yield this.walletConnector.request({chainId:`${this.namespace}:${this.chainId}`,topic:this.getCurrentTopic(this.walletConnector),request:Object.assign(Object.assign({},n),{method:i})});if(!s)throw Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.invalidCustomRequestResponse),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.invalidCustomRequestResponse);return s}})}ping(){return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);typeof this.session>"u"&&Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);try{let e=this.getCurrentTopic(this.walletConnector);return yield this.walletConnector.ping({topic:e}),!0}catch{return Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.pingFailed),!1}})}loginAccount(e){return gt(this,void 0,void 0,function*(){return e?this.addressIsValid(e.address)?(this.address=e.address,e.signature&&(this.signature=e.signature),this.onClientConnect.onClientLogin(),this.address):(Be.Logger.error(`${he.WalletConnectV2ProviderErrorMessagesEnum.invalidAddress} ${e.address}`),this.walletConnector&&(yield this.logout()),""):""})}onSessionConnected(e){return gt(this,void 0,void 0,function*(){if(!e)return"";this.session=e.session;let r=this.getAddressFromSession(e.session);return r?(yield this.loginAccount({address:r,signature:e.signature}),r):""})}handleTopicUpdateEvent({topic:e}){return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);try{let r=yield this.getPairings();if(this.address&&!this.isInitializing&&r)if(r?.length===0)this.onClientConnect.onClientLogout();else{let n=r[r.length-1];n?.topic===e&&this.onClientConnect.onClientLogout()}}catch{Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleTopic)}finally{this.pairings=yield this.getPairings()}})}handleSessionEvents({topic:e,params:r}){var n;return gt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(this.session&&((n=this.session)===null||n===void 0?void 0:n.topic)!==e)return;let{event:i}=r;if(i?.name&&this.getCurrentTopic(this.walletConnector)===e){let s=i.data;this.onClientConnect.onClientEvent(s)}})}subscribeToEvents(e){var r,n,i,s;return gt(this,void 0,void 0,function*(){if(typeof e>"u")throw new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);try{e.on("session_update",({topic:o,params:a})=>{var u;if(!this.session||((u=this.session)===null||u===void 0?void 0:u.topic)!==o)return;let{namespaces:l}=a,f=e.session.get(o),d=Object.assign(Object.assign({},f),{namespaces:l});this.onSessionConnected({session:d})}),e.on("session_event",this.handleSessionEvents.bind(this)),e.on("session_delete",({topic:o})=>gt(this,void 0,void 0,function*(){var a;!this.session||((a=this.session)===null||a===void 0?void 0:a.topic)!==o||(Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.sessionDeleted),this.onClientConnect.onClientLogout(),this.reset(),yield this.cleanupPendingPairings({deletePairings:!0}))})),e.on("session_expire",({topic:o})=>gt(this,void 0,void 0,function*(){var a;!this.session||((a=this.session)===null||a===void 0?void 0:a.topic)!==o||(Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.sessionExpired),this.onClientConnect.onClientLogout(),this.reset(),yield this.cleanupPendingPairings({deletePairings:!0}))})),(n=(r=e.core)===null||r===void 0?void 0:r.pairing)===null||n===void 0||n.events.on("pairing_delete",this.handleTopicUpdateEvent.bind(this)),(s=(i=e.core)===null||i===void 0?void 0:i.pairing)===null||s===void 0||s.events.on("pairing_expire",this.handleTopicUpdateEvent.bind(this))}catch{Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleEvent)}})}checkPersistedState(e){return gt(this,void 0,void 0,function*(){if(typeof e>"u")throw new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(this.pairings=yield this.getPairings(),!(typeof this.session<"u")&&e.session.length&&!this.address&&!this.isInitializing){let r=this.getCurrentSession(e);if(r)return yield this.onSessionConnected({session:r}),r}})}cleanupPendingPairings(e={}){var r,n,i,s,o,a,u,l;return gt(this,void 0,void 0,function*(){if(!(typeof this.walletConnector>"u"))try{let f=(i=(n=(r=this.walletConnector.core)===null||r===void 0?void 0:r.pairing)===null||n===void 0?void 0:n.pairings)===null||i===void 0?void 0:i.getAll({active:!1});if(!JA.isValidArray(f))return;for(let d of f)e.deletePairings?(o=(s=this.walletConnector.core)===null||s===void 0?void 0:s.expirer)===null||o===void 0||o.set(d.topic,0):yield(l=(u=(a=this.walletConnector.core)===null||a===void 0?void 0:a.relayer)===null||u===void 0?void 0:u.subscriber)===null||l===void 0?void 0:l.unsubscribe(d.topic)}catch{Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleCleanup)}})}getCurrentSession(e){if(typeof e>"u")throw new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=e.find(this.getConnectionParams()).filter(n=>n.acknowledged);if(r.length>0){let n=r.length-1;return r[n]}else if(e.session.length>0){let n=e.session.keys.length-1;return e.session.get(e.session.keys[n])}else throw Be.Logger.error(he.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),new Error(he.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected)}getCurrentTopic(e){if(typeof e>"u")throw new Error(he.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=this.getCurrentSession(e);if(r?.topic)return r.topic;throw new Error(he.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected)}getConnectionParams(e){var r,n;let i=[...Io.WALLETCONNECT_MULTIVERSX_METHODS,...(r=e?.methods)!==null&&r!==void 0?r:[]],s=[`${Io.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`],o=(n=e?.events)!==null&&n!==void 0?n:[];return{requiredNamespaces:{[Io.WALLETCONNECT_MULTIVERSX_NAMESPACE]:{methods:i,chains:s,events:o}}}}addressIsValid(e){try{return!!Og.UserAddress.fromBech32(e)}catch{return!1}}getAddressFromSession(e){let r=e.namespaces[this.namespace];if(r&&r.accounts){let n=r.accounts[0],[i,s,o]=n.split(":");return o}return""}};Nn.WalletConnectV2Provider=XA});var U8=w((fde,M8)=>{"use strict";c();M8.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 j8=w((dde,V8)=>{"use strict";c();var q8=typeof Symbol<"u"&&Symbol,yJ=U8();V8.exports=function(){return typeof q8!="function"||typeof Symbol!="function"||typeof q8("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:yJ()}});var G8=w((gde,H8)=>{"use strict";c();var mJ="Function.prototype.bind called on incompatible ",ZA=Array.prototype.slice,wJ=Object.prototype.toString,EJ="[object Function]";H8.exports=function(e){var r=this;if(typeof r!="function"||wJ.call(r)!==EJ)throw new TypeError(mJ+r);for(var n=ZA.call(arguments,1),i,s=function(){if(this instanceof i){var f=r.apply(this,n.concat(ZA.call(arguments)));return Object(f)===f?f:this}else return r.apply(e,n.concat(ZA.call(arguments)))},o=Math.max(0,r.length-n.length),a=[],u=0;u{"use strict";c();var vJ=G8();Q8.exports=Function.prototype.bind||vJ});var z8=w((Ede,k8)=>{"use strict";c();var AJ=Dg();k8.exports=AJ.call(Function.call,Object.prototype.hasOwnProperty)});var Bg=w((Ade,J8)=>{"use strict";c();var De,Ju=SyntaxError,Y8=Function,Yu=TypeError,eb=function(t){try{return Y8('"use strict"; return ('+t+").constructor;")()}catch{}},So=Object.getOwnPropertyDescriptor;if(So)try{So({},"")}catch{So=null}var tb=function(){throw new Yu},bJ=So?function(){try{return arguments.callee,tb}catch{try{return So(arguments,"callee").get}catch{return tb}}}():tb,Ku=j8()(),On=Object.getPrototypeOf||function(t){return t.__proto__},$u={},_J=typeof Uint8Array>"u"?De:On(Uint8Array),Co={"%AggregateError%":typeof AggregateError>"u"?De:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?De:ArrayBuffer,"%ArrayIteratorPrototype%":Ku?On([][Symbol.iterator]()):De,"%AsyncFromSyncIteratorPrototype%":De,"%AsyncFunction%":$u,"%AsyncGenerator%":$u,"%AsyncGeneratorFunction%":$u,"%AsyncIteratorPrototype%":$u,"%Atomics%":typeof Atomics>"u"?De:Atomics,"%BigInt%":typeof BigInt>"u"?De:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?De:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?De:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?De:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?De:Float32Array,"%Float64Array%":typeof Float64Array>"u"?De:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?De:FinalizationRegistry,"%Function%":Y8,"%GeneratorFunction%":$u,"%Int8Array%":typeof Int8Array>"u"?De:Int8Array,"%Int16Array%":typeof Int16Array>"u"?De:Int16Array,"%Int32Array%":typeof Int32Array>"u"?De:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Ku?On(On([][Symbol.iterator]())):De,"%JSON%":typeof JSON=="object"?JSON:De,"%Map%":typeof Map>"u"?De:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Ku?De:On(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?De:Promise,"%Proxy%":typeof Proxy>"u"?De:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?De:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?De:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Ku?De:On(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?De:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Ku?On(""[Symbol.iterator]()):De,"%Symbol%":Ku?Symbol:De,"%SyntaxError%":Ju,"%ThrowTypeError%":bJ,"%TypedArray%":_J,"%TypeError%":Yu,"%Uint8Array%":typeof Uint8Array>"u"?De:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?De:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?De:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?De:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?De:WeakMap,"%WeakRef%":typeof WeakRef>"u"?De:WeakRef,"%WeakSet%":typeof WeakSet>"u"?De:WeakSet};try{null.error}catch(t){W8=On(On(t)),Co["%Error.prototype%"]=W8}var W8,IJ=function t(e){var r;if(e==="%AsyncFunction%")r=eb("async function () {}");else if(e==="%GeneratorFunction%")r=eb("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=eb("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=t("%AsyncGenerator%");i&&(r=On(i.prototype))}return Co[e]=r,r},K8={"%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"]},rf=Dg(),Pg=z8(),SJ=rf.call(Function.call,Array.prototype.concat),CJ=rf.call(Function.apply,Array.prototype.splice),$8=rf.call(Function.call,String.prototype.replace),Rg=rf.call(Function.call,String.prototype.slice),TJ=rf.call(Function.call,RegExp.prototype.exec),xJ=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,NJ=/\\(\\)?/g,OJ=function(e){var r=Rg(e,0,1),n=Rg(e,-1);if(r==="%"&&n!=="%")throw new Ju("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new Ju("invalid intrinsic syntax, expected opening `%`");var i=[];return $8(e,xJ,function(s,o,a,u){i[i.length]=a?$8(u,NJ,"$1"):o||s}),i},DJ=function(e,r){var n=e,i;if(Pg(K8,n)&&(i=K8[n],n="%"+i[0]+"%"),Pg(Co,n)){var s=Co[n];if(s===$u&&(s=IJ(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 Ju("intrinsic "+e+" does not exist!")};J8.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(TJ(/^%?[^%]*%?$/,e)===null)throw new Ju("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=OJ(e),i=n.length>0?n[0]:"",s=DJ("%"+i+"%",r),o=s.name,a=s.value,u=!1,l=s.alias;l&&(i=l[0],CJ(n,SJ([0,1],l)));for(var f=1,d=!0;f=n.length){var T=So(a,y);d=!!T,d&&"get"in T&&!("originalValue"in T.get)?a=T.get:a=a[y]}else d=Pg(a,y),a=a[y];d&&!u&&(Co[o]=a)}}return a}});var nR=w((_de,Lg)=>{"use strict";c();var rb=Dg(),Xu=Bg(),eR=Xu("%Function.prototype.apply%"),tR=Xu("%Function.prototype.call%"),rR=Xu("%Reflect.apply%",!0)||rb.call(tR,eR),X8=Xu("%Object.getOwnPropertyDescriptor%",!0),To=Xu("%Object.defineProperty%",!0),PJ=Xu("%Math.max%");if(To)try{To({},"a",{value:1})}catch{To=null}Lg.exports=function(e){var r=rR(rb,tR,arguments);if(X8&&To){var n=X8(r,"length");n.configurable&&To(r,"length",{value:1+PJ(0,e.length-(arguments.length-1))})}return r};var Z8=function(){return rR(rb,eR,arguments)};To?To(Lg.exports,"apply",{value:Z8}):Lg.exports.apply=Z8});var aR=w((Sde,oR)=>{"use strict";c();var iR=Bg(),sR=nR(),RJ=sR(iR("String.prototype.indexOf"));oR.exports=function(e,r){var n=iR(e,!!r);return typeof n=="function"&&RJ(e,".prototype.")>-1?sR(n):n}});var uR=w(()=>{c()});var xR=w((Ode,TR)=>{c();var hb=typeof Map=="function"&&Map.prototype,nb=Object.getOwnPropertyDescriptor&&hb?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Mg=hb&&nb&&typeof nb.get=="function"?nb.get:null,cR=hb&&Map.prototype.forEach,db=typeof Set=="function"&&Set.prototype,ib=Object.getOwnPropertyDescriptor&&db?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Ug=db&&ib&&typeof ib.get=="function"?ib.get:null,lR=db&&Set.prototype.forEach,BJ=typeof WeakMap=="function"&&WeakMap.prototype,sf=BJ?WeakMap.prototype.has:null,LJ=typeof WeakSet=="function"&&WeakSet.prototype,of=LJ?WeakSet.prototype.has:null,FJ=typeof WeakRef=="function"&&WeakRef.prototype,fR=FJ?WeakRef.prototype.deref:null,MJ=Boolean.prototype.valueOf,UJ=Object.prototype.toString,qJ=Function.prototype.toString,VJ=String.prototype.match,pb=String.prototype.slice,rs=String.prototype.replace,jJ=String.prototype.toUpperCase,hR=String.prototype.toLowerCase,AR=RegExp.prototype.test,dR=Array.prototype.concat,Dn=Array.prototype.join,HJ=Array.prototype.slice,pR=Math.floor,ab=typeof BigInt=="function"?BigInt.prototype.valueOf:null,sb=Object.getOwnPropertySymbols,ub=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Zu=typeof Symbol=="function"&&typeof Symbol.iterator=="object",$t=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Zu||"symbol")?Symbol.toStringTag:null,bR=Object.prototype.propertyIsEnumerable,gR=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function yR(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||AR.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var n=t<0?-pR(-t):pR(t);if(n!==t){var i=String(n),s=pb.call(e,i.length+1);return rs.call(i,r,"$&_")+"."+rs.call(rs.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return rs.call(e,r,"$&_")}var cb=uR(),mR=cb.custom,wR=IR(mR)?mR:null;TR.exports=function t(e,r,n,i){var s=r||{};if(ts(s,"quoteStyle")&&s.quoteStyle!=="single"&&s.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(ts(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=ts(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(ts(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(ts(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 CR(e,s);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var u=String(e);return a?yR(e,u):u}if(typeof e=="bigint"){var l=String(e)+"n";return a?yR(e,l):l}var f=typeof s.depth>"u"?5:s.depth;if(typeof n>"u"&&(n=0),n>=f&&f>0&&typeof e=="object")return lb(e)?"[Array]":"[Object]";var d=oX(s,n);if(typeof i>"u")i=[];else if(SR(i,e)>=0)return"[Circular]";function y(G,$,de){if($&&(i=HJ.call(i),i.push($)),de){var ae={depth:s.depth};return ts(s,"quoteStyle")&&(ae.quoteStyle=s.quoteStyle),t(G,ae,n+1,i)}return t(G,s,n+1,i)}if(typeof e=="function"&&!ER(e)){var m=JJ(e),v=Fg(e,y);return"[Function"+(m?": "+m:" (anonymous)")+"]"+(v.length>0?" { "+Dn.call(v,", ")+" }":"")}if(IR(e)){var T=Zu?rs.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):ub.call(e);return typeof e=="object"&&!Zu?nf(T):T}if(nX(e)){for(var B="<"+hR.call(String(e.nodeName)),A=e.attributes||[],D=0;D",B}if(lb(e)){if(e.length===0)return"[]";var x=Fg(e,y);return d&&!sX(x)?"["+fb(x,d)+"]":"[ "+Dn.call(x,", ")+" ]"}if(kJ(e)){var R=Fg(e,y);return!("cause"in Error.prototype)&&"cause"in e&&!bR.call(e,"cause")?"{ ["+String(e)+"] "+Dn.call(dR.call("[cause]: "+y(e.cause),R),", ")+" }":R.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+Dn.call(R,", ")+" }"}if(typeof e=="object"&&o){if(wR&&typeof e[wR]=="function"&&cb)return cb(e,{depth:f-n});if(o!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(XJ(e)){var P=[];return cR&&cR.call(e,function(G,$){P.push(y($,e,!0)+" => "+y(G,e))}),vR("Map",Mg.call(e),P,d)}if(tX(e)){var L=[];return lR&&lR.call(e,function(G){L.push(y(G,e))}),vR("Set",Ug.call(e),L,d)}if(ZJ(e))return ob("WeakMap");if(rX(e))return ob("WeakSet");if(eX(e))return ob("WeakRef");if(WJ(e))return nf(y(Number(e)));if($J(e))return nf(y(ab.call(e)));if(KJ(e))return nf(MJ.call(e));if(zJ(e))return nf(y(String(e)));if(!QJ(e)&&!ER(e)){var _=Fg(e,y),C=gR?gR(e)===Object.prototype:e instanceof Object||e.constructor===Object,M=e instanceof Object?"":"null prototype",Z=!C&&$t&&Object(e)===e&&$t in e?pb.call(ns(e),8,-1):M?"Object":"",z=C||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",H=z+(Z||M?"["+Dn.call(dR.call([],Z||[],M||[]),": ")+"] ":"");return _.length===0?H+"{}":d?H+"{"+fb(_,d)+"}":H+"{ "+Dn.call(_,", ")+" }"}return String(e)};function _R(t,e,r){var n=(r.quoteStyle||e)==="double"?'"':"'";return n+t+n}function GJ(t){return rs.call(String(t),/"/g,""")}function lb(t){return ns(t)==="[object Array]"&&(!$t||!(typeof t=="object"&&$t in t))}function QJ(t){return ns(t)==="[object Date]"&&(!$t||!(typeof t=="object"&&$t in t))}function ER(t){return ns(t)==="[object RegExp]"&&(!$t||!(typeof t=="object"&&$t in t))}function kJ(t){return ns(t)==="[object Error]"&&(!$t||!(typeof t=="object"&&$t in t))}function zJ(t){return ns(t)==="[object String]"&&(!$t||!(typeof t=="object"&&$t in t))}function WJ(t){return ns(t)==="[object Number]"&&(!$t||!(typeof t=="object"&&$t in t))}function KJ(t){return ns(t)==="[object Boolean]"&&(!$t||!(typeof t=="object"&&$t in t))}function IR(t){if(Zu)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!ub)return!1;try{return ub.call(t),!0}catch{}return!1}function $J(t){if(!t||typeof t!="object"||!ab)return!1;try{return ab.call(t),!0}catch{}return!1}var YJ=Object.prototype.hasOwnProperty||function(t){return t in this};function ts(t,e){return YJ.call(t,e)}function ns(t){return UJ.call(t)}function JJ(t){if(t.name)return t.name;var e=VJ.call(qJ.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function SR(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 CR(pb.call(t,0,e.maxStringLength),e)+n}var i=rs.call(rs.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,iX);return _R(i,"single",e)}function iX(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":"")+jJ.call(e.toString(16))}function nf(t){return"Object("+t+")"}function ob(t){return t+" { ? }"}function vR(t,e,r,n){var i=n?fb(r,n):Dn.call(r,", ");return t+" ("+e+") {"+i+"}"}function sX(t){for(var e=0;e=0)return!1;return!0}function oX(t,e){var r;if(t.indent===" ")r=" ";else if(typeof t.indent=="number"&&t.indent>0)r=Dn.call(Array(t.indent+1)," ");else return null;return{base:r,prev:Dn.call(Array(e+1),r)}}function fb(t,e){if(t.length===0)return"";var r=` -`+e.prev+e.base;return r+Dn.call(t,","+r)+` -`+e.prev}function Fg(t,e){var r=lb(t),n=[];if(r){n.length=t.length;for(var i=0;i{"use strict";c();var gb=Bg(),ec=aR(),aX=xR(),uX=gb("%TypeError%"),qg=gb("%WeakMap%",!0),Vg=gb("%Map%",!0),cX=ec("WeakMap.prototype.get",!0),lX=ec("WeakMap.prototype.set",!0),fX=ec("WeakMap.prototype.has",!0),hX=ec("Map.prototype.get",!0),dX=ec("Map.prototype.set",!0),pX=ec("Map.prototype.has",!0),yb=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},gX=function(t,e){var r=yb(t,e);return r&&r.value},yX=function(t,e,r){var n=yb(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}},mX=function(t,e){return!!yb(t,e)};NR.exports=function(){var e,r,n,i={assert:function(s){if(!i.has(s))throw new uX("Side channel does not contain "+aX(s))},get:function(s){if(qg&&s&&(typeof s=="object"||typeof s=="function")){if(e)return cX(e,s)}else if(Vg){if(r)return hX(r,s)}else if(n)return gX(n,s)},has:function(s){if(qg&&s&&(typeof s=="object"||typeof s=="function")){if(e)return fX(e,s)}else if(Vg){if(r)return pX(r,s)}else if(n)return mX(n,s);return!1},set:function(s,o){qg&&s&&(typeof s=="object"||typeof s=="function")?(e||(e=new qg),lX(e,s,o)):Vg?(r||(r=new Vg),dX(r,s,o)):(n||(n={key:{},next:null}),yX(n,s,o))}};return i}});var jg=w((Bde,DR)=>{"use strict";c();var wX=String.prototype.replace,EX=/%20/g,mb={RFC1738:"RFC1738",RFC3986:"RFC3986"};DR.exports={default:mb.RFC3986,formatters:{RFC1738:function(t){return wX.call(t,EX,"+")},RFC3986:function(t){return String(t)}},RFC1738:mb.RFC1738,RFC3986:mb.RFC3986}});var Eb=w((Fde,RR)=>{"use strict";c();var vX=jg(),wb=Object.prototype.hasOwnProperty,xo=Array.isArray,Pn=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),AX=function(e){for(;e.length>1;){var r=e.pop(),n=r.obj[r.prop];if(xo(n)){for(var i=[],s=0;s=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122||s===vX.RFC1738&&(l===40||l===41)){a+=o.charAt(u);continue}if(l<128){a=a+Pn[l];continue}if(l<2048){a=a+(Pn[192|l>>6]+Pn[128|l&63]);continue}if(l<55296||l>=57344){a=a+(Pn[224|l>>12]+Pn[128|l>>6&63]+Pn[128|l&63]);continue}u+=1,l=65536+((l&1023)<<10|o.charCodeAt(u)&1023),a+=Pn[240|l>>18]+Pn[128|l>>12&63]+Pn[128|l>>6&63]+Pn[128|l&63]}return a},CX=function(e){for(var r=[{obj:{o:e},prop:"o"}],n=[],i=0;i{"use strict";c();var FR=OR(),Ab=Eb(),af=jg(),DX=Object.prototype.hasOwnProperty,BR={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,r){return e+"["+r+"]"},repeat:function(e){return e}},No=Array.isArray,PX=String.prototype.split,RX=Array.prototype.push,MR=function(t,e){RX.apply(t,No(e)?e:[e])},BX=Date.prototype.toISOString,LR=af.default,Vt={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:Ab.encode,encodeValuesOnly:!1,format:LR,formatter:af.formatters[LR],indices:!1,serializeDate:function(e){return BX.call(e)},skipNulls:!1,strictNullHandling:!1},LX=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},vb={},FX=function t(e,r,n,i,s,o,a,u,l,f,d,y,m,v,T){for(var B=e,A=T,D=0,x=!1;(A=A.get(vb))!==void 0&&!x;){var R=A.get(e);if(D+=1,typeof R<"u"){if(R===D)throw new RangeError("Cyclic object value");x=!0}typeof A.get(vb)>"u"&&(D=0)}if(typeof a=="function"?B=a(r,B):B instanceof Date?B=f(B):n==="comma"&&No(B)&&(B=Ab.maybeMap(B,function(re){return re instanceof Date?f(re):re})),B===null){if(i)return o&&!m?o(r,Vt.encoder,v,"key",d):r;B=""}if(LX(B)||Ab.isBuffer(B)){if(o){var P=m?r:o(r,Vt.encoder,v,"key",d);if(n==="comma"&&m){for(var L=PX.call(String(B),","),_="",C=0;C"u")return M;var Z;if(n==="comma"&&No(B))Z=[{value:B.length>0?B.join(",")||null:void 0}];else if(No(a))Z=a;else{var z=Object.keys(B);Z=u?z.sort(u):z}for(var H=0;H"u"?Vt.allowDots:!!e.allowDots,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Vt.charsetSentinel,delimiter:typeof e.delimiter>"u"?Vt.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:Vt.encode,encoder:typeof e.encoder=="function"?e.encoder:Vt.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:Vt.encodeValuesOnly,filter:s,format:n,formatter:i,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:Vt.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:Vt.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Vt.strictNullHandling}};UR.exports=function(t,e){var r=t,n=MX(e),i,s;typeof n.filter=="function"?(s=n.filter,r=s("",r)):No(n.filter)&&(s=n.filter,i=s);var o=[];if(typeof r!="object"||r===null)return"";var a;e&&e.arrayFormat in BR?a=e.arrayFormat:e&&"indices"in e?a=e.indices?"indices":"repeat":a="indices";var u=BR[a];i||(i=Object.keys(r)),n.sort&&i.sort(n.sort);for(var l=FR(),f=0;f0?m+y:""}});var HR=w((Vde,jR)=>{"use strict";c();var tc=Eb(),bb=Object.prototype.hasOwnProperty,UX=Array.isArray,Pt={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:tc.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},qX=function(t){return t.replace(/&#(\d+);/g,function(e,r){return String.fromCharCode(parseInt(r,10))})},VR=function(t,e){return t&&typeof t=="string"&&e.comma&&t.indexOf(",")>-1?t.split(","):t},VX="utf8=%26%2310003%3B",jX="utf8=%E2%9C%93",HX=function(e,r){var n={},i=r.ignoreQueryPrefix?e.replace(/^\?/,""):e,s=r.parameterLimit===1/0?void 0:r.parameterLimit,o=i.split(r.delimiter,s),a=-1,u,l=r.charset;if(r.charsetSentinel)for(u=0;u-1&&(v=UX(v)?[v]:v),bb.call(n,m)?n[m]=tc.combine(n[m],v):n[m]=v}return n},GX=function(t,e,r,n){for(var i=n?e:VR(e,r),s=t.length-1;s>=0;--s){var o,a=t[s];if(a==="[]"&&r.parseArrays)o=[].concat(i);else{o=r.plainObjects?Object.create(null):{};var u=a.charAt(0)==="["&&a.charAt(a.length-1)==="]"?a.slice(1,-1):a,l=parseInt(u,10);!r.parseArrays&&u===""?o={0:i}:!isNaN(l)&&a!==u&&String(l)===u&&l>=0&&r.parseArrays&&l<=r.arrayLimit?(o=[],o[l]=i):u!=="__proto__"&&(o[u]=i)}i=o}return i},QX=function(e,r,n,i){if(e){var s=n.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,o=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,u=n.depth>0&&o.exec(s),l=u?s.slice(0,u.index):s,f=[];if(l){if(!n.plainObjects&&bb.call(Object.prototype,l)&&!n.allowPrototypes)return;f.push(l)}for(var d=0;n.depth>0&&(u=a.exec(s))!==null&&d"u"?Pt.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?Pt.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:Pt.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:Pt.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:Pt.arrayLimit,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Pt.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:Pt.comma,decoder:typeof e.decoder=="function"?e.decoder:Pt.decoder,delimiter:typeof e.delimiter=="string"||tc.isRegExp(e.delimiter)?e.delimiter:Pt.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:Pt.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:Pt.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:Pt.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:Pt.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Pt.strictNullHandling}};jR.exports=function(t,e){var r=kX(e);if(t===""||t===null||typeof t>"u")return r.plainObjects?Object.create(null):{};for(var n=typeof t=="string"?HX(t,r):t,i=r.plainObjects?Object.create(null):{},s=Object.keys(n),o=0;o{"use strict";c();var zX=qR(),WX=HR(),KX=jg();GR.exports={formats:KX,parse:WX,stringify:zX}});var _b=w(rt=>{"use strict";c();Object.defineProperty(rt,"__esModule",{value:!0});rt.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED=rt.WALLET_PROVIDER_CALLBACK_PARAM=rt.WALLET_PROVIDER_SIGN_MESSAGE_URL=rt.WALLET_PROVIDER_GUARD_TRANSACTION_URL=rt.WALLET_PROVIDER_SIGN_TRANSACTION_URL=rt.WALLET_PROVIDER_SEND_TRANSACTION_URL=rt.WALLET_PROVIDER_DISCONNECT_URL=rt.WALLET_PROVIDER_CONNECT_URL=rt.WALLET_PROVIDER_TESTNET=rt.WALLET_PROVIDER_DEVNET=rt.WALLET_PROVIDER_MAINNET=void 0;rt.WALLET_PROVIDER_MAINNET="https://wallet.multiversx.com/dapp/init";rt.WALLET_PROVIDER_DEVNET="https://devnet-wallet.multiversx.com/dapp/init";rt.WALLET_PROVIDER_TESTNET="https://testnet-wallet.multiversx.com/dapp/init";rt.WALLET_PROVIDER_CONNECT_URL="hook/login";rt.WALLET_PROVIDER_DISCONNECT_URL="hook/logout";rt.WALLET_PROVIDER_SEND_TRANSACTION_URL="hook/transaction";rt.WALLET_PROVIDER_SIGN_TRANSACTION_URL="hook/sign";rt.WALLET_PROVIDER_GUARD_TRANSACTION_URL="hook/2fa";rt.WALLET_PROVIDER_SIGN_MESSAGE_URL="hook/sign-message";rt.WALLET_PROVIDER_CALLBACK_PARAM="walletProviderStatus";rt.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED="transactionsSigned"});var kR=w(rc=>{"use strict";c();Object.defineProperty(rc,"__esModule",{value:!0});rc.ErrCannotSignedMessage=rc.ErrCannotGetSignedTransactions=void 0;var Ib=class extends Error{constructor(){super("Cannot get signed transaction(s)")}};rc.ErrCannotGetSignedTransactions=Ib;var Sb=class extends Error{constructor(){super("Cannot get signed message")}};rc.ErrCannotSignedMessage=Sb});var zR=w(Hg=>{"use strict";c();Object.defineProperty(Hg,"__esModule",{value:!0});Hg.PlainSignedTransaction=void 0;var Cb=class{constructor(e){this.nonce=0,this.value="",this.receiver="",this.sender="",this.gasPrice=0,this.gasLimit=0,this.data="",this.chainID="",this.version=0,this.options=void 0,this.signature="",Object.assign(this,e)}};Hg.PlainSignedTransaction=Cb});var uf=w(os=>{"use strict";c();var is=os&&os.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})},$X=os&&os.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(os,"__esModule",{value:!0});os.WalletProvider=void 0;var Tb=$X(QR()),ss=_b(),xb=kR(),YX=zR(),nc=class{constructor(e){this.walletUrl=e}login(e){return is(this,void 0,void 0,function*(){let r=this.buildWalletUrl({endpoint:ss.WALLET_PROVIDER_CONNECT_URL,callbackUrl:e?.callbackUrl,params:{token:e?.token}});return yield this.redirect(r,e?.redirectDelayMilliseconds),r})}redirect(e,r){return is(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 is(this,void 0,void 0,function*(){yield new Promise(n=>{setTimeout(()=>{window.location.href=e,n(!0)},r)})})}logout(e){return is(this,void 0,void 0,function*(){let r=this.buildWalletUrl({endpoint:ss.WALLET_PROVIDER_DISCONNECT_URL,callbackUrl:e?.callbackUrl});return yield this.redirect(r,e?.redirectDelayMilliseconds),!0})}signMessage(e,r){return is(this,void 0,void 0,function*(){let n=this.buildWalletUrl({endpoint:ss.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=Tb.default.parse(n);if((((e=i.status)===null||e===void 0?void 0:e.toString())||"")!=="signed")throw new xb.ErrCannotSignedMessage;return((r=i.signature)===null||r===void 0?void 0:r.toString())||""}guardTransactions(e,r){return is(this,void 0,void 0,function*(){this.redirectTransactionsToEndpoint(ss.WALLET_PROVIDER_GUARD_TRANSACTION_URL,e,r)})}signTransactions(e,r){return is(this,void 0,void 0,function*(){this.redirectTransactionsToEndpoint(ss.WALLET_PROVIDER_SIGN_TRANSACTION_URL,e,r)})}signTransaction(e,r){return is(this,void 0,void 0,function*(){yield this.signTransactions([e],r)})}getTransactionsFromWalletUrl(){let e=Tb.default.parse(window.location.search.slice(1));return nc.isTxSignReturnSuccess(e)?this.getTxSignReturnValue(e):[]}static isTxSignReturnSuccess(e){return e.hasOwnProperty(ss.WALLET_PROVIDER_CALLBACK_PARAM)&&e[ss.WALLET_PROVIDER_CALLBACK_PARAM]===ss.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED}getTxSignReturnValue(e){var r;console.info("getTxSignReturnValue(), urlParams:",e);let n=["nonce","value","receiver","sender","gasPrice","gasLimit","chainID","version","signature"];for(let o of n)if(!e[o]||!Array.isArray(e[o]))throw new xb.ErrCannotGetSignedTransactions;let i=e.nonce.length;for(let o of n)if(e[o].length!==i)throw new xb.ErrCannotGetSignedTransactions;let s=[];for(let o=0;o{let a=nc.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}};os.WalletProvider=nc});var Nb=w((Xde,WR)=>{"use strict";c();WR.exports=function(e,r){return function(){for(var i=new Array(arguments.length),s=0;s{"use strict";c();var JX=Nb(),Db=Object.prototype.toString,Pb=function(t){return function(e){var r=Db.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())}}(Object.create(null));function Oo(t){return t=t.toLowerCase(),function(r){return Pb(r)===t}}function Rb(t){return Array.isArray(t)}function Qg(t){return typeof t>"u"}function XX(t){return t!==null&&!Qg(t)&&t.constructor!==null&&!Qg(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}var KR=Oo("ArrayBuffer");function ZX(t){var e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&KR(t.buffer),e}function eZ(t){return typeof t=="string"}function tZ(t){return typeof t=="number"}function $R(t){return t!==null&&typeof t=="object"}function Gg(t){if(Pb(t)!=="object")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}var rZ=Oo("Date"),nZ=Oo("File"),iZ=Oo("Blob"),sZ=Oo("FileList");function Bb(t){return Db.call(t)==="[object Function]"}function oZ(t){return $R(t)&&Bb(t.pipe)}function aZ(t){var e="[object FormData]";return t&&(typeof FormData=="function"&&t instanceof FormData||Db.call(t)===e||Bb(t.toString)&&t.toString()===e)}var uZ=Oo("URLSearchParams");function cZ(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function lZ(){return typeof navigator<"u"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window<"u"&&typeof document<"u"}function Lb(t,e){if(!(t===null||typeof t>"u"))if(typeof t!="object"&&(t=[t]),Rb(t))for(var r=0,n=t.length;r0;)s=n[i],o[s]||(e[s]=t[s],o[s]=!0);t=Object.getPrototypeOf(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e}function gZ(t,e,r){t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;var n=t.indexOf(e,r);return n!==-1&&n===r}function yZ(t){if(!t)return null;var e=t.length;if(Qg(e))return null;for(var r=new Array(e);e-- >0;)r[e]=t[e];return r}var mZ=function(t){return function(e){return t&&e instanceof t}}(typeof Uint8Array<"u"&&Object.getPrototypeOf(Uint8Array));YR.exports={isArray:Rb,isArrayBuffer:KR,isBuffer:XX,isFormData:aZ,isArrayBufferView:ZX,isString:eZ,isNumber:tZ,isObject:$R,isPlainObject:Gg,isUndefined:Qg,isDate:rZ,isFile:nZ,isBlob:iZ,isFunction:Bb,isStream:oZ,isURLSearchParams:uZ,isStandardBrowserEnv:lZ,forEach:Lb,merge:Ob,extend:fZ,trim:cZ,stripBOM:hZ,inherits:dZ,toFlatObject:pZ,kindOf:Pb,kindOfTest:Oo,endsWith:gZ,toArray:yZ,isTypedArray:mZ,isFileList:sZ}});var Fb=w((rpe,XR)=>{"use strict";c();var ic=Rt();function JR(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}XR.exports=function(e,r,n){if(!r)return e;var i;if(n)i=n(r);else if(ic.isURLSearchParams(r))i=r.toString();else{var s=[];ic.forEach(r,function(u,l){u===null||typeof u>"u"||(ic.isArray(u)?l=l+"[]":u=[u],ic.forEach(u,function(d){ic.isDate(d)?d=d.toISOString():ic.isObject(d)&&(d=JSON.stringify(d)),s.push(JR(l)+"="+JR(d))}))}),i=s.join("&")}if(i){var o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}});var eB=w((ipe,ZR)=>{"use strict";c();var wZ=Rt();function kg(){this.handlers=[]}kg.prototype.use=function(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};kg.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};kg.prototype.forEach=function(e){wZ.forEach(this.handlers,function(n){n!==null&&e(n)})};ZR.exports=kg});var rB=w((ope,tB)=>{"use strict";c();var EZ=Rt();tB.exports=function(e,r){EZ.forEach(e,function(i,s){s!==r&&s.toUpperCase()===r.toUpperCase()&&(e[r]=i,delete e[s])})}});var Do=w((upe,oB)=>{"use strict";c();var nB=Rt();function sc(t,e,r,n,i){Error.call(this),this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i)}nB.inherits(sc,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:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var iB=sc.prototype,sB={};["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"].forEach(function(t){sB[t]={value:t}});Object.defineProperties(sc,sB);Object.defineProperty(iB,"isAxiosError",{value:!0});sc.from=function(t,e,r,n,i,s){var o=Object.create(iB);return nB.toFlatObject(t,o,function(u){return u!==Error.prototype}),sc.call(o,t.message,e,r,n,i),o.name=t.name,s&&Object.assign(o,s),o};oB.exports=sc});var Mb=w((lpe,aB)=>{"use strict";c();aB.exports={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1}});var Ub=w((hpe,uB)=>{"use strict";c();var Wr=Rt();function vZ(t,e){e=e||new FormData;var r=[];function n(s){return s===null?"":Wr.isDate(s)?s.toISOString():Wr.isArrayBuffer(s)||Wr.isTypedArray(s)?typeof Blob=="function"?new Blob([s]):h.Buffer.from(s):s}function i(s,o){if(Wr.isPlainObject(s)||Wr.isArray(s)){if(r.indexOf(s)!==-1)throw Error("Circular reference detected in "+o);r.push(s),Wr.forEach(s,function(u,l){if(!Wr.isUndefined(u)){var f=o?o+"."+l:l,d;if(u&&!o&&typeof u=="object"){if(Wr.endsWith(l,"{}"))u=JSON.stringify(u);else if(Wr.endsWith(l,"[]")&&(d=Wr.toArray(u))){d.forEach(function(y){!Wr.isUndefined(y)&&e.append(f,n(y))});return}}i(u,f)}}),r.pop()}else e.append(o,n(s))}return i(t),e}uB.exports=vZ});var lB=w((ppe,cB)=>{"use strict";c();var qb=Do();cB.exports=function(e,r,n){var i=n.config.validateStatus;!n.status||!i||i(n.status)?e(n):r(new qb("Request failed with status code "+n.status,[qb.ERR_BAD_REQUEST,qb.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}});var hB=w((ype,fB)=>{"use strict";c();var zg=Rt();fB.exports=zg.isStandardBrowserEnv()?function(){return{write:function(r,n,i,s,o,a){var u=[];u.push(r+"="+encodeURIComponent(n)),zg.isNumber(i)&&u.push("expires="+new Date(i).toGMTString()),zg.isString(s)&&u.push("path="+s),zg.isString(o)&&u.push("domain="+o),a===!0&&u.push("secure"),document.cookie=u.join("; ")},read:function(r){var n=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(r){this.write(r,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()});var pB=w((wpe,dB)=>{"use strict";c();dB.exports=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}});var yB=w((vpe,gB)=>{"use strict";c();gB.exports=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e}});var Vb=w((bpe,mB)=>{"use strict";c();var AZ=pB(),bZ=yB();mB.exports=function(e,r){return e&&!AZ(r)?bZ(e,r):r}});var EB=w((Ipe,wB)=>{"use strict";c();var jb=Rt(),_Z=["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"];wB.exports=function(e){var r={},n,i,s;return e&&jb.forEach(e.split(` -`),function(a){if(s=a.indexOf(":"),n=jb.trim(a.substr(0,s)).toLowerCase(),i=jb.trim(a.substr(s+1)),n){if(r[n]&&_Z.indexOf(n)>=0)return;n==="set-cookie"?r[n]=(r[n]?r[n]:[]).concat([i]):r[n]=r[n]?r[n]+", "+i:i}}),r}});var bB=w((Cpe,AB)=>{"use strict";c();var vB=Rt();AB.exports=vB.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),n;function i(s){var 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){var a=vB.isString(o)?i(o):o;return a.protocol===n.protocol&&a.host===n.host}}():function(){return function(){return!0}}()});var cf=w((xpe,IB)=>{"use strict";c();var Hb=Do(),IZ=Rt();function _B(t){Hb.call(this,t??"canceled",Hb.ERR_CANCELED),this.name="CanceledError"}IZ.inherits(_B,Hb,{__CANCEL__:!0});IB.exports=_B});var CB=w((Ope,SB)=>{"use strict";c();SB.exports=function(e){var r=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return r&&r[1]||""}});var Gb=w((Ppe,TB)=>{"use strict";c();var lf=Rt(),SZ=lB(),CZ=hB(),TZ=Fb(),xZ=Vb(),NZ=EB(),OZ=bB(),DZ=Mb(),oi=Do(),PZ=cf(),RZ=CB();TB.exports=function(e){return new Promise(function(n,i){var s=e.data,o=e.headers,a=e.responseType,u;function l(){e.cancelToken&&e.cancelToken.unsubscribe(u),e.signal&&e.signal.removeEventListener("abort",u)}lf.isFormData(s)&&lf.isStandardBrowserEnv()&&delete o["Content-Type"];var f=new XMLHttpRequest;if(e.auth){var d=e.auth.username||"",y=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.Authorization="Basic "+btoa(d+":"+y)}var m=xZ(e.baseURL,e.url);f.open(e.method.toUpperCase(),TZ(m,e.params,e.paramsSerializer),!0),f.timeout=e.timeout;function v(){if(f){var A="getAllResponseHeaders"in f?NZ(f.getAllResponseHeaders()):null,D=!a||a==="text"||a==="json"?f.responseText:f.response,x={data:D,status:f.status,statusText:f.statusText,headers:A,config:e,request:f};SZ(function(P){n(P),l()},function(P){i(P),l()},x),f=null}}if("onloadend"in f?f.onloadend=v:f.onreadystatechange=function(){!f||f.readyState!==4||f.status===0&&!(f.responseURL&&f.responseURL.indexOf("file:")===0)||setTimeout(v)},f.onabort=function(){f&&(i(new oi("Request aborted",oi.ECONNABORTED,e,f)),f=null)},f.onerror=function(){i(new oi("Network Error",oi.ERR_NETWORK,e,f,f)),f=null},f.ontimeout=function(){var D=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",x=e.transitional||DZ;e.timeoutErrorMessage&&(D=e.timeoutErrorMessage),i(new oi(D,x.clarifyTimeoutError?oi.ETIMEDOUT:oi.ECONNABORTED,e,f)),f=null},lf.isStandardBrowserEnv()){var T=(e.withCredentials||OZ(m))&&e.xsrfCookieName?CZ.read(e.xsrfCookieName):void 0;T&&(o[e.xsrfHeaderName]=T)}"setRequestHeader"in f&&lf.forEach(o,function(D,x){typeof s>"u"&&x.toLowerCase()==="content-type"?delete o[x]:f.setRequestHeader(x,D)}),lf.isUndefined(e.withCredentials)||(f.withCredentials=!!e.withCredentials),a&&a!=="json"&&(f.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&f.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&f.upload&&f.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(u=function(A){f&&(i(!A||A&&A.type?new PZ:A),f.abort(),f=null)},e.cancelToken&&e.cancelToken.subscribe(u),e.signal&&(e.signal.aborted?u():e.signal.addEventListener("abort",u))),s||(s=null);var B=RZ(m);if(B&&["http","https","file"].indexOf(B)===-1){i(new oi("Unsupported protocol "+B+":",oi.ERR_BAD_REQUEST,e));return}f.send(s)})}});var NB=w((Bpe,xB)=>{c();xB.exports=null});var Kg=w((Fpe,RB)=>{"use strict";c();var Bt=Rt(),OB=rB(),DB=Do(),BZ=Mb(),LZ=Ub(),FZ={"Content-Type":"application/x-www-form-urlencoded"};function PB(t,e){!Bt.isUndefined(t)&&Bt.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function MZ(){var t;return typeof XMLHttpRequest<"u"?t=Gb():typeof p.default<"u"&&Object.prototype.toString.call(p.default)==="[object process]"&&(t=Gb()),t}function UZ(t,e,r){if(Bt.isString(t))try{return(e||JSON.parse)(t),Bt.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}var Wg={transitional:BZ,adapter:MZ(),transformRequest:[function(e,r){if(OB(r,"Accept"),OB(r,"Content-Type"),Bt.isFormData(e)||Bt.isArrayBuffer(e)||Bt.isBuffer(e)||Bt.isStream(e)||Bt.isFile(e)||Bt.isBlob(e))return e;if(Bt.isArrayBufferView(e))return e.buffer;if(Bt.isURLSearchParams(e))return PB(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString();var n=Bt.isObject(e),i=r&&r["Content-Type"],s;if((s=Bt.isFileList(e))||n&&i==="multipart/form-data"){var o=this.env&&this.env.FormData;return LZ(s?{"files[]":e}:e,o&&new o)}else if(n||i==="application/json")return PB(r,"application/json"),UZ(e);return e}],transformResponse:[function(e){var r=this.transitional||Wg.transitional,n=r&&r.silentJSONParsing,i=r&&r.forcedJSONParsing,s=!n&&this.responseType==="json";if(s||i&&Bt.isString(e)&&e.length)try{return JSON.parse(e)}catch(o){if(s)throw o.name==="SyntaxError"?DB.from(o,DB.ERR_BAD_RESPONSE,this,null,this.response):o}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:NB()},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};Bt.forEach(["delete","get","head"],function(e){Wg.headers[e]={}});Bt.forEach(["post","put","patch"],function(e){Wg.headers[e]=Bt.merge(FZ)});RB.exports=Wg});var LB=w((Upe,BB)=>{"use strict";c();var qZ=Rt(),VZ=Kg();BB.exports=function(e,r,n){var i=this||VZ;return qZ.forEach(n,function(o){e=o.call(i,e,r)}),e}});var Qb=w((Vpe,FB)=>{"use strict";c();FB.exports=function(e){return!!(e&&e.__CANCEL__)}});var qB=w((Hpe,UB)=>{"use strict";c();var MB=Rt(),kb=LB(),jZ=Qb(),HZ=Kg(),GZ=cf();function zb(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new GZ}UB.exports=function(e){zb(e),e.headers=e.headers||{},e.data=kb.call(e,e.data,e.headers,e.transformRequest),e.headers=MB.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),MB.forEach(["delete","get","head","post","put","patch","common"],function(i){delete e.headers[i]});var r=e.adapter||HZ.adapter;return r(e).then(function(i){return zb(e),i.data=kb.call(e,i.data,i.headers,e.transformResponse),i},function(i){return jZ(i)||(zb(e),i&&i.response&&(i.response.data=kb.call(e,i.response.data,i.response.headers,e.transformResponse))),Promise.reject(i)})}});var Wb=w((Qpe,VB)=>{"use strict";c();var dr=Rt();VB.exports=function(e,r){r=r||{};var n={};function i(f,d){return dr.isPlainObject(f)&&dr.isPlainObject(d)?dr.merge(f,d):dr.isPlainObject(d)?dr.merge({},d):dr.isArray(d)?d.slice():d}function s(f){if(dr.isUndefined(r[f])){if(!dr.isUndefined(e[f]))return i(void 0,e[f])}else return i(e[f],r[f])}function o(f){if(!dr.isUndefined(r[f]))return i(void 0,r[f])}function a(f){if(dr.isUndefined(r[f])){if(!dr.isUndefined(e[f]))return i(void 0,e[f])}else return i(void 0,r[f])}function u(f){if(f in r)return i(e[f],r[f]);if(f in e)return i(void 0,e[f])}var l={url:o,method:o,data:o,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:u};return dr.forEach(Object.keys(e).concat(Object.keys(r)),function(d){var y=l[d]||s,m=y(d);dr.isUndefined(m)&&y!==u||(n[d]=m)}),n}});var Kb=w((zpe,jB)=>{c();jB.exports={version:"0.27.2"}});var QB=w((Kpe,GB)=>{"use strict";c();var QZ=Kb().version,as=Do(),$b={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){$b[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var HB={};$b.transitional=function(e,r,n){function i(s,o){return"[Axios v"+QZ+"] Transitional option '"+s+"'"+o+(n?". "+n:"")}return function(s,o,a){if(e===!1)throw new as(i(o," has been removed"+(r?" in "+r:"")),as.ERR_DEPRECATED);return r&&!HB[o]&&(HB[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 kZ(t,e,r){if(typeof t!="object")throw new as("options must be an object",as.ERR_BAD_OPTION_VALUE);for(var n=Object.keys(t),i=n.length;i-- >0;){var s=n[i],o=e[s];if(o){var a=t[s],u=a===void 0||o(a,s,t);if(u!==!0)throw new as("option "+s+" must be "+u,as.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new as("Unknown option "+s,as.ERR_BAD_OPTION)}}GB.exports={assertOptions:kZ,validators:$b}});var YB=w((Ype,$B)=>{"use strict";c();var WB=Rt(),zZ=Fb(),kB=eB(),zB=qB(),$g=Wb(),WZ=Vb(),KB=QB(),oc=KB.validators;function ac(t){this.defaults=t,this.interceptors={request:new kB,response:new kB}}ac.prototype.request=function(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=$g(this.defaults,r),r.method?r.method=r.method.toLowerCase():this.defaults.method?r.method=this.defaults.method.toLowerCase():r.method="get";var n=r.transitional;n!==void 0&&KB.assertOptions(n,{silentJSONParsing:oc.transitional(oc.boolean),forcedJSONParsing:oc.transitional(oc.boolean),clarifyTimeoutError:oc.transitional(oc.boolean)},!1);var i=[],s=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(r)===!1||(s=s&&m.synchronous,i.unshift(m.fulfilled,m.rejected))});var o=[];this.interceptors.response.forEach(function(m){o.push(m.fulfilled,m.rejected)});var a;if(!s){var u=[zB,void 0];for(Array.prototype.unshift.apply(u,i),u=u.concat(o),a=Promise.resolve(r);u.length;)a=a.then(u.shift(),u.shift());return a}for(var l=r;i.length;){var f=i.shift(),d=i.shift();try{l=f(l)}catch(y){d(y);break}}try{a=zB(l)}catch(y){return Promise.reject(y)}for(;o.length;)a=a.then(o.shift(),o.shift());return a};ac.prototype.getUri=function(e){e=$g(this.defaults,e);var r=WZ(e.baseURL,e.url);return zZ(r,e.params,e.paramsSerializer)};WB.forEach(["delete","get","head","options"],function(e){ac.prototype[e]=function(r,n){return this.request($g(n||{},{method:e,url:r,data:(n||{}).data}))}});WB.forEach(["post","put","patch"],function(e){function r(n){return function(s,o,a){return this.request($g(a||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:s,data:o}))}}ac.prototype[e]=r(),ac.prototype[e+"Form"]=r(!0)});$B.exports=ac});var XB=w((Xpe,JB)=>{"use strict";c();var KZ=cf();function uc(t){if(typeof t!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(i){e=i});var r=this;this.promise.then(function(n){if(r._listeners){var i,s=r._listeners.length;for(i=0;i{"use strict";c();ZB.exports=function(e){return function(n){return e.apply(null,n)}}});var rL=w((rge,tL)=>{"use strict";c();var $Z=Rt();tL.exports=function(e){return $Z.isObject(e)&&e.isAxiosError===!0}});var sL=w((ige,Yb)=>{"use strict";c();var nL=Rt(),YZ=Nb(),Yg=YB(),JZ=Wb(),XZ=Kg();function iL(t){var e=new Yg(t),r=YZ(Yg.prototype.request,e);return nL.extend(r,Yg.prototype,e),nL.extend(r,e),r.create=function(i){return iL(JZ(t,i))},r}var ar=iL(XZ);ar.Axios=Yg;ar.CanceledError=cf();ar.CancelToken=XB();ar.isCancel=Qb();ar.VERSION=Kb().version;ar.toFormData=Ub();ar.AxiosError=Do();ar.Cancel=ar.CanceledError;ar.all=function(e){return Promise.all(e)};ar.spread=eL();ar.isAxiosError=rL();Yb.exports=ar;Yb.exports.default=ar});var aL=w((oge,oL)=>{c();oL.exports=sL()});var uL=w(Jg=>{"use strict";c();Object.defineProperty(Jg,"__esModule",{value:!0});Jg.NativeAuthClientConfig=void 0;var Jb=class{constructor(){this.origin=typeof window<"u"?window.location.hostname:"",this.apiUrl="https://api.multiversx.com",this.expirySeconds=60*60*24}};Jg.NativeAuthClientConfig=Jb});var Zb=w(cc=>{"use strict";c();var Po=cc&&cc.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(cc,"__esModule",{value:!0});cc.NativeAuthClient=void 0;var ZZ=aL(),eee=uL(),Xb=class{constructor(e){this.config=Object.assign(new eee.NativeAuthClientConfig,e)}getToken(e,r,n){let i=this.encodeValue(e),s=this.encodeValue(r);return`${i}.${s}.${n}`}initialize(e={}){return Po(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 Po(this,void 0,void 0,function*(){return this.config.gatewayUrl?yield this.getCurrentBlockHashWithGateway():yield this.getCurrentBlockHashWithApi()})}getCurrentBlockHashWithGateway(){return Po(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 Po(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 Po(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 Po(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 Po(this,void 0,void 0,function*(){return yield ZZ.default.get(e,{headers:this.config.extraRequestHeaders})})}};cc.NativeAuthClient=Xb});var dL=w(e0=>{"use strict";c();Object.defineProperty(e0,"__esModule",{value:!0});e0.TransactionStatus=void 0;var ff=class{constructor(e){this.status=(e||"").toLowerCase()}static createUnknown(){return new ff("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}};e0.TransactionStatus=ff});var hc=w(Ft=>{"use strict";c();var tee=Ft&&Ft.__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]}),ree=Ft&&Ft.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nee=Ft&&Ft.__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)&&tee(e,t,r);return ree(e,t),e};Object.defineProperty(Ft,"__esModule",{value:!0});Ft.zeroPadStringIfOddLength=Ft.isPaddedHex=Ft.numberToPaddedHex=Ft.Nonce=Ft.Address=void 0;var pL=nee(Qf()),iee="erd",hf=class{constructor(e){this.value=e}static fromPubkey(e){let r=pL.toWords(e),n=pL.encode(iee,r);return new hf(n)}bech32(){return this.value}toString(){return this.bech32()}};Ft.Address=hf;var e_=class{constructor(e){this.value=e}valueOf(){return this.value}hex(){return gL(this.value)}};Ft.Nonce=e_;function gL(t){let e=t.toString(16);return yL(e)}Ft.numberToPaddedHex=gL;function see(t){t=t||"";let e=h.Buffer.from(t,"hex").toString("hex");return t.toUpperCase()==e.toUpperCase()}Ft.isPaddedHex=see;function yL(t){return t=t||"",t.length%2==1?"0"+t:t}Ft.zeroPadStringIfOddLength=yL});var wL=w(t0=>{"use strict";c();Object.defineProperty(t0,"__esModule",{value:!0});t0.TransactionReceipt=void 0;var mL=hc(),df=class{constructor(){this.value="",this.sender=new mL.Address(""),this.data="",this.hash=""}static fromHttpResponse(e){let r=new df;return r.value=(e.value||0).toString(),r.sender=new mL.Address(e.sender),r.data=e.data,r.hash=e.txHash,r}};t0.TransactionReceipt=df});var EL=w(Rn=>{"use strict";c();Object.defineProperty(Rn,"__esModule",{value:!0});Rn.ErrContractQuery=Rn.ErrNetworkProvider=Rn.ErrUnexpectedCondition=Rn.Err=void 0;var dc=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};Rn.Err=dc;var t_=class extends dc{constructor(e){super(`Unexpected condition: [${e}]`)}};Rn.ErrUnexpectedCondition=t_;var r_=class extends dc{constructor(e,r,n){let i=`Request error on url [${e}]: [${r}]`;super(i,n)}};Rn.ErrNetworkProvider=r_;var n_=class extends dc{constructor(e){super(e.message.replace("executeQuery:",""))}};Rn.ErrContractQuery=n_});var AL=w(pc=>{"use strict";c();Object.defineProperty(pc,"__esModule",{value:!0});pc.TransactionEventTopic=pc.TransactionEvent=void 0;var vL=hc(),pf=class{constructor(e){this.address=new vL.Address(""),this.identifier="",this.topics=[],this.data="",Object.assign(this,e)}static fromHttpResponse(e){let r=new pf;return r.address=new vL.Address(e.address),r.identifier=e.identifier||"",r.topics=(e.topics||[]).map(n=>new r0(n)),r.data=h.Buffer.from(e.data||"","base64").toString(),r}findFirstOrNoneTopic(e){return this.topics.filter(r=>e(r))[0]}getLastTopic(){return this.topics[this.topics.length-1]}};pc.TransactionEvent=pf;var r0=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}};pc.TransactionEventTopic=r0});var i_=w(n0=>{"use strict";c();Object.defineProperty(n0,"__esModule",{value:!0});n0.TransactionLogs=void 0;var oee=EL(),bL=hc(),aee=AL(),gf=class{constructor(e){this.address=new bL.Address(""),this.events=[],Object.assign(this,e)}static fromHttpResponse(e){let r=new gf;return r.address=new bL.Address(e.address),r.events=(e.events||[]).map(n=>aee.TransactionEvent.fromHttpResponse(n)),r}findSingleOrNoneEvent(e,r){let n=this.findEvents(e,r);if(n.length>1)throw new oee.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}};n0.TransactionLogs=gf});var IL=w(yc=>{"use strict";c();Object.defineProperty(yc,"__esModule",{value:!0});yc.ContractResultItem=yc.ContractResults=void 0;var _L=i_(),i0=hc(),gc=class{constructor(e){this.items=e,this.items.sort(function(r,n){return r.nonce.valueOf()-n.nonce.valueOf()})}static fromProxyHttpResponse(e){let r=e.map(n=>ai.fromProxyHttpResponse(n));return new gc(r)}static fromApiHttpResponse(e){let r=e.map(n=>ai.fromApiHttpResponse(n));return new gc(r)}};yc.ContractResults=gc;var ai=class{constructor(e){this.hash="",this.nonce=0,this.value="",this.receiver=new i0.Address(""),this.sender=new i0.Address(""),this.data="",this.previousHash="",this.originalHash="",this.gasLimit=0,this.gasPrice=0,this.callType=0,this.returnMessage="",this.logs=new _L.TransactionLogs,Object.assign(this,e)}static fromProxyHttpResponse(e){return ai.fromHttpResponse(e)}static fromApiHttpResponse(e){let r=ai.fromHttpResponse(e);return r.data=h.Buffer.from(r.data,"base64").toString(),r.callType=Number(r.callType),r}static fromHttpResponse(e){let r=new ai;return r.hash=e.hash,r.nonce=Number(e.nonce||0),r.value=(e.value||0).toString(),r.receiver=new i0.Address(e.receiver),r.sender=new i0.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=_L.TransactionLogs.fromHttpResponse(e.logs||{}),r}};yc.ContractResultItem=ai});var SL=w(cs=>{"use strict";c();var uee=cs&&cs.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(cs,"__esModule",{value:!0});cs.EsdtContractAddress=cs.MaxUint64AsBigNumber=void 0;var cee=uee(Yt()),lee=hc();cs.MaxUint64AsBigNumber=new cee.default("18446744073709551615");cs.EsdtContractAddress=new lee.Address("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u")});var CL=w(mc=>{"use strict";c();var fee=mc&&mc.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(mc,"__esModule",{value:!0});mc.ContractQueryResponse=void 0;var hee=fee(Yt()),dee=SL(),yf=class{constructor(e){this.returnData=e?.returnData||[],this.returnCode=e?.returnCode||"",this.returnMessage=e?.returnMessage||"",this.gasUsed=e?.gasUsed||0}static fromHttpResponse(e){let r=e.returnData||e.ReturnData,n=e.returnCode||e.ReturnCode,i=e.returnMessage||e.ReturnMessage,s=new hee.default(e.gasRemaining||e.GasRemaining||0),o=dee.MaxUint64AsBigNumber.minus(s).toNumber();return new yf({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()}}};mc.ContractQueryResponse=yf});var TL=w(s0=>{"use strict";c();Object.defineProperty(s0,"__esModule",{value:!0});s0.ContractQueryRequest=void 0;var s_=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}};s0.ContractQueryRequest=s_});var UL=w((S0e,ML)=>{c();ML.exports=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}});var ls=w(Lo=>{c();var o_,pee=[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];Lo.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};Lo.getSymbolTotalCodewords=function(e){return pee[e]};Lo.getBCHDigit=function(t){let e=0;for(;t!==0;)e++,t>>>=1;return e};Lo.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');o_=e};Lo.isKanjiModeEnabled=function(){return typeof o_<"u"};Lo.toSJIS=function(e){return o_(e)}});var u0=w(Rr=>{c();Rr.L={bit:1};Rr.M={bit:0};Rr.Q={bit:3};Rr.H={bit:2};function gee(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return Rr.L;case"m":case"medium":return Rr.M;case"q":case"quartile":return Rr.Q;case"h":case"high":return Rr.H;default:throw new Error("Unknown EC Level: "+t)}}Rr.isValid=function(e){return e&&typeof e.bit<"u"&&e.bit>=0&&e.bit<4};Rr.from=function(e,r){if(Rr.isValid(e))return e;try{return gee(e)}catch{return r}}});var jL=w((D0e,VL)=>{c();function qL(){this.buffer=[],this.length=0}qL.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++}};VL.exports=qL});var GL=w((R0e,HL)=>{c();function mf(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)}mf.prototype.set=function(t,e,r,n){let i=t*this.size+e;this.data[i]=r,n&&(this.reservedBit[i]=!0)};mf.prototype.get=function(t,e){return this.data[t*this.size+e]};mf.prototype.xor=function(t,e,r){this.data[t*this.size+e]^=r};mf.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};HL.exports=mf});var QL=w(c0=>{c();var yee=ls().getSymbolSize;c0.getRowColCoords=function(e){if(e===1)return[];let r=Math.floor(e/7)+2,n=yee(e),i=n===145?26:Math.ceil((n-13)/(2*r-2))*2,s=[n-7];for(let o=1;o{c();var mee=ls().getSymbolSize,kL=7;zL.getPositions=function(e){let r=mee(e);return[[0,0],[r-kL,0],[0,r-kL]]}});var KL=w(Ke=>{c();Ke.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var Fo={N1:3,N2:3,N3:40,N4:10};Ke.isValid=function(e){return e!=null&&e!==""&&!isNaN(e)&&e>=0&&e<=7};Ke.from=function(e){return Ke.isValid(e)?parseInt(e,10):void 0};Ke.getPenaltyN1=function(e){let r=e.size,n=0,i=0,s=0,o=null,a=null;for(let u=0;u=5&&(n+=Fo.N1+(i-5)),o=f,i=1),f=e.get(l,u),f===a?s++:(s>=5&&(n+=Fo.N1+(s-5)),a=f,s=1)}i>=5&&(n+=Fo.N1+(i-5)),s>=5&&(n+=Fo.N1+(s-5))}return n};Ke.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*Fo.N3};Ke.getPenaltyN4=function(e){let r=0,n=e.data.length;for(let s=0;s{c();var fs=u0(),l0=[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],f0=[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];a_.getBlocksCount=function(e,r){switch(r){case fs.L:return l0[(e-1)*4+0];case fs.M:return l0[(e-1)*4+1];case fs.Q:return l0[(e-1)*4+2];case fs.H:return l0[(e-1)*4+3];default:return}};a_.getTotalCodewordsCount=function(e,r){switch(r){case fs.L:return f0[(e-1)*4+0];case fs.M:return f0[(e-1)*4+1];case fs.Q:return f0[(e-1)*4+2];case fs.H:return f0[(e-1)*4+3];default:return}}});var $L=w(d0=>{c();var wf=new Uint8Array(512),h0=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)wf[r]=e,h0[e]=r,e<<=1,e&256&&(e^=285);for(let r=255;r<512;r++)wf[r]=wf[r-255]})();d0.log=function(e){if(e<1)throw new Error("log("+e+")");return h0[e]};d0.exp=function(e){return wf[e]};d0.mul=function(e,r){return e===0||r===0?0:wf[h0[e]+h0[r]]}});var YL=w(Ef=>{c();var c_=$L();Ef.mul=function(e,r){let n=new Uint8Array(e.length+r.length-1);for(let i=0;i=0;){let i=n[0];for(let o=0;o{c();var JL=YL();function l_(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}l_.prototype.initialize=function(e){this.degree=e,this.genPoly=JL.generateECPolynomial(this.degree)};l_.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=JL.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};XL.exports=l_});var f_=w(eF=>{c();eF.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}});var h_=w(ui=>{c();var tF="[0-9]+",Eee="[A-Z $%*+\\-./:]+",vf="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";vf=vf.replace(/u/g,"\\u");var vee="(?:(?![A-Z0-9 $%*+\\-./:]|"+vf+`)(?:.|[\r -]))+`;ui.KANJI=new RegExp(vf,"g");ui.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");ui.BYTE=new RegExp(vee,"g");ui.NUMERIC=new RegExp(tF,"g");ui.ALPHANUMERIC=new RegExp(Eee,"g");var Aee=new RegExp("^"+vf+"$"),bee=new RegExp("^"+tF+"$"),_ee=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");ui.testKanji=function(e){return Aee.test(e)};ui.testNumeric=function(e){return bee.test(e)};ui.testAlphanumeric=function(e){return _ee.test(e)}});var hs=w(Et=>{c();var Iee=f_(),d_=h_();Et.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]};Et.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]};Et.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]};Et.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]};Et.MIXED={bit:-1};Et.getCharCountIndicator=function(e,r){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!Iee.isValid(r))throw new Error("Invalid version: "+r);return r>=1&&r<10?e.ccBits[0]:r<27?e.ccBits[1]:e.ccBits[2]};Et.getBestModeForData=function(e){return d_.testNumeric(e)?Et.NUMERIC:d_.testAlphanumeric(e)?Et.ALPHANUMERIC:d_.testKanji(e)?Et.KANJI:Et.BYTE};Et.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")};Et.isValid=function(e){return e&&e.bit&&e.ccBits};function See(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return Et.NUMERIC;case"alphanumeric":return Et.ALPHANUMERIC;case"kanji":return Et.KANJI;case"byte":return Et.BYTE;default:throw new Error("Unknown mode: "+t)}}Et.from=function(e,r){if(Et.isValid(e))return e;try{return See(e)}catch{return r}}});var oF=w(Mo=>{c();var p0=ls(),Cee=u_(),rF=u0(),ds=hs(),p_=f_(),iF=7973,nF=p0.getBCHDigit(iF);function Tee(t,e,r){for(let n=1;n<=40;n++)if(e<=Mo.getCapacity(n,r,t))return n}function sF(t,e){return ds.getCharCountIndicator(t,e)+4}function xee(t,e){let r=0;return t.forEach(function(n){let i=sF(n.mode,e);r+=i+n.getBitsLength()}),r}function Nee(t,e){for(let r=1;r<=40;r++)if(xee(t,r)<=Mo.getCapacity(r,e,ds.MIXED))return r}Mo.from=function(e,r){return p_.isValid(e)?parseInt(e,10):r};Mo.getCapacity=function(e,r,n){if(!p_.isValid(e))throw new Error("Invalid QR Code version");typeof n>"u"&&(n=ds.BYTE);let i=p0.getSymbolTotalCodewords(e),s=Cee.getTotalCodewordsCount(e,r),o=(i-s)*8;if(n===ds.MIXED)return o;let a=o-sF(n,e);switch(n){case ds.NUMERIC:return Math.floor(a/10*3);case ds.ALPHANUMERIC:return Math.floor(a/11*2);case ds.KANJI:return Math.floor(a/13);case ds.BYTE:default:return Math.floor(a/8)}};Mo.getBestVersionForData=function(e,r){let n,i=rF.from(r,rF.M);if(Array.isArray(e)){if(e.length>1)return Nee(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return Tee(n.mode,n.getLength(),i)};Mo.getEncodedBits=function(e){if(!p_.isValid(e)||e<7)throw new Error("Invalid QR Code version");let r=e<<12;for(;p0.getBCHDigit(r)-nF>=0;)r^=iF<{c();var g_=ls(),uF=1335,Oee=21522,aF=g_.getBCHDigit(uF);cF.getEncodedBits=function(e,r){let n=e.bit<<3|r,i=n<<10;for(;g_.getBCHDigit(i)-aF>=0;)i^=uF<{c();var Dee=hs();function wc(t){this.mode=Dee.NUMERIC,this.data=t.toString()}wc.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)};wc.prototype.getLength=function(){return this.data.length};wc.prototype.getBitsLength=function(){return wc.getBitsLength(this.data.length)};wc.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))};fF.exports=wc});var pF=w((aye,dF)=>{c();var Pee=hs(),y_=["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 Ec(t){this.mode=Pee.ALPHANUMERIC,this.data=t}Ec.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)};Ec.prototype.getLength=function(){return this.data.length};Ec.prototype.getBitsLength=function(){return Ec.getBitsLength(this.data.length)};Ec.prototype.write=function(e){let r;for(r=0;r+2<=this.data.length;r+=2){let n=y_.indexOf(this.data[r])*45;n+=y_.indexOf(this.data[r+1]),e.put(n,11)}this.data.length%2&&e.put(y_.indexOf(this.data[r]),6)};dF.exports=Ec});var yF=w((cye,gF)=>{"use strict";c();gF.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 wF=w((fye,mF)=>{c();var Ree=yF(),Bee=hs();function vc(t){this.mode=Bee.BYTE,typeof t=="string"&&(t=Ree(t)),this.data=new Uint8Array(t)}vc.getBitsLength=function(e){return e*8};vc.prototype.getLength=function(){return this.data.length};vc.prototype.getBitsLength=function(){return vc.getBitsLength(this.data.length)};vc.prototype.write=function(t){for(let e=0,r=this.data.length;e{c();var Lee=hs(),Fee=ls();function Ac(t){this.mode=Lee.KANJI,this.data=t}Ac.getBitsLength=function(e){return e*13};Ac.prototype.getLength=function(){return this.data.length};Ac.prototype.getBitsLength=function(){return Ac.getBitsLength(this.data.length)};Ac.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)}};EF.exports=Ac});var AF=w((gye,m_)=>{"use strict";c();var Af={single_source_shortest_paths:function(t,e,r){var n={},i={};i[e]=0;var s=Af.PriorityQueue.make();s.push(e,0);for(var o,a,u,l,f,d,y,m,v;!s.empty();){o=s.pop(),a=o.value,l=o.cost,f=t[a]||{};for(u in f)f.hasOwnProperty(u)&&(d=f[u],y=l+d,m=i[u],v=typeof i[u]>"u",(v||m>y)&&(i[u]=y,s.push(u,y),n[u]=a))}if(typeof r<"u"&&typeof i[r]>"u"){var T=["Could not find a path from ",e," to ",r,"."].join("");throw new Error(T)}return n},extract_shortest_path_from_predecessor_list:function(t,e){for(var r=[],n=e,i;n;)r.push(n),i=t[n],n=t[n];return r.reverse(),r},find_path:function(t,e,r){var n=Af.single_source_shortest_paths(t,e,r);return Af.extract_shortest_path_from_predecessor_list(n,r)},PriorityQueue:{make:function(t){var e=Af.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 m_<"u"&&(m_.exports=Af)});var NF=w(bc=>{c();var Ve=hs(),IF=hF(),SF=pF(),CF=wF(),TF=vF(),bf=h_(),g0=ls(),Mee=AF();function bF(t){return unescape(encodeURIComponent(t)).length}function _f(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 xF(t){let e=_f(bf.NUMERIC,Ve.NUMERIC,t),r=_f(bf.ALPHANUMERIC,Ve.ALPHANUMERIC,t),n,i;return g0.isKanjiModeEnabled()?(n=_f(bf.BYTE,Ve.BYTE,t),i=_f(bf.KANJI,Ve.KANJI,t)):(n=_f(bf.BYTE_KANJI,Ve.BYTE,t),i=[]),e.concat(r,n,i).sort(function(o,a){return o.index-a.index}).map(function(o){return{data:o.data,mode:o.mode,length:o.length}})}function w_(t,e){switch(e){case Ve.NUMERIC:return IF.getBitsLength(t);case Ve.ALPHANUMERIC:return SF.getBitsLength(t);case Ve.KANJI:return TF.getBitsLength(t);case Ve.BYTE:return CF.getBitsLength(t)}}function Uee(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 qee(t){let e=[];for(let r=0;r{c();var m0=ls(),E_=u0(),jee=jL(),Hee=GL(),Gee=QL(),Qee=WL(),b_=KL(),__=u_(),kee=ZL(),y0=oF(),zee=lF(),Wee=hs(),v_=NF();function Kee(t,e){let r=t.size,n=Qee.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 $ee(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 A_(t,e,r){let n=t.size,i=zee.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 Xee(t,e){let r=t.size,n=-1,i=r-1,s=7,o=0;for(let a=r-1;a>0;a-=2)for(a===6&&a--;;){for(let u=0;u<2;u++)if(!t.isReserved(i,a-u)){let l=!1;o>>s&1)===1),t.set(i,a-u,l),s--,s===-1&&(o++,s=7)}if(i+=n,i<0||r<=i){i-=n,n=-n;break}}}function Zee(t,e,r){let n=new jee;r.forEach(function(u){n.put(u.mode.bit,4),n.put(u.getLength(),Wee.getCharCountIndicator(u.mode,t)),u.write(n)});let i=m0.getSymbolTotalCodewords(t),s=__.getTotalCodewordsCount(t,e),o=(i-s)*8;for(n.getLengthInBits()+4<=o&&n.put(0,4);n.getLengthInBits()%8!==0;)n.putBit(0);let a=(o-n.getLengthInBits())/8;for(let u=0;u{n||(Mi(i[d].methods,s[d].methods)?Mi(i[d].events,s[d].events)||(n=Zn("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${d}`)):n=Zn("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${d}`))}),n}function h$(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 QP(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function d$(t){let e={};return Object.keys(t).forEach(r=>{r.includes(":")?e[r]=t[r]:Gs(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 p$(t,e){return Np(t,!1)&&t<=e.max&&t>=e.min}k.BASE10=aA,k.BASE16=tr,k.BASE64=bp,k.COLON=cz,k.DEFAULT_DEPTH=fA,k.EMPTY_SPACE=_p,k.ENV_MAP=ei,k.ONE_THOUSAND=lz,k.REACT_NATIVE_PRODUCT=a3,k.RELAYER_DEFAULT_PROTOCOL=w3,k.SDK_TYPE=c3,k.SLASH=u3,k.TYPE_0=uA,k.TYPE_1=Ma,k.UTF8=Tp,k.appendToQueryString=h3,k.assertType=gz,k.buildApprovedNamespaces=zz,k.calcExpiry=Tz,k.capitalize=Az,k.capitalizeWord=E3,k.createDelayedPromise=bz,k.createExpiringPromise=_z,k.decodeTypeByte=Zc,k.decrypt=nz,k.deriveSymKey=ZW,k.deserialize=lA,k.encodeTypeByte=i3,k.encrypt=rz,k.engineEvent=Nz,k.enumify=vz,k.formatAccountId=XP,k.formatAccountWithChain=GW,k.formatChainId=JP,k.formatExpirerTarget=dA,k.formatIdTarget=Sz,k.formatMessage=KW,k.formatMessageContext=yz,k.formatRelayParams=b3,k.formatRelayRpcUrl=dz,k.formatTopicTarget=Iz,k.formatUA=g3,k.formatUri=Uz,k.generateKeyPair=JW,k.generateRandomBytes32=XW,k.getAccountsChains=Gs,k.getAccountsFromNamespaces=QW,k.getAddressFromAccount=ZP,k.getAddressesFromAccounts=kW,k.getAppMetadata=fz,k.getChainFromAccount=e3,k.getChainsFromAccounts=t3,k.getChainsFromNamespace=Sp,k.getChainsFromNamespaces=WW,k.getChainsFromRequiredNamespaces=zW,k.getDidAddress=n3,k.getDidAddressSegments=Cp,k.getDidChainId=r3,k.getEnvironment=el,k.getHttpUrl=pz,k.getInternalError=Zn,k.getJavascriptID=p3,k.getJavascriptOS=d3,k.getLastItems=m3,k.getNamespacedDidChainId=$W,k.getNamespacesChains=_3,k.getNamespacesEventsForChainId=S3,k.getNamespacesMethodsForChainId=I3,k.getRelayClientMetadata=hz,k.getRelayProtocolApi=Pz,k.getRelayProtocolName=Dz,k.getRequiredNamespacesFromNamespaces=Wz,k.getSdkError=js,k.getUniqueValues=oA,k.handleDeeplinkRedirect=Oz,k.hasOverlap=Mi,k.hashKey=ez,k.hashMessage=tz,k.isBrowser=f3,k.isCaipNamespace=pA,k.isConformingNamespaces=L3,k.isExpired=xz,k.isNode=hA,k.isProposalStruct=Xz,k.isReactNative=l3,k.isSessionCompatible=Yz,k.isSessionStruct=Zz,k.isTypeOneEnvelope=sz,k.isUndefined=qi,k.isValidAccountId=T3,k.isValidAccounts=O3,k.isValidActions=P3,k.isValidArray=tl,k.isValidChainId=Xc,k.isValidChains=x3,k.isValidController=e$,k.isValidErrorReason=s$,k.isValidEvent=u$,k.isValidId=n$,k.isValidNamespaceAccounts=D3,k.isValidNamespaceActions=gA,k.isValidNamespaceChains=N3,k.isValidNamespaceMethodsOrEvents=nA,k.isValidNamespaces=R3,k.isValidNamespacesChainId=c$,k.isValidNamespacesEvent=f$,k.isValidNamespacesRequest=l$,k.isValidNumber=Np,k.isValidObject=xp,k.isValidParams=i$,k.isValidRelay=B3,k.isValidRelays=r$,k.isValidRequest=o$,k.isValidRequestExpiry=p$,k.isValidRequiredNamespaces=t$,k.isValidResponse=a$,k.isValidString=wr,k.isValidUrl=Jz,k.mapEntries=wz,k.mapToObj=mz,k.mergeArrays=Ui,k.normalizeNamespaces=rA,k.objToMap=Ez,k.parseAccountId=sA,k.parseChainId=YP,k.parseContextNames=y3,k.parseExpirerTarget=Cz,k.parseNamespaceKey=C3,k.parseRelayParams=v3,k.parseTopic=A3,k.parseUri=Mz,k.serialize=s3,k.validateDecoding=iz,k.validateEncoding=o3});var F3,M3,U3,q3,Op,nl,yA,Dp,Vi,il,Pp=ge(()=>{c();F3="PARSE_ERROR",M3="INVALID_REQUEST",U3="METHOD_NOT_FOUND",q3="INVALID_PARAMS",Op="INTERNAL_ERROR",nl="SERVER_ERROR",yA=[-32700,-32600,-32601,-32602,-32603],Dp=[-32e3,-32099],Vi={[F3]:{code:-32700,message:"Parse error"},[M3]:{code:-32600,message:"Invalid Request"},[U3]:{code:-32601,message:"Method not found"},[q3]:{code:-32602,message:"Invalid params"},[Op]:{code:-32603,message:"Internal error"},[nl]:{code:-32e3,message:"Server error"}},il=nl});function g$(t){return t<=Dp[0]&&t>=Dp[1]}function Rp(t){return yA.includes(t)}function V3(t){return typeof t=="number"}function Bp(t){return Object.keys(Vi).includes(t)?Vi[t]:Vi[il]}function Lp(t){let e=Object.values(Vi).find(r=>r.code===t);return e||Vi[il]}function y$(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(!V3(t.error.code))return{valid:!1,error:`Invalid error code type for JSON-RPC: ${t.error.code}`};if(Rp(t.error.code)){let e=Lp(t.error.code);if(e.message!==Vi[il].message&&t.error.message===e.message)return{valid:!1,error:`Invalid error code message for JSON-RPC: ${t.error.code}`}}return{valid:!0}}function mA(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var EA=ge(()=>{c();Pp()});var j3=m(Hi=>{"use strict";c();Object.defineProperty(Hi,"__esModule",{value:!0});Hi.isBrowserCryptoAvailable=Hi.getSubtleCrypto=Hi.getBrowerCrypto=void 0;function wA(){return(global===null||global===void 0?void 0:global.crypto)||(global===null||global===void 0?void 0:global.msCrypto)||{}}Hi.getBrowerCrypto=wA;function H3(){let t=wA();return t.subtle||t.webkitSubtle}Hi.getSubtleCrypto=H3;function m$(){return!!wA()&&!!H3()}Hi.isBrowserCryptoAvailable=m$});var Q3=m(ji=>{"use strict";c();Object.defineProperty(ji,"__esModule",{value:!0});ji.isBrowser=ji.isNode=ji.isReactNative=void 0;function G3(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}ji.isReactNative=G3;function k3(){return typeof p.default<"u"&&typeof p.default.versions<"u"&&typeof p.default.versions.node<"u"}ji.isNode=k3;function E$(){return!G3()&&!k3()}ji.isBrowser=E$});var vA=m(Fp=>{"use strict";c();Object.defineProperty(Fp,"__esModule",{value:!0});var W3=(mr(),ut(yr));W3.__exportStar(j3(),Fp);W3.__exportStar(Q3(),Fp)});var Ft={};ft(Ft,{isNodeJs:()=>$3});var z3,$3,K3=ge(()=>{c();z3=Ie(vA());Ht(Ft,Ie(vA()));$3=z3.isNode});function AA(t=3){let e=Date.now()*Math.pow(10,t),r=Math.floor(Math.random()*Math.pow(10,t));return e+r}function bA(t=6){return BigInt(AA(t))}function _A(t,e,r){return{id:r||AA(),jsonrpc:"2.0",method:t,params:e}}function w$(t,e){return{id:t,jsonrpc:"2.0",result:e}}function IA(t,e,r){return{id:t,jsonrpc:"2.0",error:Y3(e,r)}}function Y3(t,e){return typeof t>"u"?Bp(Op):(typeof t=="string"&&(t=Object.assign(Object.assign({},Bp(nl)),{message:t})),typeof e<"u"&&(t.data=e),Rp(t.code)&&(t=Lp(t.code)),t)}var J3=ge(()=>{c();EA();Pp()});function v$(t){return t.includes("*")?Up(t):!/\W/g.test(t)}function Mp(t){return t==="*"}function Up(t){return Mp(t)?!0:!(!t.includes("*")||t.split("*").length!==2||t.split("*").filter(e=>e.trim()==="").length!==1)}function A$(t){return!Mp(t)&&Up(t)&&!t.split("*")[0].trim()}function b$(t){return!Mp(t)&&Up(t)&&!t.split("*")[1].trim()}var X3=ge(()=>{c()});var Z3=ge(()=>{c()});var Ua,SA=ge(()=>{c();Ua=class{}});var CA,qp,sl,eR=ge(()=>{c();SA();CA=class extends Ua{constructor(e){super()}},qp=class extends Ua{constructor(){super()}},sl=class extends qp{constructor(e){super()}}});var tR=ge(()=>{c()});var rR=ge(()=>{c();Z3();SA();eR();tR()});var nR=ge(()=>{c();rR()});function S$(t){let e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function iR(t,e){let r=S$(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function C$(t){return iR(t,_$)}function Vp(t){return iR(t,I$)}function TA(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}var _$,I$,sR=ge(()=>{c();_$="^https?:",I$="^wss?:"});function xA(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function T$(t){return xA(t)&&"method"in t}function NA(t){return xA(t)&&(oR(t)||Hp(t))}function oR(t){return"result"in t}function Hp(t){return"error"in t}function x$(t){return"error"in t&&t.valid===!1}var aR=ge(()=>{c()});var Jt={};ft(Jt,{DEFAULT_ERROR:()=>il,IBaseJsonRpcProvider:()=>qp,IEvents:()=>Ua,IJsonRpcConnection:()=>CA,IJsonRpcProvider:()=>sl,INTERNAL_ERROR:()=>Op,INVALID_PARAMS:()=>q3,INVALID_REQUEST:()=>M3,METHOD_NOT_FOUND:()=>U3,PARSE_ERROR:()=>F3,RESERVED_ERROR_CODES:()=>yA,SERVER_ERROR:()=>nl,SERVER_ERROR_CODE_RANGE:()=>Dp,STANDARD_ERROR_MAP:()=>Vi,formatErrorMessage:()=>Y3,formatJsonRpcError:()=>IA,formatJsonRpcRequest:()=>_A,formatJsonRpcResult:()=>w$,getBigIntRpcId:()=>bA,getError:()=>Bp,getErrorByCode:()=>Lp,isHttpUrl:()=>C$,isJsonRpcError:()=>Hp,isJsonRpcPayload:()=>xA,isJsonRpcRequest:()=>T$,isJsonRpcResponse:()=>NA,isJsonRpcResult:()=>oR,isJsonRpcValidationInvalid:()=>x$,isLocalhostUrl:()=>TA,isNodeJs:()=>$3,isReservedErrorCode:()=>Rp,isServerErrorCode:()=>g$,isValidDefaultRoute:()=>Mp,isValidErrorCode:()=>V3,isValidLeadingWildcardRoute:()=>A$,isValidRoute:()=>v$,isValidTrailingWildcardRoute:()=>b$,isValidWildcardRoute:()=>Up,isWsUrl:()=>Vp,parseConnectionError:()=>mA,payloadId:()=>AA,validateJsonRpcError:()=>y$});var ol=ge(()=>{c();Pp();EA();K3();Ht(Jt,Ft);J3();X3();nR();sR();aR()});var uR,jp,cR,OA=ge(()=>{c();uR=Ie(kn());ol();jp=class extends sl{constructor(e){super(e),this.events=new uR.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(_A(e.method,e.params||[],e.id||bA().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=>{Hp(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),NA(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)}},cR=jp});var lR={};ft(lR,{JsonRpcProvider:()=>jp,default:()=>N$});var N$,fR=ge(()=>{c();OA();OA();N$=cR});var dR=m((Ape,hR)=>{"use strict";c();hR.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}});var pR,gR,DA,yR=ge(()=>{c();pR=()=>typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:dR(),gR=()=>typeof window<"u",DA=t=>t.split("?")[0]});var ER,mR,O$,Gp,wR,PA=ge(()=>{c();ER=Ie(kn());Ld();ol();yR();mR=10,O$=pR(),Gp=class{constructor(e){if(this.url=e,this.events=new ER.EventEmitter,this.registering=!1,!Vp(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,r)=>{if(typeof this.socket>"u"){r(new Error("Connection already closed"));return}this.socket.onclose=n=>{this.onClose(n),e()},this.socket.close()})}async send(e,r){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(Pc(e))}catch(n){this.onError(e.id,n)}}register(e=this.url){if(!Vp(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){let r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return i(new Error("WebSocket connection is missing or invalid"));n(this.socket)})})}return this.url=e,this.registering=!0,new Promise((r,n)=>{let i=(0,Jt.isReactNative)()?void 0:{rejectUnauthorized:!TA(e)},s=new O$(e,[],i);gR()?s.onerror=o=>{let a=o;n(this.emitError(a.error))}:s.on("error",o=>{n(this.emitError(o))}),s.onopen=()=>{this.onOpen(s),r(s)}})}onOpen(e){e.onmessage=r=>this.onPayload(r),e.onclose=r=>this.onClose(r),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;let r=typeof e.data=="string"?Dc(e.data):e.data;this.events.emit("payload",r)}onError(e,r){let n=this.parseError(r),i=n.message||n.toString(),s=IA(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return mA(e,DA(r),"WS")}resetMaxListeners(){this.events.getMaxListeners()>mR&&this.events.setMaxListeners(mR)}emitError(e){let r=this.parseError(new Error(e?.message||`WebSocket connection failed for host: ${DA(this.url)}`));return this.events.emit("register_error",r),r}},wR=Gp});var vR={};ft(vR,{WsConnection:()=>Gp,default:()=>D$});var D$,AR=ge(()=>{c();PA();PA();D$=wR});var r8=m((al,Va)=>{c();var P$=200,GA="__lodash_hash_undefined__",Jp=1,RR=2,BR=9007199254740991,kp="[object Arguments]",FA="[object Array]",R$="[object AsyncFunction]",LR="[object Boolean]",FR="[object Date]",MR="[object Error]",UR="[object Function]",B$="[object GeneratorFunction]",Qp="[object Map]",qR="[object Number]",L$="[object Null]",qa="[object Object]",bR="[object Promise]",F$="[object Proxy]",VR="[object RegExp]",Wp="[object Set]",HR="[object String]",M$="[object Symbol]",U$="[object Undefined]",MA="[object WeakMap]",jR="[object ArrayBuffer]",zp="[object DataView]",q$="[object Float32Array]",V$="[object Float64Array]",H$="[object Int8Array]",j$="[object Int16Array]",G$="[object Int32Array]",k$="[object Uint8Array]",Q$="[object Uint8ClampedArray]",W$="[object Uint16Array]",z$="[object Uint32Array]",$$=/[\\^$.*+?()[\]{}|]/g,K$=/^\[object .+?Constructor\]$/,Y$=/^(?:0|[1-9]\d*)$/,et={};et[q$]=et[V$]=et[H$]=et[j$]=et[G$]=et[k$]=et[Q$]=et[W$]=et[z$]=!0;et[kp]=et[FA]=et[jR]=et[LR]=et[zp]=et[FR]=et[MR]=et[UR]=et[Qp]=et[qR]=et[qa]=et[VR]=et[Wp]=et[HR]=et[MA]=!1;var GR=typeof global=="object"&&global&&global.Object===Object&&global,J$=typeof self=="object"&&self&&self.Object===Object&&self,ti=GR||J$||Function("return this")(),kR=typeof al=="object"&&al&&!al.nodeType&&al,_R=kR&&typeof Va=="object"&&Va&&!Va.nodeType&&Va,QR=_R&&_R.exports===kR,RA=QR&&GR.process,IR=function(){try{return RA&&RA.binding&&RA.binding("util")}catch{}}(),SR=IR&&IR.isTypedArray;function X$(t,e){for(var r=-1,n=t==null?0:t.length,i=0,s=[];++r-1}function xK(t,e){var r=this.__data__,n=Zp(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}ri.prototype.clear=IK;ri.prototype.delete=SK;ri.prototype.get=CK;ri.prototype.has=TK;ri.prototype.set=xK;function Ws(t){var e=-1,r=t==null?0:t.length;for(this.clear();++ea))return!1;var l=s.get(t);if(l&&s.get(e))return l==e;var f=-1,d=!0,g=r&RR?new Kp:void 0;for(s.set(t,e),s.set(e,t);++f-1&&t%1==0&&t-1&&t%1==0&&t<=BR}function e8(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}function ll(t){return t!=null&&typeof t=="object"}var t8=SR?rK(SR):QK;function sY(t){return nY(t)?HK(t):WK(t)}function oY(){return[]}function aY(){return!1}Va.exports=iY});var o6=m(me=>{"use strict";c();Object.defineProperty(me,"__esModule",{value:!0});var $s=kn(),uY=CO(),dl=jO(),We=Sv(),ii=Gv(),n8=(Ld(),ut(r2)),cY=(CD(),ut(SD)),ee=rl(),lY=($1(),ut(z1)),je=Ls(),fY=(fR(),ut(lR)),vr=(ol(),ut(Jt)),hY=(AR(),ut(vR)),dY=r8();function pg(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}function pY(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 gY=pg($s),yY=pg(uY),tg=pY(cY),mY=pg(hY),EY=pg(dY);function wY(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,S=new Uint8Array(I);F!==_;){for(var R=v[F],B=0,b=I-1;(R!==0||B>>0,S[b]=R%a>>>0,R=R/a>>>0;if(R!==0)throw new Error("Non-zero carry");O=B,F++}for(var C=I-O;C!==I&&S[C]===0;)C++;for(var L=u.repeat(N);C>>0,I=new Uint8Array(_);v[N];){var S=r[v.charCodeAt(N)];if(S===255)return;for(var R=0,B=_-1;(S!==0||R>>0,I[B]=S%256>>>0,S=S/256>>>0;if(S!==0)throw new Error("Non-zero carry");F=R,N++}if(v[N]!==" "){for(var b=_-F;b!==_&&I[b]===0;)b++;for(var C=new Uint8Array(O+(_-b)),L=O;b!==_;)C[L++]=I[b++];return C}}}function E(v){var N=g(v);if(N)return N;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:g,decode:E}}var vY=wY,AY=vY,v8=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")},bY=t=>new TextEncoder().encode(t),_Y=t=>new TextDecoder().decode(t),WA=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")}},zA=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 A8(this,e)}},$A=class{constructor(e){this.decoders=e}or(e){return A8(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`)}},A8=(t,e)=>new $A({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),KA=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new WA(e,r,n),this.decoder=new zA(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},gg=({name:t,prefix:e,encode:r,decode:n})=>new KA(t,e,r,n),pl=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=AY(r,e);return gg({prefix:t,name:e,encode:n,decode:s=>v8(i(s))})},IY=(t,e,r,n)=>{let i={};for(let f=0;f=8&&(a-=8,o[l++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},SY=(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<gg({prefix:e,name:t,encode(i){return SY(i,n,r)},decode(i){return IY(i,n,r,t)}}),CY=gg({prefix:"\0",name:"identity",encode:t=>_Y(t),decode:t=>bY(t)}),TY=Object.freeze({__proto__:null,identity:CY}),xY=Gt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),NY=Object.freeze({__proto__:null,base2:xY}),OY=Gt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),DY=Object.freeze({__proto__:null,base8:OY}),PY=pl({prefix:"9",name:"base10",alphabet:"0123456789"}),RY=Object.freeze({__proto__:null,base10:PY}),BY=Gt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),LY=Gt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),FY=Object.freeze({__proto__:null,base16:BY,base16upper:LY}),MY=Gt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),UY=Gt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),qY=Gt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),VY=Gt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),HY=Gt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),jY=Gt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),GY=Gt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),kY=Gt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),QY=Gt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),WY=Object.freeze({__proto__:null,base32:MY,base32upper:UY,base32pad:qY,base32padupper:VY,base32hex:HY,base32hexupper:jY,base32hexpad:GY,base32hexpadupper:kY,base32z:QY}),zY=pl({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),$Y=pl({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),KY=Object.freeze({__proto__:null,base36:zY,base36upper:$Y}),YY=pl({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),JY=pl({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),XY=Object.freeze({__proto__:null,base58btc:YY,base58flickr:JY}),ZY=Gt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),eJ=Gt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),tJ=Gt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),rJ=Gt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),nJ=Object.freeze({__proto__:null,base64:ZY,base64pad:eJ,base64url:tJ,base64urlpad:rJ}),b8=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}"),iJ=b8.reduce((t,e,r)=>(t[r]=e,t),[]),sJ=b8.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function oJ(t){return t.reduce((e,r)=>(e+=iJ[r],e),"")}function aJ(t){let e=[];for(let r of t){let n=sJ[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var uJ=gg({prefix:"\u{1F680}",name:"base256emoji",encode:oJ,decode:aJ}),cJ=Object.freeze({__proto__:null,base256emoji:uJ}),lJ=_8,i8=128,fJ=127,hJ=~fJ,dJ=Math.pow(2,31);function _8(t,e,r){e=e||[],r=r||0;for(var n=r;t>=dJ;)e[r++]=t&255|i8,t/=128;for(;t&hJ;)e[r++]=t&255|i8,t>>>=7;return e[r]=t|0,_8.bytes=r-n+1,e}var pJ=YA,gJ=128,s8=127;function YA(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw YA.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&s8)<=gJ);return YA.bytes=s-n,r}var yJ=Math.pow(2,7),mJ=Math.pow(2,14),EJ=Math.pow(2,21),wJ=Math.pow(2,28),vJ=Math.pow(2,35),AJ=Math.pow(2,42),bJ=Math.pow(2,49),_J=Math.pow(2,56),IJ=Math.pow(2,63),SJ=function(t){return t(I8.encode(t,e,r),e),a8=t=>I8.encodingLength(t),JA=(t,e)=>{let r=e.byteLength,n=a8(t),i=n+a8(r),s=new Uint8Array(i+r);return o8(t,s,0),o8(r,s,n),s.set(e,i),new XA(t,r,e,s)},XA=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}},S8=({name:t,code:e,encode:r})=>new ZA(t,e,r),ZA=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?JA(this.code,r):r.then(n=>JA(this.code,n))}else throw Error("Unknown type, must be binary type")}},C8=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),TJ=S8({name:"sha2-256",code:18,encode:C8("SHA-256")}),xJ=S8({name:"sha2-512",code:19,encode:C8("SHA-512")}),NJ=Object.freeze({__proto__:null,sha256:TJ,sha512:xJ}),T8=0,OJ="identity",x8=v8,DJ=t=>JA(T8,x8(t)),PJ={code:T8,name:OJ,encode:x8,digest:DJ},RJ=Object.freeze({__proto__:null,identity:PJ});new TextEncoder,new TextDecoder;var u8={...TY,...NY,...DY,...RY,...FY,...WY,...KY,...XY,...nJ,...cJ};({...NJ,...RJ});function N8(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function BJ(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?N8(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function O8(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var c8=O8("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),kA=O8("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);let e=BJ(t.length);for(let r=0;r{if(!this.initialized){let n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}},this.has=n=>(this.isInitialized(),this.keychain.has(n)),this.set=async(n,i)=>{this.isInitialized(),this.keychain.set(n,i),await this.persist()},this.get=n=>{this.isInitialized();let i=this.keychain.get(n);if(typeof i>"u"){let{message:s}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(s)}return i},this.del=async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()},this.core=e,this.logger=We.generateChildLogger(r,this.name)}get context(){return We.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,ee.mapToObj(e))}async getKeyChain(){let e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?ee.objToMap(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},ig=class{constructor(e,r,n){this.core=e,this.logger=r,this.name=B8,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=ee.generateKeyPair();return this.setPrivateKey(i.publicKey,i.privateKey)},this.signJWT=async i=>{this.isInitialized();let s=await this.getClientSeed(),o=tg.generateKeyPair(s),a=ee.generateRandomBytes32(),u=L8;return await tg.signJWT(a,i,u,o)},this.generateSharedKey=(i,s,o)=>{this.isInitialized();let a=this.getPrivateKey(i),u=ee.deriveSymKey(a,s);return this.setSymKey(u,o)},this.setSymKey=async(i,s)=>{this.isInitialized();let o=s||ee.hashKey(i);return await this.keychain.set(o,i),o},this.deleteKeyPair=async i=>{this.isInitialized(),await this.keychain.del(i)},this.deleteSymKey=async i=>{this.isInitialized(),await this.keychain.del(i)},this.encode=async(i,s,o)=>{this.isInitialized();let a=ee.validateEncoding(o),u=n8.safeJsonStringify(s);if(ee.isTypeOneEnvelope(a)){let g=a.senderPublicKey,E=a.receiverPublicKey;i=await this.generateSharedKey(g,E)}let l=this.getSymKey(i),{type:f,senderPublicKey:d}=a;return ee.encrypt({type:f,symKey:l,message:u,senderPublicKey:d})},this.decode=async(i,s,o)=>{this.isInitialized();let a=ee.validateDecoding(s,o);if(ee.isTypeOneEnvelope(a)){let f=a.receiverPublicKey,d=a.senderPublicKey;i=await this.generateSharedKey(f,d)}let u=this.getSymKey(i),l=ee.decrypt({symKey:u,encoded:s});return n8.safeJsonParse(l)},this.getPayloadType=i=>{let s=ee.deserialize(i);return ee.decodeTypeByte(s.type)},this.getPayloadSenderPublicKey=i=>{let s=ee.deserialize(i);return s.senderPublicKey?lY.toString(s.senderPublicKey,ee.BASE16):void 0},this.core=e,this.logger=We.generateChildLogger(r,this.name),this.keychain=n||new ng(this.core,this.logger)}get context(){return We.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(eb)}catch{e=ee.generateRandomBytes32(),await this.keychain.set(eb,e)}return FJ(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},sg=class extends ii.IMessageTracker{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=U8,this.version=q8,this.initialized=!1,this.storagePrefix=ni,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{let n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}},this.set=async(n,i)=>{this.isInitialized();let s=ee.hashMessage(i),o=this.messages.get(n);return typeof o>"u"&&(o={}),typeof o[s]<"u"||(o[s]=i,this.messages.set(n,o),await this.persist()),s},this.get=n=>{this.isInitialized();let i=this.messages.get(n);return typeof i>"u"&&(i={}),i},this.has=(n,i)=>{this.isInitialized();let s=this.get(n),o=ee.hashMessage(i);return typeof s[o]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=We.generateChildLogger(e,this.name),this.core=r}get context(){return We.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,ee.mapToObj(e))}async getRelayerMessages(){let e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?ee.objToMap(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},nb=class extends ii.IPublisher{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new $s.EventEmitter,this.name=H8,this.queue=new Map,this.publishTimeout=je.toMiliseconds(je.TEN_SECONDS),this.queueTimeout=je.toMiliseconds(je.FIVE_SECONDS),this.needsTransportRestart=!1,this.publish=async(n,i,s)=>{this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}});try{let o=s?.ttl||V8,a=ee.getRelayProtocolName(s),u=s?.prompt||!1,l=s?.tag||0,f=s?.id||vr.getBigIntRpcId().toString(),d={topic:n,message:i,opts:{ttl:o,relay:a,prompt:u,tag:l,id:f}},g=setTimeout(()=>this.queue.set(f,d),this.queueTimeout);try{await await ee.createExpiringPromise(this.rpcPublish(n,i,o,a,u,l,f),this.publishTimeout),clearTimeout(g),this.relayer.events.emit(Pt.publish,d)}catch{this.logger.debug("Publishing Payload stalled"),this.needsTransportRestart=!0;return}this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}})}catch(o){throw this.logger.debug("Failed to Publish Payload"),this.logger.error(o),o}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.relayer=e,this.logger=We.generateChildLogger(r,this.name),this.registerEventListeners()}get context(){return We.getLoggerContext(this.logger)}rpcPublish(e,r,n,i,s,o,a){var u,l,f,d;let g={method:ee.getRelayProtocolApi(i.protocol).publish,params:{topic:e,message:r,ttl:n,prompt:s,tag:o},id:a};return ee.isUndefined((u=g.params)==null?void 0:u.prompt)&&((l=g.params)==null||delete l.prompt),ee.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)}onPublish(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(dl.HEARTBEAT_EVENTS.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(Pt.connection_stalled);return}this.checkQueue()}),this.relayer.on(Pt.message_ack,e=>{this.onPublish(e.id.toString())})}},ib=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())}},HJ=Object.defineProperty,jJ=Object.defineProperties,GJ=Object.getOwnPropertyDescriptors,l8=Object.getOwnPropertySymbols,kJ=Object.prototype.hasOwnProperty,QJ=Object.prototype.propertyIsEnumerable,f8=(t,e,r)=>e in t?HJ(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hl=(t,e)=>{for(var r in e||(e={}))kJ.call(e,r)&&f8(t,r,e[r]);if(l8)for(var r of l8(e))QJ.call(e,r)&&f8(t,r,e[r]);return t},QA=(t,e)=>jJ(t,GJ(e)),og=class extends ii.ISubscriber{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new ib,this.events=new $s.EventEmitter,this.name=J8,this.version=X8,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=ni,this.subscribeTimeout=1e4,this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restart(),this.registerEventListeners(),this.onEnable(),this.clientId=await this.relayer.core.crypto.getClientId())},this.subscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}});try{let s=ee.getRelayProtocolName(i),o={topic:n,relay:s};this.pending.set(n,o);let a=await this.rpcSubscribe(n,s);return this.onSubscribe(a,o),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}}),a}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}},this.unsubscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),typeof i?.id<"u"?await this.unsubscribeById(n,i.id,i):await this.unsubscribeByTopic(n,i)},this.isSubscribed=async n=>this.topics.includes(n)?!0:await new Promise((i,s)=>{let o=new je.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)>=Z8&&(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=We.generateChildLogger(r,this.name),this.clientId=""}get context(){return We.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,r){let n=!1;try{n=this.getSubscription(e).topic===r}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,r){let n=this.topicMap.get(e);await Promise.all(n.map(async i=>await this.unsubscribeById(e,i,r)))}async unsubscribeById(e,r,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}});try{let i=ee.getRelayProtocolName(n);await this.rpcUnsubscribe(e,r,i);let s=ee.getSdkError("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,r,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}})}catch(i){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(i),i}}async rpcSubscribe(e,r){let n={method:ee.getRelayProtocolApi(r.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{await await ee.createExpiringPromise(this.relayer.request(n),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(Pt.connection_stalled)}return ee.hashMessage(e+this.clientId)}async rpcBatchSubscribe(e){if(!e.length)return;let r=e[0].relay,n={method:ee.getRelayProtocolApi(r.protocol).batchSubscribe,params:{topics:e.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await ee.createExpiringPromise(this.relayer.request(n),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Payload stalled"),this.relayer.events.emit(Pt.connection_stalled)}}rpcUnsubscribe(e,r,n){let i={method:ee.getRelayProtocolApi(n.protocol).unsubscribe,params:{topic:e,id:r}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(e,r){this.setSubscription(e,QA(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($r.created,r)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});let r=this.subscriptions.get(e);if(!r){let{message:n}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}deleteSubscription(e,r){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:r});let n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit($r.deleted,QA(hl({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit($r.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}=ee.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;let r=await this.rpcBatchSubscribe(e);ee.isValidArray(r)&&this.onBatchSubscribe(r.map((n,i)=>QA(hl({},e[i]),{id:n})))}async onConnect(){this.restartInProgress||(await this.restart(),this.onEnable())}onDisconnect(){this.onDisable()}async checkPending(){if(this.relayer.transportExplicitlyClosed)return;let e=[];this.pending.forEach(r=>{e.push(r)}),await this.batchSubscribe(e)}registerEventListeners(){this.relayer.core.heartbeat.on(dl.HEARTBEAT_EVENTS.pulse,async()=>{await this.checkPending()}),this.relayer.on(Pt.connect,async()=>{await this.onConnect()}),this.relayer.on(Pt.disconnect,()=>{this.onDisconnect()}),this.events.on($r.created,async e=>{let r=$r.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()}),this.events.on($r.deleted,async e=>{let r=$r.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){this.restartInProgress&&await new Promise(e=>{let r=setInterval(()=>{this.restartInProgress||(clearInterval(r),e())},this.pollingInterval)})}},WJ=Object.defineProperty,h8=Object.getOwnPropertySymbols,zJ=Object.prototype.hasOwnProperty,$J=Object.prototype.propertyIsEnumerable,d8=(t,e,r)=>e in t?WJ(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,KJ=(t,e)=>{for(var r in e||(e={}))zJ.call(e,r)&&d8(t,r,e[r]);if(h8)for(var r of h8(e))$J.call(e,r)&&d8(t,r,e[r]);return t},ag=class extends ii.IRelayer{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new $s.EventEmitter,this.name=k8,this.transportExplicitlyClosed=!1,this.initialized=!1,this.reconnecting=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","socket stalled"],this.request=async r=>{this.logger.debug("Publishing Request Payload");try{return await this.toEstablishConnection(),await this.provider.request(r)}catch(n){throw this.logger.debug("Failed to Publish Request"),this.logger.error(n),n}},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?We.generateChildLogger(e.logger,this.name):We.pino(We.getDefaultLoggerOptions({level:e.logger||G8})),this.messages=new sg(this.logger,e.core),this.subscriber=new og(this,this.logger),this.publisher=new nb(this,this.logger),this.relayUrl=e?.relayUrl||ob,this.projectId=e.projectId,this.provider={}}async init(){this.logger.trace("Initialized"),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 ${tb}...`),await this.restartTransport(tb)}this.registerEventListeners(),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)},$8)}get context(){return We.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])||"";return i||(await Promise.all([new Promise(s=>{this.subscriber.once($r.created,o=>{o.topic===e&&s()})}),new Promise(async s=>{i=await this.subscriber.subscribe(e,r),s()})]),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.connected&&(await this.provider.disconnect(),this.events.emit(Pt.transport_closed))}async transportOpen(e){if(this.transportExplicitlyClosed=!1,!this.reconnecting){this.relayUrl=e||this.relayUrl,this.reconnecting=!0;try{await Promise.all([new Promise(r=>{this.initialized||r(),this.subscriber.once($r.resubscribed,()=>{r()})}),await Promise.race([new Promise(async(r,n)=>{await ee.createExpiringPromise(this.provider.connect(),5e3,`Socket stalled when trying to connect to ${this.relayUrl}`).catch(i=>n(i)).then(()=>r()).finally(()=>this.removeListener(Pt.transport_closed,this.rejectTransportOpen))}),new Promise(r=>this.once(Pt.transport_closed,this.rejectTransportOpen))])])}catch(r){this.logger.error(r);let n=r;if(!this.isConnectionStalled(n.message))throw r;this.events.emit(Pt.transport_closed)}finally{this.reconnecting=!1}}}async restartTransport(e){this.transportExplicitlyClosed||this.reconnecting||(this.relayUrl=e||this.relayUrl,this.connected&&await Promise.all([new Promise(r=>{this.provider.once(ja.disconnect,()=>{r()})}),this.transportClose()]),await this.createProvider(),await this.transportOpen())}isConnectionStalled(e){return this.staleConnectionErrors.some(r=>e.includes(r))}rejectTransportOpen(){throw new Error("Attempt to connect to relay via `transportOpen` has stalled. Retrying...")}async createProvider(){let e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new fY.JsonRpcProvider(new mY.default(ee.formatRelayRpcUrl({sdkVersion:z8,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0}))),this.registerProviderListeners()}async recordMessageEvent(e){let{topic:r,message:n}=e;await this.messages.set(r,n)}async shouldIgnoreMessageEvent(e){let{topic:r,message:n}=e;return await this.subscriber.isSubscribed(r)?this.messages.has(r,n):!0}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),vr.isJsonRpcRequest(e)){if(!e.method.endsWith(Q8))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(KJ({type:"event",event:r.id},o)),this.events.emit(r.id,o),await this.acknowledgePayload(e),await this.onMessageEvent(o)}else vr.isJsonRpcResponse(e)&&this.events.emit(Pt.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(Pt.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){let r=vr.formatJsonRpcResult(e.id,!0);await this.provider.connection.send(r)}registerProviderListeners(){this.provider.on(ja.payload,e=>this.onProviderPayload(e)),this.provider.on(ja.connect,()=>{this.events.emit(Pt.connect)}),this.provider.on(ja.disconnect,()=>{this.onProviderDisconnect()}),this.provider.on(ja.error,e=>{this.logger.error(e),this.events.emit(Pt.error,e)})}registerEventListeners(){this.events.on(Pt.connection_stalled,async()=>{await this.restartTransport()})}onProviderDisconnect(){this.events.emit(Pt.disconnect),this.attemptToReconnect()}attemptToReconnect(){this.transportExplicitlyClosed||setTimeout(async()=>{await this.restartTransport()},je.toMiliseconds(W8))}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){if(!this.connected){if(this.connecting)return await new Promise(e=>{let r=setInterval(()=>{this.connected&&(clearInterval(r),e())},this.connectionStatusPollingInterval)});await this.restartTransport()}}},YJ=Object.defineProperty,p8=Object.getOwnPropertySymbols,JJ=Object.prototype.hasOwnProperty,XJ=Object.prototype.propertyIsEnumerable,g8=(t,e,r)=>e in t?YJ(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,y8=(t,e)=>{for(var r in e||(e={}))JJ.call(e,r)&&g8(t,r,e[r]);if(p8)for(var r of p8(e))XJ.call(e,r)&&g8(t,r,e[r]);return t},ug=class extends ii.IStore{constructor(e,r,n,i=ni,s=void 0){super(e,r,n,i),this.core=e,this.logger=r,this.name=n,this.map=new Map,this.version=K8,this.cached=[],this.initialized=!1,this.storagePrefix=ni,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!ee.isUndefined(o)?this.map.set(this.getKey(o),o):ee.isProposalStruct(o)?this.map.set(o.id,o):ee.isSessionStruct(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)},this.set=async(o,a)=>{this.isInitialized(),this.map.has(o)?await this.update(o,a):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:a}),this.map.set(o,a),await this.persist())},this.get=o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o)),this.getAll=o=>(this.isInitialized(),o?this.values.filter(a=>Object.keys(o).every(u=>EY.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=y8(y8({},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=We.generateChildLogger(r,this.name),this.storagePrefix=i,this.getKey=s}get context(){return We.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){let r=this.map.get(e);if(!r){let{message:n}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}async persist(){await this.setDataStore(this.values)}async restore(){try{let e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){let{message:r}=ee.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},cg=class{constructor(e,r){this.core=e,this.logger=r,this.name=e6,this.version=t6,this.events=new gY.default,this.initialized=!1,this.storagePrefix=ni,this.ignoredPayloadTypes=[ee.TYPE_1],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]},this.create=async()=>{this.isInitialized();let n=ee.generateRandomBytes32(),i=await this.core.crypto.setSymKey(n),s=ee.calcExpiry(je.FIVE_MINUTES),o={protocol:j8},a={topic:i,expiry:s,relay:o,active:!1},u=ee.formatUri({protocol:this.core.protocol,version:this.core.version,topic:i,symKey:n,relay:o});return await this.pairings.set(i,a),await this.core.relayer.subscribe(i),this.core.expirer.set(i,s),{topic:i,uri:u}},this.pair=async n=>{this.isInitialized(),this.isValidPair(n);let{topic:i,symKey:s,relay:o}=ee.parseUri(n.uri);if(this.pairings.keys.includes(i))throw new Error(`Pairing already exists: ${i}`);if(this.core.crypto.hasKeys(i))throw new Error(`Keychain already exists: ${i}`);let a=ee.calcExpiry(je.FIVE_MINUTES),u={topic:i,relay:o,expiry:a,active:!1};return await this.pairings.set(i,u),await this.core.crypto.setSymKey(s,i),await this.core.relayer.subscribe(i,{relay:o}),this.core.expirer.set(i,a),n.activatePairing&&await this.activate({topic:i}),u},this.activate=async({topic:n})=>{this.isInitialized();let i=ee.calcExpiry(je.THIRTY_DAYS);await this.pairings.update(n,{active:!0,expiry:i}),this.core.expirer.set(n,i)},this.ping=async n=>{this.isInitialized(),await this.isValidPing(n);let{topic:i}=n;if(this.pairings.keys.includes(i)){let s=await this.sendRequest(i,"wc_pairingPing",{}),{done:o,resolve:a,reject:u}=ee.createDelayedPromise();this.events.once(ee.engineEvent("pairing_ping",s),({error:l})=>{l?u(l):a()}),await o()}},this.updateExpiry=async({topic:n,expiry:i})=>{this.isInitialized(),await this.pairings.update(n,{expiry:i})},this.updateMetadata=async({topic:n,metadata:i})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:i})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async n=>{this.isInitialized(),await this.isValidDisconnect(n);let{topic:i}=n;this.pairings.keys.includes(i)&&(await this.sendRequest(i,"wc_pairingDelete",ee.getSdkError("USER_DISCONNECTED")),await this.deletePairing(i))},this.sendRequest=async(n,i,s)=>{let o=vr.formatJsonRpcRequest(i,s),a=await this.core.crypto.encode(n,o),u=Ga[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=vr.formatJsonRpcResult(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=Ga[u.request.method].res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.sendError=async(n,i,s)=>{let o=vr.formatJsonRpcError(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=Ga[u.request.method]?Ga[u.request.method].res:Ga.unregistered_method.res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.deletePairing=async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,ee.getSdkError("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),i?Promise.resolve():this.core.expirer.del(n)])},this.cleanup=async()=>{let n=this.pairings.getAll().filter(i=>ee.isExpired(i.expiry));await Promise.all(n.map(i=>this.deletePairing(i.topic)))},this.onRelayEventRequest=n=>{let{topic:i,payload:s}=n,o=s.method;if(this.pairings.keys.includes(i))switch(o){case"wc_pairingPing":return this.onPairingPingRequest(i,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(i,s);default:return this.onUnknownRpcMethodRequest(i,s)}},this.onRelayEventResponse=async n=>{let{topic:i,payload:s}=n,o=(await this.core.history.get(i,s.id)).request.method;if(this.pairings.keys.includes(i))switch(o){case"wc_pairingPing":return this.onPairingPingResponse(i,s);default:return this.onUnknownRpcMethodResponse(o)}},this.onPairingPingRequest=async(n,i)=>{let{id:s}=i;try{this.isValidPing({topic:n}),await this.sendResult(s,n,!0),this.events.emit("pairing_ping",{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onPairingPingResponse=(n,i)=>{let{id:s}=i;setTimeout(()=>{vr.isJsonRpcResult(i)?this.events.emit(ee.engineEvent("pairing_ping",s),{}):vr.isJsonRpcError(i)&&this.events.emit(ee.engineEvent("pairing_ping",s),{error:i.error})},500)},this.onPairingDeleteRequest=async(n,i)=>{let{id:s}=i;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit("pairing_delete",{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onUnknownRpcMethodRequest=async(n,i)=>{let{id:s,method:o}=i;try{if(this.registeredMethods.includes(o))return;let a=ee.getSdkError("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,n,a),this.logger.error(a)}catch(a){await this.sendError(s,n,a),this.logger.error(a)}},this.onUnknownRpcMethodResponse=n=>{this.registeredMethods.includes(n)||this.logger.error(ee.getSdkError("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=n=>{if(!ee.isValidParams(n)){let{message:i}=ee.getInternalError("MISSING_OR_INVALID",`pair() params: ${n}`);throw new Error(i)}if(!ee.isValidUrl(n.uri)){let{message:i}=ee.getInternalError("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw new Error(i)}},this.isValidPing=async n=>{if(!ee.isValidParams(n)){let{message:s}=ee.getInternalError("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}let{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidDisconnect=async n=>{if(!ee.isValidParams(n)){let{message:s}=ee.getInternalError("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}let{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidPairingTopic=async n=>{if(!ee.isValidString(n,!1)){let{message:i}=ee.getInternalError("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){let{message:i}=ee.getInternalError("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(ee.isExpired(this.pairings.get(n).expiry)){await this.deletePairing(n);let{message:i}=ee.getInternalError("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}},this.core=e,this.logger=We.generateChildLogger(r,this.name),this.pairings=new ug(this.core,this.logger,this.name,this.storagePrefix)}get context(){return We.getLoggerContext(this.logger)}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(Pt.message,async e=>{let{topic:r,message:n}=e;if(this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;let i=await this.core.crypto.decode(r,n);vr.isJsonRpcRequest(i)?(this.core.history.set(r,i),this.onRelayEventRequest({topic:r,payload:i})):vr.isJsonRpcResponse(i)&&(await this.core.history.resolve(i),await this.onRelayEventResponse({topic:r,payload:i}),this.core.history.delete(r,i.id))})}registerExpirerEvents(){this.core.expirer.on(Mr.expired,async e=>{let{topic:r}=ee.parseExpirerTarget(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit("pairing_expire",{topic:r}))})}},lg=class extends ii.IJsonRpcHistory{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new $s.EventEmitter,this.name=r6,this.version=n6,this.cached=[],this.initialized=!1,this.storagePrefix=ni,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:ee.calcExpiry(je.THIRTY_DAYS)};this.records.set(o.id,o),this.events.emit(zr.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=vr.isJsonRpcError(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.events.emit(zr.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(zr.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=We.generateChildLogger(r,this.name)}get context(){return We.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){let e=[];return this.values.forEach(r=>{if(typeof r.response<"u")return;let n={topic:r.topic,request:vr.formatJsonRpcRequest(r.request.method,r.request.params,r.id),chainId:r.chainId};return e.push(n)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();let r=this.records.get(e);if(!r){let{message:n}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(zr.sync)}async restore(){try{let e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){let{message:r}=ee.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(zr.created,e=>{let r=zr.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.events.on(zr.updated,e=>{let r=zr.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.events.on(zr.deleted,e=>{let r=zr.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.core.heartbeat.on(dl.HEARTBEAT_EVENTS.pulse,()=>{this.cleanup()})}cleanup(){try{this.records.forEach(e=>{je.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}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},fg=class extends ii.IExpirer{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new $s.EventEmitter,this.name=i6,this.version=s6,this.cached=[],this.initialized=!1,this.storagePrefix=ni,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(Mr.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(Mr.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=We.generateChildLogger(r,this.name)}get context(){return We.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return ee.formatTopicTarget(e);if(typeof e=="number")return ee.formatIdTarget(e);let{message:r}=ee.getInternalError("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(r)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(Mr.sync)}async restore(){try{let e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){let{message:r}=ee.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){let r=this.expirations.get(e);if(!r){let{message:n}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}checkExpiry(e,r){let{expiry:n}=r;je.toMiliseconds(n)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(Mr.expired,{target:e,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(dl.HEARTBEAT_EVENTS.pulse,()=>this.checkExpirations()),this.events.on(Mr.created,e=>{let r=Mr.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Mr.expired,e=>{let r=Mr.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Mr.deleted,e=>{let r=Mr.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},hg=class extends ii.IVerify{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.name=rg,this.initialized=!1,this.init=async n=>{ee.isReactNative()||!ee.isBrowser()||(this.verifyUrl=n?.verifyUrl||rb,await this.createIframe())},this.register=async n=>{var i;if(this.initialized||await this.init(),!!this.iframe)try{(i=this.iframe.contentWindow)==null||i.postMessage(n.attestationId,this.verifyUrl),this.logger.info(`postMessage sent: ${n.attestationId} ${this.verifyUrl}`)}catch{}},this.resolve=async n=>{var i;if(this.isDevEnv)return"";this.logger.info(`resolving attestation: ${n.attestationId}`);let s=this.startAbortTimer(je.FIVE_SECONDS),o=await fetch(`${this.verifyUrl}/attestation/${n.attestationId}`,{signal:this.abortController.signal});return clearTimeout(s),o.status===200?(i=await o.json())==null?void 0:i.origin:""},this.createIframe=async()=>{try{await Promise.race([new Promise((n,i)=>{if(document.getElementById(rg))return n();let s=document.createElement("iframe");s.setAttribute("id",rg),s.setAttribute("src",`${this.verifyUrl}/${this.projectId}`),s.style.display="none",s.addEventListener("load",()=>{this.initialized=!0,n()}),s.addEventListener("error",o=>{i(o)}),document.body.append(s),this.iframe=s}),new Promise(n=>{setTimeout(()=>n("iframe load timeout"),je.toMiliseconds(je.ONE_SECOND/2))})])}catch(n){this.logger.error(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.error(n)}},this.logger=We.generateChildLogger(r,this.name),this.verifyUrl=rb,this.abortController=new AbortController,this.isDevEnv=ee.isNode()&&p.default.env.IS_VITEST}get context(){return We.getLoggerContext(this.logger)}startAbortTimer(e){return setTimeout(()=>this.abortController.abort(),je.toMiliseconds(e))}},ZJ=Object.defineProperty,m8=Object.getOwnPropertySymbols,eX=Object.prototype.hasOwnProperty,tX=Object.prototype.propertyIsEnumerable,E8=(t,e,r)=>e in t?ZJ(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,w8=(t,e)=>{for(var r in e||(e={}))eX.call(e,r)&&E8(t,r,e[r]);if(m8)for(var r of m8(e))tX.call(e,r)&&E8(t,r,e[r]);return t},dg=class t extends ii.ICore{constructor(e){super(e),this.protocol=sb,this.version=D8,this.name=yg,this.events=new $s.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||ob;let r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:We.pino(We.getDefaultLoggerOptions({level:e?.logger||P8.logger}));this.logger=We.generateChildLogger(r,this.name),this.heartbeat=new dl.HeartBeat,this.crypto=new ig(this,this.logger,e?.keychain),this.history=new lg(this,this.logger),this.expirer=new fg(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new yY.default(w8(w8({},R8),e?.storageOptions)),this.relayer=new ag({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new cg(this,this.logger),this.verify=new hg(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(Y8,n),r}get context(){return We.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}}},rX=dg;me.CORE_CONTEXT=yg,me.CORE_DEFAULT=P8,me.CORE_PROTOCOL=sb,me.CORE_STORAGE_OPTIONS=R8,me.CORE_STORAGE_PREFIX=ni,me.CORE_VERSION=D8,me.CRYPTO_CLIENT_SEED=eb,me.CRYPTO_CONTEXT=B8,me.CRYPTO_JWT_TTL=L8,me.Core=rX,me.Crypto=ig,me.EXPIRER_CONTEXT=i6,me.EXPIRER_DEFAULT_TTL=VJ,me.EXPIRER_EVENTS=Mr,me.EXPIRER_STORAGE_VERSION=s6,me.Expirer=fg,me.HISTORY_CONTEXT=r6,me.HISTORY_EVENTS=zr,me.HISTORY_STORAGE_VERSION=n6,me.JsonRpcHistory=lg,me.KEYCHAIN_CONTEXT=F8,me.KEYCHAIN_STORAGE_VERSION=M8,me.KeyChain=ng,me.MESSAGES_CONTEXT=U8,me.MESSAGES_STORAGE_VERSION=q8,me.MessageTracker=sg,me.PAIRING_CONTEXT=e6,me.PAIRING_DEFAULT_TTL=qJ,me.PAIRING_RPC_OPTS=Ga,me.PAIRING_STORAGE_VERSION=t6,me.PENDING_SUB_RESOLUTION_TIMEOUT=Z8,me.PUBLISHER_CONTEXT=H8,me.PUBLISHER_DEFAULT_TTL=V8,me.Pairing=cg,me.RELAYER_CONTEXT=k8,me.RELAYER_DEFAULT_LOGGER=G8,me.RELAYER_DEFAULT_PROTOCOL=j8,me.RELAYER_DEFAULT_RELAY_URL=ob,me.RELAYER_EVENTS=Pt,me.RELAYER_FAILOVER_RELAY_URL=tb,me.RELAYER_PROVIDER_EVENTS=ja,me.RELAYER_RECONNECT_TIMEOUT=W8,me.RELAYER_SDK_VERSION=z8,me.RELAYER_STORAGE_OPTIONS=MJ,me.RELAYER_SUBSCRIBER_SUFFIX=Q8,me.RELAYER_TRANSPORT_CUTOFF=$8,me.Relayer=ag,me.STORE_STORAGE_VERSION=K8,me.SUBSCRIBER_CONTEXT=J8,me.SUBSCRIBER_DEFAULT_TTL=UJ,me.SUBSCRIBER_EVENTS=$r,me.SUBSCRIBER_STORAGE_VERSION=X8,me.Store=ug,me.Subscriber=og,me.VERIFY_CONTEXT=rg,me.VERIFY_SERVER=rb,me.Verify=hg,me.WALLETCONNECT_CLIENT_ID=Y8,me.default=dg});var E6=m(tt=>{"use strict";c();Object.defineProperty(tt,"__esModule",{value:!0});var xn=o6(),mg=Sv(),c6=Gv(),Q=rl(),l6=kn(),ct=Ls(),St=(ol(),ut(Jt));function nX(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var iX=nX(l6),hb="wc",db=2,pb="client",Ag=`${hb}@${db}:${pb}:`,Eg={name:pb,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},sX={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"},oX={database:":memory:"},f6="WALLETCONNECT_DEEPLINK_CHOICE",aX={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},uX="history",cX="0.3",h6="proposal",lX=ct.THIRTY_DAYS,d6="Proposal expired",p6="session",gl=ct.SEVEN_DAYS,g6="engine",ka={wc_sessionPropose:{req:{ttl:ct.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:ct.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:ct.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:ct.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:ct.ONE_DAY,prompt:!1,tag:1104},res:{ttl:ct.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:ct.ONE_DAY,prompt:!1,tag:1106},res:{ttl:ct.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:ct.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:ct.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:ct.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:ct.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:ct.ONE_DAY,prompt:!1,tag:1112},res:{ttl:ct.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:ct.THIRTY_SECONDS,prompt:!1,tag:1114},res:{ttl:ct.THIRTY_SECONDS,prompt:!1,tag:1115}}},wg={min:ct.FIVE_MINUTES,max:ct.SEVEN_DAYS},y6="request",m6=["wc_sessionPropose","wc_sessionRequest","wc_authRequest"],fX=Object.defineProperty,hX=Object.defineProperties,dX=Object.getOwnPropertyDescriptors,a6=Object.getOwnPropertySymbols,pX=Object.prototype.hasOwnProperty,gX=Object.prototype.propertyIsEnumerable,u6=(t,e,r)=>e in t?fX(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Ur=(t,e)=>{for(var r in e||(e={}))pX.call(e,r)&&u6(t,r,e[r]);if(a6)for(var r of a6(e))gX.call(e,r)&&u6(t,r,e[r]);return t},ab=(t,e)=>hX(t,dX(e)),ub=class extends c6.IEngine{constructor(e){super(e),this.name=g6,this.events=new iX.default,this.initialized=!1,this.ignoredPayloadTypes=[Q.TYPE_1],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.client.core.pairing.register({methods:Object.keys(ka)}),this.initialized=!0)},this.connect=async r=>{this.isInitialized();let n=ab(Ur({},r),{requiredNamespaces:r.requiredNamespaces||{},optionalNamespaces:r.optionalNamespaces||{}});await this.isValidConnect(n);let{pairingTopic:i,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:a,relays:u}=n,l=i,f,d=!1;if(l&&(d=this.client.core.pairing.pairings.get(l).active),!l||!d){let{topic:I,uri:S}=await this.client.core.pairing.create();l=I,f=S}let g=await this.client.core.crypto.generateKeyPair(),E=Ur({requiredNamespaces:s,optionalNamespaces:o,relays:u??[{protocol:xn.RELAYER_DEFAULT_PROTOCOL}],proposer:{publicKey:g,metadata:this.client.metadata}},a&&{sessionProperties:a}),{reject:v,resolve:N,done:O}=Q.createDelayedPromise(ct.FIVE_MINUTES,d6);if(this.events.once(Q.engineEvent("session_connect"),async({error:I,session:S})=>{if(I)v(I);else if(S){S.self.publicKey=g;let R=ab(Ur({},S),{requiredNamespaces:S.requiredNamespaces,optionalNamespaces:S.optionalNamespaces});await this.client.session.set(S.topic,R),await this.setExpiry(S.topic,S.expiry),l&&await this.client.core.pairing.updateMetadata({topic:l,metadata:S.peer.metadata}),N(R)}}),!l){let{message:I}=Q.getInternalError("NO_MATCHING_KEY",`connect() pairing topic: ${l}`);throw new Error(I)}let F=await this.sendRequest(l,"wc_sessionPropose",E),_=Q.calcExpiry(ct.FIVE_MINUTES);return await this.setProposal(F,Ur({id:F,expiry:_},E)),{uri:f,approval:O}},this.pair=async r=>(this.isInitialized(),await this.client.core.pairing.pair(r)),this.approve=async r=>{this.isInitialized(),await this.isValidApprove(r);let{id:n,relayProtocol:i,namespaces:s,sessionProperties:o}=r,a=this.client.proposal.get(n),{pairingTopic:u,proposer:l,requiredNamespaces:f,optionalNamespaces:d}=a;u=u||"",Q.isValidObject(f)||(f=Q.getRequiredNamespacesFromNamespaces(s,"approve()"));let g=await this.client.core.crypto.generateKeyPair(),E=l.publicKey,v=await this.client.core.crypto.generateSharedKey(g,E);u&&n&&(await this.client.core.pairing.updateMetadata({topic:u,metadata:l.metadata}),await this.sendResult(n,u,{relay:{protocol:i??"irn"},responderPublicKey:g}),await this.client.proposal.delete(n,Q.getSdkError("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:u}));let N=Ur({relay:{protocol:i??"irn"},namespaces:s,requiredNamespaces:f,optionalNamespaces:d,pairingTopic:u,controller:{publicKey:g,metadata:this.client.metadata},expiry:Q.calcExpiry(gl)},o&&{sessionProperties:o});await this.client.core.relayer.subscribe(v),await this.sendRequest(v,"wc_sessionSettle",N);let O=ab(Ur({},N),{topic:v,pairingTopic:u,acknowledged:!1,self:N.controller,peer:{publicKey:l.publicKey,metadata:l.metadata},controller:g});return await this.client.session.set(v,O),await this.setExpiry(v,Q.calcExpiry(gl)),{topic:v,acknowledged:()=>new Promise(F=>setTimeout(()=>F(this.client.session.get(v)),500))}},this.reject=async r=>{this.isInitialized(),await this.isValidReject(r);let{id:n,reason:i}=r,{pairingTopic:s}=this.client.proposal.get(n);s&&(await this.sendError(n,s,i),await this.client.proposal.delete(n,Q.getSdkError("USER_DISCONNECTED")))},this.update=async r=>{this.isInitialized(),await this.isValidUpdate(r);let{topic:n,namespaces:i}=r,s=await this.sendRequest(n,"wc_sessionUpdate",{namespaces:i}),{done:o,resolve:a,reject:u}=Q.createDelayedPromise();return this.events.once(Q.engineEvent("session_update",s),({error:l})=>{l?u(l):a()}),await this.client.session.update(n,{namespaces:i}),{acknowledged:o}},this.extend=async r=>{this.isInitialized(),await this.isValidExtend(r);let{topic:n}=r,i=await this.sendRequest(n,"wc_sessionExtend",{}),{done:s,resolve:o,reject:a}=Q.createDelayedPromise();return this.events.once(Q.engineEvent("session_extend",i),({error:u})=>{u?a(u):o()}),await this.setExpiry(n,Q.calcExpiry(gl)),{acknowledged:s}},this.request=async r=>{this.isInitialized(),await this.isValidRequest(r);let{chainId:n,request:i,topic:s,expiry:o}=r,a=await this.sendRequest(s,"wc_sessionRequest",{request:i,chainId:n},o),{done:u,resolve:l,reject:f}=Q.createDelayedPromise(o);this.events.once(Q.engineEvent("session_request",a),({error:g,result:E})=>{g?f(g):l(E)}),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:a});let d=await this.client.core.storage.getItem(f6);return Q.handleDeeplinkRedirect({id:a,topic:s,wcDeepLink:d}),await u()},this.respond=async r=>{this.isInitialized(),await this.isValidRespond(r);let{topic:n,response:i}=r,{id:s}=i;St.isJsonRpcResult(i)?await this.sendResult(s,n,i.result):St.isJsonRpcError(i)&&await this.sendError(s,n,i.error),this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0})},this.ping=async r=>{this.isInitialized(),await this.isValidPing(r);let{topic:n}=r;if(this.client.session.keys.includes(n)){let i=await this.sendRequest(n,"wc_sessionPing",{}),{done:s,resolve:o,reject:a}=Q.createDelayedPromise();this.events.once(Q.engineEvent("session_ping",i),({error:u})=>{u?a(u):o()}),await s()}else this.client.core.pairing.pairings.keys.includes(n)&&await this.client.core.pairing.ping({topic:n})},this.emit=async r=>{this.isInitialized(),await this.isValidEmit(r);let{topic:n,event:i,chainId:s}=r;await this.sendRequest(n,"wc_sessionEvent",{event:i,chainId:s})},this.disconnect=async r=>{this.isInitialized(),await this.isValidDisconnect(r);let{topic:n}=r;if(this.client.session.keys.includes(n)){let i=St.getBigIntRpcId().toString(),s,o=a=>{a?.id.toString()===i&&(this.client.core.relayer.events.removeListener(xn.RELAYER_EVENTS.message_ack,o),s())};await Promise.all([new Promise(a=>{s=a,this.client.core.relayer.on(xn.RELAYER_EVENTS.message_ack,o)}),this.sendRequest(n,"wc_sessionDelete",Q.getSdkError("USER_DISCONNECTED"),void 0,i)]),await this.deleteSession(n)}else await this.client.core.pairing.disconnect({topic:n})},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(n=>Q.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,Q.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.deleteProposal=async(r,n)=>{await Promise.all([this.client.proposal.delete(r,Q.getSdkError("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(r)])},this.deletePendingSessionRequest=async(r,n,i=!1)=>{await Promise.all([this.client.pendingRequest.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)])},this.setExpiry=async(r,n)=>{this.client.session.keys.includes(r)&&await this.client.session.update(r,{expiry:n}),this.client.core.expirer.set(r,n)},this.setProposal=async(r,n)=>{await this.client.proposal.set(r,n),this.client.core.expirer.set(r,n.expiry)},this.setPendingSessionRequest=async r=>{let n=ka.wc_sessionRequest.req.ttl,{id:i,topic:s,params:o}=r;await this.client.pendingRequest.set(i,{id:i,topic:s,params:o}),n&&this.client.core.expirer.set(i,Q.calcExpiry(n))},this.sendRequest=async(r,n,i,s,o)=>{let a=St.formatJsonRpcRequest(n,i);if(Q.isBrowser()&&m6.includes(n)){let f=Q.hashMessage(JSON.stringify(a));await this.client.core.verify.register({attestationId:f})}let u=await this.client.core.crypto.encode(r,a),l=ka[n].req;return s&&(l.ttl=s),o&&(l.id=o),this.client.core.history.set(r,a),this.client.core.relayer.publish(r,u,l),a.id},this.sendResult=async(r,n,i)=>{let s=St.formatJsonRpcResult(r,i),o=await this.client.core.crypto.encode(n,s),a=await this.client.core.history.get(n,r),u=ka[a.request.method].res;this.client.core.relayer.publish(n,o,u),await this.client.core.history.resolve(s)},this.sendError=async(r,n,i)=>{let s=St.formatJsonRpcError(r,i),o=await this.client.core.crypto.encode(n,s),a=await this.client.core.history.get(n,r),u=ka[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=>{Q.isExpired(i.expiry)&&r.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{Q.isExpired(i.expiry)&&n.push(i.id)}),await Promise.all([...r.map(i=>this.deleteSession(i)),...n.map(i=>this.deleteProposal(i))])},this.onRelayEventRequest=r=>{let{topic:n,payload:i}=r,s=i.method;switch(s){case"wc_sessionPropose":return this.onSessionProposeRequest(n,i);case"wc_sessionSettle":return this.onSessionSettleRequest(n,i);case"wc_sessionUpdate":return this.onSessionUpdateRequest(n,i);case"wc_sessionExtend":return this.onSessionExtendRequest(n,i);case"wc_sessionPing":return this.onSessionPingRequest(n,i);case"wc_sessionDelete":return this.onSessionDeleteRequest(n,i);case"wc_sessionRequest":return this.onSessionRequest(n,i);case"wc_sessionEvent":return this.onSessionEventRequest(n,i);default:return this.client.logger.info(`Unsupported request method ${s}`)}},this.onRelayEventResponse=async r=>{let{topic:n,payload:i}=r,s=(await this.client.core.history.get(n,i.id)).request.method;switch(s){case"wc_sessionPropose":return this.onSessionProposeResponse(n,i);case"wc_sessionSettle":return this.onSessionSettleResponse(n,i);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,i);case"wc_sessionExtend":return this.onSessionExtendResponse(n,i);case"wc_sessionPing":return this.onSessionPingResponse(n,i);case"wc_sessionRequest":return this.onSessionRequestResponse(n,i);default:return this.client.logger.info(`Unsupported response method ${s}`)}},this.onRelayEventUnknownPayload=r=>{let{topic:n}=r,{message:i}=Q.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(Ur({},n.params));let o=Q.calcExpiry(ct.FIVE_MINUTES),a=Ur({id:s,pairingTopic:r,expiry:o},i);await this.setProposal(s,a);let u=Q.hashMessage(JSON.stringify(n)),l=await this.getVerifyContext(u,a.proposer.metadata);this.client.events.emit("session_proposal",{id:s,params:a,verifyContext:l})}catch(o){await this.sendError(s,r,o),this.client.logger.error(o)}},this.onSessionProposeResponse=async(r,n)=>{let{id:i}=n;if(St.isJsonRpcResult(n)){let{result:s}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:s});let o=this.client.proposal.get(i);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:o});let a=o.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:a});let u=s.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:u});let l=await this.client.core.crypto.generateSharedKey(a,u);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:l});let f=await this.client.core.relayer.subscribe(l);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:f}),await this.client.core.pairing.activate({topic:r})}else St.isJsonRpcError(n)&&(await this.client.proposal.delete(i,Q.getSdkError("USER_DISCONNECTED")),this.events.emit(Q.engineEvent("session_connect"),{error:n.error}))},this.onSessionSettleRequest=async(r,n)=>{let{id:i,params:s}=n;try{this.isValidSessionSettleRequest(s);let{relay:o,controller:a,expiry:u,namespaces:l,requiredNamespaces:f,optionalNamespaces:d,sessionProperties:g,pairingTopic:E}=n.params,v=Ur({topic:r,relay:o,expiry:u,namespaces:l,acknowledged:!0,pairingTopic:E,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(n.id,r,!0),this.events.emit(Q.engineEvent("session_connect"),{session:v}),this.cleanupDuplicatePairings(v)}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.onSessionSettleResponse=async(r,n)=>{let{id:i}=n;St.isJsonRpcResult(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(Q.engineEvent("session_approve",i),{})):St.isJsonRpcError(n)&&(await this.client.session.delete(r,Q.getSdkError("USER_DISCONNECTED")),this.events.emit(Q.engineEvent("session_approve",i),{error:n.error}))},this.onSessionUpdateRequest=async(r,n)=>{let{params:i,id:s}=n;try{this.isValidUpdate(Ur({topic:r},i)),await this.client.session.update(r,{namespaces:i.namespaces}),await this.sendResult(s,r,!0),this.client.events.emit("session_update",{id:s,topic:r,params:i})}catch(o){await this.sendError(s,r,o),this.client.logger.error(o)}},this.onSessionUpdateResponse=(r,n)=>{let{id:i}=n;St.isJsonRpcResult(n)?this.events.emit(Q.engineEvent("session_update",i),{}):St.isJsonRpcError(n)&&this.events.emit(Q.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,Q.calcExpiry(gl)),await this.sendResult(i,r,!0),this.client.events.emit("session_extend",{id:i,topic:r})}catch(s){await this.sendError(i,r,s),this.client.logger.error(s)}},this.onSessionExtendResponse=(r,n)=>{let{id:i}=n;St.isJsonRpcResult(n)?this.events.emit(Q.engineEvent("session_extend",i),{}):St.isJsonRpcError(n)&&this.events.emit(Q.engineEvent("session_extend",i),{error:n.error})},this.onSessionPingRequest=async(r,n)=>{let{id:i}=n;try{this.isValidPing({topic:r}),await this.sendResult(i,r,!0),this.client.events.emit("session_ping",{id:i,topic:r})}catch(s){await this.sendError(i,r,s),this.client.logger.error(s)}},this.onSessionPingResponse=(r,n)=>{let{id:i}=n;setTimeout(()=>{St.isJsonRpcResult(n)?this.events.emit(Q.engineEvent("session_ping",i),{}):St.isJsonRpcError(n)&&this.events.emit(Q.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(xn.RELAYER_EVENTS.publish,async()=>{s(await this.deleteSession(r))})}),this.sendResult(i,r,!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(Ur({topic:r},s)),await this.setPendingSessionRequest({id:i,topic:r,params:s});let o=Q.hashMessage(JSON.stringify(n)),a=this.client.session.get(r),u=await this.getVerifyContext(o,a.peer.metadata);this.client.events.emit("session_request",{id:i,topic:r,params:s,verifyContext:u})}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.onSessionRequestResponse=(r,n)=>{let{id:i}=n;St.isJsonRpcResult(n)?this.events.emit(Q.engineEvent("session_request",i),{result:n.result}):St.isJsonRpcError(n)&&this.events.emit(Q.engineEvent("session_request",i),{error:n.error})},this.onSessionEventRequest=async(r,n)=>{let{id:i,params:s}=n;try{this.isValidEmit(Ur({topic:r},s)),this.client.events.emit("session_event",{id:i,topic:r,params:s})}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.isValidConnect=async r=>{if(!Q.isValidParams(r)){let{message:u}=Q.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(Q.isUndefined(n)||await this.isValidPairingTopic(n),!Q.isValidRelays(a,!0)){let{message:u}=Q.getInternalError("MISSING_OR_INVALID",`connect() relays: ${a}`);throw new Error(u)}!Q.isUndefined(i)&&Q.isValidObject(i)!==0&&this.validateNamespaces(i,"requiredNamespaces"),!Q.isUndefined(s)&&Q.isValidObject(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),Q.isUndefined(o)||this.validateSessionProps(o,"sessionProperties")},this.validateNamespaces=(r,n)=>{let i=Q.isValidRequiredNamespaces(r,"connect()",n);if(i)throw new Error(i.message)},this.isValidApprove=async r=>{if(!Q.isValidParams(r))throw new Error(Q.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=Q.isValidNamespaces(i,"approve()");if(u)throw new Error(u.message);let l=Q.isConformingNamespaces(a.requiredNamespaces,i,"approve()");if(l)throw new Error(l.message);if(!Q.isValidString(s,!0)){let{message:f}=Q.getInternalError("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(f)}Q.isUndefined(o)||this.validateSessionProps(o,"sessionProperties")},this.isValidReject=async r=>{if(!Q.isValidParams(r)){let{message:s}=Q.getInternalError("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(s)}let{id:n,reason:i}=r;if(await this.isValidProposalId(n),!Q.isValidErrorReason(i)){let{message:s}=Q.getInternalError("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidSessionSettleRequest=r=>{if(!Q.isValidParams(r)){let{message:l}=Q.getInternalError("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(l)}let{relay:n,controller:i,namespaces:s,expiry:o}=r;if(!Q.isValidRelay(n)){let{message:l}=Q.getInternalError("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(l)}let a=Q.isValidController(i,"onSessionSettleRequest()");if(a)throw new Error(a.message);let u=Q.isValidNamespaces(s,"onSessionSettleRequest()");if(u)throw new Error(u.message);if(Q.isExpired(o)){let{message:l}=Q.getInternalError("EXPIRED","onSessionSettleRequest()");throw new Error(l)}},this.isValidUpdate=async r=>{if(!Q.isValidParams(r)){let{message:u}=Q.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=Q.isValidNamespaces(i,"update()");if(o)throw new Error(o.message);let a=Q.isConformingNamespaces(s.requiredNamespaces,i,"update()");if(a)throw new Error(a.message)},this.isValidExtend=async r=>{if(!Q.isValidParams(r)){let{message:i}=Q.getInternalError("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionTopic(n)},this.isValidRequest=async r=>{if(!Q.isValidParams(r)){let{message:u}=Q.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(!Q.isValidNamespacesChainId(a,s)){let{message:u}=Q.getInternalError("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(u)}if(!Q.isValidRequest(i)){let{message:u}=Q.getInternalError("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(u)}if(!Q.isValidNamespacesRequest(a,s,i.method)){let{message:u}=Q.getInternalError("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(u)}if(o&&!Q.isValidRequestExpiry(o,wg)){let{message:u}=Q.getInternalError("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${wg.min} and ${wg.max}`);throw new Error(u)}},this.isValidRespond=async r=>{if(!Q.isValidParams(r)){let{message:s}=Q.getInternalError("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(s)}let{topic:n,response:i}=r;if(await this.isValidSessionTopic(n),!Q.isValidResponse(i)){let{message:s}=Q.getInternalError("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidPing=async r=>{if(!Q.isValidParams(r)){let{message:i}=Q.getInternalError("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async r=>{if(!Q.isValidParams(r)){let{message:a}=Q.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(!Q.isValidNamespacesChainId(o,s)){let{message:a}=Q.getInternalError("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(a)}if(!Q.isValidEvent(i)){let{message:a}=Q.getInternalError("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}if(!Q.isValidNamespacesEvent(o,s,i.name)){let{message:a}=Q.getInternalError("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}},this.isValidDisconnect=async r=>{if(!Q.isValidParams(r)){let{message:i}=Q.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||"",validation:"UNKNOWN",origin:n.url||""}};try{let s=await this.client.core.verify.resolve({attestationId:r,verifyUrl:n.verifyUrl});s&&(i.verified.origin=s,i.verified.validation=s===n.url?"VALID":"INVALID")}catch(s){this.client.logger.error(s)}return this.client.logger.info(`Verify context: ${JSON.stringify(i)}`),i},this.validateSessionProps=(r,n)=>{Object.values(r).forEach(i=>{if(!Q.isValidString(i,!1)){let{message:s}=Q.getInternalError("MISSING_OR_INVALID",`${n} must be in Record format. Received: ${JSON.stringify(i)}`);throw new Error(s)}})}}isInitialized(){if(!this.initialized){let{message:e}=Q.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.client.core.relayer.on(xn.RELAYER_EVENTS.message,async e=>{let{topic:r,message:n}=e;if(this.ignoredPayloadTypes.includes(this.client.core.crypto.getPayloadType(n)))return;let i=await this.client.core.crypto.decode(r,n);St.isJsonRpcRequest(i)?(this.client.core.history.set(r,i),this.onRelayEventRequest({topic:r,payload:i})):St.isJsonRpcResponse(i)?(await this.client.core.history.resolve(i),await this.onRelayEventResponse({topic:r,payload:i}),this.client.core.history.delete(r,i.id)):this.onRelayEventUnknownPayload({topic:r,payload:i})})}registerExpirerEvents(){this.client.core.expirer.on(xn.EXPIRER_EVENTS.expired,async e=>{let{topic:r,id:n}=Q.parseExpirerTarget(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,Q.getInternalError("EXPIRED"),!0);r?this.client.session.keys.includes(r)&&(await this.deleteSession(r,!0),this.client.events.emit("session_expire",{topic:r})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}isValidPairingTopic(e){if(!Q.isValidString(e,!1)){let{message:r}=Q.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}=Q.getInternalError("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(Q.isExpired(this.client.core.pairing.pairings.get(e).expiry)){let{message:r}=Q.getInternalError("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!Q.isValidString(e,!1)){let{message:r}=Q.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}=Q.getInternalError("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(Q.isExpired(this.client.session.get(e).expiry)){await this.deleteSession(e);let{message:r}=Q.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(Q.isValidString(e,!1)){let{message:r}=Q.getInternalError("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{let{message:r}=Q.getInternalError("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!Q.isValidId(e)){let{message:r}=Q.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}=Q.getInternalError("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(Q.isExpired(this.client.proposal.get(e).expiry)){await this.deleteProposal(e);let{message:r}=Q.getInternalError("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}},cb=class extends xn.Store{constructor(e,r){super(e,r,h6,Ag),this.core=e,this.logger=r}},lb=class extends xn.Store{constructor(e,r){super(e,r,p6,Ag),this.core=e,this.logger=r}},fb=class extends xn.Store{constructor(e,r){super(e,r,y6,Ag,n=>n.id),this.core=e,this.logger=r}},vg=class t extends c6.ISignClient{constructor(e){super(e),this.protocol=hb,this.version=db,this.name=Eg.name,this.events=new l6.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||Eg.name,this.metadata=e?.metadata||Q.getAppMetadata();let r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:mg.pino(mg.getDefaultLoggerOptions({level:e?.logger||Eg.logger}));this.core=e?.core||new xn.Core(e),this.logger=mg.generateChildLogger(r,this.name),this.session=new lb(this.core,this.logger),this.proposal=new cb(this.core,this.logger),this.pendingRequest=new fb(this.core,this.logger),this.engine=new ub(this)}static async init(e){let r=new t(e);return await r.initialize(),r}get context(){return mg.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}}},yX=vg;tt.ENGINE_CONTEXT=g6,tt.ENGINE_RPC_OPTS=ka,tt.HISTORY_CONTEXT=uX,tt.HISTORY_EVENTS=aX,tt.HISTORY_STORAGE_VERSION=cX,tt.METHODS_TO_VERIFY=m6,tt.PROPOSAL_CONTEXT=h6,tt.PROPOSAL_EXPIRY=lX,tt.PROPOSAL_EXPIRY_MESSAGE=d6,tt.REQUEST_CONTEXT=y6,tt.SESSION_CONTEXT=p6,tt.SESSION_EXPIRY=gl,tt.SESSION_REQUEST_EXPIRY_BOUNDARIES=wg,tt.SIGN_CLIENT_CONTEXT=pb,tt.SIGN_CLIENT_DEFAULT=Eg,tt.SIGN_CLIENT_EVENTS=sX,tt.SIGN_CLIENT_PROTOCOL=hb,tt.SIGN_CLIENT_STORAGE_OPTIONS=oX,tt.SIGN_CLIENT_STORAGE_PREFIX=Ag,tt.SIGN_CLIENT_VERSION=db,tt.SignClient=yX,tt.WALLETCONNECT_DEEPLINK_CHOICE=f6,tt.default=vg});var bg=m(Qi=>{"use strict";c();Object.defineProperty(Qi,"__esModule",{value:!0});Qi.OptionalOperation=Qi.Operation=void 0;var mX;(function(t){t.SIGN_TRANSACTION="mvx_signTransaction",t.SIGN_TRANSACTIONS="mvx_signTransactions",t.SIGN_MESSAGE="mvx_signMessage"})(mX=Qi.Operation||(Qi.Operation={}));var EX;(function(t){t.SIGN_LOGIN_TOKEN="mvx_signLoginToken",t.SIGN_NATIVE_AUTH_TOKEN="mvx_signNativeAuthToken",t.CANCEL_ACTION="mvx_cancelAction"})(EX=Qi.OptionalOperation||(Qi.OptionalOperation={}))});var gb=m(Wi=>{"use strict";c();Object.defineProperty(Wi,"__esModule",{value:!0});Wi.WALLETCONNECT_MULTIVERSX_OPTIONAL_METHODS=Wi.WALLETCONNECT_MULTIVERSX_METHODS=Wi.WALLETCONNECT_MULTIVERSX_NAMESPACE=void 0;var w6=bg();Wi.WALLETCONNECT_MULTIVERSX_NAMESPACE="mvx";Wi.WALLETCONNECT_MULTIVERSX_METHODS=Object.values(w6.Operation);Wi.WALLETCONNECT_MULTIVERSX_OPTIONAL_METHODS=Object.values(w6.OptionalOperation)});var Eb=m(Kr=>{"use strict";c();Object.defineProperty(Kr,"__esModule",{value:!0});Kr.WalletConnectV2ProviderErrorMessagesEnum=Kr.ErrBadAddress=Kr.ErrNotImplemented=Kr.Err=void 0;var yl=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};Kr.Err=yl;var yb=class extends yl{constructor(){super("Method not yet implemented")}};Kr.ErrNotImplemented=yb;var mb=class extends yl{constructor(e,r){super(`Bad address: ${e}`,r)}};Kr.ErrBadAddress=mb;var wX;(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"})(wX=Kr.WalletConnectV2ProviderErrorMessagesEnum||(Kr.WalletConnectV2ProviderErrorMessagesEnum={}))});var vb=m(_g=>{"use strict";c();Object.defineProperty(_g,"__esModule",{value:!0});_g.Logger=void 0;var wb=class{static error(e){console.error(e)}static trace(e){console.trace(e)}};_g.Logger=wb});var v6=m(()=>{"use strict";c();global.Buffer||(global.Buffer=_s().Buffer)});var b6=m(A6=>{"use strict";c();Object.defineProperty(A6,"__esModule",{value:!0})});var I6=m(_6=>{"use strict";c();Object.defineProperty(_6,"__esModule",{value:!0})});var S6=m(Qa=>{"use strict";c();var vX=Qa&&Qa.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Qa,"__esModule",{value:!0});Qa.RelayedTransactionV1Builder=void 0;var AX=vX(jt()),Ab=yt(),bX=Be(),_X=yn(),IX=qn(),bb=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 bX.ErrInvalidRelayedV1BuilderArguments;let e=this.prepareInnerTransaction(),r=`relayedTx@${h.Buffer.from(e).toString("hex")}`,n=new IX.TransactionPayload(r),i=this.netConfig.MinGasLimit+this.netConfig.GasPerDataByte*n.length()+this.innerTransaction.getGasLimit().valueOf(),s=new _X.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 Ab.Address(this.innerTransaction.getSender().bech32()).pubkey().toString("base64"),receiver:new Ab.Address(this.innerTransaction.getReceiver().bech32()).pubkey().toString("base64"),value:new AX.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 Ab.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)}};Qa.RelayedTransactionV1Builder=bb});var C6=m(Ig=>{"use strict";c();Object.defineProperty(Ig,"__esModule",{value:!0});Ig.Code=void 0;var _b=class t{constructor(e){this.hex=e}static fromBuffer(e){return new t(e.toString("hex"))}toString(){return this.hex}valueOf(){return h.Buffer.from(this.hex,"hex")}};Ig.Code=_b});var x6=m(T6=>{"use strict";c();Object.defineProperty(T6,"__esModule",{value:!0})});var P6=m(za=>{"use strict";c();Object.defineProperty(za,"__esModule",{value:!0});za.bech32m=za.bech32=void 0;var Sg="qpzry9x8gf2tvdw0s3jn54khce6mua7l",O6={};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 N6(t){let e=1;for(let r=0;r126)return"Invalid prefix ("+t+")";e=Wa(e)^n>>5}e=Wa(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 l=N6(o);if(typeof l=="string")throw new Error(l);let f=o+"1";for(let d=0;d>5)throw new Error("Non 5-bit word");l=Wa(l)^g,f+=Sg.charAt(g)}for(let d=0;d<6;++d)l=Wa(l);l^=e;for(let d=0;d<6;++d){let g=l>>(5-d)*5&31;f+=Sg.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(),l=o.toUpperCase();if(o!==u&&o!==l)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 E=N6(d);if(typeof E=="string")return E;let v=[];for(let N=0;N=g.length)&&v.push(F)}return E!==e?"Invalid checksum for "+o:{prefix:d,words:v}}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:SX,fromWordsUnsafe:CX,fromWords:TX}}za.bech32=D6("bech32");za.bech32m=D6("bech32m")});var B6=m(qr=>{"use strict";c();Object.defineProperty(qr,"__esModule",{value:!0});qr.TokenTransferProperties=qr.TransactionMetadataTransfer=qr.TransactionMetadata=qr.TransactionToDecode=qr.TransactionDecoder=void 0;var R6=P6(),Sb=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 Ks;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 Cg;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 Ks;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 Ks;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 Ks;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=R6.bech32.toWords(r);return R6.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)}};qr.TransactionDecoder=Sb;var Cg=class{constructor(){this.sender="",this.receiver="",this.data="",this.value="0"}};qr.TransactionToDecode=Cg;var Ks=class{constructor(){this.sender="",this.receiver="",this.value=BigInt(0)}};qr.TransactionMetadata=Ks;var Cb=class{constructor(){this.value=BigInt(0)}};qr.TransactionMetadataTransfer=Cb;var Tb=class{};qr.TokenTransferProperties=Tb});var xb=m(Tg=>{"use strict";c();Object.defineProperty(Tg,"__esModule",{value:!0});Tg.ReturnCode=void 0;var Ge=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)}};Tg.ReturnCode=Ge;Ge.None=new Ge("");Ge.Ok=new Ge("ok");Ge.FunctionNotFound=new Ge("function not found");Ge.FunctionWrongSignature=new Ge("wrong signature for function");Ge.ContractNotFound=new Ge("contract not found");Ge.UserError=new Ge("user error");Ge.OutOfGas=new Ge("out of gas");Ge.AccountCollision=new Ge("account collision");Ge.OutOfFunds=new Ge("out of funds");Ge.CallStackOverFlow=new Ge("call stack overflow");Ge.ContractInvalid=new Ge("contract invalid");Ge.ExecutionFailed=new Ge("execution failed");Ge.Unknown=new Ge("unknown")});var M6=m(xg=>{"use strict";c();Object.defineProperty(xg,"__esModule",{value:!0});xg.ResultsParser=void 0;var xX=B6(),L6=yt(),F6=Be(),zi=Yo(),NX=Vo(),$a=xb(),Ka;(function(t){t.OnTransactionCompleted="completedTxEvent",t.OnSignalError="signalError",t.OnWriteLog="writeLog"})(Ka||(Ka={}));var Nb;(function(t){t.TooMuchGas="@too much gas provided for processing"})(Nb||(Nb={}));var OX={argsSerializer:new NX.ArgSerializer},Ob=class{constructor(e){e=Object.assign(Object.assign({},OX),e),this.argsSerializer=e.argsSerializer}parseQueryResponse(e,r){let n=e.getReturnDataParts(),i=this.argsSerializer.buffersToValues(n,r.output);return{returnCode:new $a.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 $a.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 zi.Logger.trace("parseUntypedOutcome(): on simple move balance"),r;if(r=this.createBundleOnInvalidTransaction(e),r)return zi.Logger.trace("parseUntypedOutcome(): on invalid transaction"),r;if(r=this.createBundleOnEasilyFoundResultWithReturnData(e.contractResults),r)return zi.Logger.trace("parseUntypedOutcome(): on easily found result with return data"),r;if(r=this.createBundleOnSignalError(e.logs),r)return zi.Logger.trace("parseUntypedOutcome(): on signal error"),r;if(r=this.createBundleOnTooMuchGasWarning(e.logs),r)return zi.Logger.trace("parseUntypedOutcome(): on 'too much gas' warning"),r;if(r=this.createBundleOnWriteLogWhereFirstTopicEqualsAddress(e.logs,e.sender),r)return zi.Logger.trace("parseUntypedOutcome(): on writelog with topics[0] == tx.sender"),r;if(r=this.createBundleWithCustomHeuristics(e,n),r)return zi.Logger.trace("parseUntypedOutcome(): with custom heuristics"),r;if(r=this.createBundleWithFallbackHeuristics(e,n),r)return zi.Logger.trace("parseUntypedOutcome(): with fallback heuristics"),r;throw new F6.ErrCannotParseContractResults(`transaction ${e.hash.toString()}`)}parseTransactionMetadata(e){return new xX.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:$a.ReturnCode.None,returnMessage:$a.ReturnCode.None.toString(),values:[]}:null}createBundleOnInvalidTransaction(e){return e.status.isInvalid()&&e.receipt.data?{returnCode:$a.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(Ka.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(Ka.OnWriteLog,a=>a.findFirstOrNoneTopic(u=>u.toString().startsWith(Nb.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 L6.Address(r.bech32()).hex(),i=e.findSingleOrNoneEvent(Ka.OnWriteLog,u=>u.findFirstOrNoneTopic(l=>l.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 L6.Address(r.receiver);for(let i of e.contractResults.items){let s=i.logs.findSingleOrNoneEvent(Ka.OnWriteLog,o=>{var a;let u=o.address.bech32()==e.sender.bech32(),l=((a=o.topics[0])===null||a===void 0?void 0:a.hex())==n.hex();return u&&l});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 F6.ErrCannotParseContractResults("no return code");return{returnCode:$a.ReturnCode.fromBuffer(i),returnDataParts:s}}};xg.ResultsParser=Ob});var Db=m(vt=>{"use strict";c();var DX=vt&&vt.__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]}),rr=vt&&vt.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&DX(e,t,r)};Object.defineProperty(vt,"__esModule",{value:!0});rr(Vo(),vt);rr(C6(),vt);rr(tE(),vt);rr(YE(),vt);rr(fc(),vt);rr(sw(),vt);rr(ew(),vt);rr(x6(),vt);rr(aw(),vt);rr(hc(),vt);rr(M6(),vt);rr(xb(),vt);rr(Jw(),vt);rr(pw(),vt);rr(Ot(),vt)});var q6=m(Ng=>{"use strict";c();Object.defineProperty(Ng,"__esModule",{value:!0});Ng.RelayedTransactionV2Builder=void 0;var U6=Be(),ml=Db(),PX=yn(),RX=qn(),Pb=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 U6.ErrInvalidRelayedV2BuilderArguments;if(this.innerTransaction.getGasLimit()!=0)throw new U6.ErrGasLimitShouldBe0ForInnerTransaction;let{argumentsString:e}=new ml.ArgSerializer().valuesToString([new ml.AddressValue(this.innerTransaction.getReceiver()),new ml.U64Value(this.innerTransaction.getNonce().valueOf()),new ml.BytesValue(this.innerTransaction.getData().valueOf()),new ml.BytesValue(this.innerTransaction.getSignature())]),r=`relayedTxV2@${e}`,n=new RX.TransactionPayload(r),i=new PX.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}};Ng.RelayedTransactionV2Builder=Pb});var V6=m(Ys=>{"use strict";c();Object.defineProperty(Ys,"__esModule",{value:!0});Ys.SignableMessage=Ys.MESSAGE_PREFIX=void 0;var BX=yt(),LX=zw();Ys.MESSAGE_PREFIX=`Elrond Signed Message: +`;var Rb=class{constructor(e){this.message=h.Buffer.from([]),this.signature=h.Buffer.from([]),this.version=1,this.signer="ErdJS",this.address=new BX.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(Ys.MESSAGE_PREFIX),r]);return LX("keccak256").update(n).digest()}serializeForSigningRaw(){return h.Buffer.concat([this.getMessageSize(),this.message])}getSignature(){return this.signature}applySignature(e){e instanceof h.Buffer?this.signature=e:this.signature=h.Buffer.from(e.hex(),"hex")}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}}};Ys.SignableMessage=Rb});var Lb=m(ot=>{"use strict";c();var FX=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]}),MX=ot&&ot.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),H6=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)&&FX(e,t,r);return MX(e,t),e},UX=ot&&ot.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ot,"__esModule",{value:!0});ot.addressToHex=ot.bufferToHex=ot.utf8ToHex=ot.bigIntToHex=ot.bigIntToBuffer=ot.bufferToBigInt=ot.stringToBuffer=void 0;var qX=UX(jt()),VX=yt(),Bb=H6(tc()),j6=H6(rh());function HX(t){return h.Buffer.from(t)}ot.stringToBuffer=HX;function jX(t){return t.length==0?new qX.default(0):Bb.bufferToBigInt(t)}ot.bufferToBigInt=jX;function GX(t){return t==0?h.Buffer.from([]):Bb.bigIntToBuffer(t)}ot.bigIntToBuffer=GX;function kX(t){return t==0?"":Bb.getHexMagnitudeOfBigInt(t)}ot.bigIntToHex=kX;function QX(t){let e=h.Buffer.from(t).toString("hex");return j6.zeroPadStringIfOddLength(e)}ot.utf8ToHex=QX;function WX(t){let e=t.toString("hex");return j6.zeroPadStringIfOddLength(e)}ot.bufferToHex=WX;function zX(t){return VX.Address.fromBech32(t.toString()).pubkey().toString("hex")}ot.addressToHex=zX});var k6=m(Og=>{"use strict";c();Object.defineProperty(Og,"__esModule",{value:!0});Og.TokenOperationsFactory=void 0;var Fb=ps(),$X=Yo(),G6=Th(),KX=yn(),YX=qn(),ne=Lb(),Mb=class{constructor(e){this.config=e,this.trueAsHex=ne.utf8ToHex("true")}issueFungible(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["issue",ne.utf8ToHex(e.tokenName),ne.utf8ToHex(e.tokenTicker),ne.bigIntToHex(e.initialSupply),ne.bigIntToHex(e.numDecimals),...e.canFreeze?[ne.utf8ToHex("canFreeze"),this.trueAsHex]:[],...e.canWipe?[ne.utf8ToHex("canWipe"),this.trueAsHex]:[],...e.canPause?[ne.utf8ToHex("canPause"),this.trueAsHex]:[],...e.canChangeOwner?[ne.utf8ToHex("canChangeOwner"),this.trueAsHex]:[],...e.canUpgrade?[ne.utf8ToHex("canUpgrade"),this.trueAsHex]:[],...e.canAddSpecialRoles?[ne.utf8ToHex("canAddSpecialRoles"),this.trueAsHex]:[]];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(){$X.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),...e.canFreeze?[ne.utf8ToHex("canFreeze"),this.trueAsHex]:[],...e.canWipe?[ne.utf8ToHex("canWipe"),this.trueAsHex]:[],...e.canPause?[ne.utf8ToHex("canPause"),this.trueAsHex]:[],...e.canTransferNFTCreateRole?[ne.utf8ToHex("canTransferNFTCreateRole"),this.trueAsHex]:[],...e.canChangeOwner?[ne.utf8ToHex("canChangeOwner"),this.trueAsHex]:[],...e.canUpgrade?[ne.utf8ToHex("canUpgrade"),this.trueAsHex]:[],...e.canAddSpecialRoles?[ne.utf8ToHex("canAddSpecialRoles"),this.trueAsHex]:[]];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),...e.canFreeze?[ne.utf8ToHex("canFreeze"),this.trueAsHex]:[],...e.canWipe?[ne.utf8ToHex("canWipe"),this.trueAsHex]:[],...e.canPause?[ne.utf8ToHex("canPause"),this.trueAsHex]:[],...e.canTransferNFTCreateRole?[ne.utf8ToHex("canTransferNFTCreateRole"),this.trueAsHex]:[],...e.canChangeOwner?[ne.utf8ToHex("canChangeOwner"),this.trueAsHex]:[],...e.canUpgrade?[ne.utf8ToHex("canUpgrade"),this.trueAsHex]:[],...e.canAddSpecialRoles?[ne.utf8ToHex("canAddSpecialRoles"),this.trueAsHex]:[]];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),...e.canFreeze?[ne.utf8ToHex("canFreeze"),this.trueAsHex]:[],...e.canWipe?[ne.utf8ToHex("canWipe"),this.trueAsHex]:[],...e.canPause?[ne.utf8ToHex("canPause"),this.trueAsHex]:[],...e.canTransferNFTCreateRole?[ne.utf8ToHex("canTransferNFTCreateRole"),this.trueAsHex]:[],...e.canChangeOwner?[ne.utf8ToHex("canChangeOwner"),this.trueAsHex]:[],...e.canUpgrade?[ne.utf8ToHex("canUpgrade"),this.trueAsHex]:[],...e.canAddSpecialRoles?[ne.utf8ToHex("canAddSpecialRoles"),this.trueAsHex]:[]];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 l=this.buildTransactionPayload(u),f=o||this.computeGasLimit(l,a),d=new G6.TransactionVersion(Fb.TRANSACTION_VERSION_DEFAULT),g=new G6.TransactionOptions(Fb.TRANSACTION_OPTIONS_DEFAULT);return new KX.Transaction({chainID:this.config.chainID,sender:e,receiver:r,gasLimit:f,gasPrice:s,nonce:n||0,value:i||0,data:l,version:d,options:g})}buildTransactionPayload(e){let r=e.join(Fb.ARGUMENTS_SEPARATOR);return new YX.TransactionPayload(r)}computeGasLimit(e,r){return this.config.minGasLimit.valueOf()+this.config.gasLimitPerByte.valueOf()*e.length()+r.valueOf()}};Og.TokenOperationsFactory=Mb});var Q6=m(Dg=>{"use strict";c();Object.defineProperty(Dg,"__esModule",{value:!0});Dg.TokenOperationsFactoryConfig=void 0;var JX=yt(),Ub=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=JX.Address.fromBech32("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u"),this.chainID=e}};Dg.TokenOperationsFactoryConfig=Ub});var z6=m(Pg=>{"use strict";c();Object.defineProperty(Pg,"__esModule",{value:!0});Pg.TokenOperationsOutcomeParser=void 0;var XX=yt(),qb=Be(),W6=Lb(),Vb=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 qb.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 qb.ErrCannotParseTransactionOutcome(e.hash,`cannot find event of type ${r}`);if(n.length>1)throw new qb.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 W6.bufferToBigInt((r=e.topics[1])===null||r===void 0?void 0:r.valueOf()).toFixed(0)}extractAmount(e){var r;return W6.bufferToBigInt((r=e.topics[2])===null||r===void 0?void 0:r.valueOf()).toFixed(0)}extractAddress(e){var r;return XX.Address.fromBuffer((r=e.topics[3])===null||r===void 0?void 0:r.valueOf()).toString()}};Pg.TokenOperationsOutcomeParser=Vb});var $6=m(si=>{"use strict";c();var ZX=si&&si.__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]}),Hb=si&&si.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&ZX(e,t,r)};Object.defineProperty(si,"__esModule",{value:!0});Hb(k6(),si);Hb(Q6(),si);Hb(z6(),si)});var K6=m(Je=>{"use strict";c();var eZ=Je&&Je.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ct=Je&&Je.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&eZ(e,t,r)};Object.defineProperty(Je,"__esModule",{value:!0});v6();Ct(Ss(),Je);Ct(yt(),Je);Ct(WE(),Je);Ct(Be(),Je);Ct(jE(),Je);Ct(b6(),Je);Ct(I6(),Je);Ct(Yo(),Je);Ct(Th(),Je);Ct(S6(),Je);Ct(q6(),Je);Ct(V6(),Je);Ct(Db(),Je);Ct($6(),Je);Ct(sm(),Je);Ct(yn(),Je);Ct(qn(),Je);Ct(Gh(),Je);Ct(VE(),Je);Ct(gr(),Je)});var tB=m(Xt=>{"use strict";c();Object.defineProperty(Xt,"__esModule",{value:!0});Xt.getMetadata=Xt.applyTransactionSignature=Xt.getAddressFromSession=Xt.addressIsValid=Xt.getConnectionParams=Xt.getCurrentTopic=Xt.getCurrentSession=void 0;var X6=K6(),Y6=Rh(),tZ=rl(),Rg=gb(),oi=Eb(),jb=vb(),J6=bg();function Z6(t,e){if(!e)throw new Error(oi.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=e.find(eB(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 jb.Logger.error(oi.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),new Error(oi.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected)}Xt.getCurrentSession=Z6;function rZ(t,e){if(!e)throw new Error(oi.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=Z6(t,e);if(!r?.topic)throw new Error(oi.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);return r.topic}Xt.getCurrentTopic=rZ;function eB(t,e){var r,n,i;let s=[...Rg.WALLETCONNECT_MULTIVERSX_METHODS,...(r=e?.methods)!==null&&r!==void 0?r:[]];!((n=e?.methods)===null||n===void 0)&&n.includes(J6.OptionalOperation.SIGN_LOGIN_TOKEN)||s.push(J6.OptionalOperation.SIGN_LOGIN_TOKEN);let o=[`${Rg.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${t}`],a=(i=e?.events)!==null&&i!==void 0?i:[];return{requiredNamespaces:{[Rg.WALLETCONNECT_MULTIVERSX_NAMESPACE]:{methods:s,chains:o,events:a}}}}Xt.getConnectionParams=eB;function nZ(t){try{return!X6.Address.fromBech32(t).isEmpty()}catch{return!1}}Xt.addressIsValid=nZ;function iZ(t){let e=t.namespaces[Rg.WALLETCONNECT_MULTIVERSX_NAMESPACE];if(e&&e.accounts){let r=e.accounts[0],[n,i,s]=r.split(":");return s}return""}Xt.getAddressFromSession=iZ;function sZ({transaction:t,response:e}){if(!e)throw jb.Logger.error(oi.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse),new Error(oi.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse);let{signature:r,guardianSignature:n,version:i,options:s,guardian:o}=e,a=t.getGuardian().bech32();if(a&&a!==o)throw jb.Logger.error(oi.WalletConnectV2ProviderErrorMessagesEnum.invalidGuardian),new Error(oi.WalletConnectV2ProviderErrorMessagesEnum.invalidGuardian);return o&&t.setGuardian(X6.Address.fromBech32(o)),i&&t.setVersion(i),s!=null&&t.setOptions(s),t.applySignature(new Y6.Signature(r)),n&&t.applyGuardianSignature(new Y6.Signature(n)),t}Xt.applyTransactionSignature=sZ;function oZ(t){if(t)return Object.assign(Object.assign({},t),{url:tZ.getAppMetadata().url})}Xt.getMetadata=oZ});var El=m(dr=>{"use strict";c();var At=dr&&dr.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})},aZ=dr&&dr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(dr,"__esModule",{value:!0});dr.WalletConnectV2Provider=dr.OptionalOperation=dr.Operation=dr.WalletConnectV2ProviderErrorMessagesEnum=void 0;var uZ=Rh(),cZ=aZ(E6()),Gb=rl(),Ya=gb(),ye=Eb();Object.defineProperty(dr,"WalletConnectV2ProviderErrorMessagesEnum",{enumerable:!0,get:function(){return ye.WalletConnectV2ProviderErrorMessagesEnum}});var Le=vb(),$i=bg();Object.defineProperty(dr,"Operation",{enumerable:!0,get:function(){return $i.Operation}});Object.defineProperty(dr,"OptionalOperation",{enumerable:!0,get:function(){return $i.OptionalOperation}});var Zt=tB(),kb=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 At(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:Zt.getMetadata((r=this.options)===null||r===void 0?void 0:r.metadata)}:{},i=yield cZ.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(ye.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 At(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=Zt.getConnectionParams(this.chainId,e);try{return yield this.walletConnector.connect(Object.assign({pairingTopic:e?.topic},r))}catch{throw this.reset(),Le.Logger.error(e?.topic?ye.WalletConnectV2ProviderErrorMessagesEnum.unableToConnectExisting:ye.WalletConnectV2ProviderErrorMessagesEnum.unableToConnect),new Error(e?.topic?ye.WalletConnectV2ProviderErrorMessagesEnum.unableToConnectExisting:ye.WalletConnectV2ProviderErrorMessagesEnum.unableToConnect)}})}login(e){var r;return At(this,void 0,void 0,function*(){if(this.isInitializing=!0,typeof this.walletConnector>"u"&&(yield this.connect()),typeof this.walletConnector>"u")throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);typeof this.session<"u"&&(yield this.logout({topic:(r=this.session)===null||r===void 0?void 0:r.topic}));try{if(e&&e.approval){let n=yield e.approval();if(e.token){let i=Zt.getAddressFromSession(n),o=n.namespaces[Ya.WALLETCONNECT_MULTIVERSX_NAMESPACE].methods.includes($i.OptionalOperation.SIGN_NATIVE_AUTH_TOKEN)?$i.OptionalOperation.SIGN_NATIVE_AUTH_TOKEN:$i.OptionalOperation.SIGN_LOGIN_TOKEN,{signature:a}=yield this.walletConnector.request({chainId:`${Ya.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:n.topic,request:{method:o,params:{token:e.token,address:i}}});if(!a)throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToSignLoginToken),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToSignLoginToken);return yield this.onSessionConnected({session:n,signature:a})}return yield this.onSessionConnected({session:n,signature:""})}}catch{throw this.reset(),Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToLogin),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToLogin)}finally{this.isInitializing=!1}return""})}logout(e){return At(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);try{if(this.processingTopic===(e?.topic||Zt.getCurrentTopic(this.chainId,this.walletConnector)))return!0;if(e?.topic)this.processingTopic=e.topic,yield this.walletConnector.disconnect({topic:e.topic,reason:Gb.getSdkError("USER_DISCONNECTED")});else{let r=Zt.getCurrentTopic(this.chainId,this.walletConnector);this.processingTopic=r,yield this.walletConnector.disconnect({topic:r,reason:Gb.getSdkError("USER_DISCONNECTED")}),this.reset(),yield this.cleanupPendingPairings({deletePairings:!0})}}catch{Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.alreadyLoggedOut)}finally{this.processingTopic=""}return!0})}getAddress(){return At(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return this.address})}getSignature(){return At(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return this.signature})}getPairings(){var e,r,n,i,s;return At(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(ye.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 At(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);try{let r=yield this.getAddress(),{signature:n}=yield this.walletConnector.request({chainId:`${Ya.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:Zt.getCurrentTopic(this.chainId,this.walletConnector),request:{method:$i.Operation.SIGN_MESSAGE,params:{address:r,message:e.message.toString()}}});if(!n)throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageResponse),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageResponse);try{e.applySignature(new uZ.Signature(n))}catch{throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageSignature),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageSignature)}}catch{throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToSign)}return e})}signTransaction(e){return At(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let r=e.toPlainObject();if(this.chainId!==e.getChainID().valueOf())throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);try{let n=yield this.walletConnector.request({chainId:`${Ya.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:Zt.getCurrentTopic(this.chainId,this.walletConnector),request:{method:$i.Operation.SIGN_TRANSACTION,params:{transaction:r}}});return Zt.applyTransactionSignature({transaction:e,response:n})}catch{throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.transactionError)}})}signTransactions(e){return At(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let r=e.map(n=>{if(this.chainId!==n.getChainID().valueOf())throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);return n.toPlainObject()});try{let{signatures:n}=yield this.walletConnector.request({chainId:`${Ya.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:Zt.getCurrentTopic(this.chainId,this.walletConnector),request:{method:$i.Operation.SIGN_TRANSACTIONS,params:{transactions:r}}});if(!n)throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse);if(!Array.isArray(n)||e.length!==n.length)throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse);for(let[i,s]of e.entries()){let o=n[i];Zt.applyTransactionSignature({transaction:s,response:o})}return e}catch{throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.transactionError)}})}sendCustomRequest(e){var r;return At(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(ye.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:`${Ya.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:Zt.getCurrentTopic(this.chainId,this.walletConnector),request:Object.assign(Object.assign({},n),{method:i})});s||Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.invalidCustomRequestResponse)}catch{Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.invalidCustomRequestResponse)}return}})}ping(){return At(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);typeof this.session>"u"&&Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);try{let e=Zt.getCurrentTopic(this.chainId,this.walletConnector);return yield this.walletConnector.ping({topic:e}),!0}catch{return Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.pingFailed),!1}})}loginAccount(e){return At(this,void 0,void 0,function*(){return e?Zt.addressIsValid(e.address)?(this.address=e.address,e.signature&&(this.signature=e.signature),this.onClientConnect.onClientLogin(),this.address):(Le.Logger.error(`${ye.WalletConnectV2ProviderErrorMessagesEnum.invalidAddress} ${e.address}`),this.walletConnector&&(yield this.logout()),""):""})}onSessionConnected(e){return At(this,void 0,void 0,function*(){if(!e)return"";this.session=e.session;let r=Zt.getAddressFromSession(e.session);return r?(yield this.loginAccount({address:r,signature:e.signature}),r):""})}handleTopicUpdateEvent({topic:e}){return At(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u"){Le.Logger.error(ye.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{Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleTopic)}finally{this.pairings=yield this.getPairings()}})}handleSessionEvents({topic:e,params:r}){var n;return At(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw new Error(ye.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&&Zt.getCurrentTopic(this.chainId,this.walletConnector)===e){let s=i.data;this.onClientConnect.onClientEvent(s)}})}subscribeToEvents(e){var r,n,i,s;return At(this,void 0,void 0,function*(){if(typeof e>"u")throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);try{e.on("session_update",({topic:o,params:a})=>{var u;if(!this.session||((u=this.session)===null||u===void 0?void 0:u.topic)!==o)return;let{namespaces:l}=a,f=e.session.get(o),d=Object.assign(Object.assign({},f),{namespaces:l});this.onSessionConnected({session:d})}),e.on("session_event",this.handleSessionEvents.bind(this)),e.on("session_delete",({topic:o})=>At(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)&&(Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionDeleted),this.onClientConnect.onClientLogout(),this.reset(),yield this.cleanupPendingPairings({deletePairings:!0}))})),e.on("session_expire",({topic:o})=>At(this,void 0,void 0,function*(){var a;!this.session||((a=this.session)===null||a===void 0?void 0:a.topic)!==o||(Le.Logger.error(ye.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{Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleEvent)}})}checkPersistedState(e){return At(this,void 0,void 0,function*(){if(typeof e>"u")throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(this.pairings=yield this.getPairings(),!(typeof this.session<"u")&&e.session.length&&!this.address&&!this.isInitializing){let r=Zt.getCurrentSession(this.chainId,e);if(r)return yield this.onSessionConnected({session:r}),r}})}cleanupPendingPairings(e={}){var r,n,i,s,o,a,u,l;return At(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(!Gb.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(l=(u=(a=this.walletConnector.core)===null||a===void 0?void 0:a.relayer)===null||u===void 0?void 0:u.subscriber)===null||l===void 0?void 0:l.unsubscribe(d.topic)}catch{Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleCleanup)}}catch{Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleCleanup)}})}};dr.WalletConnectV2Provider=kb});var nB=m((Lge,rB)=>{"use strict";c();rB.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 oB=m((Mge,sB)=>{"use strict";c();var iB=typeof Symbol<"u"&&Symbol,lZ=nB();sB.exports=function(){return typeof iB!="function"||typeof Symbol!="function"||typeof iB("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:lZ()}});var cB=m((qge,uB)=>{"use strict";c();var aB={foo:{}},fZ=Object;uB.exports=function(){return{__proto__:aB}.foo===aB.foo&&!({__proto__:null}instanceof fZ)}});var fB=m((Hge,lB)=>{"use strict";c();var hZ="Function.prototype.bind called on incompatible ",Qb=Array.prototype.slice,dZ=Object.prototype.toString,pZ="[object Function]";lB.exports=function(e){var r=this;if(typeof r!="function"||dZ.call(r)!==pZ)throw new TypeError(hZ+r);for(var n=Qb.call(arguments,1),i,s=function(){if(this instanceof i){var f=r.apply(this,n.concat(Qb.call(arguments)));return Object(f)===f?f:this}else return r.apply(e,n.concat(Qb.call(arguments)))},o=Math.max(0,r.length-n.length),a=[],u=0;u{"use strict";c();var gZ=fB();hB.exports=Function.prototype.bind||gZ});var pB=m((Qge,dB)=>{"use strict";c();var yZ=Bg();dB.exports=yZ.call(Function.call,Object.prototype.hasOwnProperty)});var Mg=m((zge,wB)=>{"use strict";c();var De,eu=SyntaxError,EB=Function,Za=TypeError,Wb=function(t){try{return EB('"use strict"; return ('+t+").constructor;")()}catch{}},Js=Object.getOwnPropertyDescriptor;if(Js)try{Js({},"")}catch{Js=null}var zb=function(){throw new Za},mZ=Js?function(){try{return arguments.callee,zb}catch{try{return Js(arguments,"callee").get}catch{return zb}}}():zb,Ja=oB()(),EZ=cB()(),Mt=Object.getPrototypeOf||(EZ?function(t){return t.__proto__}:null),Xa={},wZ=typeof Uint8Array>"u"||!Mt?De:Mt(Uint8Array),Xs={"%AggregateError%":typeof AggregateError>"u"?De:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?De:ArrayBuffer,"%ArrayIteratorPrototype%":Ja&&Mt?Mt([][Symbol.iterator]()):De,"%AsyncFromSyncIteratorPrototype%":De,"%AsyncFunction%":Xa,"%AsyncGenerator%":Xa,"%AsyncGeneratorFunction%":Xa,"%AsyncIteratorPrototype%":Xa,"%Atomics%":typeof Atomics>"u"?De:Atomics,"%BigInt%":typeof BigInt>"u"?De:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?De:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?De:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?De:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?De:Float32Array,"%Float64Array%":typeof Float64Array>"u"?De:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?De:FinalizationRegistry,"%Function%":EB,"%GeneratorFunction%":Xa,"%Int8Array%":typeof Int8Array>"u"?De:Int8Array,"%Int16Array%":typeof Int16Array>"u"?De:Int16Array,"%Int32Array%":typeof Int32Array>"u"?De:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Ja&&Mt?Mt(Mt([][Symbol.iterator]())):De,"%JSON%":typeof JSON=="object"?JSON:De,"%Map%":typeof Map>"u"?De:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Ja||!Mt?De:Mt(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?De:Promise,"%Proxy%":typeof Proxy>"u"?De:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?De:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?De:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Ja||!Mt?De:Mt(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?De:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Ja&&Mt?Mt(""[Symbol.iterator]()):De,"%Symbol%":Ja?Symbol:De,"%SyntaxError%":eu,"%ThrowTypeError%":mZ,"%TypedArray%":wZ,"%TypeError%":Za,"%Uint8Array%":typeof Uint8Array>"u"?De:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?De:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?De:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?De:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?De:WeakMap,"%WeakRef%":typeof WeakRef>"u"?De:WeakRef,"%WeakSet%":typeof WeakSet>"u"?De:WeakSet};if(Mt)try{null.error}catch(t){gB=Mt(Mt(t)),Xs["%Error.prototype%"]=gB}var gB,vZ=function t(e){var r;if(e==="%AsyncFunction%")r=Wb("async function () {}");else if(e==="%GeneratorFunction%")r=Wb("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=Wb("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=t("%AsyncGenerator%");i&&Mt&&(r=Mt(i.prototype))}return Xs[e]=r,r},yB={"%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"]},wl=Bg(),Lg=pB(),AZ=wl.call(Function.call,Array.prototype.concat),bZ=wl.call(Function.apply,Array.prototype.splice),mB=wl.call(Function.call,String.prototype.replace),Fg=wl.call(Function.call,String.prototype.slice),_Z=wl.call(Function.call,RegExp.prototype.exec),IZ=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,SZ=/\\(\\)?/g,CZ=function(e){var r=Fg(e,0,1),n=Fg(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 mB(e,IZ,function(s,o,a,u){i[i.length]=a?mB(u,SZ,"$1"):o||s}),i},TZ=function(e,r){var n=e,i;if(Lg(yB,n)&&(i=yB[n],n="%"+i[0]+"%"),Lg(Xs,n)){var s=Xs[n];if(s===Xa&&(s=vZ(n)),typeof s>"u"&&!r)throw new Za("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!")};wB.exports=function(e,r){if(typeof e!="string"||e.length===0)throw new Za("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new Za('"allowMissing" argument must be a boolean');if(_Z(/^%?[^%]*%?$/,e)===null)throw new eu("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=CZ(e),i=n.length>0?n[0]:"",s=TZ("%"+i+"%",r),o=s.name,a=s.value,u=!1,l=s.alias;l&&(i=l[0],bZ(n,AZ([0,1],l)));for(var f=1,d=!0;f=n.length){var N=Js(a,g);d=!!N,d&&"get"in N&&!("originalValue"in N.get)?a=N.get:a=a[g]}else d=Lg(a,g),a=a[g];d&&!u&&(Xs[o]=a)}}return a}});var SB=m((Kge,Ug)=>{"use strict";c();var $b=Bg(),tu=Mg(),bB=tu("%Function.prototype.apply%"),_B=tu("%Function.prototype.call%"),IB=tu("%Reflect.apply%",!0)||$b.call(_B,bB),vB=tu("%Object.getOwnPropertyDescriptor%",!0),Zs=tu("%Object.defineProperty%",!0),xZ=tu("%Math.max%");if(Zs)try{Zs({},"a",{value:1})}catch{Zs=null}Ug.exports=function(e){var r=IB($b,_B,arguments);if(vB&&Zs){var n=vB(r,"length");n.configurable&&Zs(r,"length",{value:1+xZ(0,e.length-(arguments.length-1))})}return r};var AB=function(){return IB($b,bB,arguments)};Zs?Zs(Ug.exports,"apply",{value:AB}):Ug.exports.apply=AB});var NB=m((Jge,xB)=>{"use strict";c();var CB=Mg(),TB=SB(),NZ=TB(CB("String.prototype.indexOf"));xB.exports=function(e,r){var n=CB(e,!!r);return typeof n=="function"&&NZ(e,".prototype.")>-1?TB(n):n}});var OB=m(()=>{c()});var YB=m((rye,KB)=>{c();var i_=typeof Map=="function"&&Map.prototype,Kb=Object.getOwnPropertyDescriptor&&i_?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Vg=i_&&Kb&&typeof Kb.get=="function"?Kb.get:null,DB=i_&&Map.prototype.forEach,s_=typeof Set=="function"&&Set.prototype,Yb=Object.getOwnPropertyDescriptor&&s_?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Hg=s_&&Yb&&typeof Yb.get=="function"?Yb.get:null,PB=s_&&Set.prototype.forEach,OZ=typeof WeakMap=="function"&&WeakMap.prototype,Al=OZ?WeakMap.prototype.has:null,DZ=typeof WeakSet=="function"&&WeakSet.prototype,bl=DZ?WeakSet.prototype.has:null,PZ=typeof WeakRef=="function"&&WeakRef.prototype,RB=PZ?WeakRef.prototype.deref:null,RZ=Boolean.prototype.valueOf,BZ=Object.prototype.toString,LZ=Function.prototype.toString,FZ=String.prototype.match,o_=String.prototype.slice,Yi=String.prototype.replace,MZ=String.prototype.toUpperCase,BB=String.prototype.toLowerCase,GB=RegExp.prototype.test,LB=Array.prototype.concat,Nn=Array.prototype.join,UZ=Array.prototype.slice,FB=Math.floor,Zb=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Jb=Object.getOwnPropertySymbols,e_=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,ru=typeof Symbol=="function"&&typeof Symbol.iterator=="object",er=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===ru||"symbol")?Symbol.toStringTag:null,kB=Object.prototype.propertyIsEnumerable,MB=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function UB(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||GB.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var n=t<0?-FB(-t):FB(t);if(n!==t){var i=String(n),s=o_.call(e,i.length+1);return Yi.call(i,r,"$&_")+"."+Yi.call(Yi.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Yi.call(e,r,"$&_")}var t_=OB(),qB=t_.custom,VB=WB(qB)?qB:null;KB.exports=function t(e,r,n,i){var s=r||{};if(Ki(s,"quoteStyle")&&s.quoteStyle!=="single"&&s.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Ki(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=Ki(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(Ki(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(Ki(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 $B(e,s);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var u=String(e);return a?UB(e,u):u}if(typeof e=="bigint"){var l=String(e)+"n";return a?UB(e,l):l}var f=typeof s.depth>"u"?5:s.depth;if(typeof n>"u"&&(n=0),n>=f&&f>0&&typeof e=="object")return r_(e)?"[Array]":"[Object]";var d=ree(s,n);if(typeof i>"u")i=[];else if(zB(i,e)>=0)return"[Circular]";function g(G,K,de){if(K&&(i=UZ.call(i),i.push(K)),de){var ue={depth:s.depth};return Ki(s,"quoteStyle")&&(ue.quoteStyle=s.quoteStyle),t(G,ue,n+1,i)}return t(G,s,n+1,i)}if(typeof e=="function"&&!HB(e)){var E=zZ(e),v=qg(e,g);return"[Function"+(E?": "+E:" (anonymous)")+"]"+(v.length>0?" { "+Nn.call(v,", ")+" }":"")}if(WB(e)){var N=ru?Yi.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):e_.call(e);return typeof e=="object"&&!ru?vl(N):N}if(ZZ(e)){for(var O="<"+BB.call(String(e.nodeName)),F=e.attributes||[],_=0;_",O}if(r_(e)){if(e.length===0)return"[]";var I=qg(e,g);return d&&!tee(I)?"["+n_(I,d)+"]":"[ "+Nn.call(I,", ")+" ]"}if(HZ(e)){var S=qg(e,g);return!("cause"in Error.prototype)&&"cause"in e&&!kB.call(e,"cause")?"{ ["+String(e)+"] "+Nn.call(LB.call("[cause]: "+g(e.cause),S),", ")+" }":S.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+Nn.call(S,", ")+" }"}if(typeof e=="object"&&o){if(VB&&typeof e[VB]=="function"&&t_)return t_(e,{depth:f-n});if(o!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if($Z(e)){var R=[];return DB&&DB.call(e,function(G,K){R.push(g(K,e,!0)+" => "+g(G,e))}),jB("Map",Vg.call(e),R,d)}if(JZ(e)){var B=[];return PB&&PB.call(e,function(G){B.push(g(G,e))}),jB("Set",Hg.call(e),B,d)}if(KZ(e))return Xb("WeakMap");if(XZ(e))return Xb("WeakSet");if(YZ(e))return Xb("WeakRef");if(GZ(e))return vl(g(Number(e)));if(QZ(e))return vl(g(Zb.call(e)));if(kZ(e))return vl(RZ.call(e));if(jZ(e))return vl(g(String(e)));if(!VZ(e)&&!HB(e)){var b=qg(e,g),C=MB?MB(e)===Object.prototype:e instanceof Object||e.constructor===Object,L=e instanceof Object?"":"null prototype",X=!C&&er&&Object(e)===e&&er in e?o_.call(Ji(e),8,-1):L?"Object":"",W=C||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",j=W+(X||L?"["+Nn.call(LB.call([],X||[],L||[]),": ")+"] ":"");return b.length===0?j+"{}":d?j+"{"+n_(b,d)+"}":j+"{ "+Nn.call(b,", ")+" }"}return String(e)};function QB(t,e,r){var n=(r.quoteStyle||e)==="double"?'"':"'";return n+t+n}function qZ(t){return Yi.call(String(t),/"/g,""")}function r_(t){return Ji(t)==="[object Array]"&&(!er||!(typeof t=="object"&&er in t))}function VZ(t){return Ji(t)==="[object Date]"&&(!er||!(typeof t=="object"&&er in t))}function HB(t){return Ji(t)==="[object RegExp]"&&(!er||!(typeof t=="object"&&er in t))}function HZ(t){return Ji(t)==="[object Error]"&&(!er||!(typeof t=="object"&&er in t))}function jZ(t){return Ji(t)==="[object String]"&&(!er||!(typeof t=="object"&&er in t))}function GZ(t){return Ji(t)==="[object Number]"&&(!er||!(typeof t=="object"&&er in t))}function kZ(t){return Ji(t)==="[object Boolean]"&&(!er||!(typeof t=="object"&&er in t))}function WB(t){if(ru)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!e_)return!1;try{return e_.call(t),!0}catch{}return!1}function QZ(t){if(!t||typeof t!="object"||!Zb)return!1;try{return Zb.call(t),!0}catch{}return!1}var WZ=Object.prototype.hasOwnProperty||function(t){return t in this};function Ki(t,e){return WZ.call(t,e)}function Ji(t){return BZ.call(t)}function zZ(t){if(t.name)return t.name;var e=FZ.call(LZ.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function zB(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 $B(o_.call(t,0,e.maxStringLength),e)+n}var i=Yi.call(Yi.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,eee);return QB(i,"single",e)}function eee(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":"")+MZ.call(e.toString(16))}function vl(t){return"Object("+t+")"}function Xb(t){return t+" { ? }"}function jB(t,e,r,n){var i=n?n_(r,n):Nn.call(r,", ");return t+" ("+e+") {"+i+"}"}function tee(t){for(var e=0;e=0)return!1;return!0}function ree(t,e){var r;if(t.indent===" ")r=" ";else if(typeof t.indent=="number"&&t.indent>0)r=Nn.call(Array(t.indent+1)," ");else return null;return{base:r,prev:Nn.call(Array(e+1),r)}}function n_(t,e){if(t.length===0)return"";var r=` +`+e.prev+e.base;return r+Nn.call(t,","+r)+` +`+e.prev}function qg(t,e){var r=r_(t),n=[];if(r){n.length=t.length;for(var i=0;i{"use strict";c();var a_=Mg(),nu=NB(),nee=YB(),iee=a_("%TypeError%"),jg=a_("%WeakMap%",!0),Gg=a_("%Map%",!0),see=nu("WeakMap.prototype.get",!0),oee=nu("WeakMap.prototype.set",!0),aee=nu("WeakMap.prototype.has",!0),uee=nu("Map.prototype.get",!0),cee=nu("Map.prototype.set",!0),lee=nu("Map.prototype.has",!0),u_=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},fee=function(t,e){var r=u_(t,e);return r&&r.value},hee=function(t,e,r){var n=u_(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}},dee=function(t,e){return!!u_(t,e)};JB.exports=function(){var e,r,n,i={assert:function(s){if(!i.has(s))throw new iee("Side channel does not contain "+nee(s))},get:function(s){if(jg&&s&&(typeof s=="object"||typeof s=="function")){if(e)return see(e,s)}else if(Gg){if(r)return uee(r,s)}else if(n)return fee(n,s)},has:function(s){if(jg&&s&&(typeof s=="object"||typeof s=="function")){if(e)return aee(e,s)}else if(Gg){if(r)return lee(r,s)}else if(n)return dee(n,s);return!1},set:function(s,o){jg&&s&&(typeof s=="object"||typeof s=="function")?(e||(e=new jg),oee(e,s,o)):Gg?(r||(r=new Gg),cee(r,s,o)):(n||(n={key:{},next:null}),hee(n,s,o))}};return i}});var kg=m((oye,ZB)=>{"use strict";c();var pee=String.prototype.replace,gee=/%20/g,c_={RFC1738:"RFC1738",RFC3986:"RFC3986"};ZB.exports={default:c_.RFC3986,formatters:{RFC1738:function(t){return pee.call(t,gee,"+")},RFC3986:function(t){return String(t)}},RFC1738:c_.RFC1738,RFC3986:c_.RFC3986}});var f_=m((uye,tL)=>{"use strict";c();var yee=kg(),l_=Object.prototype.hasOwnProperty,eo=Array.isArray,On=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),mee=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&&l<=57||l>=65&&l<=90||l>=97&&l<=122||s===yee.RFC1738&&(l===40||l===41)){a+=o.charAt(u);continue}if(l<128){a=a+On[l];continue}if(l<2048){a=a+(On[192|l>>6]+On[128|l&63]);continue}if(l<55296||l>=57344){a=a+(On[224|l>>12]+On[128|l>>6&63]+On[128|l&63]);continue}u+=1,l=65536+((l&1023)<<10|o.charCodeAt(u)&1023),a+=On[240|l>>18]+On[128|l>>12&63]+On[128|l>>6&63]+On[128|l&63]}return a},bee=function(e){for(var r=[{obj:{o:e},prop:"o"}],n=[],i=0;i{"use strict";c();var iL=XB(),d_=f_(),_l=kg(),Tee=Object.prototype.hasOwnProperty,rL={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,r){return e+"["+r+"]"},repeat:function(e){return e}},to=Array.isArray,xee=String.prototype.split,Nee=Array.prototype.push,sL=function(t,e){Nee.apply(t,to(e)?e:[e])},Oee=Date.prototype.toISOString,nL=_l.default,kt={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:d_.encode,encodeValuesOnly:!1,format:nL,formatter:_l.formatters[nL],indices:!1,serializeDate:function(e){return Oee.call(e)},skipNulls:!1,strictNullHandling:!1},Dee=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},h_={},Pee=function t(e,r,n,i,s,o,a,u,l,f,d,g,E,v,N){for(var O=e,F=N,_=0,I=!1;(F=F.get(h_))!==void 0&&!I;){var S=F.get(e);if(_+=1,typeof S<"u"){if(S===_)throw new RangeError("Cyclic object value");I=!0}typeof F.get(h_)>"u"&&(_=0)}if(typeof a=="function"?O=a(r,O):O instanceof Date?O=f(O):n==="comma"&&to(O)&&(O=d_.maybeMap(O,function(re){return re instanceof Date?f(re):re})),O===null){if(i)return o&&!E?o(r,kt.encoder,v,"key",d):r;O=""}if(Dee(O)||d_.isBuffer(O)){if(o){var R=E?r:o(r,kt.encoder,v,"key",d);if(n==="comma"&&E){for(var B=xee.call(String(O),","),b="",C=0;C"u")return L;var X;if(n==="comma"&&to(O))X=[{value:O.length>0?O.join(",")||null:void 0}];else if(to(a))X=a;else{var W=Object.keys(O);X=u?W.sort(u):W}for(var j=0;j"u"?kt.allowDots:!!e.allowDots,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:kt.charsetSentinel,delimiter:typeof e.delimiter>"u"?kt.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:kt.encode,encoder:typeof e.encoder=="function"?e.encoder:kt.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:kt.encodeValuesOnly,filter:s,format:n,formatter:i,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:kt.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:kt.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:kt.strictNullHandling}};oL.exports=function(t,e){var r=t,n=Ree(e),i,s;typeof n.filter=="function"?(s=n.filter,r=s("",r)):to(n.filter)&&(s=n.filter,i=s);var o=[];if(typeof r!="object"||r===null)return"";var a;e&&e.arrayFormat in rL?a=e.arrayFormat:e&&"indices"in e?a=e.indices?"indices":"repeat":a="indices";var u=rL[a];i||(i=Object.keys(r)),n.sort&&i.sort(n.sort);for(var l=iL(),f=0;f0?E+g:""}});var lL=m((hye,cL)=>{"use strict";c();var iu=f_(),p_=Object.prototype.hasOwnProperty,Bee=Array.isArray,Ut={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:iu.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},Lee=function(t){return t.replace(/&#(\d+);/g,function(e,r){return String.fromCharCode(parseInt(r,10))})},uL=function(t,e){return t&&typeof t=="string"&&e.comma&&t.indexOf(",")>-1?t.split(","):t},Fee="utf8=%26%2310003%3B",Mee="utf8=%E2%9C%93",Uee=function(e,r){var n={},i=r.ignoreQueryPrefix?e.replace(/^\?/,""):e,s=r.parameterLimit===1/0?void 0:r.parameterLimit,o=i.split(r.delimiter,s),a=-1,u,l=r.charset;if(r.charsetSentinel)for(u=0;u-1&&(v=Bee(v)?[v]:v),p_.call(n,E)?n[E]=iu.combine(n[E],v):n[E]=v}return n},qee=function(t,e,r,n){for(var i=n?e:uL(e,r),s=t.length-1;s>=0;--s){var o,a=t[s];if(a==="[]"&&r.parseArrays)o=[].concat(i);else{o=r.plainObjects?Object.create(null):{};var u=a.charAt(0)==="["&&a.charAt(a.length-1)==="]"?a.slice(1,-1):a,l=parseInt(u,10);!r.parseArrays&&u===""?o={0:i}:!isNaN(l)&&a!==u&&String(l)===u&&l>=0&&r.parseArrays&&l<=r.arrayLimit?(o=[],o[l]=i):u!=="__proto__"&&(o[u]=i)}i=o}return i},Vee=function(e,r,n,i){if(e){var s=n.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,o=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,u=n.depth>0&&o.exec(s),l=u?s.slice(0,u.index):s,f=[];if(l){if(!n.plainObjects&&p_.call(Object.prototype,l)&&!n.allowPrototypes)return;f.push(l)}for(var d=0;n.depth>0&&(u=a.exec(s))!==null&&d"u"?Ut.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?Ut.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:Ut.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:Ut.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:Ut.arrayLimit,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Ut.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:Ut.comma,decoder:typeof e.decoder=="function"?e.decoder:Ut.decoder,delimiter:typeof e.delimiter=="string"||iu.isRegExp(e.delimiter)?e.delimiter:Ut.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:Ut.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:Ut.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:Ut.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:Ut.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Ut.strictNullHandling}};cL.exports=function(t,e){var r=Hee(e);if(t===""||t===null||typeof t>"u")return r.plainObjects?Object.create(null):{};for(var n=typeof t=="string"?Uee(t,r):t,i=r.plainObjects?Object.create(null):{},s=Object.keys(n),o=0;o{"use strict";c();var jee=aL(),Gee=lL(),kee=kg();fL.exports={formats:kee,parse:Gee,stringify:jee}});var g_=m(at=>{"use strict";c();Object.defineProperty(at,"__esModule",{value:!0});at.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED=at.WALLET_PROVIDER_CALLBACK_PARAM=at.WALLET_PROVIDER_SIGN_MESSAGE_URL=at.WALLET_PROVIDER_GUARD_TRANSACTION_URL=at.WALLET_PROVIDER_SIGN_TRANSACTION_URL=at.WALLET_PROVIDER_SEND_TRANSACTION_URL=at.WALLET_PROVIDER_DISCONNECT_URL=at.WALLET_PROVIDER_CONNECT_URL=at.WALLET_PROVIDER_TESTNET=at.WALLET_PROVIDER_DEVNET=at.WALLET_PROVIDER_MAINNET=void 0;at.WALLET_PROVIDER_MAINNET="https://wallet.multiversx.com/dapp/init";at.WALLET_PROVIDER_DEVNET="https://devnet-wallet.multiversx.com/dapp/init";at.WALLET_PROVIDER_TESTNET="https://testnet-wallet.multiversx.com/dapp/init";at.WALLET_PROVIDER_CONNECT_URL="hook/login";at.WALLET_PROVIDER_DISCONNECT_URL="hook/logout";at.WALLET_PROVIDER_SEND_TRANSACTION_URL="hook/transaction";at.WALLET_PROVIDER_SIGN_TRANSACTION_URL="hook/sign";at.WALLET_PROVIDER_GUARD_TRANSACTION_URL="hook/2fa";at.WALLET_PROVIDER_SIGN_MESSAGE_URL="hook/sign-message";at.WALLET_PROVIDER_CALLBACK_PARAM="walletProviderStatus";at.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED="transactionsSigned"});var dL=m(su=>{"use strict";c();Object.defineProperty(su,"__esModule",{value:!0});su.ErrCannotSignedMessage=su.ErrCannotGetSignedTransactions=void 0;var y_=class extends Error{constructor(){super("Cannot get signed transaction(s)")}};su.ErrCannotGetSignedTransactions=y_;var m_=class extends Error{constructor(){super("Cannot get signed message")}};su.ErrCannotSignedMessage=m_});var pL=m(Qg=>{"use strict";c();Object.defineProperty(Qg,"__esModule",{value:!0});Qg.PlainSignedTransaction=void 0;var E_=class{constructor(e){this.nonce=0,this.value="",this.receiver="",this.sender="",this.gasPrice=0,this.gasLimit=0,this.data="",this.chainID="",this.version=0,this.options=void 0,this.signature="",Object.assign(this,e)}};Qg.PlainSignedTransaction=E_});var Il=m(es=>{"use strict";c();var Xi=es&&es.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})},Qee=es&&es.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(es,"__esModule",{value:!0});es.WalletProvider=void 0;var w_=Qee(hL()),Zi=g_(),v_=dL(),Wee=pL(),A_=class t{constructor(e){this.walletUrl=e}login(e){return Xi(this,void 0,void 0,function*(){let r=this.buildWalletUrl({endpoint:Zi.WALLET_PROVIDER_CONNECT_URL,callbackUrl:e?.callbackUrl,params:{token:e?.token}});return yield this.redirect(r,e?.redirectDelayMilliseconds),r})}redirect(e,r){return Xi(this,void 0,void 0,function*(){r?yield this.redirectLater(e,r):this.redirectImmediately(e)})}redirectImmediately(e){window.location.href=e}redirectLater(e,r){return Xi(this,void 0,void 0,function*(){yield new Promise(n=>{setTimeout(()=>{window.location.href=e,n(!0)},r)})})}logout(e){return Xi(this,void 0,void 0,function*(){let r=this.buildWalletUrl({endpoint:Zi.WALLET_PROVIDER_DISCONNECT_URL,callbackUrl:e?.callbackUrl});return yield this.redirect(r,e?.redirectDelayMilliseconds),!0})}signMessage(e,r){return Xi(this,void 0,void 0,function*(){let n=this.buildWalletUrl({endpoint:Zi.WALLET_PROVIDER_SIGN_MESSAGE_URL,callbackUrl:r?.callbackUrl,params:{message:e.message.toString()}});return yield this.redirect(n),n})}getMessageSignatureFromWalletUrl(){var e,r;let n=window.location.search.slice(1);console.info("getMessageSignatureFromWalletUrl(), url:",n);let i=w_.default.parse(n);if((((e=i.status)===null||e===void 0?void 0:e.toString())||"")!=="signed")throw new v_.ErrCannotSignedMessage;return((r=i.signature)===null||r===void 0?void 0:r.toString())||""}guardTransactions(e,r){return Xi(this,void 0,void 0,function*(){this.redirectTransactionsToEndpoint(Zi.WALLET_PROVIDER_GUARD_TRANSACTION_URL,e,r)})}signTransactions(e,r){return Xi(this,void 0,void 0,function*(){this.redirectTransactionsToEndpoint(Zi.WALLET_PROVIDER_SIGN_TRANSACTION_URL,e,r)})}signTransaction(e,r){return Xi(this,void 0,void 0,function*(){yield this.signTransactions([e],r)})}getTransactionsFromWalletUrl(){let e=w_.default.parse(window.location.search.slice(1));return t.isTxSignReturnSuccess(e)?this.getTxSignReturnValue(e):[]}static isTxSignReturnSuccess(e){return e.hasOwnProperty(Zi.WALLET_PROVIDER_CALLBACK_PARAM)&&e[Zi.WALLET_PROVIDER_CALLBACK_PARAM]===Zi.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED}getTxSignReturnValue(e){var r;console.info("getTxSignReturnValue(), urlParams:",e);let n=["nonce","value","receiver","sender","gasPrice","gasLimit","chainID","version","signature"];for(let o of n)if(!e[o]||!Array.isArray(e[o]))throw new v_.ErrCannotGetSignedTransactions;let i=e.nonce.length;for(let o of n)if(e[o].length!==i)throw new v_.ErrCannotGetSignedTransactions;let s=[];for(let o=0;o{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}};es.WalletProvider=A_});var b_=m((Iye,gL)=>{"use strict";c();gL.exports=function(e,r){return function(){for(var i=new Array(arguments.length),s=0;s{"use strict";c();var zee=b_(),ro=Object.prototype.toString;function S_(t){return ro.call(t)==="[object Array]"}function __(t){return typeof t>"u"}function $ee(t){return t!==null&&!__(t)&&t.constructor!==null&&!__(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function Kee(t){return ro.call(t)==="[object ArrayBuffer]"}function Yee(t){return typeof FormData<"u"&&t instanceof FormData}function Jee(t){var e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&t.buffer instanceof ArrayBuffer,e}function Xee(t){return typeof t=="string"}function Zee(t){return typeof t=="number"}function yL(t){return t!==null&&typeof t=="object"}function Wg(t){if(ro.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function ete(t){return ro.call(t)==="[object Date]"}function tte(t){return ro.call(t)==="[object File]"}function rte(t){return ro.call(t)==="[object Blob]"}function mL(t){return ro.call(t)==="[object Function]"}function nte(t){return yL(t)&&mL(t.pipe)}function ite(t){return typeof URLSearchParams<"u"&&t instanceof URLSearchParams}function ste(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function ote(){return typeof navigator<"u"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window<"u"&&typeof document<"u"}function C_(t,e){if(!(t===null||typeof t>"u"))if(typeof t!="object"&&(t=[t]),S_(t))for(var r=0,n=t.length;r{"use strict";c();var ou=pr();function wL(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}vL.exports=function(e,r,n){if(!r)return e;var i;if(n)i=n(r);else if(ou.isURLSearchParams(r))i=r.toString();else{var s=[];ou.forEach(r,function(u,l){u===null||typeof u>"u"||(ou.isArray(u)?l=l+"[]":u=[u],ou.forEach(u,function(d){ou.isDate(d)?d=d.toISOString():ou.isObject(d)&&(d=JSON.stringify(d)),s.push(wL(l)+"="+wL(d))}))}),i=s.join("&")}if(i){var o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}});var bL=m((Oye,AL)=>{"use strict";c();var cte=pr();function zg(){this.handlers=[]}zg.prototype.use=function(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};zg.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};zg.prototype.forEach=function(e){cte.forEach(this.handlers,function(n){n!==null&&e(n)})};AL.exports=zg});var IL=m((Pye,_L)=>{"use strict";c();var lte=pr();_L.exports=function(e,r){lte.forEach(e,function(i,s){s!==r&&s.toUpperCase()===r.toUpperCase()&&(e[r]=i,delete e[s])})}});var x_=m((Bye,SL)=>{"use strict";c();SL.exports=function(e,r,n,i,s){return e.config=r,n&&(e.code=n),e.request=i,e.response=s,e.isAxiosError=!0,e.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:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},e}});var N_=m((Fye,CL)=>{"use strict";c();var fte=x_();CL.exports=function(e,r,n,i,s){var o=new Error(e);return fte(o,r,n,i,s)}});var xL=m((Uye,TL)=>{"use strict";c();var hte=N_();TL.exports=function(e,r,n){var i=n.config.validateStatus;!n.status||!i||i(n.status)?e(n):r(hte("Request failed with status code "+n.status,n.config,null,n.request,n))}});var OL=m((Vye,NL)=>{"use strict";c();var $g=pr();NL.exports=$g.isStandardBrowserEnv()?function(){return{write:function(r,n,i,s,o,a){var u=[];u.push(r+"="+encodeURIComponent(n)),$g.isNumber(i)&&u.push("expires="+new Date(i).toGMTString()),$g.isString(s)&&u.push("path="+s),$g.isString(o)&&u.push("domain="+o),a===!0&&u.push("secure"),document.cookie=u.join("; ")},read:function(r){var n=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(r){this.write(r,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()});var PL=m((jye,DL)=>{"use strict";c();DL.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}});var BL=m((kye,RL)=>{"use strict";c();RL.exports=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e}});var FL=m((Wye,LL)=>{"use strict";c();var dte=PL(),pte=BL();LL.exports=function(e,r){return e&&!dte(r)?pte(e,r):r}});var UL=m(($ye,ML)=>{"use strict";c();var O_=pr(),gte=["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"];ML.exports=function(e){var r={},n,i,s;return e&&O_.forEach(e.split(` +`),function(a){if(s=a.indexOf(":"),n=O_.trim(a.substr(0,s)).toLowerCase(),i=O_.trim(a.substr(s+1)),n){if(r[n]&>e.indexOf(n)>=0)return;n==="set-cookie"?r[n]=(r[n]?r[n]:[]).concat([i]):r[n]=r[n]?r[n]+", "+i:i}}),r}});var HL=m((Yye,VL)=>{"use strict";c();var qL=pr();VL.exports=qL.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),n;function i(s){var 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){var a=qL.isString(o)?i(o):o;return a.protocol===n.protocol&&a.host===n.host}}():function(){return function(){return!0}}()});var Sl=m((Xye,jL)=>{"use strict";c();function D_(t){this.message=t}D_.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};D_.prototype.__CANCEL__=!0;jL.exports=D_});var R_=m((e0e,GL)=>{"use strict";c();var Kg=pr(),yte=xL(),mte=OL(),Ete=T_(),wte=FL(),vte=UL(),Ate=HL(),P_=N_(),bte=Cl(),_te=Sl();GL.exports=function(e){return new Promise(function(n,i){var s=e.data,o=e.headers,a=e.responseType,u;function l(){e.cancelToken&&e.cancelToken.unsubscribe(u),e.signal&&e.signal.removeEventListener("abort",u)}Kg.isFormData(s)&&delete o["Content-Type"];var f=new XMLHttpRequest;if(e.auth){var d=e.auth.username||"",g=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.Authorization="Basic "+btoa(d+":"+g)}var E=wte(e.baseURL,e.url);f.open(e.method.toUpperCase(),Ete(E,e.params,e.paramsSerializer),!0),f.timeout=e.timeout;function v(){if(f){var O="getAllResponseHeaders"in f?vte(f.getAllResponseHeaders()):null,F=!a||a==="text"||a==="json"?f.responseText:f.response,_={data:F,status:f.status,statusText:f.statusText,headers:O,config:e,request:f};yte(function(S){n(S),l()},function(S){i(S),l()},_),f=null}}if("onloadend"in f?f.onloadend=v:f.onreadystatechange=function(){!f||f.readyState!==4||f.status===0&&!(f.responseURL&&f.responseURL.indexOf("file:")===0)||setTimeout(v)},f.onabort=function(){f&&(i(P_("Request aborted",e,"ECONNABORTED",f)),f=null)},f.onerror=function(){i(P_("Network Error",e,null,f)),f=null},f.ontimeout=function(){var F=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",_=e.transitional||bte.transitional;e.timeoutErrorMessage&&(F=e.timeoutErrorMessage),i(P_(F,e,_.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",f)),f=null},Kg.isStandardBrowserEnv()){var N=(e.withCredentials||Ate(E))&&e.xsrfCookieName?mte.read(e.xsrfCookieName):void 0;N&&(o[e.xsrfHeaderName]=N)}"setRequestHeader"in f&&Kg.forEach(o,function(F,_){typeof s>"u"&&_.toLowerCase()==="content-type"?delete o[_]:f.setRequestHeader(_,F)}),Kg.isUndefined(e.withCredentials)||(f.withCredentials=!!e.withCredentials),a&&a!=="json"&&(f.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&f.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&f.upload&&f.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(u=function(O){f&&(i(!O||O&&O.type?new _te("canceled"):O),f.abort(),f=null)},e.cancelToken&&e.cancelToken.subscribe(u),e.signal&&(e.signal.aborted?u():e.signal.addEventListener("abort",u))),s||(s=null),f.send(s)})}});var Cl=m((r0e,WL)=>{"use strict";c();var Qt=pr(),kL=IL(),Ite=x_(),Ste={"Content-Type":"application/x-www-form-urlencoded"};function QL(t,e){!Qt.isUndefined(t)&&Qt.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function Cte(){var t;return typeof XMLHttpRequest<"u"?t=R_():typeof p.default<"u"&&Object.prototype.toString.call(p.default)==="[object process]"&&(t=R_()),t}function Tte(t,e,r){if(Qt.isString(t))try{return(e||JSON.parse)(t),Qt.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}var Yg={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:Cte(),transformRequest:[function(e,r){return kL(r,"Accept"),kL(r,"Content-Type"),Qt.isFormData(e)||Qt.isArrayBuffer(e)||Qt.isBuffer(e)||Qt.isStream(e)||Qt.isFile(e)||Qt.isBlob(e)?e:Qt.isArrayBufferView(e)?e.buffer:Qt.isURLSearchParams(e)?(QL(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):Qt.isObject(e)||r&&r["Content-Type"]==="application/json"?(QL(r,"application/json"),Tte(e)):e}],transformResponse:[function(e){var r=this.transitional||Yg.transitional,n=r&&r.silentJSONParsing,i=r&&r.forcedJSONParsing,s=!n&&this.responseType==="json";if(s||i&&Qt.isString(e)&&e.length)try{return JSON.parse(e)}catch(o){if(s)throw o.name==="SyntaxError"?Ite(o,this,"E_JSON_PARSE"):o}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};Qt.forEach(["delete","get","head"],function(e){Yg.headers[e]={}});Qt.forEach(["post","put","patch"],function(e){Yg.headers[e]=Qt.merge(Ste)});WL.exports=Yg});var $L=m((i0e,zL)=>{"use strict";c();var xte=pr(),Nte=Cl();zL.exports=function(e,r,n){var i=this||Nte;return xte.forEach(n,function(o){e=o.call(i,e,r)}),e}});var B_=m((o0e,KL)=>{"use strict";c();KL.exports=function(e){return!!(e&&e.__CANCEL__)}});var XL=m((u0e,JL)=>{"use strict";c();var YL=pr(),L_=$L(),Ote=B_(),Dte=Cl(),Pte=Sl();function F_(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Pte("canceled")}JL.exports=function(e){F_(e),e.headers=e.headers||{},e.data=L_.call(e,e.data,e.headers,e.transformRequest),e.headers=YL.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),YL.forEach(["delete","get","head","post","put","patch","common"],function(i){delete e.headers[i]});var r=e.adapter||Dte.adapter;return r(e).then(function(i){return F_(e),i.data=L_.call(e,i.data,i.headers,e.transformResponse),i},function(i){return Ote(i)||(F_(e),i&&i.response&&(i.response.data=L_.call(e,i.response.data,i.response.headers,e.transformResponse))),Promise.reject(i)})}});var M_=m((l0e,ZL)=>{"use strict";c();var Ar=pr();ZL.exports=function(e,r){r=r||{};var n={};function i(f,d){return Ar.isPlainObject(f)&&Ar.isPlainObject(d)?Ar.merge(f,d):Ar.isPlainObject(d)?Ar.merge({},d):Ar.isArray(d)?d.slice():d}function s(f){if(Ar.isUndefined(r[f])){if(!Ar.isUndefined(e[f]))return i(void 0,e[f])}else return i(e[f],r[f])}function o(f){if(!Ar.isUndefined(r[f]))return i(void 0,r[f])}function a(f){if(Ar.isUndefined(r[f])){if(!Ar.isUndefined(e[f]))return i(void 0,e[f])}else return i(void 0,r[f])}function u(f){if(f in r)return i(e[f],r[f]);if(f in e)return i(void 0,e[f])}var l={url:o,method:o,data:o,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:u};return Ar.forEach(Object.keys(e).concat(Object.keys(r)),function(d){var g=l[d]||s,E=g(d);Ar.isUndefined(E)&&g!==u||(n[d]=E)}),n}});var U_=m((h0e,eF)=>{c();eF.exports={version:"0.24.0"}});var nF=m((p0e,rF)=>{"use strict";c();var Rte=U_().version,q_={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){q_[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var tF={};q_.transitional=function(e,r,n){function i(s,o){return"[Axios v"+Rte+"] Transitional option '"+s+"'"+o+(n?". "+n:"")}return function(s,o,a){if(e===!1)throw new Error(i(o," has been removed"+(r?" in "+r:"")));return r&&!tF[o]&&(tF[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 Bte(t,e,r){if(typeof t!="object")throw new TypeError("options must be an object");for(var n=Object.keys(t),i=n.length;i-- >0;){var s=n[i],o=e[s];if(o){var a=t[s],u=a===void 0||o(a,s,t);if(u!==!0)throw new TypeError("option "+s+" must be "+u);continue}if(r!==!0)throw Error("Unknown option "+s)}}rF.exports={assertOptions:Bte,validators:q_}});var cF=m((y0e,uF)=>{"use strict";c();var oF=pr(),Lte=T_(),iF=bL(),sF=XL(),Jg=M_(),aF=nF(),au=aF.validators;function Tl(t){this.defaults=t,this.interceptors={request:new iF,response:new iF}}Tl.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=Jg(this.defaults,e),e.method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var r=e.transitional;r!==void 0&&aF.assertOptions(r,{silentJSONParsing:au.transitional(au.boolean),forcedJSONParsing:au.transitional(au.boolean),clarifyTimeoutError:au.transitional(au.boolean)},!1);var n=[],i=!0;this.interceptors.request.forEach(function(g){typeof g.runWhen=="function"&&g.runWhen(e)===!1||(i=i&&g.synchronous,n.unshift(g.fulfilled,g.rejected))});var s=[];this.interceptors.response.forEach(function(g){s.push(g.fulfilled,g.rejected)});var o;if(!i){var a=[sF,void 0];for(Array.prototype.unshift.apply(a,n),a=a.concat(s),o=Promise.resolve(e);a.length;)o=o.then(a.shift(),a.shift());return o}for(var u=e;n.length;){var l=n.shift(),f=n.shift();try{u=l(u)}catch(d){f(d);break}}try{o=sF(u)}catch(d){return Promise.reject(d)}for(;s.length;)o=o.then(s.shift(),s.shift());return o};Tl.prototype.getUri=function(e){return e=Jg(this.defaults,e),Lte(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};oF.forEach(["delete","get","head","options"],function(e){Tl.prototype[e]=function(r,n){return this.request(Jg(n||{},{method:e,url:r,data:(n||{}).data}))}});oF.forEach(["post","put","patch"],function(e){Tl.prototype[e]=function(r,n,i){return this.request(Jg(i||{},{method:e,url:r,data:n}))}});uF.exports=Tl});var fF=m((E0e,lF)=>{"use strict";c();var Fte=Sl();function uu(t){if(typeof t!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(i){e=i});var r=this;this.promise.then(function(n){if(r._listeners){var i,s=r._listeners.length;for(i=0;i{"use strict";c();hF.exports=function(e){return function(n){return e.apply(null,n)}}});var gF=m((b0e,pF)=>{"use strict";c();pF.exports=function(e){return typeof e=="object"&&e.isAxiosError===!0}});var EF=m((I0e,V_)=>{"use strict";c();var yF=pr(),Mte=b_(),Xg=cF(),Ute=M_(),qte=Cl();function mF(t){var e=new Xg(t),r=Mte(Xg.prototype.request,e);return yF.extend(r,Xg.prototype,e),yF.extend(r,e),r.create=function(i){return mF(Ute(t,i))},r}var Dn=mF(qte);Dn.Axios=Xg;Dn.Cancel=Sl();Dn.CancelToken=fF();Dn.isCancel=B_();Dn.VERSION=U_().version;Dn.all=function(e){return Promise.all(e)};Dn.spread=dF();Dn.isAxiosError=gF();V_.exports=Dn;V_.exports.default=Dn});var vF=m((C0e,wF)=>{c();wF.exports=EF()});var AF=m(Zg=>{"use strict";c();Object.defineProperty(Zg,"__esModule",{value:!0});Zg.NativeAuthClientConfig=void 0;var H_=class{constructor(){this.origin=typeof window<"u"?window.location.hostname:"",this.apiUrl="https://api.multiversx.com",this.expirySeconds=60*60*24}};Zg.NativeAuthClientConfig=H_});var G_=m(cu=>{"use strict";c();var no=cu&&cu.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(cu,"__esModule",{value:!0});cu.NativeAuthClient=void 0;var Vte=vF(),Hte=AF(),j_=class{constructor(e){this.config=Object.assign(new Hte.NativeAuthClientConfig,e)}getToken(e,r,n){let i=this.encodeValue(e),s=this.encodeValue(r);return`${i}.${s}.${n}`}initialize(e={}){return no(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 no(this,void 0,void 0,function*(){return this.config.gatewayUrl?yield this.getCurrentBlockHashWithGateway():yield this.getCurrentBlockHashWithApi()})}getCurrentBlockHashWithGateway(){return no(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 no(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 no(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 no(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 no(this,void 0,void 0,function*(){return yield Vte.default.get(e,{headers:this.config.extraRequestHeaders})})}};cu.NativeAuthClient=j_});var CF=m(ry=>{"use strict";c();Object.defineProperty(ry,"__esModule",{value:!0});ry.TransactionStatus=void 0;var k_=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}};ry.TransactionStatus=k_});var hu=m(Vt=>{"use strict";c();var jte=Vt&&Vt.__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]}),Gte=Vt&&Vt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kte=Vt&&Vt.__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)&&jte(e,t,r);return Gte(e,t),e};Object.defineProperty(Vt,"__esModule",{value:!0});Vt.zeroPadStringIfOddLength=Vt.isPaddedHex=Vt.numberToPaddedHex=Vt.Nonce=Vt.Address=void 0;var TF=kte(wm()),Qte="erd",Q_=class t{constructor(e){this.value=e}static fromPubkey(e){let r=TF.toWords(e),n=TF.encode(Qte,r);return new t(n)}bech32(){return this.value}toString(){return this.bech32()}};Vt.Address=Q_;var W_=class{constructor(e){this.value=e}valueOf(){return this.value}hex(){return xF(this.value)}};Vt.Nonce=W_;function xF(t){let e=t.toString(16);return NF(e)}Vt.numberToPaddedHex=xF;function Wte(t){t=t||"";let e=h.Buffer.from(t,"hex").toString("hex");return t.toUpperCase()==e.toUpperCase()}Vt.isPaddedHex=Wte;function NF(t){return t=t||"",t.length%2==1?"0"+t:t}Vt.zeroPadStringIfOddLength=NF});var DF=m(ny=>{"use strict";c();Object.defineProperty(ny,"__esModule",{value:!0});ny.TransactionReceipt=void 0;var OF=hu(),z_=class t{constructor(){this.value="",this.sender=new OF.Address(""),this.data="",this.hash=""}static fromHttpResponse(e){let r=new t;return r.value=(e.value||0).toString(),r.sender=new OF.Address(e.sender),r.data=e.data,r.hash=e.txHash,r}};ny.TransactionReceipt=z_});var PF=m(Pn=>{"use strict";c();Object.defineProperty(Pn,"__esModule",{value:!0});Pn.ErrContractQuery=Pn.ErrNetworkProvider=Pn.ErrUnexpectedCondition=Pn.Err=void 0;var du=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};Pn.Err=du;var $_=class extends du{constructor(e){super(`Unexpected condition: [${e}]`)}};Pn.ErrUnexpectedCondition=$_;var K_=class extends du{constructor(e,r,n){let i=`Request error on url [${e}]: [${r}]`;super(i,n)}};Pn.ErrNetworkProvider=K_;var Y_=class extends du{constructor(e){super(e.message.replace("executeQuery:",""))}};Pn.ErrContractQuery=Y_});var BF=m(rs=>{"use strict";c();Object.defineProperty(rs,"__esModule",{value:!0});rs.TransactionEventTopic=rs.TransactionEventData=rs.TransactionEvent=void 0;var RF=hu(),J_=class t{constructor(e){this.address=new RF.Address(""),this.identifier="",this.topics=[],this.dataPayload=new xl(h.Buffer.from("","utf8")),this.data="",Object.assign(this,e)}static fromHttpResponse(e){let r=new t;r.address=new RF.Address(e.address),r.identifier=e.identifier||"",r.topics=(e.topics||[]).map(i=>new iy(i));let n=h.Buffer.from(e.data||"","base64");return r.dataPayload=new xl(n),r.data=n.toString(),r}findFirstOrNoneTopic(e){return this.topics.filter(r=>e(r))[0]}getLastTopic(){return this.topics[this.topics.length-1]}};rs.TransactionEvent=J_;var xl=class{constructor(e){this.raw=e}toString(){return this.raw.toString("utf8")}hex(){return this.raw.toString("hex")}valueOf(){return this.raw}};rs.TransactionEventData=xl;var iy=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}};rs.TransactionEventTopic=iy});var Z_=m(sy=>{"use strict";c();Object.defineProperty(sy,"__esModule",{value:!0});sy.TransactionLogs=void 0;var zte=PF(),LF=hu(),$te=BF(),X_=class t{constructor(e){this.address=new LF.Address(""),this.events=[],Object.assign(this,e)}static fromHttpResponse(e){let r=new t;return r.address=new LF.Address(e.address),r.events=(e.events||[]).map(n=>$te.TransactionEvent.fromHttpResponse(n)),r}findSingleOrNoneEvent(e,r){let n=this.findEvents(e,r);if(n.length>1)throw new zte.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}};sy.TransactionLogs=X_});var MF=m(pu=>{"use strict";c();Object.defineProperty(pu,"__esModule",{value:!0});pu.ContractResultItem=pu.ContractResults=void 0;var FF=Z_(),oy=hu(),eI=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=>Nl.fromProxyHttpResponse(n));return new t(r)}static fromApiHttpResponse(e){let r=e.map(n=>Nl.fromApiHttpResponse(n));return new t(r)}};pu.ContractResults=eI;var Nl=class t{constructor(e){this.hash="",this.nonce=0,this.value="",this.receiver=new oy.Address(""),this.sender=new oy.Address(""),this.data="",this.previousHash="",this.originalHash="",this.gasLimit=0,this.gasPrice=0,this.callType=0,this.returnMessage="",this.logs=new FF.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 oy.Address(e.receiver),r.sender=new oy.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=FF.TransactionLogs.fromHttpResponse(e.logs||{}),r}};pu.ContractResultItem=Nl});var UF=m(ns=>{"use strict";c();var Kte=ns&&ns.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ns,"__esModule",{value:!0});ns.EsdtContractAddress=ns.MaxUint64AsBigNumber=void 0;var Yte=Kte(jt()),Jte=hu();ns.MaxUint64AsBigNumber=new Yte.default("18446744073709551615");ns.EsdtContractAddress=new Jte.Address("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u")});var qF=m(gu=>{"use strict";c();var Xte=gu&&gu.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(gu,"__esModule",{value:!0});gu.ContractQueryResponse=void 0;var Zte=Xte(jt()),ere=UF(),tI=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 Zte.default(e.gasRemaining||e.GasRemaining||0),o=ere.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()}}};gu.ContractQueryResponse=tI});var VF=m(ay=>{"use strict";c();Object.defineProperty(ay,"__esModule",{value:!0});ay.ContractQueryRequest=void 0;var rI=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}};ay.ContractQueryRequest=rI});var JF=m((qme,YF)=>{c();YF.exports=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}});var is=m(oo=>{c();var nI,tre=[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];oo.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};oo.getSymbolTotalCodewords=function(e){return tre[e]};oo.getBCHDigit=function(t){let e=0;for(;t!==0;)e++,t>>>=1;return e};oo.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');nI=e};oo.isKanjiModeEnabled=function(){return typeof nI<"u"};oo.toSJIS=function(e){return nI(e)}});var ly=m(Vr=>{c();Vr.L={bit:1};Vr.M={bit:0};Vr.Q={bit:3};Vr.H={bit:2};function rre(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return Vr.L;case"m":case"medium":return Vr.M;case"q":case"quartile":return Vr.Q;case"h":case"high":return Vr.H;default:throw new Error("Unknown EC Level: "+t)}}Vr.isValid=function(e){return e&&typeof e.bit<"u"&&e.bit>=0&&e.bit<4};Vr.from=function(e,r){if(Vr.isValid(e))return e;try{return rre(e)}catch{return r}}});var eM=m((Qme,ZF)=>{c();function XF(){this.buffer=[],this.length=0}XF.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++}};ZF.exports=XF});var rM=m((zme,tM)=>{c();function Ol(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)}Ol.prototype.set=function(t,e,r,n){let i=t*this.size+e;this.data[i]=r,n&&(this.reservedBit[i]=!0)};Ol.prototype.get=function(t,e){return this.data[t*this.size+e]};Ol.prototype.xor=function(t,e,r){this.data[t*this.size+e]^=r};Ol.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};tM.exports=Ol});var nM=m(fy=>{c();var nre=is().getSymbolSize;fy.getRowColCoords=function(e){if(e===1)return[];let r=Math.floor(e/7)+2,n=nre(e),i=n===145?26:Math.ceil((n-13)/(2*r-2))*2,s=[n-7];for(let o=1;o{c();var ire=is().getSymbolSize,iM=7;sM.getPositions=function(e){let r=ire(e);return[[0,0],[r-iM,0],[0,r-iM]]}});var aM=m(Xe=>{c();Xe.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var ao={N1:3,N2:3,N3:40,N4:10};Xe.isValid=function(e){return e!=null&&e!==""&&!isNaN(e)&&e>=0&&e<=7};Xe.from=function(e){return Xe.isValid(e)?parseInt(e,10):void 0};Xe.getPenaltyN1=function(e){let r=e.size,n=0,i=0,s=0,o=null,a=null;for(let u=0;u=5&&(n+=ao.N1+(i-5)),o=f,i=1),f=e.get(l,u),f===a?s++:(s>=5&&(n+=ao.N1+(s-5)),a=f,s=1)}i>=5&&(n+=ao.N1+(i-5)),s>=5&&(n+=ao.N1+(s-5))}return n};Xe.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*ao.N3};Xe.getPenaltyN4=function(e){let r=0,n=e.data.length;for(let s=0;s{c();var ss=ly(),hy=[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],dy=[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];iI.getBlocksCount=function(e,r){switch(r){case ss.L:return hy[(e-1)*4+0];case ss.M:return hy[(e-1)*4+1];case ss.Q:return hy[(e-1)*4+2];case ss.H:return hy[(e-1)*4+3];default:return}};iI.getTotalCodewordsCount=function(e,r){switch(r){case ss.L:return dy[(e-1)*4+0];case ss.M:return dy[(e-1)*4+1];case ss.Q:return dy[(e-1)*4+2];case ss.H:return dy[(e-1)*4+3];default:return}}});var uM=m(gy=>{c();var Dl=new Uint8Array(512),py=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)Dl[r]=e,py[e]=r,e<<=1,e&256&&(e^=285);for(let r=255;r<512;r++)Dl[r]=Dl[r-255]})();gy.log=function(e){if(e<1)throw new Error("log("+e+")");return py[e]};gy.exp=function(e){return Dl[e]};gy.mul=function(e,r){return e===0||r===0?0:Dl[py[e]+py[r]]}});var cM=m(Pl=>{c();var oI=uM();Pl.mul=function(e,r){let n=new Uint8Array(e.length+r.length-1);for(let i=0;i=0;){let i=n[0];for(let o=0;o{c();var lM=cM();function aI(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}aI.prototype.initialize=function(e){this.degree=e,this.genPoly=lM.generateECPolynomial(this.degree)};aI.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=lM.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};fM.exports=aI});var uI=m(dM=>{c();dM.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}});var cI=m(ai=>{c();var pM="[0-9]+",ore="[A-Z $%*+\\-./:]+",Rl="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";Rl=Rl.replace(/u/g,"\\u");var are="(?:(?![A-Z0-9 $%*+\\-./:]|"+Rl+`)(?:.|[\r +]))+`;ai.KANJI=new RegExp(Rl,"g");ai.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");ai.BYTE=new RegExp(are,"g");ai.NUMERIC=new RegExp(pM,"g");ai.ALPHANUMERIC=new RegExp(ore,"g");var ure=new RegExp("^"+Rl+"$"),cre=new RegExp("^"+pM+"$"),lre=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");ai.testKanji=function(e){return ure.test(e)};ai.testNumeric=function(e){return cre.test(e)};ai.testAlphanumeric=function(e){return lre.test(e)}});var os=m(Tt=>{c();var fre=uI(),lI=cI();Tt.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]};Tt.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]};Tt.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]};Tt.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]};Tt.MIXED={bit:-1};Tt.getCharCountIndicator=function(e,r){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!fre.isValid(r))throw new Error("Invalid version: "+r);return r>=1&&r<10?e.ccBits[0]:r<27?e.ccBits[1]:e.ccBits[2]};Tt.getBestModeForData=function(e){return lI.testNumeric(e)?Tt.NUMERIC:lI.testAlphanumeric(e)?Tt.ALPHANUMERIC:lI.testKanji(e)?Tt.KANJI:Tt.BYTE};Tt.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")};Tt.isValid=function(e){return e&&e.bit&&e.ccBits};function hre(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return Tt.NUMERIC;case"alphanumeric":return Tt.ALPHANUMERIC;case"kanji":return Tt.KANJI;case"byte":return Tt.BYTE;default:throw new Error("Unknown mode: "+t)}}Tt.from=function(e,r){if(Tt.isValid(e))return e;try{return hre(e)}catch{return r}}});var wM=m(uo=>{c();var yy=is(),dre=sI(),gM=ly(),as=os(),fI=uI(),mM=7973,yM=yy.getBCHDigit(mM);function pre(t,e,r){for(let n=1;n<=40;n++)if(e<=uo.getCapacity(n,r,t))return n}function EM(t,e){return as.getCharCountIndicator(t,e)+4}function gre(t,e){let r=0;return t.forEach(function(n){let i=EM(n.mode,e);r+=i+n.getBitsLength()}),r}function yre(t,e){for(let r=1;r<=40;r++)if(gre(t,r)<=uo.getCapacity(r,e,as.MIXED))return r}uo.from=function(e,r){return fI.isValid(e)?parseInt(e,10):r};uo.getCapacity=function(e,r,n){if(!fI.isValid(e))throw new Error("Invalid QR Code version");typeof n>"u"&&(n=as.BYTE);let i=yy.getSymbolTotalCodewords(e),s=dre.getTotalCodewordsCount(e,r),o=(i-s)*8;if(n===as.MIXED)return o;let a=o-EM(n,e);switch(n){case as.NUMERIC:return Math.floor(a/10*3);case as.ALPHANUMERIC:return Math.floor(a/11*2);case as.KANJI:return Math.floor(a/13);case as.BYTE:default:return Math.floor(a/8)}};uo.getBestVersionForData=function(e,r){let n,i=gM.from(r,gM.M);if(Array.isArray(e)){if(e.length>1)return yre(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return pre(n.mode,n.getLength(),i)};uo.getEncodedBits=function(e){if(!fI.isValid(e)||e<7)throw new Error("Invalid QR Code version");let r=e<<12;for(;yy.getBCHDigit(r)-yM>=0;)r^=mM<{c();var hI=is(),AM=1335,mre=21522,vM=hI.getBCHDigit(AM);bM.getEncodedBits=function(e,r){let n=e.bit<<3|r,i=n<<10;for(;hI.getBCHDigit(i)-vM>=0;)i^=AM<{c();var Ere=os();function yu(t){this.mode=Ere.NUMERIC,this.data=t.toString()}yu.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)};yu.prototype.getLength=function(){return this.data.length};yu.prototype.getBitsLength=function(){return yu.getBitsLength(this.data.length)};yu.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))};IM.exports=yu});var TM=m((AEe,CM)=>{c();var wre=os(),dI=["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 mu(t){this.mode=wre.ALPHANUMERIC,this.data=t}mu.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)};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;for(r=0;r+2<=this.data.length;r+=2){let n=dI.indexOf(this.data[r])*45;n+=dI.indexOf(this.data[r+1]),e.put(n,11)}this.data.length%2&&e.put(dI.indexOf(this.data[r]),6)};CM.exports=mu});var NM=m((_Ee,xM)=>{"use strict";c();xM.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 DM=m((SEe,OM)=>{c();var vre=NM(),Are=os();function Eu(t){this.mode=Are.BYTE,typeof t=="string"&&(t=vre(t)),this.data=new Uint8Array(t)}Eu.getBitsLength=function(e){return e*8};Eu.prototype.getLength=function(){return this.data.length};Eu.prototype.getBitsLength=function(){return Eu.getBitsLength(this.data.length)};Eu.prototype.write=function(t){for(let e=0,r=this.data.length;e{c();var bre=os(),_re=is();function wu(t){this.mode=bre.KANJI,this.data=t}wu.getBitsLength=function(e){return e*13};wu.prototype.getLength=function(){return this.data.length};wu.prototype.getBitsLength=function(){return wu.getBitsLength(this.data.length)};wu.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)}};PM.exports=wu});var BM=m((NEe,pI)=>{"use strict";c();var Bl={single_source_shortest_paths:function(t,e,r){var n={},i={};i[e]=0;var s=Bl.PriorityQueue.make();s.push(e,0);for(var o,a,u,l,f,d,g,E,v;!s.empty();){o=s.pop(),a=o.value,l=o.cost,f=t[a]||{};for(u in f)f.hasOwnProperty(u)&&(d=f[u],g=l+d,E=i[u],v=typeof i[u]>"u",(v||E>g)&&(i[u]=g,s.push(u,g),n[u]=a))}if(typeof r<"u"&&typeof i[r]>"u"){var N=["Could not find a path from ",e," to ",r,"."].join("");throw new Error(N)}return n},extract_shortest_path_from_predecessor_list:function(t,e){for(var r=[],n=e,i;n;)r.push(n),i=t[n],n=t[n];return r.reverse(),r},find_path:function(t,e,r){var n=Bl.single_source_shortest_paths(t,e,r);return Bl.extract_shortest_path_from_predecessor_list(n,r)},PriorityQueue:{make:function(t){var e=Bl.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 pI<"u"&&(pI.exports=Bl)});var jM=m(vu=>{c();var He=os(),MM=SM(),UM=TM(),qM=DM(),VM=RM(),Ll=cI(),my=is(),Ire=BM();function LM(t){return unescape(encodeURIComponent(t)).length}function Fl(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 HM(t){let e=Fl(Ll.NUMERIC,He.NUMERIC,t),r=Fl(Ll.ALPHANUMERIC,He.ALPHANUMERIC,t),n,i;return my.isKanjiModeEnabled()?(n=Fl(Ll.BYTE,He.BYTE,t),i=Fl(Ll.KANJI,He.KANJI,t)):(n=Fl(Ll.BYTE_KANJI,He.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 gI(t,e){switch(e){case He.NUMERIC:return MM.getBitsLength(t);case He.ALPHANUMERIC:return UM.getBitsLength(t);case He.KANJI:return VM.getBitsLength(t);case He.BYTE:return qM.getBitsLength(t)}}function Sre(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 Cre(t){let e=[];for(let r=0;r{c();var wy=is(),yI=ly(),xre=eM(),Nre=rM(),Ore=nM(),Dre=oM(),wI=aM(),vI=sI(),Pre=hM(),Ey=wM(),Rre=_M(),Bre=os(),mI=jM();function Lre(t,e){let r=t.size,n=Dre.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 Fre(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 EI(t,e,r){let n=t.size,i=Rre.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 qre(t,e){let r=t.size,n=-1,i=r-1,s=7,o=0;for(let a=r-1;a>0;a-=2)for(a===6&&a--;;){for(let u=0;u<2;u++)if(!t.isReserved(i,a-u)){let l=!1;o>>s&1)===1),t.set(i,a-u,l),s--,s===-1&&(o++,s=7)}if(i+=n,i<0||r<=i){i-=n,n=-n;break}}}function Vre(t,e,r){let n=new xre;r.forEach(function(u){n.put(u.mode.bit,4),n.put(u.getLength(),Bre.getCharCountIndicator(u.mode,t)),u.write(n)});let i=wy.getSymbolTotalCodewords(t),s=vI.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&&Jee(u,e),Xee(u,o),isNaN(n)&&(n=b_.getBestMask(u,A_.bind(null,u,r))),b_.applyMask(n,u),A_(u,r,n),{modules:u,version:e,errorCorrectionLevel:r,maskPattern:n,segments:i}}OF.create=function(e,r){if(typeof e>"u"||e==="")throw new Error("No input text");let n=E_.M,i,s;return typeof r<"u"&&(n=E_.from(r.errorCorrectionLevel,E_.M),i=y0.from(r.version),s=b_.from(r.maskPattern),r.toSJISFunc&&m0.setToSJISFunction(r.toSJISFunc)),tte(e,i,n,s)}});var I_=w(Uo=>{c();function PF(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("")}}Uo.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:PF(e.color.dark||"#000000ff"),light:PF(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}};Uo.getScale=function(e,r){return r.width&&r.width>=e+r.margin*2?r.width/(e+r.margin*2):r.scale};Uo.getImageWidth=function(e,r){let n=Uo.getScale(e,r);return Math.floor((e+r.margin*2)*n)};Uo.qrToImageData=function(e,r,n){let i=r.modules.size,s=r.modules.data,o=Uo.getScale(i,n),a=Math.floor((i+n.margin*2)*o),u=n.margin*o,l=[n.color.light,n.color.dark];for(let f=0;f=u&&d>=u&&f{c();var S_=I_();function rte(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 nte(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}w0.render=function(e,r,n){let i=n,s=r;typeof i>"u"&&(!r||!r.getContext)&&(i=r,r=void 0),r||(s=nte()),i=S_.getOptions(i);let o=S_.getImageWidth(e.modules.size,i),a=s.getContext("2d"),u=a.createImageData(o,o);return S_.qrToImageData(u.data,e,i),rte(a,s,o),a.putImageData(u,0,0),s};w0.renderToDataURL=function(e,r,n){let i=n;typeof i>"u"&&(!r||!r.getContext)&&(i=r,r=void 0),i||(i={});let s=w0.render(e,r,i),o=i.type||"image/png",a=i.rendererOpts||{};return s.toDataURL(o,a.quality)}});var FF=w(LF=>{c();var ite=I_();function BF(t,e){let r=t.a/255,n=e+'="'+t.hex+'"';return r<1?n+" "+e+'-opacity="'+r.toFixed(2).slice(1)+'"':n}function C_(t,e,r){let n=t+e;return typeof r<"u"&&(n+=" "+r),n}function ste(t,e,r){let n="",i=0,s=!1,o=0;for(let a=0;a0&&u>0&&t[a-1]||(n+=s?C_("M",u+r,.5+l+r):C_("m",i,0),i=0,s=!1),u+1':"",l="',f='viewBox="0 0 '+a+" "+a+'"',y=''+u+l+` -`;return typeof n=="function"&&n(null,y),y}});var UF=w(If=>{c();var ote=UL(),T_=DF(),MF=RF(),ate=FF();function x_(t,e,r,n,i){let s=[].slice.call(arguments,1),o=s.length,a=typeof s[o-1]=="function";if(!a&&!ote())throw new Error("Callback required as last argument");if(a){if(o<2)throw new Error("Too few arguments provided");o===2?(i=r,r=e,e=n=void 0):o===3&&(e.getContext&&typeof i>"u"?(i=n,n=void 0):(i=n,n=r,r=e,e=void 0))}else{if(o<1)throw new Error("Too few arguments provided");return o===1?(r=e,e=n=void 0):o===2&&!e.getContext&&(n=r,r=e,e=void 0),new Promise(function(u,l){try{let f=T_.create(r,n);u(t(f,e,n))}catch(f){l(f)}})}try{let u=T_.create(r,n);i(null,t(u,e,n))}catch(u){i(u)}}If.create=T_.create;If.toCanvas=x_.bind(null,MF.render);If.toDataURL=x_.bind(null,MF.renderToDataURL);If.toString=x_.bind(null,function(t,e,r){return ate.render(t,r)})});var JF=w(ps=>{"use strict";c();var Ete=ps&&ps.__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]}),YF=ps&&ps.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Ete(e,t,r)};Object.defineProperty(ps,"__esModule",{value:!0});YF(uf(),ps);YF(_b(),ps)});c();var vte=_e(iI(),1),Ate=_e(HT(),1),bte=_e(QT(),1),_te=_e(tr(),1),Ite=_e($h(),1),Ste=_e(Wc(),1),Cte=_e(jc(),1),Tte=_e(Rw(),1),xte=_e(D2(),1),Nte=_e(Zh(),1),i5=_e(yi(),1),Bn=_e(Rc(),1),s5=_e(Oc(),1),o5=_e(aa(),1);c();c();var q2=_e(RE(),1);c();c();var Id="elvenjs_state",F2="https://devnet-api.multiversx.com";var Sd="/dapp/init",Cd="devnet",M2="https://maiar.page.link/?apn=com.elrond.maiar.wallet&isi=1519405832&ibi=com.elrond.maiar.wallet&link=https://xportal.com/",U2=["wss://relay.walletconnect.com"],An={devnet:{id:"devnet",shortId:"D",name:"Devnet",egldLabel:"xEGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://devnet-wallet.multiversx.com",apiAddress:"https://devnet-api.multiversx.com",explorerAddress:"https://devnet-explorer.multiversx.com",apiTimeout:1e4},testnet:{id:"testnet",shortId:"T",name:"Testnet",egldLabel:"xEGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://testnet-wallet.multiversx.com",apiAddress:"https://testnet-api.multiversx.com",explorerAddress:"https://testnet-explorer.multiversx.com",apiTimeout:1e4},mainnet:{id:"mainnet",shortId:"1",name:"Mainnet",egldLabel:"EGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://wallet.multiversx.com",apiAddress:"https://api.multiversx.com",explorerAddress:"https://explorer.multiversx.com",apiTimeout:1e4}};var Ie={get(t){let e=localStorage.getItem(Id);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(Id,JSON.stringify(r))},clear(){localStorage.removeItem(Id)}};var Td=()=>Te(void 0,null,function*(){let t=q2.ExtensionProvider.getInstance();try{let e=yield t.init(),r=Ie.get();if(r!=null&&r.address&&t.setAddress(r.address),!e){console.warn("Something went wrong when trying to initialize the ExtensionProvider..");return}return t}catch(e){console.warn("Can't initialize the Dapp Provider!")}});var e5=_e(RE(),1),t5=_e(tf(),1),r5=_e(uf(),1),n5=_e(Zb(),1);c();var fL=_e(tf(),1);c();c();var Ce=class{static set(e,r){if(!e)return;let n=R_(xf({},this.events),{[e]:r});this.events=n}static get(e){if(!(!e||!this.events))return this.events[e]}static run(e,...r){var n,i;!e||!this.events||(i=(n=this.events)[e])==null||i.call(n,...r)}static clear(){this.events=void 0}};c();var Ro=(i=>(i.ledger="ledger",i.mobile="mobile",i.webWallet="web-wallet",i.browserExtension="browser-extension",i))(Ro||{});var lc=t=>Te(void 0,null,function*(){if(!t.dappProvider)throw new Error("Error: Logout failed: There is no active session!");Ce.run("onLoginPending");let e=yield t.dappProvider.logout();return e&&(Ie.clear(),Ce.run("onLogout")),e});c();var cL=_e(tr(),1),lL=_e($h(),1);c();var Lt=t=>typeof t=="string"?t.toUpperCase():t instanceof Error?t.message:`Error: ${JSON.stringify(t)}`;c();var fc=()=>new Date().setHours(new Date().getHours()+24),Xg=t=>Date.now()>t;var us=t=>Te(void 0,null,function*(){let e=Ie.get("address"),r=Ie.get("expires");if(!(r&&Xg(r))&&e&&t.networkProvider){let i=new cL.Address(e),s=new lL.Account(i);try{let o=yield t.networkProvider.getAccount(i);Ie.set("address",e),Ie.set("nonce",o.nonce.valueOf()),Ie.set("balance",o.balance.toString()),s.update(o)}catch(o){let a=Lt(o);console.warn(`Something went wrong trying to synchronize the user account: ${a}`)}}});c();function Zg(t){return t[Math.floor(Math.random()*t.length)]}var hL=t=>Te(void 0,null,function*(){if(!t.initOptions.walletConnectV2ProjectId||!t.initOptions.chainType)return;let e={onClientLogin:()=>{us(t),Ce.run("onLoggedIn")},onClientLogout:()=>lc(t),onClientEvent:i=>{console.log("wc2 session event: ",i)}},r=Zg(t.initOptions.walletConnectV2RelayAddresses),n=new fL.WalletConnectV2Provider(e,An[t.initOptions.chainType].shortId,r,t.initOptions.walletConnectV2ProjectId);try{return yield n.init(),n}catch(i){console.warn("Can't initialize the Dapp Provider!")}});c();var xL=_e(Yt(),1),o0=_e(tr(),1),NL=_e(dL(),1),OL=_e(wL(),1),DL=_e(i_(),1),PL=_e(IL(),1),RL=_e(CL(),1),BL=_e(TL(),1),LL=_e(td(),1);var a0=class{constructor({apiUrl:e,chainType:r,apiTimeout:n}){var i,s;this.chainType=r||Cd,this.apiUrl=e||((i=An[this.chainType])==null?void 0:i.apiAddress),this.apiTimeout=n||((s=An[this.chainType])==null?void 0:s.apiTimeout)}apiGet(e,r){return Te(this,null,function*(){if(typeof fetch!="undefined"){let n=new AbortController,i=setTimeout(()=>n.abort(),this.apiTimeout),s={method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json"},signal:n.signal};try{let o=yield fetch(this.apiUrl+"/"+e,Object.assign(s,r||{})),a=yield o.json();if(!o.ok){let u=(a==null?void 0:a.error)||o.status;return clearTimeout(i),Promise.reject(u)}return clearTimeout(i),a}catch(o){this.handleApiError(o,e)}}})}apiPost(e,r,n){return Te(this,null,function*(){if(typeof fetch!="undefined"){let i=new AbortController,s=setTimeout(()=>i.abort(),this.apiTimeout),o={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(r||{}),signal:i.signal};try{let a=yield fetch(this.apiUrl+"/"+e,Object.assign(o,n||{})),u=yield a.json();if(!a.ok){let l=(u==null?void 0:u.error)||a.status;return clearTimeout(s),Promise.reject(l)}return clearTimeout(s),u}catch(a){this.handleApiError(a,e)}}})}handleApiError(e,r){if(!e.response)throw new Error(`Request error on url [${r}]: [${e.toString()}]`);let n=e.response.data,i=n.error||n.message||JSON.stringify(n);throw new Error(i)}sendTransaction(e){return Te(this,null,function*(){return(yield this.apiPost("transactions",e.toSendable())).txHash})}getAccount(e){return Te(this,null,function*(){let r=yield this.apiGet(`accounts/${e.bech32()}`);return{address:new o0.Address((r==null?void 0:r.address)||""),nonce:Number((r==null?void 0:r.nonce)||0),balance:new xL.default((r==null?void 0:r.balance)||0),code:(r==null?void 0:r.code)||"",userName:(r==null?void 0:r.username)||""}})}getTransaction(e){return Te(this,null,function*(){let r=yield this.apiGet(`transactions/${e}`),n=new NL.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 o0.Address(r.sender),receiver:new o0.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:OL.TransactionReceipt.fromHttpResponse(r.receipt||{}),logs:DL.TransactionLogs.fromHttpResponse(r.logs||{}),contractResults:PL.ContractResults.fromApiHttpResponse(r.results||[]),isCompleted:!n.isPending()}})}queryContract(o){return Te(this,arguments,function*({address:e,func:r,args:n,value:i,caller:s}){try{let a=new LL.Query({address:e,func:r,args:n,value:i,caller:s}),u=new BL.ContractQueryRequest(a).toHttpRequest(),l=yield this.apiPost("query",u);return RL.ContractQueryResponse.fromHttpResponse(l)}catch(a){this.handleApiError(a,"query")}})}};c();var FL=(t,e,r,n="/")=>Te(void 0,null,function*(){let i=yield Td(),o={callbackUrl:encodeURIComponent(`${window.location.origin}${n}`),token:e};try{i&&(yield i.login(o)),Ce.run("onLoginPending")}catch(u){let l=Lt(u);console.warn(`Something went wrong trying to login the user: ${l}`)}if(!i)throw new Error("Error: There were problems with auth provider initialization!");let{signature:a}=i.account;if(Ie.set("loginToken",e),a&&Ie.set("signature",a),t.networkProvider&&a)try{let u=yield i.getAddress();if(!u)throw new Error("Canceled!");Ie.set("address",u),Ie.set("loginMethod","browser-extension"),Ie.set("expires",fc()),yield us(t),Ce.run("onLoggedIn");let l=r.getToken(u,e,a);return Ie.set("accessToken",l),i}catch(u){console.warn(`Something went wrong trying to synchronize the user account: ${u==null?void 0:u.message}`),Ce.run("onLogout")}});c();c();var qF=_e(UF(),1),VF=_e(tf(),1);var cte=t=>{var r;let e=document.createElement("template");return e.innerHTML=t.trim(),(r=e.content.firstChild)==null?void 0:r.cloneNode(!0)},lte=t=>{let e=`${M2}?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},fte=()=>{let t=document.createElement("div");return t.classList.add("elven-wc-pairings"),t},hte=()=>{let t=document.createElement("div");return t.textContent="Existing WalletConnect pairings:",t.classList.add("elven-wc-pairings-header"),t},N_={},dte=(t,e)=>{let r=document.createElement("button");return r.classList.add("elven-wc-pairings-remove-btn"),r.textContent="\u2716",N_[t.topic]=new AbortController,r.addEventListener("click",n=>{n.stopImmediatePropagation(),e(t.topic)},{signal:N_[t.topic].signal}),r},E0={},pte=(t,e,r)=>{var o,a;let n=document.createElement("div"),i=document.createElement("div");n.classList.add("elven-wc-pairing-item"),n.setAttribute("id",t.topic),i.classList.add("elven-wc-pairing-item-description"),i.textContent=`${(o=t.peerMetadata)==null?void 0:o.description} (${(a=t.peerMetadata)==null?void 0:a.url})`,n.appendChild(i);let s=dte(t,e);return n.appendChild(s),E0[t.topic]=new AbortController,n.addEventListener("click",()=>r(t.topic),{signal:E0[t.topic].signal}),n},gte=()=>{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},yte=t=>{if(!t)return;let e=document.getElementById(t);e==null||e.remove()},mte=()=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),wte=t=>Te(void 0,null,function*(){return t?yield qF.default.toString(t,{type:"svg"}):void 0}),jF=(t,e,r,n)=>Te(void 0,null,function*(){if(!t)throw new Error("Please provide the QR Code and WalletConnect Pairings container id!");let i=null;typeof t=="string"?i=document.getElementById(t):t instanceof HTMLElement&&(i=t);let s=yield wte(e),o;if(s&&(o=cte(s)),i&&o&&(i.replaceChildren(),i.appendChild(o),mte()&&i.appendChild(lte(e))),i&&r instanceof VF.WalletConnectV2Provider){let a=r.pairings,u=f=>Te(void 0,null,function*(){try{f&&(yield r.logout({topic:f}),yte(f))}catch(d){let y=Lt(d);console.warn(`Something went wrong trying to remove the existing pairing: ${y}`)}finally{E0[f].abort()}}),l=f=>Te(void 0,null,function*(){try{let{approval:d}=yield r.connect({topic:f,methods:["mvx_cancelAction"]});if(!document.getElementById("elven-wc-pairing-item-confirm-msessage")){let m=document.getElementById(f);m==null||m.after(gte())}yield r.login({approval:d,token:n})}catch(d){let y=Lt(d);console.warn(`Something went wrong trying to login the user: ${y}`)}finally{for(let d of Object.values(E0))d==null||d.abort();for(let d of Object.values(N_))d==null||d.abort()}});if(a&&a.length>0){let f=fte();i.appendChild(f);let d=hte();f.appendChild(d);for(let y of a){let m=pte(y,u,l);f.appendChild(m)}}}return i});var v0=_e(tf(),1);var HF=(t,e,r,n)=>Te(void 0,null,function*(){if(!n)throw new Error("You haven't provided the QR code container DOM element id");let i=Zg(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:()=>Te(void 0,null,function*(){if(t.dappProvider instanceof v0.WalletConnectV2Provider){Ce.run("onLoginPending");let u=yield t.dappProvider.getAddress(),l=yield t.dappProvider.getSignature();Ie.set("address",u),Ie.set("loginMethod","mobile"),Ie.set("expires",fc()),yield us(t),l&&Ie.set("signature",l),Ie.set("loginToken",e);let f=r.getToken(u,e,l);Ie.set("accessToken",f),Ce.run("onLoggedIn"),s==null||s.replaceChildren()}}),onClientLogout:()=>Te(void 0,null,function*(){t.dappProvider instanceof v0.WalletConnectV2Provider&&(yield lc(t),Ce.run("onLogout"))}),onClientEvent:u=>{console.log("wc2 session event: ",u)}},a=new v0.WalletConnectV2Provider(o,An[t.initOptions.chainType].shortId,i,t.initOptions.walletConnectV2ProjectId);try{if(a){t.dappProvider=a,Ce.run("onQrPending"),yield a.init();let{uri:u,approval:l}=yield a.connect({methods:["mvx_cancelAction"]}),f=e?`${u}&token=${e}`:u;return n&&f&&(s=yield jF(n,f,a,e),Ce.run("onQrLoaded")),yield a.login({approval:l,token:e}),a}}catch(u){let l=Lt(u);console.warn(`Something went wrong trying to login the user: ${l}`),Ce.run("onLogout")}});c();var GF=_e(uf(),1);var QF=(t,e,r)=>Te(void 0,null,function*(){let n=new GF.WalletProvider(`${t}${Sd}`),s={callbackUrl:typeof window!="undefined"?encodeURIComponent(`${window.location.origin}${r||"/"}`):"/",token:e};try{return Ce.run("onLoginPending"),Ie.set("loginMethod","web-wallet"),yield n.login(s),Ie.set("expires",fc()),Ie.set("loginToken",e),n}catch(o){let a=Lt(o);console.warn(`Something went wrong trying to login the user: ${a}`),Ie.set("loginMethod",""),Ce.run("onLogout")}});c();var qo=t=>{if(typeof window!="undefined"){let e=new URL(window.location.href);return new URLSearchParams(e.search).get(t)}};c();var kF=_e(uf(),1);var zF=_e(Zb(),1);var WF=(t,e)=>Te(void 0,null,function*(){let r=qo("signature"),n=qo("address"),i=Ie.get("address"),s=Ie.get("loginToken");if(r&&Ie.set("signature",r),n||i){n&&(Ie.set("address",n),window.history.replaceState(null,"",window.location.pathname));let o=new kF.WalletProvider(`${t}${Sd}`);if(r&&e&&n){let u=new zF.NativeAuthClient({apiUrl:e}).getToken(n,s,r);Ie.set("accessToken",u)}return o}});c();var KF=_e($h(),1),$F=_e(Rw(),1);var A0=(t,e)=>Te(void 0,null,function*(){Ce.run("onTxSent",t),yield new $F.TransactionWatcher(e).awaitCompleted(t);let n=t.getSender(),i=new KF.Account(n),s=yield e.getAccount(n);i.update(s),Ie.set("address",i.address.bech32()),Ie.set("nonce",i.getNonceThenIncrement().valueOf()),Ie.set("balance",i.balance.toString()),Ce.run("onTxFinalized",t)});c();var b0=_e(JF(),1),XF=_e(Wc(),1);var ZF=(t,e,r)=>Te(void 0,null,function*(){if(qo(b0.WALLET_PROVIDER_CALLBACK_PARAM)===b0.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED&&t&&e&&"getTransactionsFromWalletUrl"in t){let i=t.getTransactionsFromWalletUrl();window.history.replaceState(null,"",window.location.pathname);let s=i==null?void 0:i[0];if(s){s.data=h.Buffer.from(s.data).toString("base64");let o=XF.Transaction.fromPlainObject(s);o.setNonce(r);try{Ce.run("onTxStarted",o),yield e.sendTransaction(o),yield A0(o,e)}catch(a){let u=Lt(a);throw Ce.run("onTxError",o,u),new Error(`Error: Transaction signing failed! ${u}`)}}}});var Cf=class{static init(e){return Te(this,null,function*(){let r=Ie.get();if(r.expires&&Xg(r.expires)){Ie.clear(),this.dappProvider=void 0;return}this.initOptions=xf({chainType:Cd,apiUrl:F2,apiTimeout:1e4,walletConnectV2ProjectId:"",walletConnectV2RelayAddresses:U2},e),this.networkProvider=new a0(this.initOptions),this.initOptions.onLoginPending&&Ce.set("onLoginPending",this.initOptions.onLoginPending),this.initOptions.onLoggedIn&&Ce.set("onLoggedIn",this.initOptions.onLoggedIn),this.initOptions.onQrPending&&Ce.set("onQrPending",this.initOptions.onQrPending),this.initOptions.onQrLoaded&&Ce.set("onQrLoaded",this.initOptions.onQrLoaded),this.initOptions.onLogout&&Ce.set("onLogout",this.initOptions.onLogout),this.initOptions.onTxStarted&&Ce.set("onTxStarted",this.initOptions.onTxStarted),this.initOptions.onTxSent&&Ce.set("onTxSent",this.initOptions.onTxSent),this.initOptions.onTxFinalized&&Ce.set("onTxFinalized",this.initOptions.onTxFinalized),this.initOptions.onTxError&&Ce.set("onTxError",this.initOptions.onTxError),((r==null?void 0:r.address)||r.loginMethod==="web-wallet"&&qo("address"))&&(r!=null&&r.loginMethod)&&(Ce.run("onLoginPending"),r.loginMethod==="browser-extension"&&(this.dappProvider=yield Td()),r.loginMethod==="mobile"&&(this.dappProvider=yield hL(this)),r.loginMethod==="web-wallet"&&this.initOptions.chainType&&(this.dappProvider=yield WF(An[this.initOptions.chainType].walletAddress,this.initOptions.apiUrl)),yield us(this),Ce.run("onLoggedIn"),r.loginMethod==="web-wallet"&&(yield ZF(this.dappProvider,this.networkProvider,r.nonce)))})}static login(e,r){return Te(this,null,function*(){var o,a;if(!Object.values(Ro).includes(e))throw new Error("Error: Wrong login method!");if(!this.networkProvider)throw new Error("Error: Login failed: Use ElvenJs.init() first!");let i=new n5.NativeAuthClient({apiUrl:(o=this.initOptions)==null?void 0:o.apiUrl}),s=yield i.initialize();try{if(e==="browser-extension"){let u=yield FL(this,s,i,r==null?void 0:r.callbackRoute);this.dappProvider=u}if(e==="mobile"){let u=yield HF(this,s,i,r==null?void 0:r.qrCodeContainer);this.dappProvider=u}if(e==="web-wallet"&&((a=this.initOptions)!=null&&a.chainType)){let u=yield QF(An[this.initOptions.chainType].walletAddress,s,r==null?void 0:r.callbackRoute);this.dappProvider=u}}catch(u){let l=Lt(u);throw new Error(`Error: ${l}`)}})}static logout(){return Te(this,null,function*(){try{let e=yield lc(this);return this.dappProvider=void 0,e}catch(e){let r=Lt(e);console.warn("Something went wrong when logging out: ",r)}})}static signAndSendTransaction(e){return Te(this,null,function*(){if(!this.dappProvider)throw new Error("Error: Transaction signing failed: There is no active session!");if(!this.networkProvider)throw new Error("Error: Transaction signing failed: There is no active network provider!");try{Ce.run("onTxStarted",e);let r=Ie.get();e.setNonce(r.nonce),this.dappProvider instanceof e5.ExtensionProvider&&(yield this.dappProvider.signTransaction(e)),this.dappProvider instanceof t5.WalletConnectV2Provider&&(yield this.dappProvider.signTransaction(e)),this.dappProvider instanceof r5.WalletProvider&&(yield this.dappProvider.signTransaction(e)),r.loginMethod!=="web-wallet"&&(yield this.networkProvider.sendTransaction(e),yield A0(e,this.networkProvider))}catch(r){let n=Lt(r);throw Ce.run("onTxError",e,n),new Error(`Error: Transaction signing failed! ${n}`)}return e})}static queryContract(o){return Te(this,arguments,function*({address:e,func:r,args:n=[],value:i=0,caller:s}){if(!this.networkProvider)throw new Error("Error: Query failed: There is no active network provider!");if(!e||!r)throw new Error("Error: Query failed: The Query arguments are not valid! Address and func required");try{return yield this.networkProvider.queryContract({address:e,func:r,args:n,value:i,caller:s})}catch(a){let u=Lt(a);throw new Error(`Error: Smart contract query failed! ${u}`)}})}},Sf=Cf;Sf.storage=Ie,Sf.destroy=()=>{Cf.networkProvider=void 0,Cf.dappProvider=void 0,Cf.initOptions=void 0,Ce.clear()};var export_Account=Ite.Account;var export_Address=_te.Address;var export_AddressType=o5.AddressType;var export_AddressValue=o5.AddressValue;var export_BigUIntType=Bn.BigUIntType;var export_BigUIntValue=Bn.BigUIntValue;var export_BooleanType=s5.BooleanType;var export_BooleanValue=s5.BooleanValue;var export_BytesType=i5.BytesType;var export_BytesValue=i5.BytesValue;var export_ContractFunction=Nte.ContractFunction;var export_GasEstimator=bte.GasEstimator;var export_SmartContract=xte.SmartContract;var export_TokenTransfer=vte.TokenTransfer;var export_Transaction=Ste.Transaction;var export_TransactionPayload=Cte.TransactionPayload;var export_TransactionWatcher=Tte.TransactionWatcher;var export_TransferTransactionsFactory=Ate.TransferTransactionsFactory;var export_U16Type=Bn.U16Type;var export_U16Value=Bn.U16Value;var export_U32Type=Bn.U32Type;var export_U32Value=Bn.U32Value;var export_U64Type=Bn.U64Type;var export_U64Value=Bn.U64Value;var export_U8Type=Bn.U8Type;var export_U8Value=Bn.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,Sf as ElvenJS,export_GasEstimator as GasEstimator,Ro as LoginMethodsEnum,export_SmartContract as SmartContract,export_TokenTransfer as TokenTransfer,export_Transaction as Transaction,export_TransactionPayload as TransactionPayload,export_TransactionWatcher as TransactionWatcher,export_TransferTransactionsFactory as TransferTransactionsFactory,export_U16Type as U16Type,export_U16Value as U16Value,export_U32Type as U32Type,export_U32Value as U32Value,export_U64Type as U64Type,export_U64Value as U64Value,export_U8Type as U8Type,export_U8Value as U8Value}; +`);let o=Vre(e,r,i),a=wy.getSymbolSize(e),u=new Nre(a);return Lre(u,e),Fre(u),Mre(u,e),EI(u,r,0),e>=7&&Ure(u,e),qre(u,o),isNaN(n)&&(n=wI.getBestMask(u,EI.bind(null,u,r))),wI.applyMask(n,u),EI(u,r,n),{modules:u,version:e,errorCorrectionLevel:r,maskPattern:n,segments:i}}GM.create=function(e,r){if(typeof e>"u"||e==="")throw new Error("No input text");let n=yI.M,i,s;return typeof r<"u"&&(n=yI.from(r.errorCorrectionLevel,yI.M),i=Ey.from(r.version),s=wI.from(r.maskPattern),r.toSJISFunc&&wy.setToSJISFunction(r.toSJISFunc)),jre(e,i,n,s)}});var AI=m(co=>{c();function QM(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("")}}co.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:QM(e.color.dark||"#000000ff"),light:QM(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}};co.getScale=function(e,r){return r.width&&r.width>=e+r.margin*2?r.width/(e+r.margin*2):r.scale};co.getImageWidth=function(e,r){let n=co.getScale(e,r);return Math.floor((e+r.margin*2)*n)};co.qrToImageData=function(e,r,n){let i=r.modules.size,s=r.modules.data,o=co.getScale(i,n),a=Math.floor((i+n.margin*2)*o),u=n.margin*o,l=[n.color.light,n.color.dark];for(let f=0;f=u&&d>=u&&f{c();var bI=AI();function Gre(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 kre(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}vy.render=function(e,r,n){let i=n,s=r;typeof i>"u"&&(!r||!r.getContext)&&(i=r,r=void 0),r||(s=kre()),i=bI.getOptions(i);let o=bI.getImageWidth(e.modules.size,i),a=s.getContext("2d"),u=a.createImageData(o,o);return bI.qrToImageData(u.data,e,i),Gre(a,s,o),a.putImageData(u,0,0),s};vy.renderToDataURL=function(e,r,n){let i=n;typeof i>"u"&&(!r||!r.getContext)&&(i=r,r=void 0),i||(i={});let s=vy.render(e,r,i),o=i.type||"image/png",a=i.rendererOpts||{};return s.toDataURL(o,a.quality)}});var KM=m($M=>{c();var Qre=AI();function zM(t,e){let r=t.a/255,n=e+'="'+t.hex+'"';return r<1?n+" "+e+'-opacity="'+r.toFixed(2).slice(1)+'"':n}function _I(t,e,r){let n=t+e;return typeof r<"u"&&(n+=" "+r),n}function Wre(t,e,r){let n="",i=0,s=!1,o=0;for(let a=0;a0&&u>0&&t[a-1]||(n+=s?_I("M",u+r,.5+l+r):_I("m",i,0),i=0,s=!1),u+1':"",l="',f='viewBox="0 0 '+a+" "+a+'"',g=''+u+l+` +`;return typeof n=="function"&&n(null,g),g}});var JM=m(Ml=>{c();var zre=JF(),II=kM(),YM=WM(),$re=KM();function SI(t,e,r,n,i){let s=[].slice.call(arguments,1),o=s.length,a=typeof s[o-1]=="function";if(!a&&!zre())throw new Error("Callback required as last argument");if(a){if(o<2)throw new Error("Too few arguments provided");o===2?(i=r,r=e,e=n=void 0):o===3&&(e.getContext&&typeof i>"u"?(i=n,n=void 0):(i=n,n=r,r=e,e=void 0))}else{if(o<1)throw new Error("Too few arguments provided");return o===1?(r=e,e=n=void 0):o===2&&!e.getContext&&(n=r,r=e,e=void 0),new Promise(function(u,l){try{let f=II.create(r,n);u(t(f,e,n))}catch(f){l(f)}})}try{let u=II.create(r,n);i(null,t(u,e,n))}catch(u){i(u)}}Ml.create=II.create;Ml.toCanvas=SI.bind(null,YM.render);Ml.toDataURL=SI.bind(null,YM.renderToDataURL);Ml.toString=SI.bind(null,function(t,e,r){return $re.render(t,r)})});var lU=m(us=>{"use strict";c();var one=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]}),cU=us&&us.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&one(e,t,r)};Object.defineProperty(us,"__esModule",{value:!0});cU(Il(),us);cU(g_(),us)});c();var ane=Ie(sm(),1),une=Ie(VE(),1),cne=Ie(jE(),1),lne=Ie(yt(),1),fne=Ie(Ss(),1),hne=Ie(yn(),1),dne=Ie(qn(),1),pne=Ie(Gh(),1),gne=Ie(Jw(),1),yne=Ie(fc(),1),wU=Ie(di(),1),Rn=Ie(Ku(),1),vU=Ie(Du(),1),AU=Ie(Io(),1);c();c();var EO=Ie(ev(),1);c();c();var gd="elvenjs_state",gO="https://devnet-api.multiversx.com";var yd="/dapp/init",md="devnet",yO="https://maiar.page.link/?apn=com.elrond.maiar.wallet&isi=1519405832&ibi=com.elrond.maiar.wallet&link=https://xportal.com/",mO=["wss://relay.walletconnect.com"],An={devnet:{id:"devnet",shortId:"D",name:"Devnet",egldLabel:"xEGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://devnet-wallet.multiversx.com",apiAddress:"https://devnet-api.multiversx.com",explorerAddress:"https://devnet-explorer.multiversx.com",apiTimeout:1e4},testnet:{id:"testnet",shortId:"T",name:"Testnet",egldLabel:"xEGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://testnet-wallet.multiversx.com",apiAddress:"https://testnet-api.multiversx.com",explorerAddress:"https://testnet-explorer.multiversx.com",apiTimeout:1e4},mainnet:{id:"mainnet",shortId:"1",name:"Mainnet",egldLabel:"EGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://wallet.multiversx.com",apiAddress:"https://api.multiversx.com",explorerAddress:"https://explorer.multiversx.com",apiTimeout:1e4}};var Se={get(t){let e=localStorage.getItem(gd);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(gd,JSON.stringify(r))},clear(){localStorage.removeItem(gd)}};var Ed=async()=>{let t=EO.ExtensionProvider.getInstance();try{let e=await t.init(),r=Se.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 pU=Ie(ev(),1),gU=Ie(El(),1),yU=Ie(Il(),1),mU=Ie(G_(),1);c();var IF=Ie(El(),1);c();c();var Ce=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}};c();var io=(i=>(i.ledger="ledger",i.mobile="mobile",i.webWallet="web-wallet",i.browserExtension="browser-extension",i))(io||{});var lu=async t=>{if(!t.dappProvider)throw new Error("Error: Logout failed: There is no active session!");Ce.run("onLoginPending");let e=await t.dappProvider.logout();return e&&(Se.clear(),Ce.run("onLogout")),e};c();var bF=Ie(yt(),1),_F=Ie(Ss(),1);c();var qt=t=>typeof t=="string"?t.toUpperCase():t instanceof Error?t.message:`Error: ${JSON.stringify(t)}`;c();var fu=()=>new Date().setHours(new Date().getHours()+24),ey=t=>Date.now()>t;var ts=async t=>{let e=Se.get("address"),r=Se.get("expires");if(!(r&&ey(r))&&e&&t.networkProvider){let i=new bF.Address(e),s=new _F.Account(i);try{let o=await t.networkProvider.getAccount(i);Se.set("address",e),Se.set("nonce",o.nonce.valueOf()),Se.set("balance",o.balance.toString()),s.update(o)}catch(o){let a=qt(o);console.warn(`Something went wrong trying to synchronize the user account: ${a}`)}}};c();function ty(t){return t[Math.floor(Math.random()*t.length)]}var SF=async t=>{if(!t.initOptions.walletConnectV2ProjectId||!t.initOptions.chainType)return;let e={onClientLogin:()=>{ts(t),Ce.run("onLoggedIn")},onClientLogout:()=>lu(t),onClientEvent:i=>{console.log("wc2 session event: ",i)}},r=ty(t.initOptions.walletConnectV2RelayAddresses),n=new IF.WalletConnectV2Provider(e,An[t.initOptions.chainType].shortId,r,t.initOptions.walletConnectV2ProjectId);try{return await n.init(),n}catch{console.warn("Can't initialize the Dapp Provider!")}};c();var HF=Ie(jt(),1),uy=Ie(yt(),1),jF=Ie(CF(),1),GF=Ie(DF(),1),kF=Ie(Z_(),1),QF=Ie(MF(),1),WF=Ie(qF(),1),zF=Ie(VF(),1),$F=Ie(hc(),1);var cy=class{constructor({apiUrl:e,chainType:r,apiTimeout:n}){this.chainType=r||md,this.apiUrl=e||An[this.chainType]?.apiAddress,this.apiTimeout=n||An[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 l=u?.error||a.status;return clearTimeout(s),Promise.reject(l)}return clearTimeout(s),u}catch(a){this.handleApiError(a,e)}}}handleApiError(e,r){if(!e.response)throw new Error(`Request error on url [${r}]: [${e.toString()}]`);let n=e.response.data,i=n.error||n.message||JSON.stringify(n);throw new Error(i)}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 uy.Address(r?.address||""),nonce:Number(r?.nonce||0),balance:new HF.default(r?.balance||0),code:r?.code||"",userName:r?.username||""}}async getTransaction(e){let r=await this.apiGet(`transactions/${e}`),n=new jF.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 uy.Address(r.sender),receiver:new uy.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:GF.TransactionReceipt.fromHttpResponse(r.receipt||{}),logs:kF.TransactionLogs.fromHttpResponse(r.logs||{}),contractResults:QF.ContractResults.fromApiHttpResponse(r.results||[]),isCompleted:!n.isPending()}}async queryContract({address:e,func:r,args:n,value:i,caller:s}){try{let o=new $F.Query({address:e,func:r,args:n,value:i,caller:s}),a=new zF.ContractQueryRequest(o).toHttpRequest(),u=await this.apiPost("query",a);return WF.ContractQueryResponse.fromHttpResponse(u)}catch(o){this.handleApiError(o,"query")}}};c();var KF=async(t,e,r,n="/")=>{let i=await Ed(),o={callbackUrl:encodeURIComponent(`${window.location.origin}${n}`),token:e};try{i&&(await i.login(o)?Ce.run("onLoginPending"):Ce.run("onLogout"))}catch(u){let l=qt(u);console.warn(`Something went wrong trying to login the user: ${l}`)}if(!i)throw new Error("Error: There were problems with auth provider initialization!");let{signature:a}=i.account;if(Se.set("loginToken",e),a&&Se.set("signature",a),t.networkProvider&&a)try{let u=await i.getAddress();if(!u)throw new Error("Canceled!");Se.set("address",u),Se.set("loginMethod","browser-extension"),Se.set("expires",fu()),await ts(t),Ce.run("onLoggedIn");let l=r.getToken(u,e,a);return Se.set("accessToken",l),i}catch(u){console.warn(`Something went wrong trying to synchronize the user account: ${u?.message}`),Ce.run("onLogout")}};c();c();var XM=Ie(JM(),1),ZM=Ie(El(),1);var Yre=t=>{let e=document.createElement("template");return e.innerHTML=t.trim(),e.content.firstChild?.cloneNode(!0)},Jre=t=>{let e=`${yO}?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},Xre=()=>{let t=document.createElement("div");return t.classList.add("elven-wc-pairings"),t},Zre=()=>{let t=document.createElement("div");return t.textContent="Existing WalletConnect pairings:",t.classList.add("elven-wc-pairings-header"),t},CI={},ene=(t,e)=>{let r=document.createElement("button");return r.classList.add("elven-wc-pairings-remove-btn"),r.textContent="\u2716",CI[t.topic]=new AbortController,r.addEventListener("click",n=>{n.stopImmediatePropagation(),e(t.topic)},{signal:CI[t.topic].signal}),r},Ay={},tne=(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=ene(t,e);return n.appendChild(s),Ay[t.topic]=new AbortController,n.addEventListener("click",()=>r(t.topic),{signal:Ay[t.topic].signal}),n},rne=()=>{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},nne=t=>{if(!t)return;document.getElementById(t)?.remove()},ine=()=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),sne=async t=>t?await XM.default.toString(t,{type:"svg"}):void 0,eU=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 sne(e),o;if(s&&(o=Yre(s)),i&&o&&(i.replaceChildren(),i.appendChild(o),ine()&&i.appendChild(Jre(e))),i&&r instanceof ZM.WalletConnectV2Provider){let a=r.pairings,u=async f=>{try{f&&(await r.logout({topic:f}),nne(f))}catch(d){let g=qt(d);console.warn(`Something went wrong trying to remove the existing pairing: ${g}`)}finally{Ay[f].abort()}},l=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(rne()),await r.login({approval:d,token:n})}catch(d){let g=qt(d);console.warn(`Something went wrong trying to login the user: ${g}`)}finally{for(let d of Object.values(Ay))d?.abort();for(let d of Object.values(CI))d?.abort()}};if(a&&a.length>0){let f=Xre();i.appendChild(f);let d=Zre();f.appendChild(d);for(let g of a){let E=tne(g,u,l);f.appendChild(E)}}}return i};var by=Ie(El(),1);var tU=async(t,e,r,n)=>{if(!n)throw new Error("You haven't provided the QR code container DOM element id");let i=ty(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 by.WalletConnectV2Provider){Ce.run("onLoginPending");let u=await t.dappProvider.getAddress(),l=await t.dappProvider.getSignature();Se.set("address",u),Se.set("loginMethod","mobile"),Se.set("expires",fu()),await ts(t),l&&Se.set("signature",l),Se.set("loginToken",e);let f=r.getToken(u,e,l);Se.set("accessToken",f),Ce.run("onLoggedIn"),s?.replaceChildren()}},onClientLogout:async()=>{t.dappProvider instanceof by.WalletConnectV2Provider&&(await lu(t),Ce.run("onLogout"))},onClientEvent:u=>{console.log("wc2 session event: ",u)}},a=new by.WalletConnectV2Provider(o,An[t.initOptions.chainType].shortId,i,t.initOptions.walletConnectV2ProjectId);try{if(a){t.dappProvider=a,Ce.run("onQrPending"),await a.init();let{uri:u,approval:l}=await a.connect({methods:["mvx_cancelAction","mvx_signNativeAuthToken"]}),f=e?`${u}&token=${e}`:u;return n&&f&&(s=await eU(n,f,a,e),Ce.run("onQrLoaded")),await a.login({approval:l,token:e}),a}}catch(u){let l=qt(u);console.warn(`Something went wrong trying to login the user: ${l}`),Ce.run("onLogout")}};c();var rU=Ie(Il(),1);var nU=async(t,e,r)=>{let n=new rU.WalletProvider(`${t}${yd}`),s={callbackUrl:typeof window<"u"?encodeURIComponent(`${window.location.origin}${r||"/"}`):"/",token:e};try{return Ce.run("onLoginPending"),Se.set("loginMethod","web-wallet"),await n.login(s),Se.set("expires",fu()),Se.set("loginToken",e),n}catch(o){let a=qt(o);console.warn(`Something went wrong trying to login the user: ${a}`),Se.set("loginMethod",""),Ce.run("onLogout")}};c();var lo=t=>{if(typeof window<"u"){let e=new URL(window.location.href);return new URLSearchParams(e.search).get(t)}};c();var iU=Ie(Il(),1);var sU=Ie(G_(),1),oU=async(t,e)=>{let r=lo("signature"),n=lo("address"),i=Se.get("address"),s=Se.get("loginToken");if(r&&Se.set("signature",r),n||i){n&&(Se.set("address",n),window.history.replaceState(null,"",window.location.pathname));let o=new iU.WalletProvider(`${t}${yd}`);if(r&&e&&n){let u=new sU.NativeAuthClient({apiUrl:e,origin:window.location.origin}).getToken(n,s,r);Se.set("accessToken",u)}return o}};c();var aU=Ie(Ss(),1),uU=Ie(Gh(),1);var _y=async(t,e)=>{Ce.run("onTxSent",t),await new uU.TransactionWatcher(e).awaitCompleted(t);let n=t.getSender(),i=new aU.Account(n),s=await e.getAccount(n);i.update(s),Se.set("address",i.address.bech32()),Se.set("balance",i.balance.toString()),Ce.run("onTxFinalized",t)};c();var Iy=Ie(lU(),1),fU=Ie(Ss(),1),hU=Ie(yn(),1);var dU=async(t,e,r)=>{if(lo(Iy.WALLET_PROVIDER_CALLBACK_PARAM)===Iy.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED&&t&&e&&"getTransactionsFromWalletUrl"in t){let i=t.getTransactionsFromWalletUrl();window.history.replaceState(null,"",window.location.pathname);let s=i?.[0];if(s){s.data=h.Buffer.from(s.data).toString("base64");let o=hU.Transaction.fromPlainObject(s);o.setNonce(r);let a=o.getSender(),u=new fU.Account(a),l=o.getNonce().valueOf();u.incrementNonce(),Se.set("nonce",l+1);try{Ce.run("onTxStarted",o),await e.sendTransaction(o),await _y(o,e)}catch(f){let d=qt(f);throw Ce.run("onTxError",o,d),new Error(`Error: Transaction signing failed! ${d}`)}}}};var EU=Ie(Ss(),1),TI=class{static async init(e){let r=Se.get();if(r.expires&&ey(r.expires)){Se.clear(),this.dappProvider=void 0;return}this.initOptions={chainType:md,apiUrl:gO,apiTimeout:1e4,walletConnectV2ProjectId:"",walletConnectV2RelayAddresses:mO,...e},this.networkProvider=new cy(this.initOptions),this.initOptions.onLoginPending&&Ce.set("onLoginPending",this.initOptions.onLoginPending),this.initOptions.onLoggedIn&&Ce.set("onLoggedIn",this.initOptions.onLoggedIn),this.initOptions.onQrPending&&Ce.set("onQrPending",this.initOptions.onQrPending),this.initOptions.onQrLoaded&&Ce.set("onQrLoaded",this.initOptions.onQrLoaded),this.initOptions.onLogout&&Ce.set("onLogout",this.initOptions.onLogout),this.initOptions.onTxStarted&&Ce.set("onTxStarted",this.initOptions.onTxStarted),this.initOptions.onTxSent&&Ce.set("onTxSent",this.initOptions.onTxSent),this.initOptions.onTxFinalized&&Ce.set("onTxFinalized",this.initOptions.onTxFinalized),this.initOptions.onTxError&&Ce.set("onTxError",this.initOptions.onTxError),(r?.address||r.loginMethod==="web-wallet"&&lo("address"))&&r?.loginMethod&&(Ce.run("onLoginPending"),r.loginMethod==="browser-extension"&&(this.dappProvider=await Ed()),r.loginMethod==="mobile"&&(this.dappProvider=await SF(this)),r.loginMethod==="web-wallet"&&this.initOptions.chainType&&(this.dappProvider=await oU(An[this.initOptions.chainType].walletAddress,this.initOptions.apiUrl)),await ts(this),Ce.run("onLoggedIn"),r.loginMethod==="web-wallet"&&await dU(this.dappProvider,this.networkProvider,r.nonce))}static async login(e,r){if(!Object.values(io).includes(e))throw new Error("Error: Wrong login method!");if(!this.networkProvider)throw new Error("Error: Login failed: Use ElvenJs.init() first!");try{Ce.run("onLoginPending");let i=new mU.NativeAuthClient({apiUrl:this.initOptions?.apiUrl,origin:window.location.origin}),s=await i.initialize();if(e==="browser-extension"){let o=await KF(this,s,i,r?.callbackRoute);this.dappProvider=o}if(e==="mobile"){let o=await tU(this,s,i,r?.qrCodeContainer);this.dappProvider=o}if(e==="web-wallet"&&this.initOptions?.chainType){let o=await nU(An[this.initOptions.chainType].walletAddress,s,r?.callbackRoute);this.dappProvider=o}}catch(i){let s=qt(i);throw new Error(`Error: ${s}`)}}static async logout(){try{let e=await lu(this);return this.dappProvider=void 0,e}catch(e){let r=qt(e);console.warn("Something went wrong when logging out: ",r)}}static async signAndSendTransaction(e){if(!this.dappProvider)throw new Error("Error: Transaction signing failed: There is no active session!");if(!this.networkProvider)throw new Error("Error: Transaction signing failed: There is no active network provider!");try{Ce.run("onTxStarted",e);let r=Se.get();if(e.setNonce(r.nonce),this.dappProvider instanceof pU.ExtensionProvider){let i=(await this.dappProvider.signTransaction(e)).getSignature();e.applySignature(i)}if(this.dappProvider instanceof gU.WalletConnectV2Provider&&await this.dappProvider.signTransaction(e),this.dappProvider instanceof yU.WalletProvider&&await this.dappProvider.signTransaction(e),r.loginMethod!=="web-wallet"){let n=e.getSender(),i=new EU.Account(n),s=e.getNonce().valueOf();i.incrementNonce(),Se.set("nonce",s+1),await this.networkProvider.sendTransaction(e),await _y(e,this.networkProvider)}}catch(r){let n=qt(r);throw Ce.run("onTxError",e,n),new Error(`Error: Transaction signing failed! ${n}`)}return e}static async queryContract({address:e,func:r,args:n=[],value:i=0,caller:s}){if(!this.networkProvider)throw new Error("Error: Query failed: There is no active network provider!");if(!e||!r)throw new Error("Error: Query failed: The Query arguments are not valid! Address and func required");try{return await this.networkProvider.queryContract({address:e,func:r,args:n,value:i,caller:s})}catch(o){let a=qt(o);throw new Error(`Error: Smart contract query failed! ${a}`)}}static{this.storage=Se}static{this.destroy=()=>{this.networkProvider=void 0,this.dappProvider=void 0,this.initOptions=void 0,Ce.clear()}}};var export_Account=fne.Account;var export_Address=lne.Address;var export_AddressType=AU.AddressType;var export_AddressValue=AU.AddressValue;var export_BigUIntType=Rn.BigUIntType;var export_BigUIntValue=Rn.BigUIntValue;var export_BooleanType=vU.BooleanType;var export_BooleanValue=vU.BooleanValue;var export_BytesType=wU.BytesType;var export_BytesValue=wU.BytesValue;var export_ContractFunction=yne.ContractFunction;var export_GasEstimator=cne.GasEstimator;var export_SmartContract=gne.SmartContract;var export_TokenTransfer=ane.TokenTransfer;var export_Transaction=hne.Transaction;var export_TransactionPayload=dne.TransactionPayload;var export_TransactionWatcher=pne.TransactionWatcher;var export_TransferTransactionsFactory=une.TransferTransactionsFactory;var export_U16Type=Rn.U16Type;var export_U16Value=Rn.U16Value;var export_U32Type=Rn.U32Type;var export_U32Value=Rn.U32Value;var export_U64Type=Rn.U64Type;var export_U64Value=Rn.U64Value;var export_U8Type=Rn.U8Type;var export_U8Value=Rn.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,TI as ElvenJS,export_GasEstimator as GasEstimator,io as LoginMethodsEnum,export_SmartContract as SmartContract,export_TokenTransfer as TokenTransfer,export_Transaction as Transaction,export_TransactionPayload as TransactionPayload,export_TransactionWatcher as TransactionWatcher,export_TransferTransactionsFactory as TransferTransactionsFactory,export_U16Type as U16Type,export_U16Value as U16Value,export_U32Type as U32Type,export_U32Value as U32Value,export_U64Type as U64Type,export_U64Value as U64Value,export_U8Type as U8Type,export_U8Value as U8Value}; /*! Bundled license information: ieee754/index.js: diff --git a/example/index.html b/example/index.html index a48caa7..1a3b8f0 100644 --- a/example/index.html +++ b/example/index.html @@ -26,9 +26,6 @@ -
-
Loading...
-
@@ -175,7 +176,7 @@

Other demos:

onLoginPending: () => { uiPending(true) }, onLoggedIn: () => { uiLoggedInState(true); uiPending(false); }, onLogout: () => { uiLoggedInState(false); }, - onTxStarted: () => { uiPending(true); }, + onTxStarted: (tx) => { uiPending(true); }, onTxSent: (tx) => { console.log('Tx sent, not finalized on chain yet! ', tx.getHash().toString()) }, onTxFinalized: (tx) => { tx?.hash && updateTxHashContainer(tx.hash); uiPending(false); }, onTxError: (tx, error) => { console.log('Tx error: ', error); uiPending(false); }, diff --git a/package-lock.json b/package-lock.json index 86774eb..86ce3dd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,52 +1,49 @@ { "name": "elven.js", - "version": "0.9.2", + "version": "0.11.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "elven.js", - "version": "0.9.2", + "version": "0.11.0", "license": "MIT", "devDependencies": { - "@multiversx/sdk-core": "12.2.1", - "@multiversx/sdk-extension-provider": "2.0.7", - "@multiversx/sdk-native-auth-client": "^1.0.2", - "@multiversx/sdk-network-providers": "1.4.0", - "@multiversx/sdk-wallet-connect-provider": "3.2.1", + "@multiversx/sdk-core": "12.6.0", + "@multiversx/sdk-extension-provider": "3.0.0", + "@multiversx/sdk-native-auth-client": "1.0.4", + "@multiversx/sdk-network-providers": "1.5.0", + "@multiversx/sdk-wallet-connect-provider": "4.0.2", "@multiversx/sdk-web-wallet-provider": "3.0.0", - "@types/qrcode": "1.5.0", + "@types/qrcode": "1.5.1", "@types/serve-handler": "6.1.1", - "@typescript-eslint/eslint-plugin": "5.59.5", - "@typescript-eslint/parser": "5.59.5", - "esbuild": "0.17.19", - "eslint": "8.40.0", + "@typescript-eslint/eslint-plugin": "6.0.0", + "@typescript-eslint/parser": "6.0.0", + "esbuild": "0.18.13", + "eslint": "8.45.0", "eslint-config-prettier": "8.8.0", - "eslint-plugin-prettier": "4.2.1", + "eslint-plugin-prettier": "5.0.0", "node-stdlib-browser": "1.2.0", - "prettier": "2.8.8", + "prettier": "3.0.0", "qrcode": "1.5.3", - "rimraf": "5.0.0", + "rimraf": "5.0.1", "serve-handler": "6.1.5", - "typescript": "5.0.4" + "typescript": "5.1.6" } }, - "node_modules/@cspotcode/source-map-support": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", - "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "node_modules/@aashutoshrathi/word-wrap": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz", + "integrity": "sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==", "dev": true, - "dependencies": { - "@jridgewell/trace-mapping": "0.3.9" - }, "engines": { - "node": ">=12" + "node": ">=0.10.0" } }, "node_modules/@esbuild/android-arm": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.17.19.tgz", - "integrity": "sha512-rIKddzqhmav7MSmoFCmDIb6e2W57geRsM94gV2l38fzhXMwq7hZoClug9USI2pFRGL06f4IOPHHpFNOkWieR8A==", + "version": "0.18.13", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.18.13.tgz", + "integrity": "sha512-KwqFhxRFMKZINHzCqf8eKxE0XqWlAVPRxwy6rc7CbVFxzUWB2sA/s3hbMZeemPdhN3fKBkqOaFhTbS8xJXYIWQ==", "cpu": [ "arm" ], @@ -60,9 +57,9 @@ } }, "node_modules/@esbuild/android-arm64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.17.19.tgz", - "integrity": "sha512-KBMWvEZooR7+kzY0BtbTQn0OAYY7CsiydT63pVEaPtVYF0hXbUaOyZog37DKxK7NF3XacBJOpYT4adIJh+avxA==", + "version": "0.18.13", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.18.13.tgz", + "integrity": "sha512-j7NhycJUoUAG5kAzGf4fPWfd17N6SM3o1X6MlXVqfHvs2buFraCJzos9vbeWjLxOyBKHyPOnuCuipbhvbYtTAg==", "cpu": [ "arm64" ], @@ -76,9 +73,9 @@ } }, "node_modules/@esbuild/android-x64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.17.19.tgz", - "integrity": "sha512-uUTTc4xGNDT7YSArp/zbtmbhO0uEEK9/ETW29Wk1thYUJBz3IVnvgEiEwEa9IeLyvnpKrWK64Utw2bgUmDveww==", + "version": "0.18.13", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.18.13.tgz", + "integrity": "sha512-M2eZkRxR6WnWfVELHmv6MUoHbOqnzoTVSIxgtsyhm/NsgmL+uTmag/VVzdXvmahak1I6sOb1K/2movco5ikDJg==", "cpu": [ "x64" ], @@ -92,9 +89,9 @@ } }, "node_modules/@esbuild/darwin-arm64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.17.19.tgz", - "integrity": "sha512-80wEoCfF/hFKM6WE1FyBHc9SfUblloAWx6FJkFWTWiCoht9Mc0ARGEM47e67W9rI09YoUxJL68WHfDRYEAvOhg==", + "version": "0.18.13", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.18.13.tgz", + "integrity": "sha512-f5goG30YgR1GU+fxtaBRdSW3SBG9pZW834Mmhxa6terzcboz7P2R0k4lDxlkP7NYRIIdBbWp+VgwQbmMH4yV7w==", "cpu": [ "arm64" ], @@ -108,9 +105,9 @@ } }, "node_modules/@esbuild/darwin-x64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.17.19.tgz", - "integrity": "sha512-IJM4JJsLhRYr9xdtLytPLSH9k/oxR3boaUIYiHkAawtwNOXKE8KoU8tMvryogdcT8AU+Bflmh81Xn6Q0vTZbQw==", + "version": "0.18.13", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.18.13.tgz", + "integrity": "sha512-RIrxoKH5Eo+yE5BtaAIMZaiKutPhZjw+j0OCh8WdvKEKJQteacq0myZvBDLU+hOzQOZWJeDnuQ2xgSScKf1Ovw==", "cpu": [ "x64" ], @@ -124,9 +121,9 @@ } }, "node_modules/@esbuild/freebsd-arm64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.17.19.tgz", - "integrity": "sha512-pBwbc7DufluUeGdjSU5Si+P3SoMF5DQ/F/UmTSb8HXO80ZEAJmrykPyzo1IfNbAoaqw48YRpv8shwd1NoI0jcQ==", + "version": "0.18.13", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.18.13.tgz", + "integrity": "sha512-AfRPhHWmj9jGyLgW/2FkYERKmYR+IjYxf2rtSLmhOrPGFh0KCETFzSjx/JX/HJnvIqHt/DRQD/KAaVsUKoI3Xg==", "cpu": [ "arm64" ], @@ -140,9 +137,9 @@ } }, "node_modules/@esbuild/freebsd-x64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.17.19.tgz", - "integrity": "sha512-4lu+n8Wk0XlajEhbEffdy2xy53dpR06SlzvhGByyg36qJw6Kpfk7cp45DR/62aPH9mtJRmIyrXAS5UWBrJT6TQ==", + "version": "0.18.13", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.18.13.tgz", + "integrity": "sha512-pGzWWZJBInhIgdEwzn8VHUBang8UvFKsvjDkeJ2oyY5gZtAM6BaxK0QLCuZY+qoj/nx/lIaItH425rm/hloETA==", "cpu": [ "x64" ], @@ -156,9 +153,9 @@ } }, "node_modules/@esbuild/linux-arm": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.17.19.tgz", - "integrity": "sha512-cdmT3KxjlOQ/gZ2cjfrQOtmhG4HJs6hhvm3mWSRDPtZ/lP5oe8FWceS10JaSJC13GBd4eH/haHnqf7hhGNLerA==", + "version": "0.18.13", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.18.13.tgz", + "integrity": "sha512-4iMxLRMCxGyk7lEvkkvrxw4aJeC93YIIrfbBlUJ062kilUUnAiMb81eEkVvCVoh3ON283ans7+OQkuy1uHW+Hw==", "cpu": [ "arm" ], @@ -172,9 +169,9 @@ } }, "node_modules/@esbuild/linux-arm64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.17.19.tgz", - "integrity": "sha512-ct1Tg3WGwd3P+oZYqic+YZF4snNl2bsnMKRkb3ozHmnM0dGWuxcPTTntAF6bOP0Sp4x0PjSF+4uHQ1xvxfRKqg==", + "version": "0.18.13", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.18.13.tgz", + "integrity": "sha512-hCzZbVJEHV7QM77fHPv2qgBcWxgglGFGCxk6KfQx6PsVIdi1u09X7IvgE9QKqm38OpkzaAkPnnPqwRsltvLkIQ==", "cpu": [ "arm64" ], @@ -188,9 +185,9 @@ } }, "node_modules/@esbuild/linux-ia32": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.17.19.tgz", - "integrity": "sha512-w4IRhSy1VbsNxHRQpeGCHEmibqdTUx61Vc38APcsRbuVgK0OPEnQ0YD39Brymn96mOx48Y2laBQGqgZ0j9w6SQ==", + "version": "0.18.13", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.18.13.tgz", + "integrity": "sha512-I3OKGbynl3AAIO6onXNrup/ttToE6Rv2XYfFgLK/wnr2J+1g+7k4asLrE+n7VMhaqX+BUnyWkCu27rl+62Adug==", "cpu": [ "ia32" ], @@ -204,9 +201,9 @@ } }, "node_modules/@esbuild/linux-loong64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.17.19.tgz", - "integrity": "sha512-2iAngUbBPMq439a+z//gE+9WBldoMp1s5GWsUSgqHLzLJ9WoZLZhpwWuym0u0u/4XmZ3gpHmzV84PonE+9IIdQ==", + "version": "0.18.13", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.18.13.tgz", + "integrity": "sha512-8pcKDApAsKc6WW51ZEVidSGwGbebYw2qKnO1VyD8xd6JN0RN6EUXfhXmDk9Vc4/U3Y4AoFTexQewQDJGsBXBpg==", "cpu": [ "loong64" ], @@ -220,9 +217,9 @@ } }, "node_modules/@esbuild/linux-mips64el": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.17.19.tgz", - "integrity": "sha512-LKJltc4LVdMKHsrFe4MGNPp0hqDFA1Wpt3jE1gEyM3nKUvOiO//9PheZZHfYRfYl6AwdTH4aTcXSqBerX0ml4A==", + "version": "0.18.13", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.18.13.tgz", + "integrity": "sha512-6GU+J1PLiVqWx8yoCK4Z0GnfKyCGIH5L2KQipxOtbNPBs+qNDcMJr9euxnyJ6FkRPyMwaSkjejzPSISD9hb+gg==", "cpu": [ "mips64el" ], @@ -236,9 +233,9 @@ } }, "node_modules/@esbuild/linux-ppc64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.17.19.tgz", - "integrity": "sha512-/c/DGybs95WXNS8y3Ti/ytqETiW7EU44MEKuCAcpPto3YjQbyK3IQVKfF6nbghD7EcLUGl0NbiL5Rt5DMhn5tg==", + "version": "0.18.13", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.18.13.tgz", + "integrity": "sha512-pfn/OGZ8tyR8YCV7MlLl5hAit2cmS+j/ZZg9DdH0uxdCoJpV7+5DbuXrR+es4ayRVKIcfS9TTMCs60vqQDmh+w==", "cpu": [ "ppc64" ], @@ -252,9 +249,9 @@ } }, "node_modules/@esbuild/linux-riscv64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.17.19.tgz", - "integrity": "sha512-FC3nUAWhvFoutlhAkgHf8f5HwFWUL6bYdvLc/TTuxKlvLi3+pPzdZiFKSWz/PF30TB1K19SuCxDTI5KcqASJqA==", + "version": "0.18.13", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.18.13.tgz", + "integrity": "sha512-aIbhU3LPg0lOSCfVeGHbmGYIqOtW6+yzO+Nfv57YblEK01oj0mFMtvDJlOaeAZ6z0FZ9D13oahi5aIl9JFphGg==", "cpu": [ "riscv64" ], @@ -268,9 +265,9 @@ } }, "node_modules/@esbuild/linux-s390x": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.17.19.tgz", - "integrity": "sha512-IbFsFbxMWLuKEbH+7sTkKzL6NJmG2vRyy6K7JJo55w+8xDk7RElYn6xvXtDW8HCfoKBFK69f3pgBJSUSQPr+4Q==", + "version": "0.18.13", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.18.13.tgz", + "integrity": "sha512-Pct1QwF2sp+5LVi4Iu5Y+6JsGaV2Z2vm4O9Dd7XZ5tKYxEHjFtb140fiMcl5HM1iuv6xXO8O1Vrb1iJxHlv8UA==", "cpu": [ "s390x" ], @@ -284,9 +281,9 @@ } }, "node_modules/@esbuild/linux-x64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.17.19.tgz", - "integrity": "sha512-68ngA9lg2H6zkZcyp22tsVt38mlhWde8l3eJLWkyLrp4HwMUr3c1s/M2t7+kHIhvMjglIBrFpncX1SzMckomGw==", + "version": "0.18.13", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.18.13.tgz", + "integrity": "sha512-zTrIP0KzYP7O0+3ZnmzvUKgGtUvf4+piY8PIO3V8/GfmVd3ZyHJGz7Ht0np3P1wz+I8qJ4rjwJKqqEAbIEPngA==", "cpu": [ "x64" ], @@ -300,9 +297,9 @@ } }, "node_modules/@esbuild/netbsd-x64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.17.19.tgz", - "integrity": "sha512-CwFq42rXCR8TYIjIfpXCbRX0rp1jo6cPIUPSaWwzbVI4aOfX96OXY8M6KNmtPcg7QjYeDmN+DD0Wp3LaBOLf4Q==", + "version": "0.18.13", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.18.13.tgz", + "integrity": "sha512-I6zs10TZeaHDYoGxENuksxE1sxqZpCp+agYeW039yqFwh3MgVvdmXL5NMveImOC6AtpLvE4xG5ujVic4NWFIDQ==", "cpu": [ "x64" ], @@ -316,9 +313,9 @@ } }, "node_modules/@esbuild/openbsd-x64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.17.19.tgz", - "integrity": "sha512-cnq5brJYrSZ2CF6c35eCmviIN3k3RczmHz8eYaVlNasVqsNY+JKohZU5MKmaOI+KkllCdzOKKdPs762VCPC20g==", + "version": "0.18.13", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.18.13.tgz", + "integrity": "sha512-W5C5nczhrt1y1xPG5bV+0M12p2vetOGlvs43LH8SopQ3z2AseIROu09VgRqydx5qFN7y9qCbpgHLx0kb0TcW7g==", "cpu": [ "x64" ], @@ -332,9 +329,9 @@ } }, "node_modules/@esbuild/sunos-x64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.17.19.tgz", - "integrity": "sha512-vCRT7yP3zX+bKWFeP/zdS6SqdWB8OIpaRq/mbXQxTGHnIxspRtigpkUcDMlSCOejlHowLqII7K2JKevwyRP2rg==", + "version": "0.18.13", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.18.13.tgz", + "integrity": "sha512-X/xzuw4Hzpo/yq3YsfBbIsipNgmsm8mE/QeWbdGdTTeZ77fjxI2K0KP3AlhZ6gU3zKTw1bKoZTuKLnqcJ537qw==", "cpu": [ "x64" ], @@ -348,9 +345,9 @@ } }, "node_modules/@esbuild/win32-arm64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.17.19.tgz", - "integrity": "sha512-yYx+8jwowUstVdorcMdNlzklLYhPxjniHWFKgRqH7IFlUEa0Umu3KuYplf1HUZZ422e3NU9F4LGb+4O0Kdcaag==", + "version": "0.18.13", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.18.13.tgz", + "integrity": "sha512-4CGYdRQT/ILd+yLLE5i4VApMPfGE0RPc/wFQhlluDQCK09+b4JDbxzzjpgQqTPrdnP7r5KUtGVGZYclYiPuHrw==", "cpu": [ "arm64" ], @@ -364,9 +361,9 @@ } }, "node_modules/@esbuild/win32-ia32": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.17.19.tgz", - "integrity": "sha512-eggDKanJszUtCdlVs0RB+h35wNlb5v4TWEkq4vZcmVt5u/HiDZrTXe2bWFQUez3RgNHwx/x4sk5++4NSSicKkw==", + "version": "0.18.13", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.18.13.tgz", + "integrity": "sha512-D+wKZaRhQI+MUGMH+DbEr4owC2D7XnF+uyGiZk38QbgzLcofFqIOwFs7ELmIeU45CQgfHNy9Q+LKW3cE8g37Kg==", "cpu": [ "ia32" ], @@ -380,9 +377,9 @@ } }, "node_modules/@esbuild/win32-x64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.17.19.tgz", - "integrity": "sha512-lAhycmKnVOuRYNtRtatQR1LPQf2oYCkRGkSFnseDAKPl8lu5SOsK/e1sXe5a0Pc5kHIHe6P2I/ilntNv2xf3cA==", + "version": "0.18.13", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.18.13.tgz", + "integrity": "sha512-iVl6lehAfJS+VmpF3exKpNQ8b0eucf5VWfzR8S7xFve64NBNz2jPUgx1X93/kfnkfgP737O+i1k54SVQS7uVZA==", "cpu": [ "x64" ], @@ -411,23 +408,23 @@ } }, "node_modules/@eslint-community/regexpp": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.5.0.tgz", - "integrity": "sha512-vITaYzIcNmjn5tF5uxcZ/ft7/RXGrMUIS9HalWckEOF6ESiwXKoMzAQf2UW0aVd6rnOeExTJVd5hmWXucBKGXQ==", + "version": "4.5.1", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.5.1.tgz", + "integrity": "sha512-Z5ba73P98O1KUYCCJTUeVpja9RcGoMdncZ6T49FCUl2lN38JtCJ+3WgIDBv0AuY4WChU5PmtJmOCTlN6FZTFKQ==", "dev": true, "engines": { "node": "^12.0.0 || ^14.0.0 || >=16.0.0" } }, "node_modules/@eslint/eslintrc": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.0.3.tgz", - "integrity": "sha512-+5gy6OQfk+xx3q0d6jGZZC3f3KzAkXc/IanVxd1is/VIIziRqqt3ongQz0FiTUXqTk0c7aDB3OaFuKnuSoJicQ==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.0.tgz", + "integrity": "sha512-Lj7DECXqIVCqnqjjHMPna4vn6GJcMgul/wuS0je9OZ9gsL0zzDpKPVtcG1HaDVc+9y+qgXneTeUMbCqXJNpH1A==", "dev": true, "dependencies": { "ajv": "^6.12.4", "debug": "^4.3.2", - "espree": "^9.5.2", + "espree": "^9.6.0", "globals": "^13.19.0", "ignore": "^5.2.0", "import-fresh": "^3.2.1", @@ -443,18 +440,18 @@ } }, "node_modules/@eslint/js": { - "version": "8.40.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.40.0.tgz", - "integrity": "sha512-ElyB54bJIhXQYVKjDSvCkPO1iU1tSAeVQJbllWJq1XQSmmA4dgFk8CbiBGpiOPxleE48vDogxCtmMYku4HSVLA==", + "version": "8.44.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.44.0.tgz", + "integrity": "sha512-Ag+9YM4ocKQx9AarydN0KY2j0ErMHNIocPDrVo8zAE44xLTjEtz81OdR68/cydGtk6m6jDb5Za3r2useMzYmSw==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, "node_modules/@humanwhocodes/config-array": { - "version": "0.11.8", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.8.tgz", - "integrity": "sha512-UybHIJzJnR5Qc/MsD9Kr+RpO2h+/P1GhOwdiLPXK5TWk5sgTdu88bTD9UP+CKbPPh5Rni1u0GjAdYQLemG8g+g==", + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.10.tgz", + "integrity": "sha512-KVVjQmNUepDVGXNuoRRdmmEjruj0KfiGSbS8LVc12LMsWDQzRXJ0qdhN8L8uUigKpfEHRhlaQFY0ib1tnUbNeQ==", "dev": true, "dependencies": { "@humanwhocodes/object-schema": "^1.2.1", @@ -484,35 +481,54 @@ "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", "dev": true }, - "node_modules/@jridgewell/resolve-uri": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz", - "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==", + "node_modules/@isaacs/cliui": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", + "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", "dev": true, + "dependencies": { + "string-width": "^5.1.2", + "string-width-cjs": "npm:string-width@^4.2.0", + "strip-ansi": "^7.0.1", + "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", + "wrap-ansi": "^8.1.0", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + }, "engines": { - "node": ">=6.0.0" + "node": ">=12" } }, - "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.4.15", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", - "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", - "dev": true + "node_modules/@isaacs/cliui/node_modules/ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } }, - "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.9", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", - "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "node_modules/@isaacs/cliui/node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", "dev": true, "dependencies": { - "@jridgewell/resolve-uri": "^3.0.3", - "@jridgewell/sourcemap-codec": "^1.4.10" + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" } }, "node_modules/@multiversx/sdk-core": { - "version": "12.2.1", - "resolved": "https://registry.npmjs.org/@multiversx/sdk-core/-/sdk-core-12.2.1.tgz", - "integrity": "sha512-jnVwr7ljZ3AD5rN/lifrNq5uZU7CenNVqnCzu8Ks1fVJ/TOZM6VUkVXoSvceweXY0vw7FyH6FBVRUQqWPWbZzg==", + "version": "12.6.0", + "resolved": "https://registry.npmjs.org/@multiversx/sdk-core/-/sdk-core-12.6.0.tgz", + "integrity": "sha512-aJjSn8EzaYXalUuvAuxOTPtv8GDbimJlSYNRLjCsToyfwGAyS9cRllmq2d1I2nlrR89YgAsOL9qp+sI5DA7yBw==", "dev": true, "dependencies": { "@multiversx/sdk-transaction-decoder": "1.0.2", @@ -522,38 +538,31 @@ "buffer": "6.0.3", "json-duplicate-key-handle": "1.0.0", "keccak": "3.0.2", - "protobufjs": "6.11.3" + "protobufjs": "7.2.4" } }, "node_modules/@multiversx/sdk-extension-provider": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/@multiversx/sdk-extension-provider/-/sdk-extension-provider-2.0.7.tgz", - "integrity": "sha512-t7CabgUk/hPhMYVpqGPMdEVDqOo6RrRKmru6nXKpWZHdeQZZV52zeVVC8VRgqwG5mNwAkCrALLvz7UiV/ZLfIg==", - "dev": true - }, - "node_modules/@multiversx/sdk-native-auth-client": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@multiversx/sdk-native-auth-client/-/sdk-native-auth-client-1.0.2.tgz", - "integrity": "sha512-2y5XCi09Zfgo5fNuQPaSEfOVJoZB8OrAiEtjQy3RDzm44j83E/bByFWDE2CWHV1aRWsn9JwOSQdYWtMO9RMF/Q==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@multiversx/sdk-extension-provider/-/sdk-extension-provider-3.0.0.tgz", + "integrity": "sha512-xNHLShzimYbMXqEJoiNyB4fNOXQUwSJCzt9FiOA4GdxucJnCgIM25mXtSj2I93cz+KD39QgRjEYep+li/lykOw==", "dev": true, - "dependencies": { - "axios": "^0.27.2" + "peerDependencies": { + "@multiversx/sdk-core": ">= 12.1.0" } }, - "node_modules/@multiversx/sdk-native-auth-client/node_modules/axios": { - "version": "0.27.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz", - "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==", + "node_modules/@multiversx/sdk-native-auth-client": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@multiversx/sdk-native-auth-client/-/sdk-native-auth-client-1.0.4.tgz", + "integrity": "sha512-Yz6lAWtGaUHoFma7DICQMr6ZKzNvusPq0eRNOXmTyW+9Zm9Gih2qUKFiIDEeEe6Fn9d6hO+ed20R4h3anYsxPw==", "dev": true, "dependencies": { - "follow-redirects": "^1.14.9", - "form-data": "^4.0.0" + "axios": "0.24.0" } }, "node_modules/@multiversx/sdk-network-providers": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/@multiversx/sdk-network-providers/-/sdk-network-providers-1.4.0.tgz", - "integrity": "sha512-a9vcY6wNM3ZccApULXbTCPp3/dAu4J6uH0go3jHy8YB0iH9nKiTLQLUD+1fM0lJmuC9Tk9Q+EeAj7OJzQqHKkQ==", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@multiversx/sdk-network-providers/-/sdk-network-providers-1.5.0.tgz", + "integrity": "sha512-GgmpOfwdeK8QvBCVJ96/L2ATNax7/rdSDvPLlmppKHVuFAj56/EqGnrLuktNPRWBsZse+7DMoS38kGtN77AwJQ==", "dev": true, "dependencies": { "axios": "0.24.0", @@ -579,15 +588,17 @@ "dev": true }, "node_modules/@multiversx/sdk-wallet-connect-provider": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/@multiversx/sdk-wallet-connect-provider/-/sdk-wallet-connect-provider-3.2.1.tgz", - "integrity": "sha512-2SQzVbR8HMU4kcW4uahj1jmqYDg75hADO78GEBx0oUQQDk72nPkII2/73azVvKMHuM+4YyrJa97I0KWtCUmTPg==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@multiversx/sdk-wallet-connect-provider/-/sdk-wallet-connect-provider-4.0.2.tgz", + "integrity": "sha512-WGim7kD49N5LoWestdmvxBYeJEDCevJv50Gt/RFBtZoWT3OyDoWu2wotVNssjPW0UQ5EyYPae96g+6FNHrXsxw==", "dev": true, "dependencies": { - "@walletconnect/client": "1.8.0", - "@walletconnect/sign-client": "2.6.2", - "@walletconnect/utils": "2.6.2", + "@walletconnect/sign-client": "2.9.0", + "@walletconnect/utils": "2.9.0", "bech32": "1.1.4" + }, + "peerDependencies": { + "@multiversx/sdk-core": ">= 12.1.0" } }, "node_modules/@multiversx/sdk-web-wallet-provider": { @@ -637,6 +648,42 @@ "node": ">= 8" } }, + "node_modules/@pkgjs/parseargs": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", + "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", + "dev": true, + "optional": true, + "engines": { + "node": ">=14" + } + }, + "node_modules/@pkgr/utils": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/@pkgr/utils/-/utils-2.4.2.tgz", + "integrity": "sha512-POgTXhjrTfbTV63DiFXav4lBHiICLKKwDeaKn9Nphwj7WH6m0hMMCaJkMyRWjgtPFyRKRVoMXXjczsTQRDEhYw==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.3", + "fast-glob": "^3.3.0", + "is-glob": "^4.0.3", + "open": "^9.1.0", + "picocolors": "^1.0.0", + "tslib": "^2.6.0" + }, + "engines": { + "node": "^12.20.0 || ^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/unts" + } + }, + "node_modules/@pkgr/utils/node_modules/tslib": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.0.tgz", + "integrity": "sha512-7At1WUettjcSRHXCyYtTselblcHl9PJFFVKiCAy/bY97+BPZXSQ2wbq0P9s8tK2G7dFQfNnlJnPAiArVBVBsfA==", + "dev": true + }, "node_modules/@protobufjs/aspromise": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", @@ -865,52 +912,22 @@ "@stablelib/wipe": "^1.0.1" } }, - "node_modules/@tsconfig/node10": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", - "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==", - "dev": true - }, - "node_modules/@tsconfig/node12": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", - "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", - "dev": true - }, - "node_modules/@tsconfig/node14": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", - "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", - "dev": true - }, - "node_modules/@tsconfig/node16": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.3.tgz", - "integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==", - "dev": true - }, "node_modules/@types/json-schema": { - "version": "7.0.11", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", - "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", - "dev": true - }, - "node_modules/@types/long": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.2.tgz", - "integrity": "sha512-MqTGEo5bj5t157U6fA/BiDynNkn0YknVdh48CMPkTSpFTVmvao5UQmm7uEF6xBEo7qIMAlY/JSleYaE6VOdpaA==", + "version": "7.0.12", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.12.tgz", + "integrity": "sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA==", "dev": true }, "node_modules/@types/node": { - "version": "18.15.11", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.11.tgz", - "integrity": "sha512-E5Kwq2n4SbMzQOn6wnmBjuK9ouqlURrcZDVfbo9ftDDTFt3nk7ZKK4GMOzoYgnpQJKcxwQw+lGaBvvlMo0qN/Q==", + "version": "20.4.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.1.tgz", + "integrity": "sha512-JIzsAvJeA/5iY6Y/OxZbv1lUcc8dNSE77lb2gnBH+/PJ3lFR1Ccvgwl5JWnHAkNHcRsT0TbpVOsiMKZ1F/yyJg==", "dev": true }, "node_modules/@types/qrcode": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@types/qrcode/-/qrcode-1.5.0.tgz", - "integrity": "sha512-x5ilHXRxUPIMfjtM+1vf/GPTRWZ81nqscursm5gMznJeK9M0YnZ1c3bEvRLQ0zSSgedLx1J6MGL231ObQGGhaA==", + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@types/qrcode/-/qrcode-1.5.1.tgz", + "integrity": "sha512-HpSN675K0PmxIDRpjMI3Mc2GiKo3dNu+X/F5SoItiaDS1lVfgC6Wac1c5lQDfKWbTJUSHWiHKzpJpBZG7k9gaA==", "dev": true, "dependencies": { "@types/node": "*" @@ -932,32 +949,35 @@ } }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "5.59.5", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.59.5.tgz", - "integrity": "sha512-feA9xbVRWJZor+AnLNAr7A8JRWeZqHUf4T9tlP+TN04b05pFVhO5eN7/O93Y/1OUlLMHKbnJisgDURs/qvtqdg==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.0.0.tgz", + "integrity": "sha512-xuv6ghKGoiq856Bww/yVYnXGsKa588kY3M0XK7uUW/3fJNNULKRfZfSBkMTSpqGG/8ZCXCadfh8G/z/B4aqS/A==", "dev": true, "dependencies": { - "@eslint-community/regexpp": "^4.4.0", - "@typescript-eslint/scope-manager": "5.59.5", - "@typescript-eslint/type-utils": "5.59.5", - "@typescript-eslint/utils": "5.59.5", + "@eslint-community/regexpp": "^4.5.0", + "@typescript-eslint/scope-manager": "6.0.0", + "@typescript-eslint/type-utils": "6.0.0", + "@typescript-eslint/utils": "6.0.0", + "@typescript-eslint/visitor-keys": "6.0.0", "debug": "^4.3.4", "grapheme-splitter": "^1.0.4", - "ignore": "^5.2.0", + "graphemer": "^1.4.0", + "ignore": "^5.2.4", + "natural-compare": "^1.4.0", "natural-compare-lite": "^1.4.0", - "semver": "^7.3.7", - "tsutils": "^3.21.0" + "semver": "^7.5.0", + "ts-api-utils": "^1.0.1" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^16.0.0 || >=18.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "@typescript-eslint/parser": "^5.0.0", - "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + "@typescript-eslint/parser": "^6.0.0 || ^6.0.0-alpha", + "eslint": "^7.0.0 || ^8.0.0" }, "peerDependenciesMeta": { "typescript": { @@ -966,25 +986,26 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "5.59.5", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.59.5.tgz", - "integrity": "sha512-NJXQC4MRnF9N9yWqQE2/KLRSOLvrrlZb48NGVfBa+RuPMN6B7ZcK5jZOvhuygv4D64fRKnZI4L4p8+M+rfeQuw==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.0.0.tgz", + "integrity": "sha512-TNaufYSPrr1U8n+3xN+Yp9g31vQDJqhXzzPSHfQDLcaO4tU+mCfODPxCwf4H530zo7aUBE3QIdxCXamEnG04Tg==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "5.59.5", - "@typescript-eslint/types": "5.59.5", - "@typescript-eslint/typescript-estree": "5.59.5", + "@typescript-eslint/scope-manager": "6.0.0", + "@typescript-eslint/types": "6.0.0", + "@typescript-eslint/typescript-estree": "6.0.0", + "@typescript-eslint/visitor-keys": "6.0.0", "debug": "^4.3.4" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^16.0.0 || >=18.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + "eslint": "^7.0.0 || ^8.0.0" }, "peerDependenciesMeta": { "typescript": { @@ -993,16 +1014,16 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "5.59.5", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.59.5.tgz", - "integrity": "sha512-jVecWwnkX6ZgutF+DovbBJirZcAxgxC0EOHYt/niMROf8p4PwxxG32Qdhj/iIQQIuOflLjNkxoXyArkcIP7C3A==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.0.0.tgz", + "integrity": "sha512-o4q0KHlgCZTqjuaZ25nw5W57NeykZT9LiMEG4do/ovwvOcPnDO1BI5BQdCsUkjxFyrCL0cSzLjvIMfR9uo7cWg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.59.5", - "@typescript-eslint/visitor-keys": "5.59.5" + "@typescript-eslint/types": "6.0.0", + "@typescript-eslint/visitor-keys": "6.0.0" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^16.0.0 || >=18.0.0" }, "funding": { "type": "opencollective", @@ -1010,25 +1031,25 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "5.59.5", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.59.5.tgz", - "integrity": "sha512-4eyhS7oGym67/pSxA2mmNq7X164oqDYNnZCUayBwJZIRVvKpBCMBzFnFxjeoDeShjtO6RQBHBuwybuX3POnDqg==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.0.0.tgz", + "integrity": "sha512-ah6LJvLgkoZ/pyJ9GAdFkzeuMZ8goV6BH7eC9FPmojrnX9yNCIsfjB+zYcnex28YO3RFvBkV6rMV6WpIqkPvoQ==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "5.59.5", - "@typescript-eslint/utils": "5.59.5", + "@typescript-eslint/typescript-estree": "6.0.0", + "@typescript-eslint/utils": "6.0.0", "debug": "^4.3.4", - "tsutils": "^3.21.0" + "ts-api-utils": "^1.0.1" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^16.0.0 || >=18.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "eslint": "*" + "eslint": "^7.0.0 || ^8.0.0" }, "peerDependenciesMeta": { "typescript": { @@ -1037,12 +1058,12 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "5.59.5", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.59.5.tgz", - "integrity": "sha512-xkfRPHbqSH4Ggx4eHRIO/eGL8XL4Ysb4woL8c87YuAo8Md7AUjyWKa9YMwTL519SyDPrfEgKdewjkxNCVeJW7w==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.0.0.tgz", + "integrity": "sha512-Zk9KDggyZM6tj0AJWYYKgF0yQyrcnievdhG0g5FqyU3Y2DRxJn4yWY21sJC0QKBckbsdKKjYDV2yVrrEvuTgxg==", "dev": true, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^16.0.0 || >=18.0.0" }, "funding": { "type": "opencollective", @@ -1050,21 +1071,21 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "5.59.5", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.59.5.tgz", - "integrity": "sha512-+XXdLN2CZLZcD/mO7mQtJMvCkzRfmODbeSKuMY/yXbGkzvA9rJyDY5qDYNoiz2kP/dmyAxXquL2BvLQLJFPQIg==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.0.0.tgz", + "integrity": "sha512-2zq4O7P6YCQADfmJ5OTDQTP3ktajnXIRrYAtHM9ofto/CJZV3QfJ89GEaM2BNGeSr1KgmBuLhEkz5FBkS2RQhQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.59.5", - "@typescript-eslint/visitor-keys": "5.59.5", + "@typescript-eslint/types": "6.0.0", + "@typescript-eslint/visitor-keys": "6.0.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", - "semver": "^7.3.7", - "tsutils": "^3.21.0" + "semver": "^7.5.0", + "ts-api-utils": "^1.0.1" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^16.0.0 || >=18.0.0" }, "funding": { "type": "opencollective", @@ -1077,211 +1098,70 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "5.59.5", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.59.5.tgz", - "integrity": "sha512-sCEHOiw+RbyTii9c3/qN74hYDPNORb8yWCoPLmB7BIflhplJ65u2PBpdRla12e3SSTJ2erRkPjz7ngLHhUegxA==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.0.0.tgz", + "integrity": "sha512-SOr6l4NB6HE4H/ktz0JVVWNXqCJTOo/mHnvIte1ZhBQ0Cvd04x5uKZa3zT6tiodL06zf5xxdK8COiDvPnQ27JQ==", "dev": true, "dependencies": { - "@eslint-community/eslint-utils": "^4.2.0", - "@types/json-schema": "^7.0.9", + "@eslint-community/eslint-utils": "^4.3.0", + "@types/json-schema": "^7.0.11", "@types/semver": "^7.3.12", - "@typescript-eslint/scope-manager": "5.59.5", - "@typescript-eslint/types": "5.59.5", - "@typescript-eslint/typescript-estree": "5.59.5", + "@typescript-eslint/scope-manager": "6.0.0", + "@typescript-eslint/types": "6.0.0", + "@typescript-eslint/typescript-estree": "6.0.0", "eslint-scope": "^5.1.1", - "semver": "^7.3.7" + "semver": "^7.5.0" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^16.0.0 || >=18.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + "eslint": "^7.0.0 || ^8.0.0" } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "5.59.5", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.59.5.tgz", - "integrity": "sha512-qL+Oz+dbeBRTeyJTIy0eniD3uvqU7x+y1QceBismZ41hd4aBSRh8UAw4pZP0+XzLuPZmx4raNMq/I+59W2lXKA==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.0.0.tgz", + "integrity": "sha512-cvJ63l8c0yXdeT5POHpL0Q1cZoRcmRKFCtSjNGJxPkcP571EfZMcNbzWAc7oK3D1dRzm/V5EwtkANTZxqvuuUA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.59.5", - "eslint-visitor-keys": "^3.3.0" + "@typescript-eslint/types": "6.0.0", + "eslint-visitor-keys": "^3.4.1" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^16.0.0 || >=18.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/@walletconnect/browser-utils": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/@walletconnect/browser-utils/-/browser-utils-1.8.0.tgz", - "integrity": "sha512-Wcqqx+wjxIo9fv6eBUFHPsW1y/bGWWRboni5dfD8PtOmrihrEpOCmvRJe4rfl7xgJW8Ea9UqKEaq0bIRLHlK4A==", - "dev": true, - "dependencies": { - "@walletconnect/safe-json": "1.0.0", - "@walletconnect/types": "^1.8.0", - "@walletconnect/window-getters": "1.0.0", - "@walletconnect/window-metadata": "1.0.0", - "detect-browser": "5.2.0" - } - }, - "node_modules/@walletconnect/browser-utils/node_modules/@walletconnect/safe-json": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@walletconnect/safe-json/-/safe-json-1.0.0.tgz", - "integrity": "sha512-QJzp/S/86sUAgWY6eh5MKYmSfZaRpIlmCJdi5uG4DJlKkZrHEF7ye7gA+VtbVzvTtpM/gRwO2plQuiooIeXjfg==", - "dev": true - }, - "node_modules/@walletconnect/browser-utils/node_modules/@walletconnect/window-getters": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@walletconnect/window-getters/-/window-getters-1.0.0.tgz", - "integrity": "sha512-xB0SQsLaleIYIkSsl43vm8EwETpBzJ2gnzk7e0wMF3ktqiTGS6TFHxcprMl5R44KKh4tCcHCJwolMCaDSwtAaA==", - "dev": true - }, - "node_modules/@walletconnect/browser-utils/node_modules/@walletconnect/window-metadata": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@walletconnect/window-metadata/-/window-metadata-1.0.0.tgz", - "integrity": "sha512-9eFvmJxIKCC3YWOL97SgRkKhlyGXkrHwamfechmqszbypFspaSk+t2jQXAEU7YClHF6Qjw5eYOmy1//zFi9/GA==", - "dev": true, - "dependencies": { - "@walletconnect/window-getters": "^1.0.0" - } - }, - "node_modules/@walletconnect/browser-utils/node_modules/detect-browser": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/detect-browser/-/detect-browser-5.2.0.tgz", - "integrity": "sha512-tr7XntDAu50BVENgQfajMLzacmSe34D+qZc4zjnniz0ZVuw/TZcLcyxHQjYpJTM36sGEkZZlYLnIM1hH7alTMA==", - "dev": true - }, - "node_modules/@walletconnect/client": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/@walletconnect/client/-/client-1.8.0.tgz", - "integrity": "sha512-svyBQ14NHx6Cs2j4TpkQaBI/2AF4+LXz64FojTjMtV4VMMhl81jSO1vNeg+yYhQzvjcGH/GpSwixjyCW0xFBOQ==", - "deprecated": "WalletConnect's v1 SDKs are now deprecated. Please upgrade to a v2 SDK. For details see: https://docs.walletconnect.com/", - "dev": true, - "dependencies": { - "@walletconnect/core": "^1.8.0", - "@walletconnect/iso-crypto": "^1.8.0", - "@walletconnect/types": "^1.8.0", - "@walletconnect/utils": "^1.8.0" - } - }, - "node_modules/@walletconnect/client/node_modules/@walletconnect/utils": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/@walletconnect/utils/-/utils-1.8.0.tgz", - "integrity": "sha512-zExzp8Mj1YiAIBfKNm5u622oNw44WOESzo6hj+Q3apSMIb0Jph9X3GDIdbZmvVZsNPxWDL7uodKgZcCInZv2vA==", - "dev": true, - "dependencies": { - "@walletconnect/browser-utils": "^1.8.0", - "@walletconnect/encoding": "^1.0.1", - "@walletconnect/jsonrpc-utils": "^1.0.3", - "@walletconnect/types": "^1.8.0", - "bn.js": "4.11.8", - "js-sha3": "0.8.0", - "query-string": "6.13.5" - } - }, - "node_modules/@walletconnect/client/node_modules/bn.js": { - "version": "4.11.8", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", - "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==", - "dev": true - }, - "node_modules/@walletconnect/client/node_modules/query-string": { - "version": "6.13.5", - "resolved": "https://registry.npmjs.org/query-string/-/query-string-6.13.5.tgz", - "integrity": "sha512-svk3xg9qHR39P3JlHuD7g3nRnyay5mHbrPctEBDUxUkHRifPHXJDhBUycdCC0NBjXoDf44Gb+IsOZL1Uwn8M/Q==", - "dev": true, - "dependencies": { - "decode-uri-component": "^0.2.0", - "split-on-first": "^1.0.0", - "strict-uri-encode": "^2.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/@walletconnect/core": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/@walletconnect/core/-/core-1.8.0.tgz", - "integrity": "sha512-aFTHvEEbXcZ8XdWBw6rpQDte41Rxwnuk3SgTD8/iKGSRTni50gI9S3YEzMj05jozSiOBxQci4pJDMVhIUMtarw==", - "dev": true, - "dependencies": { - "@walletconnect/socket-transport": "^1.8.0", - "@walletconnect/types": "^1.8.0", - "@walletconnect/utils": "^1.8.0" - } - }, - "node_modules/@walletconnect/core/node_modules/@walletconnect/utils": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/@walletconnect/utils/-/utils-1.8.0.tgz", - "integrity": "sha512-zExzp8Mj1YiAIBfKNm5u622oNw44WOESzo6hj+Q3apSMIb0Jph9X3GDIdbZmvVZsNPxWDL7uodKgZcCInZv2vA==", - "dev": true, - "dependencies": { - "@walletconnect/browser-utils": "^1.8.0", - "@walletconnect/encoding": "^1.0.1", - "@walletconnect/jsonrpc-utils": "^1.0.3", - "@walletconnect/types": "^1.8.0", - "bn.js": "4.11.8", - "js-sha3": "0.8.0", - "query-string": "6.13.5" - } - }, - "node_modules/@walletconnect/core/node_modules/bn.js": { - "version": "4.11.8", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", - "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==", - "dev": true - }, - "node_modules/@walletconnect/core/node_modules/query-string": { - "version": "6.13.5", - "resolved": "https://registry.npmjs.org/query-string/-/query-string-6.13.5.tgz", - "integrity": "sha512-svk3xg9qHR39P3JlHuD7g3nRnyay5mHbrPctEBDUxUkHRifPHXJDhBUycdCC0NBjXoDf44Gb+IsOZL1Uwn8M/Q==", - "dev": true, - "dependencies": { - "decode-uri-component": "^0.2.0", - "split-on-first": "^1.0.0", - "strict-uri-encode": "^2.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@walletconnect/crypto": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@walletconnect/crypto/-/crypto-1.0.3.tgz", - "integrity": "sha512-+2jdORD7XQs76I2Odgr3wwrtyuLUXD/kprNVsjWRhhhdO9Mt6WqVzOPu0/t7OHSmgal8k7SoBQzUc5hu/8zL/g==", - "dev": true, - "dependencies": { - "@walletconnect/encoding": "^1.0.2", - "@walletconnect/environment": "^1.0.1", - "@walletconnect/randombytes": "^1.0.3", - "aes-js": "^3.1.2", - "hash.js": "^1.1.7", - "tslib": "1.14.1" - } - }, - "node_modules/@walletconnect/encoding": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@walletconnect/encoding/-/encoding-1.0.2.tgz", - "integrity": "sha512-CrwSBrjqJ7rpGQcTL3kU+Ief+Bcuu9PH6JLOb+wM6NITX1GTxR/MfNwnQfhLKK6xpRAyj2/nM04OOH6wS8Imag==", + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@walletconnect/core/-/core-2.9.0.tgz", + "integrity": "sha512-MZYJghS9YCvGe32UOgDj0mCasaOoGHQaYXWeQblXE/xb8HuaM6kAWhjIQN9P+MNp5QP134BHP5olQostcCotXQ==", "dev": true, "dependencies": { - "is-typedarray": "1.0.0", - "tslib": "1.14.1", - "typedarray-to-buffer": "3.1.5" + "@walletconnect/heartbeat": "1.2.1", + "@walletconnect/jsonrpc-provider": "1.0.13", + "@walletconnect/jsonrpc-types": "1.0.3", + "@walletconnect/jsonrpc-utils": "1.0.8", + "@walletconnect/jsonrpc-ws-connection": "1.0.12", + "@walletconnect/keyvaluestorage": "^1.0.2", + "@walletconnect/logger": "^2.0.1", + "@walletconnect/relay-api": "^1.0.9", + "@walletconnect/relay-auth": "^1.0.4", + "@walletconnect/safe-json": "^1.0.2", + "@walletconnect/time": "^1.0.2", + "@walletconnect/types": "2.9.0", + "@walletconnect/utils": "2.9.0", + "events": "^3.3.0", + "lodash.isequal": "4.5.0", + "uint8arrays": "^3.1.0" } }, "node_modules/@walletconnect/environment": { @@ -1304,83 +1184,31 @@ } }, "node_modules/@walletconnect/heartbeat": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@walletconnect/heartbeat/-/heartbeat-1.2.0.tgz", - "integrity": "sha512-0vbzTa/ARrpmMmOD+bQMxPvFYKtOLQZObgZakrYr0aODiMOO71CmPVNV2eAqXnw9rMmcP+z91OybLeIFlwTjjA==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@walletconnect/heartbeat/-/heartbeat-1.2.1.tgz", + "integrity": "sha512-yVzws616xsDLJxuG/28FqtZ5rzrTA4gUjdEMTbWB5Y8V1XHRmqq4efAxCw5ie7WjbXFSUyBHaWlMR+2/CpQC5Q==", "dev": true, "dependencies": { "@walletconnect/events": "^1.0.1", "@walletconnect/time": "^1.0.2", - "chai": "^4.3.7", - "mocha": "^10.2.0", - "ts-node": "^10.9.1", "tslib": "1.14.1" } }, - "node_modules/@walletconnect/iso-crypto": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/@walletconnect/iso-crypto/-/iso-crypto-1.8.0.tgz", - "integrity": "sha512-pWy19KCyitpfXb70hA73r9FcvklS+FvO9QUIttp3c2mfW8frxgYeRXfxLRCIQTkaYueRKvdqPjbyhPLam508XQ==", - "dev": true, - "dependencies": { - "@walletconnect/crypto": "^1.0.2", - "@walletconnect/types": "^1.8.0", - "@walletconnect/utils": "^1.8.0" - } - }, - "node_modules/@walletconnect/iso-crypto/node_modules/@walletconnect/utils": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/@walletconnect/utils/-/utils-1.8.0.tgz", - "integrity": "sha512-zExzp8Mj1YiAIBfKNm5u622oNw44WOESzo6hj+Q3apSMIb0Jph9X3GDIdbZmvVZsNPxWDL7uodKgZcCInZv2vA==", - "dev": true, - "dependencies": { - "@walletconnect/browser-utils": "^1.8.0", - "@walletconnect/encoding": "^1.0.1", - "@walletconnect/jsonrpc-utils": "^1.0.3", - "@walletconnect/types": "^1.8.0", - "bn.js": "4.11.8", - "js-sha3": "0.8.0", - "query-string": "6.13.5" - } - }, - "node_modules/@walletconnect/iso-crypto/node_modules/bn.js": { - "version": "4.11.8", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", - "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==", - "dev": true - }, - "node_modules/@walletconnect/iso-crypto/node_modules/query-string": { - "version": "6.13.5", - "resolved": "https://registry.npmjs.org/query-string/-/query-string-6.13.5.tgz", - "integrity": "sha512-svk3xg9qHR39P3JlHuD7g3nRnyay5mHbrPctEBDUxUkHRifPHXJDhBUycdCC0NBjXoDf44Gb+IsOZL1Uwn8M/Q==", - "dev": true, - "dependencies": { - "decode-uri-component": "^0.2.0", - "split-on-first": "^1.0.0", - "strict-uri-encode": "^2.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/@walletconnect/jsonrpc-provider": { - "version": "1.0.12", - "resolved": "https://registry.npmjs.org/@walletconnect/jsonrpc-provider/-/jsonrpc-provider-1.0.12.tgz", - "integrity": "sha512-6uI2y5281gloZSzICOjk+CVC7CVu0MhtMt2Yzpj05lPb0pzm/bK2oZ2ibxwLerPrqpNt/5bIFVRmoOgPw1mHAQ==", + "version": "1.0.13", + "resolved": "https://registry.npmjs.org/@walletconnect/jsonrpc-provider/-/jsonrpc-provider-1.0.13.tgz", + "integrity": "sha512-K73EpThqHnSR26gOyNEL+acEex3P7VWZe6KE12ZwKzAt2H4e5gldZHbjsu2QR9cLeJ8AXuO7kEMOIcRv1QEc7g==", "dev": true, "dependencies": { - "@walletconnect/jsonrpc-utils": "^1.0.7", + "@walletconnect/jsonrpc-utils": "^1.0.8", "@walletconnect/safe-json": "^1.0.2", "tslib": "1.14.1" } }, "node_modules/@walletconnect/jsonrpc-types": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@walletconnect/jsonrpc-types/-/jsonrpc-types-1.0.2.tgz", - "integrity": "sha512-CZe8tjJX73OWdHjrBHy7HtAapJ2tT0Q3TYhPBhRxi3643lwPIQWC9En45ldY14TZwgSewkbZ0FtGBZK0G7Bbyg==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@walletconnect/jsonrpc-types/-/jsonrpc-types-1.0.3.tgz", + "integrity": "sha512-iIQ8hboBl3o5ufmJ8cuduGad0CQm3ZlsHtujv9Eu16xq89q+BG7Nh5VLxxUgmtpnrePgFkTwXirCTkwJH1v+Yw==", "dev": true, "dependencies": { "keyvaluestorage-interface": "^1.0.0", @@ -1388,20 +1216,20 @@ } }, "node_modules/@walletconnect/jsonrpc-utils": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/@walletconnect/jsonrpc-utils/-/jsonrpc-utils-1.0.7.tgz", - "integrity": "sha512-zJziApzUF/Il4VcwabnaU+0yo1QI4eUkYX99zmCVTHJvZOf2l0zjADf/OpKqWyeNFC3Io56Z/8uJHVtcNVvyFA==", + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@walletconnect/jsonrpc-utils/-/jsonrpc-utils-1.0.8.tgz", + "integrity": "sha512-vdeb03bD8VzJUL6ZtzRYsFMq1eZQcM3EAzT0a3st59dyLfJ0wq+tKMpmGH7HlB7waD858UWgfIcudbPFsbzVdw==", "dev": true, "dependencies": { "@walletconnect/environment": "^1.0.1", - "@walletconnect/jsonrpc-types": "^1.0.2", + "@walletconnect/jsonrpc-types": "^1.0.3", "tslib": "1.14.1" } }, "node_modules/@walletconnect/jsonrpc-ws-connection": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/@walletconnect/jsonrpc-ws-connection/-/jsonrpc-ws-connection-1.0.11.tgz", - "integrity": "sha512-TiFJ6saasKXD+PwGkm5ZGSw0837nc6EeFmurSPgIT/NofnOV4Tv7CVJqGQN0rQYoJUSYu21cwHNYaFkzNpUN+w==", + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/@walletconnect/jsonrpc-ws-connection/-/jsonrpc-ws-connection-1.0.12.tgz", + "integrity": "sha512-HAcadga3Qjt1Cqy+qXEW6zjaCs8uJGdGQrqltzl3OjiK4epGZRdvSzTe63P+t/3z+D2wG+ffEPn0GVcDozmN1w==", "dev": true, "dependencies": { "@walletconnect/jsonrpc-utils": "^1.0.6", @@ -1443,18 +1271,6 @@ "tslib": "1.14.1" } }, - "node_modules/@walletconnect/randombytes": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@walletconnect/randombytes/-/randombytes-1.0.3.tgz", - "integrity": "sha512-35lpzxcHFbTN3ABefC9W+uBpNZl1GC4Wpx0ed30gibfO/y9oLdy1NznbV96HARQKSBV9J9M/rrtIvf6a23jfYw==", - "dev": true, - "dependencies": { - "@walletconnect/encoding": "^1.0.2", - "@walletconnect/environment": "^1.0.1", - "randombytes": "^2.1.0", - "tslib": "1.14.1" - } - }, "node_modules/@walletconnect/relay-api": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/@walletconnect/relay-api/-/relay-api-1.0.9.tgz", @@ -1489,170 +1305,74 @@ } }, "node_modules/@walletconnect/sign-client": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/@walletconnect/sign-client/-/sign-client-2.6.2.tgz", - "integrity": "sha512-2/yXliVVRn27i4rCuIumBB361ZQtKCgAwm6OmPW8P2wJpmJ03K0FuLzuYbYy/WvweuFklQ92cQlg3V8Ez5M+vA==", + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@walletconnect/sign-client/-/sign-client-2.9.0.tgz", + "integrity": "sha512-mEKc4LlLMebCe45qzqh+MX4ilQK4kOEBzLY6YJpG8EhyT45eX4JMNA7qQoYa9MRMaaVb/7USJcc4e3ZrjZvQmA==", "dev": true, "dependencies": { - "@walletconnect/core": "2.6.2", + "@walletconnect/core": "2.9.0", "@walletconnect/events": "^1.0.1", - "@walletconnect/heartbeat": "^1.2.0", - "@walletconnect/jsonrpc-utils": "^1.0.7", + "@walletconnect/heartbeat": "1.2.1", + "@walletconnect/jsonrpc-utils": "1.0.8", "@walletconnect/logger": "^2.0.1", "@walletconnect/time": "^1.0.2", - "@walletconnect/types": "2.6.2", - "@walletconnect/utils": "2.6.2", - "events": "^3.3.0", - "pino": "7.11.0" + "@walletconnect/types": "2.9.0", + "@walletconnect/utils": "2.9.0", + "events": "^3.3.0" } }, - "node_modules/@walletconnect/sign-client/node_modules/@walletconnect/core": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/@walletconnect/core/-/core-2.6.2.tgz", - "integrity": "sha512-uTla1Dyhr9ye1SbyubyxpUlW7r4oVf47EgIMEntbmMK6+xFpeiF7w5hNebIwp9g/dW81QQklwp3c0slwkTahdg==", + "node_modules/@walletconnect/time": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@walletconnect/time/-/time-1.0.2.tgz", + "integrity": "sha512-uzdd9woDcJ1AaBZRhqy5rNC9laqWGErfc4dxA9a87mPdKOgWMD85mcFo9dIYIts/Jwocfwn07EC6EzclKubk/g==", "dev": true, "dependencies": { - "@walletconnect/heartbeat": "1.2.0", - "@walletconnect/jsonrpc-provider": "^1.0.12", - "@walletconnect/jsonrpc-utils": "^1.0.7", - "@walletconnect/jsonrpc-ws-connection": "^1.0.11", - "@walletconnect/keyvaluestorage": "^1.0.2", - "@walletconnect/logger": "^2.0.1", - "@walletconnect/relay-api": "^1.0.9", - "@walletconnect/relay-auth": "^1.0.4", - "@walletconnect/safe-json": "^1.0.2", - "@walletconnect/time": "^1.0.2", - "@walletconnect/types": "2.6.2", - "@walletconnect/utils": "2.6.2", - "events": "^3.3.0", - "lodash.isequal": "4.5.0", - "pino": "7.11.0", - "uint8arrays": "^3.1.0" + "tslib": "1.14.1" } }, - "node_modules/@walletconnect/sign-client/node_modules/@walletconnect/types": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/@walletconnect/types/-/types-2.6.2.tgz", - "integrity": "sha512-eP9xfNVdoQrIfqJSlHqijf0l/Rw/XTO2SeFVlgA5UFHpMhhAo/kzuL+xC2iOkoGKEus4fM3lCuIw+aCZCwZA3g==", + "node_modules/@walletconnect/types": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@walletconnect/types/-/types-2.9.0.tgz", + "integrity": "sha512-ORopsMfSRvUYqtjKKd6scfg8o4/aGebipLxx92AuuUgMTERSU6cGmIrK6rdLu7W6FBJkmngPLEGc9mRqAb9Lug==", "dev": true, "dependencies": { "@walletconnect/events": "^1.0.1", - "@walletconnect/heartbeat": "1.2.0", - "@walletconnect/jsonrpc-types": "^1.0.2", + "@walletconnect/heartbeat": "1.2.1", + "@walletconnect/jsonrpc-types": "1.0.3", "@walletconnect/keyvaluestorage": "^1.0.2", "@walletconnect/logger": "^2.0.1", "events": "^3.3.0" } }, - "node_modules/@walletconnect/socket-transport": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/@walletconnect/socket-transport/-/socket-transport-1.8.0.tgz", - "integrity": "sha512-5DyIyWrzHXTcVp0Vd93zJ5XMW61iDM6bcWT4p8DTRfFsOtW46JquruMhxOLeCOieM4D73kcr3U7WtyR4JUsGuQ==", + "node_modules/@walletconnect/utils": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@walletconnect/utils/-/utils-2.9.0.tgz", + "integrity": "sha512-7Tu3m6dZL84KofrNBcblsgpSqU2vdo9ImLD7zWimLXERVGNQ8smXG+gmhQYblebIBhsPzjy9N38YMC3nPlfQNw==", "dev": true, "dependencies": { - "@walletconnect/types": "^1.8.0", - "@walletconnect/utils": "^1.8.0", - "ws": "7.5.3" + "@stablelib/chacha20poly1305": "1.0.1", + "@stablelib/hkdf": "1.0.1", + "@stablelib/random": "^1.0.2", + "@stablelib/sha256": "1.0.1", + "@stablelib/x25519": "^1.0.3", + "@walletconnect/relay-api": "^1.0.9", + "@walletconnect/safe-json": "^1.0.2", + "@walletconnect/time": "^1.0.2", + "@walletconnect/types": "2.9.0", + "@walletconnect/window-getters": "^1.0.1", + "@walletconnect/window-metadata": "^1.0.1", + "detect-browser": "5.3.0", + "query-string": "7.1.3", + "uint8arrays": "^3.1.0" } }, - "node_modules/@walletconnect/socket-transport/node_modules/@walletconnect/utils": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/@walletconnect/utils/-/utils-1.8.0.tgz", - "integrity": "sha512-zExzp8Mj1YiAIBfKNm5u622oNw44WOESzo6hj+Q3apSMIb0Jph9X3GDIdbZmvVZsNPxWDL7uodKgZcCInZv2vA==", + "node_modules/@walletconnect/window-getters": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@walletconnect/window-getters/-/window-getters-1.0.1.tgz", + "integrity": "sha512-vHp+HqzGxORPAN8gY03qnbTMnhqIwjeRJNOMOAzePRg4xVEEE2WvYsI9G2NMjOknA8hnuYbU3/hwLcKbjhc8+Q==", "dev": true, "dependencies": { - "@walletconnect/browser-utils": "^1.8.0", - "@walletconnect/encoding": "^1.0.1", - "@walletconnect/jsonrpc-utils": "^1.0.3", - "@walletconnect/types": "^1.8.0", - "bn.js": "4.11.8", - "js-sha3": "0.8.0", - "query-string": "6.13.5" - } - }, - "node_modules/@walletconnect/socket-transport/node_modules/bn.js": { - "version": "4.11.8", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", - "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==", - "dev": true - }, - "node_modules/@walletconnect/socket-transport/node_modules/query-string": { - "version": "6.13.5", - "resolved": "https://registry.npmjs.org/query-string/-/query-string-6.13.5.tgz", - "integrity": "sha512-svk3xg9qHR39P3JlHuD7g3nRnyay5mHbrPctEBDUxUkHRifPHXJDhBUycdCC0NBjXoDf44Gb+IsOZL1Uwn8M/Q==", - "dev": true, - "dependencies": { - "decode-uri-component": "^0.2.0", - "split-on-first": "^1.0.0", - "strict-uri-encode": "^2.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@walletconnect/time": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@walletconnect/time/-/time-1.0.2.tgz", - "integrity": "sha512-uzdd9woDcJ1AaBZRhqy5rNC9laqWGErfc4dxA9a87mPdKOgWMD85mcFo9dIYIts/Jwocfwn07EC6EzclKubk/g==", - "dev": true, - "dependencies": { - "tslib": "1.14.1" - } - }, - "node_modules/@walletconnect/types": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/@walletconnect/types/-/types-1.8.0.tgz", - "integrity": "sha512-Cn+3I0V0vT9ghMuzh1KzZvCkiAxTq+1TR2eSqw5E5AVWfmCtECFkVZBP6uUJZ8YjwLqXheI+rnjqPy7sVM4Fyg==", - "deprecated": "WalletConnect's v1 SDKs are now deprecated. Please upgrade to a v2 SDK. For details see: https://docs.walletconnect.com/", - "dev": true - }, - "node_modules/@walletconnect/utils": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/@walletconnect/utils/-/utils-2.6.2.tgz", - "integrity": "sha512-G0gtWQd5PhT7Z3h9zy5H6bG8t9likb5+hP2ZuBbt/vTu8ONPEsTcH1Ior2lUjuYLQ9ufK3LMZM85pO+wWLRVaw==", - "dev": true, - "dependencies": { - "@stablelib/chacha20poly1305": "1.0.1", - "@stablelib/hkdf": "1.0.1", - "@stablelib/random": "^1.0.2", - "@stablelib/sha256": "1.0.1", - "@stablelib/x25519": "^1.0.3", - "@walletconnect/jsonrpc-utils": "^1.0.7", - "@walletconnect/relay-api": "^1.0.9", - "@walletconnect/safe-json": "^1.0.2", - "@walletconnect/time": "^1.0.2", - "@walletconnect/types": "2.6.2", - "@walletconnect/window-getters": "^1.0.1", - "@walletconnect/window-metadata": "^1.0.1", - "detect-browser": "5.3.0", - "query-string": "7.1.1", - "uint8arrays": "^3.1.0" - } - }, - "node_modules/@walletconnect/utils/node_modules/@walletconnect/types": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/@walletconnect/types/-/types-2.6.2.tgz", - "integrity": "sha512-eP9xfNVdoQrIfqJSlHqijf0l/Rw/XTO2SeFVlgA5UFHpMhhAo/kzuL+xC2iOkoGKEus4fM3lCuIw+aCZCwZA3g==", - "dev": true, - "dependencies": { - "@walletconnect/events": "^1.0.1", - "@walletconnect/heartbeat": "1.2.0", - "@walletconnect/jsonrpc-types": "^1.0.2", - "@walletconnect/keyvaluestorage": "^1.0.2", - "@walletconnect/logger": "^2.0.1", - "events": "^3.3.0" - } - }, - "node_modules/@walletconnect/window-getters": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@walletconnect/window-getters/-/window-getters-1.0.1.tgz", - "integrity": "sha512-vHp+HqzGxORPAN8gY03qnbTMnhqIwjeRJNOMOAzePRg4xVEEE2WvYsI9G2NMjOknA8hnuYbU3/hwLcKbjhc8+Q==", - "dev": true, - "dependencies": { - "tslib": "1.14.1" + "tslib": "1.14.1" } }, "node_modules/@walletconnect/window-metadata": { @@ -1666,9 +1386,9 @@ } }, "node_modules/acorn": { - "version": "8.8.2", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", - "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", + "version": "8.10.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", + "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==", "dev": true, "bin": { "acorn": "bin/acorn" @@ -1686,21 +1406,6 @@ "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, - "node_modules/acorn-walk": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", - "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", - "dev": true, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/aes-js": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.1.2.tgz", - "integrity": "sha512-e5pEa2kBnBOgR4Y/p20pskXI74UEz7de8ZGVo58asOtvSVG5YAbJeELPZxOmt+Bnz3rX753YKhfIn4X4l1PPRQ==", - "dev": true - }, "node_modules/ajv": { "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", @@ -1717,15 +1422,6 @@ "url": "https://github.com/sponsors/epoberezkin" } }, - "node_modules/ansi-colors": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", - "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", - "dev": true, - "engines": { - "node": ">=6" - } - }, "node_modules/ansi-regex": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", @@ -1750,25 +1446,6 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/anymatch": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", - "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", - "dev": true, - "dependencies": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/arg": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", - "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", - "dev": true - }, "node_modules/argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", @@ -1814,21 +1491,6 @@ "util": "^0.12.0" } }, - "node_modules/assertion-error": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", - "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", - "dev": true, - "engines": { - "node": "*" - } - }, - "node_modules/asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", - "dev": true - }, "node_modules/atomic-sleep": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/atomic-sleep/-/atomic-sleep-1.0.0.tgz", @@ -1897,6 +1559,15 @@ "integrity": "sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ==", "dev": true }, + "node_modules/big-integer": { + "version": "1.6.51", + "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.51.tgz", + "integrity": "sha512-GPEid2Y9QU1Exl1rpO9B2IPJGHPSupF5GnVIP0blYvNOMer2bTvSWs1jGOUg04hTmu67nmLsQ9TBo1puaotBHg==", + "dev": true, + "engines": { + "node": ">=0.6" + } + }, "node_modules/bignumber.js": { "version": "9.0.1", "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.1.tgz", @@ -1906,15 +1577,6 @@ "node": "*" } }, - "node_modules/binary-extensions": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", - "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/blake2b": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/blake2b/-/blake2b-2.1.3.tgz", @@ -1940,6 +1602,18 @@ "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==", "dev": true }, + "node_modules/bplist-parser": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.2.0.tgz", + "integrity": "sha512-z0M+byMThzQmD9NILRniCUXYsYpjwnlO8N5uCFaCqIOpqRsJCrQL9NK3JsD67CN5a08nF5oIL2bD6loTdHOuKw==", + "dev": true, + "dependencies": { + "big-integer": "^1.6.44" + }, + "engines": { + "node": ">= 5.10.0" + } + }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -1977,12 +1651,6 @@ "resolve": "^1.17.0" } }, - "node_modules/browser-stdout": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", - "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", - "dev": true - }, "node_modules/browserify-aes": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", @@ -2092,6 +1760,21 @@ "integrity": "sha512-HpGFw18DgFWlncDfjTa2rcQ4W88O1mC8e8yZ2AvQY5KDaktSTwo+KRf6nHK6FRI5FyRyb/5T6+TSxfP7QyGsmQ==", "dev": true }, + "node_modules/bundle-name": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/bundle-name/-/bundle-name-3.0.0.tgz", + "integrity": "sha512-PKA4BeSvBpQKQ8iPOGCSiell+N8P+Tf1DlwqmYhpe2gAhKPHn8EYOxVT+ShuGmhg8lN8XiSlS80yiExKXrURlw==", + "dev": true, + "dependencies": { + "run-applescript": "^5.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/bytes": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", @@ -2124,33 +1807,12 @@ } }, "node_modules/camelcase": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", - "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/chai": { - "version": "4.3.7", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.7.tgz", - "integrity": "sha512-HLnAzZ2iupm25PlN0xFreAlBA5zaBSv3og0DdeGA4Ar6h6rJ3A0rolRUKJhSF2V10GZKDgWF/VmAEsNWjCRB+A==", + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", "dev": true, - "dependencies": { - "assertion-error": "^1.1.0", - "check-error": "^1.0.2", - "deep-eql": "^4.1.2", - "get-func-name": "^2.0.0", - "loupe": "^2.3.1", - "pathval": "^1.1.1", - "type-detect": "^4.0.5" - }, "engines": { - "node": ">=4" + "node": ">=6" } }, "node_modules/chalk": { @@ -2169,54 +1831,6 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/check-error": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", - "integrity": "sha512-BrgHpW9NURQgzoNyjfq0Wu6VFO6D7IZEmJNdtgNqpzGG8RuNFHt2jQxWlAs4HMe119chBnv+34syEZtc6IhLtA==", - "dev": true, - "engines": { - "node": "*" - } - }, - "node_modules/chokidar": { - "version": "3.5.3", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", - "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", - "dev": true, - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ], - "dependencies": { - "anymatch": "~3.1.2", - "braces": "~3.0.2", - "glob-parent": "~5.1.2", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.6.0" - }, - "engines": { - "node": ">= 8.10.0" - }, - "optionalDependencies": { - "fsevents": "~2.3.2" - } - }, - "node_modules/chokidar/node_modules/glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "dependencies": { - "is-glob": "^4.0.1" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/cipher-base": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", @@ -2228,14 +1842,48 @@ } }, "node_modules/cliui": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", - "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", + "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", "dev": true, "dependencies": { "string-width": "^4.2.0", "strip-ansi": "^6.0.0", - "wrap-ansi": "^7.0.0" + "wrap-ansi": "^6.2.0" + } + }, + "node_modules/cliui/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "node_modules/cliui/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/wrap-ansi": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=8" } }, "node_modules/color-convert": { @@ -2256,18 +1904,6 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, - "node_modules/combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "dev": true, - "dependencies": { - "delayed-stream": "~1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -2398,15 +2034,12 @@ } }, "node_modules/decamelize": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", - "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==", "dev": true, "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">=0.10.0" } }, "node_modules/decode-uri-component": { @@ -2418,23 +2051,57 @@ "node": ">=0.10" } }, - "node_modules/deep-eql": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.3.tgz", - "integrity": "sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==", + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true + }, + "node_modules/default-browser": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/default-browser/-/default-browser-4.0.0.tgz", + "integrity": "sha512-wX5pXO1+BrhMkSbROFsyxUm0i/cJEScyNhA4PPxc41ICuv05ZZB/MX28s8aZx6xjmatvebIapF6hLEKEcpneUA==", + "dev": true, + "dependencies": { + "bundle-name": "^3.0.0", + "default-browser-id": "^3.0.0", + "execa": "^7.1.1", + "titleize": "^3.0.0" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/default-browser-id": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/default-browser-id/-/default-browser-id-3.0.0.tgz", + "integrity": "sha512-OZ1y3y0SqSICtE8DE4S8YOE9UZOJ8wO16fKWVP5J1Qz42kV9jcnMVFrEE/noXb/ss3Q4pZIH79kxofzyNNtUNA==", "dev": true, "dependencies": { - "type-detect": "^4.0.0" + "bplist-parser": "^0.2.0", + "untildify": "^4.0.0" }, "engines": { - "node": ">=6" + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/deep-is": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", - "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", - "dev": true + "node_modules/define-lazy-prop": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-3.0.0.tgz", + "integrity": "sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } }, "node_modules/define-properties": { "version": "1.2.0", @@ -2452,19 +2119,10 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", - "dev": true, - "engines": { - "node": ">=0.4.0" - } - }, "node_modules/des.js": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.1.tgz", - "integrity": "sha512-Q0I4pfFrv2VPd34/vfLrFOoRmlYj3OV50i7fskps1jZWK1kApMWWT9G6RRUeYedLcBDIhnSDaUvJMb3AhUlaEA==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.1.0.tgz", + "integrity": "sha512-r17GxjhUCjSRy8aiJpr8/UadFIzMzJGexI3Nmz4ADi9LYSFx4gTBp80+NaX/YsXWWLhpZ7v/v/ubEc/bCNfKwg==", "dev": true, "dependencies": { "inherits": "^2.0.1", @@ -2477,15 +2135,6 @@ "integrity": "sha512-53rsFbGdwMwlF7qvCt0ypLM5V5/Mbl0szB7GPN8y9NCcbknYOeVVXdrXEq+90IwAfrrzt6Hd+u2E2ntakICU8w==", "dev": true }, - "node_modules/diff": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", - "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", - "dev": true, - "engines": { - "node": ">=0.3.1" - } - }, "node_modules/diffie-hellman": { "version": "5.0.3", "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", @@ -2504,9 +2153,9 @@ "dev": true }, "node_modules/dijkstrajs": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/dijkstrajs/-/dijkstrajs-1.0.2.tgz", - "integrity": "sha512-QV6PMaHTCNmKSeP6QoXhVTw9snc9VD8MulTT0Bd99Pacp4SS1cjcrYPgBPmibqKVtMJJfqC6XvOXgPMEEPH/fg==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/dijkstrajs/-/dijkstrajs-1.0.3.tgz", + "integrity": "sha512-qiSlmBq9+BCdCA/L46dw8Uy93mloxsPSbwnm5yrKn2vMPiy8KyAskTF6zuV/j5BMsmOGZDPs7KjU+mjb670kfA==", "dev": true }, "node_modules/dir-glob": { @@ -2557,6 +2206,12 @@ "stream-shift": "^1.0.0" } }, + "node_modules/eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "dev": true + }, "node_modules/elliptic": { "version": "6.5.4", "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", @@ -2579,9 +2234,9 @@ "dev": true }, "node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", "dev": true }, "node_modules/encode-utf8": { @@ -2606,9 +2261,9 @@ "dev": true }, "node_modules/esbuild": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.17.19.tgz", - "integrity": "sha512-XQ0jAPFkK/u3LcVRcvVHQcTIqD6E2H1fvZMA5dQPSOWb3suUbWbfbRf94pjc0bNzRYLfIrDRQXr7X+LHIm5oHw==", + "version": "0.18.13", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.18.13.tgz", + "integrity": "sha512-vhg/WR/Oiu4oUIkVhmfcc23G6/zWuEQKFS+yiosSHe4aN6+DQRXIfeloYGibIfVhkr4wyfuVsGNLr+sQU1rWWw==", "dev": true, "hasInstallScript": true, "bin": { @@ -2618,37 +2273,28 @@ "node": ">=12" }, "optionalDependencies": { - "@esbuild/android-arm": "0.17.19", - "@esbuild/android-arm64": "0.17.19", - "@esbuild/android-x64": "0.17.19", - "@esbuild/darwin-arm64": "0.17.19", - "@esbuild/darwin-x64": "0.17.19", - "@esbuild/freebsd-arm64": "0.17.19", - "@esbuild/freebsd-x64": "0.17.19", - "@esbuild/linux-arm": "0.17.19", - "@esbuild/linux-arm64": "0.17.19", - "@esbuild/linux-ia32": "0.17.19", - "@esbuild/linux-loong64": "0.17.19", - "@esbuild/linux-mips64el": "0.17.19", - "@esbuild/linux-ppc64": "0.17.19", - "@esbuild/linux-riscv64": "0.17.19", - "@esbuild/linux-s390x": "0.17.19", - "@esbuild/linux-x64": "0.17.19", - "@esbuild/netbsd-x64": "0.17.19", - "@esbuild/openbsd-x64": "0.17.19", - "@esbuild/sunos-x64": "0.17.19", - "@esbuild/win32-arm64": "0.17.19", - "@esbuild/win32-ia32": "0.17.19", - "@esbuild/win32-x64": "0.17.19" - } - }, - "node_modules/escalade": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", - "dev": true, - "engines": { - "node": ">=6" + "@esbuild/android-arm": "0.18.13", + "@esbuild/android-arm64": "0.18.13", + "@esbuild/android-x64": "0.18.13", + "@esbuild/darwin-arm64": "0.18.13", + "@esbuild/darwin-x64": "0.18.13", + "@esbuild/freebsd-arm64": "0.18.13", + "@esbuild/freebsd-x64": "0.18.13", + "@esbuild/linux-arm": "0.18.13", + "@esbuild/linux-arm64": "0.18.13", + "@esbuild/linux-ia32": "0.18.13", + "@esbuild/linux-loong64": "0.18.13", + "@esbuild/linux-mips64el": "0.18.13", + "@esbuild/linux-ppc64": "0.18.13", + "@esbuild/linux-riscv64": "0.18.13", + "@esbuild/linux-s390x": "0.18.13", + "@esbuild/linux-x64": "0.18.13", + "@esbuild/netbsd-x64": "0.18.13", + "@esbuild/openbsd-x64": "0.18.13", + "@esbuild/sunos-x64": "0.18.13", + "@esbuild/win32-arm64": "0.18.13", + "@esbuild/win32-ia32": "0.18.13", + "@esbuild/win32-x64": "0.18.13" } }, "node_modules/escape-string-regexp": { @@ -2664,16 +2310,16 @@ } }, "node_modules/eslint": { - "version": "8.40.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.40.0.tgz", - "integrity": "sha512-bvR+TsP9EHL3TqNtj9sCNJVAFK3fBN8Q7g5waghxyRsPLIMwL73XSKnZFK0hk/O2ANC+iAoq6PWMQ+IfBAJIiQ==", + "version": "8.45.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.45.0.tgz", + "integrity": "sha512-pd8KSxiQpdYRfYa9Wufvdoct3ZPQQuVuU5O6scNgMuOMYuxvH0IGaYK0wUFjo4UYYQQCUndlXiMbnxopwvvTiw==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.4.0", - "@eslint/eslintrc": "^2.0.3", - "@eslint/js": "8.40.0", - "@humanwhocodes/config-array": "^0.11.8", + "@eslint/eslintrc": "^2.1.0", + "@eslint/js": "8.44.0", + "@humanwhocodes/config-array": "^0.11.10", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", "ajv": "^6.10.0", @@ -2684,7 +2330,7 @@ "escape-string-regexp": "^4.0.0", "eslint-scope": "^7.2.0", "eslint-visitor-keys": "^3.4.1", - "espree": "^9.5.2", + "espree": "^9.6.0", "esquery": "^1.4.2", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", @@ -2692,22 +2338,19 @@ "find-up": "^5.0.0", "glob-parent": "^6.0.2", "globals": "^13.19.0", - "grapheme-splitter": "^1.0.4", + "graphemer": "^1.4.0", "ignore": "^5.2.0", - "import-fresh": "^3.0.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", "is-path-inside": "^3.0.3", - "js-sdsl": "^4.1.4", "js-yaml": "^4.1.0", "json-stable-stringify-without-jsonify": "^1.0.1", "levn": "^0.4.1", "lodash.merge": "^4.6.2", "minimatch": "^3.1.2", "natural-compare": "^1.4.0", - "optionator": "^0.9.1", + "optionator": "^0.9.3", "strip-ansi": "^6.0.1", - "strip-json-comments": "^3.1.0", "text-table": "^0.2.0" }, "bin": { @@ -2733,21 +2376,29 @@ } }, "node_modules/eslint-plugin-prettier": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-4.2.1.tgz", - "integrity": "sha512-f/0rXLXUt0oFYs8ra4w49wYZBG5GKZpAYsJSm6rnYL5uVDjd+zowwMwVZHnAjf4edNrKpCDYfXDgmRE/Ak7QyQ==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.0.0.tgz", + "integrity": "sha512-AgaZCVuYDXHUGxj/ZGu1u8H8CYgDY3iG6w5kUFw4AzMVXzB7VvbKgYR4nATIN+OvUrghMbiDLeimVjVY5ilq3w==", "dev": true, "dependencies": { - "prettier-linter-helpers": "^1.0.0" + "prettier-linter-helpers": "^1.0.0", + "synckit": "^0.8.5" }, "engines": { - "node": ">=12.0.0" + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/prettier" }, "peerDependencies": { - "eslint": ">=7.28.0", - "prettier": ">=2.0.0" + "@types/eslint": ">=8.0.0", + "eslint": ">=8.0.0", + "prettier": ">=3.0.0" }, "peerDependenciesMeta": { + "@types/eslint": { + "optional": true + }, "eslint-config-prettier": { "optional": true } @@ -2804,12 +2455,12 @@ } }, "node_modules/espree": { - "version": "9.5.2", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.5.2.tgz", - "integrity": "sha512-7OASN1Wma5fum5SrNhFMAMJxOUAbhyfQ8dQ//PJaJbNw0URTPWqIghHWt1MmAANKhHZIYOHruW4Kw4ruUWOdGw==", + "version": "9.6.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.0.tgz", + "integrity": "sha512-1FH/IiruXZ84tpUlm0aCUEwMl2Ho5ilqVh0VvQXw+byAz/4SAciyHLlfmL5WYqsvD38oymdUwBss0LtK8m4s/A==", "dev": true, "dependencies": { - "acorn": "^8.8.0", + "acorn": "^8.9.0", "acorn-jsx": "^5.3.2", "eslint-visitor-keys": "^3.4.1" }, @@ -2899,6 +2550,35 @@ "safe-buffer": "^5.1.1" } }, + "node_modules/execa": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-7.1.1.tgz", + "integrity": "sha512-wH0eMf/UXckdUYnO21+HDztteVv05rq2GXksxT4fCGeHkBhw1DROXh40wcjMcRqDOWE7iPJ4n3M7e2+YFP+76Q==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.1", + "human-signals": "^4.3.0", + "is-stream": "^3.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^5.1.0", + "onetime": "^6.0.0", + "signal-exit": "^3.0.7", + "strip-final-newline": "^3.0.0" + }, + "engines": { + "node": "^14.18.0 || ^16.14.0 || >=18.0.0" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/execa/node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true + }, "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -2906,15 +2586,15 @@ "dev": true }, "node_modules/fast-diff": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.2.0.tgz", - "integrity": "sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.3.0.tgz", + "integrity": "sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==", "dev": true }, "node_modules/fast-glob": { - "version": "3.2.12", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz", - "integrity": "sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.0.tgz", + "integrity": "sha512-ChDuvbOypPuNjO8yIDf36x7BlZX1smcUMTTcyoIjycexOxd6DFsKsg21qVBzEmr3G7fUKIRy2/psii+CIUt7FA==", "dev": true, "dependencies": { "@nodelib/fs.stat": "^2.0.2", @@ -2952,9 +2632,9 @@ "dev": true }, "node_modules/fast-redact": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/fast-redact/-/fast-redact-3.1.2.tgz", - "integrity": "sha512-+0em+Iya9fKGfEQGcd62Yv6onjBmmhV1uh86XVfOU8VwAe6kaFdQCWI9s0/Nnugx5Vd9tdbZ7e6gE2tR9dzXdw==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/fast-redact/-/fast-redact-3.2.0.tgz", + "integrity": "sha512-zaTadChr+NekyzallAMXATXLOR8MNx3zqpZ0MUF2aGf4EathnG0f32VLODNlY8IuGY3HoRO2L6/6fSzNsLaHIw==", "dev": true, "engines": { "node": ">=6" @@ -3027,15 +2707,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/flat": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", - "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", - "dev": true, - "bin": { - "flat": "cli.js" - } - }, "node_modules/flat-cache": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", @@ -3049,6 +2720,26 @@ "node": "^10.12.0 || >=12.0.0" } }, + "node_modules/flat-cache/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/flat-cache/node_modules/rimraf": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", @@ -3099,18 +2790,20 @@ "is-callable": "^1.1.3" } }, - "node_modules/form-data": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", - "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "node_modules/foreground-child": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.1.1.tgz", + "integrity": "sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==", "dev": true, "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" + "cross-spawn": "^7.0.0", + "signal-exit": "^4.0.1" }, "engines": { - "node": ">= 6" + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, "node_modules/fs.realpath": { @@ -3119,20 +2812,6 @@ "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", "dev": true }, - "node_modules/fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "dev": true, - "hasInstallScript": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, "node_modules/function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", @@ -3148,44 +2827,50 @@ "node": "6.* || 8.* || >= 10.*" } }, - "node_modules/get-func-name": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", - "integrity": "sha512-Hm0ixYtaSZ/V7C8FJrtZIuBBI+iSgL+1Aq82zSu8VQNB4S3Gk8e7Qs3VwBDJAhmRZcFqkl3tQu36g/Foh5I5ig==", - "dev": true, - "engines": { - "node": "*" - } - }, "node_modules/get-intrinsic": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.0.tgz", - "integrity": "sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz", + "integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==", "dev": true, "dependencies": { "function-bind": "^1.1.1", "has": "^1.0.3", + "has-proto": "^1.0.1", "has-symbols": "^1.0.3" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/glob": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", - "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", + "version": "10.3.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.3.tgz", + "integrity": "sha512-92vPiMb/iqpmEgsOoIDvTjc50wf9CCCvMzsi6W0JLPeUKE8TWP1a73PgqSrqy7iAZxaSD1YdzU7QZR5LF51MJw==", "dev": true, "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" + "foreground-child": "^3.1.0", + "jackspeak": "^2.0.3", + "minimatch": "^9.0.1", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0", + "path-scurry": "^1.10.1" + }, + "bin": { + "glob": "dist/cjs/src/bin.js" }, "engines": { - "node": "*" + "node": ">=16 || 14 >=14.17" }, "funding": { "url": "https://github.com/sponsors/isaacs" @@ -3203,6 +2888,30 @@ "node": ">=10.13.0" } }, + "node_modules/glob/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/glob/node_modules/minimatch": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/globals": { "version": "13.20.0", "resolved": "https://registry.npmjs.org/globals/-/globals-13.20.0.tgz", @@ -3256,6 +2965,12 @@ "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==", "dev": true }, + "node_modules/graphemer": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", + "dev": true + }, "node_modules/has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", @@ -3289,6 +3004,18 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/has-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", + "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/has-symbols": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", @@ -3340,15 +3067,6 @@ "minimalistic-assert": "^1.0.1" } }, - "node_modules/he": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", - "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", - "dev": true, - "bin": { - "he": "bin/he" - } - }, "node_modules/hmac-drbg": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", @@ -3366,6 +3084,15 @@ "integrity": "sha512-J+FkSdyD+0mA0N+81tMotaRMfSL9SGi+xpD3T6YApKsc3bGSXJlfXri3VyFOeYkfLRQisDk1W+jIFFKBeUBbBg==", "dev": true }, + "node_modules/human-signals": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-4.3.1.tgz", + "integrity": "sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ==", + "dev": true, + "engines": { + "node": ">=14.18.0" + } + }, "node_modules/ieee754": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", @@ -3452,18 +3179,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "dev": true, - "dependencies": { - "binary-extensions": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/is-callable": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", @@ -3477,9 +3192,9 @@ } }, "node_modules/is-core-module": { - "version": "2.11.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz", - "integrity": "sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==", + "version": "2.12.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.12.1.tgz", + "integrity": "sha512-Q4ZuBAe2FUsKtyQJoQHlvP8OvBERxO3jEmy1I7hcRXcJBGGHFh/aJBswbXuS9sgrDH2QUO8ilkwNPHvHMd8clg==", "dev": true, "dependencies": { "has": "^1.0.3" @@ -3488,6 +3203,21 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-docker": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz", + "integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==", + "dev": true, + "bin": { + "is-docker": "cli.js" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", @@ -3533,6 +3263,24 @@ "node": ">=0.10.0" } }, + "node_modules/is-inside-container": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-inside-container/-/is-inside-container-1.0.0.tgz", + "integrity": "sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==", + "dev": true, + "dependencies": { + "is-docker": "^3.0.0" + }, + "bin": { + "is-inside-container": "cli.js" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-nan": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/is-nan/-/is-nan-1.3.2.tgz", @@ -3567,13 +3315,16 @@ "node": ">=8" } }, - "node_modules/is-plain-obj": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", - "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", + "node_modules/is-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", + "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", "dev": true, "engines": { - "node": ">=8" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/is-typed-array": { @@ -3595,19 +3346,28 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-typedarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==", - "dev": true + "node_modules/is-wsl": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", + "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", + "dev": true, + "dependencies": { + "is-docker": "^2.0.0" + }, + "engines": { + "node": ">=8" + } }, - "node_modules/is-unicode-supported": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", - "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", + "node_modules/is-wsl/node_modules/is-docker": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz", + "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==", "dev": true, + "bin": { + "is-docker": "cli.js" + }, "engines": { - "node": ">=10" + "node": ">=8" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -3628,22 +3388,24 @@ "node": ">=10" } }, - "node_modules/js-sdsl": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.4.0.tgz", - "integrity": "sha512-FfVSdx6pJ41Oa+CF7RDaFmTnCaFhua+SNYQX74riGOpl96x+2jQCqEfQ2bnXu/5DPCqlRuiqyvTJM0Qjz26IVg==", + "node_modules/jackspeak": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-2.2.1.tgz", + "integrity": "sha512-MXbxovZ/Pm42f6cDIDkl3xpwv1AGwObKwfmjs2nQePiy85tP3fatofl3FC1aBsOtP/6fq5SbtgHwWcMsLP+bDw==", "dev": true, + "dependencies": { + "@isaacs/cliui": "^8.0.2" + }, + "engines": { + "node": ">=14" + }, "funding": { - "type": "opencollective", - "url": "https://opencollective.com/js-sdsl" + "url": "https://github.com/sponsors/isaacs" + }, + "optionalDependencies": { + "@pkgjs/parseargs": "^0.11.0" } }, - "node_modules/js-sha3": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", - "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==", - "dev": true - }, "node_modules/js-yaml": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", @@ -3747,55 +3509,21 @@ "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", "dev": true }, - "node_modules/log-symbols": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", - "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", - "dev": true, - "dependencies": { - "chalk": "^4.1.0", - "is-unicode-supported": "^0.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/long": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", - "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==", + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/long/-/long-5.2.3.tgz", + "integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==", "dev": true }, - "node_modules/loupe": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.6.tgz", - "integrity": "sha512-RaPMZKiMy8/JruncMU5Bt6na1eftNoo++R4Y+N2FrxkDVTrGvcyzFTsaGif4QTeKESheMGegbhw6iUAq+5A8zA==", - "dev": true, - "dependencies": { - "get-func-name": "^2.0.0" - } - }, "node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.0.0.tgz", + "integrity": "sha512-svTf/fzsKHffP42sujkO/Rjs37BCIsQVRCeNYIm9WN8rgT7ffoUnRtZCqU+6BqcSBdv8gwJeTz8knJpgACeQMw==", "dev": true, - "dependencies": { - "yallist": "^4.0.0" - }, "engines": { - "node": ">=10" + "node": "14 || >=16.14" } }, - "node_modules/make-error": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", - "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", - "dev": true - }, "node_modules/md5.js": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", @@ -3807,6 +3535,12 @@ "safe-buffer": "^5.1.2" } }, + "node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true + }, "node_modules/merge2": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", @@ -3869,6 +3603,18 @@ "node": ">= 0.6" } }, + "node_modules/mimic-fn": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", + "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/minimalistic-assert": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", @@ -3894,94 +3640,12 @@ } }, "node_modules/minipass": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", - "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.1.tgz", + "integrity": "sha512-NQ8MCKimInjVlaIqx51RKJJB7mINVkLTJbsZKmto4UAAOC/CWXES8PGaOgoBZyqoUsUA/U3DToGK7GJkkHbjJw==", "dev": true, "engines": { - "node": ">=8" - } - }, - "node_modules/mocha": { - "version": "10.2.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.2.0.tgz", - "integrity": "sha512-IDY7fl/BecMwFHzoqF2sg/SHHANeBoMMXFlS9r0OXKDssYE1M5O43wUY/9BVPeIvfH2zmEbBfseqN9gBQZzXkg==", - "dev": true, - "dependencies": { - "ansi-colors": "4.1.1", - "browser-stdout": "1.3.1", - "chokidar": "3.5.3", - "debug": "4.3.4", - "diff": "5.0.0", - "escape-string-regexp": "4.0.0", - "find-up": "5.0.0", - "glob": "7.2.0", - "he": "1.2.0", - "js-yaml": "4.1.0", - "log-symbols": "4.1.0", - "minimatch": "5.0.1", - "ms": "2.1.3", - "nanoid": "3.3.3", - "serialize-javascript": "6.0.0", - "strip-json-comments": "3.1.1", - "supports-color": "8.1.1", - "workerpool": "6.2.1", - "yargs": "16.2.0", - "yargs-parser": "20.2.4", - "yargs-unparser": "2.0.0" - }, - "bin": { - "_mocha": "bin/_mocha", - "mocha": "bin/mocha.js" - }, - "engines": { - "node": ">= 14.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/mochajs" - } - }, - "node_modules/mocha/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/mocha/node_modules/minimatch": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz", - "integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==", - "dev": true, - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/mocha/node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true - }, - "node_modules/mocha/node_modules/supports-color": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", - "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/supports-color?sponsor=1" + "node": ">=16 || 14 >=14.17" } }, "node_modules/ms": { @@ -4002,18 +3666,6 @@ "integrity": "sha512-C40jQ3NzfkP53NsO8kEOFd79p4b9kDXQMwgiY1z8ZwrDZgUyom0AHwGegF4Dm99L+YoYhuaB0ceerUcXmqr1rQ==", "dev": true }, - "node_modules/nanoid": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.3.tgz", - "integrity": "sha512-p1sjXuopFs0xg+fPASzQ28agW1oHD7xDsd9Xkf3T15H3c/cifrFHVwrh74PdoklAPi+i7MdRsE47vm2r6JoB+w==", - "dev": true, - "bin": { - "nanoid": "bin/nanoid.cjs" - }, - "engines": { - "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" - } - }, "node_modules/natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", @@ -4105,13 +3757,31 @@ "ieee754": "^1.1.13" } }, - "node_modules/normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "node_modules/npm-run-path": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.1.0.tgz", + "integrity": "sha512-sJOdmRGrY2sjNTRMbSvluQqg+8X7ZK61yvzBEIDhz4f8z1TZFYABsqjjCBd/0PUNE9M6QDgHJXQkGUEm7Q+l9Q==", + "dev": true, + "dependencies": { + "path-key": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/npm-run-path/node_modules/path-key": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", + "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", "dev": true, "engines": { - "node": ">=0.10.0" + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/object-inspect": { @@ -4163,18 +3833,51 @@ "wrappy": "1" } }, + "node_modules/onetime": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", + "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", + "dev": true, + "dependencies": { + "mimic-fn": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/open": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/open/-/open-9.1.0.tgz", + "integrity": "sha512-OS+QTnw1/4vrf+9hh1jc1jnYjzSG4ttTBB8UxOwAnInG3Uo4ssetzC1ihqaIHjLJnA5GGlRl6QlZXOTQhRBUvg==", + "dev": true, + "dependencies": { + "default-browser": "^4.0.0", + "define-lazy-prop": "^3.0.0", + "is-inside-container": "^1.0.0", + "is-wsl": "^2.2.0" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/optionator": { - "version": "0.9.1", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", - "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", + "version": "0.9.3", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.3.tgz", + "integrity": "sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg==", "dev": true, "dependencies": { + "@aashutoshrathi/word-wrap": "^1.2.3", "deep-is": "^0.1.3", "fast-levenshtein": "^2.0.6", "levn": "^0.4.1", "prelude-ls": "^1.2.1", - "type-check": "^0.4.0", - "word-wrap": "^1.2.3" + "type-check": "^0.4.0" }, "engines": { "node": ">= 0.8.0" @@ -4302,13 +4005,13 @@ "dev": true }, "node_modules/path-scurry": { - "version": "1.6.4", - "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.6.4.tgz", - "integrity": "sha512-Qp/9IHkdNiXJ3/Kon++At2nVpnhRiPq/aSvQN+H3U1WZbvNRK0RIQK/o4HMqPoXjpuGJUEWpHSs6Mnjxqh3TQg==", + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.10.1.tgz", + "integrity": "sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ==", "dev": true, "dependencies": { - "lru-cache": "^9.0.0", - "minipass": "^5.0.0" + "lru-cache": "^9.1.1 || ^10.0.0", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" }, "engines": { "node": ">=16 || 14 >=14.17" @@ -4317,15 +4020,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/path-scurry/node_modules/lru-cache": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-9.0.0.tgz", - "integrity": "sha512-9AEKXzvOZc4BMacFnYiTOlDH/197LNnQIK9wZ6iMB5NXPzuv4bWR/Msv7iUMplkiMQ1qQL+KSv/JF1mZAB5Lrg==", - "dev": true, - "engines": { - "node": ">=16.14" - } - }, "node_modules/path-to-regexp": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-2.2.1.tgz", @@ -4341,15 +4035,6 @@ "node": ">=8" } }, - "node_modules/pathval": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", - "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", - "dev": true, - "engines": { - "node": "*" - } - }, "node_modules/pbkdf2": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.2.tgz", @@ -4366,6 +4051,12 @@ "node": ">=0.12" } }, + "node_modules/picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "dev": true + }, "node_modules/picomatch": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", @@ -4447,15 +4138,15 @@ } }, "node_modules/prettier": { - "version": "2.8.8", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", - "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.0.tgz", + "integrity": "sha512-zBf5eHpwHOGPC47h0zrPyNn+eAEIdEzfywMoYn2XPi0P44Zp0tSq64rq0xAREh4auw2cJZHo9QUob+NqCQky4g==", "dev": true, "bin": { - "prettier": "bin-prettier.js" + "prettier": "bin/prettier.cjs" }, "engines": { - "node": ">=10.13.0" + "node": ">=14" }, "funding": { "url": "https://github.com/prettier/prettier?sponsor=1" @@ -4489,9 +4180,9 @@ "dev": true }, "node_modules/protobufjs": { - "version": "6.11.3", - "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.11.3.tgz", - "integrity": "sha512-xL96WDdCZYdU7Slin569tFX712BxsxslWwAfAhCYjQKGTq7dAU91Lomy6nLLhh/dyGhk/YH4TwTSRxTzhuHyZg==", + "version": "7.2.4", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.2.4.tgz", + "integrity": "sha512-AT+RJgD2sH8phPmCf7OUZR8xGdcJRga4+1cOaXJ64hvcSkVhNcRHOwIxUatPH15+nj59WAGTDv3LSGZPEQbJaQ==", "dev": true, "hasInstallScript": true, "dependencies": { @@ -4505,13 +4196,11 @@ "@protobufjs/path": "^1.1.2", "@protobufjs/pool": "^1.1.0", "@protobufjs/utf8": "^1.1.0", - "@types/long": "^4.0.1", "@types/node": ">=13.7.0", - "long": "^4.0.0" + "long": "^5.0.0" }, - "bin": { - "pbjs": "bin/pbjs", - "pbts": "bin/pbts" + "engines": { + "node": ">=12.0.0" } }, "node_modules/public-encrypt": { @@ -4558,142 +4247,6 @@ "node": ">=10.13.0" } }, - "node_modules/qrcode/node_modules/camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/qrcode/node_modules/cliui": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", - "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", - "dev": true, - "dependencies": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^6.2.0" - } - }, - "node_modules/qrcode/node_modules/decamelize": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/qrcode/node_modules/find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "dev": true, - "dependencies": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/qrcode/node_modules/locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dev": true, - "dependencies": { - "p-locate": "^4.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/qrcode/node_modules/p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "dev": true, - "dependencies": { - "p-try": "^2.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/qrcode/node_modules/p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "dev": true, - "dependencies": { - "p-limit": "^2.2.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/qrcode/node_modules/wrap-ansi": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", - "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/qrcode/node_modules/y18n": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz", - "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==", - "dev": true - }, - "node_modules/qrcode/node_modules/yargs": { - "version": "15.4.1", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz", - "integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==", - "dev": true, - "dependencies": { - "cliui": "^6.0.0", - "decamelize": "^1.2.0", - "find-up": "^4.1.0", - "get-caller-file": "^2.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^4.2.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^18.1.2" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/qrcode/node_modules/yargs-parser": { - "version": "18.1.3", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", - "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", - "dev": true, - "dependencies": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - }, - "engines": { - "node": ">=6" - } - }, "node_modules/qs": { "version": "6.10.3", "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.3.tgz", @@ -4710,12 +4263,12 @@ } }, "node_modules/query-string": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/query-string/-/query-string-7.1.1.tgz", - "integrity": "sha512-MplouLRDHBZSG9z7fpuAAcI7aAYjDLhtsiVZsevsfaHWDS2IDdORKbSd1kWUA+V4zyva/HZoSfpwnYMMQDhb0w==", + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/query-string/-/query-string-7.1.3.tgz", + "integrity": "sha512-hh2WYhq4fi8+b+/2Kg9CEge4fDPvHS534aOOvOZeQ3+Vf2mCFsaFBYj0i+iXcAq6I9Vzp5fjMFBlONvayDC1qg==", "dev": true, "dependencies": { - "decode-uri-component": "^0.2.0", + "decode-uri-component": "^0.2.2", "filter-obj": "^1.1.0", "split-on-first": "^1.0.0", "strict-uri-encode": "^2.0.0" @@ -4727,16 +4280,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/querystring": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", - "integrity": "sha512-X/xY82scca2tau62i9mDyU9K+I+djTMUsvwf7xnUX5GLvVzgJybOJf4Y6o9Zx3oJK/LSXg5tTZBjwzqVPaPO2g==", - "deprecated": "The querystring API is considered Legacy. new code should use the URLSearchParams API instead.", - "dev": true, - "engines": { - "node": ">=0.4.x" - } - }, "node_modules/querystring-es3": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/querystring-es3/-/querystring-es3-0.2.1.tgz", @@ -4814,18 +4357,6 @@ "node": ">= 6" } }, - "node_modules/readdirp": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", - "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", - "dev": true, - "dependencies": { - "picomatch": "^2.2.1" - }, - "engines": { - "node": ">=8.10.0" - } - }, "node_modules/real-require": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/real-require/-/real-require-0.1.0.tgz", @@ -4887,12 +4418,12 @@ } }, "node_modules/rimraf": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.0.tgz", - "integrity": "sha512-Jf9llaP+RvaEVS5nPShYFhtXIrb3LRKP281ib3So0KkeZKo2wIKyq0Re7TOSwanasA423PSr6CCIL4bP6T040g==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.1.tgz", + "integrity": "sha512-OfFZdwtd3lZ+XZzYP/6gTACubwFcHdLRqS9UX3UwpU2dnGQYkPFISRwvM3w9IiB2w7bW5qGo/uAwE4SmXXSKvg==", "dev": true, "dependencies": { - "glob": "^10.0.0" + "glob": "^10.2.5" }, "bin": { "rimraf": "dist/cjs/src/bin.js" @@ -4904,56 +4435,124 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/rimraf/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "node_modules/ripemd160": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", + "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", "dev": true, "dependencies": { - "balanced-match": "^1.0.0" + "hash-base": "^3.0.0", + "inherits": "^2.0.1" } }, - "node_modules/rimraf/node_modules/glob": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.0.0.tgz", - "integrity": "sha512-zmp9ZDC6NpDNLujV2W2n+3lH+BafIVZ4/ct+Yj3BMZTH/+bgm/eVjHzeFLwxJrrIGgjjS2eiQLlpurHsNlEAtQ==", + "node_modules/run-applescript": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/run-applescript/-/run-applescript-5.0.0.tgz", + "integrity": "sha512-XcT5rBksx1QdIhlFOCtgZkB99ZEouFZ1E2Kc2LHqNW13U3/74YGdkQRmThTwxy4QIyookibDKYZOPqX//6BlAg==", "dev": true, "dependencies": { - "fs.realpath": "^1.0.0", - "minimatch": "^9.0.0", - "minipass": "^5.0.0", - "path-scurry": "^1.6.4" + "execa": "^5.0.0" }, "engines": { - "node": ">=16 || 14 >=14.17" + "node": ">=12" }, "funding": { - "url": "https://github.com/sponsors/isaacs" + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/rimraf/node_modules/minimatch": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.0.tgz", - "integrity": "sha512-0jJj8AvgKqWN05mrwuqi8QYKx1WmYSUoKSxu5Qhs9prezTz10sxAHGNZe9J9cqIJzta8DWsleh2KaVaLl6Ru2w==", + "node_modules/run-applescript/node_modules/execa": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", + "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", "dev": true, "dependencies": { - "brace-expansion": "^2.0.1" + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.0", + "human-signals": "^2.1.0", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.1", + "onetime": "^5.1.2", + "signal-exit": "^3.0.3", + "strip-final-newline": "^2.0.0" }, "engines": { - "node": ">=16 || 14 >=14.17" + "node": ">=10" }, "funding": { - "url": "https://github.com/sponsors/isaacs" + "url": "https://github.com/sindresorhus/execa?sponsor=1" } }, - "node_modules/ripemd160": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", - "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", + "node_modules/run-applescript/node_modules/human-signals": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", + "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", + "dev": true, + "engines": { + "node": ">=10.17.0" + } + }, + "node_modules/run-applescript/node_modules/is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/run-applescript/node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/run-applescript/node_modules/npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", "dev": true, "dependencies": { - "hash-base": "^3.0.0", - "inherits": "^2.0.1" + "path-key": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/run-applescript/node_modules/onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/run-applescript/node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true + }, + "node_modules/run-applescript/node_modules/strip-final-newline": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", + "dev": true, + "engines": { + "node": ">=6" } }, "node_modules/run-parallel": { @@ -5021,9 +4620,9 @@ "dev": true }, "node_modules/semver": { - "version": "7.3.8", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", - "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, "dependencies": { "lru-cache": "^6.0.0" @@ -5035,13 +4634,16 @@ "node": ">=10" } }, - "node_modules/serialize-javascript": { + "node_modules/semver/node_modules/lru-cache": { "version": "6.0.0", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", - "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", "dev": true, "dependencies": { - "randombytes": "^2.1.0" + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" } }, "node_modules/serve-handler": { @@ -5120,6 +4722,18 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/signal-exit": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.0.2.tgz", + "integrity": "sha512-MY2/qGx4enyjprQnFaZsHib3Yadh3IXyV2C321GY0pjGfVBu4un0uDJkwgdxqO+Rdx8JMT8IfJIRwbYVz3Ob3Q==", + "dev": true, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/slash": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", @@ -5203,6 +4817,24 @@ } }, "node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/string-width-cjs": { + "name": "string-width", "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", @@ -5216,6 +4848,39 @@ "node": ">=8" } }, + "node_modules/string-width-cjs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "node_modules/string-width/node_modules/ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/string-width/node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, "node_modules/strip-ansi": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", @@ -5228,6 +4893,31 @@ "node": ">=8" } }, + "node_modules/strip-ansi-cjs": { + "name": "strip-ansi", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-final-newline": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", + "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/strip-json-comments": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", @@ -5264,6 +4954,28 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/synckit": { + "version": "0.8.5", + "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.8.5.tgz", + "integrity": "sha512-L1dapNV6vu2s/4Sputv8xGsCdAVlb5nRDMFU/E27D44l5U6cw1g0dGd45uLc+OXjNMmF4ntiMdCimzcjFKQI8Q==", + "dev": true, + "dependencies": { + "@pkgr/utils": "^2.3.1", + "tslib": "^2.5.0" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/unts" + } + }, + "node_modules/synckit/node_modules/tslib": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.0.tgz", + "integrity": "sha512-7At1WUettjcSRHXCyYtTselblcHl9PJFFVKiCAy/bY97+BPZXSQ2wbq0P9s8tK2G7dFQfNnlJnPAiArVBVBsfA==", + "dev": true + }, "node_modules/text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", @@ -5291,6 +5003,18 @@ "node": ">=0.6.0" } }, + "node_modules/titleize": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/titleize/-/titleize-3.0.0.tgz", + "integrity": "sha512-KxVu8EYHDPBdUYdKZdKtU2aj2XfEx9AfjXxE/Aj0vT06w2icA09Vus1rh6eSu1y01akYg6BjIK/hxyLJINoMLQ==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -5303,56 +5027,16 @@ "node": ">=8.0" } }, - "node_modules/ts-node": { - "version": "10.9.1", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", - "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", + "node_modules/ts-api-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.0.1.tgz", + "integrity": "sha512-lC/RGlPmwdrIBFTX59wwNzqh7aR2otPNPR/5brHZm/XKFYKsfqxihXUe9pU3JI+3vGkl+vyCoNNnPhJn3aLK1A==", "dev": true, - "dependencies": { - "@cspotcode/source-map-support": "^0.8.0", - "@tsconfig/node10": "^1.0.7", - "@tsconfig/node12": "^1.0.7", - "@tsconfig/node14": "^1.0.0", - "@tsconfig/node16": "^1.0.2", - "acorn": "^8.4.1", - "acorn-walk": "^8.1.1", - "arg": "^4.1.0", - "create-require": "^1.1.0", - "diff": "^4.0.1", - "make-error": "^1.1.1", - "v8-compile-cache-lib": "^3.0.1", - "yn": "3.1.1" - }, - "bin": { - "ts-node": "dist/bin.js", - "ts-node-cwd": "dist/bin-cwd.js", - "ts-node-esm": "dist/bin-esm.js", - "ts-node-script": "dist/bin-script.js", - "ts-node-transpile-only": "dist/bin-transpile.js", - "ts-script": "dist/bin-script-deprecated.js" + "engines": { + "node": ">=16.13.0" }, "peerDependencies": { - "@swc/core": ">=1.2.50", - "@swc/wasm": ">=1.2.50", - "@types/node": "*", - "typescript": ">=2.7" - }, - "peerDependenciesMeta": { - "@swc/core": { - "optional": true - }, - "@swc/wasm": { - "optional": true - } - } - }, - "node_modules/ts-node/node_modules/diff": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", - "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", - "dev": true, - "engines": { - "node": ">=0.3.1" + "typescript": ">=4.2.0" } }, "node_modules/tslib": { @@ -5361,21 +5045,6 @@ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", "dev": true }, - "node_modules/tsutils": { - "version": "3.21.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", - "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", - "dev": true, - "dependencies": { - "tslib": "^1.8.1" - }, - "engines": { - "node": ">= 6" - }, - "peerDependencies": { - "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" - } - }, "node_modules/tty-browserify": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.1.tgz", @@ -5394,15 +5063,6 @@ "node": ">= 0.8.0" } }, - "node_modules/type-detect": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", - "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", - "dev": true, - "engines": { - "node": ">=4" - } - }, "node_modules/type-fest": { "version": "0.20.2", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", @@ -5415,26 +5075,17 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/typedarray-to-buffer": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", - "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", - "dev": true, - "dependencies": { - "is-typedarray": "^1.0.0" - } - }, "node_modules/typescript": { - "version": "5.0.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz", - "integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==", + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz", + "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==", "dev": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" }, "engines": { - "node": ">=12.20" + "node": ">=14.17" } }, "node_modules/uint8arrays": { @@ -5446,6 +5097,15 @@ "multiformats": "^9.4.2" } }, + "node_modules/untildify": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/untildify/-/untildify-4.0.0.tgz", + "integrity": "sha512-KK8xQ1mkzZeg9inewmFVDNkg3l5LUhoq9kN6iWYB/CC9YMG8HA+c1Q8HwDe6dEX7kErrEVNVBO3fWsVq5iDgtw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/uri-js": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", @@ -5465,20 +5125,29 @@ } }, "node_modules/url": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/url/-/url-0.11.0.tgz", - "integrity": "sha512-kbailJa29QrtXnxgq+DdCEGlbTeYM2eJUxsz6vjZavrCYPMIFHMKQmSKYAIuUK2i7hgPm28a8piX5NTUtM/LKQ==", + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/url/-/url-0.11.1.tgz", + "integrity": "sha512-rWS3H04/+mzzJkv0eZ7vEDGiQbgquI1fGfOad6zKvgYQi1SzMmhl7c/DdRGxhaWrVH6z0qWITo8rpnxK/RfEhA==", "dev": true, "dependencies": { - "punycode": "1.3.2", - "querystring": "0.2.0" + "punycode": "^1.4.1", + "qs": "^6.11.0" } }, - "node_modules/url/node_modules/punycode": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", - "integrity": "sha512-RofWgt/7fL5wP1Y7fxE7/EmTLzQVnB0ycyibJ0OOHIlJqTNzglYFxVwETOcIoJqJmpDXJ9xImDv+Fq34F/d4Dw==", - "dev": true + "node_modules/url/node_modules/qs": { + "version": "6.11.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.2.tgz", + "integrity": "sha512-tDNIz22aBzCDxLtVH++VnTfzxlfeK5CbqohpSqpJgj1Wg/cQbStNAz3NuqCs5vV+pjBsK4x4pN9HlVh7rcYRiA==", + "dev": true, + "dependencies": { + "side-channel": "^1.0.4" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, "node_modules/util": { "version": "0.12.5", @@ -5499,12 +5168,6 @@ "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", "dev": true }, - "node_modules/v8-compile-cache-lib": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", - "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", - "dev": true - }, "node_modules/vm-browserify": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-1.1.2.tgz", @@ -5527,9 +5190,9 @@ } }, "node_modules/which-module": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", - "integrity": "sha512-B+enWhmw6cjfVC7kS8Pj9pCrKSc5txArRyaYGe088shv/FGWH+0Rjx/xPgtsWfsUtS27FkP697E4DDhgrgoc0Q==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.1.tgz", + "integrity": "sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ==", "dev": true }, "node_modules/which-typed-array": { @@ -5552,22 +5215,25 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/word-wrap": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", - "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "node_modules/wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", "dev": true, + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, "engines": { - "node": ">=0.10.0" + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, - "node_modules/workerpool": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz", - "integrity": "sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==", - "dev": true - }, - "node_modules/wrap-ansi": { + "node_modules/wrap-ansi-cjs": { + "name": "wrap-ansi", "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", @@ -5584,6 +5250,65 @@ "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, + "node_modules/wrap-ansi-cjs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "node_modules/wrap-ansi-cjs/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi/node_modules/ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/wrap-ansi/node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/wrap-ansi/node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", @@ -5591,9 +5316,9 @@ "dev": true }, "node_modules/ws": { - "version": "7.5.3", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.3.tgz", - "integrity": "sha512-kQ/dHIzuLrS6Je9+uv81ueZomEwH0qVYstcAQ4/Z93K8zeko9gtAbttJWzoC5ukqXY1PpoouV3+VSOqEAFt5wg==", + "version": "7.5.9", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", + "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==", "dev": true, "engines": { "node": ">=8.3.0" @@ -5621,13 +5346,10 @@ } }, "node_modules/y18n": { - "version": "5.0.8", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", - "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", - "dev": true, - "engines": { - "node": ">=10" - } + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz", + "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==", + "dev": true }, "node_modules/yallist": { "version": "4.0.0", @@ -5636,54 +5358,110 @@ "dev": true }, "node_modules/yargs": { - "version": "16.2.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", - "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "version": "15.4.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz", + "integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==", "dev": true, "dependencies": { - "cliui": "^7.0.2", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", + "cliui": "^6.0.0", + "decamelize": "^1.2.0", + "find-up": "^4.1.0", + "get-caller-file": "^2.0.1", "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", "string-width": "^4.2.0", - "y18n": "^5.0.5", - "yargs-parser": "^20.2.2" + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^18.1.2" }, "engines": { - "node": ">=10" + "node": ">=8" } }, "node_modules/yargs-parser": { - "version": "20.2.4", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", - "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", + "version": "18.1.3", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", + "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", "dev": true, + "dependencies": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + }, "engines": { - "node": ">=10" + "node": ">=6" } }, - "node_modules/yargs-unparser": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", - "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", + "node_modules/yargs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "node_modules/yargs/node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", "dev": true, "dependencies": { - "camelcase": "^6.0.0", - "decamelize": "^4.0.0", - "flat": "^5.0.2", - "is-plain-obj": "^2.1.0" + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" }, "engines": { - "node": ">=10" + "node": ">=8" } }, - "node_modules/yn": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", - "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "node_modules/yargs/node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", "dev": true, + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "dependencies": { + "p-try": "^2.0.0" + }, "engines": { "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/yargs/node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" } }, "node_modules/yocto-queue": { @@ -5700,166 +5478,163 @@ } }, "dependencies": { - "@cspotcode/source-map-support": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", - "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", - "dev": true, - "requires": { - "@jridgewell/trace-mapping": "0.3.9" - } + "@aashutoshrathi/word-wrap": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz", + "integrity": "sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==", + "dev": true }, "@esbuild/android-arm": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.17.19.tgz", - "integrity": "sha512-rIKddzqhmav7MSmoFCmDIb6e2W57geRsM94gV2l38fzhXMwq7hZoClug9USI2pFRGL06f4IOPHHpFNOkWieR8A==", + "version": "0.18.13", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.18.13.tgz", + "integrity": "sha512-KwqFhxRFMKZINHzCqf8eKxE0XqWlAVPRxwy6rc7CbVFxzUWB2sA/s3hbMZeemPdhN3fKBkqOaFhTbS8xJXYIWQ==", "dev": true, "optional": true }, "@esbuild/android-arm64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.17.19.tgz", - "integrity": "sha512-KBMWvEZooR7+kzY0BtbTQn0OAYY7CsiydT63pVEaPtVYF0hXbUaOyZog37DKxK7NF3XacBJOpYT4adIJh+avxA==", + "version": "0.18.13", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.18.13.tgz", + "integrity": "sha512-j7NhycJUoUAG5kAzGf4fPWfd17N6SM3o1X6MlXVqfHvs2buFraCJzos9vbeWjLxOyBKHyPOnuCuipbhvbYtTAg==", "dev": true, "optional": true }, "@esbuild/android-x64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.17.19.tgz", - "integrity": "sha512-uUTTc4xGNDT7YSArp/zbtmbhO0uEEK9/ETW29Wk1thYUJBz3IVnvgEiEwEa9IeLyvnpKrWK64Utw2bgUmDveww==", + "version": "0.18.13", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.18.13.tgz", + "integrity": "sha512-M2eZkRxR6WnWfVELHmv6MUoHbOqnzoTVSIxgtsyhm/NsgmL+uTmag/VVzdXvmahak1I6sOb1K/2movco5ikDJg==", "dev": true, "optional": true }, "@esbuild/darwin-arm64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.17.19.tgz", - "integrity": "sha512-80wEoCfF/hFKM6WE1FyBHc9SfUblloAWx6FJkFWTWiCoht9Mc0ARGEM47e67W9rI09YoUxJL68WHfDRYEAvOhg==", + "version": "0.18.13", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.18.13.tgz", + "integrity": "sha512-f5goG30YgR1GU+fxtaBRdSW3SBG9pZW834Mmhxa6terzcboz7P2R0k4lDxlkP7NYRIIdBbWp+VgwQbmMH4yV7w==", "dev": true, "optional": true }, "@esbuild/darwin-x64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.17.19.tgz", - "integrity": "sha512-IJM4JJsLhRYr9xdtLytPLSH9k/oxR3boaUIYiHkAawtwNOXKE8KoU8tMvryogdcT8AU+Bflmh81Xn6Q0vTZbQw==", + "version": "0.18.13", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.18.13.tgz", + "integrity": "sha512-RIrxoKH5Eo+yE5BtaAIMZaiKutPhZjw+j0OCh8WdvKEKJQteacq0myZvBDLU+hOzQOZWJeDnuQ2xgSScKf1Ovw==", "dev": true, "optional": true }, "@esbuild/freebsd-arm64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.17.19.tgz", - "integrity": "sha512-pBwbc7DufluUeGdjSU5Si+P3SoMF5DQ/F/UmTSb8HXO80ZEAJmrykPyzo1IfNbAoaqw48YRpv8shwd1NoI0jcQ==", + "version": "0.18.13", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.18.13.tgz", + "integrity": "sha512-AfRPhHWmj9jGyLgW/2FkYERKmYR+IjYxf2rtSLmhOrPGFh0KCETFzSjx/JX/HJnvIqHt/DRQD/KAaVsUKoI3Xg==", "dev": true, "optional": true }, "@esbuild/freebsd-x64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.17.19.tgz", - "integrity": "sha512-4lu+n8Wk0XlajEhbEffdy2xy53dpR06SlzvhGByyg36qJw6Kpfk7cp45DR/62aPH9mtJRmIyrXAS5UWBrJT6TQ==", + "version": "0.18.13", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.18.13.tgz", + "integrity": "sha512-pGzWWZJBInhIgdEwzn8VHUBang8UvFKsvjDkeJ2oyY5gZtAM6BaxK0QLCuZY+qoj/nx/lIaItH425rm/hloETA==", "dev": true, "optional": true }, "@esbuild/linux-arm": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.17.19.tgz", - "integrity": "sha512-cdmT3KxjlOQ/gZ2cjfrQOtmhG4HJs6hhvm3mWSRDPtZ/lP5oe8FWceS10JaSJC13GBd4eH/haHnqf7hhGNLerA==", + "version": "0.18.13", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.18.13.tgz", + "integrity": "sha512-4iMxLRMCxGyk7lEvkkvrxw4aJeC93YIIrfbBlUJ062kilUUnAiMb81eEkVvCVoh3ON283ans7+OQkuy1uHW+Hw==", "dev": true, "optional": true }, "@esbuild/linux-arm64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.17.19.tgz", - "integrity": "sha512-ct1Tg3WGwd3P+oZYqic+YZF4snNl2bsnMKRkb3ozHmnM0dGWuxcPTTntAF6bOP0Sp4x0PjSF+4uHQ1xvxfRKqg==", + "version": "0.18.13", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.18.13.tgz", + "integrity": "sha512-hCzZbVJEHV7QM77fHPv2qgBcWxgglGFGCxk6KfQx6PsVIdi1u09X7IvgE9QKqm38OpkzaAkPnnPqwRsltvLkIQ==", "dev": true, "optional": true }, "@esbuild/linux-ia32": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.17.19.tgz", - "integrity": "sha512-w4IRhSy1VbsNxHRQpeGCHEmibqdTUx61Vc38APcsRbuVgK0OPEnQ0YD39Brymn96mOx48Y2laBQGqgZ0j9w6SQ==", + "version": "0.18.13", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.18.13.tgz", + "integrity": "sha512-I3OKGbynl3AAIO6onXNrup/ttToE6Rv2XYfFgLK/wnr2J+1g+7k4asLrE+n7VMhaqX+BUnyWkCu27rl+62Adug==", "dev": true, "optional": true }, "@esbuild/linux-loong64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.17.19.tgz", - "integrity": "sha512-2iAngUbBPMq439a+z//gE+9WBldoMp1s5GWsUSgqHLzLJ9WoZLZhpwWuym0u0u/4XmZ3gpHmzV84PonE+9IIdQ==", + "version": "0.18.13", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.18.13.tgz", + "integrity": "sha512-8pcKDApAsKc6WW51ZEVidSGwGbebYw2qKnO1VyD8xd6JN0RN6EUXfhXmDk9Vc4/U3Y4AoFTexQewQDJGsBXBpg==", "dev": true, "optional": true }, "@esbuild/linux-mips64el": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.17.19.tgz", - "integrity": "sha512-LKJltc4LVdMKHsrFe4MGNPp0hqDFA1Wpt3jE1gEyM3nKUvOiO//9PheZZHfYRfYl6AwdTH4aTcXSqBerX0ml4A==", + "version": "0.18.13", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.18.13.tgz", + "integrity": "sha512-6GU+J1PLiVqWx8yoCK4Z0GnfKyCGIH5L2KQipxOtbNPBs+qNDcMJr9euxnyJ6FkRPyMwaSkjejzPSISD9hb+gg==", "dev": true, "optional": true }, "@esbuild/linux-ppc64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.17.19.tgz", - "integrity": "sha512-/c/DGybs95WXNS8y3Ti/ytqETiW7EU44MEKuCAcpPto3YjQbyK3IQVKfF6nbghD7EcLUGl0NbiL5Rt5DMhn5tg==", + "version": "0.18.13", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.18.13.tgz", + "integrity": "sha512-pfn/OGZ8tyR8YCV7MlLl5hAit2cmS+j/ZZg9DdH0uxdCoJpV7+5DbuXrR+es4ayRVKIcfS9TTMCs60vqQDmh+w==", "dev": true, "optional": true }, "@esbuild/linux-riscv64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.17.19.tgz", - "integrity": "sha512-FC3nUAWhvFoutlhAkgHf8f5HwFWUL6bYdvLc/TTuxKlvLi3+pPzdZiFKSWz/PF30TB1K19SuCxDTI5KcqASJqA==", + "version": "0.18.13", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.18.13.tgz", + "integrity": "sha512-aIbhU3LPg0lOSCfVeGHbmGYIqOtW6+yzO+Nfv57YblEK01oj0mFMtvDJlOaeAZ6z0FZ9D13oahi5aIl9JFphGg==", "dev": true, "optional": true }, "@esbuild/linux-s390x": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.17.19.tgz", - "integrity": "sha512-IbFsFbxMWLuKEbH+7sTkKzL6NJmG2vRyy6K7JJo55w+8xDk7RElYn6xvXtDW8HCfoKBFK69f3pgBJSUSQPr+4Q==", + "version": "0.18.13", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.18.13.tgz", + "integrity": "sha512-Pct1QwF2sp+5LVi4Iu5Y+6JsGaV2Z2vm4O9Dd7XZ5tKYxEHjFtb140fiMcl5HM1iuv6xXO8O1Vrb1iJxHlv8UA==", "dev": true, "optional": true }, "@esbuild/linux-x64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.17.19.tgz", - "integrity": "sha512-68ngA9lg2H6zkZcyp22tsVt38mlhWde8l3eJLWkyLrp4HwMUr3c1s/M2t7+kHIhvMjglIBrFpncX1SzMckomGw==", + "version": "0.18.13", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.18.13.tgz", + "integrity": "sha512-zTrIP0KzYP7O0+3ZnmzvUKgGtUvf4+piY8PIO3V8/GfmVd3ZyHJGz7Ht0np3P1wz+I8qJ4rjwJKqqEAbIEPngA==", "dev": true, "optional": true }, "@esbuild/netbsd-x64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.17.19.tgz", - "integrity": "sha512-CwFq42rXCR8TYIjIfpXCbRX0rp1jo6cPIUPSaWwzbVI4aOfX96OXY8M6KNmtPcg7QjYeDmN+DD0Wp3LaBOLf4Q==", + "version": "0.18.13", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.18.13.tgz", + "integrity": "sha512-I6zs10TZeaHDYoGxENuksxE1sxqZpCp+agYeW039yqFwh3MgVvdmXL5NMveImOC6AtpLvE4xG5ujVic4NWFIDQ==", "dev": true, "optional": true }, "@esbuild/openbsd-x64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.17.19.tgz", - "integrity": "sha512-cnq5brJYrSZ2CF6c35eCmviIN3k3RczmHz8eYaVlNasVqsNY+JKohZU5MKmaOI+KkllCdzOKKdPs762VCPC20g==", + "version": "0.18.13", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.18.13.tgz", + "integrity": "sha512-W5C5nczhrt1y1xPG5bV+0M12p2vetOGlvs43LH8SopQ3z2AseIROu09VgRqydx5qFN7y9qCbpgHLx0kb0TcW7g==", "dev": true, "optional": true }, "@esbuild/sunos-x64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.17.19.tgz", - "integrity": "sha512-vCRT7yP3zX+bKWFeP/zdS6SqdWB8OIpaRq/mbXQxTGHnIxspRtigpkUcDMlSCOejlHowLqII7K2JKevwyRP2rg==", + "version": "0.18.13", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.18.13.tgz", + "integrity": "sha512-X/xzuw4Hzpo/yq3YsfBbIsipNgmsm8mE/QeWbdGdTTeZ77fjxI2K0KP3AlhZ6gU3zKTw1bKoZTuKLnqcJ537qw==", "dev": true, "optional": true }, "@esbuild/win32-arm64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.17.19.tgz", - "integrity": "sha512-yYx+8jwowUstVdorcMdNlzklLYhPxjniHWFKgRqH7IFlUEa0Umu3KuYplf1HUZZ422e3NU9F4LGb+4O0Kdcaag==", + "version": "0.18.13", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.18.13.tgz", + "integrity": "sha512-4CGYdRQT/ILd+yLLE5i4VApMPfGE0RPc/wFQhlluDQCK09+b4JDbxzzjpgQqTPrdnP7r5KUtGVGZYclYiPuHrw==", "dev": true, "optional": true }, "@esbuild/win32-ia32": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.17.19.tgz", - "integrity": "sha512-eggDKanJszUtCdlVs0RB+h35wNlb5v4TWEkq4vZcmVt5u/HiDZrTXe2bWFQUez3RgNHwx/x4sk5++4NSSicKkw==", + "version": "0.18.13", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.18.13.tgz", + "integrity": "sha512-D+wKZaRhQI+MUGMH+DbEr4owC2D7XnF+uyGiZk38QbgzLcofFqIOwFs7ELmIeU45CQgfHNy9Q+LKW3cE8g37Kg==", "dev": true, "optional": true }, "@esbuild/win32-x64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.17.19.tgz", - "integrity": "sha512-lAhycmKnVOuRYNtRtatQR1LPQf2oYCkRGkSFnseDAKPl8lu5SOsK/e1sXe5a0Pc5kHIHe6P2I/ilntNv2xf3cA==", + "version": "0.18.13", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.18.13.tgz", + "integrity": "sha512-iVl6lehAfJS+VmpF3exKpNQ8b0eucf5VWfzR8S7xFve64NBNz2jPUgx1X93/kfnkfgP737O+i1k54SVQS7uVZA==", "dev": true, "optional": true }, @@ -5873,20 +5648,20 @@ } }, "@eslint-community/regexpp": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.5.0.tgz", - "integrity": "sha512-vITaYzIcNmjn5tF5uxcZ/ft7/RXGrMUIS9HalWckEOF6ESiwXKoMzAQf2UW0aVd6rnOeExTJVd5hmWXucBKGXQ==", + "version": "4.5.1", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.5.1.tgz", + "integrity": "sha512-Z5ba73P98O1KUYCCJTUeVpja9RcGoMdncZ6T49FCUl2lN38JtCJ+3WgIDBv0AuY4WChU5PmtJmOCTlN6FZTFKQ==", "dev": true }, "@eslint/eslintrc": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.0.3.tgz", - "integrity": "sha512-+5gy6OQfk+xx3q0d6jGZZC3f3KzAkXc/IanVxd1is/VIIziRqqt3ongQz0FiTUXqTk0c7aDB3OaFuKnuSoJicQ==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.0.tgz", + "integrity": "sha512-Lj7DECXqIVCqnqjjHMPna4vn6GJcMgul/wuS0je9OZ9gsL0zzDpKPVtcG1HaDVc+9y+qgXneTeUMbCqXJNpH1A==", "dev": true, "requires": { "ajv": "^6.12.4", "debug": "^4.3.2", - "espree": "^9.5.2", + "espree": "^9.6.0", "globals": "^13.19.0", "ignore": "^5.2.0", "import-fresh": "^3.2.1", @@ -5896,15 +5671,15 @@ } }, "@eslint/js": { - "version": "8.40.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.40.0.tgz", - "integrity": "sha512-ElyB54bJIhXQYVKjDSvCkPO1iU1tSAeVQJbllWJq1XQSmmA4dgFk8CbiBGpiOPxleE48vDogxCtmMYku4HSVLA==", + "version": "8.44.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.44.0.tgz", + "integrity": "sha512-Ag+9YM4ocKQx9AarydN0KY2j0ErMHNIocPDrVo8zAE44xLTjEtz81OdR68/cydGtk6m6jDb5Za3r2useMzYmSw==", "dev": true }, "@humanwhocodes/config-array": { - "version": "0.11.8", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.8.tgz", - "integrity": "sha512-UybHIJzJnR5Qc/MsD9Kr+RpO2h+/P1GhOwdiLPXK5TWk5sgTdu88bTD9UP+CKbPPh5Rni1u0GjAdYQLemG8g+g==", + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.10.tgz", + "integrity": "sha512-KVVjQmNUepDVGXNuoRRdmmEjruj0KfiGSbS8LVc12LMsWDQzRXJ0qdhN8L8uUigKpfEHRhlaQFY0ib1tnUbNeQ==", "dev": true, "requires": { "@humanwhocodes/object-schema": "^1.2.1", @@ -5924,32 +5699,41 @@ "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", "dev": true }, - "@jridgewell/resolve-uri": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz", - "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==", - "dev": true - }, - "@jridgewell/sourcemap-codec": { - "version": "1.4.15", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", - "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", - "dev": true - }, - "@jridgewell/trace-mapping": { - "version": "0.3.9", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", - "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "@isaacs/cliui": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", + "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", "dev": true, "requires": { - "@jridgewell/resolve-uri": "^3.0.3", - "@jridgewell/sourcemap-codec": "^1.4.10" + "string-width": "^5.1.2", + "string-width-cjs": "npm:string-width@^4.2.0", + "strip-ansi": "^7.0.1", + "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", + "wrap-ansi": "^8.1.0", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "dev": true + }, + "strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "requires": { + "ansi-regex": "^6.0.1" + } + } } }, "@multiversx/sdk-core": { - "version": "12.2.1", - "resolved": "https://registry.npmjs.org/@multiversx/sdk-core/-/sdk-core-12.2.1.tgz", - "integrity": "sha512-jnVwr7ljZ3AD5rN/lifrNq5uZU7CenNVqnCzu8Ks1fVJ/TOZM6VUkVXoSvceweXY0vw7FyH6FBVRUQqWPWbZzg==", + "version": "12.6.0", + "resolved": "https://registry.npmjs.org/@multiversx/sdk-core/-/sdk-core-12.6.0.tgz", + "integrity": "sha512-aJjSn8EzaYXalUuvAuxOTPtv8GDbimJlSYNRLjCsToyfwGAyS9cRllmq2d1I2nlrR89YgAsOL9qp+sI5DA7yBw==", "dev": true, "requires": { "@multiversx/sdk-transaction-decoder": "1.0.2", @@ -5959,40 +5743,29 @@ "buffer": "6.0.3", "json-duplicate-key-handle": "1.0.0", "keccak": "3.0.2", - "protobufjs": "6.11.3" + "protobufjs": "7.2.4" } }, "@multiversx/sdk-extension-provider": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/@multiversx/sdk-extension-provider/-/sdk-extension-provider-2.0.7.tgz", - "integrity": "sha512-t7CabgUk/hPhMYVpqGPMdEVDqOo6RrRKmru6nXKpWZHdeQZZV52zeVVC8VRgqwG5mNwAkCrALLvz7UiV/ZLfIg==", - "dev": true + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@multiversx/sdk-extension-provider/-/sdk-extension-provider-3.0.0.tgz", + "integrity": "sha512-xNHLShzimYbMXqEJoiNyB4fNOXQUwSJCzt9FiOA4GdxucJnCgIM25mXtSj2I93cz+KD39QgRjEYep+li/lykOw==", + "dev": true, + "requires": {} }, "@multiversx/sdk-native-auth-client": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@multiversx/sdk-native-auth-client/-/sdk-native-auth-client-1.0.2.tgz", - "integrity": "sha512-2y5XCi09Zfgo5fNuQPaSEfOVJoZB8OrAiEtjQy3RDzm44j83E/bByFWDE2CWHV1aRWsn9JwOSQdYWtMO9RMF/Q==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@multiversx/sdk-native-auth-client/-/sdk-native-auth-client-1.0.4.tgz", + "integrity": "sha512-Yz6lAWtGaUHoFma7DICQMr6ZKzNvusPq0eRNOXmTyW+9Zm9Gih2qUKFiIDEeEe6Fn9d6hO+ed20R4h3anYsxPw==", "dev": true, "requires": { - "axios": "^0.27.2" - }, - "dependencies": { - "axios": { - "version": "0.27.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz", - "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==", - "dev": true, - "requires": { - "follow-redirects": "^1.14.9", - "form-data": "^4.0.0" - } - } + "axios": "0.24.0" } }, "@multiversx/sdk-network-providers": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/@multiversx/sdk-network-providers/-/sdk-network-providers-1.4.0.tgz", - "integrity": "sha512-a9vcY6wNM3ZccApULXbTCPp3/dAu4J6uH0go3jHy8YB0iH9nKiTLQLUD+1fM0lJmuC9Tk9Q+EeAj7OJzQqHKkQ==", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@multiversx/sdk-network-providers/-/sdk-network-providers-1.5.0.tgz", + "integrity": "sha512-GgmpOfwdeK8QvBCVJ96/L2ATNax7/rdSDvPLlmppKHVuFAj56/EqGnrLuktNPRWBsZse+7DMoS38kGtN77AwJQ==", "dev": true, "requires": { "axios": "0.24.0", @@ -6020,14 +5793,13 @@ } }, "@multiversx/sdk-wallet-connect-provider": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/@multiversx/sdk-wallet-connect-provider/-/sdk-wallet-connect-provider-3.2.1.tgz", - "integrity": "sha512-2SQzVbR8HMU4kcW4uahj1jmqYDg75hADO78GEBx0oUQQDk72nPkII2/73azVvKMHuM+4YyrJa97I0KWtCUmTPg==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@multiversx/sdk-wallet-connect-provider/-/sdk-wallet-connect-provider-4.0.2.tgz", + "integrity": "sha512-WGim7kD49N5LoWestdmvxBYeJEDCevJv50Gt/RFBtZoWT3OyDoWu2wotVNssjPW0UQ5EyYPae96g+6FNHrXsxw==", "dev": true, "requires": { - "@walletconnect/client": "1.8.0", - "@walletconnect/sign-client": "2.6.2", - "@walletconnect/utils": "2.6.2", + "@walletconnect/sign-client": "2.9.0", + "@walletconnect/utils": "2.9.0", "bech32": "1.1.4" } }, @@ -6066,6 +5838,35 @@ "fastq": "^1.6.0" } }, + "@pkgjs/parseargs": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", + "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", + "dev": true, + "optional": true + }, + "@pkgr/utils": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/@pkgr/utils/-/utils-2.4.2.tgz", + "integrity": "sha512-POgTXhjrTfbTV63DiFXav4lBHiICLKKwDeaKn9Nphwj7WH6m0hMMCaJkMyRWjgtPFyRKRVoMXXjczsTQRDEhYw==", + "dev": true, + "requires": { + "cross-spawn": "^7.0.3", + "fast-glob": "^3.3.0", + "is-glob": "^4.0.3", + "open": "^9.1.0", + "picocolors": "^1.0.0", + "tslib": "^2.6.0" + }, + "dependencies": { + "tslib": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.0.tgz", + "integrity": "sha512-7At1WUettjcSRHXCyYtTselblcHl9PJFFVKiCAy/bY97+BPZXSQ2wbq0P9s8tK2G7dFQfNnlJnPAiArVBVBsfA==", + "dev": true + } + } + }, "@protobufjs/aspromise": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", @@ -6294,52 +6095,22 @@ "@stablelib/wipe": "^1.0.1" } }, - "@tsconfig/node10": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", - "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==", - "dev": true - }, - "@tsconfig/node12": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", - "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", - "dev": true - }, - "@tsconfig/node14": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", - "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", - "dev": true - }, - "@tsconfig/node16": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.3.tgz", - "integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==", - "dev": true - }, "@types/json-schema": { - "version": "7.0.11", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", - "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", - "dev": true - }, - "@types/long": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.2.tgz", - "integrity": "sha512-MqTGEo5bj5t157U6fA/BiDynNkn0YknVdh48CMPkTSpFTVmvao5UQmm7uEF6xBEo7qIMAlY/JSleYaE6VOdpaA==", + "version": "7.0.12", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.12.tgz", + "integrity": "sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA==", "dev": true }, "@types/node": { - "version": "18.15.11", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.11.tgz", - "integrity": "sha512-E5Kwq2n4SbMzQOn6wnmBjuK9ouqlURrcZDVfbo9ftDDTFt3nk7ZKK4GMOzoYgnpQJKcxwQw+lGaBvvlMo0qN/Q==", + "version": "20.4.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.1.tgz", + "integrity": "sha512-JIzsAvJeA/5iY6Y/OxZbv1lUcc8dNSE77lb2gnBH+/PJ3lFR1Ccvgwl5JWnHAkNHcRsT0TbpVOsiMKZ1F/yyJg==", "dev": true }, "@types/qrcode": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@types/qrcode/-/qrcode-1.5.0.tgz", - "integrity": "sha512-x5ilHXRxUPIMfjtM+1vf/GPTRWZ81nqscursm5gMznJeK9M0YnZ1c3bEvRLQ0zSSgedLx1J6MGL231ObQGGhaA==", + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@types/qrcode/-/qrcode-1.5.1.tgz", + "integrity": "sha512-HpSN675K0PmxIDRpjMI3Mc2GiKo3dNu+X/F5SoItiaDS1lVfgC6Wac1c5lQDfKWbTJUSHWiHKzpJpBZG7k9gaA==", "dev": true, "requires": { "@types/node": "*" @@ -6361,260 +6132,130 @@ } }, "@typescript-eslint/eslint-plugin": { - "version": "5.59.5", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.59.5.tgz", - "integrity": "sha512-feA9xbVRWJZor+AnLNAr7A8JRWeZqHUf4T9tlP+TN04b05pFVhO5eN7/O93Y/1OUlLMHKbnJisgDURs/qvtqdg==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.0.0.tgz", + "integrity": "sha512-xuv6ghKGoiq856Bww/yVYnXGsKa588kY3M0XK7uUW/3fJNNULKRfZfSBkMTSpqGG/8ZCXCadfh8G/z/B4aqS/A==", "dev": true, "requires": { - "@eslint-community/regexpp": "^4.4.0", - "@typescript-eslint/scope-manager": "5.59.5", - "@typescript-eslint/type-utils": "5.59.5", - "@typescript-eslint/utils": "5.59.5", + "@eslint-community/regexpp": "^4.5.0", + "@typescript-eslint/scope-manager": "6.0.0", + "@typescript-eslint/type-utils": "6.0.0", + "@typescript-eslint/utils": "6.0.0", + "@typescript-eslint/visitor-keys": "6.0.0", "debug": "^4.3.4", "grapheme-splitter": "^1.0.4", - "ignore": "^5.2.0", + "graphemer": "^1.4.0", + "ignore": "^5.2.4", + "natural-compare": "^1.4.0", "natural-compare-lite": "^1.4.0", - "semver": "^7.3.7", - "tsutils": "^3.21.0" + "semver": "^7.5.0", + "ts-api-utils": "^1.0.1" } }, "@typescript-eslint/parser": { - "version": "5.59.5", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.59.5.tgz", - "integrity": "sha512-NJXQC4MRnF9N9yWqQE2/KLRSOLvrrlZb48NGVfBa+RuPMN6B7ZcK5jZOvhuygv4D64fRKnZI4L4p8+M+rfeQuw==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.0.0.tgz", + "integrity": "sha512-TNaufYSPrr1U8n+3xN+Yp9g31vQDJqhXzzPSHfQDLcaO4tU+mCfODPxCwf4H530zo7aUBE3QIdxCXamEnG04Tg==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "5.59.5", - "@typescript-eslint/types": "5.59.5", - "@typescript-eslint/typescript-estree": "5.59.5", + "@typescript-eslint/scope-manager": "6.0.0", + "@typescript-eslint/types": "6.0.0", + "@typescript-eslint/typescript-estree": "6.0.0", + "@typescript-eslint/visitor-keys": "6.0.0", "debug": "^4.3.4" } }, "@typescript-eslint/scope-manager": { - "version": "5.59.5", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.59.5.tgz", - "integrity": "sha512-jVecWwnkX6ZgutF+DovbBJirZcAxgxC0EOHYt/niMROf8p4PwxxG32Qdhj/iIQQIuOflLjNkxoXyArkcIP7C3A==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.0.0.tgz", + "integrity": "sha512-o4q0KHlgCZTqjuaZ25nw5W57NeykZT9LiMEG4do/ovwvOcPnDO1BI5BQdCsUkjxFyrCL0cSzLjvIMfR9uo7cWg==", "dev": true, "requires": { - "@typescript-eslint/types": "5.59.5", - "@typescript-eslint/visitor-keys": "5.59.5" + "@typescript-eslint/types": "6.0.0", + "@typescript-eslint/visitor-keys": "6.0.0" } }, "@typescript-eslint/type-utils": { - "version": "5.59.5", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.59.5.tgz", - "integrity": "sha512-4eyhS7oGym67/pSxA2mmNq7X164oqDYNnZCUayBwJZIRVvKpBCMBzFnFxjeoDeShjtO6RQBHBuwybuX3POnDqg==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.0.0.tgz", + "integrity": "sha512-ah6LJvLgkoZ/pyJ9GAdFkzeuMZ8goV6BH7eC9FPmojrnX9yNCIsfjB+zYcnex28YO3RFvBkV6rMV6WpIqkPvoQ==", "dev": true, "requires": { - "@typescript-eslint/typescript-estree": "5.59.5", - "@typescript-eslint/utils": "5.59.5", + "@typescript-eslint/typescript-estree": "6.0.0", + "@typescript-eslint/utils": "6.0.0", "debug": "^4.3.4", - "tsutils": "^3.21.0" + "ts-api-utils": "^1.0.1" } }, "@typescript-eslint/types": { - "version": "5.59.5", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.59.5.tgz", - "integrity": "sha512-xkfRPHbqSH4Ggx4eHRIO/eGL8XL4Ysb4woL8c87YuAo8Md7AUjyWKa9YMwTL519SyDPrfEgKdewjkxNCVeJW7w==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.0.0.tgz", + "integrity": "sha512-Zk9KDggyZM6tj0AJWYYKgF0yQyrcnievdhG0g5FqyU3Y2DRxJn4yWY21sJC0QKBckbsdKKjYDV2yVrrEvuTgxg==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "5.59.5", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.59.5.tgz", - "integrity": "sha512-+XXdLN2CZLZcD/mO7mQtJMvCkzRfmODbeSKuMY/yXbGkzvA9rJyDY5qDYNoiz2kP/dmyAxXquL2BvLQLJFPQIg==", - "dev": true, - "requires": { - "@typescript-eslint/types": "5.59.5", - "@typescript-eslint/visitor-keys": "5.59.5", - "debug": "^4.3.4", - "globby": "^11.1.0", - "is-glob": "^4.0.3", - "semver": "^7.3.7", - "tsutils": "^3.21.0" - } - }, - "@typescript-eslint/utils": { - "version": "5.59.5", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.59.5.tgz", - "integrity": "sha512-sCEHOiw+RbyTii9c3/qN74hYDPNORb8yWCoPLmB7BIflhplJ65u2PBpdRla12e3SSTJ2erRkPjz7ngLHhUegxA==", - "dev": true, - "requires": { - "@eslint-community/eslint-utils": "^4.2.0", - "@types/json-schema": "^7.0.9", - "@types/semver": "^7.3.12", - "@typescript-eslint/scope-manager": "5.59.5", - "@typescript-eslint/types": "5.59.5", - "@typescript-eslint/typescript-estree": "5.59.5", - "eslint-scope": "^5.1.1", - "semver": "^7.3.7" - } - }, - "@typescript-eslint/visitor-keys": { - "version": "5.59.5", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.59.5.tgz", - "integrity": "sha512-qL+Oz+dbeBRTeyJTIy0eniD3uvqU7x+y1QceBismZ41hd4aBSRh8UAw4pZP0+XzLuPZmx4raNMq/I+59W2lXKA==", - "dev": true, - "requires": { - "@typescript-eslint/types": "5.59.5", - "eslint-visitor-keys": "^3.3.0" - } - }, - "@walletconnect/browser-utils": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/@walletconnect/browser-utils/-/browser-utils-1.8.0.tgz", - "integrity": "sha512-Wcqqx+wjxIo9fv6eBUFHPsW1y/bGWWRboni5dfD8PtOmrihrEpOCmvRJe4rfl7xgJW8Ea9UqKEaq0bIRLHlK4A==", - "dev": true, - "requires": { - "@walletconnect/safe-json": "1.0.0", - "@walletconnect/types": "^1.8.0", - "@walletconnect/window-getters": "1.0.0", - "@walletconnect/window-metadata": "1.0.0", - "detect-browser": "5.2.0" - }, - "dependencies": { - "@walletconnect/safe-json": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@walletconnect/safe-json/-/safe-json-1.0.0.tgz", - "integrity": "sha512-QJzp/S/86sUAgWY6eh5MKYmSfZaRpIlmCJdi5uG4DJlKkZrHEF7ye7gA+VtbVzvTtpM/gRwO2plQuiooIeXjfg==", - "dev": true - }, - "@walletconnect/window-getters": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@walletconnect/window-getters/-/window-getters-1.0.0.tgz", - "integrity": "sha512-xB0SQsLaleIYIkSsl43vm8EwETpBzJ2gnzk7e0wMF3ktqiTGS6TFHxcprMl5R44KKh4tCcHCJwolMCaDSwtAaA==", - "dev": true - }, - "@walletconnect/window-metadata": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@walletconnect/window-metadata/-/window-metadata-1.0.0.tgz", - "integrity": "sha512-9eFvmJxIKCC3YWOL97SgRkKhlyGXkrHwamfechmqszbypFspaSk+t2jQXAEU7YClHF6Qjw5eYOmy1//zFi9/GA==", - "dev": true, - "requires": { - "@walletconnect/window-getters": "^1.0.0" - } - }, - "detect-browser": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/detect-browser/-/detect-browser-5.2.0.tgz", - "integrity": "sha512-tr7XntDAu50BVENgQfajMLzacmSe34D+qZc4zjnniz0ZVuw/TZcLcyxHQjYpJTM36sGEkZZlYLnIM1hH7alTMA==", - "dev": true - } - } - }, - "@walletconnect/client": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/@walletconnect/client/-/client-1.8.0.tgz", - "integrity": "sha512-svyBQ14NHx6Cs2j4TpkQaBI/2AF4+LXz64FojTjMtV4VMMhl81jSO1vNeg+yYhQzvjcGH/GpSwixjyCW0xFBOQ==", - "dev": true, - "requires": { - "@walletconnect/core": "^1.8.0", - "@walletconnect/iso-crypto": "^1.8.0", - "@walletconnect/types": "^1.8.0", - "@walletconnect/utils": "^1.8.0" - }, - "dependencies": { - "@walletconnect/utils": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/@walletconnect/utils/-/utils-1.8.0.tgz", - "integrity": "sha512-zExzp8Mj1YiAIBfKNm5u622oNw44WOESzo6hj+Q3apSMIb0Jph9X3GDIdbZmvVZsNPxWDL7uodKgZcCInZv2vA==", - "dev": true, - "requires": { - "@walletconnect/browser-utils": "^1.8.0", - "@walletconnect/encoding": "^1.0.1", - "@walletconnect/jsonrpc-utils": "^1.0.3", - "@walletconnect/types": "^1.8.0", - "bn.js": "4.11.8", - "js-sha3": "0.8.0", - "query-string": "6.13.5" - } - }, - "bn.js": { - "version": "4.11.8", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", - "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==", - "dev": true - }, - "query-string": { - "version": "6.13.5", - "resolved": "https://registry.npmjs.org/query-string/-/query-string-6.13.5.tgz", - "integrity": "sha512-svk3xg9qHR39P3JlHuD7g3nRnyay5mHbrPctEBDUxUkHRifPHXJDhBUycdCC0NBjXoDf44Gb+IsOZL1Uwn8M/Q==", - "dev": true, - "requires": { - "decode-uri-component": "^0.2.0", - "split-on-first": "^1.0.0", - "strict-uri-encode": "^2.0.0" - } - } - } - }, - "@walletconnect/core": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/@walletconnect/core/-/core-1.8.0.tgz", - "integrity": "sha512-aFTHvEEbXcZ8XdWBw6rpQDte41Rxwnuk3SgTD8/iKGSRTni50gI9S3YEzMj05jozSiOBxQci4pJDMVhIUMtarw==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.0.0.tgz", + "integrity": "sha512-2zq4O7P6YCQADfmJ5OTDQTP3ktajnXIRrYAtHM9ofto/CJZV3QfJ89GEaM2BNGeSr1KgmBuLhEkz5FBkS2RQhQ==", "dev": true, "requires": { - "@walletconnect/socket-transport": "^1.8.0", - "@walletconnect/types": "^1.8.0", - "@walletconnect/utils": "^1.8.0" - }, - "dependencies": { - "@walletconnect/utils": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/@walletconnect/utils/-/utils-1.8.0.tgz", - "integrity": "sha512-zExzp8Mj1YiAIBfKNm5u622oNw44WOESzo6hj+Q3apSMIb0Jph9X3GDIdbZmvVZsNPxWDL7uodKgZcCInZv2vA==", - "dev": true, - "requires": { - "@walletconnect/browser-utils": "^1.8.0", - "@walletconnect/encoding": "^1.0.1", - "@walletconnect/jsonrpc-utils": "^1.0.3", - "@walletconnect/types": "^1.8.0", - "bn.js": "4.11.8", - "js-sha3": "0.8.0", - "query-string": "6.13.5" - } - }, - "bn.js": { - "version": "4.11.8", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", - "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==", - "dev": true - }, - "query-string": { - "version": "6.13.5", - "resolved": "https://registry.npmjs.org/query-string/-/query-string-6.13.5.tgz", - "integrity": "sha512-svk3xg9qHR39P3JlHuD7g3nRnyay5mHbrPctEBDUxUkHRifPHXJDhBUycdCC0NBjXoDf44Gb+IsOZL1Uwn8M/Q==", - "dev": true, - "requires": { - "decode-uri-component": "^0.2.0", - "split-on-first": "^1.0.0", - "strict-uri-encode": "^2.0.0" - } - } + "@typescript-eslint/types": "6.0.0", + "@typescript-eslint/visitor-keys": "6.0.0", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "semver": "^7.5.0", + "ts-api-utils": "^1.0.1" } }, - "@walletconnect/crypto": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@walletconnect/crypto/-/crypto-1.0.3.tgz", - "integrity": "sha512-+2jdORD7XQs76I2Odgr3wwrtyuLUXD/kprNVsjWRhhhdO9Mt6WqVzOPu0/t7OHSmgal8k7SoBQzUc5hu/8zL/g==", + "@typescript-eslint/utils": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.0.0.tgz", + "integrity": "sha512-SOr6l4NB6HE4H/ktz0JVVWNXqCJTOo/mHnvIte1ZhBQ0Cvd04x5uKZa3zT6tiodL06zf5xxdK8COiDvPnQ27JQ==", "dev": true, "requires": { - "@walletconnect/encoding": "^1.0.2", - "@walletconnect/environment": "^1.0.1", - "@walletconnect/randombytes": "^1.0.3", - "aes-js": "^3.1.2", - "hash.js": "^1.1.7", - "tslib": "1.14.1" + "@eslint-community/eslint-utils": "^4.3.0", + "@types/json-schema": "^7.0.11", + "@types/semver": "^7.3.12", + "@typescript-eslint/scope-manager": "6.0.0", + "@typescript-eslint/types": "6.0.0", + "@typescript-eslint/typescript-estree": "6.0.0", + "eslint-scope": "^5.1.1", + "semver": "^7.5.0" } }, - "@walletconnect/encoding": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@walletconnect/encoding/-/encoding-1.0.2.tgz", - "integrity": "sha512-CrwSBrjqJ7rpGQcTL3kU+Ief+Bcuu9PH6JLOb+wM6NITX1GTxR/MfNwnQfhLKK6xpRAyj2/nM04OOH6wS8Imag==", + "@typescript-eslint/visitor-keys": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.0.0.tgz", + "integrity": "sha512-cvJ63l8c0yXdeT5POHpL0Q1cZoRcmRKFCtSjNGJxPkcP571EfZMcNbzWAc7oK3D1dRzm/V5EwtkANTZxqvuuUA==", "dev": true, "requires": { - "is-typedarray": "1.0.0", - "tslib": "1.14.1", - "typedarray-to-buffer": "3.1.5" + "@typescript-eslint/types": "6.0.0", + "eslint-visitor-keys": "^3.4.1" + } + }, + "@walletconnect/core": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@walletconnect/core/-/core-2.9.0.tgz", + "integrity": "sha512-MZYJghS9YCvGe32UOgDj0mCasaOoGHQaYXWeQblXE/xb8HuaM6kAWhjIQN9P+MNp5QP134BHP5olQostcCotXQ==", + "dev": true, + "requires": { + "@walletconnect/heartbeat": "1.2.1", + "@walletconnect/jsonrpc-provider": "1.0.13", + "@walletconnect/jsonrpc-types": "1.0.3", + "@walletconnect/jsonrpc-utils": "1.0.8", + "@walletconnect/jsonrpc-ws-connection": "1.0.12", + "@walletconnect/keyvaluestorage": "^1.0.2", + "@walletconnect/logger": "^2.0.1", + "@walletconnect/relay-api": "^1.0.9", + "@walletconnect/relay-auth": "^1.0.4", + "@walletconnect/safe-json": "^1.0.2", + "@walletconnect/time": "^1.0.2", + "@walletconnect/types": "2.9.0", + "@walletconnect/utils": "2.9.0", + "events": "^3.3.0", + "lodash.isequal": "4.5.0", + "uint8arrays": "^3.1.0" } }, "@walletconnect/environment": { @@ -6637,79 +6278,31 @@ } }, "@walletconnect/heartbeat": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@walletconnect/heartbeat/-/heartbeat-1.2.0.tgz", - "integrity": "sha512-0vbzTa/ARrpmMmOD+bQMxPvFYKtOLQZObgZakrYr0aODiMOO71CmPVNV2eAqXnw9rMmcP+z91OybLeIFlwTjjA==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@walletconnect/heartbeat/-/heartbeat-1.2.1.tgz", + "integrity": "sha512-yVzws616xsDLJxuG/28FqtZ5rzrTA4gUjdEMTbWB5Y8V1XHRmqq4efAxCw5ie7WjbXFSUyBHaWlMR+2/CpQC5Q==", "dev": true, "requires": { "@walletconnect/events": "^1.0.1", "@walletconnect/time": "^1.0.2", - "chai": "^4.3.7", - "mocha": "^10.2.0", - "ts-node": "^10.9.1", "tslib": "1.14.1" } }, - "@walletconnect/iso-crypto": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/@walletconnect/iso-crypto/-/iso-crypto-1.8.0.tgz", - "integrity": "sha512-pWy19KCyitpfXb70hA73r9FcvklS+FvO9QUIttp3c2mfW8frxgYeRXfxLRCIQTkaYueRKvdqPjbyhPLam508XQ==", - "dev": true, - "requires": { - "@walletconnect/crypto": "^1.0.2", - "@walletconnect/types": "^1.8.0", - "@walletconnect/utils": "^1.8.0" - }, - "dependencies": { - "@walletconnect/utils": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/@walletconnect/utils/-/utils-1.8.0.tgz", - "integrity": "sha512-zExzp8Mj1YiAIBfKNm5u622oNw44WOESzo6hj+Q3apSMIb0Jph9X3GDIdbZmvVZsNPxWDL7uodKgZcCInZv2vA==", - "dev": true, - "requires": { - "@walletconnect/browser-utils": "^1.8.0", - "@walletconnect/encoding": "^1.0.1", - "@walletconnect/jsonrpc-utils": "^1.0.3", - "@walletconnect/types": "^1.8.0", - "bn.js": "4.11.8", - "js-sha3": "0.8.0", - "query-string": "6.13.5" - } - }, - "bn.js": { - "version": "4.11.8", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", - "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==", - "dev": true - }, - "query-string": { - "version": "6.13.5", - "resolved": "https://registry.npmjs.org/query-string/-/query-string-6.13.5.tgz", - "integrity": "sha512-svk3xg9qHR39P3JlHuD7g3nRnyay5mHbrPctEBDUxUkHRifPHXJDhBUycdCC0NBjXoDf44Gb+IsOZL1Uwn8M/Q==", - "dev": true, - "requires": { - "decode-uri-component": "^0.2.0", - "split-on-first": "^1.0.0", - "strict-uri-encode": "^2.0.0" - } - } - } - }, "@walletconnect/jsonrpc-provider": { - "version": "1.0.12", - "resolved": "https://registry.npmjs.org/@walletconnect/jsonrpc-provider/-/jsonrpc-provider-1.0.12.tgz", - "integrity": "sha512-6uI2y5281gloZSzICOjk+CVC7CVu0MhtMt2Yzpj05lPb0pzm/bK2oZ2ibxwLerPrqpNt/5bIFVRmoOgPw1mHAQ==", + "version": "1.0.13", + "resolved": "https://registry.npmjs.org/@walletconnect/jsonrpc-provider/-/jsonrpc-provider-1.0.13.tgz", + "integrity": "sha512-K73EpThqHnSR26gOyNEL+acEex3P7VWZe6KE12ZwKzAt2H4e5gldZHbjsu2QR9cLeJ8AXuO7kEMOIcRv1QEc7g==", "dev": true, "requires": { - "@walletconnect/jsonrpc-utils": "^1.0.7", + "@walletconnect/jsonrpc-utils": "^1.0.8", "@walletconnect/safe-json": "^1.0.2", "tslib": "1.14.1" } }, "@walletconnect/jsonrpc-types": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@walletconnect/jsonrpc-types/-/jsonrpc-types-1.0.2.tgz", - "integrity": "sha512-CZe8tjJX73OWdHjrBHy7HtAapJ2tT0Q3TYhPBhRxi3643lwPIQWC9En45ldY14TZwgSewkbZ0FtGBZK0G7Bbyg==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@walletconnect/jsonrpc-types/-/jsonrpc-types-1.0.3.tgz", + "integrity": "sha512-iIQ8hboBl3o5ufmJ8cuduGad0CQm3ZlsHtujv9Eu16xq89q+BG7Nh5VLxxUgmtpnrePgFkTwXirCTkwJH1v+Yw==", "dev": true, "requires": { "keyvaluestorage-interface": "^1.0.0", @@ -6717,20 +6310,20 @@ } }, "@walletconnect/jsonrpc-utils": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/@walletconnect/jsonrpc-utils/-/jsonrpc-utils-1.0.7.tgz", - "integrity": "sha512-zJziApzUF/Il4VcwabnaU+0yo1QI4eUkYX99zmCVTHJvZOf2l0zjADf/OpKqWyeNFC3Io56Z/8uJHVtcNVvyFA==", + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@walletconnect/jsonrpc-utils/-/jsonrpc-utils-1.0.8.tgz", + "integrity": "sha512-vdeb03bD8VzJUL6ZtzRYsFMq1eZQcM3EAzT0a3st59dyLfJ0wq+tKMpmGH7HlB7waD858UWgfIcudbPFsbzVdw==", "dev": true, "requires": { "@walletconnect/environment": "^1.0.1", - "@walletconnect/jsonrpc-types": "^1.0.2", + "@walletconnect/jsonrpc-types": "^1.0.3", "tslib": "1.14.1" } }, "@walletconnect/jsonrpc-ws-connection": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/@walletconnect/jsonrpc-ws-connection/-/jsonrpc-ws-connection-1.0.11.tgz", - "integrity": "sha512-TiFJ6saasKXD+PwGkm5ZGSw0837nc6EeFmurSPgIT/NofnOV4Tv7CVJqGQN0rQYoJUSYu21cwHNYaFkzNpUN+w==", + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/@walletconnect/jsonrpc-ws-connection/-/jsonrpc-ws-connection-1.0.12.tgz", + "integrity": "sha512-HAcadga3Qjt1Cqy+qXEW6zjaCs8uJGdGQrqltzl3OjiK4epGZRdvSzTe63P+t/3z+D2wG+ffEPn0GVcDozmN1w==", "dev": true, "requires": { "@walletconnect/jsonrpc-utils": "^1.0.6", @@ -6760,18 +6353,6 @@ "tslib": "1.14.1" } }, - "@walletconnect/randombytes": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@walletconnect/randombytes/-/randombytes-1.0.3.tgz", - "integrity": "sha512-35lpzxcHFbTN3ABefC9W+uBpNZl1GC4Wpx0ed30gibfO/y9oLdy1NznbV96HARQKSBV9J9M/rrtIvf6a23jfYw==", - "dev": true, - "requires": { - "@walletconnect/encoding": "^1.0.2", - "@walletconnect/environment": "^1.0.1", - "randombytes": "^2.1.0", - "tslib": "1.14.1" - } - }, "@walletconnect/relay-api": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/@walletconnect/relay-api/-/relay-api-1.0.9.tgz", @@ -6806,106 +6387,20 @@ } }, "@walletconnect/sign-client": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/@walletconnect/sign-client/-/sign-client-2.6.2.tgz", - "integrity": "sha512-2/yXliVVRn27i4rCuIumBB361ZQtKCgAwm6OmPW8P2wJpmJ03K0FuLzuYbYy/WvweuFklQ92cQlg3V8Ez5M+vA==", + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@walletconnect/sign-client/-/sign-client-2.9.0.tgz", + "integrity": "sha512-mEKc4LlLMebCe45qzqh+MX4ilQK4kOEBzLY6YJpG8EhyT45eX4JMNA7qQoYa9MRMaaVb/7USJcc4e3ZrjZvQmA==", "dev": true, "requires": { - "@walletconnect/core": "2.6.2", + "@walletconnect/core": "2.9.0", "@walletconnect/events": "^1.0.1", - "@walletconnect/heartbeat": "^1.2.0", - "@walletconnect/jsonrpc-utils": "^1.0.7", + "@walletconnect/heartbeat": "1.2.1", + "@walletconnect/jsonrpc-utils": "1.0.8", "@walletconnect/logger": "^2.0.1", "@walletconnect/time": "^1.0.2", - "@walletconnect/types": "2.6.2", - "@walletconnect/utils": "2.6.2", - "events": "^3.3.0", - "pino": "7.11.0" - }, - "dependencies": { - "@walletconnect/core": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/@walletconnect/core/-/core-2.6.2.tgz", - "integrity": "sha512-uTla1Dyhr9ye1SbyubyxpUlW7r4oVf47EgIMEntbmMK6+xFpeiF7w5hNebIwp9g/dW81QQklwp3c0slwkTahdg==", - "dev": true, - "requires": { - "@walletconnect/heartbeat": "1.2.0", - "@walletconnect/jsonrpc-provider": "^1.0.12", - "@walletconnect/jsonrpc-utils": "^1.0.7", - "@walletconnect/jsonrpc-ws-connection": "^1.0.11", - "@walletconnect/keyvaluestorage": "^1.0.2", - "@walletconnect/logger": "^2.0.1", - "@walletconnect/relay-api": "^1.0.9", - "@walletconnect/relay-auth": "^1.0.4", - "@walletconnect/safe-json": "^1.0.2", - "@walletconnect/time": "^1.0.2", - "@walletconnect/types": "2.6.2", - "@walletconnect/utils": "2.6.2", - "events": "^3.3.0", - "lodash.isequal": "4.5.0", - "pino": "7.11.0", - "uint8arrays": "^3.1.0" - } - }, - "@walletconnect/types": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/@walletconnect/types/-/types-2.6.2.tgz", - "integrity": "sha512-eP9xfNVdoQrIfqJSlHqijf0l/Rw/XTO2SeFVlgA5UFHpMhhAo/kzuL+xC2iOkoGKEus4fM3lCuIw+aCZCwZA3g==", - "dev": true, - "requires": { - "@walletconnect/events": "^1.0.1", - "@walletconnect/heartbeat": "1.2.0", - "@walletconnect/jsonrpc-types": "^1.0.2", - "@walletconnect/keyvaluestorage": "^1.0.2", - "@walletconnect/logger": "^2.0.1", - "events": "^3.3.0" - } - } - } - }, - "@walletconnect/socket-transport": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/@walletconnect/socket-transport/-/socket-transport-1.8.0.tgz", - "integrity": "sha512-5DyIyWrzHXTcVp0Vd93zJ5XMW61iDM6bcWT4p8DTRfFsOtW46JquruMhxOLeCOieM4D73kcr3U7WtyR4JUsGuQ==", - "dev": true, - "requires": { - "@walletconnect/types": "^1.8.0", - "@walletconnect/utils": "^1.8.0", - "ws": "7.5.3" - }, - "dependencies": { - "@walletconnect/utils": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/@walletconnect/utils/-/utils-1.8.0.tgz", - "integrity": "sha512-zExzp8Mj1YiAIBfKNm5u622oNw44WOESzo6hj+Q3apSMIb0Jph9X3GDIdbZmvVZsNPxWDL7uodKgZcCInZv2vA==", - "dev": true, - "requires": { - "@walletconnect/browser-utils": "^1.8.0", - "@walletconnect/encoding": "^1.0.1", - "@walletconnect/jsonrpc-utils": "^1.0.3", - "@walletconnect/types": "^1.8.0", - "bn.js": "4.11.8", - "js-sha3": "0.8.0", - "query-string": "6.13.5" - } - }, - "bn.js": { - "version": "4.11.8", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", - "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==", - "dev": true - }, - "query-string": { - "version": "6.13.5", - "resolved": "https://registry.npmjs.org/query-string/-/query-string-6.13.5.tgz", - "integrity": "sha512-svk3xg9qHR39P3JlHuD7g3nRnyay5mHbrPctEBDUxUkHRifPHXJDhBUycdCC0NBjXoDf44Gb+IsOZL1Uwn8M/Q==", - "dev": true, - "requires": { - "decode-uri-component": "^0.2.0", - "split-on-first": "^1.0.0", - "strict-uri-encode": "^2.0.0" - } - } + "@walletconnect/types": "2.9.0", + "@walletconnect/utils": "2.9.0", + "events": "^3.3.0" } }, "@walletconnect/time": { @@ -6918,15 +6413,23 @@ } }, "@walletconnect/types": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/@walletconnect/types/-/types-1.8.0.tgz", - "integrity": "sha512-Cn+3I0V0vT9ghMuzh1KzZvCkiAxTq+1TR2eSqw5E5AVWfmCtECFkVZBP6uUJZ8YjwLqXheI+rnjqPy7sVM4Fyg==", - "dev": true + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@walletconnect/types/-/types-2.9.0.tgz", + "integrity": "sha512-ORopsMfSRvUYqtjKKd6scfg8o4/aGebipLxx92AuuUgMTERSU6cGmIrK6rdLu7W6FBJkmngPLEGc9mRqAb9Lug==", + "dev": true, + "requires": { + "@walletconnect/events": "^1.0.1", + "@walletconnect/heartbeat": "1.2.1", + "@walletconnect/jsonrpc-types": "1.0.3", + "@walletconnect/keyvaluestorage": "^1.0.2", + "@walletconnect/logger": "^2.0.1", + "events": "^3.3.0" + } }, "@walletconnect/utils": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/@walletconnect/utils/-/utils-2.6.2.tgz", - "integrity": "sha512-G0gtWQd5PhT7Z3h9zy5H6bG8t9likb5+hP2ZuBbt/vTu8ONPEsTcH1Ior2lUjuYLQ9ufK3LMZM85pO+wWLRVaw==", + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@walletconnect/utils/-/utils-2.9.0.tgz", + "integrity": "sha512-7Tu3m6dZL84KofrNBcblsgpSqU2vdo9ImLD7zWimLXERVGNQ8smXG+gmhQYblebIBhsPzjy9N38YMC3nPlfQNw==", "dev": true, "requires": { "@stablelib/chacha20poly1305": "1.0.1", @@ -6934,32 +6437,15 @@ "@stablelib/random": "^1.0.2", "@stablelib/sha256": "1.0.1", "@stablelib/x25519": "^1.0.3", - "@walletconnect/jsonrpc-utils": "^1.0.7", "@walletconnect/relay-api": "^1.0.9", "@walletconnect/safe-json": "^1.0.2", "@walletconnect/time": "^1.0.2", - "@walletconnect/types": "2.6.2", + "@walletconnect/types": "2.9.0", "@walletconnect/window-getters": "^1.0.1", "@walletconnect/window-metadata": "^1.0.1", "detect-browser": "5.3.0", - "query-string": "7.1.1", + "query-string": "7.1.3", "uint8arrays": "^3.1.0" - }, - "dependencies": { - "@walletconnect/types": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/@walletconnect/types/-/types-2.6.2.tgz", - "integrity": "sha512-eP9xfNVdoQrIfqJSlHqijf0l/Rw/XTO2SeFVlgA5UFHpMhhAo/kzuL+xC2iOkoGKEus4fM3lCuIw+aCZCwZA3g==", - "dev": true, - "requires": { - "@walletconnect/events": "^1.0.1", - "@walletconnect/heartbeat": "1.2.0", - "@walletconnect/jsonrpc-types": "^1.0.2", - "@walletconnect/keyvaluestorage": "^1.0.2", - "@walletconnect/logger": "^2.0.1", - "events": "^3.3.0" - } - } } }, "@walletconnect/window-getters": { @@ -6982,9 +6468,9 @@ } }, "acorn": { - "version": "8.8.2", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", - "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", + "version": "8.10.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", + "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==", "dev": true }, "acorn-jsx": { @@ -6994,18 +6480,6 @@ "dev": true, "requires": {} }, - "acorn-walk": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", - "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", - "dev": true - }, - "aes-js": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.1.2.tgz", - "integrity": "sha512-e5pEa2kBnBOgR4Y/p20pskXI74UEz7de8ZGVo58asOtvSVG5YAbJeELPZxOmt+Bnz3rX753YKhfIn4X4l1PPRQ==", - "dev": true - }, "ajv": { "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", @@ -7018,12 +6492,6 @@ "uri-js": "^4.2.2" } }, - "ansi-colors": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", - "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", - "dev": true - }, "ansi-regex": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", @@ -7039,22 +6507,6 @@ "color-convert": "^2.0.1" } }, - "anymatch": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", - "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", - "dev": true, - "requires": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - } - }, - "arg": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", - "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", - "dev": true - }, "argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", @@ -7099,18 +6551,6 @@ "util": "^0.12.0" } }, - "assertion-error": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", - "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", - "dev": true - }, - "asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", - "dev": true - }, "atomic-sleep": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/atomic-sleep/-/atomic-sleep-1.0.0.tgz", @@ -7156,18 +6596,18 @@ "integrity": "sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ==", "dev": true }, + "big-integer": { + "version": "1.6.51", + "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.51.tgz", + "integrity": "sha512-GPEid2Y9QU1Exl1rpO9B2IPJGHPSupF5GnVIP0blYvNOMer2bTvSWs1jGOUg04hTmu67nmLsQ9TBo1puaotBHg==", + "dev": true + }, "bignumber.js": { "version": "9.0.1", "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.1.tgz", "integrity": "sha512-IdZR9mh6ahOBv/hYGiXyVuyCetmGJhtYkqLBpTStdhEGjegpPlUawydyaF3pbIOFynJTpllEs+NP+CS9jKFLjA==", "dev": true }, - "binary-extensions": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", - "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", - "dev": true - }, "blake2b": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/blake2b/-/blake2b-2.1.3.tgz", @@ -7193,6 +6633,15 @@ "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==", "dev": true }, + "bplist-parser": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.2.0.tgz", + "integrity": "sha512-z0M+byMThzQmD9NILRniCUXYsYpjwnlO8N5uCFaCqIOpqRsJCrQL9NK3JsD67CN5a08nF5oIL2bD6loTdHOuKw==", + "dev": true, + "requires": { + "big-integer": "^1.6.44" + } + }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -7227,12 +6676,6 @@ "resolve": "^1.17.0" } }, - "browser-stdout": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", - "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", - "dev": true - }, "browserify-aes": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", @@ -7328,6 +6771,15 @@ "integrity": "sha512-HpGFw18DgFWlncDfjTa2rcQ4W88O1mC8e8yZ2AvQY5KDaktSTwo+KRf6nHK6FRI5FyRyb/5T6+TSxfP7QyGsmQ==", "dev": true }, + "bundle-name": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/bundle-name/-/bundle-name-3.0.0.tgz", + "integrity": "sha512-PKA4BeSvBpQKQ8iPOGCSiell+N8P+Tf1DlwqmYhpe2gAhKPHn8EYOxVT+ShuGmhg8lN8XiSlS80yiExKXrURlw==", + "dev": true, + "requires": { + "run-applescript": "^5.0.0" + } + }, "bytes": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", @@ -7351,26 +6803,11 @@ "dev": true }, "camelcase": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", - "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", "dev": true }, - "chai": { - "version": "4.3.7", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.7.tgz", - "integrity": "sha512-HLnAzZ2iupm25PlN0xFreAlBA5zaBSv3og0DdeGA4Ar6h6rJ3A0rolRUKJhSF2V10GZKDgWF/VmAEsNWjCRB+A==", - "dev": true, - "requires": { - "assertion-error": "^1.1.0", - "check-error": "^1.0.2", - "deep-eql": "^4.1.2", - "get-func-name": "^2.0.0", - "loupe": "^2.3.1", - "pathval": "^1.1.1", - "type-detect": "^4.0.5" - } - }, "chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -7381,39 +6818,6 @@ "supports-color": "^7.1.0" } }, - "check-error": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", - "integrity": "sha512-BrgHpW9NURQgzoNyjfq0Wu6VFO6D7IZEmJNdtgNqpzGG8RuNFHt2jQxWlAs4HMe119chBnv+34syEZtc6IhLtA==", - "dev": true - }, - "chokidar": { - "version": "3.5.3", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", - "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", - "dev": true, - "requires": { - "anymatch": "~3.1.2", - "braces": "~3.0.2", - "fsevents": "~2.3.2", - "glob-parent": "~5.1.2", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.6.0" - }, - "dependencies": { - "glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "requires": { - "is-glob": "^4.0.1" - } - } - } - }, "cipher-base": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", @@ -7425,14 +6829,44 @@ } }, "cliui": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", - "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", + "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", "dev": true, "requires": { "string-width": "^4.2.0", "strip-ansi": "^6.0.0", - "wrap-ansi": "^7.0.0" + "wrap-ansi": "^6.2.0" + }, + "dependencies": { + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + }, + "wrap-ansi": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + } } }, "color-convert": { @@ -7450,15 +6884,6 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, - "combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "dev": true, - "requires": { - "delayed-stream": "~1.0.0" - } - }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -7574,9 +6999,9 @@ } }, "decamelize": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", - "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==", "dev": true }, "decode-uri-component": { @@ -7585,21 +7010,40 @@ "integrity": "sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ==", "dev": true }, - "deep-eql": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.3.tgz", - "integrity": "sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==", - "dev": true, - "requires": { - "type-detect": "^4.0.0" - } - }, "deep-is": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", "dev": true }, + "default-browser": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/default-browser/-/default-browser-4.0.0.tgz", + "integrity": "sha512-wX5pXO1+BrhMkSbROFsyxUm0i/cJEScyNhA4PPxc41ICuv05ZZB/MX28s8aZx6xjmatvebIapF6hLEKEcpneUA==", + "dev": true, + "requires": { + "bundle-name": "^3.0.0", + "default-browser-id": "^3.0.0", + "execa": "^7.1.1", + "titleize": "^3.0.0" + } + }, + "default-browser-id": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/default-browser-id/-/default-browser-id-3.0.0.tgz", + "integrity": "sha512-OZ1y3y0SqSICtE8DE4S8YOE9UZOJ8wO16fKWVP5J1Qz42kV9jcnMVFrEE/noXb/ss3Q4pZIH79kxofzyNNtUNA==", + "dev": true, + "requires": { + "bplist-parser": "^0.2.0", + "untildify": "^4.0.0" + } + }, + "define-lazy-prop": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-3.0.0.tgz", + "integrity": "sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==", + "dev": true + }, "define-properties": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.0.tgz", @@ -7610,16 +7054,10 @@ "object-keys": "^1.1.1" } }, - "delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", - "dev": true - }, "des.js": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.1.tgz", - "integrity": "sha512-Q0I4pfFrv2VPd34/vfLrFOoRmlYj3OV50i7fskps1jZWK1kApMWWT9G6RRUeYedLcBDIhnSDaUvJMb3AhUlaEA==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.1.0.tgz", + "integrity": "sha512-r17GxjhUCjSRy8aiJpr8/UadFIzMzJGexI3Nmz4ADi9LYSFx4gTBp80+NaX/YsXWWLhpZ7v/v/ubEc/bCNfKwg==", "dev": true, "requires": { "inherits": "^2.0.1", @@ -7632,12 +7070,6 @@ "integrity": "sha512-53rsFbGdwMwlF7qvCt0ypLM5V5/Mbl0szB7GPN8y9NCcbknYOeVVXdrXEq+90IwAfrrzt6Hd+u2E2ntakICU8w==", "dev": true }, - "diff": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", - "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", - "dev": true - }, "diffie-hellman": { "version": "5.0.3", "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", @@ -7658,9 +7090,9 @@ } }, "dijkstrajs": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/dijkstrajs/-/dijkstrajs-1.0.2.tgz", - "integrity": "sha512-QV6PMaHTCNmKSeP6QoXhVTw9snc9VD8MulTT0Bd99Pacp4SS1cjcrYPgBPmibqKVtMJJfqC6XvOXgPMEEPH/fg==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/dijkstrajs/-/dijkstrajs-1.0.3.tgz", + "integrity": "sha512-qiSlmBq9+BCdCA/L46dw8Uy93mloxsPSbwnm5yrKn2vMPiy8KyAskTF6zuV/j5BMsmOGZDPs7KjU+mjb670kfA==", "dev": true }, "dir-glob": { @@ -7699,6 +7131,12 @@ "stream-shift": "^1.0.0" } }, + "eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "dev": true + }, "elliptic": { "version": "6.5.4", "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", @@ -7723,9 +7161,9 @@ } }, "emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", "dev": true }, "encode-utf8": { @@ -7750,40 +7188,34 @@ "dev": true }, "esbuild": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.17.19.tgz", - "integrity": "sha512-XQ0jAPFkK/u3LcVRcvVHQcTIqD6E2H1fvZMA5dQPSOWb3suUbWbfbRf94pjc0bNzRYLfIrDRQXr7X+LHIm5oHw==", - "dev": true, - "requires": { - "@esbuild/android-arm": "0.17.19", - "@esbuild/android-arm64": "0.17.19", - "@esbuild/android-x64": "0.17.19", - "@esbuild/darwin-arm64": "0.17.19", - "@esbuild/darwin-x64": "0.17.19", - "@esbuild/freebsd-arm64": "0.17.19", - "@esbuild/freebsd-x64": "0.17.19", - "@esbuild/linux-arm": "0.17.19", - "@esbuild/linux-arm64": "0.17.19", - "@esbuild/linux-ia32": "0.17.19", - "@esbuild/linux-loong64": "0.17.19", - "@esbuild/linux-mips64el": "0.17.19", - "@esbuild/linux-ppc64": "0.17.19", - "@esbuild/linux-riscv64": "0.17.19", - "@esbuild/linux-s390x": "0.17.19", - "@esbuild/linux-x64": "0.17.19", - "@esbuild/netbsd-x64": "0.17.19", - "@esbuild/openbsd-x64": "0.17.19", - "@esbuild/sunos-x64": "0.17.19", - "@esbuild/win32-arm64": "0.17.19", - "@esbuild/win32-ia32": "0.17.19", - "@esbuild/win32-x64": "0.17.19" - } - }, - "escalade": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", - "dev": true + "version": "0.18.13", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.18.13.tgz", + "integrity": "sha512-vhg/WR/Oiu4oUIkVhmfcc23G6/zWuEQKFS+yiosSHe4aN6+DQRXIfeloYGibIfVhkr4wyfuVsGNLr+sQU1rWWw==", + "dev": true, + "requires": { + "@esbuild/android-arm": "0.18.13", + "@esbuild/android-arm64": "0.18.13", + "@esbuild/android-x64": "0.18.13", + "@esbuild/darwin-arm64": "0.18.13", + "@esbuild/darwin-x64": "0.18.13", + "@esbuild/freebsd-arm64": "0.18.13", + "@esbuild/freebsd-x64": "0.18.13", + "@esbuild/linux-arm": "0.18.13", + "@esbuild/linux-arm64": "0.18.13", + "@esbuild/linux-ia32": "0.18.13", + "@esbuild/linux-loong64": "0.18.13", + "@esbuild/linux-mips64el": "0.18.13", + "@esbuild/linux-ppc64": "0.18.13", + "@esbuild/linux-riscv64": "0.18.13", + "@esbuild/linux-s390x": "0.18.13", + "@esbuild/linux-x64": "0.18.13", + "@esbuild/netbsd-x64": "0.18.13", + "@esbuild/openbsd-x64": "0.18.13", + "@esbuild/sunos-x64": "0.18.13", + "@esbuild/win32-arm64": "0.18.13", + "@esbuild/win32-ia32": "0.18.13", + "@esbuild/win32-x64": "0.18.13" + } }, "escape-string-regexp": { "version": "4.0.0", @@ -7792,16 +7224,16 @@ "dev": true }, "eslint": { - "version": "8.40.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.40.0.tgz", - "integrity": "sha512-bvR+TsP9EHL3TqNtj9sCNJVAFK3fBN8Q7g5waghxyRsPLIMwL73XSKnZFK0hk/O2ANC+iAoq6PWMQ+IfBAJIiQ==", + "version": "8.45.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.45.0.tgz", + "integrity": "sha512-pd8KSxiQpdYRfYa9Wufvdoct3ZPQQuVuU5O6scNgMuOMYuxvH0IGaYK0wUFjo4UYYQQCUndlXiMbnxopwvvTiw==", "dev": true, "requires": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.4.0", - "@eslint/eslintrc": "^2.0.3", - "@eslint/js": "8.40.0", - "@humanwhocodes/config-array": "^0.11.8", + "@eslint/eslintrc": "^2.1.0", + "@eslint/js": "8.44.0", + "@humanwhocodes/config-array": "^0.11.10", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", "ajv": "^6.10.0", @@ -7812,7 +7244,7 @@ "escape-string-regexp": "^4.0.0", "eslint-scope": "^7.2.0", "eslint-visitor-keys": "^3.4.1", - "espree": "^9.5.2", + "espree": "^9.6.0", "esquery": "^1.4.2", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", @@ -7820,22 +7252,19 @@ "find-up": "^5.0.0", "glob-parent": "^6.0.2", "globals": "^13.19.0", - "grapheme-splitter": "^1.0.4", + "graphemer": "^1.4.0", "ignore": "^5.2.0", - "import-fresh": "^3.0.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", "is-path-inside": "^3.0.3", - "js-sdsl": "^4.1.4", "js-yaml": "^4.1.0", "json-stable-stringify-without-jsonify": "^1.0.1", "levn": "^0.4.1", "lodash.merge": "^4.6.2", "minimatch": "^3.1.2", "natural-compare": "^1.4.0", - "optionator": "^0.9.1", + "optionator": "^0.9.3", "strip-ansi": "^6.0.1", - "strip-json-comments": "^3.1.0", "text-table": "^0.2.0" }, "dependencies": { @@ -7865,12 +7294,13 @@ "requires": {} }, "eslint-plugin-prettier": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-4.2.1.tgz", - "integrity": "sha512-f/0rXLXUt0oFYs8ra4w49wYZBG5GKZpAYsJSm6rnYL5uVDjd+zowwMwVZHnAjf4edNrKpCDYfXDgmRE/Ak7QyQ==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.0.0.tgz", + "integrity": "sha512-AgaZCVuYDXHUGxj/ZGu1u8H8CYgDY3iG6w5kUFw4AzMVXzB7VvbKgYR4nATIN+OvUrghMbiDLeimVjVY5ilq3w==", "dev": true, "requires": { - "prettier-linter-helpers": "^1.0.0" + "prettier-linter-helpers": "^1.0.0", + "synckit": "^0.8.5" } }, "eslint-scope": { @@ -7890,12 +7320,12 @@ "dev": true }, "espree": { - "version": "9.5.2", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.5.2.tgz", - "integrity": "sha512-7OASN1Wma5fum5SrNhFMAMJxOUAbhyfQ8dQ//PJaJbNw0URTPWqIghHWt1MmAANKhHZIYOHruW4Kw4ruUWOdGw==", + "version": "9.6.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.0.tgz", + "integrity": "sha512-1FH/IiruXZ84tpUlm0aCUEwMl2Ho5ilqVh0VvQXw+byAz/4SAciyHLlfmL5WYqsvD38oymdUwBss0LtK8m4s/A==", "dev": true, "requires": { - "acorn": "^8.8.0", + "acorn": "^8.9.0", "acorn-jsx": "^5.3.2", "eslint-visitor-keys": "^3.4.1" } @@ -7962,6 +7392,31 @@ "safe-buffer": "^5.1.1" } }, + "execa": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-7.1.1.tgz", + "integrity": "sha512-wH0eMf/UXckdUYnO21+HDztteVv05rq2GXksxT4fCGeHkBhw1DROXh40wcjMcRqDOWE7iPJ4n3M7e2+YFP+76Q==", + "dev": true, + "requires": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.1", + "human-signals": "^4.3.0", + "is-stream": "^3.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^5.1.0", + "onetime": "^6.0.0", + "signal-exit": "^3.0.7", + "strip-final-newline": "^3.0.0" + }, + "dependencies": { + "signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true + } + } + }, "fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -7969,15 +7424,15 @@ "dev": true }, "fast-diff": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.2.0.tgz", - "integrity": "sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.3.0.tgz", + "integrity": "sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==", "dev": true }, "fast-glob": { - "version": "3.2.12", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz", - "integrity": "sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.0.tgz", + "integrity": "sha512-ChDuvbOypPuNjO8yIDf36x7BlZX1smcUMTTcyoIjycexOxd6DFsKsg21qVBzEmr3G7fUKIRy2/psii+CIUt7FA==", "dev": true, "requires": { "@nodelib/fs.stat": "^2.0.2", @@ -8011,9 +7466,9 @@ "dev": true }, "fast-redact": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/fast-redact/-/fast-redact-3.1.2.tgz", - "integrity": "sha512-+0em+Iya9fKGfEQGcd62Yv6onjBmmhV1uh86XVfOU8VwAe6kaFdQCWI9s0/Nnugx5Vd9tdbZ7e6gE2tR9dzXdw==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/fast-redact/-/fast-redact-3.2.0.tgz", + "integrity": "sha512-zaTadChr+NekyzallAMXATXLOR8MNx3zqpZ0MUF2aGf4EathnG0f32VLODNlY8IuGY3HoRO2L6/6fSzNsLaHIw==", "dev": true }, "fast-url-parser": { @@ -8066,13 +7521,7 @@ "requires": { "locate-path": "^6.0.0", "path-exists": "^4.0.0" - } - }, - "flat": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", - "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", - "dev": true + } }, "flat-cache": { "version": "3.0.4", @@ -8084,6 +7533,20 @@ "rimraf": "^3.0.2" }, "dependencies": { + "glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, "rimraf": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", @@ -8116,15 +7579,14 @@ "is-callable": "^1.1.3" } }, - "form-data": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", - "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "foreground-child": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.1.1.tgz", + "integrity": "sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==", "dev": true, "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" + "cross-spawn": "^7.0.0", + "signal-exit": "^4.0.1" } }, "fs.realpath": { @@ -8133,13 +7595,6 @@ "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", "dev": true }, - "fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "dev": true, - "optional": true - }, "function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", @@ -8152,35 +7607,55 @@ "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", "dev": true }, - "get-func-name": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", - "integrity": "sha512-Hm0ixYtaSZ/V7C8FJrtZIuBBI+iSgL+1Aq82zSu8VQNB4S3Gk8e7Qs3VwBDJAhmRZcFqkl3tQu36g/Foh5I5ig==", - "dev": true - }, "get-intrinsic": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.0.tgz", - "integrity": "sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz", + "integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==", "dev": true, "requires": { "function-bind": "^1.1.1", "has": "^1.0.3", + "has-proto": "^1.0.1", "has-symbols": "^1.0.3" } }, + "get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true + }, "glob": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", - "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", + "version": "10.3.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.3.tgz", + "integrity": "sha512-92vPiMb/iqpmEgsOoIDvTjc50wf9CCCvMzsi6W0JLPeUKE8TWP1a73PgqSrqy7iAZxaSD1YdzU7QZR5LF51MJw==", "dev": true, "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" + "foreground-child": "^3.1.0", + "jackspeak": "^2.0.3", + "minimatch": "^9.0.1", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0", + "path-scurry": "^1.10.1" + }, + "dependencies": { + "brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0" + } + }, + "minimatch": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "dev": true, + "requires": { + "brace-expansion": "^2.0.1" + } + } } }, "glob-parent": { @@ -8230,6 +7705,12 @@ "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==", "dev": true }, + "graphemer": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", + "dev": true + }, "has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", @@ -8254,6 +7735,12 @@ "get-intrinsic": "^1.1.1" } }, + "has-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", + "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==", + "dev": true + }, "has-symbols": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", @@ -8290,12 +7777,6 @@ "minimalistic-assert": "^1.0.1" } }, - "he": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", - "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", - "dev": true - }, "hmac-drbg": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", @@ -8313,6 +7794,12 @@ "integrity": "sha512-J+FkSdyD+0mA0N+81tMotaRMfSL9SGi+xpD3T6YApKsc3bGSXJlfXri3VyFOeYkfLRQisDk1W+jIFFKBeUBbBg==", "dev": true }, + "human-signals": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-4.3.1.tgz", + "integrity": "sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ==", + "dev": true + }, "ieee754": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", @@ -8367,15 +7854,6 @@ "has-tostringtag": "^1.0.0" } }, - "is-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "dev": true, - "requires": { - "binary-extensions": "^2.0.0" - } - }, "is-callable": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", @@ -8383,14 +7861,20 @@ "dev": true }, "is-core-module": { - "version": "2.11.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz", - "integrity": "sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==", + "version": "2.12.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.12.1.tgz", + "integrity": "sha512-Q4ZuBAe2FUsKtyQJoQHlvP8OvBERxO3jEmy1I7hcRXcJBGGHFh/aJBswbXuS9sgrDH2QUO8ilkwNPHvHMd8clg==", "dev": true, "requires": { "has": "^1.0.3" } }, + "is-docker": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz", + "integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==", + "dev": true + }, "is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", @@ -8421,6 +7905,15 @@ "is-extglob": "^2.1.1" } }, + "is-inside-container": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-inside-container/-/is-inside-container-1.0.0.tgz", + "integrity": "sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==", + "dev": true, + "requires": { + "is-docker": "^3.0.0" + } + }, "is-nan": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/is-nan/-/is-nan-1.3.2.tgz", @@ -8443,10 +7936,10 @@ "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", "dev": true }, - "is-plain-obj": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", - "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", + "is-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", + "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", "dev": true }, "is-typed-array": { @@ -8462,17 +7955,22 @@ "has-tostringtag": "^1.0.0" } }, - "is-typedarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==", - "dev": true - }, - "is-unicode-supported": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", - "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", - "dev": true + "is-wsl": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", + "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", + "dev": true, + "requires": { + "is-docker": "^2.0.0" + }, + "dependencies": { + "is-docker": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz", + "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==", + "dev": true + } + } }, "isexe": { "version": "2.0.0", @@ -8486,17 +7984,15 @@ "integrity": "sha512-u4sej9B1LPSxTGKB/HiuzvEQnXH0ECYkSVQU39koSwmFAxhlEAFl9RdTvLv4TOTQUgBS5O3O5fwUxk6byBZ+IQ==", "dev": true }, - "js-sdsl": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.4.0.tgz", - "integrity": "sha512-FfVSdx6pJ41Oa+CF7RDaFmTnCaFhua+SNYQX74riGOpl96x+2jQCqEfQ2bnXu/5DPCqlRuiqyvTJM0Qjz26IVg==", - "dev": true - }, - "js-sha3": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", - "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==", - "dev": true + "jackspeak": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-2.2.1.tgz", + "integrity": "sha512-MXbxovZ/Pm42f6cDIDkl3xpwv1AGwObKwfmjs2nQePiy85tP3fatofl3FC1aBsOtP/6fq5SbtgHwWcMsLP+bDw==", + "dev": true, + "requires": { + "@isaacs/cliui": "^8.0.2", + "@pkgjs/parseargs": "^0.11.0" + } }, "js-yaml": { "version": "4.1.0", @@ -8585,44 +8081,16 @@ "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", "dev": true }, - "log-symbols": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", - "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", - "dev": true, - "requires": { - "chalk": "^4.1.0", - "is-unicode-supported": "^0.1.0" - } - }, "long": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", - "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==", + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/long/-/long-5.2.3.tgz", + "integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==", "dev": true }, - "loupe": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.6.tgz", - "integrity": "sha512-RaPMZKiMy8/JruncMU5Bt6na1eftNoo++R4Y+N2FrxkDVTrGvcyzFTsaGif4QTeKESheMGegbhw6iUAq+5A8zA==", - "dev": true, - "requires": { - "get-func-name": "^2.0.0" - } - }, "lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, - "requires": { - "yallist": "^4.0.0" - } - }, - "make-error": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", - "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.0.0.tgz", + "integrity": "sha512-svTf/fzsKHffP42sujkO/Rjs37BCIsQVRCeNYIm9WN8rgT7ffoUnRtZCqU+6BqcSBdv8gwJeTz8knJpgACeQMw==", "dev": true }, "md5.js": { @@ -8636,6 +8104,12 @@ "safe-buffer": "^5.1.2" } }, + "merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true + }, "merge2": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", @@ -8685,6 +8159,12 @@ "mime-db": "~1.33.0" } }, + "mimic-fn": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", + "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", + "dev": true + }, "minimalistic-assert": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", @@ -8707,74 +8187,10 @@ } }, "minipass": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", - "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", - "dev": true - }, - "mocha": { - "version": "10.2.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.2.0.tgz", - "integrity": "sha512-IDY7fl/BecMwFHzoqF2sg/SHHANeBoMMXFlS9r0OXKDssYE1M5O43wUY/9BVPeIvfH2zmEbBfseqN9gBQZzXkg==", - "dev": true, - "requires": { - "ansi-colors": "4.1.1", - "browser-stdout": "1.3.1", - "chokidar": "3.5.3", - "debug": "4.3.4", - "diff": "5.0.0", - "escape-string-regexp": "4.0.0", - "find-up": "5.0.0", - "glob": "7.2.0", - "he": "1.2.0", - "js-yaml": "4.1.0", - "log-symbols": "4.1.0", - "minimatch": "5.0.1", - "ms": "2.1.3", - "nanoid": "3.3.3", - "serialize-javascript": "6.0.0", - "strip-json-comments": "3.1.1", - "supports-color": "8.1.1", - "workerpool": "6.2.1", - "yargs": "16.2.0", - "yargs-parser": "20.2.4", - "yargs-unparser": "2.0.0" - }, - "dependencies": { - "brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "requires": { - "balanced-match": "^1.0.0" - } - }, - "minimatch": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz", - "integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==", - "dev": true, - "requires": { - "brace-expansion": "^2.0.1" - } - }, - "ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true - }, - "supports-color": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", - "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.1.tgz", + "integrity": "sha512-NQ8MCKimInjVlaIqx51RKJJB7mINVkLTJbsZKmto4UAAOC/CWXES8PGaOgoBZyqoUsUA/U3DToGK7GJkkHbjJw==", + "dev": true }, "ms": { "version": "2.1.2", @@ -8794,12 +8210,6 @@ "integrity": "sha512-C40jQ3NzfkP53NsO8kEOFd79p4b9kDXQMwgiY1z8ZwrDZgUyom0AHwGegF4Dm99L+YoYhuaB0ceerUcXmqr1rQ==", "dev": true }, - "nanoid": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.3.tgz", - "integrity": "sha512-p1sjXuopFs0xg+fPASzQ28agW1oHD7xDsd9Xkf3T15H3c/cifrFHVwrh74PdoklAPi+i7MdRsE47vm2r6JoB+w==", - "dev": true - }, "natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", @@ -8871,11 +8281,22 @@ } } }, - "normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "dev": true + "npm-run-path": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.1.0.tgz", + "integrity": "sha512-sJOdmRGrY2sjNTRMbSvluQqg+8X7ZK61yvzBEIDhz4f8z1TZFYABsqjjCBd/0PUNE9M6QDgHJXQkGUEm7Q+l9Q==", + "dev": true, + "requires": { + "path-key": "^4.0.0" + }, + "dependencies": { + "path-key": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", + "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", + "dev": true + } + } }, "object-inspect": { "version": "1.12.3", @@ -8914,18 +8335,39 @@ "wrappy": "1" } }, + "onetime": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", + "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", + "dev": true, + "requires": { + "mimic-fn": "^4.0.0" + } + }, + "open": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/open/-/open-9.1.0.tgz", + "integrity": "sha512-OS+QTnw1/4vrf+9hh1jc1jnYjzSG4ttTBB8UxOwAnInG3Uo4ssetzC1ihqaIHjLJnA5GGlRl6QlZXOTQhRBUvg==", + "dev": true, + "requires": { + "default-browser": "^4.0.0", + "define-lazy-prop": "^3.0.0", + "is-inside-container": "^1.0.0", + "is-wsl": "^2.2.0" + } + }, "optionator": { - "version": "0.9.1", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", - "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", + "version": "0.9.3", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.3.tgz", + "integrity": "sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg==", "dev": true, "requires": { + "@aashutoshrathi/word-wrap": "^1.2.3", "deep-is": "^0.1.3", "fast-levenshtein": "^2.0.6", "levn": "^0.4.1", "prelude-ls": "^1.2.1", - "type-check": "^0.4.0", - "word-wrap": "^1.2.3" + "type-check": "^0.4.0" } }, "os-browserify": { @@ -9023,21 +8465,13 @@ "dev": true }, "path-scurry": { - "version": "1.6.4", - "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.6.4.tgz", - "integrity": "sha512-Qp/9IHkdNiXJ3/Kon++At2nVpnhRiPq/aSvQN+H3U1WZbvNRK0RIQK/o4HMqPoXjpuGJUEWpHSs6Mnjxqh3TQg==", + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.10.1.tgz", + "integrity": "sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ==", "dev": true, "requires": { - "lru-cache": "^9.0.0", - "minipass": "^5.0.0" - }, - "dependencies": { - "lru-cache": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-9.0.0.tgz", - "integrity": "sha512-9AEKXzvOZc4BMacFnYiTOlDH/197LNnQIK9wZ6iMB5NXPzuv4bWR/Msv7iUMplkiMQ1qQL+KSv/JF1mZAB5Lrg==", - "dev": true - } + "lru-cache": "^9.1.1 || ^10.0.0", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" } }, "path-to-regexp": { @@ -9052,12 +8486,6 @@ "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", "dev": true }, - "pathval": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", - "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", - "dev": true - }, "pbkdf2": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.2.tgz", @@ -9071,6 +8499,12 @@ "sha.js": "^2.4.8" } }, + "picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "dev": true + }, "picomatch": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", @@ -9134,9 +8568,9 @@ "dev": true }, "prettier": { - "version": "2.8.8", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", - "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.0.tgz", + "integrity": "sha512-zBf5eHpwHOGPC47h0zrPyNn+eAEIdEzfywMoYn2XPi0P44Zp0tSq64rq0xAREh4auw2cJZHo9QUob+NqCQky4g==", "dev": true }, "prettier-linter-helpers": { @@ -9161,9 +8595,9 @@ "dev": true }, "protobufjs": { - "version": "6.11.3", - "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.11.3.tgz", - "integrity": "sha512-xL96WDdCZYdU7Slin569tFX712BxsxslWwAfAhCYjQKGTq7dAU91Lomy6nLLhh/dyGhk/YH4TwTSRxTzhuHyZg==", + "version": "7.2.4", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.2.4.tgz", + "integrity": "sha512-AT+RJgD2sH8phPmCf7OUZR8xGdcJRga4+1cOaXJ64hvcSkVhNcRHOwIxUatPH15+nj59WAGTDv3LSGZPEQbJaQ==", "dev": true, "requires": { "@protobufjs/aspromise": "^1.1.2", @@ -9176,9 +8610,8 @@ "@protobufjs/path": "^1.1.2", "@protobufjs/pool": "^1.1.0", "@protobufjs/utf8": "^1.1.0", - "@types/long": "^4.0.1", "@types/node": ">=13.7.0", - "long": "^4.0.0" + "long": "^5.0.0" } }, "public-encrypt": { @@ -9207,126 +8640,18 @@ "version": "1.4.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", "integrity": "sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ==", - "dev": true - }, - "qrcode": { - "version": "1.5.3", - "resolved": "https://registry.npmjs.org/qrcode/-/qrcode-1.5.3.tgz", - "integrity": "sha512-puyri6ApkEHYiVl4CFzo1tDkAZ+ATcnbJrJ6RiBM1Fhctdn/ix9MTE3hRph33omisEbC/2fcfemsseiKgBPKZg==", - "dev": true, - "requires": { - "dijkstrajs": "^1.0.1", - "encode-utf8": "^1.0.3", - "pngjs": "^5.0.0", - "yargs": "^15.3.1" - }, - "dependencies": { - "camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "dev": true - }, - "cliui": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", - "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", - "dev": true, - "requires": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^6.2.0" - } - }, - "decamelize": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==", - "dev": true - }, - "find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "dev": true, - "requires": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - } - }, - "locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dev": true, - "requires": { - "p-locate": "^4.1.0" - } - }, - "p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "dev": true, - "requires": { - "p-try": "^2.0.0" - } - }, - "p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "dev": true, - "requires": { - "p-limit": "^2.2.0" - } - }, - "wrap-ansi": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", - "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", - "dev": true, - "requires": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - } - }, - "y18n": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz", - "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==", - "dev": true - }, - "yargs": { - "version": "15.4.1", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz", - "integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==", - "dev": true, - "requires": { - "cliui": "^6.0.0", - "decamelize": "^1.2.0", - "find-up": "^4.1.0", - "get-caller-file": "^2.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^4.2.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^18.1.2" - } - }, - "yargs-parser": { - "version": "18.1.3", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", - "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", - "dev": true, - "requires": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - } - } + "dev": true + }, + "qrcode": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/qrcode/-/qrcode-1.5.3.tgz", + "integrity": "sha512-puyri6ApkEHYiVl4CFzo1tDkAZ+ATcnbJrJ6RiBM1Fhctdn/ix9MTE3hRph33omisEbC/2fcfemsseiKgBPKZg==", + "dev": true, + "requires": { + "dijkstrajs": "^1.0.1", + "encode-utf8": "^1.0.3", + "pngjs": "^5.0.0", + "yargs": "^15.3.1" } }, "qs": { @@ -9339,23 +8664,17 @@ } }, "query-string": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/query-string/-/query-string-7.1.1.tgz", - "integrity": "sha512-MplouLRDHBZSG9z7fpuAAcI7aAYjDLhtsiVZsevsfaHWDS2IDdORKbSd1kWUA+V4zyva/HZoSfpwnYMMQDhb0w==", + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/query-string/-/query-string-7.1.3.tgz", + "integrity": "sha512-hh2WYhq4fi8+b+/2Kg9CEge4fDPvHS534aOOvOZeQ3+Vf2mCFsaFBYj0i+iXcAq6I9Vzp5fjMFBlONvayDC1qg==", "dev": true, "requires": { - "decode-uri-component": "^0.2.0", + "decode-uri-component": "^0.2.2", "filter-obj": "^1.1.0", "split-on-first": "^1.0.0", "strict-uri-encode": "^2.0.0" } }, - "querystring": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", - "integrity": "sha512-X/xY82scca2tau62i9mDyU9K+I+djTMUsvwf7xnUX5GLvVzgJybOJf4Y6o9Zx3oJK/LSXg5tTZBjwzqVPaPO2g==", - "dev": true - }, "querystring-es3": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/querystring-es3/-/querystring-es3-0.2.1.tgz", @@ -9410,15 +8729,6 @@ "util-deprecate": "^1.0.1" } }, - "readdirp": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", - "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", - "dev": true, - "requires": { - "picomatch": "^2.2.1" - } - }, "real-require": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/real-require/-/real-require-0.1.0.tgz", @@ -9461,56 +8771,100 @@ "dev": true }, "rimraf": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.1.tgz", + "integrity": "sha512-OfFZdwtd3lZ+XZzYP/6gTACubwFcHdLRqS9UX3UwpU2dnGQYkPFISRwvM3w9IiB2w7bW5qGo/uAwE4SmXXSKvg==", + "dev": true, + "requires": { + "glob": "^10.2.5" + } + }, + "ripemd160": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", + "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", + "dev": true, + "requires": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1" + } + }, + "run-applescript": { "version": "5.0.0", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.0.tgz", - "integrity": "sha512-Jf9llaP+RvaEVS5nPShYFhtXIrb3LRKP281ib3So0KkeZKo2wIKyq0Re7TOSwanasA423PSr6CCIL4bP6T040g==", + "resolved": "https://registry.npmjs.org/run-applescript/-/run-applescript-5.0.0.tgz", + "integrity": "sha512-XcT5rBksx1QdIhlFOCtgZkB99ZEouFZ1E2Kc2LHqNW13U3/74YGdkQRmThTwxy4QIyookibDKYZOPqX//6BlAg==", "dev": true, "requires": { - "glob": "^10.0.0" + "execa": "^5.0.0" }, "dependencies": { - "brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "execa": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", + "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", "dev": true, "requires": { - "balanced-match": "^1.0.0" + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.0", + "human-signals": "^2.1.0", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.1", + "onetime": "^5.1.2", + "signal-exit": "^3.0.3", + "strip-final-newline": "^2.0.0" } }, - "glob": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.0.0.tgz", - "integrity": "sha512-zmp9ZDC6NpDNLujV2W2n+3lH+BafIVZ4/ct+Yj3BMZTH/+bgm/eVjHzeFLwxJrrIGgjjS2eiQLlpurHsNlEAtQ==", + "human-signals": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", + "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", + "dev": true + }, + "is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "dev": true + }, + "mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true + }, + "npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", "dev": true, "requires": { - "fs.realpath": "^1.0.0", - "minimatch": "^9.0.0", - "minipass": "^5.0.0", - "path-scurry": "^1.6.4" + "path-key": "^3.0.0" } }, - "minimatch": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.0.tgz", - "integrity": "sha512-0jJj8AvgKqWN05mrwuqi8QYKx1WmYSUoKSxu5Qhs9prezTz10sxAHGNZe9J9cqIJzta8DWsleh2KaVaLl6Ru2w==", + "onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", "dev": true, "requires": { - "brace-expansion": "^2.0.1" + "mimic-fn": "^2.1.0" } + }, + "signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true + }, + "strip-final-newline": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", + "dev": true } } }, - "ripemd160": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", - "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", - "dev": true, - "requires": { - "hash-base": "^3.0.0", - "inherits": "^2.0.1" - } - }, "run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", @@ -9545,21 +8899,23 @@ "dev": true }, "semver": { - "version": "7.3.8", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", - "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, "requires": { "lru-cache": "^6.0.0" - } - }, - "serialize-javascript": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", - "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", - "dev": true, - "requires": { - "randombytes": "^2.1.0" + }, + "dependencies": { + "lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + } } }, "serve-handler": { @@ -9626,6 +8982,12 @@ "object-inspect": "^1.9.0" } }, + "signal-exit": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.0.2.tgz", + "integrity": "sha512-MY2/qGx4enyjprQnFaZsHib3Yadh3IXyV2C321GY0pjGfVBu4un0uDJkwgdxqO+Rdx8JMT8IfJIRwbYVz3Ob3Q==", + "dev": true + }, "slash": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", @@ -9697,7 +9059,35 @@ } }, "string-width": { - "version": "4.2.3", + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, + "requires": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "dependencies": { + "ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "dev": true + }, + "strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "requires": { + "ansi-regex": "^6.0.1" + } + } + } + }, + "string-width-cjs": { + "version": "npm:string-width@4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", "dev": true, @@ -9705,6 +9095,14 @@ "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" + }, + "dependencies": { + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + } } }, "strip-ansi": { @@ -9716,6 +9114,21 @@ "ansi-regex": "^5.0.1" } }, + "strip-ansi-cjs": { + "version": "npm:strip-ansi@6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.1" + } + }, + "strip-final-newline": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", + "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", + "dev": true + }, "strip-json-comments": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", @@ -9737,6 +9150,24 @@ "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", "dev": true }, + "synckit": { + "version": "0.8.5", + "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.8.5.tgz", + "integrity": "sha512-L1dapNV6vu2s/4Sputv8xGsCdAVlb5nRDMFU/E27D44l5U6cw1g0dGd45uLc+OXjNMmF4ntiMdCimzcjFKQI8Q==", + "dev": true, + "requires": { + "@pkgr/utils": "^2.3.1", + "tslib": "^2.5.0" + }, + "dependencies": { + "tslib": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.0.tgz", + "integrity": "sha512-7At1WUettjcSRHXCyYtTselblcHl9PJFFVKiCAy/bY97+BPZXSQ2wbq0P9s8tK2G7dFQfNnlJnPAiArVBVBsfA==", + "dev": true + } + } + }, "text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", @@ -9761,6 +9192,12 @@ "setimmediate": "^1.0.4" } }, + "titleize": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/titleize/-/titleize-3.0.0.tgz", + "integrity": "sha512-KxVu8EYHDPBdUYdKZdKtU2aj2XfEx9AfjXxE/Aj0vT06w2icA09Vus1rh6eSu1y01akYg6BjIK/hxyLJINoMLQ==", + "dev": true + }, "to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -9770,34 +9207,12 @@ "is-number": "^7.0.0" } }, - "ts-node": { - "version": "10.9.1", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", - "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", + "ts-api-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.0.1.tgz", + "integrity": "sha512-lC/RGlPmwdrIBFTX59wwNzqh7aR2otPNPR/5brHZm/XKFYKsfqxihXUe9pU3JI+3vGkl+vyCoNNnPhJn3aLK1A==", "dev": true, - "requires": { - "@cspotcode/source-map-support": "^0.8.0", - "@tsconfig/node10": "^1.0.7", - "@tsconfig/node12": "^1.0.7", - "@tsconfig/node14": "^1.0.0", - "@tsconfig/node16": "^1.0.2", - "acorn": "^8.4.1", - "acorn-walk": "^8.1.1", - "arg": "^4.1.0", - "create-require": "^1.1.0", - "diff": "^4.0.1", - "make-error": "^1.1.1", - "v8-compile-cache-lib": "^3.0.1", - "yn": "3.1.1" - }, - "dependencies": { - "diff": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", - "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", - "dev": true - } - } + "requires": {} }, "tslib": { "version": "1.14.1", @@ -9805,15 +9220,6 @@ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", "dev": true }, - "tsutils": { - "version": "3.21.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", - "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", - "dev": true, - "requires": { - "tslib": "^1.8.1" - } - }, "tty-browserify": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.1.tgz", @@ -9829,31 +9235,16 @@ "prelude-ls": "^1.2.1" } }, - "type-detect": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", - "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", - "dev": true - }, "type-fest": { "version": "0.20.2", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", "dev": true }, - "typedarray-to-buffer": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", - "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", - "dev": true, - "requires": { - "is-typedarray": "^1.0.0" - } - }, "typescript": { - "version": "5.0.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz", - "integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==", + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz", + "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==", "dev": true }, "uint8arrays": { @@ -9865,6 +9256,12 @@ "multiformats": "^9.4.2" } }, + "untildify": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/untildify/-/untildify-4.0.0.tgz", + "integrity": "sha512-KK8xQ1mkzZeg9inewmFVDNkg3l5LUhoq9kN6iWYB/CC9YMG8HA+c1Q8HwDe6dEX7kErrEVNVBO3fWsVq5iDgtw==", + "dev": true + }, "uri-js": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", @@ -9883,20 +9280,23 @@ } }, "url": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/url/-/url-0.11.0.tgz", - "integrity": "sha512-kbailJa29QrtXnxgq+DdCEGlbTeYM2eJUxsz6vjZavrCYPMIFHMKQmSKYAIuUK2i7hgPm28a8piX5NTUtM/LKQ==", + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/url/-/url-0.11.1.tgz", + "integrity": "sha512-rWS3H04/+mzzJkv0eZ7vEDGiQbgquI1fGfOad6zKvgYQi1SzMmhl7c/DdRGxhaWrVH6z0qWITo8rpnxK/RfEhA==", "dev": true, "requires": { - "punycode": "1.3.2", - "querystring": "0.2.0" + "punycode": "^1.4.1", + "qs": "^6.11.0" }, "dependencies": { - "punycode": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", - "integrity": "sha512-RofWgt/7fL5wP1Y7fxE7/EmTLzQVnB0ycyibJ0OOHIlJqTNzglYFxVwETOcIoJqJmpDXJ9xImDv+Fq34F/d4Dw==", - "dev": true + "qs": { + "version": "6.11.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.2.tgz", + "integrity": "sha512-tDNIz22aBzCDxLtVH++VnTfzxlfeK5CbqohpSqpJgj1Wg/cQbStNAz3NuqCs5vV+pjBsK4x4pN9HlVh7rcYRiA==", + "dev": true, + "requires": { + "side-channel": "^1.0.4" + } } } }, @@ -9919,12 +9319,6 @@ "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", "dev": true }, - "v8-compile-cache-lib": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", - "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", - "dev": true - }, "vm-browserify": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-1.1.2.tgz", @@ -9941,9 +9335,9 @@ } }, "which-module": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", - "integrity": "sha512-B+enWhmw6cjfVC7kS8Pj9pCrKSc5txArRyaYGe088shv/FGWH+0Rjx/xPgtsWfsUtS27FkP697E4DDhgrgoc0Q==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.1.tgz", + "integrity": "sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ==", "dev": true }, "which-typed-array": { @@ -9960,20 +9354,42 @@ "is-typed-array": "^1.1.10" } }, - "word-wrap": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", - "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", - "dev": true - }, - "workerpool": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz", - "integrity": "sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==", - "dev": true - }, "wrap-ansi": { - "version": "7.0.0", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "dev": true, + "requires": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "dependencies": { + "ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "dev": true + }, + "ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true + }, + "strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "requires": { + "ansi-regex": "^6.0.1" + } + } + } + }, + "wrap-ansi-cjs": { + "version": "npm:wrap-ansi@7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", "dev": true, @@ -9981,6 +9397,25 @@ "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" + }, + "dependencies": { + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + } } }, "wrappy": { @@ -9990,9 +9425,9 @@ "dev": true }, "ws": { - "version": "7.5.3", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.3.tgz", - "integrity": "sha512-kQ/dHIzuLrS6Je9+uv81ueZomEwH0qVYstcAQ4/Z93K8zeko9gtAbttJWzoC5ukqXY1PpoouV3+VSOqEAFt5wg==", + "version": "7.5.9", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", + "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==", "dev": true, "requires": {} }, @@ -10003,9 +9438,9 @@ "dev": true }, "y18n": { - "version": "5.0.8", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", - "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz", + "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==", "dev": true }, "yallist": { @@ -10015,44 +9450,90 @@ "dev": true }, "yargs": { - "version": "16.2.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", - "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "version": "15.4.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz", + "integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==", "dev": true, "requires": { - "cliui": "^7.0.2", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", + "cliui": "^6.0.0", + "decamelize": "^1.2.0", + "find-up": "^4.1.0", + "get-caller-file": "^2.0.1", "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", "string-width": "^4.2.0", - "y18n": "^5.0.5", - "yargs-parser": "^20.2.2" + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^18.1.2" + }, + "dependencies": { + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "requires": { + "p-locate": "^4.1.0" + } + }, + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "requires": { + "p-limit": "^2.2.0" + } + }, + "string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + } } }, "yargs-parser": { - "version": "20.2.4", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", - "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", - "dev": true - }, - "yargs-unparser": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", - "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", + "version": "18.1.3", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", + "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", "dev": true, "requires": { - "camelcase": "^6.0.0", - "decamelize": "^4.0.0", - "flat": "^5.0.2", - "is-plain-obj": "^2.1.0" + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" } }, - "yn": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", - "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", - "dev": true - }, "yocto-queue": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", diff --git a/package.json b/package.json index 3ae0a29..44046c1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "elven.js", - "version": "0.10.2", + "version": "0.11.0", "description": "Authenticate, sign and send transactions on the MultiversX blockchain in the browser.", "type": "module", "module": "build/elven.js", @@ -39,25 +39,25 @@ "prepublishOnly": "npm run build" }, "devDependencies": { - "@multiversx/sdk-core": "12.2.1", - "@multiversx/sdk-extension-provider": "2.0.7", - "@multiversx/sdk-native-auth-client": "^1.0.2", - "@multiversx/sdk-network-providers": "1.4.0", - "@multiversx/sdk-wallet-connect-provider": "3.2.1", + "@multiversx/sdk-core": "12.6.0", + "@multiversx/sdk-extension-provider": "3.0.0", + "@multiversx/sdk-native-auth-client": "1.0.4", + "@multiversx/sdk-network-providers": "1.5.0", + "@multiversx/sdk-wallet-connect-provider": "4.0.2", "@multiversx/sdk-web-wallet-provider": "3.0.0", - "@types/qrcode": "1.5.0", + "@types/qrcode": "1.5.1", "@types/serve-handler": "6.1.1", - "@typescript-eslint/eslint-plugin": "5.59.5", - "@typescript-eslint/parser": "5.59.5", - "esbuild": "0.17.19", - "eslint": "8.40.0", + "@typescript-eslint/eslint-plugin": "6.0.0", + "@typescript-eslint/parser": "6.0.0", + "esbuild": "0.18.13", + "eslint": "8.45.0", "eslint-config-prettier": "8.8.0", - "eslint-plugin-prettier": "4.2.1", + "eslint-plugin-prettier": "5.0.0", "node-stdlib-browser": "1.2.0", - "prettier": "2.8.8", + "prettier": "3.0.0", "qrcode": "1.5.3", - "rimraf": "5.0.0", + "rimraf": "5.0.1", "serve-handler": "6.1.5", - "typescript": "5.0.4" + "typescript": "5.1.6" } } diff --git a/src/auth/init-web-wallet-provider.ts b/src/auth/init-web-wallet-provider.ts index 7c2f2b0..ca61fcf 100644 --- a/src/auth/init-web-wallet-provider.ts +++ b/src/auth/init-web-wallet-provider.ts @@ -28,6 +28,7 @@ export const initWebWalletProvider = async ( if (signature && apiUrl && urlAddress) { const nativeAuthClient = new NativeAuthClient({ apiUrl, + origin: window.location.origin, }); const accessToken = nativeAuthClient.getToken( urlAddress, diff --git a/src/auth/login-with-extension.ts b/src/auth/login-with-extension.ts index 8a97758..4d70c47 100644 --- a/src/auth/login-with-extension.ts +++ b/src/auth/login-with-extension.ts @@ -24,8 +24,14 @@ export const loginWithExtension = async ( }; try { - if (dappProvider) await dappProvider.login(providerLoginData); - EventsStore.run(EventStoreEvents.onLoginPending); + if (dappProvider) { + const address = await dappProvider.login(providerLoginData); + if (address) { + EventsStore.run(EventStoreEvents.onLoginPending); + } else { + EventsStore.run(EventStoreEvents.onLogout); + } + } } catch (e) { const err = errorParse(e); console.warn(`Something went wrong trying to login the user: ${err}`); diff --git a/src/auth/login-with-mobile.ts b/src/auth/login-with-mobile.ts index 0b36c5f..f31bb30 100644 --- a/src/auth/login-with-mobile.ts +++ b/src/auth/login-with-mobile.ts @@ -106,7 +106,10 @@ export const loginWithMobile = async ( await dappProvider.init(); const { uri: walletConnectUri, approval } = await dappProvider.connect({ - methods: [DappCoreWCV2CustomMethodsEnum.mvx_cancelAction], + methods: [ + DappCoreWCV2CustomMethodsEnum.mvx_cancelAction, + DappCoreWCV2CustomMethodsEnum.mvx_signNativeAuthToken, + ], }); const wCUri = loginToken diff --git a/src/auth/qr-code-and-pairings-builder.ts b/src/auth/qr-code-and-pairings-builder.ts index b2fbd25..ceec289 100644 --- a/src/auth/qr-code-and-pairings-builder.ts +++ b/src/auth/qr-code-and-pairings-builder.ts @@ -195,7 +195,10 @@ export const qrCodeAndPairingsBuilder = async ( try { const { approval } = await dappProvider.connect({ topic, - methods: [DappCoreWCV2CustomMethodsEnum.mvx_cancelAction], + methods: [ + DappCoreWCV2CustomMethodsEnum.mvx_cancelAction, + DappCoreWCV2CustomMethodsEnum.mvx_signNativeAuthToken, + ], }); const pairingItemConfirmation = document.getElementById( diff --git a/src/interaction/post-send-tx.ts b/src/interaction/post-send-tx.ts index b435222..74067e7 100644 --- a/src/interaction/post-send-tx.ts +++ b/src/interaction/post-send-tx.ts @@ -18,7 +18,6 @@ export const postSendTx = async ( const userAccountOnNetwork = await networkProvider.getAccount(sender); senderAccount.update(userAccountOnNetwork); ls.set('address', senderAccount.address.bech32()); - ls.set('nonce', senderAccount.getNonceThenIncrement().valueOf()); ls.set('balance', senderAccount.balance.toString()); EventsStore.run(EventStoreEvents.onTxFinalized, transaction); }; diff --git a/src/interaction/web-wallet-tx-finalize.ts b/src/interaction/web-wallet-tx-finalize.ts index 740bffe..796a7e3 100644 --- a/src/interaction/web-wallet-tx-finalize.ts +++ b/src/interaction/web-wallet-tx-finalize.ts @@ -2,6 +2,7 @@ import { WALLET_PROVIDER_CALLBACK_PARAM, WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED, } from '@multiversx/sdk-web-wallet-provider/out'; +import { Account } from '@multiversx/sdk-core/out/account'; import { Transaction } from '@multiversx/sdk-core/out/transaction'; import { getParamFromUrl } from '../utils/get-param-from-url'; import { DappProvider, EventStoreEvents } from '../types'; @@ -9,6 +10,7 @@ import { ApiNetworkProvider } from '../network-provider'; import { postSendTx } from './post-send-tx'; import { errorParse } from '../utils/error-parse'; import { EventsStore } from '../events-store'; +import { ls } from '../utils/ls-helpers'; export const webWalletTxFinalize = async ( dappProvider: DappProvider, @@ -31,6 +33,13 @@ export const webWalletTxFinalize = async ( const transaction = Transaction.fromPlainObject(transactionObj); transaction.setNonce(nonce); + + const sender = transaction.getSender(); + const senderAccount = new Account(sender); + const currentNonce = transaction.getNonce().valueOf(); + senderAccount.incrementNonce(); + ls.set('nonce', currentNonce + 1); + try { EventsStore.run(EventStoreEvents.onTxStarted, transaction); await networkProvider.sendTransaction(transaction); diff --git a/src/main.ts b/src/main.ts index 2ce9937..181dbaf 100644 --- a/src/main.ts +++ b/src/main.ts @@ -32,6 +32,7 @@ import { getParamFromUrl } from './utils/get-param-from-url'; import { initWebWalletProvider } from './auth/init-web-wallet-provider'; import { postSendTx } from './interaction/post-send-tx'; import { webWalletTxFinalize } from './interaction/web-wallet-tx-finalize'; +import { Account } from '@multiversx/sdk-core/out/account'; export class ElvenJS { private static initOptions: InitOptions | undefined; @@ -156,13 +157,16 @@ export class ElvenJS { throw new Error('Error: Login failed: Use ElvenJs.init() first!'); } - // Native auth login token initialization - const nativeAuthClient = new NativeAuthClient({ - apiUrl: this.initOptions?.apiUrl, - }); - const loginToken = await nativeAuthClient.initialize(); - try { + EventsStore.run(EventStoreEvents.onLoginPending); + + // Native auth login token initialization + const nativeAuthClient = new NativeAuthClient({ + apiUrl: this.initOptions?.apiUrl, + origin: window.location.origin, + }); + const loginToken = await nativeAuthClient.initialize(); + // Login with browser extension if (loginMethod === LoginMethodsEnum.browserExtension) { const dappProvider = await loginWithExtension( @@ -240,7 +244,11 @@ export class ElvenJS { transaction.setNonce(currentState.nonce); if (this.dappProvider instanceof ExtensionProvider) { - await this.dappProvider.signTransaction(transaction); + const plainSignedTransaction = await this.dappProvider.signTransaction( + transaction + ); + const signature = plainSignedTransaction.getSignature(); + transaction.applySignature(signature); } if (this.dappProvider instanceof WalletConnectV2Provider) { await this.dappProvider.signTransaction(transaction); @@ -250,6 +258,11 @@ export class ElvenJS { } if (currentState.loginMethod !== LoginMethodsEnum.webWallet) { + const sender = transaction.getSender(); + const senderAccount = new Account(sender); + const currentNonce = transaction.getNonce().valueOf(); + senderAccount.incrementNonce(); + ls.set('nonce', currentNonce + 1); await this.networkProvider.sendTransaction(transaction); await postSendTx(transaction, this.networkProvider); } diff --git a/src/types.ts b/src/types.ts index 056d919..e2c48aa 100644 --- a/src/types.ts +++ b/src/types.ts @@ -40,6 +40,7 @@ export interface LoginOptions { export enum DappCoreWCV2CustomMethodsEnum { mvx_cancelAction = 'mvx_cancelAction', + mvx_signNativeAuthToken = 'mvx_signNativeAuthToken', } export enum EventStoreEvents {