From 8c3ff06f068b9d6b56e33bc132c62942951eec6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20=C4=86wirko?= Date: Fri, 27 Oct 2023 19:12:15 +0200 Subject: [PATCH] add xalias support --- CHANGELOG.md | 4 + build/elven.js | 40 +- build/types/auth/login-with-web-wallet.d.ts | 2 +- .../interaction/web-wallet-tx-finalize.d.ts | 2 +- build/types/types.d.ts | 3 +- build/types/utils/constants.d.ts | 1 + example/demo-ui-tools.js | 3 + example/elven.js | 40 +- example/index.html | 16 +- package-lock.json | 1644 +++++++++-------- package.json | 37 +- src/auth/account-sync.ts | 10 +- src/auth/login-with-web-wallet.ts | 16 +- src/interaction/web-wallet-tx-finalize.ts | 14 +- src/main.ts | 39 +- src/types.ts | 1 + src/utils/constants.ts | 4 + 17 files changed, 1022 insertions(+), 854 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 742fe0c..5a81f7f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +### [0.13.0](https://github.com/elven-js/elven.js/releases/tag/v0.13.0) (2023-10-27) + - add xAlias login support `ElvenJS.login('x-alias')` (check the [docs](https://www.elvenjs.com) and [demo example](/example/index.html)) + - update dependencies + ### [0.12.0](https://github.com/elven-js/elven.js/releases/tag/v0.12.0) (2023-08-05) - improve guardian support (all providers) - update dependencies diff --git a/build/elven.js b/build/elven.js index e4aac2b..5f9eced 100644 --- a/build/elven.js +++ b/build/elven.js @@ -1,9 +1,9 @@ -var NU=Object.create;var jl=Object.defineProperty;var OU=Object.getOwnPropertyDescriptor;var DU=Object.getOwnPropertyNames;var PU=Object.getPrototypeOf,RU=Object.prototype.hasOwnProperty;var PI=(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)jl(t,r,{get:e[r],enumerable:!0})},Gl=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of DU(e))!RU.call(t,i)&&i!==r&&jl(t,i,{get:()=>e[i],enumerable:!(n=OU(e,i))||n.enumerable});return t},Ht=(t,e,r)=>(Gl(t,e,"default"),r&&Gl(r,e,"default")),_e=(t,e,r)=>(r=t!=null?NU(PU(t)):{},Gl(e||!t||!t.__esModule?jl(r,"default",{value:t,enumerable:!0}):r,t)),ct=t=>Gl(jl({},"__esModule",{value:!0}),t);var m0=m(kl=>{"use strict";c();kl.byteLength=LU;kl.toByteArray=MU;kl.fromByteArray=VU;var Jr=[],br=[],BU=typeof Uint8Array<"u"?Uint8Array:Array,y0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(ps=0,RI=y0.length;ps0)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 LU(t){var e=BI(t),r=e[0],n=e[1];return(r+n)*3/4-n}function FU(t,e,r){return(e+r)*3/4-r}function MU(t){var e,r=BI(t),n=r[0],i=r[1],s=new BU(FU(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 UU(t){return Jr[t>>18&63]+Jr[t>>12&63]+Jr[t>>6&63]+Jr[t&63]}function qU(t,e,r){for(var n,i=[],s=e;sa?a:o+s));return n===1?(e=t[r-1],i.push(Jr[e>>2]+Jr[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(Jr[e>>10]+Jr[e>>4&63]+Jr[e<<2&63]+"=")),i.join("")}});var E0=m(w0=>{c();w0.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,w=t[e+d];for(d+=g,s=w&(1<<-f)-1,w>>=-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:(w?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-l}return(w?-1:1)*o*Math.pow(2,s-n)};w0.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,w=n?0:s-1,E=n?1:-1,x=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+w]=a&255,w+=E,a/=256,i-=8);for(o=o<0;t[r+w]=o&255,w+=E,o/=256,l-=8);t[r+w-E]|=x*128}});var zI=m(ho=>{"use strict";c();var v0=m0(),fo=E0(),LI=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;ho.Buffer=$;ho.SlowBuffer=WU;ho.INSPECT_MAX_BYTES=50;var Ql=2147483647;ho.kMaxLength=Ql;$.TYPED_ARRAY_SUPPORT=HU();!$.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 HU(){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>Ql)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 I0(t)}return UI(t,e,r)}$.poolSize=8192;function UI(t,e,r){if(typeof t=="string")return jU(t,e);if(ArrayBuffer.isView(t))return kU(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(Xr(t,ArrayBuffer)||t&&Xr(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Xr(t,SharedArrayBuffer)||t&&Xr(t.buffer,SharedArrayBuffer)))return b0(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=QU(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 UI(t,e,r)};Object.setPrototypeOf($.prototype,Uint8Array.prototype);Object.setPrototypeOf($,Uint8Array);function qI(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 GU(t,e,r){return qI(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 GU(t,e,r)};function I0(t){return qI(t),Ln(t<0?0:S0(t)|0)}$.allocUnsafe=function(t){return I0(t)};$.allocUnsafeSlow=function(t){return I0(t)};function jU(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!$.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=VI(t,e)|0,n=Ln(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function A0(t){for(var e=t.length<0?0:S0(t.length)|0,r=Ln(e),n=0;n=Ql)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Ql.toString(16)+" bytes");return t|0}function WU(t){return+t!=t&&(t=0),$.alloc(+t)}$.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==$.prototype};$.compare=function(e,r){if(Xr(e,Uint8Array)&&(e=$.from(e,e.offset,e.byteLength)),Xr(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 VI(t,e){if($.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Xr(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 _0(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return WI(t).length;default:if(i)return n?-1:_0(t).length;e=(""+e).toLowerCase(),i=!0}}$.byteLength=VI;function zU(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 n5(this,e,r);case"utf8":case"utf-8":return GI(this,e,r);case"ascii":return t5(this,e,r);case"latin1":case"binary":return r5(this,e,r);case"base64":return ZU(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return i5(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}$.prototype._isBuffer=!0;function gs(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+=" ... "),""};LI&&($.prototype[LI]=$.prototype.inspect);$.prototype.compare=function(e,r,n,i,s){if(Xr(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,T0(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:FI(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):FI(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function FI(t,e,r,n,i){var s=1,o=t.length,a=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;s=2,o/=2,a/=2,r/=2}function u(w,E){return s===1?w[E]:w.readUInt16BE(E*s)}var l;if(i){var f=-1;for(l=r;lo&&(r=o-a),l=r;l>=0;l--){for(var d=!0,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 $U(this,e,r,n);case"utf8":case"utf-8":return KU(this,e,r,n);case"ascii":case"latin1":case"binary":return YU(this,e,r,n);case"base64":return JU(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return XU(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 ZU(t,e,r){return e===0&&r===t.length?v0.fromByteArray(t):v0.fromByteArray(t.slice(e,r))}function GI(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 e5(n)}var MI=4096;function e5(t){var e=t.length;if(e<=MI)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 jI(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 kI(t,e,r,n,i){return e=+e,r=r>>>0,i||jI(t,e,r,4,34028234663852886e22,-34028234663852886e22),fo.write(t,e,r,n,23,4),r+4}$.prototype.writeFloatLE=function(e,r,n){return kI(this,e,r,!0,n)};$.prototype.writeFloatBE=function(e,r,n){return kI(this,e,r,!1,n)};function QI(t,e,r,n,i){return e=+e,r=r>>>0,i||jI(t,e,r,8,17976931348623157e292,-17976931348623157e292),fo.write(t,e,r,n,52,8),r+8}$.prototype.writeDoubleLE=function(e,r,n){return QI(this,e,r,!0,n)};$.prototype.writeDoubleBE=function(e,r,n){return QI(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 a5(t){for(var e=[],r=0;r>8,i=r%256,s.push(i),s.push(n);return s}function WI(t){return v0.toByteArray(o5(t))}function Wl(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function Xr(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function T0(t){return t!==t}var c5=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 XI=m((Pne,JI)=>{c();var yt=JI.exports={},Zr,en;function C0(){throw new Error("setTimeout has not been defined")}function x0(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?Zr=setTimeout:Zr=C0}catch{Zr=C0}try{typeof clearTimeout=="function"?en=clearTimeout:en=x0}catch{en=x0}})();function $I(t){if(Zr===setTimeout)return setTimeout(t,0);if((Zr===C0||!Zr)&&setTimeout)return Zr=setTimeout,setTimeout(t,0);try{return Zr(t,0)}catch{try{return Zr.call(null,t,0)}catch{return Zr.call(this,t,0)}}}function l5(t){if(en===clearTimeout)return clearTimeout(t);if((en===x0||!en)&&clearTimeout)return en=clearTimeout,clearTimeout(t);try{return en(t)}catch{try{return en.call(null,t)}catch{return en.call(this,t)}}}var Fn=[],po=!1,ys,zl=-1;function f5(){!po||!ys||(po=!1,ys.length?Fn=ys.concat(Fn):zl=-1,Fn.length&&KI())}function KI(){if(!po){var t=$I(f5);po=!0;for(var e=Fn.length;e;){for(ys=Fn,Fn=[];++zl1)for(var r=1;r{h=_e(zI()),p=_e(XI()),h5=function(t){function e(){var n=this||self;return delete t.prototype.__magic__,n}if(typeof globalThis=="object")return globalThis;if(this)return e();t.defineProperty(t.prototype,"__magic__",{configurable:!0,get:e});var r=__magic__;return r}(Object),global=h5});var Gt=m((ZI,$l)=>{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 w(R){var B,b,T,L=q.prototype={constructor:q,toString:null,valueOf:null},X=new q(1),W=20,G=4,j=-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,v){var A,P,C,D,M,N,U,H,V=this;if(!(V instanceof q))return new q(y,v);if(v==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 T(V,H,N);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(v,2,ie.length,"Base"),v==10)return V=new q(y),oe(V,W+V.e+1,G);if(H=String(y),N=typeof y=="number"){if(y*0!=0)return T(V,H,N,v);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,v),D=M=0,U=H.length;MD){D=U;continue}}else if(!C&&(H==H.toUpperCase()&&(H=H.toLowerCase())||H==H.toLowerCase()&&(H=H.toUpperCase()))){C=!0,M=-1,D=0;continue}return T(V,String(y),N,v)}N=!1,H=b(H,v,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,N&&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&&C<=g&&C===i(C)){if(P[0]===0){if(C===0&&P.length===1)return!0;break e}if(v=(C+1)%u,v<1&&(v+=u),String(P[0]).length==v){for(v=0;v=a||A!==i(A))break e;if(A!==0)return!0}}}else if(P===null&&C===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,v=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,C,D,M,N,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),N>=9e15?(C=crypto.getRandomValues(new Uint32Array(2)),P[U]=C[0],P[U+1]=C[1]):(H.push(N%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(N%1e14),U+=7);U=M/7}else throw re=!1,Error(s+"crypto unavailable");if(!re)for(;U=10;N/=10,U++);UC-1&&(N[M+1]==null&&(N[M+1]=0),N[M+1]+=N[M]/C|0,N[M]%=C)}return N.reverse()}return function(A,P,C,D,M){var N,U,H,V,Z,we,ve,Pe,tt=A.indexOf("."),lt=W,Oe=G;for(tt>=0&&(V=se,se=0,A=A.replace(".",""),Pe=new q(P),we=Pe.pow(A.length-tt),se=V,Pe.c=v(S(x(we.c),we.e,"0"),10,C,y),Pe.e=Pe.c.length),ve=v(A,P,C,M?(N=ie,y):(N=y,ie)),H=V=ve.length;ve[--V]==0;ve.pop());if(!ve[0])return N.charAt(0);if(tt<0?--H:(we.c=ve,we.e=H,we.s=D,we=B(we,Pe,lt,Oe,C),ve=we.c,Z=we.r,H=we.e),U=H+lt+1,tt=ve[U],V=C/2,Z=Z||U<0||ve[U+1]!=null,Z=Oe<4?(tt!=null||Z)&&(Oe==0||Oe==(we.s<0?3:2)):tt>V||tt==V&&(Oe==4||Z||Oe==6&&ve[U-1]&1||Oe==(we.s<0?8:7)),U<1||!ve[0])A=Z?S(N.charAt(1),-lt,N.charAt(0)):N.charAt(0);else{if(ve.length=U,Z)for(--C;++ve[--U]>C;)ve[U]=0,U||(++H,ve=[1].concat(ve));for(V=ve.length;!ve[--V];);for(tt=0,A="";tt<=V;A+=N.charAt(ve[tt++]));A=S(A,H,N.charAt(0))}return A}}(),B=function(){function y(P,C,D){var M,N,U,H,V=0,Z=P.length,we=C%d,ve=C/d|0;for(P=P.slice();Z--;)U=P[Z]%d,H=P[Z]/d|0,M=ve*U+H*we,N=we*U+M%d*d+V,V=(N/D|0)+(M/d|0)+ve*H,P[Z]=N%D;return V&&(P=[V].concat(P)),P}function v(P,C,D,M){var N,U;if(D!=M)U=D>M?1:-1;else for(N=U=0;NC[N]?1:-1;break}return U}function A(P,C,D,M){for(var N=0;D--;)P[D]-=N,N=P[D]1;P.splice(0,1));}return function(P,C,D,M,N){var U,H,V,Z,we,ve,Pe,tt,lt,Oe,Ue,xt,ui,hs,ds,nr,Bn,Wt=P.s==C.s?1:-1,Nt=P.c,ze=C.c;if(!Nt||!Nt[0]||!ze||!ze[0])return new q(!P.s||!C.s||(Nt?ze&&Nt[0]==ze[0]:!ze)?NaN:Nt&&Nt[0]==0||!ze?Wt*0:Wt/0);for(tt=new q(Wt),lt=tt.c=[],H=P.e-C.e,Wt=D+H+1,N||(N=a,H=E(P.e/u)-E(C.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(hs=Nt.length,nr=ze.length,V=0,Wt+=2,we=i(N/(ze[0]+1)),we>1&&(ze=y(ze,we,N),Nt=y(Nt,we,N),nr=ze.length,hs=Nt.length),ui=nr,Oe=Nt.slice(0,nr),Ue=Oe.length;Ue=N/2&&ds++;do{if(we=0,U=v(ze,Oe,nr,Ue),U<0){if(xt=Oe[0],nr!=Ue&&(xt=xt*N+(Oe[1]||0)),we=i(xt/ds),we>1)for(we>=N&&(we=N-1),ve=y(ze,we,N),Pe=ve.length,Ue=Oe.length;v(ve,Oe,Pe,Ue)==1;)we--,A(ve,nr=10;Wt/=10,V++);oe(tt,D+(tt.e=V+H*u-1)+1,M,Z)}else tt.e=H,tt.r=+Z;return tt}}();function le(y,v,A,P){var C,D,M,N,U;if(A==null?A=G:F(A,0,8),!y.c)return y.toString();if(C=y.c[0],M=y.e,v==null)U=x(y.c),U=P==1||P==2&&(M<=j||M>=K)?I(U,M):S(U,M,"0");else if(y=oe(new q(y),v,A),D=y.e,U=x(y.c),N=U.length,P==1||P==2&&(v<=D||D<=j)){for(;NN){if(--v>0)for(U+=".";v--;U+="0");}else if(v+=D-N,v>0)for(D+1==N&&(U+=".");v--;U+="0");return y.s<0&&C?"-"+U:U}function ae(y,v){for(var A,P=1,C=new q(y[0]);P=10;C/=10,P++);return(A=P+A*u-1)>ue?y.c=y.e=null:A=10;N/=10,C++);if(D=v-C,D<0)D+=u,M=v,U=Z[H=0],V=U/we[C-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,C=1,D%=u,M=D-u+1}else break e;else{for(U=N=Z[H],C=1;N>=10;N/=10,C++);D%=u,M=D-u+C,V=M<0?0:U/we[C-M-1]%10|0}if(P=P||v<0||Z[H+1]!=null||(M<0?U:U%we[C-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/we[C-M]:0:Z[H-1])%10&1||A==(y.s<0?8:7)),v<1||!Z[0])return Z.length=0,P?(v-=y.e+1,Z[0]=we[(u-v%u)%u],y.e=-v||0):Z[0]=y.e=0,y;if(D==0?(Z.length=H,N=1,H--):(Z.length=H+1,N=we[u-D],Z[H]=M>0?i(U/we[C-M]%we[M])*N:0),P)for(;;)if(H==0){for(D=1,M=Z[0];M>=10;M/=10,D++);for(M=Z[0]+=N,N=1;M>=10;M/=10,N++);D!=N&&(y.e++,Z[0]==a&&(Z[0]=1));break}else{if(Z[H]+=N,Z[H]!=a)break;Z[H--]=0,N=1}for(D=Z.length;Z[--D]===0;Z.pop());}y.e>ue?y.c=y.e=null:y.e=K?I(v,A):S(v,A,"0"),y.s<0?"-"+v:v)}return L.absoluteValue=L.abs=function(){var y=new q(this);return y.s<0&&(y.s=1),y},L.comparedTo=function(y,v){return O(this,new q(y,v))},L.decimalPlaces=L.dp=function(y,v){var A,P,C,D=this;if(y!=null)return F(y,0,g),v==null?v=G:F(v,0,8),oe(new q(D),y+D.e+1,v);if(!(A=D.c))return null;if(P=((C=A.length-1)-E(this.e/u))*u,C=A[C])for(;C%10==0;C/=10,P--);return P<0&&(P=0),P},L.dividedBy=L.div=function(y,v){return B(this,new q(y,v),W,G)},L.dividedToIntegerBy=L.idiv=function(y,v){return B(this,new q(y,v),0,1)},L.exponentiatedBy=L.pow=function(y,v){var A,P,C,D,M,N,U,H,V,Z=this;if(y=new q(y),y.c&&!y.isInteger())throw Error(s+"Exponent not an integer: "+ce(y));if(v!=null&&(v=new q(v)),N=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),N?2-_(y):+ce(y))),v?V.mod(v):V;if(U=y.s<0,v){if(v.c?!v.c[0]:!v.s)return new q(NaN);P=!U&&Z.isInteger()&&v.isInteger(),P&&(Z=Z.mod(v))}else{if(y.e>9&&(Z.e>0||Z.e<-1||(Z.e==0?Z.c[0]>1||N&&Z.c[1]>=24e7:Z.c[0]<8e13||N&&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(N?(A=new q(.5),U&&(y.s=1),H=_(y)):(C=Math.abs(+ce(y)),H=C%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(v))}if(C){if(C=i(C/2),C===0)break;H=C%2}else if(y=y.times(A),oe(y,y.e+1,1),y.e>14)H=_(y);else{if(C=+ce(y),C===0)break;H=C%2}Z=Z.times(Z),D?Z.c&&Z.c.length>D&&(Z.c.length=D):P&&(Z=Z.mod(v))}return P?V:(U&&(V=X.div(V)),v?V.mod(v):D?oe(V,se,G,M):V)},L.integerValue=function(y){var v=new q(this);return y==null?y=G:F(y,0,8),oe(v,v.e+1,y)},L.isEqualTo=L.eq=function(y,v){return O(this,new q(y,v))===0},L.isFinite=function(){return!!this.c},L.isGreaterThan=L.gt=function(y,v){return O(this,new q(y,v))>0},L.isGreaterThanOrEqualTo=L.gte=function(y,v){return(v=O(this,new q(y,v)))===1||v===0},L.isInteger=function(){return!!this.c&&E(this.e/u)>this.c.length-2},L.isLessThan=L.lt=function(y,v){return O(this,new q(y,v))<0},L.isLessThanOrEqualTo=L.lte=function(y,v){return(v=O(this,new q(y,v)))===-1||v===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,v){var A,P,C,D,M=this,N=M.s;if(y=new q(y,v),v=y.s,!N||!v)return new q(NaN);if(N!=v)return y.s=-v,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=-v,y):new q(Z?M:NaN);if(!V[0]||!Z[0])return Z[0]?(y.s=-v,y):new q(V[0]?M:G==3?-0:0)}if(U=E(U),H=E(H),V=V.slice(),N=U-H){for((D=N<0)?(N=-N,C=V):(H=U,C=Z),C.reverse(),v=N;v--;C.push(0));C.reverse()}else for(P=(D=(N=V.length)<(v=Z.length))?N:v,N=v=0;v0)for(;v--;V[A++]=0);for(v=a-1;P>N;){if(V[--P]=0;){for(A=0,we=xt[C]%lt,ve=xt[C]/lt|0,M=U,D=C+M;D>C;)H=Ue[--M]%lt,V=Ue[M]/lt|0,N=ve*H+V*we,H=we*H+N%lt*lt+Pe[D]+A,A=(H/tt|0)+(N/lt|0)+ve*V,Pe[D--]=H%tt;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,v){var A,P=this,C=P.s;if(y=new q(y,v),v=y.s,!C||!v)return new q(NaN);if(C!=v)return y.s=-v,P.minus(y);var D=P.e/u,M=y.e/u,N=P.c,U=y.c;if(!D||!M){if(!N||!U)return new q(C/0);if(!N[0]||!U[0])return U[0]?y:new q(N[0]?P:C*0)}if(D=E(D),M=E(M),N=N.slice(),C=D-M){for(C>0?(M=D,A=U):(C=-C,A=N),A.reverse();C--;A.push(0));A.reverse()}for(C=N.length,v=U.length,C-v<0&&(A=U,U=N,N=A,v=C),C=0;v;)C=(N[--v]=N[v]+U[v]+C)/a|0,N[v]=a===N[v]?0:N[v]%a;return C&&(N=[C].concat(N),++M),fe(y,N,M)},L.precision=L.sd=function(y,v){var A,P,C,D=this;if(y!=null&&y!==!!y)return F(y,1,g),v==null?v=G:F(v,0,8),oe(new q(D),y,v);if(!(A=D.c))return null;if(C=A.length-1,P=C*u+1,C=A[C]){for(;C%10==0;C/=10,P--);for(C=A[0];C>=10;C/=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,v,A,P,C,D=this,M=D.c,N=D.s,U=D.e,H=W+4,V=new q("0.5");if(N!==1||!M||!M[0])return new q(!N||N<0&&(!M||M[0])?NaN:M?D:1/0);if(N=Math.sqrt(+ce(D)),N==0||N==1/0?(v=x(M),(v.length+U)%2==0&&(v+="0"),N=Math.sqrt(+v),U=E((U+1)/2)-(U<0||U%2),N==1/0?v="5e"+U:(v=N.toExponential(),v=v.slice(0,v.indexOf("e")+1)+U),A=new q(v)):A=new q(N+""),A.c[0]){for(U=A.e,N=U+H,N<3&&(N=0);;)if(C=A,A=V.times(C.plus(B(D,C,H,1))),x(C.c).slice(0,N)===(v=x(A.c)).slice(0,N))if(A.e0&&Pe>0){for(D=Pe%N||N,V=ve.substr(0,D);D0&&(V+=H+ve.slice(D)),we&&(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 v,A,P,C,D,M,N,U,H,V,Z,we,ve=this,Pe=ve.c;if(y!=null&&(N=new q(y),!N.isInteger()&&(N.c||N.s!==1)||N.lt(X)))throw Error(s+"Argument "+(N.isInteger()?"out of range: ":"not an integer: ")+ce(N));if(!Pe)return new q(ve);for(v=new q(X),H=A=new q(X),P=U=new q(X),we=x(Pe),D=v.e=we.length-ve.e-1,v.c[0]=f[(M=D%u)<0?u+M:M],y=!y||N.comparedTo(v)>0?D>0?v:H:N,M=ue,ue=1/0,N=new q(we),U.c[0]=0;V=B(N,v,0,1),C=A.plus(V.times(P)),C.comparedTo(y)!=1;)A=P,P=C,H=U.plus(V.times(C=H)),U=C,v=N.minus(V.times(C=v)),N=C;return C=B(y.minus(A),P,0,1),U=U.plus(C.times(H)),A=A.plus(C.times(P)),U.s=H.s=ve.s,D=D*2,Z=B(H,P,D,G).minus(ve).abs().comparedTo(B(U,A,D,G).minus(ve).abs())<1?[H,P]:[U,A],ue=M,Z},L.toNumber=function(){return+ce(this)},L.toPrecision=function(y,v){return y!=null&&F(y,1,g),le(this,y,v,2)},L.toString=function(y){var v,A=this,P=A.s,C=A.e;return C===null?P?(v="Infinity",P<0&&(v="-"+v)):v="NaN":(y==null?v=C<=j||C>=K?I(x(A.c),C):S(x(A.c),C,"0"):y===10?(A=oe(new q(A),W+C+1,G),v=S(x(A.c),A.e,"0")):(F(y,2,ie.length,"Base"),v=b(S(x(A.c),C,"0"),10,y,P,!0)),P<0&&A.c[0]&&(v="-"+v)),v},L.valueOf=L.toJSON=function(){return ce(this)},L._isBigNumber=!0,R!=null&&q.set(R),q}function E(R){var B=R|0;return R>0||R===B?B:B-1}function x(R){for(var B,b,T=1,L=R.length,X=R[0]+"";TK^b?1:-1;for(G=(j=L.length)<(K=X.length)?j:K,W=0;WX[W]^b?1:-1;return j==K?0:j>K^b?1:-1}function F(R,B,b,T){if(Rb||R!==i(R))throw Error(s+(T||"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 E(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 T,L;if(B<0){for(L=b+".";++B;L+=b);R=L+R}else if(T=R.length,++B>T){for(L=b,B-=T;--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 N0=class extends Re{constructor(e,r){super(`Invalid argument: ${e}`,r)}};pe.ErrInvalidArgument=N0;var O0=class extends Re{constructor(e,r="not specified"){super(`Operation "${e}" not supported. Reason: ${r}`)}};pe.ErrUnsupportedOperation=O0;var D0=class extends Re{constructor(e,r,n){super(`Bad type of "${e}": ${n}. Expected type: ${r}`)}};pe.ErrBadType=D0;var P0=class extends Re{constructor(e){super(`Invariant failed: [${e}]`)}};pe.ErrInvariantFailed=P0;var R0=class extends Re{constructor(e){super(`Unexpected condition: [${e}]`)}};pe.ErrUnexpectedCondition=R0;var B0=class extends Re{constructor(e,r){let n=`Cannot create address from: ${e}`;super(n,r)}};pe.ErrAddressCannotCreate=B0;var L0=class extends Re{constructor(e,r){super(`Wrong address HRP. Expected: ${e}, got ${r}`)}};pe.ErrAddressBadHrp=L0;var F0=class extends Re{constructor(){super("Address is empty")}};pe.ErrAddressEmpty=F0;var M0=class extends Re{constructor(e){super(`Not enough gas provided: ${e}`)}};pe.ErrNotEnoughGas=M0;var U0=class extends Re{constructor(e){super(`Invalid nonce: ${e}`)}};pe.ErrNonceInvalid=U0;var q0=class extends Re{constructor(e){super(`Invalid transaction version: ${e}`)}};pe.ErrTransactionVersionInvalid=q0;var V0=class extends Re{constructor(e){super(`Invalid transaction options: ${e}`)}};pe.ErrTransactionOptionsInvalid=V0;var H0=class extends Re{constructor(e,r){let n=`Cannot create signature from: ${e}`;super(n,r)}};pe.ErrSignatureCannotCreate=H0;var G0=class extends Re{constructor(){super("Invalid function name")}};pe.ErrInvalidFunctionName=G0;var j0=class extends Re{constructor(){super("Async timer already running")}};pe.ErrAsyncTimerAlreadyRunning=j0;var k0=class extends Re{constructor(){super("Async timer aborted")}};pe.ErrAsyncTimerAborted=k0;var Q0=class extends Re{constructor(){super("TransactionWatcher has timed out")}};pe.ErrTransactionWatcherTimeout=Q0;var W0=class extends Re{constructor(){super("Expected transaction status not reached")}};pe.ErrExpectedTransactionStatusNotReached=W0;var z0=class extends Re{constructor(){super("Expected transaction events not found")}};pe.ErrExpectedTransactionEventsNotFound=z0;var Kl=class extends Re{constructor(e){super(e)}};pe.ErrContract=Kl;var $0=class extends Kl{constructor(){super(` +var s5=Object.create;var Yl=Object.defineProperty;var o5=Object.getOwnPropertyDescriptor;var a5=Object.getOwnPropertyNames;var u5=Object.getPrototypeOf,c5=Object.prototype.hasOwnProperty;var JI=(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)Yl(t,r,{get:e[r],enumerable:!0})},Kl=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of a5(e))!c5.call(t,i)&&i!==r&&Yl(t,i,{get:()=>e[i],enumerable:!(n=o5(e,i))||n.enumerable});return t},Ht=(t,e,r)=>(Kl(t,e,"default"),r&&Kl(r,e,"default")),_e=(t,e,r)=>(r=t!=null?s5(u5(t)):{},Kl(e||!t||!t.__esModule?Yl(r,"default",{value:t,enumerable:!0}):r,t)),ct=t=>Kl(Yl({},"__esModule",{value:!0}),t);var C0=m(Jl=>{"use strict";c();Jl.byteLength=f5;Jl.toByteArray=d5;Jl.fromByteArray=y5;var Xr=[],Sr=[],l5=typeof Uint8Array<"u"?Uint8Array:Array,T0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Es=0,XI=T0.length;Es0)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 f5(t){var e=ZI(t),r=e[0],n=e[1];return(r+n)*3/4-n}function h5(t,e,r){return(e+r)*3/4-r}function d5(t){var e,r=ZI(t),n=r[0],i=r[1],s=new l5(h5(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=Sr[t.charCodeAt(u)]<<2|Sr[t.charCodeAt(u+1)]>>4,s[o++]=e&255),i===1&&(e=Sr[t.charCodeAt(u)]<<10|Sr[t.charCodeAt(u+1)]<<4|Sr[t.charCodeAt(u+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function p5(t){return Xr[t>>18&63]+Xr[t>>12&63]+Xr[t>>6&63]+Xr[t&63]}function g5(t,e,r){for(var n,i=[],s=e;sa?a:o+s));return n===1?(e=t[r-1],i.push(Xr[e>>2]+Xr[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(Xr[e>>10]+Xr[e>>4&63]+Xr[e<<2&63]+"=")),i.join("")}});var N0=m(x0=>{c();x0.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,w=t[e+d];for(d+=g,s=w&(1<<-f)-1,w>>=-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:(w?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-l}return(w?-1:1)*o*Math.pow(2,s-n)};x0.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,w=n?0:s-1,E=n?1:-1,T=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=f):(o=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-o))<1&&(o--,u*=2),o+d>=1?e+=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+w]=a&255,w+=E,a/=256,i-=8);for(o=o<0;t[r+w]=o&255,w+=E,o/=256,l-=8);t[r+w-E]|=T*128}});var hS=m(vo=>{"use strict";c();var O0=C0(),Eo=N0(),eS=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;vo.Buffer=z;vo.SlowBuffer=b5;vo.INSPECT_MAX_BYTES=50;var Xl=2147483647;vo.kMaxLength=Xl;z.TYPED_ARRAY_SUPPORT=m5();!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 m5(){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(z.prototype,"parent",{enumerable:!0,get:function(){if(z.isBuffer(this))return this.buffer}});Object.defineProperty(z.prototype,"offset",{enumerable:!0,get:function(){if(z.isBuffer(this))return this.byteOffset}});function qn(t){if(t>Xl)throw new RangeError('The value "'+t+'" is invalid for option "size"');var 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 B0(t)}return nS(t,e,r)}z.poolSize=8192;function nS(t,e,r){if(typeof t=="string")return E5(t,e);if(ArrayBuffer.isView(t))return v5(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(Zr(t,ArrayBuffer)||t&&Zr(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Zr(t,SharedArrayBuffer)||t&&Zr(t.buffer,SharedArrayBuffer)))return P0(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 z.from(n,e,r);var i=A5(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 nS(t,e,r)};Object.setPrototypeOf(z.prototype,Uint8Array.prototype);Object.setPrototypeOf(z,Uint8Array);function iS(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 w5(t,e,r){return iS(t),t<=0?qn(t):e!==void 0?typeof r=="string"?qn(t).fill(e,r):qn(t).fill(e):qn(t)}z.alloc=function(t,e,r){return w5(t,e,r)};function B0(t){return iS(t),qn(t<0?0:L0(t)|0)}z.allocUnsafe=function(t){return B0(t)};z.allocUnsafeSlow=function(t){return B0(t)};function E5(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!z.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=sS(t,e)|0,n=qn(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function D0(t){for(var e=t.length<0?0:L0(t.length)|0,r=qn(e),n=0;n=Xl)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Xl.toString(16)+" bytes");return t|0}function b5(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(Zr(e,Uint8Array)&&(e=z.from(e,e.offset,e.byteLength)),Zr(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;for(var n=e.length,i=r.length,s=0,o=Math.min(n,i);si.length?z.from(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 sS(t,e){if(z.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Zr(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 R0(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return fS(t).length;default:if(i)return n?-1:R0(t).length;e=(""+e).toLowerCase(),i=!0}}z.byteLength=sS;function _5(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 R5(this,e,r);case"utf8":case"utf-8":return aS(this,e,r);case"ascii":return D5(this,e,r);case"latin1":case"binary":return P5(this,e,r);case"base64":return N5(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B5(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}z.prototype._isBuffer=!0;function vs(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}z.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+=" ... "),""};eS&&(z.prototype[eS]=z.prototype.inspect);z.prototype.compare=function(e,r,n,i,s){if(Zr(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;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,F0(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:tS(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):tS(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function tS(t,e,r,n,i){var s=1,o=t.length,a=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;s=2,o/=2,a/=2,r/=2}function u(w,E){return s===1?w[E]:w.readUInt16BE(E*s)}var l;if(i){var f=-1;for(l=r;lo&&(r=o-a),l=r;l>=0;l--){for(var d=!0,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 I5(this,e,r,n);case"utf8":case"utf-8":return S5(this,e,r,n);case"ascii":case"latin1":case"binary":return T5(this,e,r,n);case"base64":return C5(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x5(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 N5(t,e,r){return e===0&&r===t.length?O0.fromByteArray(t):O0.fromByteArray(t.slice(e,r))}function aS(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 O5(n)}var rS=4096;function O5(t){var e=t.length;if(e<=rS)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")}z.prototype.readUintLE=z.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};z.prototype.readUint8=z.prototype.readUInt8=function(e,r){return e=e>>>0,r||Rt(e,1,this.length),this[e]};z.prototype.readUint16LE=z.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||Rt(e,2,this.length),this[e]|this[e+1]<<8};z.prototype.readUint16BE=z.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||Rt(e,2,this.length),this[e]<<8|this[e+1]};z.prototype.readUint32LE=z.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};z.prototype.readUint32BE=z.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])};z.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};z.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};z.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]};z.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};z.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};z.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};z.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]};z.prototype.readFloatLE=function(e,r){return e=e>>>0,r||Rt(e,4,this.length),Eo.read(this,e,!0,23,4)};z.prototype.readFloatBE=function(e,r){return e=e>>>0,r||Rt(e,4,this.length),Eo.read(this,e,!1,23,4)};z.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||Rt(e,8,this.length),Eo.read(this,e,!0,52,8)};z.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||Rt(e,8,this.length),Eo.read(this,e,!1,52,8)};function or(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){var s=Math.pow(2,8*n)-1;or(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;or(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};z.prototype.writeUint8=z.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||or(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||or(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||or(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||or(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||or(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};z.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){var s=Math.pow(2,8*n-1);or(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};z.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){var s=Math.pow(2,8*n-1);or(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};z.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||or(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||or(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||or(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||or(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||or(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 uS(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 cS(t,e,r,n,i){return e=+e,r=r>>>0,i||uS(t,e,r,4,34028234663852886e22,-34028234663852886e22),Eo.write(t,e,r,n,23,4),r+4}z.prototype.writeFloatLE=function(e,r,n){return cS(this,e,r,!0,n)};z.prototype.writeFloatBE=function(e,r,n){return cS(this,e,r,!1,n)};function lS(t,e,r,n,i){return e=+e,r=r>>>0,i||uS(t,e,r,8,17976931348623157e292,-17976931348623157e292),Eo.write(t,e,r,n,52,8),r+8}z.prototype.writeDoubleLE=function(e,r,n){return lS(this,e,r,!0,n)};z.prototype.writeDoubleBE=function(e,r,n){return lS(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);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 M5(t){for(var e=[],r=0;r>8,i=r%256,s.push(i),s.push(n);return s}function fS(t){return O0.toByteArray(F5(t))}function Zl(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function Zr(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function F0(t){return t!==t}var q5=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 mS=m((Sie,yS)=>{c();var mt=yS.exports={},en,tn;function M0(){throw new Error("setTimeout has not been defined")}function U0(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?en=setTimeout:en=M0}catch{en=M0}try{typeof clearTimeout=="function"?tn=clearTimeout:tn=U0}catch{tn=U0}})();function dS(t){if(en===setTimeout)return setTimeout(t,0);if((en===M0||!en)&&setTimeout)return en=setTimeout,setTimeout(t,0);try{return en(t,0)}catch{try{return en.call(null,t,0)}catch{return en.call(this,t,0)}}}function V5(t){if(tn===clearTimeout)return clearTimeout(t);if((tn===U0||!tn)&&clearTimeout)return tn=clearTimeout,clearTimeout(t);try{return tn(t)}catch{try{return tn.call(null,t)}catch{return tn.call(this,t)}}}var Vn=[],Ao=!1,As,ef=-1;function H5(){!Ao||!As||(Ao=!1,As.length?Vn=As.concat(Vn):ef=-1,Vn.length&&pS())}function pS(){if(!Ao){var t=dS(H5);Ao=!0;for(var e=Vn.length;e;){for(As=Vn,Vn=[];++ef1)for(var r=1;r{h=_e(hS()),p=_e(mS()),G5=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=G5});var Gt=m((wS,tf)=>{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 w(I){var N,_,S,R=M.prototype={constructor:M,toString:null,valueOf:null},J=new M(1),Q=20,V=4,k=-7,K=21,pe=-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 M(y,v){var b,P,C,O,L,x,F,H,q=this;if(!(q instanceof M))return new M(y,v);if(v==null){if(y&&y._isBigNumber===!0){q.s=y.s,!y.c||y.e>ue?q.c=q.e=null:y.e=10;L/=10,O++);O>ue?q.c=q.e=null:(q.e=O,q.c=[y]);return}H=String(y)}else{if(!r.test(H=String(y)))return S(q,H,x);q.s=H.charCodeAt(0)==45?(H=H.slice(1),-1):1}(O=H.indexOf("."))>-1&&(H=H.replace(".","")),(L=H.search(/e/i))>0?(O<0&&(O=L),O+=+H.slice(L+1),H=H.substring(0,L)):O<0&&(O=H.length)}else{if(B(v,2,ie.length,"Base"),v==10)return q=new M(y),oe(q,Q+q.e+1,V);if(H=String(y),x=typeof y=="number"){if(y*0!=0)return S(q,H,x,v);if(q.s=1/y<0?(H=H.slice(1),-1):1,M.DEBUG&&H.replace(/^0\.0*|\./,"").length>15)throw Error(o+y)}else q.s=H.charCodeAt(0)===45?(H=H.slice(1),-1):1;for(b=ie.slice(0,v),O=L=0,F=H.length;LO){O=F;continue}}else if(!C&&(H==H.toUpperCase()&&(H=H.toLowerCase())||H==H.toLowerCase()&&(H=H.toUpperCase()))){C=!0,L=-1,O=0;continue}return S(q,String(y),x,v)}x=!1,H=_(H,v,10,q.s),(O=H.indexOf("."))>-1?H=H.replace(".",""):O=H.length}for(L=0;H.charCodeAt(L)===48;L++);for(F=H.length;H.charCodeAt(--F)===48;);if(H=H.slice(L,++F)){if(F-=L,x&&M.DEBUG&&F>15&&(y>l||y!==i(y)))throw Error(o+q.s*y);if((O=O-L-1)>ue)q.c=q.e=null;else if(O=-g&&C<=g&&C===i(C)){if(P[0]===0){if(C===0&&P.length===1)return!0;break e}if(v=(C+1)%u,v<1&&(v+=u),String(P[0]).length==v){for(v=0;v=a||b!==i(b))break e;if(b!==0)return!0}}}else if(P===null&&C===null&&(O===null||O===1||O===-1))return!0;throw Error(s+"Invalid BigNumber: "+y)},M.maximum=M.max=function(){return ae(arguments,R.lt)},M.minimum=M.min=function(){return ae(arguments,R.gt)},M.random=function(){var y=9007199254740992,v=Math.random()*y&2097151?function(){return i(Math.random()*y)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(b){var P,C,O,L,x,F=0,H=[],q=new M(J);if(b==null?b=Q:B(b,0,g),L=n(b/u),re)if(crypto.getRandomValues){for(P=crypto.getRandomValues(new Uint32Array(L*=2));F>>11),x>=9e15?(C=crypto.getRandomValues(new Uint32Array(2)),P[F]=C[0],P[F+1]=C[1]):(H.push(x%1e14),F+=2);F=L/2}else if(crypto.randomBytes){for(P=crypto.randomBytes(L*=7);F=9e15?crypto.randomBytes(7).copy(P,F):(H.push(x%1e14),F+=7);F=L/7}else throw re=!1,Error(s+"crypto unavailable");if(!re)for(;F=10;x/=10,F++);FC-1&&(x[L+1]==null&&(x[L+1]=0),x[L+1]+=x[L]/C|0,x[L]%=C)}return x.reverse()}return function(b,P,C,O,L){var x,F,H,q,Z,we,Ae,Re,tt=b.indexOf("."),lt=Q,Oe=V;for(tt>=0&&(q=se,se=0,b=b.replace(".",""),Re=new M(P),we=Re.pow(b.length-tt),se=q,Re.c=v(A(T(we.c),we.e,"0"),10,C,y),Re.e=Re.c.length),Ae=v(b,P,C,L?(x=ie,y):(x=y,ie)),H=q=Ae.length;Ae[--q]==0;Ae.pop());if(!Ae[0])return x.charAt(0);if(tt<0?--H:(we.c=Ae,we.e=H,we.s=O,we=N(we,Re,lt,Oe,C),Ae=we.c,Z=we.r,H=we.e),F=H+lt+1,tt=Ae[F],q=C/2,Z=Z||F<0||Ae[F+1]!=null,Z=Oe<4?(tt!=null||Z)&&(Oe==0||Oe==(we.s<0?3:2)):tt>q||tt==q&&(Oe==4||Z||Oe==6&&Ae[F-1]&1||Oe==(we.s<0?8:7)),F<1||!Ae[0])b=Z?A(x.charAt(1),-lt,x.charAt(0)):x.charAt(0);else{if(Ae.length=F,Z)for(--C;++Ae[--F]>C;)Ae[F]=0,F||(++H,Ae=[1].concat(Ae));for(q=Ae.length;!Ae[--q];);for(tt=0,b="";tt<=q;b+=x.charAt(Ae[tt++]));b=A(b,H,x.charAt(0))}return b}}(),N=function(){function y(P,C,O){var L,x,F,H,q=0,Z=P.length,we=C%d,Ae=C/d|0;for(P=P.slice();Z--;)F=P[Z]%d,H=P[Z]/d|0,L=Ae*F+H*we,x=we*F+L%d*d+q,q=(x/O|0)+(L/d|0)+Ae*H,P[Z]=x%O;return q&&(P=[q].concat(P)),P}function v(P,C,O,L){var x,F;if(O!=L)F=O>L?1:-1;else for(x=F=0;xC[x]?1:-1;break}return F}function b(P,C,O,L){for(var x=0;O--;)P[O]-=x,x=P[O]1;P.splice(0,1));}return function(P,C,O,L,x){var F,H,q,Z,we,Ae,Re,tt,lt,Oe,Ue,Ot,hi,ms,ws,sr,Un,$t=P.s==C.s?1:-1,Dt=P.c,$e=C.c;if(!Dt||!Dt[0]||!$e||!$e[0])return new M(!P.s||!C.s||(Dt?$e&&Dt[0]==$e[0]:!$e)?NaN:Dt&&Dt[0]==0||!$e?$t*0:$t/0);for(tt=new M($t),lt=tt.c=[],H=P.e-C.e,$t=O+H+1,x||(x=a,H=E(P.e/u)-E(C.e/u),$t=$t/u|0),q=0;$e[q]==(Dt[q]||0);q++);if($e[q]>(Dt[q]||0)&&H--,$t<0)lt.push(1),Z=!0;else{for(ms=Dt.length,sr=$e.length,q=0,$t+=2,we=i(x/($e[0]+1)),we>1&&($e=y($e,we,x),Dt=y(Dt,we,x),sr=$e.length,ms=Dt.length),hi=sr,Oe=Dt.slice(0,sr),Ue=Oe.length;Ue=x/2&&ws++;do{if(we=0,F=v($e,Oe,sr,Ue),F<0){if(Ot=Oe[0],sr!=Ue&&(Ot=Ot*x+(Oe[1]||0)),we=i(Ot/ws),we>1)for(we>=x&&(we=x-1),Ae=y($e,we,x),Re=Ae.length,Ue=Oe.length;v(Ae,Oe,Re,Ue)==1;)we--,b(Ae,sr=10;$t/=10,q++);oe(tt,O+(tt.e=q+H*u-1)+1,L,Z)}else tt.e=H,tt.r=+Z;return tt}}();function le(y,v,b,P){var C,O,L,x,F;if(b==null?b=V:B(b,0,8),!y.c)return y.toString();if(C=y.c[0],L=y.e,v==null)F=T(y.c),F=P==1||P==2&&(L<=k||L>=K)?U(F,L):A(F,L,"0");else if(y=oe(new M(y),v,b),O=y.e,F=T(y.c),x=F.length,P==1||P==2&&(v<=O||O<=k)){for(;xx){if(--v>0)for(F+=".";v--;F+="0");}else if(v+=O-x,v>0)for(O+1==x&&(F+=".");v--;F+="0");return y.s<0&&C?"-"+F:F}function ae(y,v){for(var b,P=1,C=new M(y[0]);P=10;C/=10,P++);return(b=P+b*u-1)>ue?y.c=y.e=null:b=10;x/=10,C++);if(O=v-C,O<0)O+=u,L=v,F=Z[H=0],q=F/we[C-L-1]%10|0;else if(H=n((O+1)/u),H>=Z.length)if(P){for(;Z.length<=H;Z.push(0));F=q=0,C=1,O%=u,L=O-u+1}else break e;else{for(F=x=Z[H],C=1;x>=10;x/=10,C++);O%=u,L=O-u+C,q=L<0?0:F/we[C-L-1]%10|0}if(P=P||v<0||Z[H+1]!=null||(L<0?F:F%we[C-L-1]),P=b<4?(q||P)&&(b==0||b==(y.s<0?3:2)):q>5||q==5&&(b==4||P||b==6&&(O>0?L>0?F/we[C-L]:0:Z[H-1])%10&1||b==(y.s<0?8:7)),v<1||!Z[0])return Z.length=0,P?(v-=y.e+1,Z[0]=we[(u-v%u)%u],y.e=-v||0):Z[0]=y.e=0,y;if(O==0?(Z.length=H,x=1,H--):(Z.length=H+1,x=we[u-O],Z[H]=L>0?i(F/we[C-L]%we[L])*x:0),P)for(;;)if(H==0){for(O=1,L=Z[0];L>=10;L/=10,O++);for(L=Z[0]+=x,x=1;L>=10;L/=10,x++);O!=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(O=Z.length;Z[--O]===0;Z.pop());}y.e>ue?y.c=y.e=null:y.e=K?U(v,b):A(v,b,"0"),y.s<0?"-"+v:v)}return R.absoluteValue=R.abs=function(){var y=new M(this);return y.s<0&&(y.s=1),y},R.comparedTo=function(y,v){return D(this,new M(y,v))},R.decimalPlaces=R.dp=function(y,v){var b,P,C,O=this;if(y!=null)return B(y,0,g),v==null?v=V:B(v,0,8),oe(new M(O),y+O.e+1,v);if(!(b=O.c))return null;if(P=((C=b.length-1)-E(this.e/u))*u,C=b[C])for(;C%10==0;C/=10,P--);return P<0&&(P=0),P},R.dividedBy=R.div=function(y,v){return N(this,new M(y,v),Q,V)},R.dividedToIntegerBy=R.idiv=function(y,v){return N(this,new M(y,v),0,1)},R.exponentiatedBy=R.pow=function(y,v){var b,P,C,O,L,x,F,H,q,Z=this;if(y=new M(y),y.c&&!y.isInteger())throw Error(s+"Exponent not an integer: "+ce(y));if(v!=null&&(v=new M(v)),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 q=new M(Math.pow(+ce(Z),x?2-W(y):+ce(y))),v?q.mod(v):q;if(F=y.s<0,v){if(v.c?!v.c[0]:!v.s)return new M(NaN);P=!F&&Z.isInteger()&&v.isInteger(),P&&(Z=Z.mod(v))}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 O=Z.s<0&&W(y)?-0:0,Z.e>-1&&(O=1/O),new M(F?1/O:O);se&&(O=n(se/u+2))}for(x?(b=new M(.5),F&&(y.s=1),H=W(y)):(C=Math.abs(+ce(y)),H=C%2),q=new M(J);;){if(H){if(q=q.times(Z),!q.c)break;O?q.c.length>O&&(q.c.length=O):P&&(q=q.mod(v))}if(C){if(C=i(C/2),C===0)break;H=C%2}else if(y=y.times(b),oe(y,y.e+1,1),y.e>14)H=W(y);else{if(C=+ce(y),C===0)break;H=C%2}Z=Z.times(Z),O?Z.c&&Z.c.length>O&&(Z.c.length=O):P&&(Z=Z.mod(v))}return P?q:(F&&(q=J.div(q)),v?q.mod(v):O?oe(q,se,V,L):q)},R.integerValue=function(y){var v=new M(this);return y==null?y=V:B(y,0,8),oe(v,v.e+1,y)},R.isEqualTo=R.eq=function(y,v){return D(this,new M(y,v))===0},R.isFinite=function(){return!!this.c},R.isGreaterThan=R.gt=function(y,v){return D(this,new M(y,v))>0},R.isGreaterThanOrEqualTo=R.gte=function(y,v){return(v=D(this,new M(y,v)))===1||v===0},R.isInteger=function(){return!!this.c&&E(this.e/u)>this.c.length-2},R.isLessThan=R.lt=function(y,v){return D(this,new M(y,v))<0},R.isLessThanOrEqualTo=R.lte=function(y,v){return(v=D(this,new M(y,v)))===-1||v===0},R.isNaN=function(){return!this.s},R.isNegative=function(){return this.s<0},R.isPositive=function(){return this.s>0},R.isZero=function(){return!!this.c&&this.c[0]==0},R.minus=function(y,v){var b,P,C,O,L=this,x=L.s;if(y=new M(y,v),v=y.s,!x||!v)return new M(NaN);if(x!=v)return y.s=-v,L.plus(y);var F=L.e/u,H=y.e/u,q=L.c,Z=y.c;if(!F||!H){if(!q||!Z)return q?(y.s=-v,y):new M(Z?L:NaN);if(!q[0]||!Z[0])return Z[0]?(y.s=-v,y):new M(q[0]?L:V==3?-0:0)}if(F=E(F),H=E(H),q=q.slice(),x=F-H){for((O=x<0)?(x=-x,C=q):(H=F,C=Z),C.reverse(),v=x;v--;C.push(0));C.reverse()}else for(P=(O=(x=q.length)<(v=Z.length))?x:v,x=v=0;v0)for(;v--;q[b++]=0);for(v=a-1;P>x;){if(q[--P]=0;){for(b=0,we=Ot[C]%lt,Ae=Ot[C]/lt|0,L=F,O=C+L;O>C;)H=Ue[--L]%lt,q=Ue[L]/lt|0,x=Ae*H+q*we,H=we*H+x%lt*lt+Re[O]+b,b=(H/tt|0)+(x/lt|0)+Ae*q,Re[O--]=H%tt;Re[O]=b}return b?++P:Re.splice(0,1),fe(y,Re,P)},R.negated=function(){var y=new M(this);return y.s=-y.s||null,y},R.plus=function(y,v){var b,P=this,C=P.s;if(y=new M(y,v),v=y.s,!C||!v)return new M(NaN);if(C!=v)return y.s=-v,P.minus(y);var O=P.e/u,L=y.e/u,x=P.c,F=y.c;if(!O||!L){if(!x||!F)return new M(C/0);if(!x[0]||!F[0])return F[0]?y:new M(x[0]?P:C*0)}if(O=E(O),L=E(L),x=x.slice(),C=O-L){for(C>0?(L=O,b=F):(C=-C,b=x),b.reverse();C--;b.push(0));b.reverse()}for(C=x.length,v=F.length,C-v<0&&(b=F,F=x,x=b,v=C),C=0;v;)C=(x[--v]=x[v]+F[v]+C)/a|0,x[v]=a===x[v]?0:x[v]%a;return C&&(x=[C].concat(x),++L),fe(y,x,L)},R.precision=R.sd=function(y,v){var b,P,C,O=this;if(y!=null&&y!==!!y)return B(y,1,g),v==null?v=V:B(v,0,8),oe(new M(O),y,v);if(!(b=O.c))return null;if(C=b.length-1,P=C*u+1,C=b[C]){for(;C%10==0;C/=10,P--);for(C=b[0];C>=10;C/=10,P++);}return y&&O.e+1>P&&(P=O.e+1),P},R.shiftedBy=function(y){return B(y,-l,l),this.times("1e"+y)},R.squareRoot=R.sqrt=function(){var y,v,b,P,C,O=this,L=O.c,x=O.s,F=O.e,H=Q+4,q=new M("0.5");if(x!==1||!L||!L[0])return new M(!x||x<0&&(!L||L[0])?NaN:L?O:1/0);if(x=Math.sqrt(+ce(O)),x==0||x==1/0?(v=T(L),(v.length+F)%2==0&&(v+="0"),x=Math.sqrt(+v),F=E((F+1)/2)-(F<0||F%2),x==1/0?v="5e"+F:(v=x.toExponential(),v=v.slice(0,v.indexOf("e")+1)+F),b=new M(v)):b=new M(x+""),b.c[0]){for(F=b.e,x=F+H,x<3&&(x=0);;)if(C=b,b=q.times(C.plus(N(O,C,H,1))),T(C.c).slice(0,x)===(v=T(b.c)).slice(0,x))if(b.e0&&Re>0){for(O=Re%x||x,q=Ae.substr(0,O);O0&&(q+=H+Ae.slice(O)),we&&(q="-"+q)}P=Z?q+(b.decimalSeparator||"")+((F=+b.fractionGroupSize)?Z.replace(new RegExp("\\d{"+F+"}\\B","g"),"$&"+(b.fractionGroupSeparator||"")):Z):q}return(b.prefix||"")+P+(b.suffix||"")},R.toFraction=function(y){var v,b,P,C,O,L,x,F,H,q,Z,we,Ae=this,Re=Ae.c;if(y!=null&&(x=new M(y),!x.isInteger()&&(x.c||x.s!==1)||x.lt(J)))throw Error(s+"Argument "+(x.isInteger()?"out of range: ":"not an integer: ")+ce(x));if(!Re)return new M(Ae);for(v=new M(J),H=b=new M(J),P=F=new M(J),we=T(Re),O=v.e=we.length-Ae.e-1,v.c[0]=f[(L=O%u)<0?u+L:L],y=!y||x.comparedTo(v)>0?O>0?v:H:x,L=ue,ue=1/0,x=new M(we),F.c[0]=0;q=N(x,v,0,1),C=b.plus(q.times(P)),C.comparedTo(y)!=1;)b=P,P=C,H=F.plus(q.times(C=H)),F=C,v=x.minus(q.times(C=v)),x=C;return C=N(y.minus(b),P,0,1),F=F.plus(C.times(H)),b=b.plus(C.times(P)),F.s=H.s=Ae.s,O=O*2,Z=N(H,P,O,V).minus(Ae).abs().comparedTo(N(F,b,O,V).minus(Ae).abs())<1?[H,P]:[F,b],ue=L,Z},R.toNumber=function(){return+ce(this)},R.toPrecision=function(y,v){return y!=null&&B(y,1,g),le(this,y,v,2)},R.toString=function(y){var v,b=this,P=b.s,C=b.e;return C===null?P?(v="Infinity",P<0&&(v="-"+v)):v="NaN":(y==null?v=C<=k||C>=K?U(T(b.c),C):A(T(b.c),C,"0"):y===10?(b=oe(new M(b),Q+C+1,V),v=A(T(b.c),b.e,"0")):(B(y,2,ie.length,"Base"),v=_(A(T(b.c),C,"0"),10,y,P,!0)),P<0&&b.c[0]&&(v="-"+v)),v},R.valueOf=R.toJSON=function(){return ce(this)},R._isBigNumber=!0,I!=null&&M.set(I),M}function E(I){var N=I|0;return I>0||I===N?N:N-1}function T(I){for(var N,_,S=1,R=I.length,J=I[0]+"";SK^_?1:-1;for(V=(k=R.length)<(K=J.length)?k:K,Q=0;QJ[Q]^_?1:-1;return k==K?0:k>K^_?1:-1}function B(I,N,_,S){if(I_||I!==i(I))throw Error(s+(S||"Argument")+(typeof I=="number"?I_?" out of range: ":" not an integer: ":" not a primitive number: ")+String(I))}function W(I){var N=I.c.length-1;return E(I.e/u)==N&&I.c[N]%2!=0}function U(I,N){return(I.length>1?I.charAt(0)+"."+I.slice(1):I)+(N<0?"e":"e+")+N}function A(I,N,_){var S,R;if(N<0){for(R=_+".";++N;R+=_);I=R+I}else if(S=I.length,++N>S){for(R=_,N-=S;--N;R+=_);I+=R}else N{"use strict";c();Object.defineProperty(he,"__esModule",{value:!0});he.ErrIsCompletedFieldIsMissingOnTransaction=he.ErrGasLimitShouldBe0ForInnerTransaction=he.ErrInvalidRelayedV2BuilderArguments=he.ErrInvalidRelayedV1BuilderArguments=he.ErrNotImplemented=he.ErrContractInteraction=he.ErrCodec=he.ErrCannotParseTransactionOutcome=he.ErrCannotParseContractResults=he.ErrMissingFieldOnEnum=he.ErrMissingFieldOnStruct=he.ErrTypingSystem=he.ErrMock=he.ErrContractHasNoAddress=he.ErrContract=he.ErrExpectedTransactionEventsNotFound=he.ErrExpectedTransactionStatusNotReached=he.ErrTransactionWatcherTimeout=he.ErrAsyncTimerAborted=he.ErrAsyncTimerAlreadyRunning=he.ErrInvalidFunctionName=he.ErrSignatureCannotCreate=he.ErrTransactionOptionsInvalid=he.ErrTransactionVersionInvalid=he.ErrNonceInvalid=he.ErrNotEnoughGas=he.ErrAddressEmpty=he.ErrAddressBadHrp=he.ErrAddressCannotCreate=he.ErrUnexpectedCondition=he.ErrInvariantFailed=he.ErrBadType=he.ErrUnsupportedOperation=he.ErrInvalidArgument=he.Err=void 0;var De=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}};he.Err=De;var q0=class extends De{constructor(e,r){super(`Invalid argument: ${e}`,r)}};he.ErrInvalidArgument=q0;var V0=class extends De{constructor(e,r="not specified"){super(`Operation "${e}" not supported. Reason: ${r}`)}};he.ErrUnsupportedOperation=V0;var H0=class extends De{constructor(e,r,n){super(`Bad type of "${e}": ${n}. Expected type: ${r}`)}};he.ErrBadType=H0;var G0=class extends De{constructor(e){super(`Invariant failed: [${e}]`)}};he.ErrInvariantFailed=G0;var k0=class extends De{constructor(e){super(`Unexpected condition: [${e}]`)}};he.ErrUnexpectedCondition=k0;var j0=class extends De{constructor(e,r){let n=`Cannot create address from: ${e}`;super(n,r)}};he.ErrAddressCannotCreate=j0;var Q0=class extends De{constructor(e,r){super(`Wrong address HRP. Expected: ${e}, got ${r}`)}};he.ErrAddressBadHrp=Q0;var W0=class extends De{constructor(){super("Address is empty")}};he.ErrAddressEmpty=W0;var $0=class extends De{constructor(e){super(`Not enough gas provided: ${e}`)}};he.ErrNotEnoughGas=$0;var z0=class extends De{constructor(e){super(`Invalid nonce: ${e}`)}};he.ErrNonceInvalid=z0;var K0=class extends De{constructor(e){super(`Invalid transaction version: ${e}`)}};he.ErrTransactionVersionInvalid=K0;var Y0=class extends De{constructor(e){super(`Invalid transaction options: ${e}`)}};he.ErrTransactionOptionsInvalid=Y0;var J0=class extends De{constructor(e,r){let n=`Cannot create signature from: ${e}`;super(n,r)}};he.ErrSignatureCannotCreate=J0;var X0=class extends De{constructor(){super("Invalid function name")}};he.ErrInvalidFunctionName=X0;var Z0=class extends De{constructor(){super("Async timer already running")}};he.ErrAsyncTimerAlreadyRunning=Z0;var em=class extends De{constructor(){super("Async timer aborted")}};he.ErrAsyncTimerAborted=em;var tm=class extends De{constructor(){super("TransactionWatcher has timed out")}};he.ErrTransactionWatcherTimeout=tm;var rm=class extends De{constructor(){super("Expected transaction status not reached")}};he.ErrExpectedTransactionStatusNotReached=rm;var nm=class extends De{constructor(){super("Expected transaction events not found")}};he.ErrExpectedTransactionEventsNotFound=nm;var rf=class extends De{constructor(e){super(e)}};he.ErrContract=rf;var im=class extends rf{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=$0;var K0=class extends Re{constructor(e){super(e)}};pe.ErrMock=K0;var Y0=class extends Re{constructor(e){super(e)}};pe.ErrTypingSystem=Y0;var J0=class extends Re{constructor(e,r){super(`field ${e} does not exist on struct ${r}`)}};pe.ErrMissingFieldOnStruct=J0;var X0=class extends Re{constructor(e,r){super(`field ${e} does not exist on enum ${r}`)}};pe.ErrMissingFieldOnEnum=X0;var Z0=class extends Re{constructor(e){super(`cannot parse contract results: ${e}`)}};pe.ErrCannotParseContractResults=Z0;var em=class extends Re{constructor(e,r){super(`cannot parse outcome of transaction ${e}: ${r}`)}};pe.ErrCannotParseTransactionOutcome=em;var tm=class extends Re{constructor(e){super(e)}};pe.ErrCodec=tm;var rm=class extends Re{constructor(e){super(e)}};pe.ErrContractInteraction=rm;var nm=class extends Re{constructor(){super("Method not yet implemented")}};pe.ErrNotImplemented=nm;var im=class extends Re{constructor(){super("invalid arguments for relayed v1 builder")}};pe.ErrInvalidRelayedV1BuilderArguments=im;var sm=class extends Re{constructor(){super("invalid arguments for relayed v2 builder")}};pe.ErrInvalidRelayedV2BuilderArguments=sm;var om=class extends Re{constructor(){super("gas limit must be 0 for the inner transaction for relayed v2")}};pe.ErrGasLimitShouldBe0ForInnerTransaction=om});var um=m(ci=>{"use strict";c();var d5=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 Iu=d5(Gt()),p5=Be(),eS="EGLD",tS=18;Iu.default.set({ROUNDING_MODE:1});var Yl=class t{constructor(e){let r=new Iu.default(e.amountAsBigInteger);if(!r.isInteger()||r.isNegative())throw new p5.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 Iu.default(e).shiftedBy(tS).decimalPlaces(0);return this.egldFromBigInteger(r)}static egldFromBigInteger(e){return new t({tokenIdentifier:eS,nonce:0,amountAsBigInteger:e,numDecimals:tS})}static fungibleFromAmount(e,r,n){let i=new Iu.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 Iu.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==eS}isFungible(){return this.nonce==0}};ci.TokenTransfer=Yl;var am=class extends Yl{constructor(e,r,n,i){super({tokenIdentifier:e,nonce:r,amountAsBigInteger:n,numDecimals:i})}};ci.TokenPayment=am});var ms=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(nt=>{"use strict";c();var g5=nt&&nt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.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=nt&&nt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),m5=nt&&nt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&g5(e,t,r);return y5(e,t),e};Object.defineProperty(nt,"__esModule",{value:!0});nt.isEmpty=nt.guardEmpty=nt.guardNotEmpty=nt.guardLength=nt.guardSameLength=nt.guardValueIsSetWithMessage=nt.guardValueIsSet=nt.guardTrue=void 0;var go=m5(Be());function w5(t,e){if(!t)throw new go.ErrInvariantFailed(`[<${e}>] isn't true`)}nt.guardTrue=w5;function E5(t,e){rS(`${t} isn't set (null or undefined)`,e)}nt.guardValueIsSet=E5;function rS(t,e){if(e==null||e===void 0)throw new go.ErrInvariantFailed(t)}nt.guardValueIsSetWithMessage=rS;function v5(t,e){if(t=t||[],e=e||[],t.length!=e.length)throw new go.ErrInvariantFailed("arrays do not have the same length")}nt.guardSameLength=v5;function A5(t,e){let r=t.length||0;if(r!=e)throw new go.ErrInvariantFailed(`wrong length, expected: ${e}, actual: ${r}`)}nt.guardLength=A5;function b5(t,e){if(cm(t))throw new go.ErrInvariantFailed(`${e} is empty`)}nt.guardNotEmpty=b5;function _5(t,e){if(!cm(t))throw new go.ErrInvariantFailed(`${e} is not empty`)}nt.guardEmpty=_5;function cm(t){return t.isEmpty?t.isEmpty():t.length===0}nt.isEmpty=cm});var nS=m(Jl=>{"use strict";c();Object.defineProperty(Jl,"__esModule",{value:!0});Jl.getJavascriptPrototypesInHierarchy=void 0;function I5(t,e){let r=[],n=Object.getPrototypeOf(t);for(;n&&e(n);)r.push(n),n=Object.getPrototypeOf(n);return r}Jl.getJavascriptPrototypesInHierarchy=I5});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 lm=nS(),iS=gr(),li=class t{constructor(e,r=[],n=Su.fixed(1)){iS.guardValueIsSet("name",e),this.name=e,this.typeParameters=r,this.cardinality=n}getName(){return this.name}getClassName(){return t.ClassName}getClassHierarchy(){return lm.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 iS.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 lm.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 Su=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=Su;Su.MaxCardinality=4096;var Xl=class t extends li{constructor(e){super(e)}getClassName(){return t.ClassName}};bt.PrimitiveType=Xl;Xl.ClassName="PrimitiveType";var Zl=class t extends li{getClassName(){return t.ClassName}};bt.CustomType=Zl;Zl.ClassName="CustomType";var Tu=class t{constructor(e){this.type=e}getClassName(){return t.ClassName}getClassHierarchy(){return lm.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=Tu;Tu.ClassName="TypedValue";var ef=class t extends Tu{constructor(e){super(e)}getClassName(){return t.ClassName}};bt.PrimitiveValue=ef;ef.ClassName="PrimitiveValue";function S5(t){return t.belongsToTypesystem!==void 0}bt.isTyped=S5;var tf=class t extends li{constructor(){super("...")}getClassName(){return t.ClassName}};bt.TypePlaceholder=tf;tf.ClassName="TypePlaceholder";var rf=class t extends li{constructor(){super("?")}getClassName(){return t.ClassName}};bt.NullType=rf;rf.ClassName="NullType"});var sS=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,w="-",E=/^xn--/,x=/[^\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 T(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 G(Y,se){return Y+22+75*(Y<26)-((se!=0)<<5)}function j(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,v,A,P,C,D;for(fe=Y.lastIndexOf(w),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)/v))&&B("overflow"),q+=P*v,C=A<=ae?a:A>=ae+u?u:A-ae,!(PI(s/D)&&B("overflow"),v*=D;ie=se.length+1,ae=j(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,v,A=[],P,C,D,M;for(Y=L(Y),P=Y.length,se=g,te=0,le=d,ae=0;ae=se&&vI((s-te)/C)&&B("overflow"),te+=(fe-se)*C,se=fe,ae=0;aes&&B("overflow"),v==se){for(oe=te,ce=o;y=ce<=le?a:ce>=le+u?u:ce-le,!(oe{"use strict";c();var aS=sS();function T5(t,e){this.__proto__=new Error(e),this.__proto__.name="BackslashError",this.offset=t}function fm(t){return t>="0"&&t<="7"}function C5(t){return t>="0"&&t<="9"||t>="a"&&t<="f"||t>="A"&&t<="F"}function oS(t){return t=parseInt(t,16),aS.ucs2.encode([t])}function uS(t,e,r){var n=!1,i=[];function s(u){var l=t[u];if(!C5(l))throw new T5(u,"Unexpected token ILLEGAL");return l}for(;e{c();var hS=cS();gS.exports={validate:x5,parse:N5};function x5(t,e){var r;if(e=e||!1,typeof t!="string")r="Input must be a string";else try{nf(t,0,e,!1)}catch(n){r=n.message}return r}function N5(t,e){if(typeof t!="string")throw new Error("Input must be a string");e=e||!1;var r=nf(t,0,e,!0);return r.value}function dS(t,e){for(var r=t.length,n=e,i,s=e;s-1&&t[r]==="\\";)n++,r--;return n%2===0}function R5(t,e,r,n){for(var i=e,s=",",o=[],a=e;ws(t[a]);)a++;if(t[a]==="]")return{start:e,end:a,value:o};for(;s===",";){var u=nf(t,i,r,n),l=dS(t,u.end);n&&o.push(u.value),i=l.end,s=l.value}return{start:e,end:i,value:o}}function B5(t,e){return t.substr(e,4)==="true"}function L5(t,e){return t.substr(e,5)==="false"}function F5(t,e){return t.substr(e,4)==="null"}var M5=new RegExp(/^\s$/);function ws(t){return M5.test(t)}var U5=new RegExp(/^\d$/);function lS(t){return U5.test(t)}function Un(t,e,r){var n=10,i;t.length{"use strict";c();var q5=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]}),V5=tn&&tn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),H5=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)&&q5(e,t,r);return V5(e,t),e};Object.defineProperty(tn,"__esModule",{value:!0});tn.TypeExpressionParser=void 0;var mS=H5(Be()),G5=_t(),j5=yS(),dm=class{parse(e){let r=this.doParse(e),n=Object.keys(r);if(n.length!=1)throw new mS.ErrTypingSystem(`bad type expression: ${e}`);let i=n[0];return this.nodeToType(i,r[i])}doParse(e){let r=this.getJsonedString(e);try{return j5.parse(r)}catch{throw new mS.ErrTypingSystem(`cannot parse type expression: ${e}. internal json: ${r}.`)}}getJsonedString(e){let r="";for(var n=0;n"?a!=">"?r+=": {} }":r+="}":o==","?u==">"||(a==">"?r+=",":r+=": {},"):r+=o}let i=/(:|\{|\}|,|\s)/,s=r.replace(/utf\-8\sstring/ig,"utf-8-string").split(i).filter(o=>o);return r=s.map(o=>i.test(o)?o:`"${o}"`).map(o=>o.replace(/utf\-8\-string/ig,"utf-8 string")).join(""),s.length==1?`{${r}: {}}`:`{${r}}`}nodeToType(e,r){e.charAt(e.length-1)==="1"&&(e=e.slice(0,-1));let n=Object.keys(r).map(i=>this.nodeToType(i,r[i]));return new G5.Type(e,n)}};tn.TypeExpressionParser=dm});var gm=m(fi=>{"use strict";c();Object.defineProperty(fi,"__esModule",{value:!0});fi.EndpointParameterDefinition=fi.EndpointModifiers=fi.EndpointDefinition=void 0;var k5=sf(),wS="?",Q5="N / A",pm=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?wS:e.name,e.payableInTokens=e.payableInTokens||[],e.inputs=e.inputs||[],e.outputs=e.outputs||[];let r=e.inputs.map(s=>Cu.fromJSON(s)),n=e.outputs.map(s=>Cu.fromJSON(s)),i=new of(e.mutability,e.payableInTokens);return new t(e.name,r,n,i)}};fi.EndpointDefinition=pm;var of=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=of;var Cu=class t{constructor(e,r,n){this.name=e,this.description=r,this.type=n}static fromJSON(e){let r=new k5.TypeExpressionParser().parse(e.type);return new t(e.name||wS,e.description||Q5,r)}};fi.EndpointParameterDefinition=Cu});var wo=m(sr=>{"use strict";c();var W5=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]}),z5=sr&&sr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$5=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)&&W5(e,t,r);return z5(e,t),e};Object.defineProperty(sr,"__esModule",{value:!0});sr.Fields=sr.Field=sr.FieldDefinition=void 0;var ym=$5(Be()),K5=sf(),mm=class t{constructor(e,r,n){this.name=e,this.description=r,this.type=n}static fromJSON(e){let r=new K5.TypeExpressionParser().parse(e.type);return new t(e.name,e.description,r)}};sr.FieldDefinition=mm;var wm=class{constructor(e,r=""){this.value=e,this.name=r}checkTyping(e){let r=this.value.getType();if(!r.equals(e.type))throw new ym.ErrTypingSystem(`check type of field "${e.name}; expected: ${e.type}, actual: ${r}"`);if(this.name!=e.name)throw new ym.ErrTypingSystem(`check name of field "${e.name}"`)}equals(e){return this.name==e.name&&this.value.equals(e.value)}};sr.Field=wm;var Em=class{static checkTyping(e,r){if(e.length!=r.length)throw new ym.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 Y5=Be(),vm=gr(),af=wo(),vS=_t(),ES=256,uf=class t extends vS.CustomType{constructor(e,r){super(e),this.variants=[],this.variants=r}getClassName(){return t.ClassName}static fromJSON(e){let r=(e.variants||[]).map(n=>cf.fromJSON(n));return new t(e.name,r)}getVariantByDiscriminant(e){let r=this.variants.find(n=>n.discriminant==e);return vm.guardValueIsSet(`variant by discriminant (${e})`,r),r}getVariantByName(e){let r=this.variants.find(n=>n.name==e);return vm.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=uf;uf.ClassName="EnumType";var cf=class t{constructor(e,r,n=[]){this.fieldsDefinitions=[],vm.guardTrue(raf.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 af.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};hi.EnumVariantDefinition=cf;var lf=class t extends vS.TypedValue{constructor(e,r,n){super(e),this.fields=[],this.name=r.name,this.discriminant=r.discriminant,this.fields=n,this.fieldsByName=new Map(n.map(s=>[s.name,s]));let i=r.getFieldsDefinitions();af.Fields.checkTyping(this.fields,i)}getClassName(){return 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=af.Fields.equals(r,n);return i&&s&&o}getFields(){return this.fields}getFieldValue(e){let r=this.fieldsByName.get(e);if(r)return r.value.valueOf();throw new Y5.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=lf;lf.ClassName="EnumValue"});var vo=m(Eo=>{"use strict";c();Object.defineProperty(Eo,"__esModule",{value:!0});Eo.Struct=Eo.StructType=void 0;var J5=Be(),ff=wo(),AS=_t(),hf=class t extends AS.CustomType{constructor(e,r){super(e),this.fieldsDefinitions=[],this.fieldsDefinitions=r}getClassName(){return t.ClassName}static fromJSON(e){let r=(e.fields||[]).map(n=>ff.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 ff.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};Eo.StructType=hf;hf.ClassName="StructType";var df=class t extends AS.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();ff.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 J5.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 ff.Fields.equals(r,n)}};Eo.Struct=df;df.ClassName="Struct"});var bm=m((cie,IS)=>{"use strict";c();var gf="qpzry9x8gf2tvdw0s3jn54khce6mua7l",Am={};for(Nu=0;Nu>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 bS(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=bS(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+=gf.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+=gf.charAt(a)}return i}function _S(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=bS(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 Z5(){var t=_S.apply(null,arguments);if(typeof t=="object")return t}function e4(t){var e=_S.apply(null,arguments);if(typeof e=="object")return e;throw new Error(e)}function yf(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 s4=rn&&rn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),o4=rn&&rn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SS=rn&&rn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&s4(e,t,r);return o4(e,t),e};Object.defineProperty(rn,"__esModule",{value:!0});rn.Address=void 0;var mf=SS(bm()),bo=SS(Be()),_m="erd",Im=32,a4="0".repeat(16),Sm=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!=Im)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==Im}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=mf.decode(e)}catch(s){throw new bo.ErrAddressCannotCreate(e,s)}let n=r.prefix;if(n!=_m)throw new bo.ErrAddressBadHrp(_m,n);let i=h.Buffer.from(mf.fromWords(r.words));if(i.length!=Im)throw new bo.ErrAddressCannotCreate(e);return t.fromValidHex(i.toString("hex"))}hex(){return this.isEmpty()?"":this.valueHex}bech32(){if(this.isEmpty())return"";let e=mf.toWords(this.pubkey());return mf.encode(_m,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(a4)}};rn.Address=Sm});var Io=m(_o=>{"use strict";c();Object.defineProperty(_o,"__esModule",{value:!0});_o.AddressValue=_o.AddressType=void 0;var u4=ht(),TS=_t(),Ou=class t extends TS.PrimitiveType{constructor(){super("Address")}getClassName(){return t.ClassName}};_o.AddressType=Ou;Ou.ClassName="AddressType";var wf=class t extends TS.PrimitiveValue{constructor(e){super(new Ou),this.value=new u4.Address(e.bech32())}getClassName(){return t.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};_o.AddressValue=wf;wf.ClassName="AddressValue"});var vf=m(So=>{"use strict";c();Object.defineProperty(So,"__esModule",{value:!0});So.OptionalValue=So.OptionalType=void 0;var c4=gr(),Du=_t(),Pu=class t extends Du.Type{constructor(e){super("Optional",[e],Du.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(Du.NullType.ClassName);return r||n}};So.OptionalType=Pu;Pu.ClassName="OptionalType";var Ef=class t extends Du.TypedValue{constructor(e,r=null){super(e),this.value=r}getClassName(){return t.ClassName}static newMissing(){let e=new Pu(new Du.NullType);return new t(e)}isSet(){return!!this.value}getTypedValue(){return c4.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=Ef;Ef.ClassName="OptionalValue"});var Bu=m(To=>{"use strict";c();Object.defineProperty(To,"__esModule",{value:!0});To.BooleanValue=To.BooleanType=void 0;var CS=_t(),Ru=class t extends CS.PrimitiveType{constructor(){super("bool")}getClassName(){return t.ClassName}};To.BooleanType=Ru;Ru.ClassName="BooleanType";var Af=class t extends CS.PrimitiveValue{constructor(e){super(new Ru),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}};To.BooleanValue=Af;Af.ClassName="BooleanValue"});var di=m(Co=>{"use strict";c();Object.defineProperty(Co,"__esModule",{value:!0});Co.BytesValue=Co.BytesType=void 0;var xS=_t(),Lu=class t extends xS.PrimitiveType{constructor(){super("bytes")}getClassName(){return t.ClassName}};Co.BytesType=Lu;Lu.ClassName="BytesType";var bf=class t extends xS.PrimitiveValue{constructor(e){super(new Lu),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()}};Co.BytesValue=bf;bf.ClassName="BytesValue"});var OS=m(xo=>{"use strict";c();Object.defineProperty(xo,"__esModule",{value:!0});xo.CodeMetadataValue=xo.CodeMetadataType=void 0;var NS=_t(),_f=class extends NS.PrimitiveType{constructor(){super("CodeMetadata")}};xo.CodeMetadataType=_f;var Tm=class extends NS.PrimitiveValue{constructor(e){super(new _f),this.value=e}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};xo.CodeMetadataValue=Tm});var Sf=m(No=>{"use strict";c();Object.defineProperty(No,"__esModule",{value:!0});No.CompositeValue=No.CompositeType=void 0;var l4=gr(),Cm=_t(),Fu=class t extends Cm.Type{constructor(...e){super("Composite",e,Cm.TypeCardinality.variable(e.length))}getClassName(){return t.ClassName}};No.CompositeType=Fu;Fu.ClassName="CompositeType";var If=class t extends Cm.TypedValue{constructor(e,r){super(e),l4.guardLength(r,e.getTypeParameters().length),this.items=r}getClassName(){return t.ClassName}static fromItems(...e){let r=e.map(i=>i.getType()),n=new Fu(...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(Tf,"__esModule",{value:!0});Tf.CollectionOfTypedValues=void 0;var xm=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(nn,"__esModule",{value:!0});nn.List=nn.OptionValue=nn.ListType=nn.OptionType=void 0;var f4=gr(),h4=Nm(),vs=_t(),Es=class t extends vs.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(vs.NullType.ClassName);return r||n}};nn.OptionType=Es;Es.ClassName="OptionType";var Mu=class t extends vs.Type{constructor(e){super("List",[e])}getClassName(){return t.ClassName}};nn.ListType=Mu;Mu.ClassName="ListType";var Cf=class t extends vs.TypedValue{constructor(e,r=null){super(e),this.value=r}getClassName(){return t.ClassName}static newMissing(){let e=new Es(new vs.NullType);return new t(e)}static newMissingTyped(e){return new t(new Es(e))}static newProvided(e){let r=new Es(e.getType());return new t(r,e)}isSet(){return!!this.value}getTypedValue(){return f4.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}};nn.OptionValue=Cf;Cf.ClassName="OptionValue";var xf=class t extends vs.TypedValue{constructor(e,r){super(e),this.backingCollection=new h4.CollectionOfTypedValues(r)}getClassName(){return t.ClassName}static fromItems(e){if(e.length==0)return new t(new vs.TypePlaceholder,[]);let r=e[0].getType(),n=new Mu(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)}};nn.List=xf;xf.ClassName="List"});var Df=m(Oo=>{"use strict";c();Object.defineProperty(Oo,"__esModule",{value:!0});Oo.ArrayVec=Oo.ArrayVecType=void 0;var DS=gr(),d4=Nm(),PS=_t(),Nf=class t extends PS.Type{constructor(e,r){super("Array",[r]),DS.guardTrue(e>0,"array length > 0"),this.length=e}getClassName(){return t.ClassName}};Oo.ArrayVecType=Nf;Nf.ClassName="ArrayVecType";var Of=class t extends PS.TypedValue{constructor(e,r){super(e),DS.guardLength(r,e.length),this.backingCollection=new d4.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=Of;Of.ClassName="ArrayVec"});var Vu=m(Do=>{"use strict";c();Object.defineProperty(Do,"__esModule",{value:!0});Do.H256Value=Do.H256Type=void 0;var RS=_t(),qu=class t extends RS.PrimitiveType{constructor(){super("H256")}getClassName(){return t.ClassName}};Do.H256Type=qu;qu.ClassName="H256Type";var Pf=class t extends RS.PrimitiveValue{constructor(e){super(new qu),this.value=e}getClassName(){return t.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};Do.H256Value=Pf;Pf.ClassName="H256Value"});var Bf=m(Po=>{"use strict";c();Object.defineProperty(Po,"__esModule",{value:!0});Po.NothingValue=Po.NothingType=void 0;var BS=_t(),Hu=class t extends BS.PrimitiveType{constructor(){super("nothing")}getClassName(){return t.ClassName}};Po.NothingType=Hu;Hu.ClassName="NothingType";var Rf=class t extends BS.PrimitiveValue{constructor(){super(new Hu)}getClassName(){return t.ClassName}equals(e){return!1}valueOf(){return{}}};Po.NothingValue=Rf;Rf.ClassName="NothingValue"});var Xu=m(Ie=>{"use strict";c();var p4=Ie&&Ie.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),g4=Ie&&Ie.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),y4=Ie&&Ie.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&p4(e,t,r);return g4(e,t),e},m4=Ie&&Ie.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ie,"__esModule",{value:!0});Ie.BigIntValue=Ie.BigUIntValue=Ie.I64Value=Ie.U64Value=Ie.I32Value=Ie.U32Value=Ie.I16Value=Ie.U16Value=Ie.I8Value=Ie.U8Value=Ie.NumericalValue=Ie.BigIntType=Ie.BigUIntType=Ie.I64Type=Ie.U64Type=Ie.I32Type=Ie.U32Type=Ie.I16Type=Ie.U16Type=Ie.I8Type=Ie.U8Type=Ie.NumericalType=void 0;var LS=y4(Be()),FS=_t(),As=m4(Gt()),or=class t extends FS.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()}};Ie.NumericalType=or;or.ClassName="NumericalType";var Gu=class t extends or{constructor(){super("u8",1,!1)}getClassName(){return t.ClassName}};Ie.U8Type=Gu;Gu.ClassName="U8Type";var ju=class t extends or{constructor(){super("i8",1,!0)}getClassName(){return t.ClassName}};Ie.I8Type=ju;ju.ClassName="I8Type";var ku=class t extends or{constructor(){super("u16",2,!1)}getClassName(){return t.ClassName}};Ie.U16Type=ku;ku.ClassName="U16Type";var Qu=class t extends or{constructor(){super("i16",2,!0)}getClassName(){return t.ClassName}};Ie.I16Type=Qu;Qu.ClassName="I16Type";var Wu=class t extends or{constructor(){super("u32",4,!1)}getClassName(){return t.ClassName}};Ie.U32Type=Wu;Wu.ClassName="U32Type";var zu=class t extends or{constructor(){super("i32",4,!0)}getClassName(){return t.ClassName}};Ie.I32Type=zu;zu.ClassName="I32Type";var $u=class t extends or{constructor(){super("u64",8,!1)}getClassName(){return t.ClassName}};Ie.U64Type=$u;$u.ClassName="U64Type";var Ku=class t extends or{constructor(){super("i64",8,!0)}getClassName(){return t.ClassName}};Ie.I64Type=Ku;Ku.ClassName="I64Type";var Yu=class t extends or{constructor(){super("BigUint",0,!1)}getClassName(){return t.ClassName}};Ie.BigUIntType=Yu;Yu.ClassName="BigUIntType";var Ju=class t extends or{constructor(){super("Bigint",0,!0)}getClassName(){return t.ClassName}};Ie.BigIntType=Ju;Ju.ClassName="BigIntType";var ar=class t extends FS.PrimitiveValue{constructor(e,r){if(super(e),this.value=new As.default(r),this.sizeInBytes=e.sizeInBytes,this.withSign=e.withSign,this.value.isNaN())throw new LS.ErrInvalidArgument(`not a number: ${r}`);if(!this.withSign&&this.value.isNegative())throw new LS.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()}};Ie.NumericalValue=ar;ar.ClassName="NumericalValue";var Lf=class t extends ar{constructor(e){super(new Gu,new As.default(e))}getClassName(){return t.ClassName}};Ie.U8Value=Lf;Lf.ClassName="U8Value";var Ff=class t extends ar{constructor(e){super(new ju,new As.default(e))}getClassName(){return t.ClassName}};Ie.I8Value=Ff;Ff.ClassName="I8Value";var Mf=class t extends ar{constructor(e){super(new ku,new As.default(e))}getClassName(){return t.ClassName}};Ie.U16Value=Mf;Mf.ClassName="U16Value";var Uf=class t extends ar{constructor(e){super(new Qu,new As.default(e))}getClassName(){return t.ClassName}};Ie.I16Value=Uf;Uf.ClassName="I16Value";var qf=class t extends ar{constructor(e){super(new Wu,new As.default(e))}getClassName(){return t.ClassName}};Ie.U32Value=qf;qf.ClassName="U32Value";var Vf=class t extends ar{constructor(e){super(new zu,new As.default(e))}getClassName(){return t.ClassName}};Ie.I32Value=Vf;Vf.ClassName="I32Value";var Hf=class t extends ar{constructor(e){super(new $u,e)}getClassName(){return t.ClassName}};Ie.U64Value=Hf;Hf.ClassName="U64Value";var Gf=class t extends ar{constructor(e){super(new Ku,e)}getClassName(){return t.ClassName}};Ie.I64Value=Gf;Gf.ClassName="I64Value";var jf=class t extends ar{constructor(e){super(new Yu,e)}getClassName(){return t.ClassName}};Ie.BigUIntValue=jf;jf.ClassName="BigUIntValue";var kf=class t extends ar{constructor(e){super(new Ju,e)}getClassName(){return t.ClassName}};Ie.BigIntValue=kf;kf.ClassName="BigIntValue"});var Wf=m(Ro=>{"use strict";c();Object.defineProperty(Ro,"__esModule",{value:!0});Ro.StringValue=Ro.StringType=void 0;var MS=_t(),Zu=class t extends MS.PrimitiveType{constructor(){super("utf-8 string")}getClassName(){return t.ClassName}};Ro.StringType=Zu;Zu.ClassName="StringType";var Qf=class t extends MS.PrimitiveValue{constructor(e){super(new Zu),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=Qf;Qf.ClassName="StringValue"});var Lo=m(Bo=>{"use strict";c();Object.defineProperty(Bo,"__esModule",{value:!0});Bo.TokenIdentifierValue=Bo.TokenIdentifierType=void 0;var US=_t(),w4="EGLD",ec=class t extends US.PrimitiveType{constructor(){super("TokenIdentifier")}getClassName(){return t.ClassName}};Bo.TokenIdentifierType=ec;ec.ClassName="TokenIdentifierType";var zf=class t extends US.PrimitiveValue{constructor(e){super(new ec),this.value=e}static egld(){return new t(w4)}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=zf;zf.ClassName="TokenIdentifierValue"});var Kf=m(_r=>{"use strict";c();var E4=_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]}),v4=_r&&_r.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),A4=_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)&&E4(e,t,r);return v4(e,t),e};Object.defineProperty(_r,"__esModule",{value:!0});_r.Tuple=_r.TupleType=void 0;var b4=A4(Be()),qS=wo(),VS=vo(),tc=class t extends VS.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 qS.FieldDefinition(HS(i),"anonymous tuple field",n))}};_r.TupleType=tc;tc.ClassName="TupleType";function HS(t){return`field${t}`}var $f=class t extends VS.Struct{constructor(e,r){super(e,r)}getClassName(){return t.ClassName}static fromItems(e){if(e.length<1)throw new b4.ErrTypingSystem("bad tuple items");let r=e.map(s=>s.getType()),n=new tc(...r),i=e.map((s,o)=>new qS.Field(s,HS(o)));return new t(n,i)}};_r.Tuple=$f;$f.ClassName="Tuple"});var Xf=m(Mo=>{"use strict";c();Object.defineProperty(Mo,"__esModule",{value:!0});Mo.VariadicValue=Mo.VariadicType=void 0;var Yf=_t(),Fo=class t extends Yf.Type{constructor(e){super("Variadic",[e],Yf.TypeCardinality.variable())}getClassName(){return t.ClassName}};Mo.VariadicType=Fo;Fo.ClassName="VariadicType";var Jf=class t extends Yf.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 Yf.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 _4=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]}),I4=sn&&sn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),S4=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)&&_4(e,t,r);return I4(e,t),e};Object.defineProperty(sn,"__esModule",{value:!0});sn.TypeMapper=void 0;var GS=S4(Be()),T4=Io(),Om=vf(),C4=Bu(),x4=di(),N4=OS(),Zf=Sf(),Dm=xu(),O4=wo(),jS=Uu(),pi=Df(),D4=Vu(),kS=Bf(),Ir=Xu(),P4=Wf(),QS=vo(),WS=Lo(),gi=Kf(),Pm=Xf(),Rm=class{constructor(e=[]){this.openTypesFactories=new Map([["Option",(...r)=>new jS.OptionType(r[0])],["List",(...r)=>new jS.ListType(r[0])],["VarArgs",(...r)=>new Pm.VariadicType(r[0])],["MultiResultVec",(...r)=>new Pm.VariadicType(r[0])],["variadic",(...r)=>new Pm.VariadicType(r[0])],["OptionalArg",(...r)=>new Om.OptionalType(r[0])],["optional",(...r)=>new Om.OptionalType(r[0])],["OptionalResult",(...r)=>new Om.OptionalType(r[0])],["multi",(...r)=>new Zf.CompositeType(...r)],["MultiArg",(...r)=>new Zf.CompositeType(...r)],["MultiResult",(...r)=>new Zf.CompositeType(...r)],["multi",(...r)=>new Zf.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 C4.BooleanType],["bytes",new x4.BytesType],["Address",new T4.AddressType],["H256",new D4.H256Type],["utf-8 string",new P4.StringType],["TokenIdentifier",new WS.TokenIdentifierType],["EgldOrEsdtTokenIdentifier",new WS.TokenIdentifierType],["CodeMetadata",new N4.CodeMetadataType],["nothing",new kS.NothingType],["AsyncCall",new kS.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 GS.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(Dm.EnumType.ClassName)?this.mapEnumType(e):e.hasExactClass(QS.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 QS.StructType(e.getName(),r)}mapEnumType(e){let r=e.variants.map(i=>new Dm.EnumVariantDefinition(i.name,i.discriminant,this.mappedFields(i.getFieldsDefinitions())));return new Dm.EnumType(e.getName(),r)}mappedFields(e){return e.map(r=>new O4.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 GS.ErrTypingSystem(`Cannot map the generic type "${e.getName()}" to a known type`);return i(...n)}};sn.TypeMapper=Rm});var JS=m(on=>{"use strict";c();var R4=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]}),B4=on&&on.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),L4=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)&&R4(e,t,r);return B4(e,t),e};Object.defineProperty(on,"__esModule",{value:!0});on.AbiRegistry=void 0;var zS=L4(Be()),Lm=gr(),rc=gm(),$S=xu(),KS=vo(),F4=Bm(),M4="?",Fm=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||M4,n=e.constructor||{},i=e.endpoints||[],s=e.types||{},o=rc.EndpointDefinition.fromJSON(Object.assign({name:"constructor"},n)),a=i.map(d=>rc.EndpointDefinition.fromJSON(d)),u=[];for(let d in s){let g=s[d];if(g.type=="struct")u.push(KS.StructType.fromJSON({name:d,fields:g.fields}));else if(g.type=="enum")u.push($S.EnumType.fromJSON({name:d,variants:g.variants}));else throw new zS.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(KS.StructType.ClassName));return Lm.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($S.EnumType.ClassName));return Lm.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 Lm.guardValueIsSetWithMessage(`endpoint [${e}] not found`,r),r}remapToKnownTypes(){let e=new F4.TypeMapper([]),r=[];for(let o of this.customTypes)this.mapCustomTypeDepthFirst(o,this.customTypes,e,r);if(this.customTypes.length!=r.length)throw new zS.ErrTypingSystem("Did not re-map all custom types");let n=YS(this.constructorDefinition,e),i=[];for(let o of this.endpoints)i.push(YS(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)}};on.AbiRegistry=Fm;function YS(t,e){let r=t.input.map(i=>new rc.EndpointParameterDefinition(i.name,i.description,e.mapType(i.type))),n=t.output.map(i=>new rc.EndpointParameterDefinition(i.name,i.description,e.mapType(i.type)));return new rc.EndpointDefinition(t.name,r,n,t.modifiers)}});var ZS=m(Uo=>{"use strict";c();Object.defineProperty(Uo,"__esModule",{value:!0});Uo.createListOfTokenIdentifiers=Uo.createListOfAddresses=void 0;var U4=Io(),XS=Uu(),q4=Lo();function V4(t){let e=t.map(n=>new U4.AddressValue(n));return XS.List.fromItems(e)}Uo.createListOfAddresses=V4;function H4(t){let e=t.map(n=>new q4.TokenIdentifierValue(n));return XS.List.fromItems(e)}Uo.createListOfTokenIdentifiers=H4});var dT=m(zt=>{"use strict";c();var G4=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]}),j4=zt&&zt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),k4=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)&&G4(e,t,r);return j4(e,t),e};Object.defineProperty(zt,"__esModule",{value:!0});zt.onPrimitiveTypeSelect=zt.onPrimitiveValueSelect=zt.onTypedValueSelect=zt.onTypeSelect=void 0;var th=k4(Be()),eT=Io(),tT=Bu(),rT=di(),nT=xu(),eh=Uu(),iT=Vu(),sT=Xu(),oT=Bf(),aT=vo(),uT=Lo(),cT=Kf(),lT=_t(),fT=Df(),hT=Wf();function Q4(t,e){if(t.hasExactClass(eh.OptionType.ClassName))return e.onOption();if(t.hasExactClass(eh.ListType.ClassName))return e.onList();if(t.hasExactClass(fT.ArrayVecType.ClassName))return e.onArray();if(t.hasClassOrSuperclass(lT.PrimitiveType.ClassName))return e.onPrimitive();if(t.hasExactClass(aT.StructType.ClassName))return e.onStruct();if(t.hasExactClass(cT.TupleType.ClassName))return e.onTuple();if(t.hasExactClass(nT.EnumType.ClassName))return e.onEnum();if(e.onOther)return e.onOther();throw new th.ErrTypingSystem(`type isn't known: ${t}`)}zt.onTypeSelect=Q4;function W4(t,e){if(t.hasClassOrSuperclass(lT.PrimitiveValue.ClassName))return e.onPrimitive();if(t.hasExactClass(eh.OptionValue.ClassName))return e.onOption();if(t.hasExactClass(eh.List.ClassName))return e.onList();if(t.hasExactClass(fT.ArrayVec.ClassName))return e.onArray();if(t.hasExactClass(aT.Struct.ClassName))return e.onStruct();if(t.hasExactClass(cT.Tuple.ClassName))return e.onTuple();if(t.hasExactClass(nT.EnumValue.ClassName))return e.onEnum();if(e.onOther)return e.onOther();throw new th.ErrTypingSystem(`value isn't typed: ${t}`)}zt.onTypedValueSelect=W4;function z4(t,e){if(t.hasExactClass(tT.BooleanValue.ClassName))return e.onBoolean();if(t.hasClassOrSuperclass(sT.NumericalValue.ClassName))return e.onNumerical();if(t.hasExactClass(eT.AddressValue.ClassName))return e.onAddress();if(t.hasExactClass(rT.BytesValue.ClassName))return e.onBytes();if(t.hasExactClass(hT.StringValue.ClassName))return e.onString();if(t.hasExactClass(iT.H256Value.ClassName))return e.onH256();if(t.hasExactClass(uT.TokenIdentifierValue.ClassName))return e.onTypeIdentifier();if(t.hasExactClass(oT.NothingValue.ClassName))return e.onNothing();if(e.onOther)return e.onOther();throw new th.ErrTypingSystem(`value isn't a primitive: ${t.getType()}`)}zt.onPrimitiveValueSelect=z4;function $4(t,e){if(t.hasExactClass(tT.BooleanType.ClassName))return e.onBoolean();if(t.hasClassOrSuperclass(sT.NumericalType.ClassName))return e.onNumerical();if(t.hasExactClass(eT.AddressType.ClassName))return e.onAddress();if(t.hasExactClass(rT.BytesType.ClassName))return e.onBytes();if(t.hasExactClass(hT.StringType.ClassName))return e.onString();if(t.hasExactClass(iT.H256Type.ClassName))return e.onH256();if(t.hasExactClass(uT.TokenIdentifierType.ClassName))return e.onTokenIndetifier();if(t.hasExactClass(oT.NothingType.ClassName))return e.onNothing();if(e.onOther)return e.onOther();throw new th.ErrTypingSystem(`type isn't a known primitive: ${t}`)}zt.onPrimitiveTypeSelect=$4});var Ot=m(qe=>{"use strict";c();var K4=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]}),it=qe&&qe.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&K4(e,t,r)};Object.defineProperty(qe,"__esModule",{value:!0});it(JS(),qe);it(Io(),qe);it(vf(),qe);it(Bu(),qe);it(di(),qe);it(Sf(),qe);it(gm(),qe);it(xu(),qe);it(ZS(),qe);it(wo(),qe);it(Uu(),qe);it(Df(),qe);it(Vu(),qe);it(dT(),qe);it(Bf(),qe);it(Xu(),qe);it(Wf(),qe);it(vo(),qe);it(Lo(),qe);it(Kf(),qe);it(sf(),qe);it(Bm(),qe);it(_t(),qe);it(Xf(),qe)});var gT=m(an=>{"use strict";c();var Y4=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]}),J4=an&&an.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),X4=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)&&Y4(e,t,r);return J4(e,t),e};Object.defineProperty(an,"__esModule",{value:!0});an.OptionValueBinaryCodec=void 0;var pT=X4(Be()),rh=Ot(),Mm=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){if(e[0]==0)return[rh.OptionValue.newMissingTyped(r),1];if(e[0]!=1)throw new pT.ErrCodec("invalid buffer for optional value");let[n,i]=this.binaryCodec.decodeNested(e.slice(1),r);return[rh.OptionValue.newProvided(n),i+1]}decodeTopLevel(e,r){if(e.length==0)return new rh.OptionValue(r);if(e[0]!=1)throw new pT.ErrCodec("invalid buffer for optional value");let[n,i]=this.binaryCodec.decodeNested(e.slice(1),r);return new rh.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([])}};an.OptionValueBinaryCodec=Mm});var yT=m(nh=>{"use strict";c();Object.defineProperty(nh,"__esModule",{value:!0});nh.AddressBinaryCodec=void 0;var Z4=ht(),eq=Ot(),Um=class{decodeNested(e){let r=e.slice(0,32),n=new Z4.Address(r);return[new eq.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()}};nh.AddressBinaryCodec=Um});var wT=m(un=>{"use strict";c();var tq=un&&un.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.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=un&&un.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nq=un&&un.__importStar||function(t){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};Object.defineProperty(un,"__esModule",{value:!0});un.BooleanBinaryCodec=void 0;var iq=nq(Be()),mT=Ot(),nc=class t{decodeNested(e){let r=e.readUInt8(0);return[new mT.BooleanValue(r==t.TRUE),1]}decodeTopLevel(e){if(e.length>1)throw new iq.ErrInvalidArgument("buffer should be of size <= 1");let r=e[0];return new mT.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([])}};un.BooleanBinaryCodec=nc;nc.TRUE=1;nc.FALSE=0});var sh=m(ih=>{"use strict";c();Object.defineProperty(ih,"__esModule",{value:!0});ih.SizeOfU32=void 0;ih.SizeOfU32=4});var oh=m(cn=>{"use strict";c();var sq=cn&&cn.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(cn,"__esModule",{value:!0});cn.zeroPadStringIfOddLength=cn.isPaddedHex=cn.numberToPaddedHex=void 0;var oq=sq(Gt());function aq(t){let e=new oq.default(t).toString(16);return ET(e)}cn.numberToPaddedHex=aq;function uq(t){t=t||"";let e=h.Buffer.from(t,"hex").toString("hex");return t.toUpperCase()==e.toUpperCase()}cn.isPaddedHex=uq;function ET(t){return t=t||"",t.length%2==1?"0"+t:t}cn.zeroPadStringIfOddLength=ET});var ic=m(It=>{"use strict";c();var cq=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 qm=cq(Gt()),lq=oh();function vT(t,e=0){return t[e]>>7==1}It.isMsbOne=vT;function fq(t,e=0){return!vT(t,e)}It.isMsbZero=fq;function hq(t){let e=h.Buffer.alloc(t.length);return t.copy(e),e}It.cloneBuffer=hq;function dq(t){let e=t.toString("hex");return new qm.default(`0x${e}`,16)}It.bufferToBigInt=dq;function pq(t){let e=AT(t);return h.Buffer.from(e,"hex")}It.bigIntToBuffer=pq;function AT(t){return t=new qm.default(t),t?(t.isNegative()&&(t=t.multipliedBy(new qm.default(-1))),lq.numberToPaddedHex(t)):""}It.getHexMagnitudeOfBigInt=AT;function gq(t){for(let e=0;e{"use strict";c();var mq=qo&&qo.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(qo,"__esModule",{value:!0});qo.NumericalBinaryCodec=void 0;var sc=mq(Gt()),Vm=Ot(),bT=sh(),mt=ic(),Hm=class{decodeNested(e,r){let n=0,i=r.sizeInBytes;i||(n=bT.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 Vm.NumericalValue(r,new sc.default(0));if(!r.withSign||mt.isMsbZero(n)){let l=mt.bufferToBigInt(n);return new Vm.NumericalValue(r,l)}mt.flipBufferBitsInPlace(n);let u=mt.bufferToBigInt(n).multipliedBy(new sc.default(-1)).minus(new sc.default(1));return new Vm.NumericalValue(r,u)}encodeNested(e){if(e.sizeInBytes)return this.encodeNestedFixedSize(e,e.sizeInBytes);let r=this.encodeTopLevel(e),n=h.Buffer.alloc(bT.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 sc.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 sc.default(1)),n=mt.bigIntToBuffer(r);return mt.flipBufferBitsInPlace(n),mt.isMsbZero(n)&&(n=mt.prependByteToBuffer(n,255)),n}};qo.NumericalBinaryCodec=Hm});var IT=m(ah=>{"use strict";c();Object.defineProperty(ah,"__esModule",{value:!0});ah.H256BinaryCodec=void 0;var wq=Vu(),Gm=class{decodeNested(e){let r=e.slice(0,32);return[new wq.H256Value(r),32]}decodeTopLevel(e){let[r,n]=this.decodeNested(e);return r}encodeNested(e){return e.valueOf()}encodeTopLevel(e){return e.valueOf()}};ah.H256BinaryCodec=Gm});var lh=m(ch=>{"use strict";c();Object.defineProperty(ch,"__esModule",{value:!0});ch.BytesBinaryCodec=void 0;var ST=di(),uh=sh(),jm=class{decodeNested(e){let r=e.readUInt32BE(0),n=e.slice(uh.SizeOfU32,uh.SizeOfU32+r);return[new ST.BytesValue(n),uh.SizeOfU32+r]}decodeTopLevel(e){return new ST.BytesValue(e)}encodeNested(e){let r=h.Buffer.alloc(uh.SizeOfU32);return r.writeUInt32BE(e.getLength()),h.Buffer.concat([r,e.valueOf()])}encodeTopLevel(e){return e.valueOf()}};ch.BytesBinaryCodec=jm});var CT=m(fh=>{"use strict";c();Object.defineProperty(fh,"__esModule",{value:!0});fh.TokenIdentifierCodec=void 0;var Eq=di(),TT=Lo(),vq=lh(),km=class{constructor(){this.bytesCodec=new vq.BytesBinaryCodec}decodeNested(e){let[r,n]=this.bytesCodec.decodeNested(e);return[new TT.TokenIdentifierValue(r.toString()),n]}decodeTopLevel(e){let r=this.bytesCodec.decodeTopLevel(e);return new TT.TokenIdentifierValue(r.toString())}encodeNested(e){let r=Eq.BytesValue.fromUTF8(e.valueOf());return this.bytesCodec.encodeNested(r)}encodeTopLevel(e){return h.Buffer.from(e.valueOf())}};fh.TokenIdentifierCodec=km});var NT=m(hh=>{"use strict";c();Object.defineProperty(hh,"__esModule",{value:!0});hh.NothingCodec=void 0;var xT=Ot(),Qm=class{decodeNested(){return[new xT.NothingValue,0]}decodeTopLevel(){return new xT.NothingValue}encodeNested(){return h.Buffer.from([])}encodeTopLevel(){return h.Buffer.from([])}};hh.NothingCodec=Qm});var DT=m(dh=>{"use strict";c();Object.defineProperty(dh,"__esModule",{value:!0});dh.StringBinaryCodec=void 0;var OT=Ot(),Aq=di(),bq=lh(),Wm=class{constructor(){this.bytesBinaryCodec=new bq.BytesBinaryCodec}decodeNested(e){let[r,n]=this.bytesBinaryCodec.decodeNested(e);return[new OT.StringValue(r.valueOf().toString()),n]}decodeTopLevel(e){return new OT.StringValue(e.toString())}encodeNested(e){let r=Aq.BytesValue.fromUTF8(e.valueOf());return this.bytesBinaryCodec.encodeNested(r)}encodeTopLevel(e){return h.Buffer.from(e.valueOf())}};dh.StringBinaryCodec=Wm});var PT=m(gh=>{"use strict";c();Object.defineProperty(gh,"__esModule",{value:!0});gh.PrimitiveBinaryCodec=void 0;var ph=Ot(),_q=yT(),Iq=wT(),Sq=_T(),Tq=IT(),Cq=lh(),xq=CT(),Nq=NT(),Oq=DT(),zm=class{constructor(e){this.binaryCodec=e,this.booleanCodec=new Iq.BooleanBinaryCodec,this.numericalCodec=new Sq.NumericalBinaryCodec,this.addressCodec=new _q.AddressBinaryCodec,this.h256Codec=new Tq.H256BinaryCodec,this.bytesCodec=new Cq.BytesBinaryCodec,this.stringCodec=new Oq.StringBinaryCodec,this.tokenIdentifierCodec=new xq.TokenIdentifierCodec,this.nothingCodec=new Nq.NothingCodec}decodeNested(e,r){return ph.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 ph.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 ph.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 ph.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()})}};gh.PrimitiveBinaryCodec=zm});var LT=m(yh=>{"use strict";c();Object.defineProperty(yh,"__esModule",{value:!0});yh.ListBinaryCodec=void 0;var RT=Ot(),BT=sh(),$m=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=BT.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 RT.List(r,i)}encodeNested(e){this.binaryCodec.constraints.checkListLength(e.getLength());let r=h.Buffer.alloc(BT.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)}};yh.ListBinaryCodec=$m});var Ym=m(mh=>{"use strict";c();Object.defineProperty(mh,"__esModule",{value:!0});mh.FieldsBinaryCodec=void 0;var Dq=Ot(),Km=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 Dq.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)}};mh.FieldsBinaryCodec=Km});var Xm=m(wh=>{"use strict";c();Object.defineProperty(wh,"__esModule",{value:!0});wh.StructBinaryCodec=void 0;var Pq=Ot(),Rq=Ym(),Jm=class{constructor(e){this.fieldsCodec=new Rq.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 Pq.Struct(r,i),s]}encodeNested(e){let r=e.getFields();return this.fieldsCodec.encodeNested(r)}encodeTopLevel(e){return this.encodeNested(e)}};wh.StructBinaryCodec=Jm});var FT=m(vh=>{"use strict";c();Object.defineProperty(vh,"__esModule",{value:!0});vh.EnumBinaryCodec=void 0;var Eh=Ot(),Bq=Ym(),Zm=class{constructor(e){this.binaryCodec=e,this.fieldsCodec=new Bq.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 Eh.EnumValue(r,s,a),i+u]}readDiscriminant(e){let[r,n]=this.binaryCodec.decodeNested(e,new Eh.U8Type);return[r.valueOf(),n]}encodeNested(e){let r=new Eh.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 Eh.U8Value(e.discriminant),o=n?this.binaryCodec.encodeNested(s):this.binaryCodec.encodeTopLevel(s);return h.Buffer.concat([o,i])}};vh.EnumBinaryCodec=Zm});var MT=m(Ah=>{"use strict";c();Object.defineProperty(Ah,"__esModule",{value:!0});Ah.TupleBinaryCodec=void 0;var Lq=Xm(),ew=class{constructor(e){this.structCodec=new Lq.StructBinaryCodec(e)}decodeTopLevel(e,r){return this.structCodec.decodeTopLevel(e,r)}decodeNested(e,r){return this.structCodec.decodeNested(e,r)}encodeNested(e){return this.structCodec.encodeNested(e)}encodeTopLevel(e){return this.structCodec.encodeTopLevel(e)}};Ah.TupleBinaryCodec=ew});var UT=m(bh=>{"use strict";c();Object.defineProperty(bh,"__esModule",{value:!0});bh.ArrayVecBinaryCodec=void 0;var Fq=Ot(),tw=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 Mq=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]}),Uq=Sr&&Sr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qq=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)&&Mq(e,t,r);return Uq(e,t),e};Object.defineProperty(Sr,"__esModule",{value:!0});Sr.BinaryCodecConstraints=Sr.BinaryCodec=void 0;var qT=qq(Be()),_h=Ot(),VT=gr(),Vq=gT(),Hq=PT(),Gq=LT(),jq=Xm(),kq=FT(),Qq=MT(),Wq=UT(),rw=class{constructor(e=null){this.constraints=e||new Ih,this.optionCodec=new Vq.OptionValueBinaryCodec(this),this.listCodec=new Gq.ListBinaryCodec(this),this.arrayCodec=new Wq.ArrayVecBinaryCodec(this),this.primitiveCodec=new Hq.PrimitiveBinaryCodec(this),this.structCodec=new jq.StructBinaryCodec(this),this.tupleCodec=new Qq.TupleBinaryCodec(this),this.enumCodec=new kq.EnumBinaryCodec(this)}decodeTopLevel(e,r){return this.constraints.checkBufferLength(e),_h.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]=_h.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 VT.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),_h.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 VT.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),_h.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=rw;var Ih=class{constructor(e){this.maxBufferLength=e?.maxBufferLength||256e3,this.maxListLength=e?.maxListLength||128e3}checkBufferLength(e){if(e.length>this.maxBufferLength)throw new qT.ErrCodec(`Buffer too large: ${e.length} > ${this.maxBufferLength}`)}checkListLength(e){if(e>this.maxListLength)throw new qT.ErrCodec(`List too large: ${e} > ${this.maxListLength}`)}};Sr.BinaryCodecConstraints=Ih});var HT=m(Tr=>{"use strict";c();var zq=Tr&&Tr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Tr,"__esModule",{value:!0});Tr.decodeBigNumber=Tr.decodeString=Tr.decodeBool=Tr.decodeUnsignedNumber=void 0;var $q=zq(Gt()),Sh=Ot(),Kq=nw(),Th=new Kq.BinaryCodec;function Yq(t){let e=Th.decodeTopLevel(t,new Sh.BigUIntType);return Number(e.valueOf())}Tr.decodeUnsignedNumber=Yq;function Jq(t){return!!Th.decodeTopLevel(t,new Sh.BooleanType).valueOf()}Tr.decodeBool=Jq;function Xq(t){let e=Th.decodeTopLevel(t,new Sh.BytesType);return String(e.valueOf())}Tr.decodeString=Xq;function Zq(t){let e=Th.decodeTopLevel(t,new Sh.BigUIntType);return new $q.default(e.valueOf())}Tr.decodeBigNumber=Zq});var iw=m(yi=>{"use strict";c();var eV=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]}),GT=yi&&yi.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&eV(e,t,r)};Object.defineProperty(yi,"__esModule",{value:!0});GT(nw(),yi);GT(HT(),yi)});var Vo=m(Ch=>{"use strict";c();Object.defineProperty(Ch,"__esModule",{value:!0});Ch.ArgSerializer=void 0;var jT=ms(),tV=iw(),sw=vf(),ow=Sf(),aw=Xf(),rV={codec:new tV.BinaryCodec},uw=class{constructor(e){e=Object.assign(Object.assign({},rV),e),this.codec=e.codec}stringToValues(e,r){let n=this.stringToBuffers(e);return this.buffersToValues(n,r)}stringToBuffers(e){return e.split(jT.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(jT.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(sw.OptionalValue.ClassName)){let o=s;o.isSet()&&i(o.getTypedValue())}else if(s.hasExactClass(aw.VariadicValue.ClassName)){let o=s;for(let a of o.getItems())i(a)}else if(s.hasExactClass(ow.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}};Ch.ArgSerializer=uw});var Oh=m(Nh=>{"use strict";c();Object.defineProperty(Nh,"__esModule",{value:!0});Nh.Compatibility=void 0;var nV=ht(),xh=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()==nV.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.`))}};Nh.Compatibility=xh;xh.areWarningsEnabled=!0});var kT=m(ln=>{"use strict";c();var iV=ln&&ln.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),sV=ln&&ln.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oV=ln&&ln.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&iV(e,t,r);return sV(e,t),e};Object.defineProperty(ln,"__esModule",{value:!0});ln.Hash=void 0;var aV=oV(Be()),cw=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 aV.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}};ln.Hash=cw});var oc=m(Cr=>{"use strict";c();var uV=Cr&&Cr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),cV=Cr&&Cr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lV=Cr&&Cr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&uV(e,t,r);return cV(e,t),e};Object.defineProperty(Cr,"__esModule",{value:!0});Cr.TransactionOptions=Cr.TransactionVersion=void 0;var Gr=ms(),QT=lV(Be()),lw=class t{constructor(e){if(e=Number(e),e<1)throw new QT.ErrTransactionVersionInvalid(e);this.value=e}static withDefaultVersion(){return new t(Gr.TRANSACTION_VERSION_DEFAULT)}static withTxOptions(){return new t(Gr.TRANSACTION_VERSION_WITH_OPTIONS)}valueOf(){return this.value}};Cr.TransactionVersion=lw;var fw=class t{constructor(e){if(e=Number(e),e<0)throw new QT.ErrTransactionOptionsInvalid(e);this.value=e}static withDefaultOptions(){return new t(Gr.TRANSACTION_OPTIONS_DEFAULT)}static withOptions(e){let r=0;return e.hashSign&&(r|=Gr.TRANSACTION_OPTIONS_TX_HASH_SIGN),e.guarded&&(r|=Gr.TRANSACTION_OPTIONS_TX_GUARDED),new t(r)}isWithHashSign(){return(this.value&Gr.TRANSACTION_OPTIONS_TX_HASH_SIGN)==Gr.TRANSACTION_OPTIONS_TX_HASH_SIGN}isWithGuardian(){return(this.value&Gr.TRANSACTION_OPTIONS_TX_GUARDED)==Gr.TRANSACTION_OPTIONS_TX_GUARDED}setWithHashSign(){this.value|=Gr.TRANSACTION_OPTIONS_TX_HASH_SIGN}setWithGuardian(){this.value|=Gr.TRANSACTION_OPTIONS_TX_GUARDED}valueOf(){return this.value}};Cr.TransactionOptions=fw});var zT=m((Zse,WT)=>{"use strict";c();WT.exports=fV;function fV(t,e){for(var r=new Array(arguments.length-1),n=0,i=2,s=!0;i{"use strict";c();var Dh=YT;Dh.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),KT=new Array(123);for(jr=0;jr<64;)KT[Ho[jr]=jr<26?jr+65:jr<52?jr+71:jr<62?jr-4:jr-59|43]=jr++;var jr;Dh.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 $T="invalid encoding";Dh.decode=function(e,r,n){for(var i=n,s=0,o,a=0;a1)break;if((u=KT[u])===void 0)throw Error($T);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($T);return n-i};Dh.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var ZT=m((noe,XT)=>{"use strict";c();XT.exports=Ph;function Ph(){this._listeners={}}Ph.prototype.on=function(e,r,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:r,ctx:n||this}),this};Ph.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();sC.exports=eC(eC);function eC(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,tC),t.writeFloatBE=e.bind(null,rC);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,nC),t.readFloatBE=r.bind(null,iC)}(),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,tC,0,4),t.writeDoubleBE=e.bind(null,rC,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,nC,0,4),t.readDoubleBE=r.bind(null,iC,4,0)}(),t}function tC(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 rC(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 nC(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0}function iC(t,e){return(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}});var aC=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 cC=m(uC=>{"use strict";c();var hw=uC;hw.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))};hw.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 fC=m((loe,lC)=>{"use strict";c();lC.exports=hV;function hV(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 dC=m((hoe,hC)=>{"use strict";c();hC.exports=Bt;var ac=wi();function Bt(t,e){this.lo=t>>>0,this.hi=e>>>0}var bs=Bt.zero=new Bt(0,0);bs.toNumber=function(){return 0};bs.zzEncode=bs.zzDecode=function(){return this};bs.length=function(){return 1};var dV=Bt.zeroHash="\0\0\0\0\0\0\0\0";Bt.fromNumber=function(e){if(e===0)return bs;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(ac.isString(e))if(ac.Long)e=ac.Long.fromString(e);else return Bt.fromNumber(parseInt(e,10));return e.low||e.high?new Bt(e.low>>>0,e.high>>>0):bs};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 ac.Long?new ac.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===dV?bs: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 wi=m(dw=>{"use strict";c();var Ee=dw;Ee.asPromise=zT();Ee.base64=JT();Ee.EventEmitter=ZT();Ee.float=oC();Ee.inquire=aC();Ee.utf8=cC();Ee.pool=fC();Ee.LongBits=dC();Ee.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);Ee.global=Ee.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||dw;Ee.emptyArray=Object.freeze?Object.freeze([]):[];Ee.emptyObject=Object.freeze?Object.freeze({}):{};Ee.isInteger=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};Ee.isString=function(e){return typeof e=="string"||e instanceof String};Ee.isObject=function(e){return e&&typeof e=="object"};Ee.isset=Ee.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};Ee.Buffer=function(){try{var t=Ee.inquire("buffer").Buffer;return t.prototype.utf8Write?t:null}catch{return null}}();Ee._Buffer_from=null;Ee._Buffer_allocUnsafe=null;Ee.newBuffer=function(e){return typeof e=="number"?Ee.Buffer?Ee._Buffer_allocUnsafe(e):new Ee.Array(e):Ee.Buffer?Ee._Buffer_from(e):typeof Uint8Array>"u"?e:new Uint8Array(e)};Ee.Array=typeof Uint8Array<"u"?Uint8Array:Array;Ee.Long=Ee.global.dcodeIO&&Ee.global.dcodeIO.Long||Ee.global.Long||Ee.inquire("long");Ee.key2Re=/^true|false|0|1$/;Ee.key32Re=/^-?(?:0|[1-9][0-9]*)$/;Ee.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;Ee.longToHash=function(e){return e?Ee.LongBits.from(e).toHash():Ee.LongBits.zeroHash};Ee.longFromHash=function(e,r){var n=Ee.LongBits.fromHash(e);return Ee.Long?Ee.Long.fromBits(n.lo,n.hi,r):n.toNumber(!!r)};function pC(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]}};Ee.oneOfSetter=function(e){return function(r){for(var n=0;n{"use strict";c();EC.exports=Fe;var xr=wi(),pw,Rh=xr.LongBits,yC=xr.base64,mC=xr.utf8;function uc(t,e,r){this.fn=t,this.len=e,this.next=void 0,this.val=r}function yw(){}function pV(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 uc(yw,0,0),this.tail=this.head,this.states=null}var wC=function(){return xr.Buffer?function(){return(Fe.create=function(){return new pw})()}:function(){return new Fe}};Fe.create=wC();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 uc(e,r,n),this.len+=r,this};function mw(t,e,r){e[r]=t&255}function gV(t,e,r){for(;t>127;)e[r++]=t&127|128,t>>>=7;e[r]=t}function ww(t,e){this.len=t,this.next=void 0,this.val=e}ww.prototype=Object.create(uc.prototype);ww.prototype.fn=gV;Fe.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new ww((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(Ew,10,Rh.fromNumber(e)):this.uint32(e)};Fe.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function Ew(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=Rh.from(e);return this._push(Ew,r.length(),r)};Fe.prototype.int64=Fe.prototype.uint64;Fe.prototype.sint64=function(e){var r=Rh.from(e).zzEncode();return this._push(Ew,r.length(),r)};Fe.prototype.bool=function(e){return this._push(mw,1,e?1:0)};function gw(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(gw,4,e>>>0)};Fe.prototype.sfixed32=Fe.prototype.fixed32;Fe.prototype.fixed64=function(e){var r=Rh.from(e);return this._push(gw,4,r.lo)._push(gw,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 yV=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(mw,1,0);if(xr.isString(e)){var n=Fe.alloc(r=yC.length(e));yC.decode(e,n,0),e=n}return this.uint32(r)._push(yV,r,e)};Fe.prototype.string=function(e){var r=mC.length(e);return r?this.uint32(r)._push(mC.write,r,e):this._push(mw,1,0)};Fe.prototype.fork=function(){return this.states=new pV(this),this.head=this.tail=new uc(yw,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 uc(yw,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){pw=t,Fe.create=wC(),pw._configure()}});var bC=m((woe,AC)=>{"use strict";c();AC.exports=fn;var vC=vw();(fn.prototype=Object.create(vC.prototype)).constructor=fn;var Ei=wi();function fn(){vC.call(this)}fn._configure=function(){fn.alloc=Ei._Buffer_allocUnsafe,fn.writeBytesBuffer=Ei.Buffer&&Ei.Buffer.prototype instanceof Uint8Array&&Ei.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(fn.writeBytesBuffer,r,e),this};function mV(t,e,r){t.length<40?Ei.utf8.write(t,e,r):e.utf8Write?e.utf8Write(t,r):e.write(t,r)}fn.prototype.string=function(e){var r=Ei.Buffer.byteLength(e);return this.uint32(r),r&&this._push(mV,r,e),this};fn._configure()});var _w=m((voe,CC)=>{"use strict";c();CC.exports=wt;var hn=wi(),bw,SC=hn.LongBits,wV=hn.utf8;function kr(t,e){return RangeError("index out of range: "+t.pos+" + "+(e||1)+" > "+t.len)}function wt(t){this.buf=t,this.pos=0,this.len=t.length}var _C=typeof Uint8Array<"u"?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new wt(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new wt(e);throw Error("illegal buffer")},TC=function(){return hn.Buffer?function(r){return(wt.create=function(i){return hn.Buffer.isBuffer(i)?new bw(i):_C(i)})(r)}:_C};wt.create=TC();wt.prototype._slice=hn.Array.prototype.subarray||hn.Array.prototype.slice;wt.prototype.uint32=function(){var e=4294967295;return function(){if(e=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(e=(e|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,kr(this,10);return e}}();wt.prototype.int32=function(){return this.uint32()|0};wt.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(e&1)|0};function Aw(){var t=new SC(0,0),e=0;if(this.len-this.pos>4){for(;e<4;++e)if(t.lo=(t.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(this.buf[this.pos]&127)<<28)>>>0,t.hi=(t.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return t;e=0}else{for(;e<3;++e){if(this.pos>=this.len)throw kr(this);if(t.lo=(t.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(this.buf[this.pos++]&127)<>>0,t}if(this.len-this.pos>4){for(;e<5;++e)if(t.hi=(t.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t}else for(;e<5;++e){if(this.pos>=this.len)throw kr(this);if(t.hi=(t.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}wt.prototype.bool=function(){return this.uint32()!==0};function Bh(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}wt.prototype.fixed32=function(){if(this.pos+4>this.len)throw kr(this,4);return Bh(this.buf,this.pos+=4)};wt.prototype.sfixed32=function(){if(this.pos+4>this.len)throw kr(this,4);return Bh(this.buf,this.pos+=4)|0};function IC(){if(this.pos+8>this.len)throw kr(this,8);return new SC(Bh(this.buf,this.pos+=4),Bh(this.buf,this.pos+=4))}wt.prototype.float=function(){if(this.pos+4>this.len)throw kr(this,4);var e=hn.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};wt.prototype.double=function(){if(this.pos+8>this.len)throw kr(this,4);var e=hn.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e};wt.prototype.bytes=function(){var e=this.uint32(),r=this.pos,n=this.pos+e;if(n>this.len)throw kr(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(r,n):r===n?new this.buf.constructor(0):this._slice.call(this.buf,r,n)};wt.prototype.string=function(){var e=this.bytes();return wV.read(e,0,e.length)};wt.prototype.skip=function(e){if(typeof e=="number"){if(this.pos+e>this.len)throw kr(this,e);this.pos+=e}else do if(this.pos>=this.len)throw kr(this);while(this.buf[this.pos++]&128);return this};wt.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};wt._configure=function(t){bw=t,wt.create=TC(),bw._configure();var e=hn.Long?"toLong":"toNumber";hn.merge(wt.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 IC.call(this)[e](!0)},sfixed64:function(){return IC.call(this)[e](!1)}})}});var DC=m((boe,OC)=>{"use strict";c();OC.exports=_s;var NC=_w();(_s.prototype=Object.create(NC.prototype)).constructor=_s;var xC=wi();function _s(t){NC.call(this,t)}_s._configure=function(){xC.Buffer&&(_s.prototype._slice=xC.Buffer.prototype.slice)};_s.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))};_s._configure()});var RC=m((Ioe,PC)=>{"use strict";c();PC.exports=cc;var Iw=wi();(cc.prototype=Object.create(Iw.EventEmitter.prototype)).constructor=cc;function cc(t,e,r){if(typeof t!="function")throw TypeError("rpcImpl must be a function");Iw.EventEmitter.call(this),this.rpcImpl=t,this.requestDelimited=!!e,this.responseDelimited=!!r}cc.prototype.rpcCall=function t(e,r,n,i,s){if(!i)throw TypeError("request must be specified");var o=this;if(!s)return Iw.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}};cc.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var LC=m(BC=>{"use strict";c();var EV=BC;EV.Service=RC()});var MC=m((xoe,FC)=>{"use strict";c();FC.exports={}});var VC=m(qC=>{"use strict";c();var ur=qC;ur.build="minimal";ur.Writer=vw();ur.BufferWriter=bC();ur.Reader=_w();ur.BufferReader=DC();ur.util=wi();ur.rpc=LC();ur.roots=MC();ur.configure=UC;function UC(){ur.util._configure(),ur.Writer._configure(ur.BufferWriter),ur.Reader._configure(ur.BufferReader)}UC()});var GC=m((Poe,HC)=>{"use strict";c();HC.exports=VC()});var kC=m((Boe,jC)=>{"use strict";c();var Go=GC(),Lh=Go.Reader,vV=Go.Writer,J=Go.util,lc=Go.roots.default||(Go.roots.default={});lc.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 Lh||(n=new Lh(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 lc.proto.Transaction)return n;var i=new lc.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,Go.util.toJSONOptions)},e}(),t}();jC.exports=lc});var QC=m(Nr=>{"use strict";c();var AV=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]}),bV=Nr&&Nr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_V=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)&&AV(e,t,r);return bV(e,t),e},IV=Nr&&Nr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Nr,"__esModule",{value:!0});Nr.ProtoSerializer=void 0;var SV=IV(Gt()),Sw=ht(),TV=ms(),CV=_V(Be()),xV=ic(),Tw=class{serializeTransaction(e){let r=kC().proto,n=new Sw.Address(e.getReceiver().bech32()).pubkey(),i=new Sw.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()!==TV.TRANSACTION_OPTIONS_DEFAULT&&(s.Options=e.getOptions().valueOf()),e.isGuardedTransaction()){let u=e.getGuardian();s.GuardAddr=new Sw.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 SV.default(e.toString());if(r.isZero())return h.Buffer.from([0,0]);let n=xV.bigIntToBuffer(r);return n=h.Buffer.concat([h.Buffer.from([0]),n]),n}deserializeTransaction(e){throw new CV.ErrUnsupportedOperation("deserializeTransaction")}};Nr.ProtoSerializer=Tw});var WC=m(Is=>{"use strict";c();var NV=Is&&Is.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),OV=Is&&Is.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&NV(e,t,r)};Object.defineProperty(Is,"__esModule",{value:!0});OV(QC(),Is)});var Fh=m(dn=>{"use strict";c();var DV=dn&&dn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),PV=dn&&dn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),RV=dn&&dn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&DV(e,t,r);return PV(e,t),e};Object.defineProperty(dn,"__esModule",{value:!0});dn.Signature=void 0;var zC=RV(Be()),$C=64,Cw=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 zC.ErrSignatureCannotCreate(e);return t.fromValidHex(e)}static isValidHex(e){return h.Buffer.from(e,"hex").length==$C}static fromValidHex(e){let r=new t;return r.valueHex=e,r}static fromBuffer(e){if(e.length!=$C)throw new zC.ErrSignatureCannotCreate(e);return t.fromValidHex(e.toString("hex"))}hex(){return this.valueHex}};dn.Signature=Cw});var qn=m(Mh=>{"use strict";c();Object.defineProperty(Mh,"__esModule",{value:!0});Mh.TransactionPayload=void 0;var xw=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}};Mh.TransactionPayload=xw});var Nw=m((koe,KC)=>{c();Vn.notEqual=LV;Vn.notOk=FV;Vn.equal=BV;Vn.ok=Vn;KC.exports=Vn;function BV(t,e,r){Vn(t==e,r)}function LV(t,e,r){Vn(t!=e,r)}function FV(t,e){Vn(!t,e)}function Vn(t,e){if(!t)throw new Error(e||"AssertionError")}});var Ts=m(Wo=>{"use strict";c();var Ow=m0(),ko=E0(),YC=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Wo.Buffer=z;Wo.SlowBuffer=GV;Wo.INSPECT_MAX_BYTES=50;var Uh=2147483647;Wo.kMaxLength=Uh;z.TYPED_ARRAY_SUPPORT=MV();!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 MV(){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>Uh)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 Bw(t)}return ex(t,e,r)}z.poolSize=8192;function ex(t,e,r){if(typeof t=="string")return qV(t,e);if(ArrayBuffer.isView(t))return VV(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(pn(t,ArrayBuffer)||t&&pn(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(pn(t,SharedArrayBuffer)||t&&pn(t.buffer,SharedArrayBuffer)))return Pw(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=HV(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 ex(t,e,r)};Object.setPrototypeOf(z.prototype,Uint8Array.prototype);Object.setPrototypeOf(z,Uint8Array);function tx(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 UV(t,e,r){return tx(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 UV(t,e,r)};function Bw(t){return tx(t),Hn(t<0?0:Lw(t)|0)}z.allocUnsafe=function(t){return Bw(t)};z.allocUnsafeSlow=function(t){return Bw(t)};function qV(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!z.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=rx(t,e)|0,n=Hn(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function Dw(t){let e=t.length<0?0:Lw(t.length)|0,r=Hn(e);for(let n=0;n=Uh)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Uh.toString(16)+" bytes");return t|0}function GV(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(pn(e,Uint8Array)&&(e=z.from(e,e.offset,e.byteLength)),pn(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 rx(t,e){if(z.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||pn(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 Rw(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return fx(t).length;default:if(i)return n?-1:Rw(t).length;e=(""+e).toLowerCase(),i=!0}}z.byteLength=rx;function jV(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 ZV(this,e,r);case"utf8":case"utf-8":return ix(this,e,r);case"ascii":return JV(this,e,r);case"latin1":case"binary":return XV(this,e,r);case"base64":return KV(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return eH(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}z.prototype._isBuffer=!0;function Ss(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+=" ... "),""};YC&&(z.prototype[YC]=z.prototype.inspect);z.prototype.compare=function(e,r,n,i,s){if(pn(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,Mw(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:JC(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):JC(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function JC(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 kV(this,e,r,n);case"utf8":case"utf-8":return QV(this,e,r,n);case"ascii":case"latin1":case"binary":return WV(this,e,r,n);case"base64":return zV(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return $V(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 KV(t,e,r){return e===0&&r===t.length?Ow.fromByteArray(t):Ow.fromByteArray(t.slice(e,r))}function ix(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 YV(n)}var XC=4096;function YV(t){let e=t.length;if(e<=XC)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)&&fc(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)&&fc(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)&&fc(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)&&fc(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 sx(t,e,r,n,i){lx(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 ox(t,e,r,n,i){lx(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 sx(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});z.prototype.writeBigUInt64BE=vi(function(e,r=0){return ox(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 sx(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});z.prototype.writeBigInt64BE=vi(function(e,r=0){return ox(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function ax(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 ux(t,e,r,n,i){return e=+e,r=r>>>0,i||ax(t,e,r,4,34028234663852886e22,-34028234663852886e22),ko.write(t,e,r,n,23,4),r+4}z.prototype.writeFloatLE=function(e,r,n){return ux(this,e,r,!0,n)};z.prototype.writeFloatBE=function(e,r,n){return ux(this,e,r,!1,n)};function cx(t,e,r,n,i){return e=+e,r=r>>>0,i||ax(t,e,r,8,17976931348623157e292,-17976931348623157e292),ko.write(t,e,r,n,52,8),r+8}z.prototype.writeDoubleLE=function(e,r,n){return cx(this,e,r,!0,n)};z.prototype.writeDoubleBE=function(e,r,n){return cx(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=ZC(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=ZC(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);function ZC(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 tH(t,e,r){Qo(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&fc(e,t.length-(r+1))}function lx(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 jo.ERR_OUT_OF_RANGE("value",a,t)}tH(n,i,s)}function Qo(t,e){if(typeof t!="number")throw new jo.ERR_INVALID_ARG_TYPE(e,"number",t)}function fc(t,e,r){throw Math.floor(t)!==t?(Qo(t,r),new jo.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new jo.ERR_BUFFER_OUT_OF_BOUNDS:new jo.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var rH=/[^+/0-9A-Za-z-_]/g;function nH(t){if(t=t.split("=")[0],t=t.trim().replace(rH,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function Rw(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 iH(t){let e=[];for(let r=0;r>8,i=r%256,s.push(i),s.push(n);return s}function fx(t){return Ow.toByteArray(nH(t))}function qh(t,e,r,n){let i;for(i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function pn(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function Mw(t){return t!==t}var oH=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"?aH:t}function aH(){throw new Error("BigInt not supported")}});var dx=m((Koe,hx)=>{c();hx.exports=Uw;Uw.supported=typeof WebAssembly<"u";function Uw(t){if(!Uw.supported)return null;var e=t&&t.imports,r=uH("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 uH(t){return typeof atob=="function"?new Uint8Array(atob(t).split("").map(cH)):new(Ts()).Buffer(t,"base64")}function cH(t){return t.charCodeAt(0)}});var vx=m((Zoe,yn)=>{c();var gn=Nw(),Ke=dx()(),Gn=64,Vh=[];yn.exports=Or;var px=yn.exports.BYTES_MIN=16,gx=yn.exports.BYTES_MAX=64,Joe=yn.exports.BYTES=32,yx=yn.exports.KEYBYTES_MIN=16,mx=yn.exports.KEYBYTES_MAX=64,Xoe=yn.exports.KEYBYTES=32,wx=yn.exports.SALTBYTES=16,Ex=yn.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&&(gn(t>=px,"digestLength must be at least "+px+", was given "+t),gn(t<=gx,"digestLength must be at most "+gx+", was given "+t),e!=null&&gn(e.length>=yx,"key must be at least "+yx+", was given "+e.length),e!=null&&gn(e.length<=mx,"key must be at least "+mx+", was given "+e.length),r!=null&&gn(r.length===wx,"salt must be exactly "+wx+", was given "+r.length),n!=null&&gn(n.length===Ex,"personal must be exactly "+Ex+", was given "+n.length)),Vh.length||(Vh.push(Gn),Gn+=216),this.digestLength=t,this.finalized=!1,this.pointer=Vh.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,Gn,Gn+e.length),Ke.memory[this.pointer+200]=128)}Or.prototype.update=function(t){return gn(this.finalized===!1,"Hash instance finalized"),gn(t,"input must be TypedArray or Buffer"),Gn+t.length>Ke.memory.length&&Ke.realloc(Gn+t.length),Ke.memory.set(t,Gn),Ke.exports.blake2b_update(this.pointer,Gn,Gn+t.length),this};Or.prototype.digest=function(t){if(gn(this.finalized===!1,"Hash instance finalized"),this.finalized=!0,Vh.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 fH(Ke.memory,this.pointer+128,this.digestLength);gn(t.length>=this.digestLength,"input must be TypedArray or Buffer");for(var e=0;e{c();var _i=Nw(),dc=vx();function Hh(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 Ax(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 xx(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=hc[i],a=hc[i+1],u=hc[s],l=hc[s+1];Hh(Ce,t,e),Ax(Ce,t,o,a);var f=Ce[n]^Ce[t],d=Ce[n+1]^Ce[t+1];Ce[n]=d,Ce[n+1]=f,Hh(Ce,r,n),f=Ce[e]^Ce[r],d=Ce[e+1]^Ce[r+1],Ce[e]=f>>>24^d<<8,Ce[e+1]=d>>>24^f<<8,Hh(Ce,t,e),Ax(Ce,t,u,l),f=Ce[n]^Ce[t],d=Ce[n+1]^Ce[t+1],Ce[n]=f>>>16^d<<16,Ce[n+1]=d>>>16^f<<16,Hh(Ce,r,n),f=Ce[e]^Ce[r],d=Ce[e+1]^Ce[r+1],Ce[e]=d>>>31^f<<1,Ce[e+1]=f>>>31^d<<1}var Nx=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),dH=[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(dH.map(function(t){return t*2})),Ce=new Uint32Array(32),hc=new Uint32Array(32);function Ox(t,e){var r=0;for(r=0;r<16;r++)Ce[r]=t.h[r],Ce[r+16]=Nx[r];for(Ce[24]=Ce[24]^t.t,Ce[25]=Ce[25]^t.t/4294967296,e&&(Ce[28]=~Ce[28],Ce[29]=~Ce[29]),r=0;r<32;r++)hc[r]=xx(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]^Ce[r]^Ce[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]=Nx[i]^xx(bi,i*4);e&&(Dx(this,e),this.c=128)}zo.prototype.update=function(t){return _i(t!=null,"input must be Uint8Array or Buffer"),Dx(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"),pH(this,e),t==="hex"?gH(e):e};zo.prototype.final=zo.prototype.digest;zo.ready=function(t){dc.ready(function(){t()})};function Dx(t,e){for(var r=0;r>2]>>8*(r&3);return e}function gH(t){for(var e="",r=0;r=bx,"outlen must be at least "+bx+", was given "+e),_i(e<=_x,"outlen must be at most "+_x+", was given "+e),r!=null&&_i(r.length>=Ix,"key must be at least "+Ix+", was given "+r.length),r!=null&&_i(r.length<=Sx,"key must be at most "+Sx+", was given "+r.length),n!=null&&_i(n.length===Tx,"salt must be exactly "+Tx+", was given "+n.length),i!=null&&_i(i.length===Cx,"personal must be exactly "+Cx+", was given "+i.length)),new Px(e,r,n,i)};lr.exports.ready=function(t){dc.ready(function(){t()})};lr.exports.WASM_SUPPORTED=dc.SUPPORTED;lr.exports.WASM_LOADED=!1;var bx=lr.exports.BYTES_MIN=16,_x=lr.exports.BYTES_MAX=64,tae=lr.exports.BYTES=32,Ix=lr.exports.KEYBYTES_MIN=16,Sx=lr.exports.KEYBYTES_MAX=64,rae=lr.exports.KEYBYTES=32,Tx=lr.exports.SALTBYTES=16,Cx=lr.exports.PERSONALBYTES=16;dc.ready(function(t){t||(lr.exports.WASM_LOADED=!0,Px=dc)})});var mn=m(Dr=>{"use strict";c();var mH=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]}),wH=Dr&&Dr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),EH=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)&&mH(e,t,r);return wH(e,t),e};Object.defineProperty(Dr,"__esModule",{value:!0});Dr.TransactionHash=Dr.Transaction=void 0;var $o=Gt(),pc=ht(),vH=Oh(),AH=ms(),bH=EH(Be()),_H=kT(),jn=oc(),IH=WC(),Bx=Fh(),Lx=qn(),SH=gr(),TH=Rx(),CH=32,qw=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:w}){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||AH.TRANSACTION_MIN_GAS_PRICE,this.gasLimit=u,this.data=l||new Lx.TransactionPayload,this.chainID=f,this.version=d?new jn.TransactionVersion(d.valueOf()):jn.TransactionVersion.withDefaultVersion(),this.options=g?new jn.TransactionOptions(g.valueOf()):jn.TransactionOptions.withDefaultOptions(),this.guardian=w||pc.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 jn.TransactionVersion(e.valueOf())}getOptions(){return new jn.TransactionOptions(this.options.valueOf())}setOptions(e){this.options=new jn.TransactionOptions(e.valueOf())}getSignature(){return this.signature}getGuardianSignature(){return this.guardianSignature}setGuardian(e){this.guardian=e}getHash(){return SH.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 vH.Compatibility.guardAddressIsSetAndNonZero(new pc.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:pc.Address.fromString(e.receiver),receiverUsername:e.receiverUsername?h.Buffer.from(e.receiverUsername,"base64").toString():void 0,sender:pc.Address.fromString(e.sender),senderUsername:e.senderUsername?h.Buffer.from(e.senderUsername,"base64").toString():void 0,guardian:e.guardian?pc.Address.fromString(e.guardian):void 0,gasPrice:Number(e.gasPrice),gasLimit:Number(e.gasLimit),data:new Lx.TransactionPayload(h.Buffer.from(e.data||"","base64")),chainID:String(e.chainID),version:new jn.TransactionVersion(e.version),options:e.options!=null?new jn.TransactionOptions(e.options):void 0});return e.signature&&r.applySignature(new Bx.Signature(e.signature)),e.guardianSignature&&r.applyGuardianSignature(new Bx.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 bH.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=qw;var Ko=class t extends _H.Hash{constructor(e){super(e)}static compute(e){let n=new IH.ProtoSerializer().serializeTransaction(e),i=TH(CH).update(n).digest("hex");return new t(i)}};Dr.TransactionHash=Ko});var jw=m(jh=>{"use strict";c();Object.defineProperty(jh,"__esModule",{value:!0});jh.TransferTransactionsFactory=void 0;var Vw=Vo(),Qr=Ot(),Gh=mn(),Hw=qn(),Gw=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 Gh.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 Vw.ArgSerializer().valuesToString([Qr.BytesValue.fromUTF8(e.tokenTransfer.tokenIdentifier),new Qr.BigUIntValue(e.tokenTransfer.valueOf())]),n=`ESDTTransfer@${r}`,i=new Hw.TransactionPayload(n),s=i.length()||0,o=this.gasEstimator.forESDTTransfer(s);return new Gh.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 Vw.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 Hw.TransactionPayload(n),s=i.length()||0,o=this.gasEstimator.forESDTNFTTransfer(s);return new Gh.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 Vw.ArgSerializer().valuesToString(r),i=`MultiESDTNFTTransfer@${n}`,s=new Hw.TransactionPayload(i),o=s.length()||0,a=this.gasEstimator.forMultiESDTNFTTransfer(o,e.tokenTransfers.length);return new Gh.Transaction({nonce:e.nonce,receiver:e.sender,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||a,data:s,chainID:e.chainID})}};jh.TransferTransactionsFactory=Gw});var Qw=m(Cs=>{"use strict";c();Object.defineProperty(Cs,"__esModule",{value:!0});Cs.GasEstimator=Cs.DefaultGasConfiguration=void 0;Cs.DefaultGasConfiguration={minGasLimit:5e4,gasPerDataByte:1500,gasCostESDTTransfer:2e5,gasCostESDTNFTTransfer:2e5,gasCostESDTNFTMultiTransfer:2e5};var xH=1e5,Fx=8e5,kw=class{constructor(e){this.gasConfiguration=e||Cs.DefaultGasConfiguration}forEGLDTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasPerDataByte*e}forESDTTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasCostESDTTransfer+this.gasConfiguration.gasPerDataByte*e+xH}forESDTNFTTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasCostESDTNFTTransfer+this.gasConfiguration.gasPerDataByte*e+Fx}forMultiESDTNFTTransfer(e,r){return this.gasConfiguration.minGasLimit+(this.gasConfiguration.gasCostESDTNFTMultiTransfer+Fx)*r+this.gasConfiguration.gasPerDataByte*e}};Cs.GasEstimator=kw});var Yo=m(kh=>{"use strict";c();Object.defineProperty(kh,"__esModule",{value:!0});kh.Account=void 0;var NH=ht(),Ww=class{constructor(e){this.address=new NH.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=Ww});var Jo=m(Ns=>{"use strict";c();Object.defineProperty(Ns,"__esModule",{value:!0});Ns.Logger=Ns.LogLevel=void 0;var xs;(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"})(xs=Ns.LogLevel||(Ns.LogLevel={}));var Qh=class t{static setLevel(e){t.logLevel=e}static trace(e,...r){t.logLevel>=xs.Debug||console.debug(e,r)}static debug(e,...r){t.logLevel>=xs.Debug||console.debug(e,r)}static info(e,...r){t.logLevel>=xs.Info||console.log(e,r)}static warn(e,...r){t.logLevel>=xs.Warn||console.warn(e,r)}static error(e,...r){t.logLevel>=xs.Error||console.error(e,r)}};Ns.Logger=Qh;Qh.logLevel=xs.Debug});var Kw=m(wn=>{"use strict";c();var OH=wn&&wn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),DH=wn&&wn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),PH=wn&&wn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&OH(e,t,r);return DH(e,t),e};Object.defineProperty(wn,"__esModule",{value:!0});wn.AsyncTimer=void 0;var RH=PH(Be()),BH=Be(),zw=Jo(),$w=class{constructor(e){this.timeoutHandle=null,this.rejectionFunc=null,this.name=e,this.correlationTag=0}start(e){if(this.timeoutHandle)throw new RH.ErrAsyncTimerAlreadyRunning;return this.correlationTag++,zw.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(){zw.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].abort()`),this.rejectionFunc&&(this.rejectionFunc(new BH.ErrAsyncTimerAborted),this.rejectionFunc=null),this.stop()}stop(){this.isStopped()||(zw.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].stop()`),this.timeoutHandle&&(clearTimeout(this.timeoutHandle),this.timeoutHandle=null))}isStopped(){return!this.timeoutHandle}};wn.AsyncTimer=$w});var Wh=m(Zo=>{"use strict";c();var Pr=Zo&&Zo.__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(Zo,"__esModule",{value:!0});Zo.TransactionWatcher=void 0;var Yw=Kw(),Xo=Be(),Mx=Jo(),Ii=class t{constructor(e,r={}){this.fetcher=new Jw(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 Xo.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 Xo.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 Xo.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 Xo.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 Xo.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)})}awaitConditionally(e,r,n){return Pr(this,void 0,void 0,function*(){let i=new Yw.AsyncTimer("watcher:periodic"),s=new Yw.AsyncTimer("watcher:patience"),o=new Yw.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(Mx.Logger.debug("TransactionWatcher.awaitConditionally(): cannot (yet) fetch data."),!(f instanceof Xo.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}};Zo.TransactionWatcher=Ii;Ii.DefaultPollingInterval=6e3;Ii.DefaultTimeout=Ii.DefaultPollingInterval*15;Ii.DefaultPatience=0;Ii.NoopOnStatusReceived=t=>{};var Jw=class{constructor(e){this.fetcher=e}getTransaction(e){return Pr(this,void 0,void 0,function*(){return Mx.Logger.debug(`transactionWatcher, getTransaction(${e})`),yield this.fetcher.getTransaction(e)})}}});var Zw=m(Kh=>{"use strict";c();Object.defineProperty(Kh,"__esModule",{value:!0});Kh.CodeMetadata=void 0;var Xw=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|=zh.Upgradeable),this.readable&&(e|=zh.Readable),this.payable&&(r|=$h.Payable),this.payableBySc&&(r|=$h.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}};Kh.CodeMetadata=Xw;var zh;(function(t){t[t.Upgradeable=1]="Upgradeable",t[t.Reserved2=2]="Reserved2",t[t.Readable=4]="Readable"})(zh||(zh={}));var $h;(function(t){t[t.Reserved1=1]="Reserved1",t[t.Payable=2]="Payable",t[t.PayableBySc=4]="PayableBySc"})($h||($h={}))});var gc=m(En=>{"use strict";c();var LH=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]}),FH=En&&En.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MH=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)&&LH(e,t,r);return FH(e,t),e};Object.defineProperty(En,"__esModule",{value:!0});En.ContractFunction=void 0;var UH=MH(Be()),eE=class t{constructor(e){if(this.name=e,e==null)throw new UH.ErrInvalidFunctionName}static none(){return new t("untitled")}toString(){return this.name}valueOf(){return this.name}};En.ContractFunction=eE});var nE=m(Rr=>{"use strict";c();var qH=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]}),VH=Rr&&Rr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HH=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)&&qH(e,t,r);return VH(e,t),e},GH=Rr&&Rr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Rr,"__esModule",{value:!0});Rr.InteractionChecker=void 0;var tE=HH(Be()),jH=GH(Gt()),rE=class{checkInteraction(e,r){this.checkPayable(e,r),this.checkArguments(e,r)}checkPayable(e,r){let n=!new jH.default(e.getValue().toString()).isZero(),i=r.modifiers.isPayableInEGLD();if(n&&!i)throw new tE.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 tE.ErrContractInteraction(`bad arguments, expected: ${s}, got: ${o}`);for(let a=0;a{"use strict";c();Object.defineProperty(Yh,"__esModule",{value:!0});Yh.Query=void 0;var kH=ht(),QH=Vo(),iE=class{constructor(e){this.caller=e.caller||new kH.Address,this.address=e.address,this.func=e.func,this.args=e.args||[],this.value=e.value||0}getEncodedArguments(){return new QH.ArgSerializer().valuesToStrings(this.args)}};Yh.Query=iE});var uE=m(Jh=>{"use strict";c();Object.defineProperty(Jh,"__esModule",{value:!0});Jh.Interaction=void 0;var Ux=ht(),WH=Oh(),sE=ms(),oE=gc(),zH=nE(),$H=yc(),ea=Ot(),aE=class{constructor(e,r,n){this.nonce=0,this.value="0",this.gasLimit=0,this.gasPrice=void 0,this.chainID="",this.querent=new Ux.Address,this.sender=new Ux.Address,this.isWithSingleESDTTransfer=!1,this.isWithSingleESDTNFTTransfer=!1,this.isWithMultiESDTNFTTransfer=!1,this.contract=e,this.function=r,this.args=n,this.tokenTransfers=new ta([],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(){WH.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 oE.ContractFunction(sE.ESDT_TRANSFER_FUNCTION_NAME),n=this.tokenTransfers.buildArgsForSingleESDTTransfer()):this.isWithSingleESDTNFTTransfer?(e=this.sender,r=new oE.ContractFunction(sE.ESDTNFT_TRANSFER_FUNCTION_NAME),n=this.tokenTransfers.buildArgsForSingleESDTNFTTransfer()):this.isWithMultiESDTNFTTransfer&&(e=this.sender,r=new oE.ContractFunction(sE.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 $H.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 ta([e],this),this}withSingleESDTNFTTransfer(e,r){return this.isWithSingleESDTNFTTransfer=!0,this.tokenTransfers=new ta([e],this),r&&(this.sender=r),this}withMultiESDTNFTTransfer(e,r){return this.isWithMultiESDTNFTTransfer=!0,this.tokenTransfers=new ta(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 zH.InteractionChecker().checkInteraction(this,this.getEndpoint()),this}};Jh.Interaction=aE;var ta=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 ea.U8Value(this.transfers.length)}getTypedTokenIdentifier(e){return ea.BytesValue.fromUTF8(e.tokenIdentifier)}getTypedTokenNonce(e){return new ea.U64Value(e.nonce)}getTypedTokenQuantity(e){return new ea.BigUIntValue(e.amountAsBigInteger)}getTypedTokensReceiver(){return new ea.AddressValue(this.interaction.getContractAddress())}getTypedInteractionFunction(){return ea.BytesValue.fromUTF8(this.interaction.getFunction().valueOf())}getInteractionArguments(){return this.interaction.getArguments()}}});var qx=m(Xh=>{"use strict";c();Object.defineProperty(Xh,"__esModule",{value:!0});Xh.ArgumentErrorContext=void 0;var KH=Be(),cE=class{constructor(e,r,n){this.endpointName=e,this.argumentIndex=r,this.parameterDefinition=n}throwError(e){throw new KH.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)})`)}};Xh.ArgumentErrorContext=cE});var lE=m(Os=>{"use strict";c();var YH=Os&&Os.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Os,"__esModule",{value:!0});Os.NativeSerializer=void 0;var JH=YH(Gt()),XH=ht(),Vx=Be(),ZH=oh(),eG=qx(),Ae=Ot(),tG;(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 w(_,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(Wr,"__esModule",{value:!0});Wr.ContractCallPayloadBuilder=Wr.ContractUpgradePayloadBuilder=Wr.ContractDeployPayloadBuilder=Wr.ArwenVirtualMachine=void 0;var pE=qn(),gE=gr(),rG=Vo();Wr.ArwenVirtualMachine="0500";var fE=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(){gE.guardValueIsSet("code",this.code);let e=this.code.toString(),r=this.codeMetadata.toString(),n=`${e}@${Wr.ArwenVirtualMachine}@${r}`;return n=yE(n,this.arguments),new pE.TransactionPayload(n)}};Wr.ContractDeployPayloadBuilder=fE;var hE=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(){gE.guardValueIsSet("code",this.code);let e=this.code.toString(),r=this.codeMetadata.toString(),n=`upgradeContract@${e}@${r}`;return n=yE(n,this.arguments),new pE.TransactionPayload(n)}};Wr.ContractUpgradePayloadBuilder=hE;var dE=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(){gE.guardValueIsSet("calledFunction",this.contractFunction);let e=this.contractFunction.name;return e=yE(e,this.arguments),new pE.TransactionPayload(e)}};Wr.ContractCallPayloadBuilder=dE;function yE(t,e){let{argumentsString:r,count:n}=new rG.ArgSerializer().valuesToString(e);return n==0?t:`${t}@${r}`}});var kn=m((Lae,wE)=>{"use strict";c();var ra=typeof Reflect=="object"?Reflect:null,Hx=ra&&typeof ra.apply=="function"?ra.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},Zh;ra&&typeof ra.ownKeys=="function"?Zh=ra.ownKeys:Object.getOwnPropertySymbols?Zh=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Zh=function(e){return Object.getOwnPropertyNames(e)};function nG(t){console&&console.warn&&console.warn(t)}var jx=Number.isNaN||function(e){return e!==e};function ke(){ke.init.call(this)}wE.exports=ke;wE.exports.once=aG;ke.EventEmitter=ke;ke.prototype._events=void 0;ke.prototype._eventsCount=0;ke.prototype._maxListeners=void 0;var Gx=10;function ed(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 Gx},set:function(t){if(typeof t!="number"||t<0||jx(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Gx=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||jx(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 kx(t){return t._maxListeners===void 0?ke.defaultMaxListeners:t._maxListeners}ke.prototype.getMaxListeners=function(){return kx(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")Hx(u,this,r);else for(var l=u.length,f=Kx(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,nG(a)}return t}ke.prototype.addListener=function(e,r){return Qx(this,e,r,!1)};ke.prototype.on=ke.prototype.addListener;ke.prototype.prependListener=function(e,r){return Qx(this,e,r,!0)};function iG(){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 Wx(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=iG.bind(n);return i.listener=r,n.wrapFn=i,i}ke.prototype.once=function(e,r){return ed(r),this.on(e,Wx(this,e,r)),this};ke.prototype.prependOnceListener=function(e,r){return ed(r),this.prependListener(e,Wx(this,e,r)),this};ke.prototype.removeListener=function(e,r){var n,i,s,o,a;if(ed(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():sG(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 zx(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?oG(i):Kx(i,i.length)}ke.prototype.listeners=function(e){return zx(this,e,!0)};ke.prototype.rawListeners=function(e){return zx(this,e,!1)};ke.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):$x.call(t,e)};ke.prototype.listenerCount=$x;function $x(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?Zh(this._events):[]};function Kx(t,e){for(var r=new Array(e),n=0;n{c();Jx.exports=kn().EventEmitter});var vE=m(()=>{c()});var nN=m((Gae,rN)=>{"use strict";c();function Xx(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 Zx(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 td.alloc(0);for(var n=td.allocUnsafe(r>>>0),i=this.head,s=0;i;)yG(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=td.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:gG,value:function(r,n){return AE(this,Zx(Zx({},n),{},{depth:0,customInspect:!1}))}}]),t}()});var _E=m((kae,sN)=>{"use strict";c();function mG(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(bE,this,t)):p.default.nextTick(bE,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(rd,r):(r._writableState.errorEmitted=!0,p.default.nextTick(iN,r,s)):p.default.nextTick(iN,r,s):e?(p.default.nextTick(rd,r),e(s)):p.default.nextTick(rd,r)}),this)}function iN(t,e){bE(t,e),rd(t)}function rd(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function wG(){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 bE(t,e){t.emit("error",e)}function EG(t,e){var r=t._readableState,n=t._writableState;r&&r.autoDestroy||n&&n.autoDestroy?t.destroy(e):t.emit("error",e)}sN.exports={destroy:mG,undestroy:wG,errorOrDestroy:EG}});var Ds=m((Wae,uN)=>{"use strict";c();function vG(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var aN={};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){vG(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,aN[t]=i}function oN(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 AG(t,e,r){return t.substr(!r||r<0?0:+r,e.length)===e}function bG(t,e,r){return(r===void 0||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}function _G(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"&&AG(e,"not ")?(n="must not be",e=e.replace(/^not /,"")):n="must be";var i;if(bG(t," argument"))i="The ".concat(t," ").concat(n," ").concat(oN(e,"type"));else{var s=_G(t,".")?"property":"argument";i='The "'.concat(t,'" ').concat(s," ").concat(n," ").concat(oN(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");uN.exports.codes=aN});var IE=m(($ae,cN)=>{"use strict";c();var IG=Ds().codes.ERR_INVALID_OPT_VALUE;function SG(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function TG(t,e,r,n){var i=SG(e,n,r);if(i!=null){if(!(isFinite(i)&&Math.floor(i)===i)||i<0){var s=n?r:"highWaterMark";throw new IG(s,i)}return Math.floor(i)}return t.objectMode?16:16*1024}cN.exports={getHighWaterMark:TG}});var na=m((Yae,SE)=>{c();typeof Object.create=="function"?SE.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:SE.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 fN=m((Xae,lN)=>{c();lN.exports=CG;function CG(t,e){if(TE("noDeprecation"))return t;var r=!1;function n(){if(!r){if(TE("throwDeprecation"))throw new Error(e);TE("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}return n}function TE(t){try{if(!global.localStorage)return!1}catch{return!1}var e=global.localStorage[t];return e==null?!1:String(e).toLowerCase()==="true"}});var NE=m((eue,mN)=>{"use strict";c();mN.exports=dt;function dN(t){var e=this;this.next=null,this.entry=null,this.finish=function(){ej(e,t)}}var ia;dt.WritableState=wc;var xG={deprecate:fN()},pN=EE(),id=Ts().Buffer,NG=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function OG(t){return id.from(t)}function DG(t){return id.isBuffer(t)||t instanceof NG}var xE=_E(),PG=IE(),RG=PG.getHighWaterMark,Si=Ds().codes,BG=Si.ERR_INVALID_ARG_TYPE,LG=Si.ERR_METHOD_NOT_IMPLEMENTED,FG=Si.ERR_MULTIPLE_CALLBACK,MG=Si.ERR_STREAM_CANNOT_PIPE,UG=Si.ERR_STREAM_DESTROYED,qG=Si.ERR_STREAM_NULL_VALUES,VG=Si.ERR_STREAM_WRITE_AFTER_END,HG=Si.ERR_UNKNOWN_ENCODING,sa=xE.errorOrDestroy;na()(dt,pN);function GG(){}function wc(t,e,r){ia=ia||Ps(),t=t||{},typeof r!="boolean"&&(r=e instanceof ia),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=RG(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){KG(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 dN(this)}wc.prototype.getBuffer=function(){for(var e=this.bufferedRequest,r=[];e;)r.push(e),e=e.next;return r};(function(){try{Object.defineProperty(wc.prototype,"buffer",{get:xG.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var nd;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(nd=Function.prototype[Symbol.hasInstance],Object.defineProperty(dt,Symbol.hasInstance,{value:function(e){return nd.call(this,e)?!0:this!==dt?!1:e&&e._writableState instanceof wc}})):nd=function(e){return e instanceof this};function dt(t){ia=ia||Ps();var e=this instanceof ia;if(!e&&!nd.call(dt,this))return new dt(t);this._writableState=new wc(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)),pN.call(this)}dt.prototype.pipe=function(){sa(this,new MG)};function jG(t,e){var r=new VG;sa(t,r),p.default.nextTick(e,r)}function kG(t,e,r,n){var i;return r===null?i=new qG:typeof r!="string"&&!e.objectMode&&(i=new BG("chunk",["string","Buffer"],r)),i?(sa(t,i),p.default.nextTick(n,i),!1):!0}dt.prototype.write=function(t,e,r){var n=this._writableState,i=!1,s=!n.objectMode&&DG(t);return s&&!id.isBuffer(t)&&(t=OG(t)),typeof e=="function"&&(r=e,e=null),s?e="buffer":e||(e=n.defaultEncoding),typeof r!="function"&&(r=GG),n.ending?jG(this,r):(s||kG(this,n,t,r))&&(n.pendingcb++,i=WG(this,n,s,t,e,r)),i};dt.prototype.cork=function(){this._writableState.corked++};dt.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,!t.writing&&!t.corked&&!t.bufferProcessing&&t.bufferedRequest&&gN(this,t))};dt.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 HG(e);return this._writableState.defaultEncoding=e,this};Object.defineProperty(dt.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function QG(t,e,r){return!t.objectMode&&t.decodeStrings!==!1&&typeof e=="string"&&(e=id.from(e,r)),e}Object.defineProperty(dt.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function WG(t,e,r,n,i,s){if(!r){var o=QG(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 tj=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};EN.exports=vn;var wN=PE(),DE=NE();na()(vn,wN);for(OE=tj(DE.prototype),sd=0;sd{c();var ad=Ts(),An=ad.Buffer;function vN(t,e){for(var r in t)e[r]=t[r]}An.from&&An.alloc&&An.allocUnsafe&&An.allocUnsafeSlow?AN.exports=ad:(vN(ad,RE),RE.Buffer=Rs);function Rs(t,e,r){return An(t,e,r)}Rs.prototype=Object.create(An.prototype);vN(An,Rs);Rs.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return An(t,e,r)};Rs.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=An(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};Rs.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return An(t)};Rs.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return ad.SlowBuffer(t)}});var FE=m(IN=>{"use strict";c();var LE=bN().Buffer,_N=LE.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 ij(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 sj(t){var e=ij(t);if(typeof e!="string"&&(LE.isEncoding===_N||!_N(t)))throw new Error("Unknown encoding: "+t);return e||t}IN.StringDecoder=Ec;function Ec(t){this.encoding=sj(t);var e;switch(this.encoding){case"utf16le":this.text=fj,this.end=hj,e=4;break;case"utf8":this.fillLast=uj,e=4;break;case"base64":this.text=dj,this.end=pj,e=3;break;default:this.write=gj,this.end=yj;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=LE.allocUnsafe(e)}Ec.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 oj(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 aj(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 uj(t){var e=this.lastTotal-this.lastNeed,r=aj(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 cj(t,e){var r=oj(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 lj(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function fj(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 hj(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 dj(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 pj(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function gj(t){return t.toString(this.encoding)}function yj(t){return t&&t.length?this.write(t):""}});var ud=m((aue,CN)=>{"use strict";c();var SN=Ds().codes.ERR_STREAM_PREMATURE_CLOSE;function mj(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 cd;function Ti(t,e,r){return e=vj(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function vj(t){var e=Aj(t,"string");return typeof e=="symbol"?e:String(e)}function Aj(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 bj=ud(),Ci=Symbol("lastResolve"),Bs=Symbol("lastReject"),vc=Symbol("error"),ld=Symbol("ended"),Ls=Symbol("lastPromise"),ME=Symbol("handlePromise"),Fs=Symbol("stream");function xi(t,e){return{value:t,done:e}}function _j(t){var e=t[Ci];if(e!==null){var r=t[Fs].read();r!==null&&(t[Ls]=null,t[Ci]=null,t[Bs]=null,e(xi(r,!1)))}}function Ij(t){p.default.nextTick(_j,t)}function Sj(t,e){return function(r,n){t.then(function(){if(e[ld]){r(xi(void 0,!0));return}e[ME](r,n)},n)}}var Tj=Object.getPrototypeOf(function(){}),Cj=Object.setPrototypeOf((cd={get stream(){return this[Fs]},next:function(){var e=this,r=this[vc];if(r!==null)return Promise.reject(r);if(this[ld])return Promise.resolve(xi(void 0,!0));if(this[Fs].destroyed)return new Promise(function(o,a){p.default.nextTick(function(){e[vc]?a(e[vc]):o(xi(void 0,!0))})});var n=this[Ls],i;if(n)i=new Promise(Sj(n,this));else{var s=this[Fs].read();if(s!==null)return Promise.resolve(xi(s,!1));i=new Promise(this[ME])}return this[Ls]=i,i}},Ti(cd,Symbol.asyncIterator,function(){return this}),Ti(cd,"return",function(){var e=this;return new Promise(function(r,n){e[Fs].destroy(null,function(i){if(i){n(i);return}r(xi(void 0,!0))})})}),cd),Tj),xj=function(e){var r,n=Object.create(Cj,(r={},Ti(r,Fs,{value:e,writable:!0}),Ti(r,Ci,{value:null,writable:!0}),Ti(r,Bs,{value:null,writable:!0}),Ti(r,vc,{value:null,writable:!0}),Ti(r,ld,{value:e._readableState.endEmitted,writable:!0}),Ti(r,ME,{value:function(s,o){var a=n[Fs].read();a?(n[Ls]=null,n[Ci]=null,n[Bs]=null,s(xi(a,!1))):(n[Ci]=s,n[Bs]=o)},writable:!0}),r));return n[Ls]=null,bj(e,function(i){if(i&&i.code!=="ERR_STREAM_PREMATURE_CLOSE"){var s=n[Bs];s!==null&&(n[Ls]=null,n[Ci]=null,n[Bs]=null,s(i)),n[vc]=i;return}var o=n[Ci];o!==null&&(n[Ls]=null,n[Ci]=null,n[Bs]=null,o(xi(void 0,!0))),n[ld]=!0}),e.on("readable",Ij.bind(null,n)),n};xN.exports=xj});var DN=m((fue,ON)=>{c();ON.exports=function(){throw new Error("Readable.from is not available in the browser")}});var PE=m((pue,HN)=>{"use strict";c();HN.exports=Me;var oa;Me.ReadableState=LN;var due=kn().EventEmitter,BN=function(e,r){return e.listeners(r).length},bc=EE(),fd=Ts().Buffer,Nj=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function Oj(t){return fd.from(t)}function Dj(t){return fd.isBuffer(t)||t instanceof Nj}var UE=vE(),xe;UE&&UE.debuglog?xe=UE.debuglog("stream"):xe=function(){};var Pj=nN(),QE=_E(),Rj=IE(),Bj=Rj.getHighWaterMark,hd=Ds().codes,Lj=hd.ERR_INVALID_ARG_TYPE,Fj=hd.ERR_STREAM_PUSH_AFTER_EOF,Mj=hd.ERR_METHOD_NOT_IMPLEMENTED,Uj=hd.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,aa,qE,VE;na()(Me,bc);var Ac=QE.errorOrDestroy,HE=["error","close","destroy","pause","resume"];function qj(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 LN(t,e,r){oa=oa||Ps(),t=t||{},typeof r!="boolean"&&(r=e instanceof oa),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=Bj(this,t,"readableHighWaterMark",r),this.buffer=new Pj,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&&(aa||(aa=FE().StringDecoder),this.decoder=new aa(t.encoding),this.encoding=t.encoding)}function Me(t){if(oa=oa||Ps(),!(this instanceof Me))return new Me(t);var e=this instanceof oa;this._readableState=new LN(t,this,e),this.readable=!0,t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy)),bc.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=QE.destroy;Me.prototype._undestroy=QE.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=fd.from(t,e),e=""),n=!0),FN(this,t,e,!1,n)};Me.prototype.unshift=function(t){return FN(this,t,null,!0,!1)};function FN(t,e,r,n,i){xe("readableAddChunk",e);var s=t._readableState;if(e===null)s.reading=!1,Gj(t,s);else{var o;if(i||(o=Vj(s,e)),o)Ac(t,o);else if(s.objectMode||e&&e.length>0)if(typeof e!="string"&&!s.objectMode&&Object.getPrototypeOf(e)!==fd.prototype&&(e=Oj(e)),n)s.endEmitted?Ac(t,new Uj):GE(t,s,e,!0);else if(s.ended)Ac(t,new Fj);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(e=s.decoder.write(e),s.objectMode||e.length!==0?GE(t,s,e,!1):kE(t,s)):GE(t,s,e,!1)}else n||(s.reading=!1,kE(t,s))}return!s.ended&&(s.length=PN?t=PN:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}function RN(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=Hj(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?jE(this):dd(this),null;if(t=RN(t,e),t===0&&e.ended)return e.length===0&&jE(this),null;var n=e.needReadable;xe("need readable",n),(e.length===0||e.length-t0?i=qN(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&&jE(this)),i!==null&&this.emit("data",i),i};function Gj(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?dd(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,MN(t)))}}function dd(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(MN,t))}function MN(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,WE(t)}function kE(t,e){e.readingMore||(e.readingMore=!0,p.default.nextTick(jj,t,e))}function jj(t,e){for(;!e.reading&&!e.ended&&(e.length1&&VN(n.pipes,t)!==-1)&&!l&&(xe("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function g(O){xe("onerror",O),x(),t.removeListener("error",g),BN(t,"error")===0&&Ac(t,O)}qj(t,"error",g);function w(){t.removeListener("finish",E),x()}t.once("close",w);function E(){xe("onfinish"),t.removeListener("close",w),x()}t.once("finish",E);function x(){xe("unpipe"),r.unpipe(t)}return t.emit("pipe",r),n.flowing||(xe("pipe resume"),r.resume()),t};function kj(t){return function(){var r=t._readableState;xe("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,r.awaitDrain===0&&BN(t,"data")&&(r.flowing=!0,WE(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?dd(this):n.reading||p.default.nextTick(Qj,this)),r};Me.prototype.addListener=Me.prototype.on;Me.prototype.removeListener=function(t,e){var r=bc.prototype.removeListener.call(this,t,e);return t==="readable"&&p.default.nextTick(UN,this),r};Me.prototype.removeAllListeners=function(t){var e=bc.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&p.default.nextTick(UN,this),e};function UN(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 Qj(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,Wj(this,t)),t.paused=!1,this};function Wj(t,e){e.resumeScheduled||(e.resumeScheduled=!0,p.default.nextTick(zj,t,e))}function zj(t,e){xe("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),WE(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 WE(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 jE(t){var e=t._readableState;xe("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,p.default.nextTick($j,e,t))}function $j(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 VE===void 0&&(VE=DN()),VE(Me,t,e)});function VN(t,e){for(var r=0,n=t.length;r{"use strict";c();jN.exports=Qn;var pd=Ds().codes,Kj=pd.ERR_METHOD_NOT_IMPLEMENTED,Yj=pd.ERR_MULTIPLE_CALLBACK,Jj=pd.ERR_TRANSFORM_ALREADY_TRANSFORMING,Xj=pd.ERR_TRANSFORM_WITH_LENGTH_0,gd=Ps();na()(Qn,gd);function Zj(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(n===null)return this.emit("error",new Yj);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();QN.exports=_c;var kN=zE();na()(_c,kN);function _c(t){if(!(this instanceof _c))return new _c(t);kN.call(this,t)}_c.prototype._transform=function(t,e,r){r(null,t)}});var JN=m((vue,YN)=>{"use strict";c();var $E;function tk(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}var KN=Ds().codes,rk=KN.ERR_MISSING_ARGS,nk=KN.ERR_STREAM_DESTROYED;function zN(t){if(t)throw t}function ik(t){return t.setHeader&&typeof t.abort=="function"}function sk(t,e,r,n){n=tk(n);var i=!1;t.on("close",function(){i=!0}),$E===void 0&&($E=ud()),$E(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,ik(t))return t.abort();if(typeof t.destroy=="function")return t.destroy();n(o||new nk("pipe"))}}}function $N(t){t()}function ok(t,e){return t.pipe(e)}function ak(t){return!t.length||typeof t[t.length-1]!="function"?zN:t.pop()}function uk(){for(var t=arguments.length,e=new Array(t),r=0;r0;return sk(o,u,l,function(f){i||(i=f),f&&s.forEach($N),!u&&(s.forEach($N),n(i))})});return e.reduce(ok)}YN.exports=uk});var KE=m((Lr,XN)=>{c();Lr=XN.exports=PE();Lr.Stream=Lr;Lr.Readable=Lr;Lr.Writable=NE();Lr.Duplex=Ps();Lr.Transform=zE();Lr.PassThrough=WN();Lr.finished=ud();Lr.pipeline=JN()});var tO=m((_ue,eO)=>{c();var{Transform:ck}=KE();eO.exports=t=>class ZN extends ck{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 ZN(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}}});var iO=m((Sue,nO)=>{c();var{Transform:lk}=KE();nO.exports=t=>class rO extends lk{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 rO(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}}});var oO=m((Cue,sO)=>{c();var fk=tO(),hk=iO();sO.exports=function(t){let e=fk(t),r=hk(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 cO=m(uO=>{c();var aO=[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];uO.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),w=d^(s<<1|i>>>31),E=t[0]^g,x=t[1]^w,O=t[10]^g,F=t[11]^w,_=t[20]^g,I=t[21]^w,S=t[30]^g,R=t[31]^w,B=t[40]^g,b=t[41]^w;g=r^(o<<1|a>>>31),w=n^(a<<1|o>>>31);let T=t[2]^g,L=t[3]^w,X=t[12]^g,W=t[13]^w,G=t[22]^g,j=t[23]^w,K=t[32]^g,de=t[33]^w,ue=t[42]^g,re=t[43]^w;g=i^(u<<1|l>>>31),w=s^(l<<1|u>>>31);let Y=t[4]^g,se=t[5]^w,te=t[14]^g,ie=t[15]^w,q=t[24]^g,le=t[25]^w,ae=t[34]^g,fe=t[35]^w,oe=t[44]^g,ce=t[45]^w;g=o^(f<<1|d>>>31),w=a^(d<<1|f>>>31);let y=t[6]^g,v=t[7]^w,A=t[16]^g,P=t[17]^w,C=t[26]^g,D=t[27]^w,M=t[36]^g,N=t[37]^w,U=t[46]^g,H=t[47]^w;g=u^(r<<1|n>>>31),w=l^(n<<1|r>>>31);let V=t[8]^g,Z=t[9]^w,we=t[18]^g,ve=t[19]^w,Pe=t[28]^g,tt=t[29]^w,lt=t[38]^g,Oe=t[39]^w,Ue=t[48]^g,xt=t[49]^w,ui=E,hs=x,ds=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,xy=B<<18|b>>>14,Ny=b<<18|B>>>14,Oy=T<<1|L>>>31,Dy=L<<1|T>>>31,Py=W<<12|X>>>20,Ry=X<<12|W>>>20,By=G<<10|j>>>22,Ly=j<<10|G>>>22,Fy=de<<13|K>>>19,My=K<<13|de>>>19,Uy=ue<<2|re>>>30,qy=re<<2|ue>>>30,Vy=se<<30|Y>>>2,Hy=Y<<30|se>>>2,Gy=te<<6|ie>>>26,jy=ie<<6|te>>>26,ky=le<<11|q>>>21,Qy=q<<11|le>>>21,Wy=ae<<15|fe>>>17,zy=fe<<15|ae>>>17,$y=ce<<29|oe>>>3,Ky=oe<<29|ce>>>3,Yy=y<<28|v>>>4,Jy=v<<28|y>>>4,Xy=P<<23|A>>>9,Zy=A<<23|P>>>9,e0=C<<25|D>>>7,t0=D<<25|C>>>7,r0=M<<21|N>>>11,n0=N<<21|M>>>11,i0=H<<24|U>>>8,s0=U<<24|H>>>8,o0=V<<27|Z>>>5,a0=Z<<27|V>>>5,u0=we<<20|ve>>>12,c0=ve<<20|we>>>12,l0=tt<<7|Pe>>>25,f0=Pe<<7|tt>>>25,h0=lt<<8|Oe>>>24,d0=Oe<<8|lt>>>24,p0=Ue<<14|xt>>>18,g0=xt<<14|Ue>>>18;t[0]=ui^~Py&ky,t[1]=hs^~Ry&Qy,t[10]=Yy^~u0&Bn,t[11]=Jy^~c0&Wt,t[20]=Oy^~Gy&e0,t[21]=Dy^~jy&t0,t[30]=o0^~ds&By,t[31]=a0^~nr&Ly,t[40]=Vy^~Xy&l0,t[41]=Hy^~Zy&f0,t[2]=Py^~ky&r0,t[3]=Ry^~Qy&n0,t[12]=u0^~Bn&Fy,t[13]=c0^~Wt&My,t[22]=Gy^~e0&h0,t[23]=jy^~t0&d0,t[32]=ds^~By&Wy,t[33]=nr^~Ly&zy,t[42]=Xy^~l0&Nt,t[43]=Zy^~f0&ze,t[4]=ky^~r0&p0,t[5]=Qy^~n0&g0,t[14]=Bn^~Fy&$y,t[15]=Wt^~My&Ky,t[24]=e0^~h0&xy,t[25]=t0^~d0&Ny,t[34]=By^~Wy&i0,t[35]=Ly^~zy&s0,t[44]=l0^~Nt&Uy,t[45]=f0^~ze&qy,t[6]=r0^~p0&ui,t[7]=n0^~g0&hs,t[16]=Fy^~$y&Yy,t[17]=My^~Ky&Jy,t[26]=h0^~xy&Oy,t[27]=d0^~Ny&Dy,t[36]=Wy^~i0&o0,t[37]=zy^~s0&a0,t[46]=Nt^~Uy&Vy,t[47]=ze^~qy&Hy,t[8]=p0^~ui&Py,t[9]=g0^~hs&Ry,t[18]=$y^~Yy&u0,t[19]=Ky^~Jy&c0,t[28]=xy^~Oy&Gy,t[29]=Ny^~Dy&jy,t[38]=i0^~o0&ds,t[39]=s0^~a0&nr,t[48]=Uy^~Vy&Xy,t[49]=qy^~Hy&Zy,t[0]^=aO[e*2],t[1]^=aO[e*2+1]}}});var fO=m((Due,lO)=>{c();var yd=cO();function ua(){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}ua.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};ua.prototype.absorb=function(t){for(let e=0;e>>8*(this.count%4)&255,this.count+=1,this.count===this.blockSize&&(yd.p1600(this.state),this.count=0);return e};ua.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};lO.exports=ua});var YE=m((Rue,hO)=>{c();hO.exports=oO()(fO())});var ev=m(ca=>{"use strict";c();var dk=ca&&ca.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ca,"__esModule",{value:!0});ca.SmartContract=void 0;var pk=dk(Gt()),Ic=ht(),JE=Oh(),gk=Be(),XE=mn(),yk=gr(),mk=ic(),dO=Zw(),pO=gc(),gO=uE(),wk=lE(),Ek=yc(),md=mE(),vk=YE(),ZE=class{constructor(e={}){this.address=new Ic.Address,this.methodsExplicit={},this.methods={},this.address=e.address||new Ic.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 pO.ContractFunction(i);return new gO.Interaction(e,o,s||[])},this.methods[i]=function(s){let o=new pO.ContractFunction(i),a=wk.NativeSerializer.nativeToTypedValues(s||[],n);return new gO.Interaction(e,o,a||[])}}}setAddress(e){this.address=e}getAddress(){return this.address}getAbi(){return yk.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}){JE.Compatibility.guardAddressIsSetAndNonZero(e,"'deployer' of SmartContract.deploy()","pass the actual address to deploy()"),n=n||new dO.CodeMetadata,i=i||[],s=s||0;let l=new md.ContractDeployPayloadBuilder().setCode(r).setCodeMetadata(n).setInitArgs(i).build();return new XE.Transaction({receiver:Ic.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}){JE.Compatibility.guardAddressIsSetAndNonZero(e,"'caller' of SmartContract.upgrade()","pass the actual address to upgrade()"),this.ensureHasAddress(),n=n||new dO.CodeMetadata,i=i||[],s=s||0;let l=new md.ContractUpgradePayloadBuilder().setCode(r).setCodeMetadata(n).setInitArgs(i).build();return new XE.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}){JE.Compatibility.guardAddressIsSetAndNonZero(u,"'caller' of SmartContract.call()","pass the actual address to call()"),this.ensureHasAddress(),r=r||[],n=n||0;let l=new md.ContractCallPayloadBuilder().setFunction(e).setArgs(r).build();return new XE.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 Ek.Query({address:this.getAddress(),func:e,args:r,value:n,caller:i})}ensureHasAddress(){if(!this.getAddress().bech32())throw new gk.ErrContractHasNoAddress}static computeAddress(e,r){let n=h.Buffer.alloc(8,0),i=new Ic.Address(e.bech32()).pubkey(),s=i.slice(30),o=h.Buffer.alloc(8),a=new pk.default(r.valueOf().toString(10)),u=mk.bigIntToBuffer(a);o.write(u.reverse().toString("hex"),"hex");let l=h.Buffer.concat([i,o]),f=vk("keccak256").update(l).digest(),d=h.Buffer.from(md.ArwenVirtualMachine,"hex"),g=h.Buffer.concat([n,d,f.slice(10,30),s]);return new Ic.Address(g)}};ca.SmartContract=ZE});var yO=m(Ni=>{"use strict";c();Object.defineProperty(Ni,"__esModule",{value:!0});Ni.ErrAccountNotConnected=Ni.ErrCannotSignSingleTransaction=Ni.Err=void 0;var Sc=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};Ni.Err=Sc;var tv=class extends Sc{constructor(){super("Cannot sign single transaction.")}};Ni.ErrCannotSignSingleTransaction=tv;var rv=class extends Sc{constructor(){super("Account is not connected.")}};Ni.ErrAccountNotConnected=rv});var mO=m(Tc=>{"use strict";c();Object.defineProperty(Tc,"__esModule",{value:!0});Tc.Operation=void 0;var Ak;(function(t){t.Connect="connect",t.Logout="logout",t.SignTransactions="signTransactions",t.SignMessage="signMessage",t.CancelAction="cancelAction"})(Ak=Tc.Operation||(Tc.Operation={}))});var nv=m(la=>{"use strict";c();var Oi=la&&la.__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(la,"__esModule",{value:!0});la.ExtensionProvider=void 0;var bk=mn(),wO=yO(),Cc=mO(),xc=class t{constructor(){if(this.account={address:""},this.initialized=!1,t._instance)throw new Error("Error: Instantiation failed: Use ExtensionProvider.getInstance() instead of new.");t._instance=this}static getInstance(){return t._instance}setAddress(e){return this.account.address=e,t._instance}init(){return 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(Cc.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(Cc.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 wO.ErrCannotSignSingleTransaction;return r[0]})}ensureConnected(){if(!this.account.address)throw new wO.ErrAccountNotConnected}signTransactions(e){return Oi(this,void 0,void 0,function*(){this.ensureConnected();let r=yield this.startBgrMsgChannel(Cc.Operation.SignTransactions,{from:this.account.address,transactions:e.map(n=>n.toPlainObject())});try{return r.map(i=>bk.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(Cc.Operation.SignMessage,r)).signature,s=h.Buffer.from(i,"hex");return e.applySignature(s),e})}cancelAction(){return this.startBgrMsgChannel(Cc.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)})}};la.ExtensionProvider=xc;xc._instance=new xc});var yr={};ft(yr,{__assign:()=>sv,__asyncDelegator:()=>Lk,__asyncGenerator:()=>Bk,__asyncValues:()=>Fk,__await:()=>Nc,__awaiter:()=>xk,__classPrivateFieldGet:()=>Vk,__classPrivateFieldSet:()=>Hk,__createBinding:()=>Ok,__decorate:()=>Sk,__exportStar:()=>Dk,__extends:()=>_k,__generator:()=>Nk,__importDefault:()=>qk,__importStar:()=>Uk,__makeTemplateObject:()=>Mk,__metadata:()=>Ck,__param:()=>Tk,__read:()=>_O,__rest:()=>Ik,__spread:()=>Pk,__spreadArrays:()=>Rk,__values:()=>ov});function _k(t,e){iv(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function Ik(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 Tk(t,e){return function(r,n){e(r,n,t)}}function Ck(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function xk(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 Nk(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 _O(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 Pk(){for(var t=[],e=0;e1||a(g,w)})})}function a(g,w){try{u(n[g](w))}catch(E){d(s[0][3],E)}}function u(g){g.value instanceof Nc?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,w){g(w),s.shift(),s.length&&a(s[0][0],s[0][1])}}function Lk(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:Nc(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function Fk(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 ov=="function"?ov(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 Mk(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function Uk(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 qk(t){return t&&t.__esModule?t:{default:t}}function Vk(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function Hk(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 iv,sv,mr=ge(()=>{c();iv=function(t,e){return iv=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])},iv(t,e)};sv=function(){return sv=Object.assign||function(e){for(var r,n=1,i=arguments.length;n{"use strict";c();Object.defineProperty(Ad,"__esModule",{value:!0});function Gk(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}}Ad.safeJsonParse=Gk;function jk(t){return typeof t=="string"?t:JSON.stringify(t,(e,r)=>typeof r>"u"?null:r)}Ad.safeJsonStringify=jk});var IO=m((ece,bd)=>{"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?bd.exports=global.localStorage:typeof window<"u"&&window.localStorage?bd.exports=window.localStorage:bd.exports=new e})()});var SO=m(_d=>{"use strict";c();Object.defineProperty(_d,"__esModule",{value:!0});_d.IKeyValueStorage=void 0;var uv=class{};_d.IKeyValueStorage=uv});var TO=m(Id=>{"use strict";c();Object.defineProperty(Id,"__esModule",{value:!0});Id.parseEntry=void 0;var kk=av();function Qk(t){var e;return[t[0],kk.safeJsonParse((e=t[1])!==null&&e!==void 0?e:"")]}Id.parseEntry=Qk});var xO=m(Sd=>{"use strict";c();Object.defineProperty(Sd,"__esModule",{value:!0});var CO=(mr(),ct(yr));CO.__exportStar(SO(),Sd);CO.__exportStar(TO(),Sd)});var OO=m(Oc=>{"use strict";c();Object.defineProperty(Oc,"__esModule",{value:!0});Oc.KeyValueStorage=void 0;var fa=(mr(),ct(yr)),NO=av(),Wk=fa.__importDefault(IO()),zk=xO(),Td=class{constructor(){this.localStorage=Wk.default}getKeys(){return fa.__awaiter(this,void 0,void 0,function*(){return Object.keys(this.localStorage)})}getEntries(){return fa.__awaiter(this,void 0,void 0,function*(){return Object.entries(this.localStorage).map(zk.parseEntry)})}getItem(e){return fa.__awaiter(this,void 0,void 0,function*(){let r=this.localStorage.getItem(e);if(r!==null)return NO.safeJsonParse(r)})}setItem(e,r){return fa.__awaiter(this,void 0,void 0,function*(){this.localStorage.setItem(e,NO.safeJsonStringify(r))})}removeItem(e){return fa.__awaiter(this,void 0,void 0,function*(){this.localStorage.removeItem(e)})}};Oc.KeyValueStorage=Td;Oc.default=Td});var DO=m(Cd=>{"use strict";c();Object.defineProperty(Cd,"__esModule",{value:!0});Cd.delay=void 0;function $k(t){return new Promise(e=>{setTimeout(()=>{e(!0)},t)})}Cd.delay=$k});var PO=m(ha=>{"use strict";c();Object.defineProperty(ha,"__esModule",{value:!0});ha.ONE_THOUSAND=ha.ONE_HUNDRED=void 0;ha.ONE_HUNDRED=100;ha.ONE_THOUSAND=1e3});var RO=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 cv=m(xd=>{"use strict";c();Object.defineProperty(xd,"__esModule",{value:!0});var BO=(mr(),ct(yr));BO.__exportStar(PO(),xd);BO.__exportStar(RO(),xd)});var FO=m(da=>{"use strict";c();Object.defineProperty(da,"__esModule",{value:!0});da.fromMiliseconds=da.toMiliseconds=void 0;var LO=cv();function Kk(t){return t*LO.ONE_THOUSAND}da.toMiliseconds=Kk;function Yk(t){return Math.floor(t/LO.ONE_THOUSAND)}da.fromMiliseconds=Yk});var UO=m(Nd=>{"use strict";c();Object.defineProperty(Nd,"__esModule",{value:!0});var MO=(mr(),ct(yr));MO.__exportStar(DO(),Nd);MO.__exportStar(FO(),Nd)});var qO=m(Dc=>{"use strict";c();Object.defineProperty(Dc,"__esModule",{value:!0});Dc.Watch=void 0;var Od=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}};Dc.Watch=Od;Dc.default=Od});var VO=m(Dd=>{"use strict";c();Object.defineProperty(Dd,"__esModule",{value:!0});Dd.IWatch=void 0;var lv=class{};Dd.IWatch=lv});var HO=m(fv=>{"use strict";c();Object.defineProperty(fv,"__esModule",{value:!0});var Jk=(mr(),ct(yr));Jk.__exportStar(VO(),fv)});var Ms=m(pa=>{"use strict";c();Object.defineProperty(pa,"__esModule",{value:!0});var Pd=(mr(),ct(yr));Pd.__exportStar(UO(),pa);Pd.__exportStar(qO(),pa);Pd.__exportStar(HO(),pa);Pd.__exportStar(cv(),pa)});var hv,GO=ge(()=>{c();hv=class{}});var dv={};ft(dv,{IEvents:()=>hv});var pv=ge(()=>{c();GO()});var jO=m(Rd=>{"use strict";c();Object.defineProperty(Rd,"__esModule",{value:!0});Rd.IHeartBeat=void 0;var Xk=(pv(),ct(dv)),gv=class extends Xk.IEvents{constructor(e){super()}};Rd.IHeartBeat=gv});var mv=m(yv=>{"use strict";c();Object.defineProperty(yv,"__esModule",{value:!0});var Zk=(mr(),ct(yr));Zk.__exportStar(jO(),yv)});var kO=m(ga=>{"use strict";c();Object.defineProperty(ga,"__esModule",{value:!0});ga.HEARTBEAT_EVENTS=ga.HEARTBEAT_INTERVAL=void 0;var e7=Ms();ga.HEARTBEAT_INTERVAL=e7.FIVE_SECONDS;ga.HEARTBEAT_EVENTS={pulse:"heartbeat_pulse"}});var Ev=m(wv=>{"use strict";c();Object.defineProperty(wv,"__esModule",{value:!0});var t7=(mr(),ct(yr));t7.__exportStar(kO(),wv)});var QO=m(Bd=>{"use strict";c();Object.defineProperty(Bd,"__esModule",{value:!0});Bd.HeartBeat=void 0;var vv=(mr(),ct(yr)),r7=kn(),n7=Ms(),i7=mv(),Av=Ev(),bv=class t extends i7.IHeartBeat{constructor(e){super(e),this.events=new r7.EventEmitter,this.interval=Av.HEARTBEAT_INTERVAL,this.interval=e?.interval||Av.HEARTBEAT_INTERVAL}static init(e){return vv.__awaiter(this,void 0,void 0,function*(){let r=new t(e);return yield r.init(),r})}init(){return vv.__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 vv.__awaiter(this,void 0,void 0,function*(){this.intervalRef=setInterval(()=>this.pulse(),n7.toMiliseconds(this.interval))})}pulse(){this.events.emit(Av.HEARTBEAT_EVENTS.pulse)}};Bd.HeartBeat=bv});var WO=m(Pc=>{"use strict";c();Object.defineProperty(Pc,"__esModule",{value:!0});var _v=(mr(),ct(yr));_v.__exportStar(QO(),Pc);_v.__exportStar(mv(),Pc);_v.__exportStar(Ev(),Pc)});var $O=m((Wce,zO)=>{"use strict";c();function s7(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}zO.exports=o7;function o7(t,e,r){var n=r&&r.stringify||s7,i=1;if(typeof t=="object"&&t!==null){var s=e.length+i;if(s===1)return t;var o=new Array(s);o[0]=n(t);for(var a=1;a-1?d:0,t.charCodeAt(w+1)){case 100:case 102:if(f>=u||e[f]==null)break;d=u||e[f]==null)break;d=u||e[f]===void 0)break;d",d=w+2,w++;break}l+=n(e[f]),d=w+2,w++;break;case 115:if(f>=u)break;d{"use strict";c();var KO=$O();XO.exports=bn;var Rc=y7().console||{},a7={mapHttpRequest:Ld,mapHttpResponse:Ld,wrapRequestSerializer:Iv,wrapResponseSerializer:Iv,wrapErrorSerializer:Iv,req:Ld,res:Ld,err:h7};function u7(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||Rc;t.browser.write&&(t.browser.asObject=!0);let n=t.serializers||{},i=u7(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=Bc),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:d7(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=Bc,u.serializers=n,u._serialize=i,u._stdErrSerialize=s,u.child=w,e&&(u._logEvent=Sv());function f(){return this.level==="silent"?1/0:this.levels.values[this.level]}function d(){return this._level}function g(E){if(E!=="silent"&&!this.levels.values[E])throw Error("unknown level "+E);this._level=E,ya(l,u,"error","log"),ya(l,u,"fatal","error"),ya(l,u,"warn","error"),ya(l,u,"info","log"),ya(l,u,"debug","log"),ya(l,u,"trace","log")}function w(E,x){if(!E)throw new Error("missing bindings for child Pino");x=x||{},i&&E.serializers&&(x.serializers=E.serializers);let O=x.serializers;if(i&&O){var F=Object.assign({},n,O),_=t.browser.serialize===!0?Object.keys(F):i;delete E.serializers,Fd([E],_,F,this._stdErrSerialize)}function I(S){this._childLevel=(S._childLevel|0)+1,this.error=ma(S,E,"error"),this.fatal=ma(S,E,"fatal"),this.warn=ma(S,E,"warn"),this.info=ma(S,E,"info"),this.debug=ma(S,E,"debug"),this.trace=ma(S,E,"trace"),F&&(this.serializers=F,this._serialize=_),e&&(this._logEvent=Sv([].concat(S._logEvent.bindings,E)))}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=a7;bn.stdTimeFunctions=Object.assign({},{nullTime:YO,epochTime:JO,unixTime:p7,isoTime:g7});function ya(t,e,r,n){let i=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?Bc:i[r]?i[r]:Rc[r]||Rc[n]||Bc,c7(t,e,r)}function c7(t,e,r){!t.transmit&&e[r]===Bc||(e[r]=function(n){return function(){let s=t.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Rc?Rc:this;for(var u=0;u-1&&s in r&&(t[i][s]=r[s](t[i][s]))}function ma(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(wa,"__esModule",{value:!0});wa.PINO_CUSTOM_CONTEXT_KEY=wa.PINO_LOGGER_DEFAULTS=void 0;wa.PINO_LOGGER_DEFAULTS={level:"info"};wa.PINO_CUSTOM_CONTEXT_KEY="custom_context"});var i2=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=Tv();function m7(t){return Object.assign(Object.assign({},t),{level:t?.level||Ea.PINO_LOGGER_DEFAULTS.level})}fr.getDefaultLoggerOptions=m7;function e2(t,e=Ea.PINO_CUSTOM_CONTEXT_KEY){return t[e]||""}fr.getBrowserLoggerContext=e2;function t2(t,e,r=Ea.PINO_CUSTOM_CONTEXT_KEY){return t[r]=e,t}fr.setBrowserLoggerContext=t2;function r2(t,e=Ea.PINO_CUSTOM_CONTEXT_KEY){let r="";return typeof t.bindings>"u"?r=e2(t,e):r=t.bindings().context||"",r}fr.getLoggerContext=r2;function n2(t,e,r=Ea.PINO_CUSTOM_CONTEXT_KEY){let n=r2(t,r);return n.trim()?`${n}/${e}`:e}fr.formatChildLoggerContext=n2;function w7(t,e,r=Ea.PINO_CUSTOM_CONTEXT_KEY){let n=n2(t,e,r),i=t.child({context:n});return t2(i,n,r)}fr.generateChildLogger=w7});var xv=m(va=>{"use strict";c();Object.defineProperty(va,"__esModule",{value:!0});va.pino=void 0;var Cv=(mr(),ct(yr)),E7=Cv.__importDefault(ZO());Object.defineProperty(va,"pino",{enumerable:!0,get:function(){return E7.default}});Cv.__exportStar(Tv(),va);Cv.__exportStar(i2(),va)});var Wv=m(Dt=>{"use strict";c();Object.defineProperty(Dt,"__esModule",{value:!0});var Aa=(pv(),ct(dv)),s2=kn();function v7(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var A7=v7(s2),Nv=class extends Aa.IEvents{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},Ov=class{constructor(e,r,n){this.core=e,this.logger=r}},Dv=class extends Aa.IEvents{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}},Pv=class{constructor(e,r){this.logger=e,this.core=r}},Rv=class extends Aa.IEvents{constructor(e,r){super(),this.relayer=e,this.logger=r}},Bv=class extends Aa.IEvents{constructor(e){super()}},Lv=class{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}},Fv=class{constructor(){this.map=new Map}},Mv=class extends Aa.IEvents{constructor(e,r){super(),this.relayer=e,this.logger=r}},Uv=class{constructor(e,r){this.core=e,this.logger=r}},qv=class extends Aa.IEvents{constructor(e,r){super(),this.core=e,this.logger=r}},Vv=class{constructor(e,r){this.logger=e,this.core=r}},Hv=class{constructor(e,r){this.projectId=e,this.logger=r}},Gv=class extends A7.default{constructor(){super()}},jv=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},kv=class extends s2.EventEmitter{constructor(){super()}},Qv=class{constructor(e){this.client=e}};Dt.ICore=Nv,Dt.ICrypto=Ov,Dt.IEngine=Qv,Dt.IEngineEvents=kv,Dt.IExpirer=qv,Dt.IJsonRpcHistory=Dv,Dt.IKeyChain=Uv,Dt.IMessageTracker=Pv,Dt.IPairing=Vv,Dt.IPublisher=Rv,Dt.IRelayer=Bv,Dt.ISignClient=jv,Dt.ISignClientEvents=Gv,Dt.IStore=Lv,Dt.ISubscriber=Mv,Dt.ISubscriberTopicMap=Fv,Dt.IVerify=Hv});var o2={};ft(o2,{safeJsonParse:()=>Lc,safeJsonStringify:()=>Fc});function Lc(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return _7(t)}catch{return t}}function Fc(t){return typeof t=="string"?t:b7(t)||""}var b7,_7,Md=ge(()=>{c();b7=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),_7=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 u2=m(Ud=>{"use strict";c();Object.defineProperty(Ud,"__esModule",{value:!0});Ud.BrowserRandomSource=void 0;var a2=65536,zv=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($v,"__esModule",{value:!0});function I7(t){for(var e=0;e{c()});var l2=m(qd=>{"use strict";c();Object.defineProperty(qd,"__esModule",{value:!0});qd.NodeRandomSource=void 0;var S7=Mr(),Kv=class{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof PI<"u"){let e=c2();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(Vd,"__esModule",{value:!0});Vd.SystemRandomSource=void 0;var T7=u2(),C7=l2(),Yv=class{constructor(){if(this.isAvailable=!1,this.name="",this._source=new T7.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new C7.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)}};Vd.SystemRandomSource=Yv});var h2=m(wr=>{"use strict";c();Object.defineProperty(wr,"__esModule",{value:!0});function x7(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}wr.mul=Math.imul||x7;function N7(t,e){return t+e|0}wr.add=N7;function O7(t,e){return t-e|0}wr.sub=O7;function D7(t,e){return t<>>32-e}wr.rotl=D7;function P7(t,e){return t<<32-e|t>>>e}wr.rotr=P7;function R7(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t}wr.isInteger=Number.isInteger||R7;wr.MAX_SAFE_INTEGER=9007199254740991;wr.isSafeInteger=function(t){return wr.isInteger(t)&&t>=-wr.MAX_SAFE_INTEGER&&t<=wr.MAX_SAFE_INTEGER}});var ba=m(Ne=>{"use strict";c();Object.defineProperty(Ne,"__esModule",{value:!0});var d2=h2();function B7(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}Ne.readInt16BE=B7;function L7(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}Ne.readUint16BE=L7;function F7(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}Ne.readInt16LE=F7;function M7(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}Ne.readUint16LE=M7;function p2(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}Ne.writeUint16BE=p2;Ne.writeInt16BE=p2;function g2(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=g2;Ne.writeInt16LE=g2;function Jv(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}Ne.readInt32BE=Jv;function Xv(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=Xv;function Zv(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}Ne.readInt32LE=Zv;function e1(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=e1;function Hd(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=Hd;Ne.writeInt32BE=Hd;function Gd(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=Gd;Ne.writeInt32LE=Gd;function U7(t,e){e===void 0&&(e=0);var r=Jv(t,e),n=Jv(t,e+4);return r*4294967296+n-(n>>31)*4294967296}Ne.readInt64BE=U7;function q7(t,e){e===void 0&&(e=0);var r=Xv(t,e),n=Xv(t,e+4);return r*4294967296+n}Ne.readUint64BE=q7;function V7(t,e){e===void 0&&(e=0);var r=Zv(t,e),n=Zv(t,e+4);return n*4294967296+r-(r>>31)*4294967296}Ne.readInt64LE=V7;function H7(t,e){e===void 0&&(e=0);var r=e1(t,e),n=e1(t,e+4);return n*4294967296+r}Ne.readUint64LE=H7;function y2(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),Hd(t/4294967296>>>0,e,r),Hd(t>>>0,e,r+4),e}Ne.writeUint64BE=y2;Ne.writeInt64BE=y2;function m2(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),Gd(t>>>0,e,r),Gd(t/4294967296>>>0,e,r+4),e}Ne.writeUint64LE=m2;Ne.writeInt64LE=m2;function G7(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=G7;function j7(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=k7;function Q7(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(!d2.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 e9=f2(),t9=ba(),w2=Mr();Kt.defaultRandomSource=new e9.SystemRandomSource;function t1(t,e=Kt.defaultRandomSource){return e.randomBytes(t)}Kt.randomBytes=t1;function r9(t=Kt.defaultRandomSource){let e=t1(4,t),r=(0,t9.readUint32LE)(e);return(0,w2.wipe)(e),r}Kt.randomUint32=r9;var E2="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function v2(t,e=E2,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=t1(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 Ia=ba(),_a=Mr();Wn.DIGEST_LENGTH=64;Wn.BLOCK_SIZE=128;var b2=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(){_a.wipe(this._buffer),_a.wipe(this._tempHi),_a.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&&(r1(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(n=r1(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){_a.wipe(e.stateHi),_a.wipe(e.stateLo),e.buffer&&_a.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},t}();Wn.SHA512=b2;var A2=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 r1(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],w=r[6],E=r[7],x=n[0],O=n[1],F=n[2],_=n[3],I=n[4],S=n[5],R=n[6],B=n[7],b,T,L,X,W,G,j,K;o>=128;){for(var de=0;de<16;de++){var ue=8*de+s;t[de]=Ia.readUint32BE(i,ue),e[de]=Ia.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=w,ae=E,fe=x,oe=O,ce=F,y=_,v=I,A=S,P=R,C=B;if(b=E,T=B,W=T&65535,G=T>>>16,j=b&65535,K=b>>>16,b=(d>>>14|I<<32-14)^(d>>>18|I<<32-18)^(I>>>41-32|d<<32-(41-32)),T=(I>>>14|d<<32-14)^(I>>>18|d<<32-18)^(d>>>41-32|I<<32-(41-32)),W+=T&65535,G+=T>>>16,j+=b&65535,K+=b>>>16,b=d&g^~d&w,T=I&S^~I&R,W+=T&65535,G+=T>>>16,j+=b&65535,K+=b>>>16,b=A2[de*2],T=A2[de*2+1],W+=T&65535,G+=T>>>16,j+=b&65535,K+=b>>>16,b=t[de%16],T=e[de%16],W+=T&65535,G+=T>>>16,j+=b&65535,K+=b>>>16,G+=W>>>16,j+=G>>>16,K+=j>>>16,L=j&65535|K<<16,X=W&65535|G<<16,b=L,T=X,W=T&65535,G=T>>>16,j=b&65535,K=b>>>16,b=(a>>>28|x<<32-28)^(x>>>34-32|a<<32-(34-32))^(x>>>39-32|a<<32-(39-32)),T=(x>>>28|a<<32-28)^(a>>>34-32|x<<32-(34-32))^(a>>>39-32|x<<32-(39-32)),W+=T&65535,G+=T>>>16,j+=b&65535,K+=b>>>16,b=a&u^a&l^u&l,T=x&O^x&F^O&F,W+=T&65535,G+=T>>>16,j+=b&65535,K+=b>>>16,G+=W>>>16,j+=G>>>16,K+=j>>>16,ae=j&65535|K<<16,C=W&65535|G<<16,b=te,T=y,W=T&65535,G=T>>>16,j=b&65535,K=b>>>16,b=L,T=X,W+=T&65535,G+=T>>>16,j+=b&65535,K+=b>>>16,G+=W>>>16,j+=G>>>16,K+=j>>>16,te=j&65535|K<<16,y=W&65535|G<<16,u=re,l=Y,f=se,d=te,g=ie,w=q,E=le,a=ae,O=fe,F=oe,_=ce,I=y,S=v,R=A,B=P,x=C,de%16===15)for(var ue=0;ue<16;ue++)b=t[ue],T=e[ue],W=T&65535,G=T>>>16,j=b&65535,K=b>>>16,b=t[(ue+9)%16],T=e[(ue+9)%16],W+=T&65535,G+=T>>>16,j+=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,T=(X>>>1|L<<32-1)^(X>>>8|L<<32-8)^(X>>>7|L<<32-7),W+=T&65535,G+=T>>>16,j+=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,T=(X>>>19|L<<32-19)^(L>>>61-32|X<<32-(61-32))^(X>>>6|L<<32-6),W+=T&65535,G+=T>>>16,j+=b&65535,K+=b>>>16,G+=W>>>16,j+=G>>>16,K+=j>>>16,t[ue]=j&65535|K<<16,e[ue]=W&65535|G<<16}b=a,T=x,W=T&65535,G=T>>>16,j=b&65535,K=b>>>16,b=r[0],T=n[0],W+=T&65535,G+=T>>>16,j+=b&65535,K+=b>>>16,G+=W>>>16,j+=G>>>16,K+=j>>>16,r[0]=a=j&65535|K<<16,n[0]=x=W&65535|G<<16,b=u,T=O,W=T&65535,G=T>>>16,j=b&65535,K=b>>>16,b=r[1],T=n[1],W+=T&65535,G+=T>>>16,j+=b&65535,K+=b>>>16,G+=W>>>16,j+=G>>>16,K+=j>>>16,r[1]=u=j&65535|K<<16,n[1]=O=W&65535|G<<16,b=l,T=F,W=T&65535,G=T>>>16,j=b&65535,K=b>>>16,b=r[2],T=n[2],W+=T&65535,G+=T>>>16,j+=b&65535,K+=b>>>16,G+=W>>>16,j+=G>>>16,K+=j>>>16,r[2]=l=j&65535|K<<16,n[2]=F=W&65535|G<<16,b=f,T=_,W=T&65535,G=T>>>16,j=b&65535,K=b>>>16,b=r[3],T=n[3],W+=T&65535,G+=T>>>16,j+=b&65535,K+=b>>>16,G+=W>>>16,j+=G>>>16,K+=j>>>16,r[3]=f=j&65535|K<<16,n[3]=_=W&65535|G<<16,b=d,T=I,W=T&65535,G=T>>>16,j=b&65535,K=b>>>16,b=r[4],T=n[4],W+=T&65535,G+=T>>>16,j+=b&65535,K+=b>>>16,G+=W>>>16,j+=G>>>16,K+=j>>>16,r[4]=d=j&65535|K<<16,n[4]=I=W&65535|G<<16,b=g,T=S,W=T&65535,G=T>>>16,j=b&65535,K=b>>>16,b=r[5],T=n[5],W+=T&65535,G+=T>>>16,j+=b&65535,K+=b>>>16,G+=W>>>16,j+=G>>>16,K+=j>>>16,r[5]=g=j&65535|K<<16,n[5]=S=W&65535|G<<16,b=w,T=R,W=T&65535,G=T>>>16,j=b&65535,K=b>>>16,b=r[6],T=n[6],W+=T&65535,G+=T>>>16,j+=b&65535,K+=b>>>16,G+=W>>>16,j+=G>>>16,K+=j>>>16,r[6]=w=j&65535|K<<16,n[6]=R=W&65535|G<<16,b=E,T=B,W=T&65535,G=T>>>16,j=b&65535,K=b>>>16,b=r[7],T=n[7],W+=T&65535,G+=T>>>16,j+=b&65535,K+=b>>>16,G+=W>>>16,j+=G>>>16,K+=j>>>16,r[7]=E=j&65535|K<<16,n[7]=B=W&65535|G<<16,s+=128,o-=128}return s}function i9(t){var e=new b2;e.update(t);var r=e.digest();return e.clean(),r}Wn.hash=i9});var M2=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 s9=Mc(),Uc=_2(),x2=Mr();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,N2(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 O2(t,e){let r=0;for(let n=0;n<32;n++)r|=t[n]^e[n];return(1&r-1>>>8)-1}function T2(t,e){let r=new Uint8Array(32),n=new Uint8Array(32);return qc(r,t),qc(n,e),O2(r,n)}function D2(t){let e=new Uint8Array(32);return qc(e,t),e[0]&1}function l9(t,e){for(let r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function Us(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]+r[n]}function Vs(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,w=0,E=0,x=0,O=0,F=0,_=0,I=0,S=0,R=0,B=0,b=0,T=0,L=0,X=0,W=0,G=0,j=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],v=r[9],A=r[10],P=r[11],C=r[12],D=r[13],M=r[14],N=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,w+=n*y,E+=n*v,x+=n*A,O+=n*P,F+=n*C,_+=n*D,I+=n*M,S+=n*N,n=e[1],o+=n*te,a+=n*ie,u+=n*q,l+=n*le,f+=n*ae,d+=n*fe,g+=n*oe,w+=n*ce,E+=n*y,x+=n*v,O+=n*A,F+=n*P,_+=n*C,I+=n*D,S+=n*M,R+=n*N,n=e[2],a+=n*te,u+=n*ie,l+=n*q,f+=n*le,d+=n*ae,g+=n*fe,w+=n*oe,E+=n*ce,x+=n*y,O+=n*v,F+=n*A,_+=n*P,I+=n*C,S+=n*D,R+=n*M,B+=n*N,n=e[3],u+=n*te,l+=n*ie,f+=n*q,d+=n*le,g+=n*ae,w+=n*fe,E+=n*oe,x+=n*ce,O+=n*y,F+=n*v,_+=n*A,I+=n*P,S+=n*C,R+=n*D,B+=n*M,b+=n*N,n=e[4],l+=n*te,f+=n*ie,d+=n*q,g+=n*le,w+=n*ae,E+=n*fe,x+=n*oe,O+=n*ce,F+=n*y,_+=n*v,I+=n*A,S+=n*P,R+=n*C,B+=n*D,b+=n*M,T+=n*N,n=e[5],f+=n*te,d+=n*ie,g+=n*q,w+=n*le,E+=n*ae,x+=n*fe,O+=n*oe,F+=n*ce,_+=n*y,I+=n*v,S+=n*A,R+=n*P,B+=n*C,b+=n*D,T+=n*M,L+=n*N,n=e[6],d+=n*te,g+=n*ie,w+=n*q,E+=n*le,x+=n*ae,O+=n*fe,F+=n*oe,_+=n*ce,I+=n*y,S+=n*v,R+=n*A,B+=n*P,b+=n*C,T+=n*D,L+=n*M,X+=n*N,n=e[7],g+=n*te,w+=n*ie,E+=n*q,x+=n*le,O+=n*ae,F+=n*fe,_+=n*oe,I+=n*ce,S+=n*y,R+=n*v,B+=n*A,b+=n*P,T+=n*C,L+=n*D,X+=n*M,W+=n*N,n=e[8],w+=n*te,E+=n*ie,x+=n*q,O+=n*le,F+=n*ae,_+=n*fe,I+=n*oe,S+=n*ce,R+=n*y,B+=n*v,b+=n*A,T+=n*P,L+=n*C,X+=n*D,W+=n*M,G+=n*N,n=e[9],E+=n*te,x+=n*ie,O+=n*q,F+=n*le,_+=n*ae,I+=n*fe,S+=n*oe,R+=n*ce,B+=n*y,b+=n*v,T+=n*A,L+=n*P,X+=n*C,W+=n*D,G+=n*M,j+=n*N,n=e[10],x+=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,T+=n*v,L+=n*A,X+=n*P,W+=n*C,G+=n*D,j+=n*M,K+=n*N,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,T+=n*y,L+=n*v,X+=n*A,W+=n*P,G+=n*C,j+=n*D,K+=n*M,de+=n*N,n=e[12],F+=n*te,_+=n*ie,I+=n*q,S+=n*le,R+=n*ae,B+=n*fe,b+=n*oe,T+=n*ce,L+=n*y,X+=n*v,W+=n*A,G+=n*P,j+=n*C,K+=n*D,de+=n*M,ue+=n*N,n=e[13],_+=n*te,I+=n*ie,S+=n*q,R+=n*le,B+=n*ae,b+=n*fe,T+=n*oe,L+=n*ce,X+=n*y,W+=n*v,G+=n*A,j+=n*P,K+=n*C,de+=n*D,ue+=n*M,re+=n*N,n=e[14],I+=n*te,S+=n*ie,R+=n*q,B+=n*le,b+=n*ae,T+=n*fe,L+=n*oe,X+=n*ce,W+=n*y,G+=n*v,j+=n*A,K+=n*P,de+=n*C,ue+=n*D,re+=n*M,Y+=n*N,n=e[15],S+=n*te,R+=n*ie,B+=n*q,b+=n*le,T+=n*ae,L+=n*fe,X+=n*oe,W+=n*ce,G+=n*y,j+=n*v,K+=n*A,de+=n*P,ue+=n*C,re+=n*D,Y+=n*M,se+=n*N,s+=38*R,o+=38*B,a+=38*b,u+=38*T,l+=38*L,f+=38*X,d+=38*W,g+=38*G,w+=38*j,E+=38*K,x+=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=w+i+65535,i=Math.floor(n/65536),w=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=x+i+65535,i=Math.floor(n/65536),x=n-i*65536,n=O+i+65535,i=Math.floor(n/65536),O=n-i*65536,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=w+i+65535,i=Math.floor(n/65536),w=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=x+i+65535,i=Math.floor(n/65536),x=n-i*65536,n=O+i+65535,i=Math.floor(n/65536),O=n-i*65536,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]=w,t[9]=E,t[10]=x,t[11]=O,t[12]=F,t[13]=_,t[14]=I,t[15]=S}function qs(t,e){Qe(t,e,e)}function P2(t,e){let r=be(),n;for(n=0;n<16;n++)r[n]=e[n];for(n=253;n>=0;n--)qs(r,r),n!==2&&n!==4&&Qe(r,r,e);for(n=0;n<16;n++)t[n]=r[n]}function f9(t,e){let r=be(),n;for(n=0;n<16;n++)r[n]=e[n];for(n=250;n>=0;n--)qs(r,r),n!==1&&Qe(r,r,e);for(n=0;n<16;n++)t[n]=r[n]}function o1(t,e){let r=be(),n=be(),i=be(),s=be(),o=be(),a=be(),u=be(),l=be(),f=be();Vs(r,t[1],t[0]),Vs(f,e[1],e[0]),Qe(r,r,f),Us(n,t[0],t[1]),Us(f,e[0],e[1]),Qe(n,n,f),Qe(i,t[3],e[3]),Qe(i,i,u9),Qe(s,t[2],e[2]),Us(s,s,s),Vs(o,n,r),Vs(a,s,i),Us(u,s,i),Us(l,n,r),Qe(t[0],o,a),Qe(t[1],l,u),Qe(t[2],u,a),Qe(t[3],o,l)}function C2(t,e,r){for(let n=0;n<4;n++)N2(t[n],e[n],r)}function u1(t,e){let r=be(),n=be(),i=be();P2(i,e[2]),Qe(r,e[0],i),Qe(n,e[1],i),qc(t,n),t[31]^=D2(r)<<7}function R2(t,e,r){Pi(t[0],s1),Pi(t[1],Sa),Pi(t[2],Sa),Pi(t[3],s1);for(let n=255;n>=0;--n){let i=r[n/8|0]>>(n&7)&1;C2(t,e,i),o1(e,t),o1(t,t),C2(t,e,i)}}function c1(t,e){let r=[be(),be(),be(),be()];Pi(r[0],I2),Pi(r[1],S2),Pi(r[2],Sa),Qe(r[3],I2,S2),R2(t,r,e)}function B2(t){if(t.length!==Ve.SEED_LENGTH)throw new Error(`ed25519: seed must be ${Ve.SEED_LENGTH} bytes`);let e=(0,Uc.hash)(t);e[0]&=248,e[31]&=127,e[31]|=64;let r=new Uint8Array(32),n=[be(),be(),be(),be()];c1(n,e),u1(r,n);let i=new Uint8Array(64);return i.set(t),i.set(r,32),{publicKey:r,secretKey:i}}Ve.generateKeyPairFromSeed=B2;function h9(t){let e=(0,s9.randomBytes)(32,t),r=B2(e);return(0,x2.wipe)(e),r}Ve.generateKeyPair=h9;function d9(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=d9;var i1=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 L2(t,e){let r,n,i,s;for(n=63;n>=32;--n){for(r=0,i=n-32,s=n-12;i>4)*i1[i],r=e[i]>>8,e[i]&=255;for(i=0;i<32;i++)e[i]-=r*i1[i];for(n=0;n<32;n++)e[n+1]+=e[n]>>8,t[n]=e[n]&255}function a1(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;L2(t,e)}function p9(t,e){let r=new Float64Array(64),n=[be(),be(),be(),be()],i=(0,Uc.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 Uc.SHA512;o.update(s.subarray(32)),o.update(e);let a=o.digest();o.clean(),a1(a),c1(n,a),u1(s,n),o.reset(),o.update(s.subarray(0,32)),o.update(t.subarray(32)),o.update(e);let u=o.digest();a1(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 L2(s.subarray(32),r),s}Ve.sign=p9;function F2(t,e){let r=be(),n=be(),i=be(),s=be(),o=be(),a=be(),u=be();return Pi(t[2],Sa),l9(t[1],e),qs(i,t[1]),Qe(s,i,a9),Vs(i,i,t[2]),Us(s,t[2],s),qs(o,s),qs(a,o),Qe(u,a,o),Qe(r,u,i),Qe(r,r,s),f9(r,r),Qe(r,r,i),Qe(r,r,s),Qe(r,r,s),Qe(t[0],r,s),qs(n,t[0]),Qe(n,n,s),T2(n,i)&&Qe(t[0],t[0],c9),qs(n,t[0]),Qe(n,n,s),T2(n,i)?-1:(D2(t[0])===e[31]>>7&&Vs(t[0],s1,t[0]),Qe(t[3],t[0],t[1]),0)}function g9(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(F2(s,t))return!1;let o=new Uc.SHA512;o.update(r.subarray(0,32)),o.update(t),o.update(e);let a=o.digest();return a1(a),R2(i,s,a),c1(s,r.subarray(32)),o1(i,s),u1(n,i),!O2(r,n)}Ve.verify=g9;function y9(t){let e=[be(),be(),be(),be()];if(F2(e,t))throw new Error("Ed25519: invalid public key");let r=be(),n=be(),i=e[1];Us(r,Sa,i),Vs(n,Sa,i),P2(n,n),Qe(r,r,n);let s=new Uint8Array(32);return qc(s,r),s}Ve.convertPublicKeyToX25519=y9;function m9(t){let e=(0,Uc.hash)(t.subarray(0,32));e[0]&=248,e[31]&=127,e[31]|=64;let r=new Uint8Array(e.subarray(0,32));return(0,x2.wipe)(e),r}Ve.convertSecretKeyToX25519=m9});var jd,kd,Hs,Ta,Qd,Vc,Wd,zd,$d,Ca,Kd,Yd,U2,q2,Jd=ge(()=>{c();jd="EdDSA",kd="JWT",Hs=".",Ta="base64url",Qd="utf8",Vc="utf8",Wd=":",zd="did",$d="key",Ca="base58btc",Kd="z",Yd="K36",U2=32,q2=32});function Ri(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}var Hc=ge(()=>{c()});function xa(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?Ri(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}var Xd=ge(()=>{c();Hc()});function Zd(t,e){e||(e=t.reduce((i,s)=>i+s.length,0));let r=xa(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return Ri(r)}var l1=ge(()=>{c();Xd();Hc()});function w9(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=E[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 T=I-O;T!==I&&S[T]===0;)T++;for(var L=u.repeat(x);T>>0,I=new Uint8Array(_);E[x];){var S=r[E.charCodeAt(x)];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,x++}if(E[x]!==" "){for(var b=_-F;b!==_&&I[b]===0;)b++;for(var T=new Uint8Array(O+(_-b)),L=O;b!==_;)T[L++]=I[b++];return T}}}function w(E){var x=g(E);if(x)return x;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:g,decode:w}}var E9,v9,V2,H2=ge(()=>{c();E9=w9,v9=E9,V2=v9});var Vle,G2,zn,j2,k2,Bi=ge(()=>{c();Vle=new Uint8Array(0),G2=(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")},j2=t=>new TextEncoder().encode(t),k2=t=>new TextDecoder().decode(t)});var f1,h1,d1,W2,p1,Na,Li,A9,b9,pt,zr=ge(()=>{c();H2();Bi();f1=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")}},h1=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 W2(this,e)}},d1=class{constructor(e){this.decoders=e}or(e){return W2(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`)}},W2=(t,e)=>new d1({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),p1=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new f1(e,r,n),this.decoder=new h1(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},Na=({name:t,prefix:e,encode:r,decode:n})=>new p1(t,e,r,n),Li=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=V2(r,e);return Na({prefix:t,name:e,encode:n,decode:s=>zn(i(s))})},A9=(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},b9=(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<Na({prefix:e,name:t,encode(i){return b9(i,n,r)},decode(i){return A9(i,n,r,t)}})});var g1={};ft(g1,{identity:()=>_9});var _9,z2=ge(()=>{c();zr();Bi();_9=Na({prefix:"\0",name:"identity",encode:t=>k2(t),decode:t=>j2(t)})});var y1={};ft(y1,{base2:()=>I9});var I9,$2=ge(()=>{c();zr();I9=pt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1})});var m1={};ft(m1,{base8:()=>S9});var S9,K2=ge(()=>{c();zr();S9=pt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3})});var w1={};ft(w1,{base10:()=>T9});var T9,Y2=ge(()=>{c();zr();T9=Li({prefix:"9",name:"base10",alphabet:"0123456789"})});var E1={};ft(E1,{base16:()=>C9,base16upper:()=>x9});var C9,x9,J2=ge(()=>{c();zr();C9=pt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),x9=pt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})});var v1={};ft(v1,{base32:()=>Oa,base32hex:()=>P9,base32hexpad:()=>B9,base32hexpadupper:()=>L9,base32hexupper:()=>R9,base32pad:()=>O9,base32padupper:()=>D9,base32upper:()=>N9,base32z:()=>F9});var Oa,N9,O9,D9,P9,R9,B9,L9,F9,A1=ge(()=>{c();zr();Oa=pt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),N9=pt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),O9=pt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),D9=pt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),P9=pt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),R9=pt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),B9=pt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),L9=pt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),F9=pt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})});var b1={};ft(b1,{base36:()=>M9,base36upper:()=>U9});var M9,U9,X2=ge(()=>{c();zr();M9=Li({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),U9=Li({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})});var _1={};ft(_1,{base58btc:()=>_n,base58flickr:()=>q9});var _n,q9,I1=ge(()=>{c();zr();_n=Li({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),q9=Li({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})});var S1={};ft(S1,{base64:()=>V9,base64pad:()=>H9,base64url:()=>G9,base64urlpad:()=>j9});var V9,H9,G9,j9,Z2=ge(()=>{c();zr();V9=pt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),H9=pt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),G9=pt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),j9=pt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})});var T1={};ft(T1,{base256emoji:()=>$9});function W9(t){return t.reduce((e,r)=>(e+=k9[r],e),"")}function z9(t){let e=[];for(let r of t){let n=Q9[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var eD,k9,Q9,$9,tD=ge(()=>{c();zr();eD=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}"),k9=eD.reduce((t,e,r)=>(t[r]=e,t),[]),Q9=eD.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);$9=Na({prefix:"\u{1F680}",name:"base256emoji",encode:W9,decode:z9})});function iD(t,e,r){e=e||[],r=r||0;for(var n=r;t>=X9;)e[r++]=t&255|rD,t/=128;for(;t&J9;)e[r++]=t&255|rD,t>>>=7;return e[r]=t|0,iD.bytes=r-n+1,e}function C1(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw C1.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&nD)<=eQ);return C1.bytes=s-n,r}var K9,rD,Y9,J9,X9,Z9,eQ,nD,tQ,rQ,nQ,iQ,sQ,oQ,aQ,uQ,cQ,lQ,fQ,hQ,Gc,sD=ge(()=>{c();K9=iD,rD=128,Y9=127,J9=~Y9,X9=Math.pow(2,31);Z9=C1,eQ=128,nD=127;tQ=Math.pow(2,7),rQ=Math.pow(2,14),nQ=Math.pow(2,21),iQ=Math.pow(2,28),sQ=Math.pow(2,35),oQ=Math.pow(2,42),aQ=Math.pow(2,49),uQ=Math.pow(2,56),cQ=Math.pow(2,63),lQ=function(t){return t{c();sD();jc=(t,e=0)=>[Gc.decode(t,e),Gc.decode.bytes],Da=(t,e,r=0)=>(Gc.encode(t,e,r),e),Pa=t=>Gc.encodingLength(t)});var Gs,oD,aD,Ra,Qc=ge(()=>{c();Bi();tp();Gs=(t,e)=>{let r=e.byteLength,n=Pa(t),i=n+Pa(r),s=new Uint8Array(i+r);return Da(t,s,0),Da(r,s,n),s.set(e,i),new Ra(t,r,e,s)},oD=t=>{let e=zn(t),[r,n]=jc(e),[i,s]=jc(e.subarray(n)),o=e.subarray(n+s);if(o.byteLength!==i)throw new Error("Incorrect length");return new Ra(r,i,o,e)},aD=(t,e)=>t===e?!0:t.code===e.code&&t.size===e.size&&G2(t.bytes,e.bytes),Ra=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}});var N1,x1,O1=ge(()=>{c();Qc();N1=({name:t,code:e,encode:r})=>new x1(t,e,r),x1=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?Gs(this.code,r):r.then(n=>Gs(this.code,n))}else throw Error("Unknown type, must be binary type")}}});var D1={};ft(D1,{sha256:()=>dQ,sha512:()=>pQ});var cD,dQ,pQ,lD=ge(()=>{c();O1();cD=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),dQ=N1({name:"sha2-256",code:18,encode:cD("SHA-256")}),pQ=N1({name:"sha2-512",code:19,encode:cD("SHA-512")})});var P1={};ft(P1,{identity:()=>mQ});var fD,gQ,hD,yQ,mQ,dD=ge(()=>{c();Bi();Qc();fD=0,gQ="identity",hD=zn,yQ=t=>Gs(fD,hD(t)),mQ={code:fD,name:gQ,encode:hD,digest:yQ}});var pD=ge(()=>{c();Bi()});var Tfe,Cfe,gD=ge(()=>{c();Tfe=new TextEncoder,Cfe=new TextDecoder});var ip,vQ,AQ,bQ,Wc,_Q,yD,mD,rp,np,IQ,SQ,TQ,wD=ge(()=>{c();tp();Qc();I1();A1();Bi();ip=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:np,byteLength:np,code:rp,version:rp,multihash:rp,bytes:rp,_baseCache:np,asCID:np})}toV0(){switch(this.version){case 0:return this;default:{let{code:e,multihash:r}=this;if(e!==Wc)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==_Q)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=Gs(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&&aD(this.multihash,e.multihash)}toString(e){let{bytes:r,version:n,_baseCache:i}=this;switch(n){case 0:return AQ(r,i,e||_n.encoder);default:return bQ(r,i,e||Oa.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 SQ(/^0\.0/,TQ),!!(e&&(e[mD]||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||yD(r,n,i.bytes))}else if(e!=null&&e[mD]===!0){let{version:r,multihash:n,code:i}=e,s=oD(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!==Wc)throw new Error(`Version 0 CID must use dag-pb (code: ${Wc}) block encoding`);return new t(e,r,n,n.bytes)}case 1:{let i=yD(e,r,n.bytes);return new t(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return t.create(0,Wc,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 Ra(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]=jc(e.subarray(r));return r+=g,d},i=n(),s=Wc;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]=vQ(e,r),s=t.decode(i);return s._baseCache.set(n,e),s}},vQ=(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 Oa.prefix:{let r=e||Oa;return[Oa.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)]}}},AQ=(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},bQ=(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},Wc=112,_Q=18,yD=(t,e,r)=>{let n=Pa(t),i=n+Pa(e),s=new Uint8Array(i+r.byteLength);return Da(t,s,0),Da(e,s,n),s.set(r,i),s},mD=Symbol.for("@ipld/js-cid/CID"),rp={writable:!1,configurable:!1,enumerable:!0},np={writable:!1,enumerable:!1,configurable:!1},IQ="0.0.0-dev",SQ=(t,e)=>{if(t.test(IQ))console.warn(e);else throw new Error(e)},TQ=`CID.isCID(v) is deprecated and will be removed in the next major release. +`)}};he.ErrContractHasNoAddress=im;var sm=class extends De{constructor(e){super(e)}};he.ErrMock=sm;var om=class extends De{constructor(e){super(e)}};he.ErrTypingSystem=om;var am=class extends De{constructor(e,r){super(`field ${e} does not exist on struct ${r}`)}};he.ErrMissingFieldOnStruct=am;var um=class extends De{constructor(e,r){super(`field ${e} does not exist on enum ${r}`)}};he.ErrMissingFieldOnEnum=um;var cm=class extends De{constructor(e){super(`cannot parse contract results: ${e}`)}};he.ErrCannotParseContractResults=cm;var lm=class extends De{constructor(e,r){super(`cannot parse outcome of transaction ${e}: ${r}`)}};he.ErrCannotParseTransactionOutcome=lm;var fm=class extends De{constructor(e){super(e)}};he.ErrCodec=fm;var hm=class extends De{constructor(e){super(e)}};he.ErrContractInteraction=hm;var dm=class extends De{constructor(){super("Method not yet implemented")}};he.ErrNotImplemented=dm;var pm=class extends De{constructor(){super("invalid arguments for relayed v1 builder")}};he.ErrInvalidRelayedV1BuilderArguments=pm;var gm=class extends De{constructor(){super("invalid arguments for relayed v2 builder")}};he.ErrInvalidRelayedV2BuilderArguments=gm;var ym=class extends De{constructor(){super("gas limit must be 0 for the inner transaction for relayed v2")}};he.ErrGasLimitShouldBe0ForInnerTransaction=ym;var mm=class extends De{constructor(){super("The transaction watcher requires the `isCompleted` property to be defined on the transaction object. Perhaps you've used the sdk-network-provider's `ProxyNetworkProvider.getTransaction()` and in that case you should also pass `withProcessStatus=true`.")}};he.ErrIsCompletedFieldIsMissingOnTransaction=mm});var Em=m(di=>{"use strict";c();var k5=di&&di.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(di,"__esModule",{value:!0});di.TokenPayment=di.TokenTransfer=void 0;var Cu=k5(Gt()),j5=Be(),ES="EGLD",vS=18;Cu.default.set({ROUNDING_MODE:1});var nf=class t{constructor(e){let r=new Cu.default(e.amountAsBigInteger);if(!r.isInteger()||r.isNegative())throw new j5.ErrInvalidArgument(`bad amountAsBigInteger: ${e.amountAsBigInteger}`);this.tokenIdentifier=e.tokenIdentifier,this.nonce=e.nonce,this.amountAsBigInteger=r,this.numDecimals=e.numDecimals||0}static egldFromAmount(e){let r=new Cu.default(e).shiftedBy(vS).decimalPlaces(0);return this.egldFromBigInteger(r)}static egldFromBigInteger(e){return new t({tokenIdentifier:ES,nonce:0,amountAsBigInteger:e,numDecimals:vS})}static fungibleFromAmount(e,r,n){let i=new Cu.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 Cu.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==ES}isFungible(){return this.nonce==0}};di.TokenTransfer=nf;var wm=class extends nf{constructor(e,r,n,i){super({tokenIdentifier:e,nonce:r,amountAsBigInteger:n,numDecimals:i})}};di.TokenPayment=wm});var bs=m(ze=>{"use strict";c();Object.defineProperty(ze,"__esModule",{value:!0});ze.ARGUMENTS_SEPARATOR=ze.ESDT_TRANSFER_VALUE=ze.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME=ze.ESDTNFT_TRANSFER_FUNCTION_NAME=ze.ESDT_TRANSFER_FUNCTION_NAME=ze.ESDT_TRANSFER_GAS_LIMIT=ze.TRANSACTION_VERSION_WITH_OPTIONS=ze.TRANSACTION_VERSION_DEFAULT=ze.TRANSACTION_OPTIONS_TX_GUARDED=ze.TRANSACTION_OPTIONS_TX_HASH_SIGN=ze.TRANSACTION_OPTIONS_DEFAULT=ze.TRANSACTION_MIN_GAS_PRICE=void 0;ze.TRANSACTION_MIN_GAS_PRICE=1e9;ze.TRANSACTION_OPTIONS_DEFAULT=0;ze.TRANSACTION_OPTIONS_TX_HASH_SIGN=1;ze.TRANSACTION_OPTIONS_TX_GUARDED=2;ze.TRANSACTION_VERSION_DEFAULT=1;ze.TRANSACTION_VERSION_WITH_OPTIONS=2;ze.ESDT_TRANSFER_GAS_LIMIT=5e5;ze.ESDT_TRANSFER_FUNCTION_NAME="ESDTTransfer";ze.ESDTNFT_TRANSFER_FUNCTION_NAME="ESDTNFTTransfer";ze.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME="MultiESDTNFTTransfer";ze.ESDT_TRANSFER_VALUE="0";ze.ARGUMENTS_SEPARATOR="@"});var wr=m(nt=>{"use strict";c();var Q5=nt&&nt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),W5=nt&&nt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$5=nt&&nt.__importStar||function(t){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 W5(e,t),e};Object.defineProperty(nt,"__esModule",{value:!0});nt.isEmpty=nt.guardEmpty=nt.guardNotEmpty=nt.guardLength=nt.guardSameLength=nt.guardValueIsSetWithMessage=nt.guardValueIsSet=nt.guardTrue=void 0;var bo=$5(Be());function z5(t,e){if(!t)throw new bo.ErrInvariantFailed(`[<${e}>] isn't true`)}nt.guardTrue=z5;function K5(t,e){AS(`${t} isn't set (null or undefined)`,e)}nt.guardValueIsSet=K5;function AS(t,e){if(e==null||e===void 0)throw new bo.ErrInvariantFailed(t)}nt.guardValueIsSetWithMessage=AS;function Y5(t,e){if(t=t||[],e=e||[],t.length!=e.length)throw new bo.ErrInvariantFailed("arrays do not have the same length")}nt.guardSameLength=Y5;function J5(t,e){let r=t.length||0;if(r!=e)throw new bo.ErrInvariantFailed(`wrong length, expected: ${e}, actual: ${r}`)}nt.guardLength=J5;function X5(t,e){if(vm(t))throw new bo.ErrInvariantFailed(`${e} is empty`)}nt.guardNotEmpty=X5;function Z5(t,e){if(!vm(t))throw new bo.ErrInvariantFailed(`${e} is not empty`)}nt.guardEmpty=Z5;function vm(t){return t.isEmpty?t.isEmpty():t.length===0}nt.isEmpty=vm});var bS=m(sf=>{"use strict";c();Object.defineProperty(sf,"__esModule",{value:!0});sf.getJavascriptPrototypesInHierarchy=void 0;function e4(t,e){let r=[],n=Object.getPrototypeOf(t);for(;n&&e(n);)r.push(n),n=Object.getPrototypeOf(n);return r}sf.getJavascriptPrototypesInHierarchy=e4});var It=m(_t=>{"use strict";c();Object.defineProperty(_t,"__esModule",{value:!0});_t.NullType=_t.TypePlaceholder=_t.isTyped=_t.PrimitiveValue=_t.TypedValue=_t.CustomType=_t.PrimitiveType=_t.TypeCardinality=_t.Type=void 0;var Am=bS(),_S=wr(),pi=class t{constructor(e,r=[],n=xu.fixed(1)){_S.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 _S.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(){}};_t.Type=pi;pi.ClassName="Type";var xu=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}};_t.TypeCardinality=xu;xu.MaxCardinality=4096;var of=class t extends pi{constructor(e){super(e)}getClassName(){return t.ClassName}};_t.PrimitiveType=of;of.ClassName="PrimitiveType";var af=class t extends pi{getClassName(){return t.ClassName}};_t.CustomType=af;af.ClassName="CustomType";var Nu=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(){}};_t.TypedValue=Nu;Nu.ClassName="TypedValue";var uf=class t extends Nu{constructor(e){super(e)}getClassName(){return t.ClassName}};_t.PrimitiveValue=uf;uf.ClassName="PrimitiveValue";function t4(t){return t.belongsToTypesystem!==void 0}_t.isTyped=t4;var cf=class t extends pi{constructor(){super("...")}getClassName(){return t.ClassName}};_t.TypePlaceholder=cf;cf.ClassName="TypePlaceholder";var lf=class t extends pi{constructor(){super("?")}getClassName(){return t.ClassName}};_t.NullType=lf;lf.ClassName="NullType"});var IS=m((_o,Io)=>{c();(function(t){var e=typeof _o=="object"&&_o&&!_o.nodeType&&_o,r=typeof Io=="object"&&Io&&!Io.nodeType&&Io,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,w="-",E=/^xn--/,T=/[^\x20-\x7E]/,D=/[\x2E\u3002\uFF0E\uFF61]/g,B={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},W=o-a,U=Math.floor,A=String.fromCharCode,I;function N(Y){throw new RangeError(B[Y])}function _(Y,se){for(var te=Y.length,ie=[];te--;)ie[te]=se(Y[te]);return ie}function S(Y,se){var te=Y.split("@"),ie="";te.length>1&&(ie=te[0]+"@",Y=te[1]),Y=Y.replace(D,".");var M=Y.split("."),le=_(M,se).join(".");return ie+le}function R(Y){for(var se=[],te=0,ie=Y.length,M,le;te=55296&&M<=56319&&te65535&&(se-=65536,te+=A(se>>>10&1023|55296),se=56320|se&1023),te+=A(se),te}).join("")}function Q(Y){return Y-48<10?Y-22:Y-65<26?Y-65:Y-97<26?Y-97:o}function V(Y,se){return Y+22+75*(Y<26)-((se!=0)<<5)}function k(Y,se,te){var ie=0;for(Y=te?U(Y/f):Y>>1,Y+=U(Y/se);Y>W*u>>1;ie+=o)Y=U(Y/W);return U(ie+(W+1)*Y/(Y+l))}function K(Y){var se=[],te=Y.length,ie,M=0,le=g,ae=d,fe,oe,ce,y,v,b,P,C,O;for(fe=Y.lastIndexOf(w),fe<0&&(fe=0),oe=0;oe=128&&N("not-basic"),se.push(Y.charCodeAt(oe));for(ce=fe>0?fe+1:0;ce=te&&N("invalid-input"),P=Q(Y.charCodeAt(ce++)),(P>=o||P>U((s-M)/v))&&N("overflow"),M+=P*v,C=b<=ae?a:b>=ae+u?u:b-ae,!(PU(s/O)&&N("overflow"),v*=O;ie=se.length+1,ae=k(M-y,ie,y==0),U(M/ie)>s-le&&N("overflow"),le+=U(M/ie),M%=ie,se.splice(M++,0,le)}return J(se)}function pe(Y){var se,te,ie,M,le,ae,fe,oe,ce,y,v,b=[],P,C,O,L;for(Y=R(Y),P=Y.length,se=g,te=0,le=d,ae=0;ae=se&&vU((s-te)/C)&&N("overflow"),te+=(fe-se)*C,se=fe,ae=0;aes&&N("overflow"),v==se){for(oe=te,ce=o;y=ce<=le?a:ce>=le+u?u:ce-le,!(oe{"use strict";c();var TS=IS();function r4(t,e){this.__proto__=new Error(e),this.__proto__.name="BackslashError",this.offset=t}function bm(t){return t>="0"&&t<="7"}function n4(t){return t>="0"&&t<="9"||t>="a"&&t<="f"||t>="A"&&t<="F"}function SS(t){return t=parseInt(t,16),TS.ucs2.encode([t])}function CS(t,e,r){var n=!1,i=[];function s(u){var l=t[u];if(!n4(l))throw new r4(u,"Unexpected token ILLEGAL");return l}for(;e{c();var DS=xS();BS.exports={validate:i4,parse:s4};function i4(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 s4(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 PS(t,e){for(var r=t.length,n=e,i,s=e;s-1&&t[r]==="\\";)n++,r--;return n%2===0}function c4(t,e,r,n){for(var i=e,s=",",o=[],a=e;_s(t[a]);)a++;if(t[a]==="]")return{start:e,end:a,value:o};for(;s===",";){var u=ff(t,i,r,n),l=PS(t,u.end);n&&o.push(u.value),i=l.end,s=l.value}return{start:e,end:i,value:o}}function l4(t,e){return t.substr(e,4)==="true"}function f4(t,e){return t.substr(e,5)==="false"}function h4(t,e){return t.substr(e,4)==="null"}var d4=new RegExp(/^\s$/);function _s(t){return d4.test(t)}var p4=new RegExp(/^\d$/);function NS(t){return p4.test(t)}function Gn(t,e,r){var n=10,i;t.length{"use strict";c();var g4=rn&&rn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),y4=rn&&rn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),m4=rn&&rn.__importStar||function(t){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 y4(e,t),e};Object.defineProperty(rn,"__esModule",{value:!0});rn.TypeExpressionParser=void 0;var FS=m4(Be()),w4=It(),E4=LS(),Im=class{parse(e){let r=this.doParse(e),n=Object.keys(r);if(n.length!=1)throw new FS.ErrTypingSystem(`bad type expression: ${e}`);let i=n[0];return this.nodeToType(i,r[i])}doParse(e){let r=this.getJsonedString(e);try{return E4.parse(r)}catch{throw new FS.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 w4.Type(e,n)}};rn.TypeExpressionParser=Im});var Tm=m(gi=>{"use strict";c();Object.defineProperty(gi,"__esModule",{value:!0});gi.EndpointParameterDefinition=gi.EndpointModifiers=gi.EndpointDefinition=void 0;var v4=hf(),MS="?",A4="N / A",Sm=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?MS:e.name,e.onlyOwner=e.onlyOwner||!1,e.payableInTokens=e.payableInTokens||[],e.inputs=e.inputs||[],e.outputs=e.outputs||[];let r=e.inputs.map(s=>Ou.fromJSON(s)),n=e.outputs.map(s=>Ou.fromJSON(s)),i=new df(e.mutability,e.payableInTokens,e.onlyOwner);return new t(e.name,r,n,i)}};gi.EndpointDefinition=Sm;var df=class{constructor(e,r,n){this.mutability=e||"",this.payableInTokens=r||[],this.onlyOwner=n||!1}isPayableInEGLD(){return this.isPayableInToken("EGLD")}isPayableInToken(e){return this.payableInTokens.includes(e)?!0:this.payableInTokens.includes(`!${e}`)?!1:!!this.payableInTokens.includes("*")}isPayable(){return this.payableInTokens.length!=0}isReadonly(){return this.mutability=="readonly"}isOnlyOwner(){return this.onlyOwner}};gi.EndpointModifiers=df;var Ou=class t{constructor(e,r,n){this.name=e,this.description=r,this.type=n}static fromJSON(e){let r=new v4.TypeExpressionParser().parse(e.type);return new t(e.name||MS,e.description||A4,r)}};gi.EndpointParameterDefinition=Ou});var So=m(ar=>{"use strict";c();var b4=ar&&ar.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.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=ar&&ar.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),I4=ar&&ar.__importStar||function(t){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(ar,"__esModule",{value:!0});ar.Fields=ar.Field=ar.FieldDefinition=void 0;var Cm=I4(Be()),S4=hf(),xm=class t{constructor(e,r,n){this.name=e,this.description=r,this.type=n}static fromJSON(e){let r=new S4.TypeExpressionParser().parse(e.type);return new t(e.name,e.description,r)}};ar.FieldDefinition=xm;var Nm=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)}};ar.Field=Nm;var Om=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(yi,"__esModule",{value:!0});yi.EnumValue=yi.EnumVariantDefinition=yi.EnumType=void 0;var T4=Be(),Dm=wr(),pf=So(),qS=It(),US=256,gf=class t extends qS.CustomType{constructor(e,r){super(e),this.variants=[],this.variants=r}getClassName(){return t.ClassName}static fromJSON(e){let r=(e.variants||[]).map(n=>yf.fromJSON(n));return new t(e.name,r)}getVariantByDiscriminant(e){let r=this.variants.find(n=>n.discriminant==e);return Dm.guardValueIsSet(`variant by discriminant (${e})`,r),r}getVariantByName(e){let r=this.variants.find(n=>n.name==e);return Dm.guardValueIsSet(`variant by name (${e})`,r),r}getNamesOfDependencies(){let e=[];for(let r of this.variants)e.push(...r.getNamesOfDependencies());return[...new Set(e)]}};yi.EnumType=gf;gf.ClassName="EnumType";var yf=class t{constructor(e,r,n=[]){this.fieldsDefinitions=[],Dm.guardTrue(rpf.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 pf.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};yi.EnumVariantDefinition=yf;var mf=class t extends qS.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();pf.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=pf.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 T4.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}};yi.EnumValue=mf;mf.ClassName="EnumValue"});var Co=m(To=>{"use strict";c();Object.defineProperty(To,"__esModule",{value:!0});To.Struct=To.StructType=void 0;var C4=Be(),wf=So(),VS=It(),Ef=class t extends VS.CustomType{constructor(e,r){super(e),this.fieldsDefinitions=[],this.fieldsDefinitions=r}getClassName(){return t.ClassName}static fromJSON(e){let r=(e.fields||[]).map(n=>wf.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 wf.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};To.StructType=Ef;Ef.ClassName="StructType";var vf=class t extends VS.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();wf.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 C4.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 wf.Fields.equals(r,n)}};To.Struct=vf;vf.ClassName="Struct"});var Rm=m((rse,kS)=>{"use strict";c();var bf="qpzry9x8gf2tvdw0s3jn54khce6mua7l",Pm={};for(Pu=0;Pu>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 HS(t){for(var e=1,r=0;r126)return"Invalid prefix ("+t+")";e=xo(e)^n>>5}for(e=xo(e),r=0;rr)throw new TypeError("Exceeds length limit");t=t.toLowerCase();var n=HS(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=xo(n)^o,i+=bf.charAt(o)}for(s=0;s<6;++s)n=xo(n);for(n^=1,s=0;s<6;++s){var a=n>>(5-s)*5&31;i+=bf.charAt(a)}return i}function GS(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=HS(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 N4(){var t=GS.apply(null,arguments);if(typeof t=="object")return t}function O4(t){var e=GS.apply(null,arguments);if(typeof e=="object")return e;throw new Error(e)}function _f(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 L4=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]}),F4=nn&&nn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jS=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)&&L4(e,t,r);return F4(e,t),e};Object.defineProperty(nn,"__esModule",{value:!0});nn.Address=void 0;var If=jS(Rm()),No=jS(Be()),Bm="erd",Lm=32,M4="0".repeat(16),Fm=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 No.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!=Lm)throw new No.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==Lm}static fromHex(e){if(!t.isValidHex(e))throw new No.ErrAddressCannotCreate(e);return t.fromValidHex(e)}static empty(){return new t}static fromBech32(e){let r;try{r=If.decode(e)}catch(s){throw new No.ErrAddressCannotCreate(e,s)}let n=r.prefix;if(n!=Bm)throw new No.ErrAddressBadHrp(Bm,n);let i=h.Buffer.from(If.fromWords(r.words));if(i.length!=Lm)throw new No.ErrAddressCannotCreate(e);return t.fromValidHex(i.toString("hex"))}hex(){return this.isEmpty()?"":this.valueHex}bech32(){if(this.isEmpty())return"";let e=If.toWords(this.pubkey());return If.encode(Bm,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(M4)}};nn.Address=Fm});var Do=m(Oo=>{"use strict";c();Object.defineProperty(Oo,"__esModule",{value:!0});Oo.AddressValue=Oo.AddressType=void 0;var U4=ht(),QS=It(),Ru=class t extends QS.PrimitiveType{constructor(){super("Address")}getClassName(){return t.ClassName}};Oo.AddressType=Ru;Ru.ClassName="AddressType";var Sf=class t extends QS.PrimitiveValue{constructor(e){super(new Ru),this.value=new U4.Address(e.bech32())}getClassName(){return t.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};Oo.AddressValue=Sf;Sf.ClassName="AddressValue"});var Cf=m(Po=>{"use strict";c();Object.defineProperty(Po,"__esModule",{value:!0});Po.OptionalValue=Po.OptionalType=void 0;var q4=wr(),Bu=It(),Lu=class t extends Bu.Type{constructor(e){super("Optional",[e],Bu.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(Bu.NullType.ClassName);return r||n}};Po.OptionalType=Lu;Lu.ClassName="OptionalType";var Tf=class t extends Bu.TypedValue{constructor(e,r=null){super(e),this.value=r}getClassName(){return t.ClassName}static newMissing(){let e=new Lu(new Bu.NullType);return new t(e)}isSet(){return!!this.value}getTypedValue(){return q4.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}};Po.OptionalValue=Tf;Tf.ClassName="OptionalValue"});var Mu=m(Ro=>{"use strict";c();Object.defineProperty(Ro,"__esModule",{value:!0});Ro.BooleanValue=Ro.BooleanType=void 0;var WS=It(),Fu=class t extends WS.PrimitiveType{constructor(){super("bool")}getClassName(){return t.ClassName}};Ro.BooleanType=Fu;Fu.ClassName="BooleanType";var xf=class t extends WS.PrimitiveValue{constructor(e){super(new Fu),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}};Ro.BooleanValue=xf;xf.ClassName="BooleanValue"});var mi=m(Bo=>{"use strict";c();Object.defineProperty(Bo,"__esModule",{value:!0});Bo.BytesValue=Bo.BytesType=void 0;var $S=It(),Uu=class t extends $S.PrimitiveType{constructor(){super("bytes")}getClassName(){return t.ClassName}};Bo.BytesType=Uu;Uu.ClassName="BytesType";var Nf=class t extends $S.PrimitiveValue{constructor(e){super(new Uu),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()}};Bo.BytesValue=Nf;Nf.ClassName="BytesValue"});var KS=m(Lo=>{"use strict";c();Object.defineProperty(Lo,"__esModule",{value:!0});Lo.CodeMetadataValue=Lo.CodeMetadataType=void 0;var zS=It(),Of=class extends zS.PrimitiveType{constructor(){super("CodeMetadata")}};Lo.CodeMetadataType=Of;var Mm=class extends zS.PrimitiveValue{constructor(e){super(new Of),this.value=e}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};Lo.CodeMetadataValue=Mm});var Pf=m(Fo=>{"use strict";c();Object.defineProperty(Fo,"__esModule",{value:!0});Fo.CompositeValue=Fo.CompositeType=void 0;var V4=wr(),Um=It(),qu=class t extends Um.Type{constructor(...e){super("Composite",e,Um.TypeCardinality.variable(e.length))}getClassName(){return t.ClassName}};Fo.CompositeType=qu;qu.ClassName="CompositeType";var Df=class t extends Um.TypedValue{constructor(e,r){super(e),V4.guardLength(r,e.getTypeParameters().length),this.items=r}getClassName(){return t.ClassName}static fromItems(...e){let r=e.map(i=>i.getType()),n=new qu(...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(Rf,"__esModule",{value:!0});Rf.CollectionOfTypedValues=void 0;var qm=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(sn,"__esModule",{value:!0});sn.List=sn.OptionValue=sn.ListType=sn.OptionType=void 0;var H4=wr(),G4=Vm(),Ss=It(),Is=class t extends Ss.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(Ss.NullType.ClassName);return r||n}};sn.OptionType=Is;Is.ClassName="OptionType";var Vu=class t extends Ss.Type{constructor(e){super("List",[e])}getClassName(){return t.ClassName}};sn.ListType=Vu;Vu.ClassName="ListType";var Bf=class t extends Ss.TypedValue{constructor(e,r=null){super(e),this.value=r}getClassName(){return t.ClassName}static newMissing(){let e=new Is(new Ss.NullType);return new t(e)}static newMissingTyped(e){return new t(new Is(e))}static newProvided(e){let r=new Is(e.getType());return new t(r,e)}isSet(){return!!this.value}getTypedValue(){return H4.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}};sn.OptionValue=Bf;Bf.ClassName="OptionValue";var Lf=class t extends Ss.TypedValue{constructor(e,r){super(e),this.backingCollection=new G4.CollectionOfTypedValues(r)}getClassName(){return t.ClassName}static fromItems(e){if(e.length==0)return new t(new Ss.TypePlaceholder,[]);let r=e[0].getType(),n=new Vu(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)}};sn.List=Lf;Lf.ClassName="List"});var Uf=m(Mo=>{"use strict";c();Object.defineProperty(Mo,"__esModule",{value:!0});Mo.ArrayVec=Mo.ArrayVecType=void 0;var YS=wr(),k4=Vm(),JS=It(),Ff=class t extends JS.Type{constructor(e,r){super("Array",[r]),YS.guardTrue(e>0,"array length > 0"),this.length=e}getClassName(){return t.ClassName}};Mo.ArrayVecType=Ff;Ff.ClassName="ArrayVecType";var Mf=class t extends JS.TypedValue{constructor(e,r){super(e),YS.guardLength(r,e.length),this.backingCollection=new k4.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)}};Mo.ArrayVec=Mf;Mf.ClassName="ArrayVec"});var ku=m(Uo=>{"use strict";c();Object.defineProperty(Uo,"__esModule",{value:!0});Uo.H256Value=Uo.H256Type=void 0;var XS=It(),Gu=class t extends XS.PrimitiveType{constructor(){super("H256")}getClassName(){return t.ClassName}};Uo.H256Type=Gu;Gu.ClassName="H256Type";var qf=class t extends XS.PrimitiveValue{constructor(e){super(new Gu),this.value=e}getClassName(){return t.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};Uo.H256Value=qf;qf.ClassName="H256Value"});var Hf=m(qo=>{"use strict";c();Object.defineProperty(qo,"__esModule",{value:!0});qo.NothingValue=qo.NothingType=void 0;var ZS=It(),ju=class t extends ZS.PrimitiveType{constructor(){super("nothing")}getClassName(){return t.ClassName}};qo.NothingType=ju;ju.ClassName="NothingType";var Vf=class t extends ZS.PrimitiveValue{constructor(){super(new ju)}getClassName(){return t.ClassName}equals(e){return!1}valueOf(){return{}}};qo.NothingValue=Vf;Vf.ClassName="NothingValue"});var tc=m(Ie=>{"use strict";c();var j4=Ie&&Ie.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Q4=Ie&&Ie.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),W4=Ie&&Ie.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&j4(e,t,r);return Q4(e,t),e},$4=Ie&&Ie.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ie,"__esModule",{value:!0});Ie.BigIntValue=Ie.BigUIntValue=Ie.I64Value=Ie.U64Value=Ie.I32Value=Ie.U32Value=Ie.I16Value=Ie.U16Value=Ie.I8Value=Ie.U8Value=Ie.NumericalValue=Ie.BigIntType=Ie.BigUIntType=Ie.I64Type=Ie.U64Type=Ie.I32Type=Ie.U32Type=Ie.I16Type=Ie.U16Type=Ie.I8Type=Ie.U8Type=Ie.NumericalType=void 0;var eT=W4(Be()),tT=It(),Ts=$4(Gt()),ur=class t extends tT.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()}};Ie.NumericalType=ur;ur.ClassName="NumericalType";var Qu=class t extends ur{constructor(){super("u8",1,!1)}getClassName(){return t.ClassName}};Ie.U8Type=Qu;Qu.ClassName="U8Type";var Wu=class t extends ur{constructor(){super("i8",1,!0)}getClassName(){return t.ClassName}};Ie.I8Type=Wu;Wu.ClassName="I8Type";var $u=class t extends ur{constructor(){super("u16",2,!1)}getClassName(){return t.ClassName}};Ie.U16Type=$u;$u.ClassName="U16Type";var zu=class t extends ur{constructor(){super("i16",2,!0)}getClassName(){return t.ClassName}};Ie.I16Type=zu;zu.ClassName="I16Type";var Ku=class t extends ur{constructor(){super("u32",4,!1)}getClassName(){return t.ClassName}};Ie.U32Type=Ku;Ku.ClassName="U32Type";var Yu=class t extends ur{constructor(){super("i32",4,!0)}getClassName(){return t.ClassName}};Ie.I32Type=Yu;Yu.ClassName="I32Type";var Ju=class t extends ur{constructor(){super("u64",8,!1)}getClassName(){return t.ClassName}};Ie.U64Type=Ju;Ju.ClassName="U64Type";var Xu=class t extends ur{constructor(){super("i64",8,!0)}getClassName(){return t.ClassName}};Ie.I64Type=Xu;Xu.ClassName="I64Type";var Zu=class t extends ur{constructor(){super("BigUint",0,!1)}getClassName(){return t.ClassName}};Ie.BigUIntType=Zu;Zu.ClassName="BigUIntType";var ec=class t extends ur{constructor(){super("Bigint",0,!0)}getClassName(){return t.ClassName}};Ie.BigIntType=ec;ec.ClassName="BigIntType";var cr=class t extends tT.PrimitiveValue{constructor(e,r){if(super(e),this.value=new Ts.default(r),this.sizeInBytes=e.sizeInBytes,this.withSign=e.withSign,this.value.isNaN())throw new eT.ErrInvalidArgument(`not a number: ${r}`);if(!this.withSign&&this.value.isNegative())throw new eT.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()}};Ie.NumericalValue=cr;cr.ClassName="NumericalValue";var Gf=class t extends cr{constructor(e){super(new Qu,new Ts.default(e))}getClassName(){return t.ClassName}};Ie.U8Value=Gf;Gf.ClassName="U8Value";var kf=class t extends cr{constructor(e){super(new Wu,new Ts.default(e))}getClassName(){return t.ClassName}};Ie.I8Value=kf;kf.ClassName="I8Value";var jf=class t extends cr{constructor(e){super(new $u,new Ts.default(e))}getClassName(){return t.ClassName}};Ie.U16Value=jf;jf.ClassName="U16Value";var Qf=class t extends cr{constructor(e){super(new zu,new Ts.default(e))}getClassName(){return t.ClassName}};Ie.I16Value=Qf;Qf.ClassName="I16Value";var Wf=class t extends cr{constructor(e){super(new Ku,new Ts.default(e))}getClassName(){return t.ClassName}};Ie.U32Value=Wf;Wf.ClassName="U32Value";var $f=class t extends cr{constructor(e){super(new Yu,new Ts.default(e))}getClassName(){return t.ClassName}};Ie.I32Value=$f;$f.ClassName="I32Value";var zf=class t extends cr{constructor(e){super(new Ju,e)}getClassName(){return t.ClassName}};Ie.U64Value=zf;zf.ClassName="U64Value";var Kf=class t extends cr{constructor(e){super(new Xu,e)}getClassName(){return t.ClassName}};Ie.I64Value=Kf;Kf.ClassName="I64Value";var Yf=class t extends cr{constructor(e){super(new Zu,e)}getClassName(){return t.ClassName}};Ie.BigUIntValue=Yf;Yf.ClassName="BigUIntValue";var Jf=class t extends cr{constructor(e){super(new ec,e)}getClassName(){return t.ClassName}};Ie.BigIntValue=Jf;Jf.ClassName="BigIntValue"});var Zf=m(Vo=>{"use strict";c();Object.defineProperty(Vo,"__esModule",{value:!0});Vo.StringValue=Vo.StringType=void 0;var rT=It(),rc=class t extends rT.PrimitiveType{constructor(){super("utf-8 string")}getClassName(){return t.ClassName}};Vo.StringType=rc;rc.ClassName="StringType";var Xf=class t extends rT.PrimitiveValue{constructor(e){super(new rc),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}};Vo.StringValue=Xf;Xf.ClassName="StringValue"});var Go=m(Ho=>{"use strict";c();Object.defineProperty(Ho,"__esModule",{value:!0});Ho.TokenIdentifierValue=Ho.TokenIdentifierType=void 0;var nT=It(),z4="EGLD",nc=class t extends nT.PrimitiveType{constructor(){super("TokenIdentifier")}getClassName(){return t.ClassName}};Ho.TokenIdentifierType=nc;nc.ClassName="TokenIdentifierType";var eh=class t extends nT.PrimitiveValue{constructor(e){super(new nc),this.value=e}static egld(){return new t(z4)}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()}};Ho.TokenIdentifierValue=eh;eh.ClassName="TokenIdentifierValue"});var rh=m(Tr=>{"use strict";c();var K4=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]}),Y4=Tr&&Tr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),J4=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)&&K4(e,t,r);return Y4(e,t),e};Object.defineProperty(Tr,"__esModule",{value:!0});Tr.Tuple=Tr.TupleType=void 0;var X4=J4(Be()),iT=So(),sT=Co(),ic=class t extends sT.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 iT.FieldDefinition(oT(i),"anonymous tuple field",n))}};Tr.TupleType=ic;ic.ClassName="TupleType";function oT(t){return`field${t}`}var th=class t extends sT.Struct{constructor(e,r){super(e,r)}getClassName(){return t.ClassName}static fromItems(e){if(e.length<1)throw new X4.ErrTypingSystem("bad tuple items");let r=e.map(s=>s.getType()),n=new ic(...r),i=e.map((s,o)=>new iT.Field(s,oT(o)));return new t(n,i)}};Tr.Tuple=th;th.ClassName="Tuple"});var sh=m(wi=>{"use strict";c();Object.defineProperty(wi,"__esModule",{value:!0});wi.VariadicValue=wi.CountedVariadicType=wi.VariadicType=void 0;var ko=It(),Cs=class t extends ko.Type{constructor(e,r=!1){super("Variadic",[e],ko.TypeCardinality.variable()),this.isCounted=r}getClassName(){return t.ClassName}};wi.VariadicType=Cs;Cs.ClassName="VariadicType";var nh=class extends ko.Type{constructor(e){super("Variadic",[e],ko.TypeCardinality.variable())}getClassName(){return Cs.ClassName}};wi.CountedVariadicType=nh;nh.ClassName="VariadicType";var ih=class t extends ko.TypedValue{constructor(e,r){super(e),this.items=r}getClassName(){return t.ClassName}static fromItems(...e){return this.createFromItems(e,!1)}static fromItemsCounted(...e){return this.createFromItems(e,!0)}static createFromItems(e,r){if(e.length==0)return new t(new Cs(new ko.TypePlaceholder,r),[]);let n=e[0].getType();return new t(new Cs(n,r),e)}getItems(){return this.items}valueOf(){return this.items.map(e=>e.valueOf())}equals(e){if(this.getType().differs(e.getType()))return!1;for(let r=0;r{"use strict";c();var Z4=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]}),eq=on&&on.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tq=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)&&Z4(e,t,r);return eq(e,t),e};Object.defineProperty(on,"__esModule",{value:!0});on.TypeMapper=void 0;var aT=tq(Be()),rq=Do(),Hm=Cf(),nq=Mu(),iq=mi(),sq=KS(),oh=Pf(),Gm=Du(),oq=So(),uT=Hu(),kn=Uf(),aq=ku(),cT=Hf(),Cr=tc(),uq=Zf(),lT=Co(),fT=Go(),Ei=rh(),ah=sh(),km=class{constructor(e=[]){this.openTypesFactories=new Map([["Option",(...r)=>new uT.OptionType(r[0])],["List",(...r)=>new uT.ListType(r[0])],["VarArgs",(...r)=>new ah.VariadicType(r[0])],["MultiResultVec",(...r)=>new ah.VariadicType(r[0])],["variadic",(...r)=>new ah.VariadicType(r[0])],["counted-variadic",(...r)=>new ah.VariadicType(r[0],!0)],["OptionalArg",(...r)=>new Hm.OptionalType(r[0])],["optional",(...r)=>new Hm.OptionalType(r[0])],["OptionalResult",(...r)=>new Hm.OptionalType(r[0])],["multi",(...r)=>new oh.CompositeType(...r)],["MultiArg",(...r)=>new oh.CompositeType(...r)],["MultiResult",(...r)=>new oh.CompositeType(...r)],["multi",(...r)=>new oh.CompositeType(...r)],["tuple",(...r)=>new Ei.TupleType(...r)],["tuple2",(...r)=>new Ei.TupleType(...r)],["tuple3",(...r)=>new Ei.TupleType(...r)],["tuple4",(...r)=>new Ei.TupleType(...r)],["tuple5",(...r)=>new Ei.TupleType(...r)],["tuple6",(...r)=>new Ei.TupleType(...r)],["tuple7",(...r)=>new Ei.TupleType(...r)],["tuple8",(...r)=>new Ei.TupleType(...r)],["array2",(...r)=>new kn.ArrayVecType(2,r[0])],["array8",(...r)=>new kn.ArrayVecType(8,r[0])],["array16",(...r)=>new kn.ArrayVecType(16,r[0])],["array20",(...r)=>new kn.ArrayVecType(20,r[0])],["array32",(...r)=>new kn.ArrayVecType(32,r[0])],["array46",(...r)=>new kn.ArrayVecType(46,r[0])],["array64",(...r)=>new kn.ArrayVecType(64,r[0])],["array128",(...r)=>new kn.ArrayVecType(128,r[0])],["array256",(...r)=>new kn.ArrayVecType(256,r[0])]]),this.closedTypesMap=new Map([["u8",new Cr.U8Type],["u16",new Cr.U16Type],["u32",new Cr.U32Type],["u64",new Cr.U64Type],["U64",new Cr.U64Type],["BigUint",new Cr.BigUIntType],["i8",new Cr.I8Type],["i16",new Cr.I16Type],["i32",new Cr.I32Type],["i64",new Cr.I64Type],["Bigint",new Cr.BigIntType],["BigInt",new Cr.BigIntType],["bool",new nq.BooleanType],["bytes",new iq.BytesType],["Address",new rq.AddressType],["H256",new aq.H256Type],["utf-8 string",new uq.StringType],["TokenIdentifier",new fT.TokenIdentifierType],["EgldOrEsdtTokenIdentifier",new fT.TokenIdentifierType],["CodeMetadata",new sq.CodeMetadataType],["nothing",new cT.NothingType],["AsyncCall",new cT.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 aT.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(Gm.EnumType.ClassName)?this.mapEnumType(e):e.hasExactClass(lT.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 lT.StructType(e.getName(),r)}mapEnumType(e){let r=e.variants.map(i=>new Gm.EnumVariantDefinition(i.name,i.discriminant,this.mappedFields(i.getFieldsDefinitions())));return new Gm.EnumType(e.getName(),r)}mappedFields(e){return e.map(r=>new oq.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 aT.ErrTypingSystem(`Cannot map the generic type "${e.getName()}" to a known type`);return i(...n)}};on.TypeMapper=km});var yT=m(an=>{"use strict";c();var cq=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]}),lq=an&&an.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fq=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)&&cq(e,t,r);return lq(e,t),e};Object.defineProperty(an,"__esModule",{value:!0});an.AbiRegistry=void 0;var hT=fq(Be()),Qm=wr(),sc=Tm(),dT=Du(),pT=Co(),hq=jm(),dq="?",Wm=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||dq,n=e.constructor||{},i=e.endpoints||[],s=e.types||{},o=sc.EndpointDefinition.fromJSON(Object.assign({name:"constructor"},n)),a=i.map(d=>sc.EndpointDefinition.fromJSON(d)),u=[];for(let d in s){let g=s[d];if(g.type=="struct")u.push(pT.StructType.fromJSON({name:d,fields:g.fields}));else if(g.type=="enum")u.push(dT.EnumType.fromJSON({name:d,variants:g.variants}));else throw new hT.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(pT.StructType.ClassName));return Qm.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(dT.EnumType.ClassName));return Qm.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 Qm.guardValueIsSetWithMessage(`endpoint [${e}] not found`,r),r}remapToKnownTypes(){let e=new hq.TypeMapper([]),r=[];for(let o of this.customTypes)this.mapCustomTypeDepthFirst(o,this.customTypes,e,r);if(this.customTypes.length!=r.length)throw new hT.ErrTypingSystem("Did not re-map all custom types");let n=gT(this.constructorDefinition,e),i=[];for(let o of this.endpoints)i.push(gT(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)}};an.AbiRegistry=Wm;function gT(t,e){let r=t.input.map(i=>new sc.EndpointParameterDefinition(i.name,i.description,e.mapType(i.type))),n=t.output.map(i=>new sc.EndpointParameterDefinition(i.name,i.description,e.mapType(i.type)));return new sc.EndpointDefinition(t.name,r,n,t.modifiers)}});var wT=m(jo=>{"use strict";c();Object.defineProperty(jo,"__esModule",{value:!0});jo.createListOfTokenIdentifiers=jo.createListOfAddresses=void 0;var pq=Do(),mT=Hu(),gq=Go();function yq(t){let e=t.map(n=>new pq.AddressValue(n));return mT.List.fromItems(e)}jo.createListOfAddresses=yq;function mq(t){let e=t.map(n=>new gq.TokenIdentifierValue(n));return mT.List.fromItems(e)}jo.createListOfTokenIdentifiers=mq});var PT=m(zt=>{"use strict";c();var wq=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]}),Eq=zt&&zt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vq=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)&&wq(e,t,r);return Eq(e,t),e};Object.defineProperty(zt,"__esModule",{value:!0});zt.onPrimitiveTypeSelect=zt.onPrimitiveValueSelect=zt.onTypedValueSelect=zt.onTypeSelect=void 0;var ch=vq(Be()),ET=Do(),vT=Mu(),AT=mi(),bT=Du(),uh=Hu(),_T=ku(),IT=tc(),ST=Hf(),TT=Co(),CT=Go(),xT=rh(),NT=It(),OT=Uf(),DT=Zf();function Aq(t,e){if(t.hasExactClass(uh.OptionType.ClassName))return e.onOption();if(t.hasExactClass(uh.ListType.ClassName))return e.onList();if(t.hasExactClass(OT.ArrayVecType.ClassName))return e.onArray();if(t.hasClassOrSuperclass(NT.PrimitiveType.ClassName))return e.onPrimitive();if(t.hasExactClass(TT.StructType.ClassName))return e.onStruct();if(t.hasExactClass(xT.TupleType.ClassName))return e.onTuple();if(t.hasExactClass(bT.EnumType.ClassName))return e.onEnum();if(e.onOther)return e.onOther();throw new ch.ErrTypingSystem(`type isn't known: ${t}`)}zt.onTypeSelect=Aq;function bq(t,e){if(t.hasClassOrSuperclass(NT.PrimitiveValue.ClassName))return e.onPrimitive();if(t.hasExactClass(uh.OptionValue.ClassName))return e.onOption();if(t.hasExactClass(uh.List.ClassName))return e.onList();if(t.hasExactClass(OT.ArrayVec.ClassName))return e.onArray();if(t.hasExactClass(TT.Struct.ClassName))return e.onStruct();if(t.hasExactClass(xT.Tuple.ClassName))return e.onTuple();if(t.hasExactClass(bT.EnumValue.ClassName))return e.onEnum();if(e.onOther)return e.onOther();throw new ch.ErrTypingSystem(`value isn't typed: ${t}`)}zt.onTypedValueSelect=bq;function _q(t,e){if(t.hasExactClass(vT.BooleanValue.ClassName))return e.onBoolean();if(t.hasClassOrSuperclass(IT.NumericalValue.ClassName))return e.onNumerical();if(t.hasExactClass(ET.AddressValue.ClassName))return e.onAddress();if(t.hasExactClass(AT.BytesValue.ClassName))return e.onBytes();if(t.hasExactClass(DT.StringValue.ClassName))return e.onString();if(t.hasExactClass(_T.H256Value.ClassName))return e.onH256();if(t.hasExactClass(CT.TokenIdentifierValue.ClassName))return e.onTypeIdentifier();if(t.hasExactClass(ST.NothingValue.ClassName))return e.onNothing();if(e.onOther)return e.onOther();throw new ch.ErrTypingSystem(`value isn't a primitive: ${t.getType()}`)}zt.onPrimitiveValueSelect=_q;function Iq(t,e){if(t.hasExactClass(vT.BooleanType.ClassName))return e.onBoolean();if(t.hasClassOrSuperclass(IT.NumericalType.ClassName))return e.onNumerical();if(t.hasExactClass(ET.AddressType.ClassName))return e.onAddress();if(t.hasExactClass(AT.BytesType.ClassName))return e.onBytes();if(t.hasExactClass(DT.StringType.ClassName))return e.onString();if(t.hasExactClass(_T.H256Type.ClassName))return e.onH256();if(t.hasExactClass(CT.TokenIdentifierType.ClassName))return e.onTokenIndetifier();if(t.hasExactClass(ST.NothingType.ClassName))return e.onNothing();if(e.onOther)return e.onOther();throw new ch.ErrTypingSystem(`type isn't a known primitive: ${t}`)}zt.onPrimitiveTypeSelect=Iq});var St=m(qe=>{"use strict";c();var Sq=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]}),it=qe&&qe.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Sq(e,t,r)};Object.defineProperty(qe,"__esModule",{value:!0});it(yT(),qe);it(Do(),qe);it(Cf(),qe);it(Mu(),qe);it(mi(),qe);it(Pf(),qe);it(Tm(),qe);it(Du(),qe);it(wT(),qe);it(So(),qe);it(Hu(),qe);it(Uf(),qe);it(ku(),qe);it(PT(),qe);it(Hf(),qe);it(tc(),qe);it(Zf(),qe);it(Co(),qe);it(Go(),qe);it(rh(),qe);it(hf(),qe);it(jm(),qe);it(It(),qe);it(sh(),qe)});var BT=m(un=>{"use strict";c();var Tq=un&&un.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Cq=un&&un.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xq=un&&un.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Tq(e,t,r);return Cq(e,t),e};Object.defineProperty(un,"__esModule",{value:!0});un.OptionValueBinaryCodec=void 0;var RT=xq(Be()),lh=St(),$m=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){if(e[0]==0)return[lh.OptionValue.newMissingTyped(r),1];if(e[0]!=1)throw new RT.ErrCodec("invalid buffer for optional value");let[n,i]=this.binaryCodec.decodeNested(e.slice(1),r);return[lh.OptionValue.newProvided(n),i+1]}decodeTopLevel(e,r){if(e.length==0)return new lh.OptionValue(r);if(e[0]!=1)throw new RT.ErrCodec("invalid buffer for optional value");let[n,i]=this.binaryCodec.decodeNested(e.slice(1),r);return new lh.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([])}};un.OptionValueBinaryCodec=$m});var LT=m(fh=>{"use strict";c();Object.defineProperty(fh,"__esModule",{value:!0});fh.AddressBinaryCodec=void 0;var Nq=ht(),Oq=St(),zm=class{decodeNested(e){let r=e.slice(0,32),n=new Nq.Address(r);return[new Oq.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()}};fh.AddressBinaryCodec=zm});var MT=m(cn=>{"use strict";c();var Dq=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]}),Pq=cn&&cn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Rq=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)&&Dq(e,t,r);return Pq(e,t),e};Object.defineProperty(cn,"__esModule",{value:!0});cn.BooleanBinaryCodec=void 0;var Bq=Rq(Be()),FT=St(),oc=class t{decodeNested(e){let r=e.readUInt8(0);return[new FT.BooleanValue(r==t.TRUE),1]}decodeTopLevel(e){if(e.length>1)throw new Bq.ErrInvalidArgument("buffer should be of size <= 1");let r=e[0];return new FT.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([])}};cn.BooleanBinaryCodec=oc;oc.TRUE=1;oc.FALSE=0});var dh=m(hh=>{"use strict";c();Object.defineProperty(hh,"__esModule",{value:!0});hh.SizeOfU32=void 0;hh.SizeOfU32=4});var ph=m(ln=>{"use strict";c();var Lq=ln&&ln.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ln,"__esModule",{value:!0});ln.zeroPadStringIfOddLength=ln.isPaddedHex=ln.numberToPaddedHex=void 0;var Fq=Lq(Gt());function Mq(t){let e=new Fq.default(t).toString(16);return UT(e)}ln.numberToPaddedHex=Mq;function Uq(t){t=t||"";let e=h.Buffer.from(t,"hex").toString("hex");return t.toUpperCase()==e.toUpperCase()}ln.isPaddedHex=Uq;function UT(t){return t=t||"",t.length%2==1?"0"+t:t}ln.zeroPadStringIfOddLength=UT});var ac=m(Tt=>{"use strict";c();var qq=Tt&&Tt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Tt,"__esModule",{value:!0});Tt.prependByteToBuffer=Tt.flipBufferBitsInPlace=Tt.getHexMagnitudeOfBigInt=Tt.bigIntToBuffer=Tt.bufferToBigInt=Tt.cloneBuffer=Tt.isMsbZero=Tt.isMsbOne=void 0;var Km=qq(Gt()),Vq=ph();function qT(t,e=0){return t[e]>>7==1}Tt.isMsbOne=qT;function Hq(t,e=0){return!qT(t,e)}Tt.isMsbZero=Hq;function Gq(t){let e=h.Buffer.alloc(t.length);return t.copy(e),e}Tt.cloneBuffer=Gq;function kq(t){let e=t.toString("hex");return new Km.default(`0x${e}`,16)}Tt.bufferToBigInt=kq;function jq(t){let e=VT(t);return h.Buffer.from(e,"hex")}Tt.bigIntToBuffer=jq;function VT(t){return t=new Km.default(t),t?(t.isNegative()&&(t=t.multipliedBy(new Km.default(-1))),Vq.numberToPaddedHex(t)):""}Tt.getHexMagnitudeOfBigInt=VT;function Qq(t){for(let e=0;e{"use strict";c();var $q=Qo&&Qo.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Qo,"__esModule",{value:!0});Qo.NumericalBinaryCodec=void 0;var uc=$q(Gt()),Ym=St(),HT=dh(),wt=ac(),Jm=class{decodeNested(e,r){let n=0,i=r.sizeInBytes;i||(n=HT.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=wt.cloneBuffer(e);if(e.length==0)return new Ym.NumericalValue(r,new uc.default(0));if(!r.withSign||wt.isMsbZero(n)){let l=wt.bufferToBigInt(n);return new Ym.NumericalValue(r,l)}wt.flipBufferBitsInPlace(n);let u=wt.bufferToBigInt(n).multipliedBy(new uc.default(-1)).minus(new uc.default(1));return new Ym.NumericalValue(r,u)}encodeNested(e){if(e.sizeInBytes)return this.encodeNestedFixedSize(e,e.sizeInBytes);let r=this.encodeTopLevel(e),n=h.Buffer.alloc(HT.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=wt.bigIntToBuffer(e.value),a=h.Buffer.alloc(r-o.length,0);return h.Buffer.concat([a,o])}if(e.value.isPositive()){let o=wt.bigIntToBuffer(e.value);wt.isMsbOne(o)&&(o=wt.prependByteToBuffer(o,0));let a=h.Buffer.alloc(r-o.length,0);return h.Buffer.concat([a,o])}let n=e.value.plus(new uc.default(1)),i=wt.bigIntToBuffer(n);wt.flipBufferBitsInPlace(i),wt.isMsbZero(i)&&(i=wt.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):wt.bigIntToBuffer(e.value)}encodePrimitive(e){if(e.value.isPositive()){let i=wt.bigIntToBuffer(e.value);return wt.isMsbOne(i)&&(i=wt.prependByteToBuffer(i,0)),i}let r=e.value.plus(new uc.default(1)),n=wt.bigIntToBuffer(r);return wt.flipBufferBitsInPlace(n),wt.isMsbZero(n)&&(n=wt.prependByteToBuffer(n,255)),n}};Qo.NumericalBinaryCodec=Jm});var kT=m(gh=>{"use strict";c();Object.defineProperty(gh,"__esModule",{value:!0});gh.H256BinaryCodec=void 0;var zq=ku(),Xm=class{decodeNested(e){let r=e.slice(0,32);return[new zq.H256Value(r),32]}decodeTopLevel(e){let[r,n]=this.decodeNested(e);return r}encodeNested(e){return e.valueOf()}encodeTopLevel(e){return e.valueOf()}};gh.H256BinaryCodec=Xm});var wh=m(mh=>{"use strict";c();Object.defineProperty(mh,"__esModule",{value:!0});mh.BytesBinaryCodec=void 0;var jT=mi(),yh=dh(),Zm=class{decodeNested(e){let r=e.readUInt32BE(0),n=e.slice(yh.SizeOfU32,yh.SizeOfU32+r);return[new jT.BytesValue(n),yh.SizeOfU32+r]}decodeTopLevel(e){return new jT.BytesValue(e)}encodeNested(e){let r=h.Buffer.alloc(yh.SizeOfU32);return r.writeUInt32BE(e.getLength()),h.Buffer.concat([r,e.valueOf()])}encodeTopLevel(e){return e.valueOf()}};mh.BytesBinaryCodec=Zm});var WT=m(Eh=>{"use strict";c();Object.defineProperty(Eh,"__esModule",{value:!0});Eh.TokenIdentifierCodec=void 0;var Kq=mi(),QT=Go(),Yq=wh(),ew=class{constructor(){this.bytesCodec=new Yq.BytesBinaryCodec}decodeNested(e){let[r,n]=this.bytesCodec.decodeNested(e);return[new QT.TokenIdentifierValue(r.toString()),n]}decodeTopLevel(e){let r=this.bytesCodec.decodeTopLevel(e);return new QT.TokenIdentifierValue(r.toString())}encodeNested(e){let r=Kq.BytesValue.fromUTF8(e.valueOf());return this.bytesCodec.encodeNested(r)}encodeTopLevel(e){return h.Buffer.from(e.valueOf())}};Eh.TokenIdentifierCodec=ew});var zT=m(vh=>{"use strict";c();Object.defineProperty(vh,"__esModule",{value:!0});vh.NothingCodec=void 0;var $T=St(),tw=class{decodeNested(){return[new $T.NothingValue,0]}decodeTopLevel(){return new $T.NothingValue}encodeNested(){return h.Buffer.from([])}encodeTopLevel(){return h.Buffer.from([])}};vh.NothingCodec=tw});var YT=m(Ah=>{"use strict";c();Object.defineProperty(Ah,"__esModule",{value:!0});Ah.StringBinaryCodec=void 0;var KT=St(),Jq=mi(),Xq=wh(),rw=class{constructor(){this.bytesBinaryCodec=new Xq.BytesBinaryCodec}decodeNested(e){let[r,n]=this.bytesBinaryCodec.decodeNested(e);return[new KT.StringValue(r.valueOf().toString()),n]}decodeTopLevel(e){return new KT.StringValue(e.toString())}encodeNested(e){let r=Jq.BytesValue.fromUTF8(e.valueOf());return this.bytesBinaryCodec.encodeNested(r)}encodeTopLevel(e){return h.Buffer.from(e.valueOf())}};Ah.StringBinaryCodec=rw});var JT=m(_h=>{"use strict";c();Object.defineProperty(_h,"__esModule",{value:!0});_h.PrimitiveBinaryCodec=void 0;var bh=St(),Zq=LT(),eV=MT(),tV=GT(),rV=kT(),nV=wh(),iV=WT(),sV=zT(),oV=YT(),nw=class{constructor(e){this.binaryCodec=e,this.booleanCodec=new eV.BooleanBinaryCodec,this.numericalCodec=new tV.NumericalBinaryCodec,this.addressCodec=new Zq.AddressBinaryCodec,this.h256Codec=new rV.H256BinaryCodec,this.bytesCodec=new nV.BytesBinaryCodec,this.stringCodec=new oV.StringBinaryCodec,this.tokenIdentifierCodec=new iV.TokenIdentifierCodec,this.nothingCodec=new sV.NothingCodec}decodeNested(e,r){return bh.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 bh.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 bh.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 bh.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()})}};_h.PrimitiveBinaryCodec=nw});var eC=m(Ih=>{"use strict";c();Object.defineProperty(Ih,"__esModule",{value:!0});Ih.ListBinaryCodec=void 0;var XT=St(),ZT=dh(),iw=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=ZT.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 XT.List(r,i)}encodeNested(e){this.binaryCodec.constraints.checkListLength(e.getLength());let r=h.Buffer.alloc(ZT.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)}};Ih.ListBinaryCodec=iw});var ow=m(Sh=>{"use strict";c();Object.defineProperty(Sh,"__esModule",{value:!0});Sh.FieldsBinaryCodec=void 0;var aV=St(),sw=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){let n=[],i=0;for(let s of r){let[o,a]=this.binaryCodec.decodeNested(e,s.type);e=e.slice(a),i+=a;let u=new aV.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)}};Sh.FieldsBinaryCodec=sw});var uw=m(Th=>{"use strict";c();Object.defineProperty(Th,"__esModule",{value:!0});Th.StructBinaryCodec=void 0;var uV=St(),cV=ow(),aw=class{constructor(e){this.fieldsCodec=new cV.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 uV.Struct(r,i),s]}encodeNested(e){let r=e.getFields();return this.fieldsCodec.encodeNested(r)}encodeTopLevel(e){return this.encodeNested(e)}};Th.StructBinaryCodec=aw});var tC=m(xh=>{"use strict";c();Object.defineProperty(xh,"__esModule",{value:!0});xh.EnumBinaryCodec=void 0;var Ch=St(),lV=ow(),cw=class{constructor(e){this.binaryCodec=e,this.fieldsCodec=new lV.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 Ch.EnumValue(r,s,a),i+u]}readDiscriminant(e){let[r,n]=this.binaryCodec.decodeNested(e,new Ch.U8Type);return[r.valueOf(),n]}encodeNested(e){let r=new Ch.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 Ch.U8Value(e.discriminant),o=n?this.binaryCodec.encodeNested(s):this.binaryCodec.encodeTopLevel(s);return h.Buffer.concat([o,i])}};xh.EnumBinaryCodec=cw});var rC=m(Nh=>{"use strict";c();Object.defineProperty(Nh,"__esModule",{value:!0});Nh.TupleBinaryCodec=void 0;var fV=uw(),lw=class{constructor(e){this.structCodec=new fV.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)}};Nh.TupleBinaryCodec=lw});var nC=m(Oh=>{"use strict";c();Object.defineProperty(Oh,"__esModule",{value:!0});Oh.ArrayVecBinaryCodec=void 0;var hV=St(),fw=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 dV=xr&&xr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),pV=xr&&xr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gV=xr&&xr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&dV(e,t,r);return pV(e,t),e};Object.defineProperty(xr,"__esModule",{value:!0});xr.BinaryCodecConstraints=xr.BinaryCodec=void 0;var iC=gV(Be()),Dh=St(),sC=wr(),yV=BT(),mV=JT(),wV=eC(),EV=uw(),vV=tC(),AV=rC(),bV=nC(),hw=class{constructor(e=null){this.constraints=e||new Ph,this.optionCodec=new yV.OptionValueBinaryCodec(this),this.listCodec=new wV.ListBinaryCodec(this),this.arrayCodec=new bV.ArrayVecBinaryCodec(this),this.primitiveCodec=new mV.PrimitiveBinaryCodec(this),this.structCodec=new EV.StructBinaryCodec(this),this.tupleCodec=new AV.TupleBinaryCodec(this),this.enumCodec=new vV.EnumBinaryCodec(this)}decodeTopLevel(e,r){return this.constraints.checkBufferLength(e),Dh.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]=Dh.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 sC.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),Dh.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 sC.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),Dh.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)})}};xr.BinaryCodec=hw;var Ph=class{constructor(e){this.maxBufferLength=e?.maxBufferLength||256e3,this.maxListLength=e?.maxListLength||128e3}checkBufferLength(e){if(e.length>this.maxBufferLength)throw new iC.ErrCodec(`Buffer too large: ${e.length} > ${this.maxBufferLength}`)}checkListLength(e){if(e>this.maxListLength)throw new iC.ErrCodec(`List too large: ${e} > ${this.maxListLength}`)}};xr.BinaryCodecConstraints=Ph});var oC=m(Nr=>{"use strict";c();var _V=Nr&&Nr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Nr,"__esModule",{value:!0});Nr.decodeBigNumber=Nr.decodeString=Nr.decodeBool=Nr.decodeUnsignedNumber=void 0;var IV=_V(Gt()),Rh=St(),SV=dw(),Bh=new SV.BinaryCodec;function TV(t){let e=Bh.decodeTopLevel(t,new Rh.BigUIntType);return Number(e.valueOf())}Nr.decodeUnsignedNumber=TV;function CV(t){return!!Bh.decodeTopLevel(t,new Rh.BooleanType).valueOf()}Nr.decodeBool=CV;function xV(t){let e=Bh.decodeTopLevel(t,new Rh.BytesType);return String(e.valueOf())}Nr.decodeString=xV;function NV(t){let e=Bh.decodeTopLevel(t,new Rh.BigUIntType);return new IV.default(e.valueOf())}Nr.decodeBigNumber=NV});var pw=m(vi=>{"use strict";c();var OV=vi&&vi.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),aC=vi&&vi.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&OV(e,t,r)};Object.defineProperty(vi,"__esModule",{value:!0});aC(dw(),vi);aC(oC(),vi)});var Wo=m(Lh=>{"use strict";c();Object.defineProperty(Lh,"__esModule",{value:!0});Lh.ArgSerializer=void 0;var uC=bs(),DV=pw(),cC=St(),gw=Cf(),yw=Pf(),mw=sh(),PV={codec:new DV.BinaryCodec},ww=class{constructor(e){e=Object.assign(Object.assign({},PV),e),this.codec=e.codec}stringToValues(e,r){let n=this.stringToBuffers(e);return this.buffersToValues(n,r)}stringToBuffers(e){return e.split(uC.ARGUMENTS_SEPARATOR).map(r=>h.Buffer.from(r,"hex"))}buffersToValues(e,r){let n=this;e=e||[];let i=[],s=0,o=e.length;for(let d=0;d=o}return i}valuesToString(e){let r=this.valuesToStrings(e),n=r.join(uC.ARGUMENTS_SEPARATOR),i=r.length;return{argumentsString:n,count:i}}valuesToStrings(e){return this.valuesToBuffers(e).map(i=>i.toString("hex"))}valuesToBuffers(e){let r=this,n=[];for(let o of e)i(o);function i(o){if(o.hasExactClass(gw.OptionalValue.ClassName)){let u=o;u.isSet()&&i(u.getTypedValue());return}if(o.hasExactClass(mw.VariadicValue.ClassName)){s(o);return}if(o.hasExactClass(yw.CompositeValue.ClassName)){let u=o;for(let l of u.getItems())i(l);return}let a=r.codec.encodeTopLevel(o);n.push(a)}function s(o){if(o.getType().isCounted){let u=new cC.U32Value(o.getItems().length);n.push(r.codec.encodeTopLevel(u))}for(let u of o.getItems())i(u)}return n}};Lh.ArgSerializer=ww});var Uh=m(Mh=>{"use strict";c();Object.defineProperty(Mh,"__esModule",{value:!0});Mh.Compatibility=void 0;var RV=ht(),Fh=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()==RV.Address.Zero().bech32()&&console.warn(`${r}: address should not be the 'zero' address (also known as the 'contracts deployment address'); ${n}. In the future, this will throw an exception instead of emitting a WARN.`))}};Mh.Compatibility=Fh;Fh.areWarningsEnabled=!0});var lC=m(fn=>{"use strict";c();var BV=fn&&fn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),LV=fn&&fn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FV=fn&&fn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&BV(e,t,r);return LV(e,t),e};Object.defineProperty(fn,"__esModule",{value:!0});fn.Hash=void 0;var MV=FV(Be()),Ew=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 MV.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}};fn.Hash=Ew});var cc=m(Or=>{"use strict";c();var UV=Or&&Or.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qV=Or&&Or.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VV=Or&&Or.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&UV(e,t,r);return qV(e,t),e};Object.defineProperty(Or,"__esModule",{value:!0});Or.TransactionOptions=Or.TransactionVersion=void 0;var jr=bs(),fC=VV(Be()),vw=class t{constructor(e){if(e=Number(e),e<1)throw new fC.ErrTransactionVersionInvalid(e);this.value=e}static withDefaultVersion(){return new t(jr.TRANSACTION_VERSION_DEFAULT)}static withTxOptions(){return new t(jr.TRANSACTION_VERSION_WITH_OPTIONS)}valueOf(){return this.value}};Or.TransactionVersion=vw;var Aw=class t{constructor(e){if(e=Number(e),e<0)throw new fC.ErrTransactionOptionsInvalid(e);this.value=e}static withDefaultOptions(){return new t(jr.TRANSACTION_OPTIONS_DEFAULT)}static withOptions(e){let r=0;return e.hashSign&&(r|=jr.TRANSACTION_OPTIONS_TX_HASH_SIGN),e.guarded&&(r|=jr.TRANSACTION_OPTIONS_TX_GUARDED),new t(r)}isWithHashSign(){return(this.value&jr.TRANSACTION_OPTIONS_TX_HASH_SIGN)==jr.TRANSACTION_OPTIONS_TX_HASH_SIGN}isWithGuardian(){return(this.value&jr.TRANSACTION_OPTIONS_TX_GUARDED)==jr.TRANSACTION_OPTIONS_TX_GUARDED}setWithHashSign(){this.value|=jr.TRANSACTION_OPTIONS_TX_HASH_SIGN}setWithGuardian(){this.value|=jr.TRANSACTION_OPTIONS_TX_GUARDED}valueOf(){return this.value}};Or.TransactionOptions=Aw});var dC=m((Woe,hC)=>{"use strict";c();hC.exports=HV;function HV(t,e){for(var r=new Array(arguments.length-1),n=0,i=2,s=!0;i{"use strict";c();var qh=yC;qh.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 $o=new Array(64),gC=new Array(123);for(Qr=0;Qr<64;)gC[$o[Qr]=Qr<26?Qr+65:Qr<52?Qr+71:Qr<62?Qr-4:Qr-59|43]=Qr++;var Qr;qh.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++]=$o[u|l>>4],u=(l&15)<<2,a=2;break;case 2:s[o++]=$o[u|l>>6],s[o++]=$o[l&63],a=0;break}o>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,s)),o=0)}return a&&(s[o++]=$o[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 pC="invalid encoding";qh.decode=function(e,r,n){for(var i=n,s=0,o,a=0;a1)break;if((u=gC[u])===void 0)throw Error(pC);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(pC);return n-i};qh.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var EC=m((Yoe,wC)=>{"use strict";c();wC.exports=Vh;function Vh(){this._listeners={}}Vh.prototype.on=function(e,r,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:r,ctx:n||this}),this};Vh.prototype.off=function(e,r){if(e===void 0)this._listeners={};else if(r===void 0)this._listeners[e]=[];else for(var n=this._listeners[e],i=0;i{"use strict";c();SC.exports=vC(vC);function vC(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,AC),t.writeFloatBE=e.bind(null,bC);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,_C),t.readFloatBE=r.bind(null,IC)}(),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,AC,0,4),t.writeDoubleBE=e.bind(null,bC,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,_C,0,4),t.readDoubleBE=r.bind(null,IC,4,0)}(),t}function AC(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 bC(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 _C(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0}function IC(t,e){return(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}});var CC=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 NC=m(xC=>{"use strict";c();var bw=xC;bw.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))};bw.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 DC=m((nae,OC)=>{"use strict";c();OC.exports=GV;function GV(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 RC=m((sae,PC)=>{"use strict";c();PC.exports=Bt;var lc=bi();function Bt(t,e){this.lo=t>>>0,this.hi=e>>>0}var xs=Bt.zero=new Bt(0,0);xs.toNumber=function(){return 0};xs.zzEncode=xs.zzDecode=function(){return this};xs.length=function(){return 1};var kV=Bt.zeroHash="\0\0\0\0\0\0\0\0";Bt.fromNumber=function(e){if(e===0)return xs;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(lc.isString(e))if(lc.Long)e=lc.Long.fromString(e);else return Bt.fromNumber(parseInt(e,10));return e.low||e.high?new Bt(e.low>>>0,e.high>>>0):xs};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 lc.Long?new lc.Long(this.lo|0,this.hi|0,!!e):{low:this.lo|0,high:this.hi|0,unsigned:!!e}};var Ai=String.prototype.charCodeAt;Bt.fromHash=function(e){return e===kV?xs:new Bt((Ai.call(e,0)|Ai.call(e,1)<<8|Ai.call(e,2)<<16|Ai.call(e,3)<<24)>>>0,(Ai.call(e,4)|Ai.call(e,5)<<8|Ai.call(e,6)<<16|Ai.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 bi=m(_w=>{"use strict";c();var Ee=_w;Ee.asPromise=dC();Ee.base64=mC();Ee.EventEmitter=EC();Ee.float=TC();Ee.inquire=CC();Ee.utf8=NC();Ee.pool=DC();Ee.LongBits=RC();Ee.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);Ee.global=Ee.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||_w;Ee.emptyArray=Object.freeze?Object.freeze([]):[];Ee.emptyObject=Object.freeze?Object.freeze({}):{};Ee.isInteger=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};Ee.isString=function(e){return typeof e=="string"||e instanceof String};Ee.isObject=function(e){return e&&typeof e=="object"};Ee.isset=Ee.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};Ee.Buffer=function(){try{var t=Ee.inquire("buffer").Buffer;return t.prototype.utf8Write?t:null}catch{return null}}();Ee._Buffer_from=null;Ee._Buffer_allocUnsafe=null;Ee.newBuffer=function(e){return typeof e=="number"?Ee.Buffer?Ee._Buffer_allocUnsafe(e):new Ee.Array(e):Ee.Buffer?Ee._Buffer_from(e):typeof Uint8Array>"u"?e:new Uint8Array(e)};Ee.Array=typeof Uint8Array<"u"?Uint8Array:Array;Ee.Long=Ee.global.dcodeIO&&Ee.global.dcodeIO.Long||Ee.global.Long||Ee.inquire("long");Ee.key2Re=/^true|false|0|1$/;Ee.key32Re=/^-?(?:0|[1-9][0-9]*)$/;Ee.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;Ee.longToHash=function(e){return e?Ee.LongBits.from(e).toHash():Ee.LongBits.zeroHash};Ee.longFromHash=function(e,r){var n=Ee.LongBits.fromHash(e);return Ee.Long?Ee.Long.fromBits(n.lo,n.hi,r):n.toNumber(!!r)};function BC(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]}};Ee.oneOfSetter=function(e){return function(r){for(var n=0;n{"use strict";c();qC.exports=Fe;var Dr=bi(),Iw,Hh=Dr.LongBits,FC=Dr.base64,MC=Dr.utf8;function fc(t,e,r){this.fn=t,this.len=e,this.next=void 0,this.val=r}function Tw(){}function jV(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 fc(Tw,0,0),this.tail=this.head,this.states=null}var UC=function(){return Dr.Buffer?function(){return(Fe.create=function(){return new Iw})()}:function(){return new Fe}};Fe.create=UC();Fe.alloc=function(e){return new Dr.Array(e)};Dr.Array!==Array&&(Fe.alloc=Dr.pool(Fe.alloc,Dr.Array.prototype.subarray));Fe.prototype._push=function(e,r,n){return this.tail=this.tail.next=new fc(e,r,n),this.len+=r,this};function Cw(t,e,r){e[r]=t&255}function QV(t,e,r){for(;t>127;)e[r++]=t&127|128,t>>>=7;e[r]=t}function xw(t,e){this.len=t,this.next=void 0,this.val=e}xw.prototype=Object.create(fc.prototype);xw.prototype.fn=QV;Fe.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new xw((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(Nw,10,Hh.fromNumber(e)):this.uint32(e)};Fe.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function Nw(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=Hh.from(e);return this._push(Nw,r.length(),r)};Fe.prototype.int64=Fe.prototype.uint64;Fe.prototype.sint64=function(e){var r=Hh.from(e).zzEncode();return this._push(Nw,r.length(),r)};Fe.prototype.bool=function(e){return this._push(Cw,1,e?1:0)};function Sw(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(Sw,4,e>>>0)};Fe.prototype.sfixed32=Fe.prototype.fixed32;Fe.prototype.fixed64=function(e){var r=Hh.from(e);return this._push(Sw,4,r.lo)._push(Sw,4,r.hi)};Fe.prototype.sfixed64=Fe.prototype.fixed64;Fe.prototype.float=function(e){return this._push(Dr.float.writeFloatLE,4,e)};Fe.prototype.double=function(e){return this._push(Dr.float.writeDoubleLE,8,e)};var WV=Dr.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(Cw,1,0);if(Dr.isString(e)){var n=Fe.alloc(r=FC.length(e));FC.decode(e,n,0),e=n}return this.uint32(r)._push(WV,r,e)};Fe.prototype.string=function(e){var r=MC.length(e);return r?this.uint32(r)._push(MC.write,r,e):this._push(Cw,1,0)};Fe.prototype.fork=function(){return this.states=new jV(this),this.head=this.tail=new fc(Tw,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 fc(Tw,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){Iw=t,Fe.create=UC(),Iw._configure()}});var GC=m((fae,HC)=>{"use strict";c();HC.exports=hn;var VC=Ow();(hn.prototype=Object.create(VC.prototype)).constructor=hn;var _i=bi();function hn(){VC.call(this)}hn._configure=function(){hn.alloc=_i._Buffer_allocUnsafe,hn.writeBytesBuffer=_i.Buffer&&_i.Buffer.prototype instanceof Uint8Array&&_i.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(hn.writeBytesBuffer,r,e),this};function $V(t,e,r){t.length<40?_i.utf8.write(t,e,r):e.utf8Write?e.utf8Write(t,r):e.write(t,r)}hn.prototype.string=function(e){var r=_i.Buffer.byteLength(e);return this.uint32(r),r&&this._push($V,r,e),this};hn._configure()});var Rw=m((dae,$C)=>{"use strict";c();$C.exports=Et;var dn=bi(),Pw,QC=dn.LongBits,zV=dn.utf8;function Wr(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 kC=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")},WC=function(){return dn.Buffer?function(r){return(Et.create=function(i){return dn.Buffer.isBuffer(i)?new Pw(i):kC(i)})(r)}:kC};Et.create=WC();Et.prototype._slice=dn.Array.prototype.subarray||dn.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,Wr(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 Dw(){var t=new QC(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 Wr(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 Wr(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 Gh(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 Wr(this,4);return Gh(this.buf,this.pos+=4)};Et.prototype.sfixed32=function(){if(this.pos+4>this.len)throw Wr(this,4);return Gh(this.buf,this.pos+=4)|0};function jC(){if(this.pos+8>this.len)throw Wr(this,8);return new QC(Gh(this.buf,this.pos+=4),Gh(this.buf,this.pos+=4))}Et.prototype.float=function(){if(this.pos+4>this.len)throw Wr(this,4);var e=dn.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};Et.prototype.double=function(){if(this.pos+8>this.len)throw Wr(this,4);var e=dn.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 Wr(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 zV.read(e,0,e.length)};Et.prototype.skip=function(e){if(typeof e=="number"){if(this.pos+e>this.len)throw Wr(this,e);this.pos+=e}else do if(this.pos>=this.len)throw Wr(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){Pw=t,Et.create=WC(),Pw._configure();var e=dn.Long?"toLong":"toNumber";dn.merge(Et.prototype,{int64:function(){return Dw.call(this)[e](!1)},uint64:function(){return Dw.call(this)[e](!0)},sint64:function(){return Dw.call(this).zzDecode()[e](!1)},fixed64:function(){return jC.call(this)[e](!0)},sfixed64:function(){return jC.call(this)[e](!1)}})}});var JC=m((gae,YC)=>{"use strict";c();YC.exports=Ns;var KC=Rw();(Ns.prototype=Object.create(KC.prototype)).constructor=Ns;var zC=bi();function Ns(t){KC.call(this,t)}Ns._configure=function(){zC.Buffer&&(Ns.prototype._slice=zC.Buffer.prototype.slice)};Ns.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))};Ns._configure()});var ZC=m((mae,XC)=>{"use strict";c();XC.exports=hc;var Bw=bi();(hc.prototype=Object.create(Bw.EventEmitter.prototype)).constructor=hc;function hc(t,e,r){if(typeof t!="function")throw TypeError("rpcImpl must be a function");Bw.EventEmitter.call(this),this.rpcImpl=t,this.requestDelimited=!!e,this.responseDelimited=!!r}hc.prototype.rpcCall=function t(e,r,n,i,s){if(!i)throw TypeError("request must be specified");var o=this;if(!s)return Bw.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}};hc.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var tx=m(ex=>{"use strict";c();var KV=ex;KV.Service=ZC()});var nx=m((Aae,rx)=>{"use strict";c();rx.exports={}});var ox=m(sx=>{"use strict";c();var lr=sx;lr.build="minimal";lr.Writer=Ow();lr.BufferWriter=GC();lr.Reader=Rw();lr.BufferReader=JC();lr.util=bi();lr.rpc=tx();lr.roots=nx();lr.configure=ix;function ix(){lr.util._configure(),lr.Writer._configure(lr.BufferWriter),lr.Reader._configure(lr.BufferReader)}ix()});var ux=m((Sae,ax)=>{"use strict";c();ax.exports=ox()});var lx=m((Cae,cx)=>{"use strict";c();var zo=ux(),kh=zo.Reader,YV=zo.Writer,X=zo.util,dc=zo.roots.default||(zo.roots.default={});dc.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 kh||(n=new kh(n)),this.decode(n,n.uint32())},e.verify=function(n){return typeof n!="object"||n===null?"object expected":n.Nonce!=null&&n.hasOwnProperty("Nonce")&&!X.isInteger(n.Nonce)&&!(n.Nonce&&X.isInteger(n.Nonce.low)&&X.isInteger(n.Nonce.high))?"Nonce: integer|Long expected":n.Value!=null&&n.hasOwnProperty("Value")&&!(n.Value&&typeof n.Value.length=="number"||X.isString(n.Value))?"Value: buffer expected":n.RcvAddr!=null&&n.hasOwnProperty("RcvAddr")&&!(n.RcvAddr&&typeof n.RcvAddr.length=="number"||X.isString(n.RcvAddr))?"RcvAddr: buffer expected":n.RcvUserName!=null&&n.hasOwnProperty("RcvUserName")&&!(n.RcvUserName&&typeof n.RcvUserName.length=="number"||X.isString(n.RcvUserName))?"RcvUserName: buffer expected":n.SndAddr!=null&&n.hasOwnProperty("SndAddr")&&!(n.SndAddr&&typeof n.SndAddr.length=="number"||X.isString(n.SndAddr))?"SndAddr: buffer expected":n.SndUserName!=null&&n.hasOwnProperty("SndUserName")&&!(n.SndUserName&&typeof n.SndUserName.length=="number"||X.isString(n.SndUserName))?"SndUserName: buffer expected":n.GasPrice!=null&&n.hasOwnProperty("GasPrice")&&!X.isInteger(n.GasPrice)&&!(n.GasPrice&&X.isInteger(n.GasPrice.low)&&X.isInteger(n.GasPrice.high))?"GasPrice: integer|Long expected":n.GasLimit!=null&&n.hasOwnProperty("GasLimit")&&!X.isInteger(n.GasLimit)&&!(n.GasLimit&&X.isInteger(n.GasLimit.low)&&X.isInteger(n.GasLimit.high))?"GasLimit: integer|Long expected":n.Data!=null&&n.hasOwnProperty("Data")&&!(n.Data&&typeof n.Data.length=="number"||X.isString(n.Data))?"Data: buffer expected":n.ChainID!=null&&n.hasOwnProperty("ChainID")&&!(n.ChainID&&typeof n.ChainID.length=="number"||X.isString(n.ChainID))?"ChainID: buffer expected":n.Version!=null&&n.hasOwnProperty("Version")&&!X.isInteger(n.Version)?"Version: integer expected":n.Signature!=null&&n.hasOwnProperty("Signature")&&!(n.Signature&&typeof n.Signature.length=="number"||X.isString(n.Signature))?"Signature: buffer expected":n.Options!=null&&n.hasOwnProperty("Options")&&!X.isInteger(n.Options)?"Options: integer expected":n.GuardAddr!=null&&n.hasOwnProperty("GuardAddr")&&!(n.GuardAddr&&typeof n.GuardAddr.length=="number"||X.isString(n.GuardAddr))?"GuardAddr: buffer expected":n.GuardSignature!=null&&n.hasOwnProperty("GuardSignature")&&!(n.GuardSignature&&typeof n.GuardSignature.length=="number"||X.isString(n.GuardSignature))?"GuardSignature: buffer expected":null},e.fromObject=function(n){if(n instanceof dc.proto.Transaction)return n;var i=new dc.proto.Transaction;return n.Nonce!=null&&(X.Long?(i.Nonce=X.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 X.LongBits(n.Nonce.low>>>0,n.Nonce.high>>>0).toNumber(!0))),n.Value!=null&&(typeof n.Value=="string"?X.base64.decode(n.Value,i.Value=X.newBuffer(X.base64.length(n.Value)),0):n.Value.length&&(i.Value=n.Value)),n.RcvAddr!=null&&(typeof n.RcvAddr=="string"?X.base64.decode(n.RcvAddr,i.RcvAddr=X.newBuffer(X.base64.length(n.RcvAddr)),0):n.RcvAddr.length&&(i.RcvAddr=n.RcvAddr)),n.RcvUserName!=null&&(typeof n.RcvUserName=="string"?X.base64.decode(n.RcvUserName,i.RcvUserName=X.newBuffer(X.base64.length(n.RcvUserName)),0):n.RcvUserName.length&&(i.RcvUserName=n.RcvUserName)),n.SndAddr!=null&&(typeof n.SndAddr=="string"?X.base64.decode(n.SndAddr,i.SndAddr=X.newBuffer(X.base64.length(n.SndAddr)),0):n.SndAddr.length&&(i.SndAddr=n.SndAddr)),n.SndUserName!=null&&(typeof n.SndUserName=="string"?X.base64.decode(n.SndUserName,i.SndUserName=X.newBuffer(X.base64.length(n.SndUserName)),0):n.SndUserName.length&&(i.SndUserName=n.SndUserName)),n.GasPrice!=null&&(X.Long?(i.GasPrice=X.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 X.LongBits(n.GasPrice.low>>>0,n.GasPrice.high>>>0).toNumber(!0))),n.GasLimit!=null&&(X.Long?(i.GasLimit=X.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 X.LongBits(n.GasLimit.low>>>0,n.GasLimit.high>>>0).toNumber(!0))),n.Data!=null&&(typeof n.Data=="string"?X.base64.decode(n.Data,i.Data=X.newBuffer(X.base64.length(n.Data)),0):n.Data.length&&(i.Data=n.Data)),n.ChainID!=null&&(typeof n.ChainID=="string"?X.base64.decode(n.ChainID,i.ChainID=X.newBuffer(X.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"?X.base64.decode(n.Signature,i.Signature=X.newBuffer(X.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"?X.base64.decode(n.GuardAddr,i.GuardAddr=X.newBuffer(X.base64.length(n.GuardAddr)),0):n.GuardAddr.length&&(i.GuardAddr=n.GuardAddr)),n.GuardSignature!=null&&(typeof n.GuardSignature=="string"?X.base64.decode(n.GuardSignature,i.GuardSignature=X.newBuffer(X.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(X.Long){var o=new X.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=X.newBuffer(s.Value))),i.bytes===String?s.RcvAddr="":(s.RcvAddr=[],i.bytes!==Array&&(s.RcvAddr=X.newBuffer(s.RcvAddr))),i.bytes===String?s.RcvUserName="":(s.RcvUserName=[],i.bytes!==Array&&(s.RcvUserName=X.newBuffer(s.RcvUserName))),i.bytes===String?s.SndAddr="":(s.SndAddr=[],i.bytes!==Array&&(s.SndAddr=X.newBuffer(s.SndAddr))),i.bytes===String?s.SndUserName="":(s.SndUserName=[],i.bytes!==Array&&(s.SndUserName=X.newBuffer(s.SndUserName))),X.Long){var o=new X.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(X.Long){var o=new X.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=X.newBuffer(s.Data))),i.bytes===String?s.ChainID="":(s.ChainID=[],i.bytes!==Array&&(s.ChainID=X.newBuffer(s.ChainID))),s.Version=0,i.bytes===String?s.Signature="":(s.Signature=[],i.bytes!==Array&&(s.Signature=X.newBuffer(s.Signature))),s.Options=0,i.bytes===String?s.GuardAddr="":(s.GuardAddr=[],i.bytes!==Array&&(s.GuardAddr=X.newBuffer(s.GuardAddr))),i.bytes===String?s.GuardSignature="":(s.GuardSignature=[],i.bytes!==Array&&(s.GuardSignature=X.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?X.Long.prototype.toString.call(n.Nonce):i.longs===Number?new X.LongBits(n.Nonce.low>>>0,n.Nonce.high>>>0).toNumber(!0):n.Nonce),n.Value!=null&&n.hasOwnProperty("Value")&&(s.Value=i.bytes===String?X.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?X.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?X.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?X.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?X.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?X.Long.prototype.toString.call(n.GasPrice):i.longs===Number?new X.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?X.Long.prototype.toString.call(n.GasLimit):i.longs===Number?new X.LongBits(n.GasLimit.low>>>0,n.GasLimit.high>>>0).toNumber(!0):n.GasLimit),n.Data!=null&&n.hasOwnProperty("Data")&&(s.Data=i.bytes===String?X.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?X.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?X.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?X.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?X.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,zo.util.toJSONOptions)},e}(),t}();cx.exports=dc});var fx=m(Pr=>{"use strict";c();var JV=Pr&&Pr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),XV=Pr&&Pr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZV=Pr&&Pr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&JV(e,t,r);return XV(e,t),e},eH=Pr&&Pr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Pr,"__esModule",{value:!0});Pr.ProtoSerializer=void 0;var tH=eH(Gt()),Lw=ht(),rH=bs(),nH=ZV(Be()),iH=ac(),Fw=class{serializeTransaction(e){let r=lx().proto,n=new Lw.Address(e.getReceiver().bech32()).pubkey(),i=new Lw.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()!==rH.TRANSACTION_OPTIONS_DEFAULT&&(s.Options=e.getOptions().valueOf()),e.isGuardedTransaction()){let u=e.getGuardian();s.GuardAddr=new Lw.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 tH.default(e.toString());if(r.isZero())return h.Buffer.from([0,0]);let n=iH.bigIntToBuffer(r);return n=h.Buffer.concat([h.Buffer.from([0]),n]),n}deserializeTransaction(e){throw new nH.ErrUnsupportedOperation("deserializeTransaction")}};Pr.ProtoSerializer=Fw});var hx=m(Os=>{"use strict";c();var sH=Os&&Os.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),oH=Os&&Os.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&sH(e,t,r)};Object.defineProperty(Os,"__esModule",{value:!0});oH(fx(),Os)});var jh=m(pn=>{"use strict";c();var aH=pn&&pn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),uH=pn&&pn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cH=pn&&pn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&aH(e,t,r);return uH(e,t),e};Object.defineProperty(pn,"__esModule",{value:!0});pn.Signature=void 0;var dx=cH(Be()),px=64,Mw=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 dx.ErrSignatureCannotCreate(e);return t.fromValidHex(e)}static isValidHex(e){return h.Buffer.from(e,"hex").length==px}static fromValidHex(e){let r=new t;return r.valueHex=e,r}static fromBuffer(e){if(e.length!=px)throw new dx.ErrSignatureCannotCreate(e);return t.fromValidHex(e.toString("hex"))}hex(){return this.valueHex}};pn.Signature=Mw});var jn=m(Qh=>{"use strict";c();Object.defineProperty(Qh,"__esModule",{value:!0});Qh.TransactionPayload=void 0;var Uw=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}};Qh.TransactionPayload=Uw});var qw=m((Mae,gx)=>{c();Qn.notEqual=fH;Qn.notOk=hH;Qn.equal=lH;Qn.ok=Qn;gx.exports=Qn;function lH(t,e,r){Qn(t==e,r)}function fH(t,e,r){Qn(t!=e,r)}function hH(t,e){Qn(!t,e)}function Qn(t,e){if(!t)throw new Error(e||"AssertionError")}});var Ps=m(Xo=>{"use strict";c();var Vw=C0(),Yo=N0(),yx=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Xo.Buffer=$;Xo.SlowBuffer=wH;Xo.INSPECT_MAX_BYTES=50;var Wh=2147483647;Xo.kMaxLength=Wh;$.TYPED_ARRAY_SUPPORT=dH();!$.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 dH(){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($.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 Wn(t){if(t>Wh)throw new RangeError('The value "'+t+'" is invalid for option "size"');let 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 jw(t)}return vx(t,e,r)}$.poolSize=8192;function vx(t,e,r){if(typeof t=="string")return gH(t,e);if(ArrayBuffer.isView(t))return yH(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(gn(t,ArrayBuffer)||t&&gn(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(gn(t,SharedArrayBuffer)||t&&gn(t.buffer,SharedArrayBuffer)))return Gw(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 $.from(n,e,r);let i=mH(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 vx(t,e,r)};Object.setPrototypeOf($.prototype,Uint8Array.prototype);Object.setPrototypeOf($,Uint8Array);function Ax(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 pH(t,e,r){return Ax(t),t<=0?Wn(t):e!==void 0?typeof r=="string"?Wn(t).fill(e,r):Wn(t).fill(e):Wn(t)}$.alloc=function(t,e,r){return pH(t,e,r)};function jw(t){return Ax(t),Wn(t<0?0:Qw(t)|0)}$.allocUnsafe=function(t){return jw(t)};$.allocUnsafeSlow=function(t){return jw(t)};function gH(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!$.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=bx(t,e)|0,n=Wn(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function Hw(t){let e=t.length<0?0:Qw(t.length)|0,r=Wn(e);for(let n=0;n=Wh)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Wh.toString(16)+" bytes");return t|0}function wH(t){return+t!=t&&(t=0),$.alloc(+t)}$.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==$.prototype};$.compare=function(e,r){if(gn(e,Uint8Array)&&(e=$.from(e,e.offset,e.byteLength)),gn(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;let n=e.length,i=r.length;for(let s=0,o=Math.min(n,i);si.length?($.isBuffer(o)||(o=$.from(o)),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 bx(t,e){if($.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||gn(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 kw(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return Dx(t).length;default:if(i)return n?-1:kw(t).length;e=(""+e).toLowerCase(),i=!0}}$.byteLength=bx;function EH(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 NH(this,e,r);case"utf8":case"utf-8":return Ix(this,e,r);case"ascii":return CH(this,e,r);case"latin1":case"binary":return xH(this,e,r);case"base64":return SH(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return OH(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}$.prototype._isBuffer=!0;function Ds(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}$.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+=" ... "),""};yx&&($.prototype[yx]=$.prototype.inspect);$.prototype.compare=function(e,r,n,i,s){if(gn(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;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,$w(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:mx(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):mx(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function mx(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 vH(this,e,r,n);case"utf8":case"utf-8":return AH(this,e,r,n);case"ascii":case"latin1":case"binary":return bH(this,e,r,n);case"base64":return _H(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return IH(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 SH(t,e,r){return e===0&&r===t.length?Vw.fromByteArray(t):Vw.fromByteArray(t.slice(e,r))}function Ix(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 TH(n)}var wx=4096;function TH(t){let e=t.length;if(e<=wx)return String.fromCharCode.apply(String,t);let r="",n=0;for(;nn)&&(r=n);let i="";for(let s=e;sn&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),rr)throw new RangeError("Trying to access beyond buffer length")}$.prototype.readUintLE=$.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};$.prototype.readUint8=$.prototype.readUInt8=function(e,r){return e=e>>>0,r||Lt(e,1,this.length),this[e]};$.prototype.readUint16LE=$.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||Lt(e,2,this.length),this[e]|this[e+1]<<8};$.prototype.readUint16BE=$.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||Lt(e,2,this.length),this[e]<<8|this[e+1]};$.prototype.readUint32LE=$.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};$.prototype.readUint32BE=$.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])};$.prototype.readBigUInt64LE=Ii(function(e){e=e>>>0,Jo(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&pc(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,Jo(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&pc(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};$.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};$.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]};$.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};$.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};$.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};$.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]};$.prototype.readBigInt64LE=Ii(function(e){e=e>>>0,Jo(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&pc(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,Jo(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&pc(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),Yo.read(this,e,!0,23,4)};$.prototype.readFloatBE=function(e,r){return e=e>>>0,r||Lt(e,4,this.length),Yo.read(this,e,!1,23,4)};$.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||Lt(e,8,this.length),Yo.read(this,e,!0,52,8)};$.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||Lt(e,8,this.length),Yo.read(this,e,!1,52,8)};function fr(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){let a=Math.pow(2,8*n)-1;fr(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;fr(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};$.prototype.writeUint8=$.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||fr(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||fr(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||fr(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||fr(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||fr(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 Sx(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 Tx(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}$.prototype.writeBigUInt64LE=Ii(function(e,r=0){return Sx(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});$.prototype.writeBigUInt64BE=Ii(function(e,r=0){return Tx(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});$.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let u=Math.pow(2,8*n-1);fr(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};$.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let u=Math.pow(2,8*n-1);fr(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};$.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||fr(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||fr(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||fr(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||fr(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||fr(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};$.prototype.writeBigInt64LE=Ii(function(e,r=0){return Sx(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});$.prototype.writeBigInt64BE=Ii(function(e,r=0){return Tx(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Cx(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 xx(t,e,r,n,i){return e=+e,r=r>>>0,i||Cx(t,e,r,4,34028234663852886e22,-34028234663852886e22),Yo.write(t,e,r,n,23,4),r+4}$.prototype.writeFloatLE=function(e,r,n){return xx(this,e,r,!0,n)};$.prototype.writeFloatBE=function(e,r,n){return xx(this,e,r,!1,n)};function Nx(t,e,r,n,i){return e=+e,r=r>>>0,i||Cx(t,e,r,8,17976931348623157e292,-17976931348623157e292),Yo.write(t,e,r,n,52,8),r+8}$.prototype.writeDoubleLE=function(e,r,n){return Nx(this,e,r,!0,n)};$.prototype.writeDoubleBE=function(e,r,n){return Nx(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);let s;if(typeof e=="number")for(s=r;s2**32?i=Ex(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=Ex(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);function Ex(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 DH(t,e,r){Jo(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&pc(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 Ko.ERR_OUT_OF_RANGE("value",a,t)}DH(n,i,s)}function Jo(t,e){if(typeof t!="number")throw new Ko.ERR_INVALID_ARG_TYPE(e,"number",t)}function pc(t,e,r){throw Math.floor(t)!==t?(Jo(t,r),new Ko.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new Ko.ERR_BUFFER_OUT_OF_BOUNDS:new Ko.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var PH=/[^+/0-9A-Za-z-_]/g;function RH(t){if(t=t.split("=")[0],t=t.trim().replace(PH,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function kw(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 BH(t){let e=[];for(let r=0;r>8,i=r%256,s.push(i),s.push(n);return s}function Dx(t){return Vw.toByteArray(RH(t))}function $h(t,e,r,n){let i;for(i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function gn(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function $w(t){return t!==t}var FH=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 Ii(t){return typeof BigInt>"u"?MH:t}function MH(){throw new Error("BigInt not supported")}});var Rx=m((Gae,Px)=>{c();Px.exports=zw;zw.supported=typeof WebAssembly<"u";function zw(t){if(!zw.supported)return null;var e=t&&t.imports,r=UH("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 UH(t){return typeof atob=="function"?new Uint8Array(atob(t).split("").map(qH)):new(Ps()).Buffer(t,"base64")}function qH(t){return t.charCodeAt(0)}});var Vx=m((Wae,mn)=>{c();var yn=qw(),Ke=Rx()(),$n=64,zh=[];mn.exports=Rr;var Bx=mn.exports.BYTES_MIN=16,Lx=mn.exports.BYTES_MAX=64,jae=mn.exports.BYTES=32,Fx=mn.exports.KEYBYTES_MIN=16,Mx=mn.exports.KEYBYTES_MAX=64,Qae=mn.exports.KEYBYTES=32,Ux=mn.exports.SALTBYTES=16,qx=mn.exports.PERSONALBYTES=16;function Rr(t,e,r,n,i){if(!(this instanceof Rr))return new Rr(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&&(yn(t>=Bx,"digestLength must be at least "+Bx+", was given "+t),yn(t<=Lx,"digestLength must be at most "+Lx+", was given "+t),e!=null&&yn(e.length>=Fx,"key must be at least "+Fx+", was given "+e.length),e!=null&&yn(e.length<=Mx,"key must be at least "+Mx+", was given "+e.length),r!=null&&yn(r.length===Ux,"salt must be exactly "+Ux+", was given "+r.length),n!=null&&yn(n.length===qx,"personal must be exactly "+qx+", was given "+n.length)),zh.length||(zh.push($n),$n+=216),this.digestLength=t,this.finalized=!1,this.pointer=zh.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,$n,$n+e.length),Ke.memory[this.pointer+200]=128)}Rr.prototype.update=function(t){return yn(this.finalized===!1,"Hash instance finalized"),yn(t,"input must be TypedArray or Buffer"),$n+t.length>Ke.memory.length&&Ke.realloc($n+t.length),Ke.memory.set(t,$n),Ke.exports.blake2b_update(this.pointer,$n,$n+t.length),this};Rr.prototype.digest=function(t){if(yn(this.finalized===!1,"Hash instance finalized"),this.finalized=!0,zh.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 HH(Ke.memory,this.pointer+128,this.digestLength);yn(t.length>=this.digestLength,"input must be TypedArray or Buffer");for(var e=0;e{c();var Ci=qw(),yc=Vx();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 Hx(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 zx(t,e){return t[e]^t[e+1]<<8^t[e+2]<<16^t[e+3]<<24}function Si(t,e,r,n,i,s){var o=gc[i],a=gc[i+1],u=gc[s],l=gc[s+1];Kh(Ce,t,e),Hx(Ce,t,o,a);var f=Ce[n]^Ce[t],d=Ce[n+1]^Ce[t+1];Ce[n]=d,Ce[n+1]=f,Kh(Ce,r,n),f=Ce[e]^Ce[r],d=Ce[e+1]^Ce[r+1],Ce[e]=f>>>24^d<<8,Ce[e+1]=d>>>24^f<<8,Kh(Ce,t,e),Hx(Ce,t,u,l),f=Ce[n]^Ce[t],d=Ce[n+1]^Ce[t+1],Ce[n]=f>>>16^d<<16,Ce[n+1]=d>>>16^f<<16,Kh(Ce,r,n),f=Ce[e]^Ce[r],d=Ce[e+1]^Ce[r+1],Ce[e]=d>>>31^f<<1,Ce[e+1]=f>>>31^d<<1}var Kx=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),kH=[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(kH.map(function(t){return t*2})),Ce=new Uint32Array(32),gc=new Uint32Array(32);function Yx(t,e){var r=0;for(r=0;r<16;r++)Ce[r]=t.h[r],Ce[r+16]=Kx[r];for(Ce[24]=Ce[24]^t.t,Ce[25]=Ce[25]^t.t/4294967296,e&&(Ce[28]=~Ce[28],Ce[29]=~Ce[29]),r=0;r<32;r++)gc[r]=zx(t.b,4*r);for(r=0;r<12;r++)Si(0,8,16,24,Kt[r*16+0],Kt[r*16+1]),Si(2,10,18,26,Kt[r*16+2],Kt[r*16+3]),Si(4,12,20,28,Kt[r*16+4],Kt[r*16+5]),Si(6,14,22,30,Kt[r*16+6],Kt[r*16+7]),Si(0,10,20,30,Kt[r*16+8],Kt[r*16+9]),Si(2,12,22,24,Kt[r*16+10],Kt[r*16+11]),Si(4,14,16,26,Kt[r*16+12],Kt[r*16+13]),Si(6,8,18,28,Kt[r*16+14],Kt[r*16+15]);for(r=0;r<16;r++)t.h[r]=t.h[r]^Ce[r]^Ce[r+16]}var Ti=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){Ti.fill(0),this.b=new Uint8Array(128),this.h=new Uint32Array(16),this.t=0,this.c=0,this.outlen=t,Ti[0]=t,e&&(Ti[1]=e.length),Ti[2]=1,Ti[3]=1,r&&Ti.set(r,32),n&&Ti.set(n,48);for(var i=0;i<16;i++)this.h[i]=Kx[i]^zx(Ti,i*4);e&&(Jx(this,e),this.c=128)}Zo.prototype.update=function(t){return Ci(t!=null,"input must be Uint8Array or Buffer"),Jx(this,t),this};Zo.prototype.digest=function(t){var e=!t||t==="binary"||t==="hex"?new Uint8Array(this.outlen):t;return Ci(e.length>=this.outlen,"out must have at least outlen bytes of space"),jH(this,e),t==="hex"?QH(e):e};Zo.prototype.final=Zo.prototype.digest;Zo.ready=function(t){yc.ready(function(){t()})};function Jx(t,e){for(var r=0;r>2]>>8*(r&3);return e}function QH(t){for(var e="",r=0;r=Gx,"outlen must be at least "+Gx+", was given "+e),Ci(e<=kx,"outlen must be at most "+kx+", was given "+e),r!=null&&Ci(r.length>=jx,"key must be at least "+jx+", was given "+r.length),r!=null&&Ci(r.length<=Qx,"key must be at most "+Qx+", was given "+r.length),n!=null&&Ci(n.length===Wx,"salt must be exactly "+Wx+", was given "+n.length),i!=null&&Ci(i.length===$x,"personal must be exactly "+$x+", was given "+i.length)),new Xx(e,r,n,i)};hr.exports.ready=function(t){yc.ready(function(){t()})};hr.exports.WASM_SUPPORTED=yc.SUPPORTED;hr.exports.WASM_LOADED=!1;var Gx=hr.exports.BYTES_MIN=16,kx=hr.exports.BYTES_MAX=64,zae=hr.exports.BYTES=32,jx=hr.exports.KEYBYTES_MIN=16,Qx=hr.exports.KEYBYTES_MAX=64,Kae=hr.exports.KEYBYTES=32,Wx=hr.exports.SALTBYTES=16,$x=hr.exports.PERSONALBYTES=16;yc.ready(function(t){t||(hr.exports.WASM_LOADED=!0,Xx=yc)})});var wn=m(Br=>{"use strict";c();var $H=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]}),zH=Br&&Br.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),KH=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)&&$H(e,t,r);return zH(e,t),e};Object.defineProperty(Br,"__esModule",{value:!0});Br.TransactionHash=Br.Transaction=void 0;var ea=Gt(),mc=ht(),YH=Uh(),JH=bs(),XH=KH(Be()),ZH=lC(),zn=cc(),eG=hx(),eN=jh(),tN=jn(),tG=wr(),rG=Zx(),nG=32,Kw=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:w}){this.nonce=e||0,this.value=r?new ea.BigNumber(r.toString()).toFixed(0):0,this.sender=n,this.receiver=i,this.senderUsername=s||"",this.receiverUsername=o||"",this.gasPrice=a||JH.TRANSACTION_MIN_GAS_PRICE,this.gasLimit=u,this.data=l||new tN.TransactionPayload,this.chainID=f,this.version=d?new zn.TransactionVersion(d.valueOf()):zn.TransactionVersion.withDefaultVersion(),this.options=g?new zn.TransactionOptions(g.valueOf()):zn.TransactionOptions.withDefaultOptions(),this.guardian=w||mc.Address.empty(),this.signature=h.Buffer.from([]),this.guardianSignature=h.Buffer.from([]),this.hash=ta.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 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 tG.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 YH.Compatibility.guardAddressIsSetAndNonZero(new mc.Address(r.sender),"'sender' of transaction","pass the actual sender to the Transaction constructor"),r}static fromPlainObject(e){let r=new t({nonce:Number(e.nonce),value:new ea.BigNumber(e.value).toFixed(0),receiver:mc.Address.fromString(e.receiver),receiverUsername:e.receiverUsername?h.Buffer.from(e.receiverUsername,"base64").toString():void 0,sender:mc.Address.fromString(e.sender),senderUsername:e.senderUsername?h.Buffer.from(e.senderUsername,"base64").toString():void 0,guardian:e.guardian?mc.Address.fromString(e.guardian):void 0,gasPrice:Number(e.gasPrice),gasLimit:Number(e.gasLimit),data:new tN.TransactionPayload(h.Buffer.from(e.data||"","base64")),chainID:String(e.chainID),version:new zn.TransactionVersion(e.version),options:e.options!=null?new zn.TransactionOptions(e.options):void 0});return e.signature&&r.applySignature(new eN.Signature(e.signature)),e.guardianSignature&&r.applyGuardianSignature(new eN.Signature(e.guardianSignature)),r}applySignature(e){this.signature=this.interpretSignatureAsBuffer(e),this.hash=ta.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=ta.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 XH.ErrNotEnoughGas(this.gasLimit.valueOf());let n=new ea.BigNumber(this.gasPrice.valueOf()),i=new ea.BigNumber(r).multipliedBy(n);if(r===this.gasLimit.valueOf())return i;let s=new ea.BigNumber(this.gasLimit.valueOf()-r),o=n.multipliedBy(new ea.BigNumber(e.GasPriceModifier.valueOf())),a=s.multipliedBy(o);return i.plus(a)}};Br.Transaction=Kw;var ta=class t extends ZH.Hash{constructor(e){super(e)}static compute(e){let n=new eG.ProtoSerializer().serializeTransaction(e),i=rG(nG).update(n).digest("hex");return new t(i)}};Br.TransactionHash=ta});var Zw=m(Jh=>{"use strict";c();Object.defineProperty(Jh,"__esModule",{value:!0});Jh.TransferTransactionsFactory=void 0;var Yw=Wo(),$r=St(),Yh=wn(),Jw=jn(),Xw=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 Yh.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 Yw.ArgSerializer().valuesToString([$r.BytesValue.fromUTF8(e.tokenTransfer.tokenIdentifier),new $r.BigUIntValue(e.tokenTransfer.valueOf())]),n=`ESDTTransfer@${r}`,i=new Jw.TransactionPayload(n),s=i.length()||0,o=this.gasEstimator.forESDTTransfer(s);return new Yh.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 Yw.ArgSerializer().valuesToString([$r.BytesValue.fromUTF8(e.tokenTransfer.tokenIdentifier),new $r.U64Value(e.tokenTransfer.nonce),new $r.BigUIntValue(e.tokenTransfer.valueOf()),new $r.AddressValue(e.destination)]),n=`ESDTNFTTransfer@${r}`,i=new Jw.TransactionPayload(n),s=i.length()||0,o=this.gasEstimator.forESDTNFTTransfer(s);return new Yh.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 $r.AddressValue(e.destination),new $r.U16Value(e.tokenTransfers.length)];for(let u of e.tokenTransfers)r.push($r.BytesValue.fromUTF8(u.tokenIdentifier),new $r.U64Value(u.nonce),new $r.BigUIntValue(u.valueOf()));let{argumentsString:n}=new Yw.ArgSerializer().valuesToString(r),i=`MultiESDTNFTTransfer@${n}`,s=new Jw.TransactionPayload(i),o=s.length()||0,a=this.gasEstimator.forMultiESDTNFTTransfer(o,e.tokenTransfers.length);return new Yh.Transaction({nonce:e.nonce,receiver:e.sender,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||a,data:s,chainID:e.chainID})}};Jh.TransferTransactionsFactory=Xw});var tE=m(Rs=>{"use strict";c();Object.defineProperty(Rs,"__esModule",{value:!0});Rs.GasEstimator=Rs.DefaultGasConfiguration=void 0;Rs.DefaultGasConfiguration={minGasLimit:5e4,gasPerDataByte:1500,gasCostESDTTransfer:2e5,gasCostESDTNFTTransfer:2e5,gasCostESDTNFTMultiTransfer:2e5};var iG=1e5,rN=8e5,eE=class{constructor(e){this.gasConfiguration=e||Rs.DefaultGasConfiguration}forEGLDTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasPerDataByte*e}forESDTTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasCostESDTTransfer+this.gasConfiguration.gasPerDataByte*e+iG}forESDTNFTTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasCostESDTNFTTransfer+this.gasConfiguration.gasPerDataByte*e+rN}forMultiESDTNFTTransfer(e,r){return this.gasConfiguration.minGasLimit+(this.gasConfiguration.gasCostESDTNFTMultiTransfer+rN)*r+this.gasConfiguration.gasPerDataByte*e}};Rs.GasEstimator=eE});var ra=m(Xh=>{"use strict";c();Object.defineProperty(Xh,"__esModule",{value:!0});Xh.Account=void 0;var sG=ht(),rE=class{constructor(e){this.address=new sG.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()}}};Xh.Account=rE});var na=m(Ls=>{"use strict";c();Object.defineProperty(Ls,"__esModule",{value:!0});Ls.Logger=Ls.LogLevel=void 0;var Bs;(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"})(Bs=Ls.LogLevel||(Ls.LogLevel={}));var Zh=class t{static setLevel(e){t.logLevel=e}static trace(e,...r){t.logLevel>=Bs.Debug||console.debug(e,r)}static debug(e,...r){t.logLevel>=Bs.Debug||console.debug(e,r)}static info(e,...r){t.logLevel>=Bs.Info||console.log(e,r)}static warn(e,...r){t.logLevel>=Bs.Warn||console.warn(e,r)}static error(e,...r){t.logLevel>=Bs.Error||console.error(e,r)}};Ls.Logger=Zh;Zh.logLevel=Bs.Debug});var sE=m(En=>{"use strict";c();var oG=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]}),aG=En&&En.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uG=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)&&oG(e,t,r);return aG(e,t),e};Object.defineProperty(En,"__esModule",{value:!0});En.AsyncTimer=void 0;var cG=uG(Be()),lG=Be(),nE=na(),iE=class{constructor(e){this.timeoutHandle=null,this.rejectionFunc=null,this.name=e,this.correlationTag=0}start(e){if(this.timeoutHandle)throw new cG.ErrAsyncTimerAlreadyRunning;return this.correlationTag++,nE.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(){nE.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].abort()`),this.rejectionFunc&&(this.rejectionFunc(new lG.ErrAsyncTimerAborted),this.rejectionFunc=null),this.stop()}stop(){this.isStopped()||(nE.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].stop()`),this.timeoutHandle&&(clearTimeout(this.timeoutHandle),this.timeoutHandle=null))}isStopped(){return!this.timeoutHandle}};En.AsyncTimer=iE});var ed=m(ia=>{"use strict";c();var Lr=ia&&ia.__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(ia,"__esModule",{value:!0});ia.TransactionWatcher=void 0;var oE=sE(),xi=Be(),nN=na(),Ni=class t{constructor(e,r={}){this.fetcher=new aE(e),this.pollingIntervalMilliseconds=r.pollingIntervalMilliseconds||t.DefaultPollingInterval,this.timeoutMilliseconds=r.timeoutMilliseconds||t.DefaultTimeout,this.patienceMilliseconds=r.patienceMilliseconds||t.DefaultPatience}awaitPending(e){return Lr(this,void 0,void 0,function*(){let r=s=>s.status.isPending(),n=()=>Lr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),i=()=>new xi.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)})}awaitCompleted(e){return Lr(this,void 0,void 0,function*(){let r=s=>{if(s.isCompleted===void 0)throw new xi.ErrIsCompletedFieldIsMissingOnTransaction;return s.isCompleted},n=()=>Lr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),i=()=>new xi.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)})}awaitAllEvents(e,r){return Lr(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=()=>Lr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),s=()=>new xi.ErrExpectedTransactionEventsNotFound;return this.awaitConditionally(n,i,s)})}awaitAnyEvent(e,r){return Lr(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=()=>Lr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),s=()=>new xi.ErrExpectedTransactionEventsNotFound;return this.awaitConditionally(n,i,s)})}awaitOnCondition(e,r){return Lr(this,void 0,void 0,function*(){let n=()=>Lr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),i=()=>new xi.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)})}awaitConditionally(e,r,n){return Lr(this,void 0,void 0,function*(){let i=new oE.AsyncTimer("watcher:periodic"),s=new oE.AsyncTimer("watcher:patience"),o=new oE.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(nN.Logger.debug("TransactionWatcher.awaitConditionally(): cannot (yet) fetch data."),f instanceof xi.ErrIsCompletedFieldIsMissingOnTransaction||!(f instanceof xi.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}};ia.TransactionWatcher=Ni;Ni.DefaultPollingInterval=6e3;Ni.DefaultTimeout=Ni.DefaultPollingInterval*15;Ni.DefaultPatience=0;Ni.NoopOnStatusReceived=t=>{};var aE=class{constructor(e){this.fetcher=e}getTransaction(e){return Lr(this,void 0,void 0,function*(){return nN.Logger.debug(`transactionWatcher, getTransaction(${e})`),yield this.fetcher.getTransaction(e)})}}});var cE=m(nd=>{"use strict";c();Object.defineProperty(nd,"__esModule",{value:!0});nd.CodeMetadata=void 0;var uE=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|=td.Upgradeable),this.readable&&(e|=td.Readable),this.payable&&(r|=rd.Payable),this.payableBySc&&(r|=rd.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}};nd.CodeMetadata=uE;var td;(function(t){t[t.Upgradeable=1]="Upgradeable",t[t.Reserved2=2]="Reserved2",t[t.Readable=4]="Readable"})(td||(td={}));var rd;(function(t){t[t.Reserved1=1]="Reserved1",t[t.Payable=2]="Payable",t[t.PayableBySc=4]="PayableBySc"})(rd||(rd={}))});var wc=m(vn=>{"use strict";c();var fG=vn&&vn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),hG=vn&&vn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dG=vn&&vn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&fG(e,t,r);return hG(e,t),e};Object.defineProperty(vn,"__esModule",{value:!0});vn.ContractFunction=void 0;var pG=dG(Be()),lE=class t{constructor(e){if(this.name=e,e==null)throw new pG.ErrInvalidFunctionName}static none(){return new t("untitled")}toString(){return this.name}valueOf(){return this.name}};vn.ContractFunction=lE});var dE=m(Fr=>{"use strict";c();var gG=Fr&&Fr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yG=Fr&&Fr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mG=Fr&&Fr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&gG(e,t,r);return yG(e,t),e},wG=Fr&&Fr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Fr,"__esModule",{value:!0});Fr.InteractionChecker=void 0;var fE=mG(Be()),EG=wG(Gt()),hE=class{checkInteraction(e,r){this.checkPayable(e,r),this.checkArguments(e,r)}checkPayable(e,r){let n=!new EG.default(e.getValue().toString()).isZero(),i=r.modifiers.isPayableInEGLD();if(n&&!i)throw new fE.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 fE.ErrContractInteraction(`bad arguments, expected: ${s}, got: ${o}`);for(let a=0;a{"use strict";c();Object.defineProperty(id,"__esModule",{value:!0});id.Query=void 0;var vG=ht(),AG=Wo(),pE=class{constructor(e){this.caller=e.caller||new vG.Address,this.address=e.address,this.func=e.func,this.args=e.args||[],this.value=e.value||0}getEncodedArguments(){return new AG.ArgSerializer().valuesToStrings(this.args)}};id.Query=pE});var wE=m(sd=>{"use strict";c();Object.defineProperty(sd,"__esModule",{value:!0});sd.Interaction=void 0;var iN=ht(),bG=Uh(),gE=bs(),yE=wc(),_G=dE(),IG=Ec(),sa=St(),mE=class{constructor(e,r,n){this.nonce=0,this.value="0",this.gasLimit=0,this.gasPrice=void 0,this.chainID="",this.querent=new iN.Address,this.sender=new iN.Address,this.isWithSingleESDTTransfer=!1,this.isWithSingleESDTNFTTransfer=!1,this.isWithMultiESDTNFTTransfer=!1,this.contract=e,this.function=r,this.args=n,this.tokenTransfers=new oa([],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(){bG.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 yE.ContractFunction(gE.ESDT_TRANSFER_FUNCTION_NAME),n=this.tokenTransfers.buildArgsForSingleESDTTransfer()):this.isWithSingleESDTNFTTransfer?(e=this.sender,r=new yE.ContractFunction(gE.ESDTNFT_TRANSFER_FUNCTION_NAME),n=this.tokenTransfers.buildArgsForSingleESDTNFTTransfer()):this.isWithMultiESDTNFTTransfer&&(e=this.sender,r=new yE.ContractFunction(gE.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 IG.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 oa([e],this),this}withSingleESDTNFTTransfer(e,r){return this.isWithSingleESDTNFTTransfer=!0,this.tokenTransfers=new oa([e],this),r&&(this.sender=r),this}withMultiESDTNFTTransfer(e,r){return this.isWithMultiESDTNFTTransfer=!0,this.tokenTransfers=new oa(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 _G.InteractionChecker().checkInteraction(this,this.getEndpoint()),this}};sd.Interaction=mE;var oa=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 sa.U8Value(this.transfers.length)}getTypedTokenIdentifier(e){return sa.BytesValue.fromUTF8(e.tokenIdentifier)}getTypedTokenNonce(e){return new sa.U64Value(e.nonce)}getTypedTokenQuantity(e){return new sa.BigUIntValue(e.amountAsBigInteger)}getTypedTokensReceiver(){return new sa.AddressValue(this.interaction.getContractAddress())}getTypedInteractionFunction(){return sa.BytesValue.fromUTF8(this.interaction.getFunction().valueOf())}getInteractionArguments(){return this.interaction.getArguments()}}});var sN=m(od=>{"use strict";c();Object.defineProperty(od,"__esModule",{value:!0});od.ArgumentErrorContext=void 0;var SG=Be(),EE=class{constructor(e,r,n){this.endpointName=e,this.argumentIndex=r,this.parameterDefinition=n}throwError(e){throw new SG.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)})`)}};od.ArgumentErrorContext=EE});var AE=m(Fs=>{"use strict";c();var TG=Fs&&Fs.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Fs,"__esModule",{value:!0});Fs.NativeSerializer=void 0;var CG=TG(Gt()),xG=ht(),vE=Be(),NG=ph(),OG=sN(),ve=St(),DG;(function(t){function e(A,I){A=A||[],r(A,I),n(I)&&(A=i(A,I));let N=I.input,_=[];for(let S=0;S0&&I[0].type.getCardinality().isComposite()&&(_=1/0,S=!0);for(let R of I){if(R.type.getCardinality().isSingular())break;N-=1}return{min:N,max:_,variadic:S}}function o(A,I,N){if(A&&A.belongsToTypesystem)return A;if(I instanceof ve.OptionType)return a(A,I,N);if(I instanceof ve.OptionalType)return u(A,I,N);if(I instanceof ve.VariadicType)return l(A,I,N);if(I instanceof ve.CompositeType)return d(A,I,N);if(I instanceof ve.TupleType)return g(A,I,N);if(I instanceof ve.StructType)return w(A,I,N);if(I instanceof ve.ListType)return f(A,I,N);if(I instanceof ve.PrimitiveType)return E(A,I,N);if(I instanceof ve.EnumType)return T(A,I,N);N.throwError(`convertToTypedValue: unhandled type ${I}`)}function a(A,I,N){if(A==null)return ve.OptionValue.newMissing();let _=o(A,I.getFirstTypeParameter(),N);return ve.OptionValue.newProvided(_)}function u(A,I,N){if(A==null)return new ve.OptionalValue(I);let _=o(A,I.getFirstTypeParameter(),N);return new ve.OptionalValue(I,_)}function l(A,I,N){if(I.isCounted)throw new vE.ErrInvalidArgument('Counted variadic arguments must be explicitly typed. E.g. use "VariadicValue.fromItemsCounted()" or "new VariadicValue()"');A==null&&(A=[]),A.map===void 0&&N.convertError(A,"Variadic");let _=A.map(function(S){return o(S,I.getFirstTypeParameter(),N)});return new ve.VariadicValue(I,_)}function f(A,I,N){A.map===void 0&&N.convertError(A,"List");let _=A.map(function(S){return o(S,I.getFirstTypeParameter(),N)});return new ve.List(I,_)}function d(A,I,N){let _=[],S=I.getTypeParameters();N.guardSameLength(A,S);for(let R=0;R{"use strict";c();Object.defineProperty(zr,"__esModule",{value:!0});zr.ContractCallPayloadBuilder=zr.ContractUpgradePayloadBuilder=zr.ContractDeployPayloadBuilder=zr.ArwenVirtualMachine=void 0;var SE=jn(),TE=wr(),PG=Wo();zr.ArwenVirtualMachine="0500";var bE=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(){TE.guardValueIsSet("code",this.code);let e=this.code.toString(),r=this.codeMetadata.toString(),n=`${e}@${zr.ArwenVirtualMachine}@${r}`;return n=CE(n,this.arguments),new SE.TransactionPayload(n)}};zr.ContractDeployPayloadBuilder=bE;var _E=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(){TE.guardValueIsSet("code",this.code);let e=this.code.toString(),r=this.codeMetadata.toString(),n=`upgradeContract@${e}@${r}`;return n=CE(n,this.arguments),new SE.TransactionPayload(n)}};zr.ContractUpgradePayloadBuilder=_E;var IE=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(){TE.guardValueIsSet("calledFunction",this.contractFunction);let e=this.contractFunction.toString();return e=CE(e,this.arguments),new SE.TransactionPayload(e)}};zr.ContractCallPayloadBuilder=IE;function CE(t,e){let{argumentsString:r,count:n}=new PG.ArgSerializer().valuesToString(e);return n==0?t:`${t}@${r}`}});var Kn=m((xue,NE)=>{"use strict";c();var aa=typeof Reflect=="object"?Reflect:null,oN=aa&&typeof aa.apply=="function"?aa.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},ad;aa&&typeof aa.ownKeys=="function"?ad=aa.ownKeys:Object.getOwnPropertySymbols?ad=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:ad=function(e){return Object.getOwnPropertyNames(e)};function RG(t){console&&console.warn&&console.warn(t)}var uN=Number.isNaN||function(e){return e!==e};function ke(){ke.init.call(this)}NE.exports=ke;NE.exports.once=MG;ke.EventEmitter=ke;ke.prototype._events=void 0;ke.prototype._eventsCount=0;ke.prototype._maxListeners=void 0;var aN=10;function ud(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 aN},set:function(t){if(typeof t!="number"||t<0||uN(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");aN=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||uN(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 cN(t){return t._maxListeners===void 0?ke.defaultMaxListeners:t._maxListeners}ke.prototype.getMaxListeners=function(){return cN(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")oN(u,this,r);else for(var l=u.length,f=pN(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,RG(a)}return t}ke.prototype.addListener=function(e,r){return lN(this,e,r,!1)};ke.prototype.on=ke.prototype.addListener;ke.prototype.prependListener=function(e,r){return lN(this,e,r,!0)};function BG(){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 fN(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=BG.bind(n);return i.listener=r,n.wrapFn=i,i}ke.prototype.once=function(e,r){return ud(r),this.on(e,fN(this,e,r)),this};ke.prototype.prependOnceListener=function(e,r){return ud(r),this.prependListener(e,fN(this,e,r)),this};ke.prototype.removeListener=function(e,r){var n,i,s,o,a;if(ud(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():LG(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};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 hN(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?FG(i):pN(i,i.length)}ke.prototype.listeners=function(e){return hN(this,e,!0)};ke.prototype.rawListeners=function(e){return hN(this,e,!1)};ke.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):dN.call(t,e)};ke.prototype.listenerCount=dN;function dN(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?ad(this._events):[]};function pN(t,e){for(var r=new Array(e),n=0;n{c();yN.exports=Kn().EventEmitter});var DE=m(()=>{c()});var bN=m((Lue,AN)=>{"use strict";c();function mN(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function wN(t){for(var e=1;e0?this.tail.next=n:this.head=n,this.tail=n,++this.length}},{key:"unshift",value:function(r){var n={data:r,next:this.head};this.length===0&&(this.tail=n),this.head=n,++this.length}},{key:"shift",value:function(){if(this.length!==0){var r=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,r}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(r){if(this.length===0)return"";for(var n=this.head,i=""+n.data;n=n.next;)i+=r+n.data;return i}},{key:"concat",value:function(r){if(this.length===0)return cd.alloc(0);for(var n=cd.allocUnsafe(r>>>0),i=this.head,s=0;i;)WG(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=cd.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:QG,value:function(r,n){return PE(this,wN(wN({},n),{},{depth:0,customInspect:!1}))}}]),t}()});var BE=m((Mue,IN)=>{"use strict";c();function $G(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(RE,this,t)):p.default.nextTick(RE,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(ld,r):(r._writableState.errorEmitted=!0,p.default.nextTick(_N,r,s)):p.default.nextTick(_N,r,s):e?(p.default.nextTick(ld,r),e(s)):p.default.nextTick(ld,r)}),this)}function _N(t,e){RE(t,e),ld(t)}function ld(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function zG(){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 RE(t,e){t.emit("error",e)}function KG(t,e){var r=t._readableState,n=t._writableState;r&&r.autoDestroy||n&&n.autoDestroy?t.destroy(e):t.emit("error",e)}IN.exports={destroy:$G,undestroy:zG,errorOrDestroy:KG}});var Ms=m((que,CN)=>{"use strict";c();function YG(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var TN={};function Mr(t,e,r){r||(r=Error);function n(s,o,a){return typeof e=="string"?e:e(s,o,a)}var i=function(s){YG(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,TN[t]=i}function SN(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 JG(t,e,r){return t.substr(!r||r<0?0:+r,e.length)===e}function XG(t,e,r){return(r===void 0||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}function ZG(t,e,r){return typeof r!="number"&&(r=0),r+e.length>t.length?!1:t.indexOf(e,r)!==-1}Mr("ERR_INVALID_OPT_VALUE",function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'},TypeError);Mr("ERR_INVALID_ARG_TYPE",function(t,e,r){var n;typeof e=="string"&&JG(e,"not ")?(n="must not be",e=e.replace(/^not /,"")):n="must be";var i;if(XG(t," argument"))i="The ".concat(t," ").concat(n," ").concat(SN(e,"type"));else{var s=ZG(t,".")?"property":"argument";i='The "'.concat(t,'" ').concat(s," ").concat(n," ").concat(SN(e,"type"))}return i+=". Received type ".concat(typeof r),i},TypeError);Mr("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");Mr("ERR_METHOD_NOT_IMPLEMENTED",function(t){return"The "+t+" method is not implemented"});Mr("ERR_STREAM_PREMATURE_CLOSE","Premature close");Mr("ERR_STREAM_DESTROYED",function(t){return"Cannot call "+t+" after a stream was destroyed"});Mr("ERR_MULTIPLE_CALLBACK","Callback called multiple times");Mr("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");Mr("ERR_STREAM_WRITE_AFTER_END","write after end");Mr("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Mr("ERR_UNKNOWN_ENCODING",function(t){return"Unknown encoding: "+t},TypeError);Mr("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");CN.exports.codes=TN});var LE=m((Hue,xN)=>{"use strict";c();var ek=Ms().codes.ERR_INVALID_OPT_VALUE;function tk(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function rk(t,e,r,n){var i=tk(e,n,r);if(i!=null){if(!(isFinite(i)&&Math.floor(i)===i)||i<0){var s=n?r:"highWaterMark";throw new ek(s,i)}return Math.floor(i)}return t.objectMode?16:16*1024}xN.exports={getHighWaterMark:rk}});var ua=m((kue,FE)=>{c();typeof Object.create=="function"?FE.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:FE.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 ON=m((Que,NN)=>{c();NN.exports=nk;function nk(t,e){if(ME("noDeprecation"))return t;var r=!1;function n(){if(!r){if(ME("throwDeprecation"))throw new Error(e);ME("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}return n}function ME(t){try{if(!global.localStorage)return!1}catch{return!1}var e=global.localStorage[t];return e==null?!1:String(e).toLowerCase()==="true"}});var VE=m(($ue,FN)=>{"use strict";c();FN.exports=dt;function PN(t){var e=this;this.next=null,this.entry=null,this.finish=function(){Ok(e,t)}}var ca;dt.WritableState=Ac;var ik={deprecate:ON()},RN=OE(),hd=Ps().Buffer,sk=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function ok(t){return hd.from(t)}function ak(t){return hd.isBuffer(t)||t instanceof sk}var qE=BE(),uk=LE(),ck=uk.getHighWaterMark,Oi=Ms().codes,lk=Oi.ERR_INVALID_ARG_TYPE,fk=Oi.ERR_METHOD_NOT_IMPLEMENTED,hk=Oi.ERR_MULTIPLE_CALLBACK,dk=Oi.ERR_STREAM_CANNOT_PIPE,pk=Oi.ERR_STREAM_DESTROYED,gk=Oi.ERR_STREAM_NULL_VALUES,yk=Oi.ERR_STREAM_WRITE_AFTER_END,mk=Oi.ERR_UNKNOWN_ENCODING,la=qE.errorOrDestroy;ua()(dt,RN);function wk(){}function Ac(t,e,r){ca=ca||Us(),t=t||{},typeof r!="boolean"&&(r=e instanceof ca),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=ck(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){Sk(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 PN(this)}Ac.prototype.getBuffer=function(){for(var e=this.bufferedRequest,r=[];e;)r.push(e),e=e.next;return r};(function(){try{Object.defineProperty(Ac.prototype,"buffer",{get:ik.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var fd;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(fd=Function.prototype[Symbol.hasInstance],Object.defineProperty(dt,Symbol.hasInstance,{value:function(e){return fd.call(this,e)?!0:this!==dt?!1:e&&e._writableState instanceof Ac}})):fd=function(e){return e instanceof this};function dt(t){ca=ca||Us();var e=this instanceof ca;if(!e&&!fd.call(dt,this))return new dt(t);this._writableState=new Ac(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)),RN.call(this)}dt.prototype.pipe=function(){la(this,new dk)};function Ek(t,e){var r=new yk;la(t,r),p.default.nextTick(e,r)}function vk(t,e,r,n){var i;return r===null?i=new gk:typeof r!="string"&&!e.objectMode&&(i=new lk("chunk",["string","Buffer"],r)),i?(la(t,i),p.default.nextTick(n,i),!1):!0}dt.prototype.write=function(t,e,r){var n=this._writableState,i=!1,s=!n.objectMode&&ak(t);return s&&!hd.isBuffer(t)&&(t=ok(t)),typeof e=="function"&&(r=e,e=null),s?e="buffer":e||(e=n.defaultEncoding),typeof r!="function"&&(r=wk),n.ending?Ek(this,r):(s||vk(this,n,t,r))&&(n.pendingcb++,i=bk(this,n,s,t,e,r)),i};dt.prototype.cork=function(){this._writableState.corked++};dt.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,!t.writing&&!t.corked&&!t.bufferProcessing&&t.bufferedRequest&&BN(this,t))};dt.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 mk(e);return this._writableState.defaultEncoding=e,this};Object.defineProperty(dt.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function Ak(t,e,r){return!t.objectMode&&t.decodeStrings!==!1&&typeof e=="string"&&(e=hd.from(e,r)),e}Object.defineProperty(dt.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function bk(t,e,r,n,i,s){if(!r){var o=Ak(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 Dk=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};UN.exports=An;var MN=kE(),GE=VE();ua()(An,MN);for(HE=Dk(GE.prototype),dd=0;dd{c();var gd=Ps(),bn=gd.Buffer;function qN(t,e){for(var r in t)e[r]=t[r]}bn.from&&bn.alloc&&bn.allocUnsafe&&bn.allocUnsafeSlow?VN.exports=gd:(qN(gd,jE),jE.Buffer=qs);function qs(t,e,r){return bn(t,e,r)}qs.prototype=Object.create(bn.prototype);qN(bn,qs);qs.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return bn(t,e,r)};qs.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=bn(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};qs.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return bn(t)};qs.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return gd.SlowBuffer(t)}});var $E=m(kN=>{"use strict";c();var WE=HN().Buffer,GN=WE.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 Bk(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 Lk(t){var e=Bk(t);if(typeof e!="string"&&(WE.isEncoding===GN||!GN(t)))throw new Error("Unknown encoding: "+t);return e||t}kN.StringDecoder=bc;function bc(t){this.encoding=Lk(t);var e;switch(this.encoding){case"utf16le":this.text=Hk,this.end=Gk,e=4;break;case"utf8":this.fillLast=Uk,e=4;break;case"base64":this.text=kk,this.end=jk,e=3;break;default:this.write=Qk,this.end=Wk;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=WE.allocUnsafe(e)}bc.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 Fk(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 Mk(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 Uk(t){var e=this.lastTotal-this.lastNeed,r=Mk(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 qk(t,e){var r=Fk(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 Vk(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function Hk(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 Gk(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 kk(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 jk(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function Qk(t){return t.toString(this.encoding)}function Wk(t){return t&&t.length?this.write(t):""}});var yd=m((ece,WN)=>{"use strict";c();var jN=Ms().codes.ERR_STREAM_PREMATURE_CLOSE;function $k(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 md;function Di(t,e,r){return e=Yk(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Yk(t){var e=Jk(t,"string");return typeof e=="symbol"?e:String(e)}function Jk(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 Xk=yd(),Pi=Symbol("lastResolve"),Vs=Symbol("lastReject"),_c=Symbol("error"),wd=Symbol("ended"),Hs=Symbol("lastPromise"),zE=Symbol("handlePromise"),Gs=Symbol("stream");function Ri(t,e){return{value:t,done:e}}function Zk(t){var e=t[Pi];if(e!==null){var r=t[Gs].read();r!==null&&(t[Hs]=null,t[Pi]=null,t[Vs]=null,e(Ri(r,!1)))}}function ej(t){p.default.nextTick(Zk,t)}function tj(t,e){return function(r,n){t.then(function(){if(e[wd]){r(Ri(void 0,!0));return}e[zE](r,n)},n)}}var rj=Object.getPrototypeOf(function(){}),nj=Object.setPrototypeOf((md={get stream(){return this[Gs]},next:function(){var e=this,r=this[_c];if(r!==null)return Promise.reject(r);if(this[wd])return Promise.resolve(Ri(void 0,!0));if(this[Gs].destroyed)return new Promise(function(o,a){p.default.nextTick(function(){e[_c]?a(e[_c]):o(Ri(void 0,!0))})});var n=this[Hs],i;if(n)i=new Promise(tj(n,this));else{var s=this[Gs].read();if(s!==null)return Promise.resolve(Ri(s,!1));i=new Promise(this[zE])}return this[Hs]=i,i}},Di(md,Symbol.asyncIterator,function(){return this}),Di(md,"return",function(){var e=this;return new Promise(function(r,n){e[Gs].destroy(null,function(i){if(i){n(i);return}r(Ri(void 0,!0))})})}),md),rj),ij=function(e){var r,n=Object.create(nj,(r={},Di(r,Gs,{value:e,writable:!0}),Di(r,Pi,{value:null,writable:!0}),Di(r,Vs,{value:null,writable:!0}),Di(r,_c,{value:null,writable:!0}),Di(r,wd,{value:e._readableState.endEmitted,writable:!0}),Di(r,zE,{value:function(s,o){var a=n[Gs].read();a?(n[Hs]=null,n[Pi]=null,n[Vs]=null,s(Ri(a,!1))):(n[Pi]=s,n[Vs]=o)},writable:!0}),r));return n[Hs]=null,Xk(e,function(i){if(i&&i.code!=="ERR_STREAM_PREMATURE_CLOSE"){var s=n[Vs];s!==null&&(n[Hs]=null,n[Pi]=null,n[Vs]=null,s(i)),n[_c]=i;return}var o=n[Pi];o!==null&&(n[Hs]=null,n[Pi]=null,n[Vs]=null,o(Ri(void 0,!0))),n[wd]=!0}),e.on("readable",ej.bind(null,n)),n};$N.exports=ij});var YN=m((ice,KN)=>{c();KN.exports=function(){throw new Error("Readable.from is not available in the browser")}});var kE=m((ace,oO)=>{"use strict";c();oO.exports=Me;var fa;Me.ReadableState=eO;var oce=Kn().EventEmitter,ZN=function(e,r){return e.listeners(r).length},Sc=OE(),Ed=Ps().Buffer,sj=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function oj(t){return Ed.from(t)}function aj(t){return Ed.isBuffer(t)||t instanceof sj}var KE=DE(),xe;KE&&KE.debuglog?xe=KE.debuglog("stream"):xe=function(){};var uj=bN(),rv=BE(),cj=LE(),lj=cj.getHighWaterMark,vd=Ms().codes,fj=vd.ERR_INVALID_ARG_TYPE,hj=vd.ERR_STREAM_PUSH_AFTER_EOF,dj=vd.ERR_METHOD_NOT_IMPLEMENTED,pj=vd.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,ha,YE,JE;ua()(Me,Sc);var Ic=rv.errorOrDestroy,XE=["error","close","destroy","pause","resume"];function gj(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}function eO(t,e,r){fa=fa||Us(),t=t||{},typeof r!="boolean"&&(r=e instanceof fa),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=lj(this,t,"readableHighWaterMark",r),this.buffer=new uj,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&&(ha||(ha=$E().StringDecoder),this.decoder=new ha(t.encoding),this.encoding=t.encoding)}function Me(t){if(fa=fa||Us(),!(this instanceof Me))return new Me(t);var e=this instanceof fa;this._readableState=new eO(t,this,e),this.readable=!0,t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy)),Sc.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=rv.destroy;Me.prototype._undestroy=rv.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=Ed.from(t,e),e=""),n=!0),tO(this,t,e,!1,n)};Me.prototype.unshift=function(t){return tO(this,t,null,!0,!1)};function tO(t,e,r,n,i){xe("readableAddChunk",e);var s=t._readableState;if(e===null)s.reading=!1,wj(t,s);else{var o;if(i||(o=yj(s,e)),o)Ic(t,o);else if(s.objectMode||e&&e.length>0)if(typeof e!="string"&&!s.objectMode&&Object.getPrototypeOf(e)!==Ed.prototype&&(e=oj(e)),n)s.endEmitted?Ic(t,new pj):ZE(t,s,e,!0);else if(s.ended)Ic(t,new hj);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(e=s.decoder.write(e),s.objectMode||e.length!==0?ZE(t,s,e,!1):tv(t,s)):ZE(t,s,e,!1)}else n||(s.reading=!1,tv(t,s))}return!s.ended&&(s.length=JN?t=JN:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}function XN(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=mj(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?ev(this):Ad(this),null;if(t=XN(t,e),t===0&&e.ended)return e.length===0&&ev(this),null;var n=e.needReadable;xe("need readable",n),(e.length===0||e.length-t0?i=iO(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&&ev(this)),i!==null&&this.emit("data",i),i};function wj(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?Ad(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,rO(t)))}}function Ad(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(rO,t))}function rO(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,nv(t)}function tv(t,e){e.readingMore||(e.readingMore=!0,p.default.nextTick(Ej,t,e))}function Ej(t,e){for(;!e.reading&&!e.ended&&(e.length1&&sO(n.pipes,t)!==-1)&&!l&&(xe("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function g(D){xe("onerror",D),T(),t.removeListener("error",g),ZN(t,"error")===0&&Ic(t,D)}gj(t,"error",g);function w(){t.removeListener("finish",E),T()}t.once("close",w);function E(){xe("onfinish"),t.removeListener("close",w),T()}t.once("finish",E);function T(){xe("unpipe"),r.unpipe(t)}return t.emit("pipe",r),n.flowing||(xe("pipe resume"),r.resume()),t};function vj(t){return function(){var r=t._readableState;xe("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,r.awaitDrain===0&&ZN(t,"data")&&(r.flowing=!0,nv(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?Ad(this):n.reading||p.default.nextTick(Aj,this)),r};Me.prototype.addListener=Me.prototype.on;Me.prototype.removeListener=function(t,e){var r=Sc.prototype.removeListener.call(this,t,e);return t==="readable"&&p.default.nextTick(nO,this),r};Me.prototype.removeAllListeners=function(t){var e=Sc.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&p.default.nextTick(nO,this),e};function nO(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 Aj(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,bj(this,t)),t.paused=!1,this};function bj(t,e){e.resumeScheduled||(e.resumeScheduled=!0,p.default.nextTick(_j,t,e))}function _j(t,e){xe("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),nv(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 nv(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 ev(t){var e=t._readableState;xe("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,p.default.nextTick(Ij,e,t))}function Ij(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 JE===void 0&&(JE=YN()),JE(Me,t,e)});function sO(t,e){for(var r=0,n=t.length;r{"use strict";c();uO.exports=Yn;var bd=Ms().codes,Sj=bd.ERR_METHOD_NOT_IMPLEMENTED,Tj=bd.ERR_MULTIPLE_CALLBACK,Cj=bd.ERR_TRANSFORM_ALREADY_TRANSFORMING,xj=bd.ERR_TRANSFORM_WITH_LENGTH_0,_d=Us();ua()(Yn,_d);function Nj(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(n===null)return this.emit("error",new Tj);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();lO.exports=Tc;var cO=iv();ua()(Tc,cO);function Tc(t){if(!(this instanceof Tc))return new Tc(t);cO.call(this,t)}Tc.prototype._transform=function(t,e,r){r(null,t)}});var yO=m((dce,gO)=>{"use strict";c();var sv;function Dj(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}var pO=Ms().codes,Pj=pO.ERR_MISSING_ARGS,Rj=pO.ERR_STREAM_DESTROYED;function hO(t){if(t)throw t}function Bj(t){return t.setHeader&&typeof t.abort=="function"}function Lj(t,e,r,n){n=Dj(n);var i=!1;t.on("close",function(){i=!0}),sv===void 0&&(sv=yd()),sv(t,{readable:e,writable:r},function(o){if(o)return n(o);i=!0,n()});var s=!1;return function(o){if(!i&&!s){if(s=!0,Bj(t))return t.abort();if(typeof t.destroy=="function")return t.destroy();n(o||new Rj("pipe"))}}}function dO(t){t()}function Fj(t,e){return t.pipe(e)}function Mj(t){return!t.length||typeof t[t.length-1]!="function"?hO:t.pop()}function Uj(){for(var t=arguments.length,e=new Array(t),r=0;r0;return Lj(o,u,l,function(f){i||(i=f),f&&s.forEach(dO),!u&&(s.forEach(dO),n(i))})});return e.reduce(Fj)}gO.exports=Uj});var ov=m((Ur,mO)=>{c();Ur=mO.exports=kE();Ur.Stream=Ur;Ur.Readable=Ur;Ur.Writable=VE();Ur.Duplex=Us();Ur.Transform=iv();Ur.PassThrough=fO();Ur.finished=yd();Ur.pipeline=yO()});var vO=m((yce,EO)=>{c();var{Transform:qj}=ov();EO.exports=t=>class wO extends qj{constructor(r,n,i,s,o){super(o),this._rate=r,this._capacity=n,this._delimitedSuffix=i,this._hashBitLength=s,this._options=o,this._state=new t,this._state.initialize(r,n),this._finalized=!1}_transform(r,n,i){let s=null;try{this.update(r,n)}catch(o){s=o}i(s)}_flush(r){let n=null;try{this.push(this.digest())}catch(i){n=i}r(n)}update(r,n){if(!h.Buffer.isBuffer(r)&&typeof r!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");return h.Buffer.isBuffer(r)||(r=h.Buffer.from(r,n)),this._state.absorb(r),this}digest(r){if(this._finalized)throw new Error("Digest already called");this._finalized=!0,this._delimitedSuffix&&this._state.absorbLastFewBits(this._delimitedSuffix);let n=this._state.squeeze(this._hashBitLength/8);return r!==void 0&&(n=n.toString(r)),this._resetState(),n}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){let r=new wO(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}}});var _O=m((wce,bO)=>{c();var{Transform:Vj}=ov();bO.exports=t=>class AO extends Vj{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 AO(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}}});var SO=m((vce,IO)=>{c();var Hj=vO(),Gj=_O();IO.exports=function(t){let e=Hj(t),r=Gj(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 xO=m(CO=>{c();var TO=[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];CO.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),w=d^(s<<1|i>>>31),E=t[0]^g,T=t[1]^w,D=t[10]^g,B=t[11]^w,W=t[20]^g,U=t[21]^w,A=t[30]^g,I=t[31]^w,N=t[40]^g,_=t[41]^w;g=r^(o<<1|a>>>31),w=n^(a<<1|o>>>31);let S=t[2]^g,R=t[3]^w,J=t[12]^g,Q=t[13]^w,V=t[22]^g,k=t[23]^w,K=t[32]^g,pe=t[33]^w,ue=t[42]^g,re=t[43]^w;g=i^(u<<1|l>>>31),w=s^(l<<1|u>>>31);let Y=t[4]^g,se=t[5]^w,te=t[14]^g,ie=t[15]^w,M=t[24]^g,le=t[25]^w,ae=t[34]^g,fe=t[35]^w,oe=t[44]^g,ce=t[45]^w;g=o^(f<<1|d>>>31),w=a^(d<<1|f>>>31);let y=t[6]^g,v=t[7]^w,b=t[16]^g,P=t[17]^w,C=t[26]^g,O=t[27]^w,L=t[36]^g,x=t[37]^w,F=t[46]^g,H=t[47]^w;g=u^(r<<1|n>>>31),w=l^(n<<1|r>>>31);let q=t[8]^g,Z=t[9]^w,we=t[18]^g,Ae=t[19]^w,Re=t[28]^g,tt=t[29]^w,lt=t[38]^g,Oe=t[39]^w,Ue=t[48]^g,Ot=t[49]^w,hi=E,ms=T,ws=B<<4|D>>>28,sr=D<<4|B>>>28,Un=W<<3|U>>>29,$t=U<<3|W>>>29,Dt=I<<9|A>>>23,$e=A<<9|I>>>23,Uy=N<<18|_>>>14,qy=_<<18|N>>>14,Vy=S<<1|R>>>31,Hy=R<<1|S>>>31,Gy=Q<<12|J>>>20,ky=J<<12|Q>>>20,jy=V<<10|k>>>22,Qy=k<<10|V>>>22,Wy=pe<<13|K>>>19,$y=K<<13|pe>>>19,zy=ue<<2|re>>>30,Ky=re<<2|ue>>>30,Yy=se<<30|Y>>>2,Jy=Y<<30|se>>>2,Xy=te<<6|ie>>>26,Zy=ie<<6|te>>>26,e0=le<<11|M>>>21,t0=M<<11|le>>>21,r0=ae<<15|fe>>>17,n0=fe<<15|ae>>>17,i0=ce<<29|oe>>>3,s0=oe<<29|ce>>>3,o0=y<<28|v>>>4,a0=v<<28|y>>>4,u0=P<<23|b>>>9,c0=b<<23|P>>>9,l0=C<<25|O>>>7,f0=O<<25|C>>>7,h0=L<<21|x>>>11,d0=x<<21|L>>>11,p0=H<<24|F>>>8,g0=F<<24|H>>>8,y0=q<<27|Z>>>5,m0=Z<<27|q>>>5,w0=we<<20|Ae>>>12,E0=Ae<<20|we>>>12,v0=tt<<7|Re>>>25,A0=Re<<7|tt>>>25,b0=lt<<8|Oe>>>24,_0=Oe<<8|lt>>>24,I0=Ue<<14|Ot>>>18,S0=Ot<<14|Ue>>>18;t[0]=hi^~Gy&e0,t[1]=ms^~ky&t0,t[10]=o0^~w0&Un,t[11]=a0^~E0&$t,t[20]=Vy^~Xy&l0,t[21]=Hy^~Zy&f0,t[30]=y0^~ws&jy,t[31]=m0^~sr&Qy,t[40]=Yy^~u0&v0,t[41]=Jy^~c0&A0,t[2]=Gy^~e0&h0,t[3]=ky^~t0&d0,t[12]=w0^~Un&Wy,t[13]=E0^~$t&$y,t[22]=Xy^~l0&b0,t[23]=Zy^~f0&_0,t[32]=ws^~jy&r0,t[33]=sr^~Qy&n0,t[42]=u0^~v0&Dt,t[43]=c0^~A0&$e,t[4]=e0^~h0&I0,t[5]=t0^~d0&S0,t[14]=Un^~Wy&i0,t[15]=$t^~$y&s0,t[24]=l0^~b0&Uy,t[25]=f0^~_0&qy,t[34]=jy^~r0&p0,t[35]=Qy^~n0&g0,t[44]=v0^~Dt&zy,t[45]=A0^~$e&Ky,t[6]=h0^~I0&hi,t[7]=d0^~S0&ms,t[16]=Wy^~i0&o0,t[17]=$y^~s0&a0,t[26]=b0^~Uy&Vy,t[27]=_0^~qy&Hy,t[36]=r0^~p0&y0,t[37]=n0^~g0&m0,t[46]=Dt^~zy&Yy,t[47]=$e^~Ky&Jy,t[8]=I0^~hi&Gy,t[9]=S0^~ms&ky,t[18]=i0^~o0&w0,t[19]=s0^~a0&E0,t[28]=Uy^~Vy&Xy,t[29]=qy^~Hy&Zy,t[38]=p0^~y0&ws,t[39]=g0^~m0&sr,t[48]=zy^~Yy&u0,t[49]=Ky^~Jy&c0,t[0]^=TO[e*2],t[1]^=TO[e*2+1]}}});var OO=m((Ice,NO)=>{c();var Id=xO();function da(){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}da.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};da.prototype.absorb=function(t){for(let e=0;e>>8*(this.count%4)&255,this.count+=1,this.count===this.blockSize&&(Id.p1600(this.state),this.count=0);return e};da.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};NO.exports=da});var av=m((Tce,DO)=>{c();DO.exports=SO()(OO())});var fv=m(pa=>{"use strict";c();var kj=pa&&pa.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(pa,"__esModule",{value:!0});pa.SmartContract=void 0;var jj=kj(Gt()),Cc=ht(),uv=Uh(),Qj=Be(),cv=wn(),Wj=wr(),$j=ac(),PO=cE(),RO=wc(),BO=wE(),zj=AE(),Kj=Ec(),Sd=xE(),Yj=av(),lv=class{constructor(e={}){this.address=new Cc.Address,this.methodsExplicit={},this.methods={},this.address=e.address||new Cc.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 RO.ContractFunction(i);return new BO.Interaction(e,o,s||[])},this.methods[i]=function(s){let o=new RO.ContractFunction(i),a=zj.NativeSerializer.nativeToTypedValues(s||[],n);return new BO.Interaction(e,o,a||[])}}}setAddress(e){this.address=e}getAddress(){return this.address}getAbi(){return Wj.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}){uv.Compatibility.guardAddressIsSetAndNonZero(e,"'deployer' of SmartContract.deploy()","pass the actual address to deploy()"),n=n||new PO.CodeMetadata,i=i||[],s=s||0;let l=new Sd.ContractDeployPayloadBuilder().setCode(r).setCodeMetadata(n).setInitArgs(i).build();return new cv.Transaction({receiver:Cc.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}){uv.Compatibility.guardAddressIsSetAndNonZero(e,"'caller' of SmartContract.upgrade()","pass the actual address to upgrade()"),this.ensureHasAddress(),n=n||new PO.CodeMetadata,i=i||[],s=s||0;let l=new Sd.ContractUpgradePayloadBuilder().setCode(r).setCodeMetadata(n).setInitArgs(i).build();return new cv.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}){uv.Compatibility.guardAddressIsSetAndNonZero(u,"'caller' of SmartContract.call()","pass the actual address to call()"),this.ensureHasAddress(),r=r||[],n=n||0;let l=new Sd.ContractCallPayloadBuilder().setFunction(e).setArgs(r).build();return new cv.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 Kj.Query({address:this.getAddress(),func:e,args:r,value:n,caller:i})}ensureHasAddress(){if(!this.getAddress().bech32())throw new Qj.ErrContractHasNoAddress}static computeAddress(e,r){let n=h.Buffer.alloc(8,0),i=new Cc.Address(e.bech32()).pubkey(),s=i.slice(30),o=h.Buffer.alloc(8),a=new jj.default(r.valueOf().toString(10)),u=$j.bigIntToBuffer(a);o.write(u.reverse().toString("hex"),"hex");let l=h.Buffer.concat([i,o]),f=Yj("keccak256").update(l).digest(),d=h.Buffer.from(Sd.ArwenVirtualMachine,"hex"),g=h.Buffer.concat([n,d,f.slice(10,30),s]);return new Cc.Address(g)}};pa.SmartContract=lv});var LO=m(Bi=>{"use strict";c();Object.defineProperty(Bi,"__esModule",{value:!0});Bi.ErrAccountNotConnected=Bi.ErrCannotSignSingleTransaction=Bi.Err=void 0;var xc=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};Bi.Err=xc;var hv=class extends xc{constructor(){super("Cannot sign single transaction.")}};Bi.ErrCannotSignSingleTransaction=hv;var dv=class extends xc{constructor(){super("Account is not connected.")}};Bi.ErrAccountNotConnected=dv});var FO=m(Nc=>{"use strict";c();Object.defineProperty(Nc,"__esModule",{value:!0});Nc.Operation=void 0;var Jj;(function(t){t.Connect="connect",t.Logout="logout",t.SignTransactions="signTransactions",t.SignMessage="signMessage",t.CancelAction="cancelAction"})(Jj=Nc.Operation||(Nc.Operation={}))});var pv=m(ga=>{"use strict";c();var Li=ga&&ga.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{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(ga,"__esModule",{value:!0});ga.ExtensionProvider=void 0;var Xj=wn(),MO=LO(),Oc=FO(),Dc=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 Li(this,void 0,void 0,function*(){return window&&window.elrondWallet&&(this.initialized=!0),this.initialized})}login(e={}){return Li(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(Oc.Operation.Connect,n),this.account.address})}logout(){return Li(this,void 0,void 0,function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");try{yield this.startBgrMsgChannel(Oc.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 Li(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 Li(this,void 0,void 0,function*(){return!!this.account.address})}signTransaction(e){return Li(this,void 0,void 0,function*(){this.ensureConnected();let r=yield this.signTransactions([e]);if(r.length!=1)throw new MO.ErrCannotSignSingleTransaction;return r[0]})}ensureConnected(){if(!this.account.address)throw new MO.ErrAccountNotConnected}signTransactions(e){return Li(this,void 0,void 0,function*(){this.ensureConnected();let r=yield this.startBgrMsgChannel(Oc.Operation.SignTransactions,{from:this.account.address,transactions:e.map(n=>n.toPlainObject())});try{return r.map(i=>Xj.Transaction.fromPlainObject(i))}catch(n){throw new Error(`Transaction canceled: ${n.message}.`)}})}signMessage(e){return Li(this,void 0,void 0,function*(){this.ensureConnected();let r={account:this.account.address,message:e.message.toString()},i=(yield this.startBgrMsgChannel(Oc.Operation.SignMessage,r)).signature,s=h.Buffer.from(i,"hex");return e.applySignature(s),e})}cancelAction(){return this.startBgrMsgChannel(Oc.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)})}};ga.ExtensionProvider=Dc;Dc._instance=new Dc});var Er={};ft(Er,{__assign:()=>yv,__asyncDelegator:()=>fQ,__asyncGenerator:()=>lQ,__asyncValues:()=>hQ,__await:()=>Pc,__awaiter:()=>iQ,__classPrivateFieldGet:()=>yQ,__classPrivateFieldSet:()=>mQ,__createBinding:()=>oQ,__decorate:()=>tQ,__exportStar:()=>aQ,__extends:()=>Zj,__generator:()=>sQ,__importDefault:()=>gQ,__importStar:()=>pQ,__makeTemplateObject:()=>dQ,__metadata:()=>nQ,__param:()=>rQ,__read:()=>GO,__rest:()=>eQ,__spread:()=>uQ,__spreadArrays:()=>cQ,__values:()=>mv});function Zj(t,e){gv(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function eQ(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 rQ(t,e){return function(r,n){e(r,n,t)}}function nQ(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function iQ(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 sQ(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 GO(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 uQ(){for(var t=[],e=0;e1||a(g,w)})})}function a(g,w){try{u(n[g](w))}catch(E){d(s[0][3],E)}}function u(g){g.value instanceof Pc?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,w){g(w),s.shift(),s.length&&a(s[0][0],s[0][1])}}function fQ(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:Pc(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function hQ(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 mv=="function"?mv(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 dQ(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function pQ(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 gQ(t){return t&&t.__esModule?t:{default:t}}function yQ(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function mQ(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 gv,yv,vr=ge(()=>{c();gv=function(t,e){return gv=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])},gv(t,e)};yv=function(){return yv=Object.assign||function(e){for(var r,n=1,i=arguments.length;n{"use strict";c();Object.defineProperty(Nd,"__esModule",{value:!0});function wQ(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}}Nd.safeJsonParse=wQ;function EQ(t){return typeof t=="string"?t:JSON.stringify(t,(e,r)=>typeof r>"u"?null:r)}Nd.safeJsonStringify=EQ});var kO=m(($ce,Od)=>{"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?Od.exports=global.localStorage:typeof window<"u"&&window.localStorage?Od.exports=window.localStorage:Od.exports=new e})()});var jO=m(Dd=>{"use strict";c();Object.defineProperty(Dd,"__esModule",{value:!0});Dd.IKeyValueStorage=void 0;var Ev=class{};Dd.IKeyValueStorage=Ev});var QO=m(Pd=>{"use strict";c();Object.defineProperty(Pd,"__esModule",{value:!0});Pd.parseEntry=void 0;var vQ=wv();function AQ(t){var e;return[t[0],vQ.safeJsonParse((e=t[1])!==null&&e!==void 0?e:"")]}Pd.parseEntry=AQ});var $O=m(Rd=>{"use strict";c();Object.defineProperty(Rd,"__esModule",{value:!0});var WO=(vr(),ct(Er));WO.__exportStar(jO(),Rd);WO.__exportStar(QO(),Rd)});var KO=m(Rc=>{"use strict";c();Object.defineProperty(Rc,"__esModule",{value:!0});Rc.KeyValueStorage=void 0;var ya=(vr(),ct(Er)),zO=wv(),bQ=ya.__importDefault(kO()),_Q=$O(),Bd=class{constructor(){this.localStorage=bQ.default}getKeys(){return ya.__awaiter(this,void 0,void 0,function*(){return Object.keys(this.localStorage)})}getEntries(){return ya.__awaiter(this,void 0,void 0,function*(){return Object.entries(this.localStorage).map(_Q.parseEntry)})}getItem(e){return ya.__awaiter(this,void 0,void 0,function*(){let r=this.localStorage.getItem(e);if(r!==null)return zO.safeJsonParse(r)})}setItem(e,r){return ya.__awaiter(this,void 0,void 0,function*(){this.localStorage.setItem(e,zO.safeJsonStringify(r))})}removeItem(e){return ya.__awaiter(this,void 0,void 0,function*(){this.localStorage.removeItem(e)})}};Rc.KeyValueStorage=Bd;Rc.default=Bd});var YO=m(Ld=>{"use strict";c();Object.defineProperty(Ld,"__esModule",{value:!0});Ld.delay=void 0;function IQ(t){return new Promise(e=>{setTimeout(()=>{e(!0)},t)})}Ld.delay=IQ});var JO=m(ma=>{"use strict";c();Object.defineProperty(ma,"__esModule",{value:!0});ma.ONE_THOUSAND=ma.ONE_HUNDRED=void 0;ma.ONE_HUNDRED=100;ma.ONE_THOUSAND=1e3});var XO=m(de=>{"use strict";c();Object.defineProperty(de,"__esModule",{value:!0});de.ONE_YEAR=de.FOUR_WEEKS=de.THREE_WEEKS=de.TWO_WEEKS=de.ONE_WEEK=de.THIRTY_DAYS=de.SEVEN_DAYS=de.FIVE_DAYS=de.THREE_DAYS=de.ONE_DAY=de.TWENTY_FOUR_HOURS=de.TWELVE_HOURS=de.SIX_HOURS=de.THREE_HOURS=de.ONE_HOUR=de.SIXTY_MINUTES=de.THIRTY_MINUTES=de.TEN_MINUTES=de.FIVE_MINUTES=de.ONE_MINUTE=de.SIXTY_SECONDS=de.THIRTY_SECONDS=de.TEN_SECONDS=de.FIVE_SECONDS=de.ONE_SECOND=void 0;de.ONE_SECOND=1;de.FIVE_SECONDS=5;de.TEN_SECONDS=10;de.THIRTY_SECONDS=30;de.SIXTY_SECONDS=60;de.ONE_MINUTE=de.SIXTY_SECONDS;de.FIVE_MINUTES=de.ONE_MINUTE*5;de.TEN_MINUTES=de.ONE_MINUTE*10;de.THIRTY_MINUTES=de.ONE_MINUTE*30;de.SIXTY_MINUTES=de.ONE_MINUTE*60;de.ONE_HOUR=de.SIXTY_MINUTES;de.THREE_HOURS=de.ONE_HOUR*3;de.SIX_HOURS=de.ONE_HOUR*6;de.TWELVE_HOURS=de.ONE_HOUR*12;de.TWENTY_FOUR_HOURS=de.ONE_HOUR*24;de.ONE_DAY=de.TWENTY_FOUR_HOURS;de.THREE_DAYS=de.ONE_DAY*3;de.FIVE_DAYS=de.ONE_DAY*5;de.SEVEN_DAYS=de.ONE_DAY*7;de.THIRTY_DAYS=de.ONE_DAY*30;de.ONE_WEEK=de.SEVEN_DAYS;de.TWO_WEEKS=de.ONE_WEEK*2;de.THREE_WEEKS=de.ONE_WEEK*3;de.FOUR_WEEKS=de.ONE_WEEK*4;de.ONE_YEAR=de.ONE_DAY*365});var vv=m(Fd=>{"use strict";c();Object.defineProperty(Fd,"__esModule",{value:!0});var ZO=(vr(),ct(Er));ZO.__exportStar(JO(),Fd);ZO.__exportStar(XO(),Fd)});var t2=m(wa=>{"use strict";c();Object.defineProperty(wa,"__esModule",{value:!0});wa.fromMiliseconds=wa.toMiliseconds=void 0;var e2=vv();function SQ(t){return t*e2.ONE_THOUSAND}wa.toMiliseconds=SQ;function TQ(t){return Math.floor(t/e2.ONE_THOUSAND)}wa.fromMiliseconds=TQ});var n2=m(Md=>{"use strict";c();Object.defineProperty(Md,"__esModule",{value:!0});var r2=(vr(),ct(Er));r2.__exportStar(YO(),Md);r2.__exportStar(t2(),Md)});var i2=m(Bc=>{"use strict";c();Object.defineProperty(Bc,"__esModule",{value:!0});Bc.Watch=void 0;var Ud=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}};Bc.Watch=Ud;Bc.default=Ud});var s2=m(qd=>{"use strict";c();Object.defineProperty(qd,"__esModule",{value:!0});qd.IWatch=void 0;var Av=class{};qd.IWatch=Av});var o2=m(bv=>{"use strict";c();Object.defineProperty(bv,"__esModule",{value:!0});var CQ=(vr(),ct(Er));CQ.__exportStar(s2(),bv)});var ks=m(Ea=>{"use strict";c();Object.defineProperty(Ea,"__esModule",{value:!0});var Vd=(vr(),ct(Er));Vd.__exportStar(n2(),Ea);Vd.__exportStar(i2(),Ea);Vd.__exportStar(o2(),Ea);Vd.__exportStar(vv(),Ea)});var _v,a2=ge(()=>{c();_v=class{}});var Iv={};ft(Iv,{IEvents:()=>_v});var Sv=ge(()=>{c();a2()});var u2=m(Hd=>{"use strict";c();Object.defineProperty(Hd,"__esModule",{value:!0});Hd.IHeartBeat=void 0;var xQ=(Sv(),ct(Iv)),Tv=class extends xQ.IEvents{constructor(e){super()}};Hd.IHeartBeat=Tv});var xv=m(Cv=>{"use strict";c();Object.defineProperty(Cv,"__esModule",{value:!0});var NQ=(vr(),ct(Er));NQ.__exportStar(u2(),Cv)});var c2=m(va=>{"use strict";c();Object.defineProperty(va,"__esModule",{value:!0});va.HEARTBEAT_EVENTS=va.HEARTBEAT_INTERVAL=void 0;var OQ=ks();va.HEARTBEAT_INTERVAL=OQ.FIVE_SECONDS;va.HEARTBEAT_EVENTS={pulse:"heartbeat_pulse"}});var Ov=m(Nv=>{"use strict";c();Object.defineProperty(Nv,"__esModule",{value:!0});var DQ=(vr(),ct(Er));DQ.__exportStar(c2(),Nv)});var l2=m(Gd=>{"use strict";c();Object.defineProperty(Gd,"__esModule",{value:!0});Gd.HeartBeat=void 0;var Dv=(vr(),ct(Er)),PQ=Kn(),RQ=ks(),BQ=xv(),Pv=Ov(),Rv=class t extends BQ.IHeartBeat{constructor(e){super(e),this.events=new PQ.EventEmitter,this.interval=Pv.HEARTBEAT_INTERVAL,this.interval=e?.interval||Pv.HEARTBEAT_INTERVAL}static init(e){return Dv.__awaiter(this,void 0,void 0,function*(){let r=new t(e);return yield r.init(),r})}init(){return Dv.__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 Dv.__awaiter(this,void 0,void 0,function*(){this.intervalRef=setInterval(()=>this.pulse(),RQ.toMiliseconds(this.interval))})}pulse(){this.events.emit(Pv.HEARTBEAT_EVENTS.pulse)}};Gd.HeartBeat=Rv});var f2=m(Lc=>{"use strict";c();Object.defineProperty(Lc,"__esModule",{value:!0});var Bv=(vr(),ct(Er));Bv.__exportStar(l2(),Lc);Bv.__exportStar(xv(),Lc);Bv.__exportStar(Ov(),Lc)});var d2=m((qle,h2)=>{"use strict";c();function LQ(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}h2.exports=FQ;function FQ(t,e,r){var n=r&&r.stringify||LQ,i=1;if(typeof t=="object"&&t!==null){var s=e.length+i;if(s===1)return t;var o=new Array(s);o[0]=n(t);for(var a=1;a-1?d:0,t.charCodeAt(w+1)){case 100:case 102:if(f>=u||e[f]==null)break;d=u||e[f]==null)break;d=u||e[f]===void 0)break;d",d=w+2,w++;break}l+=n(e[f]),d=w+2,w++;break;case 115:if(f>=u)break;d{"use strict";c();var p2=d2();m2.exports=_n;var Fc=WQ().console||{},MQ={mapHttpRequest:kd,mapHttpResponse:kd,wrapRequestSerializer:Lv,wrapResponseSerializer:Lv,wrapErrorSerializer:Lv,req:kd,res:kd,err:GQ};function UQ(t,e){return Array.isArray(t)?t.filter(function(n){return n!=="!stdSerializers.err"}):t===!0?Object.keys(e):!1}function _n(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||Fc;t.browser.write&&(t.browser.asObject=!0);let n=t.serializers||{},i=UQ(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=Mc),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:kQ(t)};u.levels=_n.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=Mc,u.serializers=n,u._serialize=i,u._stdErrSerialize=s,u.child=w,e&&(u._logEvent=Fv());function f(){return this.level==="silent"?1/0:this.levels.values[this.level]}function d(){return this._level}function g(E){if(E!=="silent"&&!this.levels.values[E])throw Error("unknown level "+E);this._level=E,Aa(l,u,"error","log"),Aa(l,u,"fatal","error"),Aa(l,u,"warn","error"),Aa(l,u,"info","log"),Aa(l,u,"debug","log"),Aa(l,u,"trace","log")}function w(E,T){if(!E)throw new Error("missing bindings for child Pino");T=T||{},i&&E.serializers&&(T.serializers=E.serializers);let D=T.serializers;if(i&&D){var B=Object.assign({},n,D),W=t.browser.serialize===!0?Object.keys(B):i;delete E.serializers,jd([E],W,B,this._stdErrSerialize)}function U(A){this._childLevel=(A._childLevel|0)+1,this.error=ba(A,E,"error"),this.fatal=ba(A,E,"fatal"),this.warn=ba(A,E,"warn"),this.info=ba(A,E,"info"),this.debug=ba(A,E,"debug"),this.trace=ba(A,E,"trace"),B&&(this.serializers=B,this._serialize=W),e&&(this._logEvent=Fv([].concat(A._logEvent.bindings,E)))}return U.prototype=this,new U(this)}return u}_n.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"}};_n.stdSerializers=MQ;_n.stdTimeFunctions=Object.assign({},{nullTime:g2,epochTime:y2,unixTime:jQ,isoTime:QQ});function Aa(t,e,r,n){let i=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?Mc:i[r]?i[r]:Fc[r]||Fc[n]||Mc,qQ(t,e,r)}function qQ(t,e,r){!t.transmit&&e[r]===Mc||(e[r]=function(n){return function(){let s=t.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Fc?Fc:this;for(var u=0;u-1&&s in r&&(t[i][s]=r[s](t[i][s]))}function ba(t,e,r){return function(){let n=new Array(1+arguments.length);n[0]=e;for(var i=1;i{"use strict";c();Object.defineProperty(_a,"__esModule",{value:!0});_a.PINO_CUSTOM_CONTEXT_KEY=_a.PINO_LOGGER_DEFAULTS=void 0;_a.PINO_LOGGER_DEFAULTS={level:"info"};_a.PINO_CUSTOM_CONTEXT_KEY="custom_context"});var _2=m(dr=>{"use strict";c();Object.defineProperty(dr,"__esModule",{value:!0});dr.generateChildLogger=dr.formatChildLoggerContext=dr.getLoggerContext=dr.setBrowserLoggerContext=dr.getBrowserLoggerContext=dr.getDefaultLoggerOptions=void 0;var Ia=Mv();function $Q(t){return Object.assign(Object.assign({},t),{level:t?.level||Ia.PINO_LOGGER_DEFAULTS.level})}dr.getDefaultLoggerOptions=$Q;function E2(t,e=Ia.PINO_CUSTOM_CONTEXT_KEY){return t[e]||""}dr.getBrowserLoggerContext=E2;function v2(t,e,r=Ia.PINO_CUSTOM_CONTEXT_KEY){return t[r]=e,t}dr.setBrowserLoggerContext=v2;function A2(t,e=Ia.PINO_CUSTOM_CONTEXT_KEY){let r="";return typeof t.bindings>"u"?r=E2(t,e):r=t.bindings().context||"",r}dr.getLoggerContext=A2;function b2(t,e,r=Ia.PINO_CUSTOM_CONTEXT_KEY){let n=A2(t,r);return n.trim()?`${n}/${e}`:e}dr.formatChildLoggerContext=b2;function zQ(t,e,r=Ia.PINO_CUSTOM_CONTEXT_KEY){let n=b2(t,e,r),i=t.child({context:n});return v2(i,n,r)}dr.generateChildLogger=zQ});var qv=m(Sa=>{"use strict";c();Object.defineProperty(Sa,"__esModule",{value:!0});Sa.pino=void 0;var Uv=(vr(),ct(Er)),KQ=Uv.__importDefault(w2());Object.defineProperty(Sa,"pino",{enumerable:!0,get:function(){return KQ.default}});Uv.__exportStar(Mv(),Sa);Uv.__exportStar(_2(),Sa)});var n1=m(Pt=>{"use strict";c();Object.defineProperty(Pt,"__esModule",{value:!0});var Ta=(Sv(),ct(Iv)),I2=Kn();function YQ(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var JQ=YQ(I2),Vv=class extends Ta.IEvents{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},Hv=class{constructor(e,r,n){this.core=e,this.logger=r}},Gv=class extends Ta.IEvents{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}},kv=class{constructor(e,r){this.logger=e,this.core=r}},jv=class extends Ta.IEvents{constructor(e,r){super(),this.relayer=e,this.logger=r}},Qv=class extends Ta.IEvents{constructor(e){super()}},Wv=class{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}},$v=class{constructor(){this.map=new Map}},zv=class extends Ta.IEvents{constructor(e,r){super(),this.relayer=e,this.logger=r}},Kv=class{constructor(e,r){this.core=e,this.logger=r}},Yv=class extends Ta.IEvents{constructor(e,r){super(),this.core=e,this.logger=r}},Jv=class{constructor(e,r){this.logger=e,this.core=r}},Xv=class{constructor(e,r){this.projectId=e,this.logger=r}},Zv=class extends JQ.default{constructor(){super()}},e1=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},t1=class extends I2.EventEmitter{constructor(){super()}},r1=class{constructor(e){this.client=e}};Pt.ICore=Vv,Pt.ICrypto=Hv,Pt.IEngine=r1,Pt.IEngineEvents=t1,Pt.IExpirer=Yv,Pt.IJsonRpcHistory=Gv,Pt.IKeyChain=Kv,Pt.IMessageTracker=kv,Pt.IPairing=Jv,Pt.IPublisher=jv,Pt.IRelayer=Qv,Pt.ISignClient=e1,Pt.ISignClientEvents=Zv,Pt.IStore=Wv,Pt.ISubscriber=zv,Pt.ISubscriberTopicMap=$v,Pt.IVerify=Xv});var S2={};ft(S2,{safeJsonParse:()=>Uc,safeJsonStringify:()=>qc});function Uc(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return ZQ(t)}catch{return t}}function qc(t){return typeof t=="string"?t:XQ(t)||""}var XQ,ZQ,Qd=ge(()=>{c();XQ=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),ZQ=t=>{let e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,r=t.replace(e,'$1"$2n"$3');return JSON.parse(r,(n,i)=>typeof i=="string"&&i.match(/^\d+n$/)?BigInt(i.substring(0,i.length-1)):i)}});var C2=m(Wd=>{"use strict";c();Object.defineProperty(Wd,"__esModule",{value:!0});Wd.BrowserRandomSource=void 0;var T2=65536,i1=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(s1,"__esModule",{value:!0});function e7(t){for(var e=0;e{c()});var N2=m($d=>{"use strict";c();Object.defineProperty($d,"__esModule",{value:!0});$d.NodeRandomSource=void 0;var t7=qr(),o1=class{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof JI<"u"){let e=x2();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(zd,"__esModule",{value:!0});zd.SystemRandomSource=void 0;var r7=C2(),n7=N2(),a1=class{constructor(){if(this.isAvailable=!1,this.name="",this._source=new r7.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new n7.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)}};zd.SystemRandomSource=a1});var D2=m(Ar=>{"use strict";c();Object.defineProperty(Ar,"__esModule",{value:!0});function i7(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}Ar.mul=Math.imul||i7;function s7(t,e){return t+e|0}Ar.add=s7;function o7(t,e){return t-e|0}Ar.sub=o7;function a7(t,e){return t<>>32-e}Ar.rotl=a7;function u7(t,e){return t<<32-e|t>>>e}Ar.rotr=u7;function c7(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t}Ar.isInteger=Number.isInteger||c7;Ar.MAX_SAFE_INTEGER=9007199254740991;Ar.isSafeInteger=function(t){return Ar.isInteger(t)&&t>=-Ar.MAX_SAFE_INTEGER&&t<=Ar.MAX_SAFE_INTEGER}});var Ca=m(Ne=>{"use strict";c();Object.defineProperty(Ne,"__esModule",{value:!0});var P2=D2();function l7(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}Ne.readInt16BE=l7;function f7(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}Ne.readUint16BE=f7;function h7(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}Ne.readInt16LE=h7;function d7(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}Ne.readUint16LE=d7;function R2(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}Ne.writeUint16BE=R2;Ne.writeInt16BE=R2;function B2(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}Ne.writeUint16LE=B2;Ne.writeInt16LE=B2;function u1(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}Ne.readInt32BE=u1;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 l1(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}Ne.readInt32LE=l1;function f1(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=f1;function Kd(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=Kd;Ne.writeInt32BE=Kd;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 p7(t,e){e===void 0&&(e=0);var r=u1(t,e),n=u1(t,e+4);return r*4294967296+n-(n>>31)*4294967296}Ne.readInt64BE=p7;function g7(t,e){e===void 0&&(e=0);var r=c1(t,e),n=c1(t,e+4);return r*4294967296+n}Ne.readUint64BE=g7;function y7(t,e){e===void 0&&(e=0);var r=l1(t,e),n=l1(t,e+4);return n*4294967296+r-(r>>31)*4294967296}Ne.readInt64LE=y7;function m7(t,e){e===void 0&&(e=0);var r=f1(t,e),n=f1(t,e+4);return n*4294967296+r}Ne.readUint64LE=m7;function L2(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),Kd(t/4294967296>>>0,e,r),Kd(t>>>0,e,r+4),e}Ne.writeUint64BE=L2;Ne.writeInt64BE=L2;function F2(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=F2;Ne.writeInt64LE=F2;function w7(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=w7;function E7(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=v7;function A7(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(!P2.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,s=n;s{"use strict";c();Object.defineProperty(Jt,"__esModule",{value:!0});Jt.randomStringForEntropy=Jt.randomString=Jt.randomUint32=Jt.randomBytes=Jt.defaultRandomSource=void 0;var O7=O2(),D7=Ca(),M2=qr();Jt.defaultRandomSource=new O7.SystemRandomSource;function h1(t,e=Jt.defaultRandomSource){return e.randomBytes(t)}Jt.randomBytes=h1;function P7(t=Jt.defaultRandomSource){let e=h1(4,t),r=(0,D7.readUint32LE)(e);return(0,M2.wipe)(e),r}Jt.randomUint32=P7;var U2="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function q2(t,e=U2,r=Jt.defaultRandomSource){if(e.length<2)throw new Error("randomString charset is too short");if(e.length>256)throw new Error("randomString charset is too long");let n="",i=e.length,s=256-256%i;for(;t>0;){let o=h1(Math.ceil(t*256/s),r);for(let a=0;a0;a++){let u=o[a];u{"use strict";c();Object.defineProperty(Jn,"__esModule",{value:!0});var Na=Ca(),xa=qr();Jn.DIGEST_LENGTH=64;Jn.BLOCK_SIZE=128;var H2=function(){function t(){this.digestLength=Jn.DIGEST_LENGTH,this.blockSize=Jn.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(){xa.wipe(this._buffer),xa.wipe(this._tempHi),xa.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&&(d1(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(n=d1(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){xa.wipe(e.stateHi),xa.wipe(e.stateLo),e.buffer&&xa.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},t}();Jn.SHA512=H2;var V2=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 d1(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],w=r[6],E=r[7],T=n[0],D=n[1],B=n[2],W=n[3],U=n[4],A=n[5],I=n[6],N=n[7],_,S,R,J,Q,V,k,K;o>=128;){for(var pe=0;pe<16;pe++){var ue=8*pe+s;t[pe]=Na.readUint32BE(i,ue),e[pe]=Na.readUint32BE(i,ue+4)}for(var pe=0;pe<80;pe++){var re=a,Y=u,se=l,te=f,ie=d,M=g,le=w,ae=E,fe=T,oe=D,ce=B,y=W,v=U,b=A,P=I,C=N;if(_=E,S=N,Q=S&65535,V=S>>>16,k=_&65535,K=_>>>16,_=(d>>>14|U<<32-14)^(d>>>18|U<<32-18)^(U>>>41-32|d<<32-(41-32)),S=(U>>>14|d<<32-14)^(U>>>18|d<<32-18)^(d>>>41-32|U<<32-(41-32)),Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,_=d&g^~d&w,S=U&A^~U&I,Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,_=V2[pe*2],S=V2[pe*2+1],Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,_=t[pe%16],S=e[pe%16],Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,R=k&65535|K<<16,J=Q&65535|V<<16,_=R,S=J,Q=S&65535,V=S>>>16,k=_&65535,K=_>>>16,_=(a>>>28|T<<32-28)^(T>>>34-32|a<<32-(34-32))^(T>>>39-32|a<<32-(39-32)),S=(T>>>28|a<<32-28)^(a>>>34-32|T<<32-(34-32))^(a>>>39-32|T<<32-(39-32)),Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,_=a&u^a&l^u&l,S=T&D^T&B^D&B,Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,ae=k&65535|K<<16,C=Q&65535|V<<16,_=te,S=y,Q=S&65535,V=S>>>16,k=_&65535,K=_>>>16,_=R,S=J,Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,te=k&65535|K<<16,y=Q&65535|V<<16,u=re,l=Y,f=se,d=te,g=ie,w=M,E=le,a=ae,D=fe,B=oe,W=ce,U=y,A=v,I=b,N=P,T=C,pe%16===15)for(var ue=0;ue<16;ue++)_=t[ue],S=e[ue],Q=S&65535,V=S>>>16,k=_&65535,K=_>>>16,_=t[(ue+9)%16],S=e[(ue+9)%16],Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,R=t[(ue+1)%16],J=e[(ue+1)%16],_=(R>>>1|J<<32-1)^(R>>>8|J<<32-8)^R>>>7,S=(J>>>1|R<<32-1)^(J>>>8|R<<32-8)^(J>>>7|R<<32-7),Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,R=t[(ue+14)%16],J=e[(ue+14)%16],_=(R>>>19|J<<32-19)^(J>>>61-32|R<<32-(61-32))^R>>>6,S=(J>>>19|R<<32-19)^(R>>>61-32|J<<32-(61-32))^(J>>>6|R<<32-6),Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,t[ue]=k&65535|K<<16,e[ue]=Q&65535|V<<16}_=a,S=T,Q=S&65535,V=S>>>16,k=_&65535,K=_>>>16,_=r[0],S=n[0],Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,r[0]=a=k&65535|K<<16,n[0]=T=Q&65535|V<<16,_=u,S=D,Q=S&65535,V=S>>>16,k=_&65535,K=_>>>16,_=r[1],S=n[1],Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,r[1]=u=k&65535|K<<16,n[1]=D=Q&65535|V<<16,_=l,S=B,Q=S&65535,V=S>>>16,k=_&65535,K=_>>>16,_=r[2],S=n[2],Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,r[2]=l=k&65535|K<<16,n[2]=B=Q&65535|V<<16,_=f,S=W,Q=S&65535,V=S>>>16,k=_&65535,K=_>>>16,_=r[3],S=n[3],Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,r[3]=f=k&65535|K<<16,n[3]=W=Q&65535|V<<16,_=d,S=U,Q=S&65535,V=S>>>16,k=_&65535,K=_>>>16,_=r[4],S=n[4],Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,r[4]=d=k&65535|K<<16,n[4]=U=Q&65535|V<<16,_=g,S=A,Q=S&65535,V=S>>>16,k=_&65535,K=_>>>16,_=r[5],S=n[5],Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,r[5]=g=k&65535|K<<16,n[5]=A=Q&65535|V<<16,_=w,S=I,Q=S&65535,V=S>>>16,k=_&65535,K=_>>>16,_=r[6],S=n[6],Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,r[6]=w=k&65535|K<<16,n[6]=I=Q&65535|V<<16,_=E,S=N,Q=S&65535,V=S>>>16,k=_&65535,K=_>>>16,_=r[7],S=n[7],Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,r[7]=E=k&65535|K<<16,n[7]=N=Q&65535|V<<16,s+=128,o-=128}return s}function B7(t){var e=new H2;e.update(t);var r=e.digest();return e.clean(),r}Jn.hash=B7});var rD=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 L7=Vc(),Hc=G2(),$2=qr();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,z2(n,r,1-s)}for(let i=0;i<16;i++)t[2*i]=n[i]&255,t[2*i+1]=n[i]>>8}function K2(t,e){let r=0;for(let n=0;n<32;n++)r|=t[n]^e[n];return(1&r-1>>>8)-1}function Q2(t,e){let r=new Uint8Array(32),n=new Uint8Array(32);return Gc(r,t),Gc(n,e),K2(r,n)}function Y2(t){let e=new Uint8Array(32);return Gc(e,t),e[0]&1}function V7(t,e){for(let r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function js(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]+r[n]}function Ws(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]-r[n]}function je(t,e,r){let n,i,s=0,o=0,a=0,u=0,l=0,f=0,d=0,g=0,w=0,E=0,T=0,D=0,B=0,W=0,U=0,A=0,I=0,N=0,_=0,S=0,R=0,J=0,Q=0,V=0,k=0,K=0,pe=0,ue=0,re=0,Y=0,se=0,te=r[0],ie=r[1],M=r[2],le=r[3],ae=r[4],fe=r[5],oe=r[6],ce=r[7],y=r[8],v=r[9],b=r[10],P=r[11],C=r[12],O=r[13],L=r[14],x=r[15];n=e[0],s+=n*te,o+=n*ie,a+=n*M,u+=n*le,l+=n*ae,f+=n*fe,d+=n*oe,g+=n*ce,w+=n*y,E+=n*v,T+=n*b,D+=n*P,B+=n*C,W+=n*O,U+=n*L,A+=n*x,n=e[1],o+=n*te,a+=n*ie,u+=n*M,l+=n*le,f+=n*ae,d+=n*fe,g+=n*oe,w+=n*ce,E+=n*y,T+=n*v,D+=n*b,B+=n*P,W+=n*C,U+=n*O,A+=n*L,I+=n*x,n=e[2],a+=n*te,u+=n*ie,l+=n*M,f+=n*le,d+=n*ae,g+=n*fe,w+=n*oe,E+=n*ce,T+=n*y,D+=n*v,B+=n*b,W+=n*P,U+=n*C,A+=n*O,I+=n*L,N+=n*x,n=e[3],u+=n*te,l+=n*ie,f+=n*M,d+=n*le,g+=n*ae,w+=n*fe,E+=n*oe,T+=n*ce,D+=n*y,B+=n*v,W+=n*b,U+=n*P,A+=n*C,I+=n*O,N+=n*L,_+=n*x,n=e[4],l+=n*te,f+=n*ie,d+=n*M,g+=n*le,w+=n*ae,E+=n*fe,T+=n*oe,D+=n*ce,B+=n*y,W+=n*v,U+=n*b,A+=n*P,I+=n*C,N+=n*O,_+=n*L,S+=n*x,n=e[5],f+=n*te,d+=n*ie,g+=n*M,w+=n*le,E+=n*ae,T+=n*fe,D+=n*oe,B+=n*ce,W+=n*y,U+=n*v,A+=n*b,I+=n*P,N+=n*C,_+=n*O,S+=n*L,R+=n*x,n=e[6],d+=n*te,g+=n*ie,w+=n*M,E+=n*le,T+=n*ae,D+=n*fe,B+=n*oe,W+=n*ce,U+=n*y,A+=n*v,I+=n*b,N+=n*P,_+=n*C,S+=n*O,R+=n*L,J+=n*x,n=e[7],g+=n*te,w+=n*ie,E+=n*M,T+=n*le,D+=n*ae,B+=n*fe,W+=n*oe,U+=n*ce,A+=n*y,I+=n*v,N+=n*b,_+=n*P,S+=n*C,R+=n*O,J+=n*L,Q+=n*x,n=e[8],w+=n*te,E+=n*ie,T+=n*M,D+=n*le,B+=n*ae,W+=n*fe,U+=n*oe,A+=n*ce,I+=n*y,N+=n*v,_+=n*b,S+=n*P,R+=n*C,J+=n*O,Q+=n*L,V+=n*x,n=e[9],E+=n*te,T+=n*ie,D+=n*M,B+=n*le,W+=n*ae,U+=n*fe,A+=n*oe,I+=n*ce,N+=n*y,_+=n*v,S+=n*b,R+=n*P,J+=n*C,Q+=n*O,V+=n*L,k+=n*x,n=e[10],T+=n*te,D+=n*ie,B+=n*M,W+=n*le,U+=n*ae,A+=n*fe,I+=n*oe,N+=n*ce,_+=n*y,S+=n*v,R+=n*b,J+=n*P,Q+=n*C,V+=n*O,k+=n*L,K+=n*x,n=e[11],D+=n*te,B+=n*ie,W+=n*M,U+=n*le,A+=n*ae,I+=n*fe,N+=n*oe,_+=n*ce,S+=n*y,R+=n*v,J+=n*b,Q+=n*P,V+=n*C,k+=n*O,K+=n*L,pe+=n*x,n=e[12],B+=n*te,W+=n*ie,U+=n*M,A+=n*le,I+=n*ae,N+=n*fe,_+=n*oe,S+=n*ce,R+=n*y,J+=n*v,Q+=n*b,V+=n*P,k+=n*C,K+=n*O,pe+=n*L,ue+=n*x,n=e[13],W+=n*te,U+=n*ie,A+=n*M,I+=n*le,N+=n*ae,_+=n*fe,S+=n*oe,R+=n*ce,J+=n*y,Q+=n*v,V+=n*b,k+=n*P,K+=n*C,pe+=n*O,ue+=n*L,re+=n*x,n=e[14],U+=n*te,A+=n*ie,I+=n*M,N+=n*le,_+=n*ae,S+=n*fe,R+=n*oe,J+=n*ce,Q+=n*y,V+=n*v,k+=n*b,K+=n*P,pe+=n*C,ue+=n*O,re+=n*L,Y+=n*x,n=e[15],A+=n*te,I+=n*ie,N+=n*M,_+=n*le,S+=n*ae,R+=n*fe,J+=n*oe,Q+=n*ce,V+=n*y,k+=n*v,K+=n*b,pe+=n*P,ue+=n*C,re+=n*O,Y+=n*L,se+=n*x,s+=38*I,o+=38*N,a+=38*_,u+=38*S,l+=38*R,f+=38*J,d+=38*Q,g+=38*V,w+=38*k,E+=38*K,T+=38*pe,D+=38*ue,B+=38*re,W+=38*Y,U+=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=w+i+65535,i=Math.floor(n/65536),w=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=T+i+65535,i=Math.floor(n/65536),T=n-i*65536,n=D+i+65535,i=Math.floor(n/65536),D=n-i*65536,n=B+i+65535,i=Math.floor(n/65536),B=n-i*65536,n=W+i+65535,i=Math.floor(n/65536),W=n-i*65536,n=U+i+65535,i=Math.floor(n/65536),U=n-i*65536,n=A+i+65535,i=Math.floor(n/65536),A=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=w+i+65535,i=Math.floor(n/65536),w=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=T+i+65535,i=Math.floor(n/65536),T=n-i*65536,n=D+i+65535,i=Math.floor(n/65536),D=n-i*65536,n=B+i+65535,i=Math.floor(n/65536),B=n-i*65536,n=W+i+65535,i=Math.floor(n/65536),W=n-i*65536,n=U+i+65535,i=Math.floor(n/65536),U=n-i*65536,n=A+i+65535,i=Math.floor(n/65536),A=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]=w,t[9]=E,t[10]=T,t[11]=D,t[12]=B,t[13]=W,t[14]=U,t[15]=A}function Qs(t,e){je(t,e,e)}function J2(t,e){let r=be(),n;for(n=0;n<16;n++)r[n]=e[n];for(n=253;n>=0;n--)Qs(r,r),n!==2&&n!==4&&je(r,r,e);for(n=0;n<16;n++)t[n]=r[n]}function H7(t,e){let r=be(),n;for(n=0;n<16;n++)r[n]=e[n];for(n=250;n>=0;n--)Qs(r,r),n!==1&&je(r,r,e);for(n=0;n<16;n++)t[n]=r[n]}function m1(t,e){let r=be(),n=be(),i=be(),s=be(),o=be(),a=be(),u=be(),l=be(),f=be();Ws(r,t[1],t[0]),Ws(f,e[1],e[0]),je(r,r,f),js(n,t[0],t[1]),js(f,e[0],e[1]),je(n,n,f),je(i,t[3],e[3]),je(i,i,U7),je(s,t[2],e[2]),js(s,s,s),Ws(o,n,r),Ws(a,s,i),js(u,s,i),js(l,n,r),je(t[0],o,a),je(t[1],l,u),je(t[2],u,a),je(t[3],o,l)}function W2(t,e,r){for(let n=0;n<4;n++)z2(t[n],e[n],r)}function E1(t,e){let r=be(),n=be(),i=be();J2(i,e[2]),je(r,e[0],i),je(n,e[1],i),Gc(t,n),t[31]^=Y2(r)<<7}function X2(t,e,r){Mi(t[0],y1),Mi(t[1],Oa),Mi(t[2],Oa),Mi(t[3],y1);for(let n=255;n>=0;--n){let i=r[n/8|0]>>(n&7)&1;W2(t,e,i),m1(e,t),m1(t,t),W2(t,e,i)}}function v1(t,e){let r=[be(),be(),be(),be()];Mi(r[0],k2),Mi(r[1],j2),Mi(r[2],Oa),je(r[3],k2,j2),X2(t,r,e)}function Z2(t){if(t.length!==Ve.SEED_LENGTH)throw new Error(`ed25519: seed must be ${Ve.SEED_LENGTH} bytes`);let e=(0,Hc.hash)(t);e[0]&=248,e[31]&=127,e[31]|=64;let r=new Uint8Array(32),n=[be(),be(),be(),be()];v1(n,e),E1(r,n);let i=new Uint8Array(64);return i.set(t),i.set(r,32),{publicKey:r,secretKey:i}}Ve.generateKeyPairFromSeed=Z2;function G7(t){let e=(0,L7.randomBytes)(32,t),r=Z2(e);return(0,$2.wipe)(e),r}Ve.generateKeyPair=G7;function k7(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=k7;var g1=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 eD(t,e){let r,n,i,s;for(n=63;n>=32;--n){for(r=0,i=n-32,s=n-12;i>4)*g1[i],r=e[i]>>8,e[i]&=255;for(i=0;i<32;i++)e[i]-=r*g1[i];for(n=0;n<32;n++)e[n+1]+=e[n]>>8,t[n]=e[n]&255}function w1(t){let e=new Float64Array(64);for(let r=0;r<64;r++)e[r]=t[r];for(let r=0;r<64;r++)t[r]=0;eD(t,e)}function j7(t,e){let r=new Float64Array(64),n=[be(),be(),be(),be()],i=(0,Hc.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 Hc.SHA512;o.update(s.subarray(32)),o.update(e);let a=o.digest();o.clean(),w1(a),v1(n,a),E1(s,n),o.reset(),o.update(s.subarray(0,32)),o.update(t.subarray(32)),o.update(e);let u=o.digest();w1(u);for(let 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 eD(s.subarray(32),r),s}Ve.sign=j7;function tD(t,e){let r=be(),n=be(),i=be(),s=be(),o=be(),a=be(),u=be();return Mi(t[2],Oa),V7(t[1],e),Qs(i,t[1]),je(s,i,M7),Ws(i,i,t[2]),js(s,t[2],s),Qs(o,s),Qs(a,o),je(u,a,o),je(r,u,i),je(r,r,s),H7(r,r),je(r,r,i),je(r,r,s),je(r,r,s),je(t[0],r,s),Qs(n,t[0]),je(n,n,s),Q2(n,i)&&je(t[0],t[0],q7),Qs(n,t[0]),je(n,n,s),Q2(n,i)?-1:(Y2(t[0])===e[31]>>7&&Ws(t[0],y1,t[0]),je(t[3],t[0],t[1]),0)}function Q7(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(tD(s,t))return!1;let o=new Hc.SHA512;o.update(r.subarray(0,32)),o.update(t),o.update(e);let a=o.digest();return w1(a),X2(i,s,a),v1(s,r.subarray(32)),m1(i,s),E1(n,i),!K2(r,n)}Ve.verify=Q7;function W7(t){let e=[be(),be(),be(),be()];if(tD(e,t))throw new Error("Ed25519: invalid public key");let r=be(),n=be(),i=e[1];js(r,Oa,i),Ws(n,Oa,i),J2(n,n),je(r,r,n);let s=new Uint8Array(32);return Gc(s,r),s}Ve.convertPublicKeyToX25519=W7;function $7(t){let e=(0,Hc.hash)(t.subarray(0,32));e[0]&=248,e[31]&=127,e[31]|=64;let r=new Uint8Array(e.subarray(0,32));return(0,$2.wipe)(e),r}Ve.convertSecretKeyToX25519=$7});var Jd,Xd,$s,Da,Zd,kc,ep,tp,rp,Pa,np,ip,nD,iD,sp=ge(()=>{c();Jd="EdDSA",Xd="JWT",$s=".",Da="base64url",Zd="utf8",kc="utf8",ep=":",tp="did",rp="key",Pa="base58btc",np="z",ip="K36",nD=32,iD=32});function Ui(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}var jc=ge(()=>{c()});function Ra(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?Ui(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}var op=ge(()=>{c();jc()});function ap(t,e){e||(e=t.reduce((i,s)=>i+s.length,0));let r=Ra(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return Ui(r)}var A1=ge(()=>{c();op();jc()});function z7(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,A=new Uint8Array(U);B!==W;){for(var I=E[B],N=0,_=U-1;(I!==0||N>>0,A[_]=I%a>>>0,I=I/a>>>0;if(I!==0)throw new Error("Non-zero carry");D=N,B++}for(var S=U-D;S!==U&&A[S]===0;)S++;for(var R=u.repeat(T);S>>0,U=new Uint8Array(W);E[T];){var A=r[E.charCodeAt(T)];if(A===255)return;for(var I=0,N=W-1;(A!==0||I>>0,U[N]=A%256>>>0,A=A/256>>>0;if(A!==0)throw new Error("Non-zero carry");B=I,T++}if(E[T]!==" "){for(var _=W-B;_!==W&&U[_]===0;)_++;for(var S=new Uint8Array(D+(W-_)),R=D;_!==W;)S[R++]=U[_++];return S}}}function w(E){var T=g(E);if(T)return T;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:g,decode:w}}var K7,Y7,sD,oD=ge(()=>{c();K7=z7,Y7=K7,sD=Y7});var Rfe,aD,Xn,uD,cD,qi=ge(()=>{c();Rfe=new Uint8Array(0),aD=(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")},uD=t=>new TextEncoder().encode(t),cD=t=>new TextDecoder().decode(t)});var b1,_1,I1,fD,S1,Ba,Vi,J7,X7,pt,Kr=ge(()=>{c();oD();qi();b1=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")}},_1=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 fD(this,e)}},I1=class{constructor(e){this.decoders=e}or(e){return fD(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`)}},fD=(t,e)=>new I1({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),S1=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new b1(e,r,n),this.decoder=new _1(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},Ba=({name:t,prefix:e,encode:r,decode:n})=>new S1(t,e,r,n),Vi=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=sD(r,e);return Ba({prefix:t,name:e,encode:n,decode:s=>Xn(i(s))})},J7=(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},X7=(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<Ba({prefix:e,name:t,encode(i){return X7(i,n,r)},decode(i){return J7(i,n,r,t)}})});var T1={};ft(T1,{identity:()=>Z7});var Z7,hD=ge(()=>{c();Kr();qi();Z7=Ba({prefix:"\0",name:"identity",encode:t=>cD(t),decode:t=>uD(t)})});var C1={};ft(C1,{base2:()=>e9});var e9,dD=ge(()=>{c();Kr();e9=pt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1})});var x1={};ft(x1,{base8:()=>t9});var t9,pD=ge(()=>{c();Kr();t9=pt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3})});var N1={};ft(N1,{base10:()=>r9});var r9,gD=ge(()=>{c();Kr();r9=Vi({prefix:"9",name:"base10",alphabet:"0123456789"})});var O1={};ft(O1,{base16:()=>n9,base16upper:()=>i9});var n9,i9,yD=ge(()=>{c();Kr();n9=pt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),i9=pt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})});var D1={};ft(D1,{base32:()=>La,base32hex:()=>u9,base32hexpad:()=>l9,base32hexpadupper:()=>f9,base32hexupper:()=>c9,base32pad:()=>o9,base32padupper:()=>a9,base32upper:()=>s9,base32z:()=>h9});var La,s9,o9,a9,u9,c9,l9,f9,h9,P1=ge(()=>{c();Kr();La=pt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),s9=pt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),o9=pt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),a9=pt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),u9=pt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),c9=pt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),l9=pt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),f9=pt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),h9=pt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})});var R1={};ft(R1,{base36:()=>d9,base36upper:()=>p9});var d9,p9,mD=ge(()=>{c();Kr();d9=Vi({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),p9=Vi({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})});var B1={};ft(B1,{base58btc:()=>In,base58flickr:()=>g9});var In,g9,L1=ge(()=>{c();Kr();In=Vi({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),g9=Vi({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})});var F1={};ft(F1,{base64:()=>y9,base64pad:()=>m9,base64url:()=>w9,base64urlpad:()=>E9});var y9,m9,w9,E9,wD=ge(()=>{c();Kr();y9=pt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),m9=pt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),w9=pt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),E9=pt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})});var M1={};ft(M1,{base256emoji:()=>I9});function b9(t){return t.reduce((e,r)=>(e+=v9[r],e),"")}function _9(t){let e=[];for(let r of t){let n=A9[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var ED,v9,A9,I9,vD=ge(()=>{c();Kr();ED=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}"),v9=ED.reduce((t,e,r)=>(t[r]=e,t),[]),A9=ED.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);I9=Ba({prefix:"\u{1F680}",name:"base256emoji",encode:b9,decode:_9})});function _D(t,e,r){e=e||[],r=r||0;for(var n=r;t>=x9;)e[r++]=t&255|AD,t/=128;for(;t&C9;)e[r++]=t&255|AD,t>>>=7;return e[r]=t|0,_D.bytes=r-n+1,e}function U1(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw U1.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&bD)<=O9);return U1.bytes=s-n,r}var S9,AD,T9,C9,x9,N9,O9,bD,D9,P9,R9,B9,L9,F9,M9,U9,q9,V9,H9,G9,Qc,ID=ge(()=>{c();S9=_D,AD=128,T9=127,C9=~T9,x9=Math.pow(2,31);N9=U1,O9=128,bD=127;D9=Math.pow(2,7),P9=Math.pow(2,14),R9=Math.pow(2,21),B9=Math.pow(2,28),L9=Math.pow(2,35),F9=Math.pow(2,42),M9=Math.pow(2,49),U9=Math.pow(2,56),q9=Math.pow(2,63),V9=function(t){return t{c();ID();Wc=(t,e=0)=>[Qc.decode(t,e),Qc.decode.bytes],Fa=(t,e,r=0)=>(Qc.encode(t,e,r),e),Ma=t=>Qc.encodingLength(t)});var zs,SD,TD,Ua,zc=ge(()=>{c();qi();cp();zs=(t,e)=>{let r=e.byteLength,n=Ma(t),i=n+Ma(r),s=new Uint8Array(i+r);return Fa(t,s,0),Fa(r,s,n),s.set(e,i),new Ua(t,r,e,s)},SD=t=>{let e=Xn(t),[r,n]=Wc(e),[i,s]=Wc(e.subarray(n)),o=e.subarray(n+s);if(o.byteLength!==i)throw new Error("Incorrect length");return new Ua(r,i,o,e)},TD=(t,e)=>t===e?!0:t.code===e.code&&t.size===e.size&&aD(t.bytes,e.bytes),Ua=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}});var V1,q1,H1=ge(()=>{c();zc();V1=({name:t,code:e,encode:r})=>new q1(t,e,r),q1=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?zs(this.code,r):r.then(n=>zs(this.code,n))}else throw Error("Unknown type, must be binary type")}}});var G1={};ft(G1,{sha256:()=>k9,sha512:()=>j9});var xD,k9,j9,ND=ge(()=>{c();H1();xD=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),k9=V1({name:"sha2-256",code:18,encode:xD("SHA-256")}),j9=V1({name:"sha2-512",code:19,encode:xD("SHA-512")})});var k1={};ft(k1,{identity:()=>$9});var OD,Q9,DD,W9,$9,PD=ge(()=>{c();qi();zc();OD=0,Q9="identity",DD=Xn,W9=t=>zs(OD,DD(t)),$9={code:OD,name:Q9,encode:DD,digest:W9}});var RD=ge(()=>{c();qi()});var Ehe,vhe,BD=ge(()=>{c();Ehe=new TextEncoder,vhe=new TextDecoder});var hp,Y9,J9,X9,Kc,Z9,LD,FD,lp,fp,eW,tW,rW,MD=ge(()=>{c();cp();zc();L1();P1();qi();hp=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: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!==Kc)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==Z9)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=zs(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&&TD(this.multihash,e.multihash)}toString(e){let{bytes:r,version:n,_baseCache:i}=this;switch(n){case 0:return J9(r,i,e||In.encoder);default:return X9(r,i,e||La.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 tW(/^0\.0/,rW),!!(e&&(e[FD]||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||LD(r,n,i.bytes))}else if(e!=null&&e[FD]===!0){let{version:r,multihash:n,code:i}=e,s=SD(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!==Kc)throw new Error(`Version 0 CID must use dag-pb (code: ${Kc}) block encoding`);return new t(e,r,n,n.bytes)}case 1:{let i=LD(e,r,n.bytes);return new t(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return t.create(0,Kc,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=Xn(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 Ua(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]=Wc(e.subarray(r));return r+=g,d},i=n(),s=Kc;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]=Y9(e,r),s=t.decode(i);return s._baseCache.set(n,e),s}},Y9=(t,e)=>{switch(t[0]){case"Q":{let r=e||In;return[In.prefix,r.decode(`${In.prefix}${t}`)]}case In.prefix:{let r=e||In;return[In.prefix,r.decode(t)]}case La.prefix:{let r=e||La;return[La.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)]}}},J9=(t,e,r)=>{let{prefix:n}=r;if(n!==In.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},X9=(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},Kc=112,Z9=18,LD=(t,e,r)=>{let n=Ma(t),i=n+Ma(e),s=new Uint8Array(i+r.byteLength);return Fa(t,s,0),Fa(e,s,n),s.set(r,i),s},FD=Symbol.for("@ipld/js-cid/CID"),lp={writable:!1,configurable:!1,enumerable:!0},fp={writable:!1,enumerable:!1,configurable:!1},eW="0.0.0-dev",tW=(t,e)=>{if(t.test(eW))console.warn(e);else throw new Error(e)},rW=`CID.isCID(v) is deprecated and will be removed in the next major release. Following code pattern: if (CID.isCID(value)) { @@ -17,33 +17,33 @@ if (cid) { // Make sure to use cid instead of value doSomethingWithCID(cid) } -`});var ED=ge(()=>{c();wD();tp();Bi();O1();Qc()});var R1,Ufe,vD=ge(()=>{c();z2();$2();K2();Y2();J2();A1();X2();I1();Z2();tD();lD();dD();pD();gD();ED();R1={...g1,...y1,...m1,...w1,...E1,...v1,...b1,..._1,...S1,...T1},Ufe={...D1,...P1}});function bD(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var AD,B1,CQ,sp,L1=ge(()=>{c();vD();Xd();AD=bD("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),B1=bD("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);let e=xa(t.length);for(let r=0;r{c();L1()});function In(t,e="utf8"){let r=sp[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Ri(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}var M1=ge(()=>{c();L1();Hc()});function zc(t){return Lc($n(In(t,Ta),Qd))}function $c(t){return $n(In(Fc(t),Qd),Ta)}function U1(t){let e=In(Yd,Ca),r=Kd+$n(Zd([e,t]),Ca);return[zd,$d,r].join(Wd)}function q1(t){let[e,r,n]=t.split(Wd);if(e!==zd||r!==$d)throw new Error('Issuer must be a DID with method "key"');if(n.slice(0,1)!==Kd)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)!==Yd)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 _D(t){return $n(t,Ta)}function ID(t){return In(t,Ta)}function V1(t){return In([$c(t.header),$c(t.payload)].join(Hs),Vc)}function xQ(t){let e=$n(t,Vc).split(Hs),r=zc(e[0]),n=zc(e[1]);return{header:r,payload:n}}function H1(t){return[$c(t.header),$c(t.payload),_D(t.signature)].join(Hs)}function G1(t){let e=t.split(Hs),r=zc(e[0]),n=zc(e[1]),i=ID(e[2]),s=In(e.slice(0,2).join(Hs),Vc);return{header:r,payload:n,signature:i,data:s}}var j1=ge(()=>{c();l1();F1();M1();Md();Jd()});function NQ(t=(0,SD.randomBytes)(32)){return Ba.generateKeyPairFromSeed(t)}async function OQ(t,e,r,n,i=(0,TD.fromMiliseconds)(Date.now())){let s={alg:jd,typ:kd},o=U1(n.publicKey),a=i+r,u={iss:o,sub:t,aud:e,iat:i,exp:a},l=V1({header:s,payload:u}),f=Ba.sign(n.secretKey,l);return H1({header:s,payload:u,signature:f})}async function DQ(t){let{header:e,payload:r,data:n,signature:i}=G1(t);if(e.alg!==jd||e.typ!==kd)throw new Error("JWT must use EdDSA algorithm");let s=q1(r.iss);return Ba.verify(s,n,i)}var Ba,SD,TD,CD=ge(()=>{c();Ba=_e(M2()),SD=_e(Mc()),TD=_e(Ms());Jd();j1()});var xD=ge(()=>{c()});var ND={};ft(ND,{DATA_ENCODING:()=>Vc,DID_DELIMITER:()=>Wd,DID_METHOD:()=>$d,DID_PREFIX:()=>zd,JSON_ENCODING:()=>Qd,JWT_DELIMITER:()=>Hs,JWT_ENCODING:()=>Ta,JWT_IRIDIUM_ALG:()=>jd,JWT_IRIDIUM_TYP:()=>kd,KEY_PAIR_SEED_LENGTH:()=>q2,MULTICODEC_ED25519_BASE:()=>Kd,MULTICODEC_ED25519_ENCODING:()=>Ca,MULTICODEC_ED25519_HEADER:()=>Yd,MULTICODEC_ED25519_LENGTH:()=>U2,decodeData:()=>xQ,decodeIss:()=>q1,decodeJSON:()=>zc,decodeJWT:()=>G1,decodeSig:()=>ID,encodeData:()=>V1,encodeIss:()=>U1,encodeJSON:()=>$c,encodeJWT:()=>H1,encodeSig:()=>_D,generateKeyPair:()=>NQ,signJWT:()=>OQ,verifyJWT:()=>DQ});var OD=ge(()=>{c();CD();Jd();xD();j1()});var PD=m(op=>{"use strict";c();Object.defineProperty(op,"__esModule",{value:!0});var Yt=ba(),k1=Mr(),PQ=20;function RQ(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],w=r[27]<<24|r[26]<<16|r[25]<<8|r[24],E=r[31]<<24|r[30]<<16|r[29]<<8|r[28],x=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,T=u,L=l,X=f,W=d,G=g,j=w,K=E,de=x,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+T|0,ue^=S,ue=ue>>>32-16|ue<<16,G=G+ue|0,T^=G,T=T>>>32-12|T<<12,R=R+L|0,re^=R,re=re>>>32-16|re<<16,j=j+re|0,L^=j,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,j=j+re|0,L^=j,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+T|0,ue^=S,ue=ue>>>32-8|ue<<8,G=G+ue|0,T^=G,T=T>>>32-7|T<<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+T|0,Y^=I,Y=Y>>>32-16|Y<<16,j=j+Y|0,T^=j,T=T>>>32-12|T<<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,G=G+re|0,b^=G,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,G=G+re|0,b^=G,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+T|0,Y^=I,Y=Y>>>32-8|Y<<8,j=j+Y|0,T^=j,T=T>>>32-7|T<<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(T+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(G+g|0,t,36),Yt.writeUint32LE(j+w|0,t,40),Yt.writeUint32LE(K+E|0,t,44),Yt.writeUint32LE(de+x|0,t,48),Yt.writeUint32LE(ue+O|0,t,52),Yt.writeUint32LE(re+F|0,t,56),Yt.writeUint32LE(Y+_|0,t,60)}function DD(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 ap=m(La=>{"use strict";c();Object.defineProperty(La,"__esModule",{value:!0});function FQ(t,e,r){return~(t-1)&e|t-1&r}La.select=FQ;function MQ(t,e){return(t|0)-(e|0)-1>>>31&1}La.lessOrEqual=MQ;function RD(t,e){if(t.length!==e.length)return 0;for(var r=0,n=0;n>>8}La.compare=RD;function UQ(t,e){return t.length===0||e.length===0?!1:RD(t,e)!==0}La.equal=UQ});var LD=m(Kn=>{"use strict";c();Object.defineProperty(Kn,"__esModule",{value:!0});var qQ=ap(),up=Mr();Kn.DIGEST_LENGTH=16;var BD=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],w=this._h[8],E=this._h[9],x=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],T=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 G=e[r+6]|e[r+7]<<8;u+=(W>>>7|G<<9)&8191;var j=e[r+8]|e[r+9]<<8;l+=(G>>>4|j<<12)&8191,f+=j>>>1&8191;var K=e[r+10]|e[r+11]<<8;d+=(j>>>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;w+=(de>>>8|ue<<8)&8191,E+=ue>>>5|i;var re=0,Y=re;Y+=s*x,Y+=o*(5*T),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+=w*(5*F),Y+=E*(5*O),re+=Y>>>13,Y&=8191;var se=re;se+=s*O,se+=o*x,se+=a*(5*T),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+=w*(5*_),se+=E*(5*F),re+=se>>>13,se&=8191;var te=re;te+=s*F,te+=o*O,te+=a*x,te+=u*(5*T),te+=l*(5*b),re=te>>>13,te&=8191,te+=f*(5*B),te+=d*(5*R),te+=g*(5*S),te+=w*(5*I),te+=E*(5*_),re+=te>>>13,te&=8191;var ie=re;ie+=s*_,ie+=o*F,ie+=a*O,ie+=u*x,ie+=l*(5*T),re=ie>>>13,ie&=8191,ie+=f*(5*b),ie+=d*(5*B),ie+=g*(5*R),ie+=w*(5*S),ie+=E*(5*I),re+=ie>>>13,ie&=8191;var q=re;q+=s*I,q+=o*_,q+=a*F,q+=u*O,q+=l*x,re=q>>>13,q&=8191,q+=f*(5*T),q+=d*(5*b),q+=g*(5*B),q+=w*(5*R),q+=E*(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*x,le+=d*(5*T),le+=g*(5*b),le+=w*(5*B),le+=E*(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*x,ae+=g*(5*T),ae+=w*(5*b),ae+=E*(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*x,fe+=w*(5*T),fe+=E*(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+=w*x,oe+=E*(5*T),re+=oe>>>13,oe&=8191;var ce=re;ce+=s*T,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+=w*O,ce+=E*x,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,w=oe,E=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]=w,this._h[9]=E},t.prototype.finish=function(e,r){r===void 0&&(r=0);var n=new Uint16Array(10),i,s,o,a;if(this._leftover){for(a=this._leftover,this._buffer[a++]=1;a<16;a++)this._buffer[a]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(i=this._h[1]>>>13,this._h[1]&=8191,a=2;a<10;a++)this._h[a]+=i,i=this._h[a]>>>13,this._h[a]&=8191;for(this._h[0]+=i*5,i=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=i,i=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=i,n[0]=this._h[0]+5,i=n[0]>>>13,n[0]&=8191,a=1;a<10;a++)n[a]=this._h[a]+i,i=n[a]>>>13,n[a]&=8191;for(n[9]-=8192,s=(i^1)-1,a=0;a<10;a++)n[a]&=s;for(s=~s,a=0;a<10;a++)this._h[a]=this._h[a]&s|n[a];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,o=this._h[0]+this._pad[0],this._h[0]=o&65535,a=1;a<8;a++)o=(this._h[a]+this._pad[a]|0)+(o>>>16)|0,this._h[a]=o&65535;return e[r+0]=this._h[0]>>>0,e[r+1]=this._h[0]>>>8,e[r+2]=this._h[1]>>>0,e[r+3]=this._h[1]>>>8,e[r+4]=this._h[2]>>>0,e[r+5]=this._h[2]>>>8,e[r+6]=this._h[3]>>>0,e[r+7]=this._h[3]>>>8,e[r+8]=this._h[4]>>>0,e[r+9]=this._h[4]>>>8,e[r+10]=this._h[5]>>>0,e[r+11]=this._h[5]>>>8,e[r+12]=this._h[6]>>>0,e[r+13]=this._h[6]>>>8,e[r+14]=this._h[7]>>>0,e[r+15]=this._h[7]>>>8,this._finished=!0,this},t.prototype.update=function(e){var r=0,n=e.length,i;if(this._leftover){i=16-this._leftover,i>n&&(i=n);for(var s=0;s=16&&(i=n-n%16,this._blocks(e,r,i),r+=i,n-=i),n){for(var s=0;s{"use strict";c();Object.defineProperty(Yn,"__esModule",{value:!0});var cp=PD(),GQ=LD(),Kc=Mr(),FD=ba(),jQ=ap();Yn.KEY_LENGTH=32;Yn.NONCE_LENGTH=12;Yn.TAG_LENGTH=16;var MD=new Uint8Array(16),kQ=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);cp.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 cp.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),Kc.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(MD.subarray(i.length%16))),s.update(n),n.length%16>0&&s.update(MD.subarray(n.length%16));var o=new Uint8Array(8);i&&FD.writeUint64LE(i.length,o),s.update(o),FD.writeUint64LE(n.length,o),s.update(o);for(var a=s.digest(),u=0;u{"use strict";c();Object.defineProperty(Q1,"__esModule",{value:!0});function QQ(t){return typeof t.saveState<"u"&&typeof t.restoreState<"u"&&typeof t.cleanSavedState<"u"}Q1.isSerializableHash=QQ});var HD=m(Yc=>{"use strict";c();Object.defineProperty(Yc,"__esModule",{value:!0});var Sn=qD(),WQ=ap(),zQ=Mr(),VD=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(W1,"__esModule",{value:!0});var GD=HD(),jD=Mr(),KQ=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=GD.hmac(this._hash,n,r);this._hmac=new GD.HMAC(e,s),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return t.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(e===0)throw new Error("hkdf: cannot expand more");this._hmac.reset(),e>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},t.prototype.expand=function(e){for(var r=new Uint8Array(e),n=0;n{"use strict";c();Object.defineProperty(Fi,"__esModule",{value:!0});var fp=ba(),lp=Mr();Fi.DIGEST_LENGTH=32;Fi.BLOCK_SIZE=64;var QD=function(){function t(){this.digestLength=Fi.DIGEST_LENGTH,this.blockSize=Fi.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return t.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},t.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},t.prototype.clean=function(){lp.wipe(this._buffer),lp.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&&(z1(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(n=z1(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){lp.wipe(e.state),e.buffer&&lp.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},t}();Fi.SHA256=QD;var YQ=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 z1(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],w=0;w<16;w++){var E=n+w*4;t[w]=fp.readUint32BE(r,E)}for(var w=16;w<64;w++){var x=t[w-2],O=(x>>>17|x<<32-17)^(x>>>19|x<<32-19)^x>>>10;x=t[w-15];var F=(x>>>7|x<<32-7)^(x>>>18|x<<32-18)^x>>>3;t[w]=(O+t[w-7]|0)+(F+t[w-16]|0)}for(var w=0;w<64;w++){var O=(((l>>>6|l<<26)^(l>>>11|l<<21)^(l>>>25|l<<7))+(l&f^~l&d)|0)+(g+(YQ[w]+t[w]|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 JQ(t){var e=new QD;e.update(t);var r=e.digest();return e.clean(),r}Fi.hash=JQ});var YD=m(gt=>{"use strict";c();Object.defineProperty(gt,"__esModule",{value:!0});gt.sharedKey=gt.generateKeyPair=gt.generateKeyPairFromSeed=gt.scalarMultBase=gt.scalarMult=gt.SHARED_KEY_LENGTH=gt.SECRET_KEY_LENGTH=gt.PUBLIC_KEY_LENGTH=void 0;var XQ=Mc(),ZQ=Mr();gt.PUBLIC_KEY_LENGTH=32;gt.SECRET_KEY_LENGTH=32;gt.SHARED_KEY_LENGTH=32;function Tn(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,Jc(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 rW(t,e){for(let r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function hp(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]+r[n]}function dp(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,w=0,E=0,x=0,O=0,F=0,_=0,I=0,S=0,R=0,B=0,b=0,T=0,L=0,X=0,W=0,G=0,j=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],v=r[9],A=r[10],P=r[11],C=r[12],D=r[13],M=r[14],N=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,w+=n*y,E+=n*v,x+=n*A,O+=n*P,F+=n*C,_+=n*D,I+=n*M,S+=n*N,n=e[1],o+=n*te,a+=n*ie,u+=n*q,l+=n*le,f+=n*ae,d+=n*fe,g+=n*oe,w+=n*ce,E+=n*y,x+=n*v,O+=n*A,F+=n*P,_+=n*C,I+=n*D,S+=n*M,R+=n*N,n=e[2],a+=n*te,u+=n*ie,l+=n*q,f+=n*le,d+=n*ae,g+=n*fe,w+=n*oe,E+=n*ce,x+=n*y,O+=n*v,F+=n*A,_+=n*P,I+=n*C,S+=n*D,R+=n*M,B+=n*N,n=e[3],u+=n*te,l+=n*ie,f+=n*q,d+=n*le,g+=n*ae,w+=n*fe,E+=n*oe,x+=n*ce,O+=n*y,F+=n*v,_+=n*A,I+=n*P,S+=n*C,R+=n*D,B+=n*M,b+=n*N,n=e[4],l+=n*te,f+=n*ie,d+=n*q,g+=n*le,w+=n*ae,E+=n*fe,x+=n*oe,O+=n*ce,F+=n*y,_+=n*v,I+=n*A,S+=n*P,R+=n*C,B+=n*D,b+=n*M,T+=n*N,n=e[5],f+=n*te,d+=n*ie,g+=n*q,w+=n*le,E+=n*ae,x+=n*fe,O+=n*oe,F+=n*ce,_+=n*y,I+=n*v,S+=n*A,R+=n*P,B+=n*C,b+=n*D,T+=n*M,L+=n*N,n=e[6],d+=n*te,g+=n*ie,w+=n*q,E+=n*le,x+=n*ae,O+=n*fe,F+=n*oe,_+=n*ce,I+=n*y,S+=n*v,R+=n*A,B+=n*P,b+=n*C,T+=n*D,L+=n*M,X+=n*N,n=e[7],g+=n*te,w+=n*ie,E+=n*q,x+=n*le,O+=n*ae,F+=n*fe,_+=n*oe,I+=n*ce,S+=n*y,R+=n*v,B+=n*A,b+=n*P,T+=n*C,L+=n*D,X+=n*M,W+=n*N,n=e[8],w+=n*te,E+=n*ie,x+=n*q,O+=n*le,F+=n*ae,_+=n*fe,I+=n*oe,S+=n*ce,R+=n*y,B+=n*v,b+=n*A,T+=n*P,L+=n*C,X+=n*D,W+=n*M,G+=n*N,n=e[9],E+=n*te,x+=n*ie,O+=n*q,F+=n*le,_+=n*ae,I+=n*fe,S+=n*oe,R+=n*ce,B+=n*y,b+=n*v,T+=n*A,L+=n*P,X+=n*C,W+=n*D,G+=n*M,j+=n*N,n=e[10],x+=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,T+=n*v,L+=n*A,X+=n*P,W+=n*C,G+=n*D,j+=n*M,K+=n*N,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,T+=n*y,L+=n*v,X+=n*A,W+=n*P,G+=n*C,j+=n*D,K+=n*M,de+=n*N,n=e[12],F+=n*te,_+=n*ie,I+=n*q,S+=n*le,R+=n*ae,B+=n*fe,b+=n*oe,T+=n*ce,L+=n*y,X+=n*v,W+=n*A,G+=n*P,j+=n*C,K+=n*D,de+=n*M,ue+=n*N,n=e[13],_+=n*te,I+=n*ie,S+=n*q,R+=n*le,B+=n*ae,b+=n*fe,T+=n*oe,L+=n*ce,X+=n*y,W+=n*v,G+=n*A,j+=n*P,K+=n*C,de+=n*D,ue+=n*M,re+=n*N,n=e[14],I+=n*te,S+=n*ie,R+=n*q,B+=n*le,b+=n*ae,T+=n*fe,L+=n*oe,X+=n*ce,W+=n*y,G+=n*v,j+=n*A,K+=n*P,de+=n*C,ue+=n*D,re+=n*M,Y+=n*N,n=e[15],S+=n*te,R+=n*ie,B+=n*q,b+=n*le,T+=n*ae,L+=n*fe,X+=n*oe,W+=n*ce,G+=n*y,j+=n*v,K+=n*A,de+=n*P,ue+=n*C,re+=n*D,Y+=n*M,se+=n*N,s+=38*R,o+=38*B,a+=38*b,u+=38*T,l+=38*L,f+=38*X,d+=38*W,g+=38*G,w+=38*j,E+=38*K,x+=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=w+i+65535,i=Math.floor(n/65536),w=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=x+i+65535,i=Math.floor(n/65536),x=n-i*65536,n=O+i+65535,i=Math.floor(n/65536),O=n-i*65536,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=w+i+65535,i=Math.floor(n/65536),w=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=x+i+65535,i=Math.floor(n/65536),x=n-i*65536,n=O+i+65535,i=Math.floor(n/65536),O=n-i*65536,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]=w,t[9]=E,t[10]=x,t[11]=O,t[12]=F,t[13]=_,t[14]=I,t[15]=S}function Xc(t,e){Jn(t,e,e)}function nW(t,e){let r=Tn();for(let n=0;n<16;n++)r[n]=e[n];for(let n=253;n>=0;n--)Xc(r,r),n!==2&&n!==4&&Jn(r,r,e);for(let n=0;n<16;n++)t[n]=r[n]}function K1(t,e){let r=new Uint8Array(32),n=new Float64Array(80),i=Tn(),s=Tn(),o=Tn(),a=Tn(),u=Tn(),l=Tn();for(let w=0;w<31;w++)r[w]=t[w];r[31]=t[31]&127|64,r[0]&=248,rW(n,e);for(let w=0;w<16;w++)s[w]=n[w];i[0]=a[0]=1;for(let w=254;w>=0;--w){let E=r[w>>>3]>>>(w&7)&1;Jc(i,s,E),Jc(o,a,E),hp(u,i,o),dp(i,i,o),hp(o,s,a),dp(s,s,a),Xc(a,u),Xc(l,i),Jn(i,o,i),Jn(o,s,u),hp(u,i,o),dp(i,i,o),Xc(s,i),dp(o,a,l),Jn(i,o,eW),hp(i,i,a),Jn(o,o,i),Jn(i,a,l),Jn(a,s,n),Xc(s,u),Jc(i,s,E),Jc(o,a,E)}for(let w=0;w<16;w++)n[w+16]=i[w],n[w+32]=o[w],n[w+48]=s[w],n[w+64]=a[w];let f=n.subarray(32),d=n.subarray(16);nW(f,f),Jn(d,d,f);let g=new Uint8Array(32);return tW(g,d),g}gt.scalarMult=K1;function $D(t){return K1(t,zD)}gt.scalarMultBase=$D;function KD(t){if(t.length!==gt.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${gt.SECRET_KEY_LENGTH} bytes`);let e=new Uint8Array(t);return{publicKey:$D(e),secretKey:e}}gt.generateKeyPairFromSeed=KD;function iW(t){let e=(0,XQ.randomBytes)(32,t),r=KD(e);return(0,ZQ.wipe)(e),r}gt.generateKeyPair=iW;function sW(t,e,r=!1){if(t.length!==gt.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(e.length!==gt.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");let n=K1(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 ZD(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r{c()});function tP(t,e){if(t.length!==e.length)throw new Error("Inputs should have the same length");let r=xa(t.length);for(let n=0;n{c();Xd();Hc()});var Y1={};ft(Y1,{compare:()=>JD,concat:()=>Zd,equals:()=>ZD,fromString:()=>In,toString:()=>$n,xor:()=>tP});var J1=ge(()=>{c();XD();l1();eP();M1();F1();rP()});var pP=m(st=>{"use strict";c();var nP=st&&st.__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 lP:typeof navigator<"u"?X1(navigator.userAgent):dP()}st.detect=cW;function fP(t){return t!==""&&uW.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 lW(t){var e=fP(t);return e?e[0]:null}st.browserName=lW;function X1(t){var e=fP(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new cP;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 js(t){let e;return typeof window<"u"&&typeof window[t]<"u"&&(e=window[t]),e}Ye.getFromWindow=js;function Fa(t){let e=js(t);if(!e)throw new Error(`${t} is not defined in Window`);return e}Ye.getFromWindowOrThrow=Fa;function hW(){return Fa("document")}Ye.getDocumentOrThrow=hW;function dW(){return js("document")}Ye.getDocument=dW;function pW(){return Fa("navigator")}Ye.getNavigatorOrThrow=pW;function gW(){return js("navigator")}Ye.getNavigator=gW;function yW(){return Fa("location")}Ye.getLocationOrThrow=yW;function mW(){return js("location")}Ye.getLocation=mW;function wW(){return Fa("crypto")}Ye.getCryptoOrThrow=wW;function EW(){return js("crypto")}Ye.getCrypto=EW;function vW(){return Fa("localStorage")}Ye.getLocalStorageOrThrow=vW;function AW(){return js("localStorage")}Ye.getLocalStorage=AW});var yP=m(pp=>{"use strict";c();Object.defineProperty(pp,"__esModule",{value:!0});pp.getWindowMetadata=void 0;var gP=Z1();function bW(){let t,e;try{t=gP.getDocumentOrThrow(),e=gP.getLocationOrThrow()}catch{return null}function r(){let d=t.getElementsByTagName("link"),g=[];for(let w=0;w-1){let O=E.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 w=0;wE.getAttribute(O)).filter(O=>O?d.includes(O):!1);if(x.length&&x){let O=E.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}}pp.getWindowMetadata=bW});var wP=m((ede,mP)=>{"use strict";c();mP.exports=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)});var _P=m((rde,bP)=>{"use strict";c();var AP="%[a-f0-9]{2}",EP=new RegExp("("+AP+")|([^%]+?)","gi"),vP=new RegExp("("+AP+")+","gi");function eA(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([],eA(r),eA(n))}function _W(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(EP)||[],r=1;r{"use strict";c();IP.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 CP=m((ode,TP)=>{"use strict";c();TP.exports=function(t,e){for(var r={},n=Object.keys(t),i=Array.isArray(e),s=0;s{"use strict";c();var SW=wP(),TW=_P(),NP=SP(),CW=CP(),xW=t=>t==null,tA=Symbol("encodeFragmentIdentifier");function NW(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,[Et(e,t),"[",i,"]"].join("")]:[...r,[Et(e,t),"[",Et(i,t),"]=",Et(n,t)].join("")]};case"bracket":return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[Et(e,t),"[]"].join("")]:[...r,[Et(e,t),"[]=",Et(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,[Et(e,t),":list="].join("")]:[...r,[Et(e,t),":list=",Et(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?[[Et(r,t),e,Et(i,t)].join("")]:[[n,Et(i,t)].join(t.arrayFormatSeparator)])}default:return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,Et(e,t)]:[...r,[Et(e,t),"=",Et(n,t)].join("")]}}function OW(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 OP(t){if(typeof t!="string"||t.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function Et(t,e){return e.encode?e.strict?SW(t):encodeURIComponent(t):t}function Xn(t,e){return e.decode?TW(t):t}function DP(t){return Array.isArray(t)?t.sort():typeof t=="object"?DP(Object.keys(t)).sort((e,r)=>Number(e)-Number(r)).map(e=>t[e]):t}function PP(t){let e=t.indexOf("#");return e!==-1&&(t=t.slice(0,e)),t}function DW(t){let e="",r=t.indexOf("#");return r!==-1&&(e=t.slice(r)),e}function RP(t){t=PP(t);let e=t.indexOf("?");return e===-1?"":t.slice(e+1)}function xP(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 BP(t,e){e=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},e),OP(e.arrayFormatSeparator);let r=OW(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]=NP(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]=xP(s[o],e);else n[i]=xP(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]=DP(o):i[s]=o,i},Object.create(null))}hr.extract=RP;hr.parse=BP;hr.stringify=(t,e)=>{if(!t)return"";e=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},e),OP(e.arrayFormatSeparator);let r=o=>e.skipNull&&xW(t[o])||e.skipEmptyString&&t[o]==="",n=NW(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?Et(o,e):Array.isArray(a)?a.length===0&&e.arrayFormat==="bracket-separator"?Et(o,e)+"[]":a.reduce(n(o),[]).join("&"):Et(o,e)+"="+Et(a,e)}).filter(o=>o.length>0).join("&")};hr.parseUrl=(t,e)=>{e=Object.assign({decode:!0},e);let[r,n]=NP(t,"#");return Object.assign({url:r.split("?")[0]||"",query:BP(RP(t),e)},e&&e.parseFragmentIdentifier&&n?{fragmentIdentifier:Xn(n,e)}:{})};hr.stringifyUrl=(t,e)=>{e=Object.assign({encode:!0,strict:!0,[tA]:!0},e);let r=PP(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=DW(t.url);return t.fragmentIdentifier&&(a=`#${e[tA]?Et(t.fragmentIdentifier,e):t.fragmentIdentifier}`),`${r}${o}${a}`};hr.pick=(t,e,r)=>{r=Object.assign({parseFragmentIdentifier:!0,[tA]:!1},r);let{url:n,query:i,fragmentIdentifier:s}=hr.parseUrl(t,r);return hr.stringifyUrl({url:n,query:CW(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 FP=ge(()=>{c()});function Mi(t,e,r="string"){if(!t[e]||typeof t[e]!==r)throw new Error(`Missing or invalid "${e}" param`)}function PW(t,e){let r=!0;return e.forEach(n=>{n in t||(r=!1)}),r}function RW(t,e){return Array.isArray(t)?t.length===e:Object.keys(t).length===e}function BW(t,e){return Array.isArray(t)?t.length>=e:Object.keys(t).length>=e}function Zc(t,e,r){return(!r.length?RW(t,e.length):BW(t,e.length))?PW(t,e):!1}function el(t,e,r="_"){let n=t.split(r);return n[n.length-1].trim().toLowerCase()===e.trim().toLowerCase()}var rA=ge(()=>{c()});function LW(t){return gp(t.method)&&yp(t.params)}function gp(t){return el(t,"subscribe")}function yp(t){return Zc(t,["topic"],[])}function FW(t){return mp(t.method)&&wp(t.params)}function mp(t){return el(t,"publish")}function wp(t){return Zc(t,["message","topic","ttl"],["prompt","tag"])}function MW(t){return Ep(t.method)&&vp(t.params)}function Ep(t){return el(t,"unsubscribe")}function vp(t){return Zc(t,["id","topic"],[])}function UW(t){return Ap(t.method)&&bp(t.params)}function Ap(t){return el(t,"subscription")}function bp(t){return Zc(t,["id","data"],[])}var nA=ge(()=>{c();rA()});function qW(t){if(!gp(t.method))throw new Error("JSON-RPC Request has invalid subscribe method");if(!yp(t.params))throw new Error("JSON-RPC Request has invalid subscribe params");let e=t.params;return Mi(e,"topic"),e}function VW(t){if(!mp(t.method))throw new Error("JSON-RPC Request has invalid publish method");if(!wp(t.params))throw new Error("JSON-RPC Request has invalid publish params");let e=t.params;return Mi(e,"topic"),Mi(e,"message"),Mi(e,"ttl","number"),e}function HW(t){if(!Ep(t.method))throw new Error("JSON-RPC Request has invalid unsubscribe method");if(!vp(t.params))throw new Error("JSON-RPC Request has invalid unsubscribe params");let e=t.params;return Mi(e,"id"),e}function GW(t){if(!Ap(t.method))throw new Error("JSON-RPC Request has invalid subscription method");if(!bp(t.params))throw new Error("JSON-RPC Request has invalid subscription params");let e=t.params;return Mi(e,"id"),Mi(e,"data"),e}var MP=ge(()=>{c();rA();nA()});var jW,UP=ge(()=>{c();jW={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 qP={};ft(qP,{RELAY_JSONRPC:()=>jW,isPublishMethod:()=>mp,isPublishParams:()=>wp,isPublishRequest:()=>FW,isSubscribeMethod:()=>gp,isSubscribeParams:()=>yp,isSubscribeRequest:()=>LW,isSubscriptionMethod:()=>Ap,isSubscriptionParams:()=>bp,isSubscriptionRequest:()=>UW,isUnsubscribeMethod:()=>Ep,isUnsubscribeParams:()=>vp,isUnsubscribeRequest:()=>MW,parsePublishRequest:()=>VW,parseSubscribeRequest:()=>qW,parseSubscriptionRequest:()=>GW,parseUnsubscribeRequest:()=>HW});var VP=ge(()=>{c();FP();MP();UP();nA()});var ol=m(k=>{"use strict";c();Object.defineProperty(k,"__esModule",{value:!0});var YP=UD(),kW=kD(),JP=Mc(),aA=WD(),QW=YD(),ot=(J1(),ct(Y1)),WW=pP(),Ma=Ms(),tl=Z1(),zW=yP(),$W=LP(),KW=(VP(),ct(qP));function XP(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 ZP=XP(QW),_p=XP($W),Tp=":";function e3(t){let[e,r]=t.split(Tp);return{namespace:e,reference:r}}function t3(t){let{namespace:e,reference:r}=t;return[e,r].join(Tp)}function uA(t){let[e,r,n]=t.split(Tp);return{namespace:e,reference:r,address:n}}function r3(t){let{namespace:e,reference:r,address:n}=t;return[e,r,n].join(Tp)}function cA(t,e){let r=[];return t.forEach(n=>{let i=e(n);r.includes(i)||r.push(i)}),r}function n3(t){let{address:e}=uA(t);return e}function i3(t){let{namespace:e,reference:r}=uA(t);return t3({namespace:e,reference:r})}function YW(t,e){let{namespace:r,reference:n}=e3(e);return r3({namespace:r,reference:n,address:t})}function JW(t){return cA(t,n3)}function s3(t){return cA(t,i3)}function XW(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 ZW(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...s3(i.accounts))}),r}function ez(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...Cp(n,i))}),r}function Cp(t,e){return t.includes(":")?[t]:e.chains||[]}var xp=t=>t?.split(":"),o3=t=>{let e=t&&xp(t);if(e)return e[3]},tz=t=>{let e=t&&xp(t);if(e)return e[2]+":"+e[3]},a3=t=>{let e=t&&xp(t);if(e)return e.pop()},rz=(t,e)=>{let r=`${t.domain} wants you to sign in with your Ethereum account:`,n=a3(e),i=t.statement,s=`URI: ${t.aud}`,o=`Version: ${t.version}`,a=`Chain ID: ${o3(e)}`,u=`Nonce: ${t.nonce}`,l=`Issued At: ${t.iat}`,f=t.resources&&t.resources.length>0?`Resources: +`});var UD=ge(()=>{c();MD();cp();qi();H1();zc()});var j1,Dhe,qD=ge(()=>{c();hD();dD();pD();gD();yD();P1();mD();L1();wD();vD();ND();PD();RD();BD();UD();j1={...T1,...C1,...x1,...N1,...O1,...D1,...R1,...B1,...F1,...M1},Dhe={...G1,...k1}});function HD(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var VD,Q1,nW,dp,W1=ge(()=>{c();qD();op();VD=HD("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),Q1=HD("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);let e=Ra(t.length);for(let r=0;r{c();W1()});function Sn(t,e="utf8"){let r=dp[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Ui(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}var z1=ge(()=>{c();W1();jc()});function Yc(t){return Uc(Zn(Sn(t,Da),Zd))}function Jc(t){return Zn(Sn(qc(t),Zd),Da)}function K1(t){let e=Sn(ip,Pa),r=np+Zn(ap([e,t]),Pa);return[tp,rp,r].join(ep)}function Y1(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=Sn(n.slice(1),Pa);if(Zn(s.slice(0,2),Pa)!==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 GD(t){return Zn(t,Da)}function kD(t){return Sn(t,Da)}function J1(t){return Sn([Jc(t.header),Jc(t.payload)].join($s),kc)}function iW(t){let e=Zn(t,kc).split($s),r=Yc(e[0]),n=Yc(e[1]);return{header:r,payload:n}}function X1(t){return[Jc(t.header),Jc(t.payload),GD(t.signature)].join($s)}function Z1(t){let e=t.split($s),r=Yc(e[0]),n=Yc(e[1]),i=kD(e[2]),s=Sn(e.slice(0,2).join($s),kc);return{header:r,payload:n,signature:i,data:s}}var eA=ge(()=>{c();A1();$1();z1();Qd();sp()});function sW(t=(0,jD.randomBytes)(32)){return qa.generateKeyPairFromSeed(t)}async function oW(t,e,r,n,i=(0,QD.fromMiliseconds)(Date.now())){let s={alg:Jd,typ:Xd},o=K1(n.publicKey),a=i+r,u={iss:o,sub:t,aud:e,iat:i,exp:a},l=J1({header:s,payload:u}),f=qa.sign(n.secretKey,l);return X1({header:s,payload:u,signature:f})}async function aW(t){let{header:e,payload:r,data:n,signature:i}=Z1(t);if(e.alg!==Jd||e.typ!==Xd)throw new Error("JWT must use EdDSA algorithm");let s=Y1(r.iss);return qa.verify(s,n,i)}var qa,jD,QD,WD=ge(()=>{c();qa=_e(rD()),jD=_e(Vc()),QD=_e(ks());sp();eA()});var $D=ge(()=>{c()});var zD={};ft(zD,{DATA_ENCODING:()=>kc,DID_DELIMITER:()=>ep,DID_METHOD:()=>rp,DID_PREFIX:()=>tp,JSON_ENCODING:()=>Zd,JWT_DELIMITER:()=>$s,JWT_ENCODING:()=>Da,JWT_IRIDIUM_ALG:()=>Jd,JWT_IRIDIUM_TYP:()=>Xd,KEY_PAIR_SEED_LENGTH:()=>iD,MULTICODEC_ED25519_BASE:()=>np,MULTICODEC_ED25519_ENCODING:()=>Pa,MULTICODEC_ED25519_HEADER:()=>ip,MULTICODEC_ED25519_LENGTH:()=>nD,decodeData:()=>iW,decodeIss:()=>Y1,decodeJSON:()=>Yc,decodeJWT:()=>Z1,decodeSig:()=>kD,encodeData:()=>J1,encodeIss:()=>K1,encodeJSON:()=>Jc,encodeJWT:()=>X1,encodeSig:()=>GD,generateKeyPair:()=>sW,signJWT:()=>oW,verifyJWT:()=>aW});var KD=ge(()=>{c();WD();sp();$D();eA()});var JD=m(pp=>{"use strict";c();Object.defineProperty(pp,"__esModule",{value:!0});var Xt=Ca(),tA=qr(),uW=20;function cW(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],w=r[27]<<24|r[26]<<16|r[25]<<8|r[24],E=r[31]<<24|r[30]<<16|r[29]<<8|r[28],T=e[3]<<24|e[2]<<16|e[1]<<8|e[0],D=e[7]<<24|e[6]<<16|e[5]<<8|e[4],B=e[11]<<24|e[10]<<16|e[9]<<8|e[8],W=e[15]<<24|e[14]<<16|e[13]<<8|e[12],U=n,A=i,I=s,N=o,_=a,S=u,R=l,J=f,Q=d,V=g,k=w,K=E,pe=T,ue=D,re=B,Y=W,se=0;se>>32-16|pe<<16,Q=Q+pe|0,_^=Q,_=_>>>32-12|_<<12,A=A+S|0,ue^=A,ue=ue>>>32-16|ue<<16,V=V+ue|0,S^=V,S=S>>>32-12|S<<12,I=I+R|0,re^=I,re=re>>>32-16|re<<16,k=k+re|0,R^=k,R=R>>>32-12|R<<12,N=N+J|0,Y^=N,Y=Y>>>32-16|Y<<16,K=K+Y|0,J^=K,J=J>>>32-12|J<<12,I=I+R|0,re^=I,re=re>>>32-8|re<<8,k=k+re|0,R^=k,R=R>>>32-7|R<<7,N=N+J|0,Y^=N,Y=Y>>>32-8|Y<<8,K=K+Y|0,J^=K,J=J>>>32-7|J<<7,A=A+S|0,ue^=A,ue=ue>>>32-8|ue<<8,V=V+ue|0,S^=V,S=S>>>32-7|S<<7,U=U+_|0,pe^=U,pe=pe>>>32-8|pe<<8,Q=Q+pe|0,_^=Q,_=_>>>32-7|_<<7,U=U+S|0,Y^=U,Y=Y>>>32-16|Y<<16,k=k+Y|0,S^=k,S=S>>>32-12|S<<12,A=A+R|0,pe^=A,pe=pe>>>32-16|pe<<16,K=K+pe|0,R^=K,R=R>>>32-12|R<<12,I=I+J|0,ue^=I,ue=ue>>>32-16|ue<<16,Q=Q+ue|0,J^=Q,J=J>>>32-12|J<<12,N=N+_|0,re^=N,re=re>>>32-16|re<<16,V=V+re|0,_^=V,_=_>>>32-12|_<<12,I=I+J|0,ue^=I,ue=ue>>>32-8|ue<<8,Q=Q+ue|0,J^=Q,J=J>>>32-7|J<<7,N=N+_|0,re^=N,re=re>>>32-8|re<<8,V=V+re|0,_^=V,_=_>>>32-7|_<<7,A=A+R|0,pe^=A,pe=pe>>>32-8|pe<<8,K=K+pe|0,R^=K,R=R>>>32-7|R<<7,U=U+S|0,Y^=U,Y=Y>>>32-8|Y<<8,k=k+Y|0,S^=k,S=S>>>32-7|S<<7;Xt.writeUint32LE(U+n|0,t,0),Xt.writeUint32LE(A+i|0,t,4),Xt.writeUint32LE(I+s|0,t,8),Xt.writeUint32LE(N+o|0,t,12),Xt.writeUint32LE(_+a|0,t,16),Xt.writeUint32LE(S+u|0,t,20),Xt.writeUint32LE(R+l|0,t,24),Xt.writeUint32LE(J+f|0,t,28),Xt.writeUint32LE(Q+d|0,t,32),Xt.writeUint32LE(V+g|0,t,36),Xt.writeUint32LE(k+w|0,t,40),Xt.writeUint32LE(K+E|0,t,44),Xt.writeUint32LE(pe+T|0,t,48),Xt.writeUint32LE(ue+D|0,t,52),Xt.writeUint32LE(re+B|0,t,56),Xt.writeUint32LE(Y+W|0,t,60)}function YD(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 gp=m(Va=>{"use strict";c();Object.defineProperty(Va,"__esModule",{value:!0});function hW(t,e,r){return~(t-1)&e|t-1&r}Va.select=hW;function dW(t,e){return(t|0)-(e|0)-1>>>31&1}Va.lessOrEqual=dW;function XD(t,e){if(t.length!==e.length)return 0;for(var r=0,n=0;n>>8}Va.compare=XD;function pW(t,e){return t.length===0||e.length===0?!1:XD(t,e)!==0}Va.equal=pW});var eP=m(ei=>{"use strict";c();Object.defineProperty(ei,"__esModule",{value:!0});var gW=gp(),yp=qr();ei.DIGEST_LENGTH=16;var ZD=function(){function t(e){this.digestLength=ei.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],w=this._h[8],E=this._h[9],T=this._r[0],D=this._r[1],B=this._r[2],W=this._r[3],U=this._r[4],A=this._r[5],I=this._r[6],N=this._r[7],_=this._r[8],S=this._r[9];n>=16;){var R=e[r+0]|e[r+1]<<8;s+=R&8191;var J=e[r+2]|e[r+3]<<8;o+=(R>>>13|J<<3)&8191;var Q=e[r+4]|e[r+5]<<8;a+=(J>>>10|Q<<6)&8191;var V=e[r+6]|e[r+7]<<8;u+=(Q>>>7|V<<9)&8191;var k=e[r+8]|e[r+9]<<8;l+=(V>>>4|k<<12)&8191,f+=k>>>1&8191;var K=e[r+10]|e[r+11]<<8;d+=(k>>>14|K<<2)&8191;var pe=e[r+12]|e[r+13]<<8;g+=(K>>>11|pe<<5)&8191;var ue=e[r+14]|e[r+15]<<8;w+=(pe>>>8|ue<<8)&8191,E+=ue>>>5|i;var re=0,Y=re;Y+=s*T,Y+=o*(5*S),Y+=a*(5*_),Y+=u*(5*N),Y+=l*(5*I),re=Y>>>13,Y&=8191,Y+=f*(5*A),Y+=d*(5*U),Y+=g*(5*W),Y+=w*(5*B),Y+=E*(5*D),re+=Y>>>13,Y&=8191;var se=re;se+=s*D,se+=o*T,se+=a*(5*S),se+=u*(5*_),se+=l*(5*N),re=se>>>13,se&=8191,se+=f*(5*I),se+=d*(5*A),se+=g*(5*U),se+=w*(5*W),se+=E*(5*B),re+=se>>>13,se&=8191;var te=re;te+=s*B,te+=o*D,te+=a*T,te+=u*(5*S),te+=l*(5*_),re=te>>>13,te&=8191,te+=f*(5*N),te+=d*(5*I),te+=g*(5*A),te+=w*(5*U),te+=E*(5*W),re+=te>>>13,te&=8191;var ie=re;ie+=s*W,ie+=o*B,ie+=a*D,ie+=u*T,ie+=l*(5*S),re=ie>>>13,ie&=8191,ie+=f*(5*_),ie+=d*(5*N),ie+=g*(5*I),ie+=w*(5*A),ie+=E*(5*U),re+=ie>>>13,ie&=8191;var M=re;M+=s*U,M+=o*W,M+=a*B,M+=u*D,M+=l*T,re=M>>>13,M&=8191,M+=f*(5*S),M+=d*(5*_),M+=g*(5*N),M+=w*(5*I),M+=E*(5*A),re+=M>>>13,M&=8191;var le=re;le+=s*A,le+=o*U,le+=a*W,le+=u*B,le+=l*D,re=le>>>13,le&=8191,le+=f*T,le+=d*(5*S),le+=g*(5*_),le+=w*(5*N),le+=E*(5*I),re+=le>>>13,le&=8191;var ae=re;ae+=s*I,ae+=o*A,ae+=a*U,ae+=u*W,ae+=l*B,re=ae>>>13,ae&=8191,ae+=f*D,ae+=d*T,ae+=g*(5*S),ae+=w*(5*_),ae+=E*(5*N),re+=ae>>>13,ae&=8191;var fe=re;fe+=s*N,fe+=o*I,fe+=a*A,fe+=u*U,fe+=l*W,re=fe>>>13,fe&=8191,fe+=f*B,fe+=d*D,fe+=g*T,fe+=w*(5*S),fe+=E*(5*_),re+=fe>>>13,fe&=8191;var oe=re;oe+=s*_,oe+=o*N,oe+=a*I,oe+=u*A,oe+=l*U,re=oe>>>13,oe&=8191,oe+=f*W,oe+=d*B,oe+=g*D,oe+=w*T,oe+=E*(5*S),re+=oe>>>13,oe&=8191;var ce=re;ce+=s*S,ce+=o*_,ce+=a*N,ce+=u*I,ce+=l*A,re=ce>>>13,ce&=8191,ce+=f*U,ce+=d*W,ce+=g*B,ce+=w*D,ce+=E*T,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=M,f=le,d=ae,g=fe,w=oe,E=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]=w,this._h[9]=E},t.prototype.finish=function(e,r){r===void 0&&(r=0);var n=new Uint16Array(10),i,s,o,a;if(this._leftover){for(a=this._leftover,this._buffer[a++]=1;a<16;a++)this._buffer[a]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(i=this._h[1]>>>13,this._h[1]&=8191,a=2;a<10;a++)this._h[a]+=i,i=this._h[a]>>>13,this._h[a]&=8191;for(this._h[0]+=i*5,i=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=i,i=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=i,n[0]=this._h[0]+5,i=n[0]>>>13,n[0]&=8191,a=1;a<10;a++)n[a]=this._h[a]+i,i=n[a]>>>13,n[a]&=8191;for(n[9]-=8192,s=(i^1)-1,a=0;a<10;a++)n[a]&=s;for(s=~s,a=0;a<10;a++)this._h[a]=this._h[a]&s|n[a];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,o=this._h[0]+this._pad[0],this._h[0]=o&65535,a=1;a<8;a++)o=(this._h[a]+this._pad[a]|0)+(o>>>16)|0,this._h[a]=o&65535;return e[r+0]=this._h[0]>>>0,e[r+1]=this._h[0]>>>8,e[r+2]=this._h[1]>>>0,e[r+3]=this._h[1]>>>8,e[r+4]=this._h[2]>>>0,e[r+5]=this._h[2]>>>8,e[r+6]=this._h[3]>>>0,e[r+7]=this._h[3]>>>8,e[r+8]=this._h[4]>>>0,e[r+9]=this._h[4]>>>8,e[r+10]=this._h[5]>>>0,e[r+11]=this._h[5]>>>8,e[r+12]=this._h[6]>>>0,e[r+13]=this._h[6]>>>8,e[r+14]=this._h[7]>>>0,e[r+15]=this._h[7]>>>8,this._finished=!0,this},t.prototype.update=function(e){var r=0,n=e.length,i;if(this._leftover){i=16-this._leftover,i>n&&(i=n);for(var s=0;s=16&&(i=n-n%16,this._blocks(e,r,i),r+=i,n-=i),n){for(var s=0;s{"use strict";c();Object.defineProperty(ti,"__esModule",{value:!0});var mp=JD(),wW=eP(),Xc=qr(),tP=Ca(),EW=gp();ti.KEY_LENGTH=32;ti.NONCE_LENGTH=12;ti.TAG_LENGTH=16;var rP=new Uint8Array(16),vW=function(){function t(e){if(this.nonceLength=ti.NONCE_LENGTH,this.tagLength=ti.TAG_LENGTH,e.length!==ti.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);mp.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 mp.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),Xc.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(rP.subarray(i.length%16))),s.update(n),n.length%16>0&&s.update(rP.subarray(n.length%16));var o=new Uint8Array(8);i&&tP.writeUint64LE(i.length,o),s.update(o),tP.writeUint64LE(n.length,o),s.update(o);for(var a=s.digest(),u=0;u{"use strict";c();Object.defineProperty(rA,"__esModule",{value:!0});function AW(t){return typeof t.saveState<"u"&&typeof t.restoreState<"u"&&typeof t.cleanSavedState<"u"}rA.isSerializableHash=AW});var oP=m(Zc=>{"use strict";c();Object.defineProperty(Zc,"__esModule",{value:!0});var Tn=iP(),bW=gp(),_W=qr(),sP=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(nA,"__esModule",{value:!0});var aP=oP(),uP=qr(),SW=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=aP.hmac(this._hash,n,r);this._hmac=new aP.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 Ep=Ca(),wp=qr();Hi.DIGEST_LENGTH=32;Hi.BLOCK_SIZE=64;var lP=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(){wp.wipe(this._buffer),wp.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&&(iA(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(n=iA(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){wp.wipe(e.state),e.buffer&&wp.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},t}();Hi.SHA256=lP;var TW=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 iA(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],w=0;w<16;w++){var E=n+w*4;t[w]=Ep.readUint32BE(r,E)}for(var w=16;w<64;w++){var T=t[w-2],D=(T>>>17|T<<32-17)^(T>>>19|T<<32-19)^T>>>10;T=t[w-15];var B=(T>>>7|T<<32-7)^(T>>>18|T<<32-18)^T>>>3;t[w]=(D+t[w-7]|0)+(B+t[w-16]|0)}for(var w=0;w<64;w++){var D=(((l>>>6|l<<26)^(l>>>11|l<<21)^(l>>>25|l<<7))+(l&f^~l&d)|0)+(g+(TW[w]+t[w]|0)|0)|0,B=((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+D|0,u=a,a=o,o=s,s=D+B|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 CW(t){var e=new lP;e.update(t);var r=e.digest();return e.clean(),r}Hi.hash=CW});var gP=m(gt=>{"use strict";c();Object.defineProperty(gt,"__esModule",{value:!0});gt.sharedKey=gt.generateKeyPair=gt.generateKeyPairFromSeed=gt.scalarMultBase=gt.scalarMult=gt.SHARED_KEY_LENGTH=gt.SECRET_KEY_LENGTH=gt.PUBLIC_KEY_LENGTH=void 0;var xW=Vc(),NW=qr();gt.PUBLIC_KEY_LENGTH=32;gt.SECRET_KEY_LENGTH=32;gt.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,el(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 PW(t,e){for(let r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function vp(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]+r[n]}function Ap(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]-r[n]}function ri(t,e,r){let n,i,s=0,o=0,a=0,u=0,l=0,f=0,d=0,g=0,w=0,E=0,T=0,D=0,B=0,W=0,U=0,A=0,I=0,N=0,_=0,S=0,R=0,J=0,Q=0,V=0,k=0,K=0,pe=0,ue=0,re=0,Y=0,se=0,te=r[0],ie=r[1],M=r[2],le=r[3],ae=r[4],fe=r[5],oe=r[6],ce=r[7],y=r[8],v=r[9],b=r[10],P=r[11],C=r[12],O=r[13],L=r[14],x=r[15];n=e[0],s+=n*te,o+=n*ie,a+=n*M,u+=n*le,l+=n*ae,f+=n*fe,d+=n*oe,g+=n*ce,w+=n*y,E+=n*v,T+=n*b,D+=n*P,B+=n*C,W+=n*O,U+=n*L,A+=n*x,n=e[1],o+=n*te,a+=n*ie,u+=n*M,l+=n*le,f+=n*ae,d+=n*fe,g+=n*oe,w+=n*ce,E+=n*y,T+=n*v,D+=n*b,B+=n*P,W+=n*C,U+=n*O,A+=n*L,I+=n*x,n=e[2],a+=n*te,u+=n*ie,l+=n*M,f+=n*le,d+=n*ae,g+=n*fe,w+=n*oe,E+=n*ce,T+=n*y,D+=n*v,B+=n*b,W+=n*P,U+=n*C,A+=n*O,I+=n*L,N+=n*x,n=e[3],u+=n*te,l+=n*ie,f+=n*M,d+=n*le,g+=n*ae,w+=n*fe,E+=n*oe,T+=n*ce,D+=n*y,B+=n*v,W+=n*b,U+=n*P,A+=n*C,I+=n*O,N+=n*L,_+=n*x,n=e[4],l+=n*te,f+=n*ie,d+=n*M,g+=n*le,w+=n*ae,E+=n*fe,T+=n*oe,D+=n*ce,B+=n*y,W+=n*v,U+=n*b,A+=n*P,I+=n*C,N+=n*O,_+=n*L,S+=n*x,n=e[5],f+=n*te,d+=n*ie,g+=n*M,w+=n*le,E+=n*ae,T+=n*fe,D+=n*oe,B+=n*ce,W+=n*y,U+=n*v,A+=n*b,I+=n*P,N+=n*C,_+=n*O,S+=n*L,R+=n*x,n=e[6],d+=n*te,g+=n*ie,w+=n*M,E+=n*le,T+=n*ae,D+=n*fe,B+=n*oe,W+=n*ce,U+=n*y,A+=n*v,I+=n*b,N+=n*P,_+=n*C,S+=n*O,R+=n*L,J+=n*x,n=e[7],g+=n*te,w+=n*ie,E+=n*M,T+=n*le,D+=n*ae,B+=n*fe,W+=n*oe,U+=n*ce,A+=n*y,I+=n*v,N+=n*b,_+=n*P,S+=n*C,R+=n*O,J+=n*L,Q+=n*x,n=e[8],w+=n*te,E+=n*ie,T+=n*M,D+=n*le,B+=n*ae,W+=n*fe,U+=n*oe,A+=n*ce,I+=n*y,N+=n*v,_+=n*b,S+=n*P,R+=n*C,J+=n*O,Q+=n*L,V+=n*x,n=e[9],E+=n*te,T+=n*ie,D+=n*M,B+=n*le,W+=n*ae,U+=n*fe,A+=n*oe,I+=n*ce,N+=n*y,_+=n*v,S+=n*b,R+=n*P,J+=n*C,Q+=n*O,V+=n*L,k+=n*x,n=e[10],T+=n*te,D+=n*ie,B+=n*M,W+=n*le,U+=n*ae,A+=n*fe,I+=n*oe,N+=n*ce,_+=n*y,S+=n*v,R+=n*b,J+=n*P,Q+=n*C,V+=n*O,k+=n*L,K+=n*x,n=e[11],D+=n*te,B+=n*ie,W+=n*M,U+=n*le,A+=n*ae,I+=n*fe,N+=n*oe,_+=n*ce,S+=n*y,R+=n*v,J+=n*b,Q+=n*P,V+=n*C,k+=n*O,K+=n*L,pe+=n*x,n=e[12],B+=n*te,W+=n*ie,U+=n*M,A+=n*le,I+=n*ae,N+=n*fe,_+=n*oe,S+=n*ce,R+=n*y,J+=n*v,Q+=n*b,V+=n*P,k+=n*C,K+=n*O,pe+=n*L,ue+=n*x,n=e[13],W+=n*te,U+=n*ie,A+=n*M,I+=n*le,N+=n*ae,_+=n*fe,S+=n*oe,R+=n*ce,J+=n*y,Q+=n*v,V+=n*b,k+=n*P,K+=n*C,pe+=n*O,ue+=n*L,re+=n*x,n=e[14],U+=n*te,A+=n*ie,I+=n*M,N+=n*le,_+=n*ae,S+=n*fe,R+=n*oe,J+=n*ce,Q+=n*y,V+=n*v,k+=n*b,K+=n*P,pe+=n*C,ue+=n*O,re+=n*L,Y+=n*x,n=e[15],A+=n*te,I+=n*ie,N+=n*M,_+=n*le,S+=n*ae,R+=n*fe,J+=n*oe,Q+=n*ce,V+=n*y,k+=n*v,K+=n*b,pe+=n*P,ue+=n*C,re+=n*O,Y+=n*L,se+=n*x,s+=38*I,o+=38*N,a+=38*_,u+=38*S,l+=38*R,f+=38*J,d+=38*Q,g+=38*V,w+=38*k,E+=38*K,T+=38*pe,D+=38*ue,B+=38*re,W+=38*Y,U+=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=w+i+65535,i=Math.floor(n/65536),w=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=T+i+65535,i=Math.floor(n/65536),T=n-i*65536,n=D+i+65535,i=Math.floor(n/65536),D=n-i*65536,n=B+i+65535,i=Math.floor(n/65536),B=n-i*65536,n=W+i+65535,i=Math.floor(n/65536),W=n-i*65536,n=U+i+65535,i=Math.floor(n/65536),U=n-i*65536,n=A+i+65535,i=Math.floor(n/65536),A=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=w+i+65535,i=Math.floor(n/65536),w=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=T+i+65535,i=Math.floor(n/65536),T=n-i*65536,n=D+i+65535,i=Math.floor(n/65536),D=n-i*65536,n=B+i+65535,i=Math.floor(n/65536),B=n-i*65536,n=W+i+65535,i=Math.floor(n/65536),W=n-i*65536,n=U+i+65535,i=Math.floor(n/65536),U=n-i*65536,n=A+i+65535,i=Math.floor(n/65536),A=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]=w,t[9]=E,t[10]=T,t[11]=D,t[12]=B,t[13]=W,t[14]=U,t[15]=A}function tl(t,e){ri(t,e,e)}function RW(t,e){let r=Cn();for(let n=0;n<16;n++)r[n]=e[n];for(let n=253;n>=0;n--)tl(r,r),n!==2&&n!==4&&ri(r,r,e);for(let n=0;n<16;n++)t[n]=r[n]}function oA(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 w=0;w<31;w++)r[w]=t[w];r[31]=t[31]&127|64,r[0]&=248,PW(n,e);for(let w=0;w<16;w++)s[w]=n[w];i[0]=a[0]=1;for(let w=254;w>=0;--w){let E=r[w>>>3]>>>(w&7)&1;el(i,s,E),el(o,a,E),vp(u,i,o),Ap(i,i,o),vp(o,s,a),Ap(s,s,a),tl(a,u),tl(l,i),ri(i,o,i),ri(o,s,u),vp(u,i,o),Ap(i,i,o),tl(s,i),Ap(o,a,l),ri(i,o,OW),vp(i,i,a),ri(o,o,i),ri(i,a,l),ri(a,s,n),tl(s,u),el(i,s,E),el(o,a,E)}for(let w=0;w<16;w++)n[w+16]=i[w],n[w+32]=o[w],n[w+48]=s[w],n[w+64]=a[w];let f=n.subarray(32),d=n.subarray(16);RW(f,f),ri(d,d,f);let g=new Uint8Array(32);return DW(g,d),g}gt.scalarMult=oA;function dP(t){return oA(t,hP)}gt.scalarMultBase=dP;function pP(t){if(t.length!==gt.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${gt.SECRET_KEY_LENGTH} bytes`);let e=new Uint8Array(t);return{publicKey:dP(e),secretKey:e}}gt.generateKeyPairFromSeed=pP;function BW(t){let e=(0,xW.randomBytes)(32,t),r=pP(e);return(0,NW.wipe)(e),r}gt.generateKeyPair=BW;function LW(t,e,r=!1){if(t.length!==gt.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(e.length!==gt.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");let n=oA(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 wP(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r{c()});function vP(t,e){if(t.length!==e.length)throw new Error("Inputs should have the same length");let r=Ra(t.length);for(let n=0;n{c();op();jc()});var aA={};ft(aA,{compare:()=>yP,concat:()=>ap,equals:()=>wP,fromString:()=>Sn,toString:()=>Zn,xor:()=>vP});var uA=ge(()=>{c();mP();A1();EP();z1();$1();AP()});var RP=m(st=>{"use strict";c();var bP=st&&st.__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 NP:typeof navigator<"u"?cA(navigator.userAgent):PP()}st.detect=qW;function OP(t){return t!==""&&UW.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 VW(t){var e=OP(t);return e?e[0]:null}st.browserName=VW;function cA(t){var e=OP(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new xP;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length<_P&&(i=bP(bP([],i,!0),HW(_P-i.length),!0)):i=[];var s=i.join("."),o=DP(t),a=MW.exec(t);return a&&a[1]?new CP(r,s,o,a[1]):new SP(r,s,o)}st.parseUserAgent=cA;function DP(t){for(var e=0,r=IP.length;e{"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 Ks(t){let e;return typeof window<"u"&&typeof window[t]<"u"&&(e=window[t]),e}Ye.getFromWindow=Ks;function Ha(t){let e=Ks(t);if(!e)throw new Error(`${t} is not defined in Window`);return e}Ye.getFromWindowOrThrow=Ha;function GW(){return Ha("document")}Ye.getDocumentOrThrow=GW;function kW(){return Ks("document")}Ye.getDocument=kW;function jW(){return Ha("navigator")}Ye.getNavigatorOrThrow=jW;function QW(){return Ks("navigator")}Ye.getNavigator=QW;function WW(){return Ha("location")}Ye.getLocationOrThrow=WW;function $W(){return Ks("location")}Ye.getLocation=$W;function zW(){return Ha("crypto")}Ye.getCryptoOrThrow=zW;function KW(){return Ks("crypto")}Ye.getCrypto=KW;function YW(){return Ha("localStorage")}Ye.getLocalStorageOrThrow=YW;function JW(){return Ks("localStorage")}Ye.getLocalStorage=JW});var LP=m(bp=>{"use strict";c();Object.defineProperty(bp,"__esModule",{value:!0});bp.getWindowMetadata=void 0;var BP=lA();function XW(){let t,e;try{t=BP.getDocumentOrThrow(),e=BP.getLocationOrThrow()}catch{return null}function r(){let d=t.getElementsByTagName("link"),g=[];for(let w=0;w-1){let D=E.getAttribute("href");if(D)if(D.toLowerCase().indexOf("https:")===-1&&D.toLowerCase().indexOf("http:")===-1&&D.indexOf("//")!==0){let B=e.protocol+"//"+e.host;if(D.indexOf("/")===0)B+=D;else{let W=e.pathname.split("/");W.pop();let U=W.join("/");B+=U+"/"+D}g.push(B)}else if(D.indexOf("//")===0){let B=e.protocol+D;g.push(B)}else g.push(D)}}return g}function n(...d){let g=t.getElementsByTagName("meta");for(let w=0;wE.getAttribute(D)).filter(D=>D?d.includes(D):!1);if(T.length&&T){let D=E.getAttribute("content");if(D)return D}}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}}bp.getWindowMetadata=XW});var MP=m(($de,FP)=>{"use strict";c();FP.exports=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)});var GP=m((Kde,HP)=>{"use strict";c();var VP="%[a-f0-9]{2}",UP=new RegExp("("+VP+")|([^%]+?)","gi"),qP=new RegExp("("+VP+")+","gi");function fA(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([],fA(r),fA(n))}function ZW(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(UP)||[],r=1;r{"use strict";c();kP.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 WP=m((Zde,QP)=>{"use strict";c();QP.exports=function(t,e){for(var r={},n=Object.keys(t),i=Array.isArray(e),s=0;s{"use strict";c();var t$=MP(),r$=GP(),zP=jP(),n$=WP(),i$=t=>t==null,hA=Symbol("encodeFragmentIdentifier");function s$(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,[vt(e,t),"[",i,"]"].join("")]:[...r,[vt(e,t),"[",vt(i,t),"]=",vt(n,t)].join("")]};case"bracket":return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[vt(e,t),"[]"].join("")]:[...r,[vt(e,t),"[]=",vt(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,[vt(e,t),":list="].join("")]:[...r,[vt(e,t),":list=",vt(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?[[vt(r,t),e,vt(i,t)].join("")]:[[n,vt(i,t)].join(t.arrayFormatSeparator)])}default:return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,vt(e,t)]:[...r,[vt(e,t),"=",vt(n,t)].join("")]}}function o$(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&&ni(n,t).includes(t.arrayFormatSeparator);n=o?ni(n,t):n;let a=s||o?n.split(t.arrayFormatSeparator).map(u=>ni(u,t)):n===null?n:ni(n,t);i[r]=a};case"bracket-separator":return(r,n,i)=>{let s=/(\[\])$/.test(r);if(r=r.replace(/\[\]$/,""),!s){i[r]=n&&ni(n,t);return}let o=n===null?[]:n.split(t.arrayFormatSeparator).map(a=>ni(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 KP(t){if(typeof t!="string"||t.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function vt(t,e){return e.encode?e.strict?t$(t):encodeURIComponent(t):t}function ni(t,e){return e.decode?r$(t):t}function YP(t){return Array.isArray(t)?t.sort():typeof t=="object"?YP(Object.keys(t)).sort((e,r)=>Number(e)-Number(r)).map(e=>t[e]):t}function JP(t){let e=t.indexOf("#");return e!==-1&&(t=t.slice(0,e)),t}function a$(t){let e="",r=t.indexOf("#");return r!==-1&&(e=t.slice(r)),e}function XP(t){t=JP(t);let e=t.indexOf("?");return e===-1?"":t.slice(e+1)}function $P(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 ZP(t,e){e=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},e),KP(e.arrayFormatSeparator);let r=o$(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]=zP(e.decode?i.replace(/\+/g," "):i,"=");o=o===void 0?null:["comma","separator","bracket-separator"].includes(e.arrayFormat)?o:ni(o,e),r(ni(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]=$P(s[o],e);else n[i]=$P(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]=YP(o):i[s]=o,i},Object.create(null))}pr.extract=XP;pr.parse=ZP;pr.stringify=(t,e)=>{if(!t)return"";e=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},e),KP(e.arrayFormatSeparator);let r=o=>e.skipNull&&i$(t[o])||e.skipEmptyString&&t[o]==="",n=s$(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?vt(o,e):Array.isArray(a)?a.length===0&&e.arrayFormat==="bracket-separator"?vt(o,e)+"[]":a.reduce(n(o),[]).join("&"):vt(o,e)+"="+vt(a,e)}).filter(o=>o.length>0).join("&")};pr.parseUrl=(t,e)=>{e=Object.assign({decode:!0},e);let[r,n]=zP(t,"#");return Object.assign({url:r.split("?")[0]||"",query:ZP(XP(t),e)},e&&e.parseFragmentIdentifier&&n?{fragmentIdentifier:ni(n,e)}:{})};pr.stringifyUrl=(t,e)=>{e=Object.assign({encode:!0,strict:!0,[hA]:!0},e);let r=JP(t.url).split("?")[0]||"",n=pr.extract(t.url),i=pr.parse(n,{sort:!1}),s=Object.assign(i,t.query),o=pr.stringify(s,e);o&&(o=`?${o}`);let a=a$(t.url);return t.fragmentIdentifier&&(a=`#${e[hA]?vt(t.fragmentIdentifier,e):t.fragmentIdentifier}`),`${r}${o}${a}`};pr.pick=(t,e,r)=>{r=Object.assign({parseFragmentIdentifier:!0,[hA]:!1},r);let{url:n,query:i,fragmentIdentifier:s}=pr.parseUrl(t,r);return pr.stringifyUrl({url:n,query:n$(i,e),fragmentIdentifier:s},r)};pr.exclude=(t,e,r)=>{let n=Array.isArray(e)?i=>!e.includes(i):(i,s)=>!e(i,s);return pr.pick(t,n,r)}});var t3=ge(()=>{c()});function Gi(t,e,r="string"){if(!t[e]||typeof t[e]!==r)throw new Error(`Missing or invalid "${e}" param`)}function u$(t,e){let r=!0;return e.forEach(n=>{n in t||(r=!1)}),r}function c$(t,e){return Array.isArray(t)?t.length===e:Object.keys(t).length===e}function l$(t,e){return Array.isArray(t)?t.length>=e:Object.keys(t).length>=e}function rl(t,e,r){return(!r.length?c$(t,e.length):l$(t,e.length))?u$(t,e):!1}function nl(t,e,r="_"){let n=t.split(r);return n[n.length-1].trim().toLowerCase()===e.trim().toLowerCase()}var dA=ge(()=>{c()});function f$(t){return _p(t.method)&&Ip(t.params)}function _p(t){return nl(t,"subscribe")}function Ip(t){return rl(t,["topic"],[])}function h$(t){return Sp(t.method)&&Tp(t.params)}function Sp(t){return nl(t,"publish")}function Tp(t){return rl(t,["message","topic","ttl"],["prompt","tag"])}function d$(t){return Cp(t.method)&&xp(t.params)}function Cp(t){return nl(t,"unsubscribe")}function xp(t){return rl(t,["id","topic"],[])}function p$(t){return Np(t.method)&&Op(t.params)}function Np(t){return nl(t,"subscription")}function Op(t){return rl(t,["id","data"],[])}var pA=ge(()=>{c();dA()});function g$(t){if(!_p(t.method))throw new Error("JSON-RPC Request has invalid subscribe method");if(!Ip(t.params))throw new Error("JSON-RPC Request has invalid subscribe params");let e=t.params;return Gi(e,"topic"),e}function y$(t){if(!Sp(t.method))throw new Error("JSON-RPC Request has invalid publish method");if(!Tp(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 m$(t){if(!Cp(t.method))throw new Error("JSON-RPC Request has invalid unsubscribe method");if(!xp(t.params))throw new Error("JSON-RPC Request has invalid unsubscribe params");let e=t.params;return Gi(e,"id"),e}function w$(t){if(!Np(t.method))throw new Error("JSON-RPC Request has invalid subscription method");if(!Op(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 r3=ge(()=>{c();dA();pA()});var E$,n3=ge(()=>{c();E$={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 i3={};ft(i3,{RELAY_JSONRPC:()=>E$,isPublishMethod:()=>Sp,isPublishParams:()=>Tp,isPublishRequest:()=>h$,isSubscribeMethod:()=>_p,isSubscribeParams:()=>Ip,isSubscribeRequest:()=>f$,isSubscriptionMethod:()=>Np,isSubscriptionParams:()=>Op,isSubscriptionRequest:()=>p$,isUnsubscribeMethod:()=>Cp,isUnsubscribeParams:()=>xp,isUnsubscribeRequest:()=>d$,parsePublishRequest:()=>y$,parseSubscribeRequest:()=>g$,parseSubscriptionRequest:()=>w$,parseUnsubscribeRequest:()=>m$});var s3=ge(()=>{c();t3();r3();n3();pA()});var cl=m(G=>{"use strict";c();Object.defineProperty(G,"__esModule",{value:!0});var g3=nP(),v$=cP(),y3=Vc(),vA=fP(),A$=gP(),ot=(uA(),ct(aA)),b$=RP(),Ga=ks(),il=lA(),_$=LP(),I$=e3(),S$=(s3(),ct(i3));function m3(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 w3=m3(A$),Dp=m3(I$),Bp=":";function E3(t){let[e,r]=t.split(Bp);return{namespace:e,reference:r}}function v3(t){let{namespace:e,reference:r}=t;return[e,r].join(Bp)}function AA(t){let[e,r,n]=t.split(Bp);return{namespace:e,reference:r,address:n}}function A3(t){let{namespace:e,reference:r,address:n}=t;return[e,r,n].join(Bp)}function bA(t,e){let r=[];return t.forEach(n=>{let i=e(n);r.includes(i)||r.push(i)}),r}function b3(t){let{address:e}=AA(t);return e}function _3(t){let{namespace:e,reference:r}=AA(t);return v3({namespace:e,reference:r})}function T$(t,e){let{namespace:r,reference:n}=E3(e);return A3({namespace:r,reference:n,address:t})}function C$(t){return bA(t,b3)}function I3(t){return bA(t,_3)}function x$(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 N$(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...I3(i.accounts))}),r}function O$(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...Lp(n,i))}),r}function Lp(t,e){return t.includes(":")?[t]:e.chains||[]}var Fp=t=>t?.split(":"),S3=t=>{let e=t&&Fp(t);if(e)return e[3]},D$=t=>{let e=t&&Fp(t);if(e)return e[2]+":"+e[3]},T3=t=>{let e=t&&Fp(t);if(e)return e.pop()},P$=(t,e)=>{let r=`${t.domain} wants you to sign in with your Ethereum account:`,n=T3(e),i=t.statement,s=`URI: ${t.aud}`,o=`Version: ${t.version}`,a=`Chain ID: ${S3(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(` -`)},lA="base10",tr="base16",Ip="base64pad",Np="utf8",fA=0,Ua=1,nz=0,HP=1,iA=12,hA=32;function iz(){let t=ZP.generateKeyPair();return{privateKey:ot.toString(t.secretKey,tr),publicKey:ot.toString(t.publicKey,tr)}}function sz(){let t=JP.randomBytes(hA);return ot.toString(t,tr)}function oz(t,e){let r=ZP.sharedKey(ot.fromString(t,tr),ot.fromString(e,tr)),n=new kW.HKDF(aA.SHA256,r).expand(hA);return ot.toString(n,tr)}function az(t){let e=aA.hash(ot.fromString(t,tr));return ot.toString(e,tr)}function uz(t){let e=aA.hash(ot.fromString(t,Np));return ot.toString(e,tr)}function u3(t){return ot.fromString(`${t}`,lA)}function nl(t){return Number(ot.toString(t,lA))}function cz(t){let e=u3(typeof t.type<"u"?t.type:fA);if(nl(e)===Ua&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");let r=typeof t.senderPublicKey<"u"?ot.fromString(t.senderPublicKey,tr):void 0,n=typeof t.iv<"u"?ot.fromString(t.iv,tr):JP.randomBytes(iA),i=new YP.ChaCha20Poly1305(ot.fromString(t.symKey,tr)).seal(n,ot.fromString(t.message,Np));return c3({type:e,sealed:i,iv:n,senderPublicKey:r})}function lz(t){let e=new YP.ChaCha20Poly1305(ot.fromString(t.symKey,tr)),{sealed:r,iv:n}=dA(t.encoded),i=e.open(n,r);if(i===null)throw new Error("Failed to decrypt");return ot.toString(i,Np)}function c3(t){if(nl(t.type)===Ua){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return ot.toString(ot.concat([t.type,t.senderPublicKey,t.iv,t.sealed]),Ip)}return ot.toString(ot.concat([t.type,t.iv,t.sealed]),Ip)}function dA(t){let e=ot.fromString(t,Ip),r=e.slice(nz,HP),n=HP;if(nl(r)===Ua){let a=n+hA,u=a+iA,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+iA,s=e.slice(n,i),o=e.slice(i);return{type:r,sealed:o,iv:s}}function fz(t,e){let r=dA(t);return l3({type:nl(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?ot.toString(r.senderPublicKey,tr):void 0,receiverPublicKey:e?.receiverPublicKey})}function l3(t){let e=t?.type||fA;if(e===Ua){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 hz(t){return t.type===Ua&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}var dz=Object.defineProperty,GP=Object.getOwnPropertySymbols,pz=Object.prototype.hasOwnProperty,gz=Object.prototype.propertyIsEnumerable,jP=(t,e,r)=>e in t?dz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,kP=(t,e)=>{for(var r in e||(e={}))pz.call(e,r)&&jP(t,r,e[r]);if(GP)for(var r of GP(e))gz.call(e,r)&&jP(t,r,e[r]);return t},f3="ReactNative",ei={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},Sp=" ",yz=":",h3="/",pA=2,mz=1e3,d3="js";function gA(){return typeof p.default<"u"&&typeof p.default.versions<"u"&&typeof p.default.versions.node<"u"}function p3(){return!tl.getDocument()&&!!tl.getNavigator()&&navigator.product===f3}function g3(){return!gA()&&!!tl.getNavigator()}function il(){return p3()?ei.reactNative:gA()?ei.node:g3()?ei.browser:ei.unknown}function y3(t,e){let r=_p.parse(t);return r=kP(kP({},r),e),t=_p.stringify(r),t}function wz(){return zW.getWindowMetadata()||{name:"",description:"",url:"",icons:[""]}}function Ez(t,e){var r;let n=il(),i={protocol:t,version:e,env:n};return n==="browser"&&(i.host=((r=tl.getLocation())==null?void 0:r.host)||"unknown"),i}function m3(){if(il()===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=WW.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 w3(){var t;let e=il();return e===ei.browser?[e,((t=tl.getLocation())==null?void 0:t.host)||"unknown"].join(":"):e}function E3(t,e,r){let n=m3(),i=w3();return[[t,e].join("-"),[d3,r].join("-"),n,i].join("/")}function vz({protocol:t,version:e,relayUrl:r,sdkVersion:n,auth:i,projectId:s,useOnCloseEvent:o}){let a=r.split("?"),u=E3(t,e,n),l={auth:i,ua:u,projectId:s,useOnCloseEvent:o||void 0},f=y3(a[1]||"",l);return a[0]+"?"+f}function Az(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 bz(t,e,r){if(!t[e]||typeof t[e]!==r)throw new Error(`Missing or invalid "${e}" param`)}function v3(t,e=pA){return A3(t.split(h3),e)}function _z(t){return v3(t).join(Sp)}function Ui(t,e){return t.filter(r=>e.includes(r)).length===t.length}function A3(t,e=pA){return t.slice(Math.max(t.length-e,0))}function Iz(t){return Object.fromEntries(t.entries())}function Sz(t){return new Map(Object.entries(t))}function Tz(t,e){let r={};return Object.keys(t).forEach(n=>{r[n]=e(t[n])}),r}var Cz=t=>t;function b3(t){return t.trim().replace(/^\w/,e=>e.toUpperCase())}function xz(t){return t.split(Sp).map(e=>b3(e)).join(Sp)}function Nz(t=Ma.FIVE_MINUTES,e){let r=Ma.toMiliseconds(t||Ma.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 Oz(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 yA(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 Dz(t){return yA("topic",t)}function Pz(t){return yA("id",t)}function Rz(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 Bz(t,e){return Ma.fromMiliseconds((e||Date.now())+Ma.toMiliseconds(t))}function Lz(t){return Date.now()>=Ma.toMiliseconds(t)}function Fz(t,e){return`${t}${e?`:${e}`:""}`}function qi(t=[],e=[]){return[...new Set([...t,...e])]}async function Mz({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=il();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 _3="irn";function Uz(t){return t?.relay||{protocol:_3}}function qz(t){let e=KW.RELAY_JSONRPC[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var Vz=Object.defineProperty,QP=Object.getOwnPropertySymbols,Hz=Object.prototype.hasOwnProperty,Gz=Object.prototype.propertyIsEnumerable,WP=(t,e,r)=>e in t?Vz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jz=(t,e)=>{for(var r in e||(e={}))Hz.call(e,r)&&WP(t,r,e[r]);if(QP)for(var r of QP(e))Gz.call(e,r)&&WP(t,r,e[r]);return t};function I3(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 kz(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=_p.parse(s);return{protocol:n,topic:S3(i[0]),version:parseInt(i[1],10),symKey:o.symKey,relay:I3(o)}}function S3(t){return t.startsWith("//")?t.substring(2):t}function T3(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 Qz(t){return`${t.protocol}:${t.topic}@${t.version}?`+_p.stringify(jz({symKey:t.symKey},T3(t.relay)))}var Wz=Object.defineProperty,zz=Object.defineProperties,$z=Object.getOwnPropertyDescriptors,zP=Object.getOwnPropertySymbols,Kz=Object.prototype.hasOwnProperty,Yz=Object.prototype.propertyIsEnumerable,$P=(t,e,r)=>e in t?Wz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Jz=(t,e)=>{for(var r in e||(e={}))Kz.call(e,r)&&$P(t,r,e[r]);if(zP)for(var r of zP(e))Yz.call(e,r)&&$P(t,r,e[r]);return t},Xz=(t,e)=>zz(t,$z(e));function Qs(t){let e=[];return t.forEach(r=>{let[n,i]=r.split(":");e.push(`${n}:${i}`)}),e}function C3(t){let e=[];return Object.values(t).forEach(r=>{e.push(...Qs(r.accounts))}),e}function x3(t,e){let r=[];return Object.values(t).forEach(n=>{Qs(n.accounts).includes(e)&&r.push(...n.methods)}),r}function N3(t,e){let r=[];return Object.values(t).forEach(n=>{Qs(n.accounts).includes(e)&&r.push(...n.events)}),r}function Zz(t,e){let r=M3(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 e$(t){let{proposal:{requiredNamespaces:e,optionalNamespaces:r={}},supportedNamespaces:n}=t,i=sA(e),s=sA(r),o={};Object.keys(n).forEach(l=>{let f=n[l].chains,d=n[l].methods,g=n[l].events,w=n[l].accounts;f.forEach(E=>{if(!w.some(x=>x.includes(E)))throw new Error(`No accounts provided for chain ${E} in namespace ${l}`)}),o[l]={chains:f,methods:d,events:g,accounts:w}});let a=q3(e,o,"approve()");if(a)throw new Error(a.message);let u={};return!Object.keys(e).length&&!Object.keys(r).length?o:(Object.keys(i).forEach(l=>{let f=n[l].chains.filter(E=>{var x,O;return(O=(x=i[l])==null?void 0:x.chains)==null?void 0:O.includes(E)}),d=n[l].methods.filter(E=>{var x,O;return(O=(x=i[l])==null?void 0:x.methods)==null?void 0:O.includes(E)}),g=n[l].events.filter(E=>{var x,O;return(O=(x=i[l])==null?void 0:x.events)==null?void 0:O.includes(E)}),w=f.map(E=>n[l].accounts.filter(x=>x.includes(`${E}:`))).flat();u[l]={chains:f,methods:d,events:g,accounts:w}}),Object.keys(s).forEach(l=>{var f,d,g,w,E,x;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:qi((g=u[l])==null?void 0:g.chains,O),methods:qi((w=u[l])==null?void 0:w.methods,F),events:qi((E=u[l])==null?void 0:E.events,_),accounts:qi((x=u[l])==null?void 0:x.accounts,I)}}),u)}function mA(t){return t.includes(":")}function O3(t){return mA(t)?t.split(":")[0]:t}function sA(t){var e,r,n;let i={};if(!Op(t))return i;for(let[s,o]of Object.entries(t)){let a=mA(s)?[s]:o.chains,u=o.methods||[],l=o.events||[],f=O3(s);i[f]=Xz(Jz({},i[f]),{chains:qi(a,(e=i[f])==null?void 0:e.chains),methods:qi(u,(r=i[f])==null?void 0:r.methods),events:qi(l,(n=i[f])==null?void 0:n.events)})}return i}var t$={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}},r$={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}=r$[t];return{message:e?`${r} ${e}`:r,code:n}}function ks(t,e){let{message:r,code:n}=t$[t];return{message:e?`${r} ${e}`:r,code:n}}function sl(t,e){return Array.isArray(t)?typeof e<"u"&&t.length?t.every(e):!0:!1}function Op(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function Vi(t){return typeof t>"u"}function Er(t,e){return e&&Vi(t)?!0:typeof t=="string"&&!!t.trim().length}function Dp(t,e){return e&&Vi(t)?!0:typeof t=="number"&&!isNaN(t)}function n$(t,e){let{requiredNamespaces:r}=e,n=Object.keys(t.namespaces),i=Object.keys(r),s=!0;return Ui(i,n)?(n.forEach(o=>{let{accounts:a,methods:u,events:l}=t.namespaces[o],f=Qs(a),d=r[o];(!Ui(Cp(o,d),f)||!Ui(d.methods,u)||!Ui(d.events,l))&&(s=!1)}),s):!1}function rl(t){return Er(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function D3(t){if(Er(t,!1)&&t.includes(":")){let e=t.split(":");if(e.length===3){let r=e[0]+":"+e[1];return!!e[2]&&rl(r)}}return!1}function i$(t){if(Er(t,!1))try{return typeof new URL(t)<"u"}catch{return!1}return!1}function s$(t){var e;return(e=t?.proposer)==null?void 0:e.publicKey}function o$(t){return t?.topic}function a$(t,e){let r=null;return Er(t?.publicKey,!1)||(r=Zn("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function oA(t){let e=!0;return sl(t)?t.length&&(e=t.every(r=>Er(r,!1))):e=!1,e}function P3(t,e,r){let n=null;return sl(e)&&e.length?e.forEach(i=>{n||rl(i)||(n=ks("UNSUPPORTED_CHAINS",`${r}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):rl(t)||(n=ks("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 R3(t,e,r){let n=null;return Object.entries(t).forEach(([i,s])=>{if(n)return;let o=P3(i,Cp(i,s),`${e} ${r}`);o&&(n=o)}),n}function B3(t,e){let r=null;return sl(t)?t.forEach(n=>{r||D3(n)||(r=ks("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):r=ks("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function L3(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;let i=B3(n?.accounts,`${e} namespace`);i&&(r=i)}),r}function F3(t,e){let r=null;return oA(t?.methods)?oA(t?.events)||(r=ks("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=ks("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function wA(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;let i=F3(n,`${e}, namespace`);i&&(r=i)}),r}function u$(t,e,r){let n=null;if(t&&Op(t)){let i=wA(t,e);i&&(n=i);let s=R3(t,e,r);s&&(n=s)}else n=Zn("MISSING_OR_INVALID",`${e}, ${r} should be an object with data`);return n}function M3(t,e){let r=null;if(t&&Op(t)){let n=wA(t,e);n&&(r=n);let i=L3(t,e);i&&(r=i)}else r=Zn("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function U3(t){return Er(t.protocol,!0)}function c$(t,e){let r=!1;return e&&!t?r=!0:t&&sl(t)&&t.length&&t.forEach(n=>{r=U3(n)}),r}function l$(t){return typeof t=="number"}function f$(t){return typeof t<"u"&&typeof t!==null}function h$(t){return!(!t||typeof t!="object"||!t.code||!Dp(t.code,!1)||!t.message||!Er(t.message,!1))}function d$(t){return!(Vi(t)||!Er(t.method,!1))}function p$(t){return!(Vi(t)||Vi(t.result)&&Vi(t.error)||!Dp(t.id,!1)||!Er(t.jsonrpc,!1))}function g$(t){return!(Vi(t)||!Er(t.name,!1))}function y$(t,e){return!(!rl(e)||!C3(t).includes(e))}function m$(t,e,r){return Er(r,!1)?x3(t,e).includes(r):!1}function w$(t,e,r){return Er(r,!1)?N3(t,e).includes(r):!1}function q3(t,e,r){let n=null,i=E$(t),s=v$(e),o=Object.keys(i),a=Object.keys(s),u=KP(Object.keys(t)),l=KP(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. +`)},_A="base10",rr="base16",Pp="base64pad",Mp="utf8",IA=0,ka=1,R$=0,o3=1,yA=12,SA=32;function B$(){let t=w3.generateKeyPair();return{privateKey:ot.toString(t.secretKey,rr),publicKey:ot.toString(t.publicKey,rr)}}function L$(){let t=y3.randomBytes(SA);return ot.toString(t,rr)}function F$(t,e){let r=w3.sharedKey(ot.fromString(t,rr),ot.fromString(e,rr),!0),n=new v$.HKDF(vA.SHA256,r).expand(SA);return ot.toString(n,rr)}function M$(t){let e=vA.hash(ot.fromString(t,rr));return ot.toString(e,rr)}function U$(t){let e=vA.hash(ot.fromString(t,Mp));return ot.toString(e,rr)}function C3(t){return ot.fromString(`${t}`,_A)}function ol(t){return Number(ot.toString(t,_A))}function q$(t){let e=C3(typeof t.type<"u"?t.type:IA);if(ol(e)===ka&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");let r=typeof t.senderPublicKey<"u"?ot.fromString(t.senderPublicKey,rr):void 0,n=typeof t.iv<"u"?ot.fromString(t.iv,rr):y3.randomBytes(yA),i=new g3.ChaCha20Poly1305(ot.fromString(t.symKey,rr)).seal(n,ot.fromString(t.message,Mp));return x3({type:e,sealed:i,iv:n,senderPublicKey:r})}function V$(t){let e=new g3.ChaCha20Poly1305(ot.fromString(t.symKey,rr)),{sealed:r,iv:n}=TA(t.encoded),i=e.open(n,r);if(i===null)throw new Error("Failed to decrypt");return ot.toString(i,Mp)}function x3(t){if(ol(t.type)===ka){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return ot.toString(ot.concat([t.type,t.senderPublicKey,t.iv,t.sealed]),Pp)}return ot.toString(ot.concat([t.type,t.iv,t.sealed]),Pp)}function TA(t){let e=ot.fromString(t,Pp),r=e.slice(R$,o3),n=o3;if(ol(r)===ka){let a=n+SA,u=a+yA,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+yA,s=e.slice(n,i),o=e.slice(i);return{type:r,sealed:o,iv:s}}function H$(t,e){let r=TA(t);return N3({type:ol(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?ot.toString(r.senderPublicKey,rr):void 0,receiverPublicKey:e?.receiverPublicKey})}function N3(t){let e=t?.type||IA;if(e===ka){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 G$(t){return t.type===ka&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}var k$=Object.defineProperty,a3=Object.getOwnPropertySymbols,j$=Object.prototype.hasOwnProperty,Q$=Object.prototype.propertyIsEnumerable,u3=(t,e,r)=>e in t?k$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,c3=(t,e)=>{for(var r in e||(e={}))j$.call(e,r)&&u3(t,r,e[r]);if(a3)for(var r of a3(e))Q$.call(e,r)&&u3(t,r,e[r]);return t},O3="ReactNative",tr={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},Rp=" ",W$=":",D3="/",CA=2,$$=1e3,P3="js";function xA(){return typeof p.default<"u"&&typeof p.default.versions<"u"&&typeof p.default.versions.node<"u"}function al(){return!il.getDocument()&&!!il.getNavigator()&&navigator.product===O3}function Up(){return!xA()&&!!il.getNavigator()}function Js(){return al()?tr.reactNative:xA()?tr.node:Up()?tr.browser:tr.unknown}function R3(t,e){let r=Dp.parse(t);return r=c3(c3({},r),e),t=Dp.stringify(r),t}function z$(){return _$.getWindowMetadata()||{name:"",description:"",url:"",icons:[""]}}function K$(t,e){var r;let n=Js(),i={protocol:t,version:e,env:n};return n==="browser"&&(i.host=((r=il.getLocation())==null?void 0:r.host)||"unknown"),i}function B3(){if(Js()===tr.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=b$.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 L3(){var t;let e=Js();return e===tr.browser?[e,((t=il.getLocation())==null?void 0:t.host)||"unknown"].join(":"):e}function F3(t,e,r){let n=B3(),i=L3();return[[t,e].join("-"),[P3,r].join("-"),n,i].join("/")}function Y$({protocol:t,version:e,relayUrl:r,sdkVersion:n,auth:i,projectId:s,useOnCloseEvent:o}){let a=r.split("?"),u=F3(t,e,n),l={auth:i,ua:u,projectId:s,useOnCloseEvent:o||void 0},f=R3(a[1]||"",l);return a[0]+"?"+f}function J$(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 X$(t,e,r){if(!t[e]||typeof t[e]!==r)throw new Error(`Missing or invalid "${e}" param`)}function M3(t,e=CA){return U3(t.split(D3),e)}function Z$(t){return M3(t).join(Rp)}function ki(t,e){return t.filter(r=>e.includes(r)).length===t.length}function U3(t,e=CA){return t.slice(Math.max(t.length-e,0))}function ez(t){return Object.fromEntries(t.entries())}function tz(t){return new Map(Object.entries(t))}function rz(t,e){let r={};return Object.keys(t).forEach(n=>{r[n]=e(t[n])}),r}var nz=t=>t;function q3(t){return t.trim().replace(/^\w/,e=>e.toUpperCase())}function iz(t){return t.split(Rp).map(e=>q3(e)).join(Rp)}function sz(t=Ga.FIVE_MINUTES,e){let r=Ga.toMiliseconds(t||Ga.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 oz(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 NA(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 az(t){return NA("topic",t)}function uz(t){return NA("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 lz(t,e){return Ga.fromMiliseconds((e||Date.now())+Ga.toMiliseconds(t))}function fz(t){return Date.now()>=Ga.toMiliseconds(t)}function hz(t,e){return`${t}${e?`:${e}`:""}`}function ji(t=[],e=[]){return[...new Set([...t,...e])]}async function dz({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=Js();o===tr.browser?s.startsWith("https://")?window.open(s,"_blank","noreferrer noopener"):window.open(s,"_self","noreferrer noopener"):o===tr.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(s)}catch(n){console.error(n)}}var V3="irn";function pz(t){return t?.relay||{protocol:V3}}function gz(t){let e=S$.RELAY_JSONRPC[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var yz=Object.defineProperty,l3=Object.getOwnPropertySymbols,mz=Object.prototype.hasOwnProperty,wz=Object.prototype.propertyIsEnumerable,f3=(t,e,r)=>e in t?yz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Ez=(t,e)=>{for(var r in e||(e={}))mz.call(e,r)&&f3(t,r,e[r]);if(l3)for(var r of l3(e))wz.call(e,r)&&f3(t,r,e[r]);return t};function H3(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 vz(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=Dp.parse(s);return{protocol:n,topic:G3(i[0]),version:parseInt(i[1],10),symKey:o.symKey,relay:H3(o)}}function G3(t){return t.startsWith("//")?t.substring(2):t}function k3(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 Az(t){return`${t.protocol}:${t.topic}@${t.version}?`+Dp.stringify(Ez({symKey:t.symKey},k3(t.relay)))}var bz=Object.defineProperty,_z=Object.defineProperties,Iz=Object.getOwnPropertyDescriptors,h3=Object.getOwnPropertySymbols,Sz=Object.prototype.hasOwnProperty,Tz=Object.prototype.propertyIsEnumerable,d3=(t,e,r)=>e in t?bz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Cz=(t,e)=>{for(var r in e||(e={}))Sz.call(e,r)&&d3(t,r,e[r]);if(h3)for(var r of h3(e))Tz.call(e,r)&&d3(t,r,e[r]);return t},xz=(t,e)=>_z(t,Iz(e));function Xs(t){let e=[];return t.forEach(r=>{let[n,i]=r.split(":");e.push(`${n}:${i}`)}),e}function j3(t){let e=[];return Object.values(t).forEach(r=>{e.push(...Xs(r.accounts))}),e}function Q3(t,e){let r=[];return Object.values(t).forEach(n=>{Xs(n.accounts).includes(e)&&r.push(...n.methods)}),r}function W3(t,e){let r=[];return Object.values(t).forEach(n=>{Xs(n.accounts).includes(e)&&r.push(...n.events)}),r}function Nz(t,e){let r=eR(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 Oz(t){let{proposal:{requiredNamespaces:e,optionalNamespaces:r={}},supportedNamespaces:n}=t,i=mA(e),s=mA(r),o={};Object.keys(n).forEach(l=>{let f=n[l].chains,d=n[l].methods,g=n[l].events,w=n[l].accounts;f.forEach(E=>{if(!w.some(T=>T.includes(E)))throw new Error(`No accounts provided for chain ${E} in namespace ${l}`)}),o[l]={chains:f,methods:d,events:g,accounts:w}});let a=rR(e,o,"approve()");if(a)throw new Error(a.message);let u={};return!Object.keys(e).length&&!Object.keys(r).length?o:(Object.keys(i).forEach(l=>{let f=n[l].chains.filter(E=>{var T,D;return(D=(T=i[l])==null?void 0:T.chains)==null?void 0:D.includes(E)}),d=n[l].methods.filter(E=>{var T,D;return(D=(T=i[l])==null?void 0:T.methods)==null?void 0:D.includes(E)}),g=n[l].events.filter(E=>{var T,D;return(D=(T=i[l])==null?void 0:T.events)==null?void 0:D.includes(E)}),w=f.map(E=>n[l].accounts.filter(T=>T.includes(`${E}:`))).flat();u[l]={chains:f,methods:d,events:g,accounts:w}}),Object.keys(s).forEach(l=>{var f,d,g,w,E,T;if(!n[l])return;let D=(d=(f=s[l])==null?void 0:f.chains)==null?void 0:d.filter(A=>n[l].chains.includes(A)),B=n[l].methods.filter(A=>{var I,N;return(N=(I=s[l])==null?void 0:I.methods)==null?void 0:N.includes(A)}),W=n[l].events.filter(A=>{var I,N;return(N=(I=s[l])==null?void 0:I.events)==null?void 0:N.includes(A)}),U=D?.map(A=>n[l].accounts.filter(I=>I.includes(`${A}:`))).flat();u[l]={chains:ji((g=u[l])==null?void 0:g.chains,D),methods:ji((w=u[l])==null?void 0:w.methods,B),events:ji((E=u[l])==null?void 0:E.events,W),accounts:ji((T=u[l])==null?void 0:T.accounts,U)}}),u)}function OA(t){return t.includes(":")}function $3(t){return OA(t)?t.split(":")[0]:t}function mA(t){var e,r,n;let i={};if(!qp(t))return i;for(let[s,o]of Object.entries(t)){let a=OA(s)?[s]:o.chains,u=o.methods||[],l=o.events||[],f=$3(s);i[f]=xz(Cz({},i[f]),{chains:ji(a,(e=i[f])==null?void 0:e.chains),methods:ji(u,(r=i[f])==null?void 0:r.methods),events:ji(l,(n=i[f])==null?void 0:n.events)})}return i}var Dz={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}},Pz={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 ii(t,e){let{message:r,code:n}=Pz[t];return{message:e?`${r} ${e}`:r,code:n}}function Ys(t,e){let{message:r,code:n}=Dz[t];return{message:e?`${r} ${e}`:r,code:n}}function ul(t,e){return Array.isArray(t)?typeof e<"u"&&t.length?t.every(e):!0:!1}function qp(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function Qi(t){return typeof t>"u"}function br(t,e){return e&&Qi(t)?!0:typeof t=="string"&&!!t.trim().length}function Vp(t,e){return e&&Qi(t)?!0:typeof t=="number"&&!isNaN(t)}function Rz(t,e){let{requiredNamespaces:r}=e,n=Object.keys(t.namespaces),i=Object.keys(r),s=!0;return ki(i,n)?(n.forEach(o=>{let{accounts:a,methods:u,events:l}=t.namespaces[o],f=Xs(a),d=r[o];(!ki(Lp(o,d),f)||!ki(d.methods,u)||!ki(d.events,l))&&(s=!1)}),s):!1}function sl(t){return br(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function z3(t){if(br(t,!1)&&t.includes(":")){let e=t.split(":");if(e.length===3){let r=e[0]+":"+e[1];return!!e[2]&&sl(r)}}return!1}function Bz(t){if(br(t,!1))try{return typeof new URL(t)<"u"}catch{return!1}return!1}function Lz(t){var e;return(e=t?.proposer)==null?void 0:e.publicKey}function Fz(t){return t?.topic}function Mz(t,e){let r=null;return br(t?.publicKey,!1)||(r=ii("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function wA(t){let e=!0;return ul(t)?t.length&&(e=t.every(r=>br(r,!1))):e=!1,e}function K3(t,e,r){let n=null;return ul(e)&&e.length?e.forEach(i=>{n||sl(i)||(n=Ys("UNSUPPORTED_CHAINS",`${r}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):sl(t)||(n=Ys("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 Y3(t,e,r){let n=null;return Object.entries(t).forEach(([i,s])=>{if(n)return;let o=K3(i,Lp(i,s),`${e} ${r}`);o&&(n=o)}),n}function J3(t,e){let r=null;return ul(t)?t.forEach(n=>{r||z3(n)||(r=Ys("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):r=Ys("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function X3(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;let i=J3(n?.accounts,`${e} namespace`);i&&(r=i)}),r}function Z3(t,e){let r=null;return wA(t?.methods)?wA(t?.events)||(r=Ys("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=Ys("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function DA(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;let i=Z3(n,`${e}, namespace`);i&&(r=i)}),r}function Uz(t,e,r){let n=null;if(t&&qp(t)){let i=DA(t,e);i&&(n=i);let s=Y3(t,e,r);s&&(n=s)}else n=ii("MISSING_OR_INVALID",`${e}, ${r} should be an object with data`);return n}function eR(t,e){let r=null;if(t&&qp(t)){let n=DA(t,e);n&&(r=n);let i=X3(t,e);i&&(r=i)}else r=ii("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function tR(t){return br(t.protocol,!0)}function qz(t,e){let r=!1;return e&&!t?r=!0:t&&ul(t)&&t.length&&t.forEach(n=>{r=tR(n)}),r}function Vz(t){return typeof t=="number"}function Hz(t){return typeof t<"u"&&typeof t!==null}function Gz(t){return!(!t||typeof t!="object"||!t.code||!Vp(t.code,!1)||!t.message||!br(t.message,!1))}function kz(t){return!(Qi(t)||!br(t.method,!1))}function jz(t){return!(Qi(t)||Qi(t.result)&&Qi(t.error)||!Vp(t.id,!1)||!br(t.jsonrpc,!1))}function Qz(t){return!(Qi(t)||!br(t.name,!1))}function Wz(t,e){return!(!sl(e)||!j3(t).includes(e))}function $z(t,e,r){return br(r,!1)?Q3(t,e).includes(r):!1}function zz(t,e,r){return br(r,!1)?W3(t,e).includes(r):!1}function rR(t,e,r){let n=null,i=Kz(t),s=Yz(e),o=Object.keys(i),a=Object.keys(s),u=p3(Object.keys(t)),l=p3(Object.keys(e)),f=u.filter(d=>!l.includes(d));return f.length&&(n=ii("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces. Required: ${f.toString()} - Received: ${Object.keys(e).toString()}`)),Ui(o,a)||(n=Zn("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces. + Received: ${Object.keys(e).toString()}`)),ki(o,a)||(n=ii("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces. Required: ${o.toString()} - Approved: ${a.toString()}`)),Object.keys(e).forEach(d=>{if(!d.includes(":")||n)return;let g=Qs(e[d].accounts);g.includes(d)||(n=Zn("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=Xs(e[d].accounts);g.includes(d)||(n=ii("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${d} Required: ${d} - Approved: ${g.toString()}`))}),o.forEach(d=>{n||(Ui(i[d].methods,s[d].methods)?Ui(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 E$(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 KP(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function v$(t){let e={};return Object.keys(t).forEach(r=>{r.includes(":")?e[r]=t[r]:Qs(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 A$(t,e){return Dp(t,!1)&&t<=e.max&&t>=e.min}k.BASE10=lA,k.BASE16=tr,k.BASE64=Ip,k.COLON=yz,k.DEFAULT_DEPTH=pA,k.EMPTY_SPACE=Sp,k.ENV_MAP=ei,k.ONE_THOUSAND=mz,k.REACT_NATIVE_PRODUCT=f3,k.RELAYER_DEFAULT_PROTOCOL=_3,k.SDK_TYPE=d3,k.SLASH=h3,k.TYPE_0=fA,k.TYPE_1=Ua,k.UTF8=Np,k.appendToQueryString=y3,k.assertType=bz,k.buildApprovedNamespaces=e$,k.calcExpiry=Bz,k.capitalize=xz,k.capitalizeWord=b3,k.createDelayedPromise=Nz,k.createExpiringPromise=Oz,k.decodeTypeByte=nl,k.decrypt=lz,k.deriveSymKey=oz,k.deserialize=dA,k.encodeTypeByte=u3,k.encrypt=cz,k.engineEvent=Fz,k.enumify=Cz,k.formatAccountId=r3,k.formatAccountWithChain=YW,k.formatChainId=t3,k.formatExpirerTarget=yA,k.formatIdTarget=Pz,k.formatMessage=rz,k.formatMessageContext=_z,k.formatRelayParams=T3,k.formatRelayRpcUrl=vz,k.formatTopicTarget=Dz,k.formatUA=E3,k.formatUri=Qz,k.generateKeyPair=iz,k.generateRandomBytes32=sz,k.getAccountsChains=Qs,k.getAccountsFromNamespaces=XW,k.getAddressFromAccount=n3,k.getAddressesFromAccounts=JW,k.getAppMetadata=wz,k.getChainFromAccount=i3,k.getChainsFromAccounts=s3,k.getChainsFromNamespace=Cp,k.getChainsFromNamespaces=ZW,k.getChainsFromRequiredNamespaces=ez,k.getDidAddress=a3,k.getDidAddressSegments=xp,k.getDidChainId=o3,k.getEnvironment=il,k.getHttpUrl=Az,k.getInternalError=Zn,k.getJavascriptID=w3,k.getJavascriptOS=m3,k.getLastItems=A3,k.getNamespacedDidChainId=tz,k.getNamespacesChains=C3,k.getNamespacesEventsForChainId=N3,k.getNamespacesMethodsForChainId=x3,k.getRelayClientMetadata=Ez,k.getRelayProtocolApi=qz,k.getRelayProtocolName=Uz,k.getRequiredNamespacesFromNamespaces=Zz,k.getSdkError=ks,k.getUniqueValues=cA,k.handleDeeplinkRedirect=Mz,k.hasOverlap=Ui,k.hashKey=az,k.hashMessage=uz,k.isBrowser=g3,k.isCaipNamespace=mA,k.isConformingNamespaces=q3,k.isExpired=Lz,k.isNode=gA,k.isProposalStruct=s$,k.isReactNative=p3,k.isSessionCompatible=n$,k.isSessionStruct=o$,k.isTypeOneEnvelope=hz,k.isUndefined=Vi,k.isValidAccountId=D3,k.isValidAccounts=B3,k.isValidActions=F3,k.isValidArray=sl,k.isValidChainId=rl,k.isValidChains=P3,k.isValidController=a$,k.isValidErrorReason=h$,k.isValidEvent=g$,k.isValidId=l$,k.isValidNamespaceAccounts=L3,k.isValidNamespaceActions=wA,k.isValidNamespaceChains=R3,k.isValidNamespaceMethodsOrEvents=oA,k.isValidNamespaces=M3,k.isValidNamespacesChainId=y$,k.isValidNamespacesEvent=w$,k.isValidNamespacesRequest=m$,k.isValidNumber=Dp,k.isValidObject=Op,k.isValidParams=f$,k.isValidRelay=U3,k.isValidRelays=c$,k.isValidRequest=d$,k.isValidRequestExpiry=A$,k.isValidRequiredNamespaces=u$,k.isValidResponse=p$,k.isValidString=Er,k.isValidUrl=i$,k.mapEntries=Tz,k.mapToObj=Iz,k.mergeArrays=qi,k.normalizeNamespaces=sA,k.objToMap=Sz,k.parseAccountId=uA,k.parseChainId=e3,k.parseContextNames=v3,k.parseExpirerTarget=Rz,k.parseNamespaceKey=O3,k.parseRelayParams=I3,k.parseTopic=S3,k.parseUri=kz,k.serialize=c3,k.validateDecoding=fz,k.validateEncoding=l3});var V3,H3,G3,j3,Pp,al,EA,Rp,Hi,ul,Bp=ge(()=>{c();V3="PARSE_ERROR",H3="INVALID_REQUEST",G3="METHOD_NOT_FOUND",j3="INVALID_PARAMS",Pp="INTERNAL_ERROR",al="SERVER_ERROR",EA=[-32700,-32600,-32601,-32602,-32603],Rp=[-32e3,-32099],Hi={[V3]:{code:-32700,message:"Parse error"},[H3]:{code:-32600,message:"Invalid Request"},[G3]:{code:-32601,message:"Method not found"},[j3]:{code:-32602,message:"Invalid params"},[Pp]:{code:-32603,message:"Internal error"},[al]:{code:-32e3,message:"Server error"}},ul=al});function b$(t){return t<=Rp[0]&&t>=Rp[1]}function Lp(t){return EA.includes(t)}function k3(t){return typeof t=="number"}function Fp(t){return Object.keys(Hi).includes(t)?Hi[t]:Hi[ul]}function Mp(t){let e=Object.values(Hi).find(r=>r.code===t);return e||Hi[ul]}function _$(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(!k3(t.error.code))return{valid:!1,error:`Invalid error code type for JSON-RPC: ${t.error.code}`};if(Lp(t.error.code)){let e=Mp(t.error.code);if(e.message!==Hi[ul].message&&t.error.message===e.message)return{valid:!1,error:`Invalid error code message for JSON-RPC: ${t.error.code}`}}return{valid:!0}}function vA(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var AA=ge(()=>{c();Bp()});var W3=m(Gi=>{"use strict";c();Object.defineProperty(Gi,"__esModule",{value:!0});Gi.isBrowserCryptoAvailable=Gi.getSubtleCrypto=Gi.getBrowerCrypto=void 0;function bA(){return(global===null||global===void 0?void 0:global.crypto)||(global===null||global===void 0?void 0:global.msCrypto)||{}}Gi.getBrowerCrypto=bA;function Q3(){let t=bA();return t.subtle||t.webkitSubtle}Gi.getSubtleCrypto=Q3;function I$(){return!!bA()&&!!Q3()}Gi.isBrowserCryptoAvailable=I$});var K3=m(ji=>{"use strict";c();Object.defineProperty(ji,"__esModule",{value:!0});ji.isBrowser=ji.isNode=ji.isReactNative=void 0;function z3(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}ji.isReactNative=z3;function $3(){return typeof p.default<"u"&&typeof p.default.versions<"u"&&typeof p.default.versions.node<"u"}ji.isNode=$3;function S$(){return!z3()&&!$3()}ji.isBrowser=S$});var _A=m(Up=>{"use strict";c();Object.defineProperty(Up,"__esModule",{value:!0});var Y3=(mr(),ct(yr));Y3.__exportStar(W3(),Up);Y3.__exportStar(K3(),Up)});var Ft={};ft(Ft,{isNodeJs:()=>X3});var J3,X3,Z3=ge(()=>{c();J3=_e(_A());Ht(Ft,_e(_A()));X3=J3.isNode});function IA(t=3){let e=Date.now()*Math.pow(10,t),r=Math.floor(Math.random()*Math.pow(10,t));return e+r}function SA(t=6){return BigInt(IA(t))}function TA(t,e,r){return{id:r||IA(),jsonrpc:"2.0",method:t,params:e}}function T$(t,e){return{id:t,jsonrpc:"2.0",result:e}}function CA(t,e,r){return{id:t,jsonrpc:"2.0",error:eR(e,r)}}function eR(t,e){return typeof t>"u"?Fp(Pp):(typeof t=="string"&&(t=Object.assign(Object.assign({},Fp(al)),{message:t})),typeof e<"u"&&(t.data=e),Lp(t.code)&&(t=Mp(t.code)),t)}var tR=ge(()=>{c();AA();Bp()});function C$(t){return t.includes("*")?Vp(t):!/\W/g.test(t)}function qp(t){return t==="*"}function Vp(t){return qp(t)?!0:!(!t.includes("*")||t.split("*").length!==2||t.split("*").filter(e=>e.trim()==="").length!==1)}function x$(t){return!qp(t)&&Vp(t)&&!t.split("*")[0].trim()}function N$(t){return!qp(t)&&Vp(t)&&!t.split("*")[1].trim()}var rR=ge(()=>{c()});var nR=ge(()=>{c()});var qa,xA=ge(()=>{c();qa=class{}});var NA,Hp,cl,iR=ge(()=>{c();xA();NA=class extends qa{constructor(e){super()}},Hp=class extends qa{constructor(){super()}},cl=class extends Hp{constructor(e){super()}}});var sR=ge(()=>{c()});var oR=ge(()=>{c();nR();xA();iR();sR()});var aR=ge(()=>{c();oR()});function P$(t){let e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function uR(t,e){let r=P$(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function R$(t){return uR(t,O$)}function Gp(t){return uR(t,D$)}function OA(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}var O$,D$,cR=ge(()=>{c();O$="^https?:",D$="^wss?:"});function DA(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function B$(t){return DA(t)&&"method"in t}function PA(t){return DA(t)&&(lR(t)||jp(t))}function lR(t){return"result"in t}function jp(t){return"error"in t}function L$(t){return"error"in t&&t.valid===!1}var fR=ge(()=>{c()});var Jt={};ft(Jt,{DEFAULT_ERROR:()=>ul,IBaseJsonRpcProvider:()=>Hp,IEvents:()=>qa,IJsonRpcConnection:()=>NA,IJsonRpcProvider:()=>cl,INTERNAL_ERROR:()=>Pp,INVALID_PARAMS:()=>j3,INVALID_REQUEST:()=>H3,METHOD_NOT_FOUND:()=>G3,PARSE_ERROR:()=>V3,RESERVED_ERROR_CODES:()=>EA,SERVER_ERROR:()=>al,SERVER_ERROR_CODE_RANGE:()=>Rp,STANDARD_ERROR_MAP:()=>Hi,formatErrorMessage:()=>eR,formatJsonRpcError:()=>CA,formatJsonRpcRequest:()=>TA,formatJsonRpcResult:()=>T$,getBigIntRpcId:()=>SA,getError:()=>Fp,getErrorByCode:()=>Mp,isHttpUrl:()=>R$,isJsonRpcError:()=>jp,isJsonRpcPayload:()=>DA,isJsonRpcRequest:()=>B$,isJsonRpcResponse:()=>PA,isJsonRpcResult:()=>lR,isJsonRpcValidationInvalid:()=>L$,isLocalhostUrl:()=>OA,isNodeJs:()=>X3,isReservedErrorCode:()=>Lp,isServerErrorCode:()=>b$,isValidDefaultRoute:()=>qp,isValidErrorCode:()=>k3,isValidLeadingWildcardRoute:()=>x$,isValidRoute:()=>C$,isValidTrailingWildcardRoute:()=>N$,isValidWildcardRoute:()=>Vp,isWsUrl:()=>Gp,parseConnectionError:()=>vA,payloadId:()=>IA,validateJsonRpcError:()=>_$});var ll=ge(()=>{c();Bp();AA();Z3();Ht(Jt,Ft);tR();rR();aR();cR();fR()});var hR,kp,dR,RA=ge(()=>{c();hR=_e(kn());ll();kp=class extends cl{constructor(e){super(e),this.events=new hR.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||[],e.id||SA().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=>{jp(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),PA(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)}},dR=kp});var pR={};ft(pR,{JsonRpcProvider:()=>kp,default:()=>F$});var F$,gR=ge(()=>{c();RA();RA();F$=dR});var mR=m((Npe,yR)=>{"use strict";c();yR.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}});var wR,ER,BA,vR=ge(()=>{c();wR=()=>typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:mR(),ER=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",BA=t=>t.split("?")[0]});var bR,AR,M$,Qp,_R,LA=ge(()=>{c();bR=_e(kn());Md();ll();vR();AR=10,M$=wR(),Qp=class{constructor(e){if(this.url=e,this.events=new bR.EventEmitter,this.registering=!1,!Gp(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(Fc(e))}catch(n){this.onError(e.id,n)}}register(e=this.url){if(!Gp(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:!OA(e)},s=new M$(e,[],i);ER()?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"?Lc(e.data):e.data;this.events.emit("payload",r)}onError(e,r){let n=this.parseError(r),i=n.message||n.toString(),s=CA(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return vA(e,BA(r),"WS")}resetMaxListeners(){this.events.getMaxListeners()>AR&&this.events.setMaxListeners(AR)}emitError(e){let r=this.parseError(new Error(e?.message||`WebSocket connection failed for host: ${BA(this.url)}`));return this.events.emit("register_error",r),r}},_R=Qp});var IR={};ft(IR,{WsConnection:()=>Qp,default:()=>U$});var U$,SR=ge(()=>{c();LA();LA();U$=_R});var o8=m((fl,Ha)=>{c();var q$=200,WA="__lodash_hash_undefined__",Zp=1,MR=2,UR=9007199254740991,Wp="[object Arguments]",qA="[object Array]",V$="[object AsyncFunction]",qR="[object Boolean]",VR="[object Date]",HR="[object Error]",GR="[object Function]",H$="[object GeneratorFunction]",zp="[object Map]",jR="[object Number]",G$="[object Null]",Va="[object Object]",TR="[object Promise]",j$="[object Proxy]",kR="[object RegExp]",$p="[object Set]",QR="[object String]",k$="[object Symbol]",Q$="[object Undefined]",VA="[object WeakMap]",WR="[object ArrayBuffer]",Kp="[object DataView]",W$="[object Float32Array]",z$="[object Float64Array]",$$="[object Int8Array]",K$="[object Int16Array]",Y$="[object Int32Array]",J$="[object Uint8Array]",X$="[object Uint8ClampedArray]",Z$="[object Uint16Array]",eK="[object Uint32Array]",tK=/[\\^$.*+?()[\]{}|]/g,rK=/^\[object .+?Constructor\]$/,nK=/^(?:0|[1-9]\d*)$/,rt={};rt[W$]=rt[z$]=rt[$$]=rt[K$]=rt[Y$]=rt[J$]=rt[X$]=rt[Z$]=rt[eK]=!0;rt[Wp]=rt[qA]=rt[WR]=rt[qR]=rt[Kp]=rt[VR]=rt[HR]=rt[GR]=rt[zp]=rt[jR]=rt[Va]=rt[kR]=rt[$p]=rt[QR]=rt[VA]=!1;var zR=typeof global=="object"&&global&&global.Object===Object&&global,iK=typeof self=="object"&&self&&self.Object===Object&&self,ti=zR||iK||Function("return this")(),$R=typeof fl=="object"&&fl&&!fl.nodeType&&fl,CR=$R&&typeof Ha=="object"&&Ha&&!Ha.nodeType&&Ha,KR=CR&&CR.exports===$R,FA=KR&&zR.process,xR=function(){try{return FA&&FA.binding&&FA.binding("util")}catch{}}(),NR=xR&&xR.isTypedArray;function sK(t,e){for(var r=-1,n=t==null?0:t.length,i=0,s=[];++r-1}function LK(t,e){var r=this.__data__,n=tg(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}ri.prototype.clear=DK;ri.prototype.delete=PK;ri.prototype.get=RK;ri.prototype.has=BK;ri.prototype.set=LK;function $s(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&MR?new Jp:void 0;for(s.set(t,e),s.set(e,t);++f-1&&t%1==0&&t-1&&t%1==0&&t<=UR}function i8(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}function pl(t){return t!=null&&typeof t=="object"}var s8=NR?cK(NR):XK;function hY(t){return lY(t)?$K(t):ZK(t)}function dY(){return[]}function pY(){return!1}Ha.exports=fY});var l6=m(me=>{"use strict";c();Object.defineProperty(me,"__esModule",{value:!0});var Ys=kn(),gY=OO(),ml=WO(),We=xv(),ii=Wv(),a8=(Md(),ct(o2)),yY=(OD(),ct(ND)),ee=ol(),mY=(J1(),ct(Y1)),Ge=Ms(),wY=(gR(),ct(pR)),vr=(ll(),ct(Jt)),EY=(SR(),ct(IR)),vY=o8();function yg(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}function AY(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 bY=yg(Ys),_Y=yg(gY),ng=AY(yY),IY=yg(EY),SY=yg(vY);function TY(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=E[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 T=I-O;T!==I&&S[T]===0;)T++;for(var L=u.repeat(x);T>>0,I=new Uint8Array(_);E[x];){var S=r[E.charCodeAt(x)];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,x++}if(E[x]!==" "){for(var b=_-F;b!==_&&I[b]===0;)b++;for(var T=new Uint8Array(O+(_-b)),L=O;b!==_;)T[L++]=I[b++];return T}}}function w(E){var x=g(E);if(x)return x;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:g,decode:w}}var CY=TY,xY=CY,I8=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")},NY=t=>new TextEncoder().encode(t),OY=t=>new TextDecoder().decode(t),KA=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")}},YA=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 S8(this,e)}},JA=class{constructor(e){this.decoders=e}or(e){return S8(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`)}},S8=(t,e)=>new JA({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),XA=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new KA(e,r,n),this.decoder=new YA(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},mg=({name:t,prefix:e,encode:r,decode:n})=>new XA(t,e,r,n),wl=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=xY(r,e);return mg({prefix:t,name:e,encode:n,decode:s=>I8(i(s))})},DY=(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},PY=(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<mg({prefix:e,name:t,encode(i){return PY(i,n,r)},decode(i){return DY(i,n,r,t)}}),RY=mg({prefix:"\0",name:"identity",encode:t=>OY(t),decode:t=>NY(t)}),BY=Object.freeze({__proto__:null,identity:RY}),LY=jt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),FY=Object.freeze({__proto__:null,base2:LY}),MY=jt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),UY=Object.freeze({__proto__:null,base8:MY}),qY=wl({prefix:"9",name:"base10",alphabet:"0123456789"}),VY=Object.freeze({__proto__:null,base10:qY}),HY=jt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),GY=jt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),jY=Object.freeze({__proto__:null,base16:HY,base16upper:GY}),kY=jt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),QY=jt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),WY=jt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),zY=jt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),$Y=jt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),KY=jt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),YY=jt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),JY=jt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),XY=jt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),ZY=Object.freeze({__proto__:null,base32:kY,base32upper:QY,base32pad:WY,base32padupper:zY,base32hex:$Y,base32hexupper:KY,base32hexpad:YY,base32hexpadupper:JY,base32z:XY}),eJ=wl({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),tJ=wl({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),rJ=Object.freeze({__proto__:null,base36:eJ,base36upper:tJ}),nJ=wl({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),iJ=wl({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),sJ=Object.freeze({__proto__:null,base58btc:nJ,base58flickr:iJ}),oJ=jt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),aJ=jt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),uJ=jt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),cJ=jt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),lJ=Object.freeze({__proto__:null,base64:oJ,base64pad:aJ,base64url:uJ,base64urlpad:cJ}),T8=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}"),fJ=T8.reduce((t,e,r)=>(t[r]=e,t),[]),hJ=T8.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function dJ(t){return t.reduce((e,r)=>(e+=fJ[r],e),"")}function pJ(t){let e=[];for(let r of t){let n=hJ[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var gJ=mg({prefix:"\u{1F680}",name:"base256emoji",encode:dJ,decode:pJ}),yJ=Object.freeze({__proto__:null,base256emoji:gJ}),mJ=C8,u8=128,wJ=127,EJ=~wJ,vJ=Math.pow(2,31);function C8(t,e,r){e=e||[],r=r||0;for(var n=r;t>=vJ;)e[r++]=t&255|u8,t/=128;for(;t&EJ;)e[r++]=t&255|u8,t>>>=7;return e[r]=t|0,C8.bytes=r-n+1,e}var AJ=ZA,bJ=128,c8=127;function ZA(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw ZA.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&c8)<=bJ);return ZA.bytes=s-n,r}var _J=Math.pow(2,7),IJ=Math.pow(2,14),SJ=Math.pow(2,21),TJ=Math.pow(2,28),CJ=Math.pow(2,35),xJ=Math.pow(2,42),NJ=Math.pow(2,49),OJ=Math.pow(2,56),DJ=Math.pow(2,63),PJ=function(t){return t<_J?1:t(x8.encode(t,e,r),e),f8=t=>x8.encodingLength(t),eb=(t,e)=>{let r=e.byteLength,n=f8(t),i=n+f8(r),s=new Uint8Array(i+r);return l8(t,s,0),l8(r,s,n),s.set(e,i),new tb(t,r,e,s)},tb=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}},N8=({name:t,code:e,encode:r})=>new rb(t,e,r),rb=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?eb(this.code,r):r.then(n=>eb(this.code,n))}else throw Error("Unknown type, must be binary type")}},O8=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),BJ=N8({name:"sha2-256",code:18,encode:O8("SHA-256")}),LJ=N8({name:"sha2-512",code:19,encode:O8("SHA-512")}),FJ=Object.freeze({__proto__:null,sha256:BJ,sha512:LJ}),D8=0,MJ="identity",P8=I8,UJ=t=>eb(D8,P8(t)),qJ={code:D8,name:MJ,encode:P8,digest:UJ},VJ=Object.freeze({__proto__:null,identity:qJ});new TextEncoder,new TextDecoder;var h8={...BY,...FY,...UY,...VY,...jY,...ZY,...rJ,...sJ,...lJ,...yJ};({...FJ,...VJ});function R8(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function HJ(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?R8(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function B8(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var d8=B8("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),zA=B8("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);let e=HJ(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)}}},og=class{constructor(e,r,n){this.core=e,this.logger=r,this.name=U8,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=ng.generateKeyPair(i);return ng.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=ng.generateKeyPair(s),a=ee.generateRandomBytes32(),u=q8;return await ng.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=a8.safeJsonStringify(s);if(ee.isTypeOneEnvelope(a)){let g=a.senderPublicKey,w=a.receiverPublicKey;i=await this.generateSharedKey(g,w)}let l=this.getSymKey(i),{type:f,senderPublicKey:d}=a;return ee.encrypt({type:f,symKey:l,message:u,senderPublicKey:d})},this.decode=async(i,s,o)=>{this.isInitialized();let a=ee.validateDecoding(s,o);if(ee.isTypeOneEnvelope(a)){let u=a.receiverPublicKey,l=a.senderPublicKey;i=await this.generateSharedKey(u,l)}try{let u=this.getSymKey(i),l=ee.decrypt({symKey:u,encoded:s});return a8.safeJsonParse(l)}catch(u){this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`),this.logger.error(u)}},this.getPayloadType=i=>{let s=ee.deserialize(i);return ee.decodeTypeByte(s.type)},this.getPayloadSenderPublicKey=i=>{let s=ee.deserialize(i);return s.senderPublicKey?mY.toString(s.senderPublicKey,ee.BASE16):void 0},this.core=e,this.logger=We.generateChildLogger(r,this.name),this.keychain=n||new sg(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(nb)}catch{e=ee.generateRandomBytes32(),await this.keychain.set(nb,e)}return jJ(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)}}},ag=class extends ii.IMessageTracker{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=G8,this.version=j8,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)}}},ob=class extends ii.IPublisher{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new Ys.EventEmitter,this.name=Q8,this.queue=new Map,this.publishTimeout=Ge.toMiliseconds(Ge.TEN_SECONDS),this.queueTimeout=Ge.toMiliseconds(Ge.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||k8,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(ml.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())})}},ab=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())}},$J=Object.defineProperty,KJ=Object.defineProperties,YJ=Object.getOwnPropertyDescriptors,p8=Object.getOwnPropertySymbols,JJ=Object.prototype.hasOwnProperty,XJ=Object.prototype.propertyIsEnumerable,g8=(t,e,r)=>e in t?$J(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,yl=(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},$A=(t,e)=>KJ(t,YJ(e)),ug=class extends ii.ISubscriber{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new ab,this.events=new Ys.EventEmitter,this.name=t6,this.version=r6,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 Ge.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)>=n6&&(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,$A(yl({},r),{id:e})),this.pending.delete(r.topic)}onBatchSubscribe(e){e.length&&e.forEach(r=>{this.setSubscription(r.id,yl({},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,yl({},r)),this.topicMap.set(r.topic,e),this.events.emit(Kr.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(Kr.deleted,$A(yl({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Kr.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)=>$A(yl({},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(ml.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(Kr.created,async e=>{let r=Kr.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()}),this.events.on(Kr.deleted,async e=>{let r=Kr.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)})}},ZJ=Object.defineProperty,y8=Object.getOwnPropertySymbols,eX=Object.prototype.hasOwnProperty,tX=Object.prototype.propertyIsEnumerable,m8=(t,e,r)=>e in t?ZJ(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,rX=(t,e)=>{for(var r in e||(e={}))eX.call(e,r)&&m8(t,r,e[r]);if(y8)for(var r of y8(e))tX.call(e,r)&&m8(t,r,e[r]);return t},cg=class extends ii.IRelayer{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new Ys.EventEmitter,this.name=$8,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||z8})),this.messages=new ag(this.logger,e.core),this.subscriber=new ug(this,this.logger),this.publisher=new ob(this,this.logger),this.relayUrl=e?.relayUrl||cb,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 ${ib}...`),await this.restartTransport(ib)}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)},X8)}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(Kr.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(Kr.resubscribed,()=>{r()})}),await Promise.race([new Promise(async(r,n)=>{await ee.createExpiringPromise(this.provider.connect(),1e4,`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 wY.JsonRpcProvider(new IY.default(ee.formatRelayRpcUrl({sdkVersion:J8,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;if(!n||n.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isSubscribed(r))return this.logger.debug(`Ignoring message for non-subscribed topic ${r}`),!0;let i=this.messages.has(r,n);return i&&this.logger.debug(`Ignoring duplicate message: ${n}`),i}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),vr.isJsonRpcRequest(e)){if(!e.method.endsWith(K8))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(rX({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()},Ge.toMiliseconds(Y8))}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()}}},nX=Object.defineProperty,w8=Object.getOwnPropertySymbols,iX=Object.prototype.hasOwnProperty,sX=Object.prototype.propertyIsEnumerable,E8=(t,e,r)=>e in t?nX(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,v8=(t,e)=>{for(var r in e||(e={}))iX.call(e,r)&&E8(t,r,e[r]);if(w8)for(var r of w8(e))sX.call(e,r)&&E8(t,r,e[r]);return t},lg=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=Z8,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=>SY.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=v8(v8({},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)}}},fg=class{constructor(e,r){this.core=e,this.logger=r,this.name=i6,this.version=s6,this.events=new bY.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(Ge.FIVE_MINUTES),o={protocol:W8},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(Ge.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(Ge.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=ka[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=ka[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=ka[u.request.method]?ka[u.request.method].res:ka.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;switch(s.method){case"wc_pairingPing":return this.onPairingPingRequest(i,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(i,s);default:return this.onUnknownRpcMethodRequest(i,s)}},this.onRelayEventResponse=async n=>{let{topic:i,payload:s}=n,o=(await this.core.history.get(i,s.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(i,s);default:return this.onUnknownRpcMethodResponse(o)}},this.onPairingPingRequest=async(n,i)=>{let{id:s}=i;try{this.isValidPing({topic:n}),await this.sendResult(s,n,!0),this.events.emit("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 lg(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.pairings.keys.includes(r)||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(Ur.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}))})}},hg=class extends ii.IJsonRpcHistory{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new Ys.EventEmitter,this.name=o6,this.version=a6,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(Ge.THIRTY_DAYS)};this.records.set(o.id,o),this.events.emit($r.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($r.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($r.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($r.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($r.created,e=>{let r=$r.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.events.on($r.updated,e=>{let r=$r.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.events.on($r.deleted,e=>{let r=$r.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.core.heartbeat.on(ml.HEARTBEAT_EVENTS.pulse,()=>{this.cleanup()})}cleanup(){try{this.records.forEach(e=>{Ge.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)}}},dg=class extends ii.IExpirer{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new Ys.EventEmitter,this.name=u6,this.version=c6,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(Ur.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(Ur.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(Ur.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;Ge.toMiliseconds(n)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(Ur.expired,{target:e,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(ml.HEARTBEAT_EVENTS.pulse,()=>this.checkExpirations()),this.events.on(Ur.created,e=>{let r=Ur.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Ur.expired,e=>{let r=Ur.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Ur.deleted,e=>{let r=Ur.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)}}},pg=class extends ii.IVerify{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.name=ig,this.initialized=!1,this.init=async n=>{ee.isReactNative()||!ee.isBrowser()||(this.verifyUrl=n?.verifyUrl||sb,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(Ge.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(ig))return n();let s=document.createElement("iframe");s.setAttribute("id",ig),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"),Ge.toMiliseconds(Ge.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=sb,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(),Ge.toMiliseconds(e))}},oX=Object.defineProperty,A8=Object.getOwnPropertySymbols,aX=Object.prototype.hasOwnProperty,uX=Object.prototype.propertyIsEnumerable,b8=(t,e,r)=>e in t?oX(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,_8=(t,e)=>{for(var r in e||(e={}))aX.call(e,r)&&b8(t,r,e[r]);if(A8)for(var r of A8(e))uX.call(e,r)&&b8(t,r,e[r]);return t},gg=class t extends ii.ICore{constructor(e){super(e),this.protocol=ub,this.version=L8,this.name=wg,this.events=new Ys.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||cb;let r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:We.pino(We.getDefaultLoggerOptions({level:e?.logger||F8.logger}));this.logger=We.generateChildLogger(r,this.name),this.heartbeat=new ml.HeartBeat,this.crypto=new og(this,this.logger,e?.keychain),this.history=new hg(this,this.logger),this.expirer=new dg(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new _Y.default(_8(_8({},M8),e?.storageOptions)),this.relayer=new cg({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new fg(this,this.logger),this.verify=new pg(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(e6,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}}},cX=gg;me.CORE_CONTEXT=wg,me.CORE_DEFAULT=F8,me.CORE_PROTOCOL=ub,me.CORE_STORAGE_OPTIONS=M8,me.CORE_STORAGE_PREFIX=ni,me.CORE_VERSION=L8,me.CRYPTO_CLIENT_SEED=nb,me.CRYPTO_CONTEXT=U8,me.CRYPTO_JWT_TTL=q8,me.Core=cX,me.Crypto=og,me.EXPIRER_CONTEXT=u6,me.EXPIRER_DEFAULT_TTL=zJ,me.EXPIRER_EVENTS=Ur,me.EXPIRER_STORAGE_VERSION=c6,me.Expirer=dg,me.HISTORY_CONTEXT=o6,me.HISTORY_EVENTS=$r,me.HISTORY_STORAGE_VERSION=a6,me.JsonRpcHistory=hg,me.KEYCHAIN_CONTEXT=V8,me.KEYCHAIN_STORAGE_VERSION=H8,me.KeyChain=sg,me.MESSAGES_CONTEXT=G8,me.MESSAGES_STORAGE_VERSION=j8,me.MessageTracker=ag,me.PAIRING_CONTEXT=i6,me.PAIRING_DEFAULT_TTL=WJ,me.PAIRING_RPC_OPTS=ka,me.PAIRING_STORAGE_VERSION=s6,me.PENDING_SUB_RESOLUTION_TIMEOUT=n6,me.PUBLISHER_CONTEXT=Q8,me.PUBLISHER_DEFAULT_TTL=k8,me.Pairing=fg,me.RELAYER_CONTEXT=$8,me.RELAYER_DEFAULT_LOGGER=z8,me.RELAYER_DEFAULT_PROTOCOL=W8,me.RELAYER_DEFAULT_RELAY_URL=cb,me.RELAYER_EVENTS=Pt,me.RELAYER_FAILOVER_RELAY_URL=ib,me.RELAYER_PROVIDER_EVENTS=ja,me.RELAYER_RECONNECT_TIMEOUT=Y8,me.RELAYER_SDK_VERSION=J8,me.RELAYER_STORAGE_OPTIONS=kJ,me.RELAYER_SUBSCRIBER_SUFFIX=K8,me.RELAYER_TRANSPORT_CUTOFF=X8,me.Relayer=cg,me.STORE_STORAGE_VERSION=Z8,me.SUBSCRIBER_CONTEXT=t6,me.SUBSCRIBER_DEFAULT_TTL=QJ,me.SUBSCRIBER_EVENTS=Kr,me.SUBSCRIBER_STORAGE_VERSION=r6,me.Store=lg,me.Subscriber=ug,me.VERIFY_CONTEXT=ig,me.VERIFY_SERVER=sb,me.Verify=pg,me.WALLETCONNECT_CLIENT_ID=e6,me.default=gg});var b6=m(Je=>{"use strict";c();Object.defineProperty(Je,"__esModule",{value:!0});var xn=l6(),Eg=xv(),d6=Wv(),Q=ol(),p6=kn(),Xe=Ms(),St=(ll(),ct(Jt));function lX(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var fX=lX(p6),gb="wc",yb=2,mb="client",_g=`${gb}@${yb}:${mb}:`,vg={name:mb,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},hX={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"},dX={database:":memory:"},g6="WALLETCONNECT_DEEPLINK_CHOICE",pX={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},gX="history",yX="0.3",y6="proposal",mX=Xe.THIRTY_DAYS,m6="Proposal expired",w6="session",El=Xe.SEVEN_DAYS,E6="engine",Qa={wc_sessionPropose:{req:{ttl:Xe.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:Xe.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:Xe.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:Xe.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:Xe.ONE_DAY,prompt:!1,tag:1104},res:{ttl:Xe.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:Xe.ONE_DAY,prompt:!1,tag:1106},res:{ttl:Xe.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:Xe.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:Xe.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:Xe.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:Xe.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:Xe.ONE_DAY,prompt:!1,tag:1112},res:{ttl:Xe.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:Xe.THIRTY_SECONDS,prompt:!1,tag:1114},res:{ttl:Xe.THIRTY_SECONDS,prompt:!1,tag:1115}}},Ag={min:Xe.FIVE_MINUTES,max:Xe.SEVEN_DAYS},Wa={idle:"idle",active:"active"},v6="request",A6=["wc_sessionPropose","wc_sessionRequest","wc_authRequest"],wX=Object.defineProperty,EX=Object.defineProperties,vX=Object.getOwnPropertyDescriptors,f6=Object.getOwnPropertySymbols,AX=Object.prototype.hasOwnProperty,bX=Object.prototype.propertyIsEnumerable,h6=(t,e,r)=>e in t?wX(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,qr=(t,e)=>{for(var r in e||(e={}))AX.call(e,r)&&h6(t,r,e[r]);if(f6)for(var r of f6(e))bX.call(e,r)&&h6(t,r,e[r]);return t},lb=(t,e)=>EX(t,vX(e)),fb=class extends d6.IEngine{constructor(e){super(e),this.name=E6,this.events=new fX.default,this.initialized=!1,this.ignoredPayloadTypes=[Q.TYPE_1],this.requestQueue={state:Wa.idle,requests:[]},this.requestQueueDelay=Xe.ONE_SECOND,this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.client.core.pairing.register({methods:Object.keys(Qa)}),this.initialized=!0,setTimeout(()=>{this.requestQueue.requests=this.getPendingSessionRequests(),this.processRequestQueue()},Xe.toMiliseconds(this.requestQueueDelay)))},this.connect=async r=>{this.isInitialized();let n=lb(qr({},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(),w=qr({requiredNamespaces:s,optionalNamespaces:o,relays:u??[{protocol:xn.RELAYER_DEFAULT_PROTOCOL}],proposer:{publicKey:g,metadata:this.client.metadata}},a&&{sessionProperties:a}),{reject:E,resolve:x,done:O}=Q.createDelayedPromise(Xe.FIVE_MINUTES,m6);if(this.events.once(Q.engineEvent("session_connect"),async({error:I,session:S})=>{if(I)E(I);else if(S){S.self.publicKey=g;let R=lb(qr({},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}),x(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",w),_=Q.calcExpiry(Xe.FIVE_MINUTES);return await this.setProposal(F,qr({id:F,expiry:_},w)),{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(),w=l.publicKey,E=await this.client.core.crypto.generateSharedKey(g,w);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 x=qr({relay:{protocol:i??"irn"},namespaces:s,requiredNamespaces:f,optionalNamespaces:d,pairingTopic:u,controller:{publicKey:g,metadata:this.client.metadata},expiry:Q.calcExpiry(El)},o&&{sessionProperties:o});await this.client.core.relayer.subscribe(E),await this.sendRequest(E,"wc_sessionSettle",x);let O=lb(qr({},x),{topic:E,pairingTopic:u,acknowledged:!1,self:x.controller,peer:{publicKey:l.publicKey,metadata:l.metadata},controller:g});return await this.client.session.set(E,O),await this.setExpiry(E,Q.calcExpiry(El)),{topic:E,acknowledged:()=>new Promise(F=>setTimeout(()=>F(this.client.session.get(E)),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(El)),{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:w})=>{g?f(g):l(w)}),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:a});let d=await this.client.core.storage.getItem(g6);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.cleanupAfterResponse(r)},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.requestQueue.requests=this.requestQueue.requests.filter(s=>s.id!==r),i&&(this.requestQueue.state=Wa.idle)},this.setExpiry=async(r,n)=>{this.client.session.keys.includes(r)&&await this.client.session.update(r,{expiry:n}),this.client.core.expirer.set(r,n)},this.setProposal=async(r,n)=>{await this.client.proposal.set(r,n),this.client.core.expirer.set(r,n.expiry)},this.setPendingSessionRequest=async r=>{let n=Qa.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()&&A6.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=Qa[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=Qa[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=Qa[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(qr({},n.params));let o=Q.calcExpiry(Xe.FIVE_MINUTES),a=qr({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:w}=n.params,E=qr({topic:r,relay:o,expiry:u,namespaces:l,acknowledged:!0,pairingTopic:w,requiredNamespaces:f,optionalNamespaces:d,controller:a.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}},g&&{sessionProperties:g});await this.sendResult(n.id,r,!0),this.events.emit(Q.engineEvent("session_connect"),{session:E}),this.cleanupDuplicatePairings(E)}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.onSessionSettleResponse=async(r,n)=>{let{id:i}=n;St.isJsonRpcResult(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(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(qr({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(El)),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(qr({topic:r},s)),await this.setPendingSessionRequest({id:i,topic:r,params:s}),this.addRequestToQueue({id:i,topic:r,params:s}),await this.processRequestQueue()}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(qr({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.addRequestToQueue=r=>{this.requestQueue.requests.push(r)},this.cleanupAfterResponse=r=>{this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.requestQueue.state=Wa.idle,this.processRequestQueue()},Xe.toMiliseconds(this.requestQueueDelay))},this.processRequestQueue=async()=>{if(this.requestQueue.state===Wa.active){this.client.logger.info("session request queue is already active.");return}let r=this.requestQueue.requests[0];if(!r){this.client.logger.info("session request queue is empty.");return}try{let{id:n,topic:i,params:s}=r,o=Q.hashMessage(JSON.stringify({id:n,params:s})),a=this.client.session.get(i),u=await this.getVerifyContext(o,a.peer.metadata);this.requestQueue.state=Wa.active,this.client.events.emit("session_request",{id:n,topic:i,params:s,verifyContext:u})}catch(n){this.client.logger.error(n)}},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,Ag)){let{message:u}=Q.getInternalError("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${Ag.min} and ${Ag.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)}}},hb=class extends xn.Store{constructor(e,r){super(e,r,y6,_g),this.core=e,this.logger=r}},db=class extends xn.Store{constructor(e,r){super(e,r,w6,_g),this.core=e,this.logger=r}},pb=class extends xn.Store{constructor(e,r){super(e,r,v6,_g,n=>n.id),this.core=e,this.logger=r}},bg=class t extends d6.ISignClient{constructor(e){super(e),this.protocol=gb,this.version=yb,this.name=vg.name,this.events=new p6.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||vg.name,this.metadata=e?.metadata||Q.getAppMetadata();let r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:Eg.pino(Eg.getDefaultLoggerOptions({level:e?.logger||vg.logger}));this.core=e?.core||new xn.Core(e),this.logger=Eg.generateChildLogger(r,this.name),this.session=new db(this.core,this.logger),this.proposal=new hb(this.core,this.logger),this.pendingRequest=new pb(this.core,this.logger),this.engine=new fb(this)}static async init(e){let r=new t(e);return await r.initialize(),r}get context(){return Eg.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}}},_X=bg;Je.ENGINE_CONTEXT=E6,Je.ENGINE_RPC_OPTS=Qa,Je.HISTORY_CONTEXT=gX,Je.HISTORY_EVENTS=pX,Je.HISTORY_STORAGE_VERSION=yX,Je.METHODS_TO_VERIFY=A6,Je.PROPOSAL_CONTEXT=y6,Je.PROPOSAL_EXPIRY=mX,Je.PROPOSAL_EXPIRY_MESSAGE=m6,Je.REQUEST_CONTEXT=v6,Je.REQUEST_QUEUE_STATES=Wa,Je.SESSION_CONTEXT=w6,Je.SESSION_EXPIRY=El,Je.SESSION_REQUEST_EXPIRY_BOUNDARIES=Ag,Je.SIGN_CLIENT_CONTEXT=mb,Je.SIGN_CLIENT_DEFAULT=vg,Je.SIGN_CLIENT_EVENTS=hX,Je.SIGN_CLIENT_PROTOCOL=gb,Je.SIGN_CLIENT_STORAGE_OPTIONS=dX,Je.SIGN_CLIENT_STORAGE_PREFIX=_g,Je.SIGN_CLIENT_VERSION=yb,Je.SignClient=_X,Je.WALLETCONNECT_DEEPLINK_CHOICE=g6,Je.default=bg});var Ig=m(Wi=>{"use strict";c();Object.defineProperty(Wi,"__esModule",{value:!0});Wi.OptionalOperation=Wi.Operation=void 0;var IX;(function(t){t.SIGN_TRANSACTION="mvx_signTransaction",t.SIGN_TRANSACTIONS="mvx_signTransactions",t.SIGN_MESSAGE="mvx_signMessage"})(IX=Wi.Operation||(Wi.Operation={}));var SX;(function(t){t.SIGN_LOGIN_TOKEN="mvx_signLoginToken",t.SIGN_NATIVE_AUTH_TOKEN="mvx_signNativeAuthToken",t.CANCEL_ACTION="mvx_cancelAction"})(SX=Wi.OptionalOperation||(Wi.OptionalOperation={}))});var wb=m(zi=>{"use strict";c();Object.defineProperty(zi,"__esModule",{value:!0});zi.WALLETCONNECT_MULTIVERSX_OPTIONAL_METHODS=zi.WALLETCONNECT_MULTIVERSX_METHODS=zi.WALLETCONNECT_MULTIVERSX_NAMESPACE=void 0;var _6=Ig();zi.WALLETCONNECT_MULTIVERSX_NAMESPACE="mvx";zi.WALLETCONNECT_MULTIVERSX_METHODS=Object.values(_6.Operation);zi.WALLETCONNECT_MULTIVERSX_OPTIONAL_METHODS=Object.values(_6.OptionalOperation)});var Ab=m(Yr=>{"use strict";c();Object.defineProperty(Yr,"__esModule",{value:!0});Yr.WalletConnectV2ProviderErrorMessagesEnum=Yr.ErrBadAddress=Yr.ErrNotImplemented=Yr.Err=void 0;var vl=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};Yr.Err=vl;var Eb=class extends vl{constructor(){super("Method not yet implemented")}};Yr.ErrNotImplemented=Eb;var vb=class extends vl{constructor(e,r){super(`Bad address: ${e}`,r)}};Yr.ErrBadAddress=vb;var TX;(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"})(TX=Yr.WalletConnectV2ProviderErrorMessagesEnum||(Yr.WalletConnectV2ProviderErrorMessagesEnum={}))});var _b=m(Sg=>{"use strict";c();Object.defineProperty(Sg,"__esModule",{value:!0});Sg.Logger=void 0;var bb=class{static error(e){console.error(e)}static trace(e){console.trace(e)}};Sg.Logger=bb});var I6=m(()=>{"use strict";c();global.Buffer||(global.Buffer=Ts().Buffer)});var T6=m(S6=>{"use strict";c();Object.defineProperty(S6,"__esModule",{value:!0})});var x6=m(C6=>{"use strict";c();Object.defineProperty(C6,"__esModule",{value:!0})});var N6=m(za=>{"use strict";c();var CX=za&&za.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(za,"__esModule",{value:!0});za.RelayedTransactionV1Builder=void 0;var xX=CX(Gt()),Ib=ht(),NX=Be(),OX=mn(),DX=qn(),Sb=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 NX.ErrInvalidRelayedV1BuilderArguments;let e=this.prepareInnerTransaction(),r=`relayedTx@${h.Buffer.from(e).toString("hex")}`,n=new DX.TransactionPayload(r),i=this.netConfig.MinGasLimit+this.netConfig.GasPerDataByte*n.length()+this.innerTransaction.getGasLimit().valueOf(),s=new OX.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 Ib.Address(this.innerTransaction.getSender().bech32()).pubkey().toString("base64"),receiver:new Ib.Address(this.innerTransaction.getReceiver().bech32()).pubkey().toString("base64"),value:new xX.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 Ib.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)}};za.RelayedTransactionV1Builder=Sb});var O6=m(Tg=>{"use strict";c();Object.defineProperty(Tg,"__esModule",{value:!0});Tg.Code=void 0;var Tb=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")}};Tg.Code=Tb});var P6=m(D6=>{"use strict";c();Object.defineProperty(D6,"__esModule",{value:!0})});var F6=m(Ka=>{"use strict";c();Object.defineProperty(Ka,"__esModule",{value:!0});Ka.bech32m=Ka.bech32=void 0;var Cg="qpzry9x8gf2tvdw0s3jn54khce6mua7l",B6={};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 R6(t){let e=1;for(let r=0;r126)return"Invalid prefix ("+t+")";e=$a(e)^n>>5}e=$a(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=R6(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=$a(l)^g,f+=Cg.charAt(g)}for(let d=0;d<6;++d)l=$a(l);l^=e;for(let d=0;d<6;++d){let g=l>>(5-d)*5&31;f+=Cg.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 w=R6(d);if(typeof w=="string")return w;let E=[];for(let x=0;x=g.length)&&E.push(F)}return w!==e?"Invalid checksum for "+o:{prefix:d,words:E}}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:PX,fromWordsUnsafe:RX,fromWords:BX}}Ka.bech32=L6("bech32");Ka.bech32m=L6("bech32m")});var U6=m(Vr=>{"use strict";c();Object.defineProperty(Vr,"__esModule",{value:!0});Vr.TokenTransferProperties=Vr.TransactionMetadataTransfer=Vr.TransactionMetadata=Vr.TransactionToDecode=Vr.TransactionDecoder=void 0;var M6=F6(),xb=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 Js;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 xg;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 Js;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 Js;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 Js;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=M6.bech32.toWords(r);return M6.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)}};Vr.TransactionDecoder=xb;var xg=class{constructor(){this.sender="",this.receiver="",this.data="",this.value="0"}};Vr.TransactionToDecode=xg;var Js=class{constructor(){this.sender="",this.receiver="",this.value=BigInt(0)}};Vr.TransactionMetadata=Js;var Nb=class{constructor(){this.value=BigInt(0)}};Vr.TransactionMetadataTransfer=Nb;var Ob=class{};Vr.TokenTransferProperties=Ob});var Db=m(Ng=>{"use strict";c();Object.defineProperty(Ng,"__esModule",{value:!0});Ng.ReturnCode=void 0;var je=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)}};Ng.ReturnCode=je;je.None=new je("");je.Ok=new je("ok");je.FunctionNotFound=new je("function not found");je.FunctionWrongSignature=new je("wrong signature for function");je.ContractNotFound=new je("contract not found");je.UserError=new je("user error");je.OutOfGas=new je("out of gas");je.AccountCollision=new je("account collision");je.OutOfFunds=new je("out of funds");je.CallStackOverFlow=new je("call stack overflow");je.ContractInvalid=new je("contract invalid");je.ExecutionFailed=new je("execution failed");je.Unknown=new je("unknown")});var H6=m(Og=>{"use strict";c();Object.defineProperty(Og,"__esModule",{value:!0});Og.ResultsParser=void 0;var LX=U6(),q6=ht(),V6=Be(),$i=Jo(),FX=Vo(),Ya=Db(),Ja;(function(t){t.OnTransactionCompleted="completedTxEvent",t.OnSignalError="signalError",t.OnWriteLog="writeLog"})(Ja||(Ja={}));var Pb;(function(t){t.TooMuchGas="@too much gas provided for processing"})(Pb||(Pb={}));var MX={argsSerializer:new FX.ArgSerializer},Rb=class{constructor(e){e=Object.assign(Object.assign({},MX),e),this.argsSerializer=e.argsSerializer}parseQueryResponse(e,r){let n=e.getReturnDataParts(),i=this.argsSerializer.buffersToValues(n,r.output);return{returnCode:new Ya.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 Ya.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 $i.Logger.trace("parseUntypedOutcome(): on simple move balance"),r;if(r=this.createBundleOnInvalidTransaction(e),r)return $i.Logger.trace("parseUntypedOutcome(): on invalid transaction"),r;if(r=this.createBundleOnEasilyFoundResultWithReturnData(e.contractResults),r)return $i.Logger.trace("parseUntypedOutcome(): on easily found result with return data"),r;if(r=this.createBundleOnSignalError(e.logs),r)return $i.Logger.trace("parseUntypedOutcome(): on signal error"),r;if(r=this.createBundleOnTooMuchGasWarning(e.logs),r)return $i.Logger.trace("parseUntypedOutcome(): on 'too much gas' warning"),r;if(r=this.createBundleOnWriteLogWhereFirstTopicEqualsAddress(e.logs,e.sender),r)return $i.Logger.trace("parseUntypedOutcome(): on writelog with topics[0] == tx.sender"),r;if(r=this.createBundleWithCustomHeuristics(e,n),r)return $i.Logger.trace("parseUntypedOutcome(): with custom heuristics"),r;if(r=this.createBundleWithFallbackHeuristics(e,n),r)return $i.Logger.trace("parseUntypedOutcome(): with fallback heuristics"),r;throw new V6.ErrCannotParseContractResults(`transaction ${e.hash.toString()}`)}parseTransactionMetadata(e){return new LX.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:Ya.ReturnCode.None,returnMessage:Ya.ReturnCode.None.toString(),values:[]}:null}createBundleOnInvalidTransaction(e){return e.status.isInvalid()&&e.receipt.data?{returnCode:Ya.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(Ja.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(Ja.OnWriteLog,a=>a.findFirstOrNoneTopic(u=>u.toString().startsWith(Pb.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 q6.Address(r.bech32()).hex(),i=e.findSingleOrNoneEvent(Ja.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 q6.Address(r.receiver);for(let i of e.contractResults.items){let s=i.logs.findSingleOrNoneEvent(Ja.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 V6.ErrCannotParseContractResults("no return code");return{returnCode:Ya.ReturnCode.fromBuffer(i),returnDataParts:s}}};Og.ResultsParser=Rb});var Bb=m(vt=>{"use strict";c();var UX=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)&&UX(e,t,r)};Object.defineProperty(vt,"__esModule",{value:!0});rr(Vo(),vt);rr(O6(),vt);rr(iw(),vt);rr(Zw(),vt);rr(gc(),vt);rr(uE(),vt);rr(nE(),vt);rr(P6(),vt);rr(lE(),vt);rr(yc(),vt);rr(H6(),vt);rr(Db(),vt);rr(ev(),vt);rr(mE(),vt);rr(Ot(),vt)});var j6=m(Dg=>{"use strict";c();Object.defineProperty(Dg,"__esModule",{value:!0});Dg.RelayedTransactionV2Builder=void 0;var G6=Be(),Al=Bb(),qX=mn(),VX=qn(),Lb=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 G6.ErrInvalidRelayedV2BuilderArguments;if(this.innerTransaction.getGasLimit()!=0)throw new G6.ErrGasLimitShouldBe0ForInnerTransaction;let{argumentsString:e}=new Al.ArgSerializer().valuesToString([new Al.AddressValue(this.innerTransaction.getReceiver()),new Al.U64Value(this.innerTransaction.getNonce().valueOf()),new Al.BytesValue(this.innerTransaction.getData().valueOf()),new Al.BytesValue(this.innerTransaction.getSignature())]),r=`relayedTxV2@${e}`,n=new VX.TransactionPayload(r),i=new qX.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}};Dg.RelayedTransactionV2Builder=Lb});var k6=m(Xs=>{"use strict";c();Object.defineProperty(Xs,"__esModule",{value:!0});Xs.SignableMessage=Xs.MESSAGE_PREFIX=void 0;var HX=ht(),GX=YE();Xs.MESSAGE_PREFIX=`Elrond Signed Message: -`;var Fb=class{constructor(e){this.message=h.Buffer.from([]),this.signature=h.Buffer.from([]),this.version=1,this.signer="ErdJS",this.address=new HX.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(Xs.MESSAGE_PREFIX),r]);return GX("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}}};Xs.SignableMessage=Fb});var Ub=m(at=>{"use strict";c();var jX=at&&at.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),kX=at&&at.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Q6=at&&at.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&jX(e,t,r);return kX(e,t),e},QX=at&&at.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(at,"__esModule",{value:!0});at.addressToHex=at.bufferToHex=at.utf8ToHex=at.bigIntToHex=at.bigIntToBuffer=at.bufferToBigInt=at.stringToBuffer=void 0;var WX=QX(Gt()),zX=ht(),Mb=Q6(ic()),W6=Q6(oh());function $X(t){return h.Buffer.from(t)}at.stringToBuffer=$X;function KX(t){return t.length==0?new WX.default(0):Mb.bufferToBigInt(t)}at.bufferToBigInt=KX;function YX(t){return t==0?h.Buffer.from([]):Mb.bigIntToBuffer(t)}at.bigIntToBuffer=YX;function JX(t){return t==0?"":Mb.getHexMagnitudeOfBigInt(t)}at.bigIntToHex=JX;function XX(t){let e=h.Buffer.from(t).toString("hex");return W6.zeroPadStringIfOddLength(e)}at.utf8ToHex=XX;function ZX(t){let e=t.toString("hex");return W6.zeroPadStringIfOddLength(e)}at.bufferToHex=ZX;function eZ(t){return zX.Address.fromBech32(t.toString()).pubkey().toString("hex")}at.addressToHex=eZ});var $6=m(Pg=>{"use strict";c();Object.defineProperty(Pg,"__esModule",{value:!0});Pg.TokenOperationsFactory=void 0;var qb=ms(),tZ=Jo(),z6=oc(),rZ=mn(),nZ=qn(),ne=Ub(),Vb=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(){tZ.Logger.info(` + Approved: ${g.toString()}`))}),o.forEach(d=>{n||(ki(i[d].methods,s[d].methods)?ki(i[d].events,s[d].events)||(n=ii("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${d}`)):n=ii("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${d}`))}),n}function Kz(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 p3(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function Yz(t){let e={};return Object.keys(t).forEach(r=>{r.includes(":")?e[r]=t[r]:Xs(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 Jz(t,e){return Vp(t,!1)&&t<=e.max&&t>=e.min}function Xz(){let t=Js();return new Promise(e=>{switch(t){case tr.browser:e(nR());break;case tr.reactNative:e(iR());break;case tr.node:e(sR());break;default:e(!0)}})}function nR(){return Up()&&navigator?.onLine}async function iR(){return al()&&typeof global<"u"&&global!=null&&global.NetInfo?(await(global==null?void 0:global.NetInfo.fetch()))?.isConnected:!0}function sR(){return!0}function Zz(t){switch(Js()){case tr.browser:oR(t);break;case tr.reactNative:aR(t);break;case tr.node:break}}function oR(t){!al()&&Up()&&(window.addEventListener("online",()=>t(!0)),window.addEventListener("offline",()=>t(!1)))}function aR(t){al()&&typeof global<"u"&&global!=null&&global.NetInfo&&global?.NetInfo.addEventListener(e=>t(e?.isConnected))}var gA={},EA=class{static get(e){return gA[e]}static set(e,r){gA[e]=r}static delete(e){delete gA[e]}};G.BASE10=_A,G.BASE16=rr,G.BASE64=Pp,G.COLON=W$,G.DEFAULT_DEPTH=CA,G.EMPTY_SPACE=Rp,G.ENV_MAP=tr,G.MemoryStore=EA,G.ONE_THOUSAND=$$,G.REACT_NATIVE_PRODUCT=O3,G.RELAYER_DEFAULT_PROTOCOL=V3,G.SDK_TYPE=P3,G.SLASH=D3,G.TYPE_0=IA,G.TYPE_1=ka,G.UTF8=Mp,G.appendToQueryString=R3,G.assertType=X$,G.buildApprovedNamespaces=Oz,G.calcExpiry=lz,G.capitalize=iz,G.capitalizeWord=q3,G.createDelayedPromise=sz,G.createExpiringPromise=oz,G.decodeTypeByte=ol,G.decrypt=V$,G.deriveSymKey=F$,G.deserialize=TA,G.encodeTypeByte=C3,G.encrypt=q$,G.engineEvent=hz,G.enumify=nz,G.formatAccountId=A3,G.formatAccountWithChain=T$,G.formatChainId=v3,G.formatExpirerTarget=NA,G.formatIdTarget=uz,G.formatMessage=P$,G.formatMessageContext=Z$,G.formatRelayParams=k3,G.formatRelayRpcUrl=Y$,G.formatTopicTarget=az,G.formatUA=F3,G.formatUri=Az,G.generateKeyPair=B$,G.generateRandomBytes32=L$,G.getAccountsChains=Xs,G.getAccountsFromNamespaces=x$,G.getAddressFromAccount=b3,G.getAddressesFromAccounts=C$,G.getAppMetadata=z$,G.getBrowserOnlineStatus=nR,G.getChainFromAccount=_3,G.getChainsFromAccounts=I3,G.getChainsFromNamespace=Lp,G.getChainsFromNamespaces=N$,G.getChainsFromRequiredNamespaces=O$,G.getDidAddress=T3,G.getDidAddressSegments=Fp,G.getDidChainId=S3,G.getEnvironment=Js,G.getHttpUrl=J$,G.getInternalError=ii,G.getJavascriptID=L3,G.getJavascriptOS=B3,G.getLastItems=U3,G.getNamespacedDidChainId=D$,G.getNamespacesChains=j3,G.getNamespacesEventsForChainId=W3,G.getNamespacesMethodsForChainId=Q3,G.getNodeOnlineStatus=sR,G.getReactNativeOnlineStatus=iR,G.getRelayClientMetadata=K$,G.getRelayProtocolApi=gz,G.getRelayProtocolName=pz,G.getRequiredNamespacesFromNamespaces=Nz,G.getSdkError=Ys,G.getUniqueValues=bA,G.handleDeeplinkRedirect=dz,G.hasOverlap=ki,G.hashKey=M$,G.hashMessage=U$,G.isBrowser=Up,G.isCaipNamespace=OA,G.isConformingNamespaces=rR,G.isExpired=fz,G.isNode=xA,G.isOnline=Xz,G.isProposalStruct=Lz,G.isReactNative=al,G.isSessionCompatible=Rz,G.isSessionStruct=Fz,G.isTypeOneEnvelope=G$,G.isUndefined=Qi,G.isValidAccountId=z3,G.isValidAccounts=J3,G.isValidActions=Z3,G.isValidArray=ul,G.isValidChainId=sl,G.isValidChains=K3,G.isValidController=Mz,G.isValidErrorReason=Gz,G.isValidEvent=Qz,G.isValidId=Vz,G.isValidNamespaceAccounts=X3,G.isValidNamespaceActions=DA,G.isValidNamespaceChains=Y3,G.isValidNamespaceMethodsOrEvents=wA,G.isValidNamespaces=eR,G.isValidNamespacesChainId=Wz,G.isValidNamespacesEvent=zz,G.isValidNamespacesRequest=$z,G.isValidNumber=Vp,G.isValidObject=qp,G.isValidParams=Hz,G.isValidRelay=tR,G.isValidRelays=qz,G.isValidRequest=kz,G.isValidRequestExpiry=Jz,G.isValidRequiredNamespaces=Uz,G.isValidResponse=jz,G.isValidString=br,G.isValidUrl=Bz,G.mapEntries=rz,G.mapToObj=ez,G.mergeArrays=ji,G.normalizeNamespaces=mA,G.objToMap=tz,G.parseAccountId=AA,G.parseChainId=E3,G.parseContextNames=M3,G.parseExpirerTarget=cz,G.parseNamespaceKey=$3,G.parseRelayParams=H3,G.parseTopic=G3,G.parseUri=vz,G.serialize=x3,G.subscribeToBrowserNetworkChange=oR,G.subscribeToNetworkChange=Zz,G.subscribeToReactNativeNetworkChange=aR,G.validateDecoding=H$,G.validateEncoding=N3});var uR,cR,lR,fR,Hp,ll,PA,Gp,Wi,fl,kp=ge(()=>{c();uR="PARSE_ERROR",cR="INVALID_REQUEST",lR="METHOD_NOT_FOUND",fR="INVALID_PARAMS",Hp="INTERNAL_ERROR",ll="SERVER_ERROR",PA=[-32700,-32600,-32601,-32602,-32603],Gp=[-32e3,-32099],Wi={[uR]:{code:-32700,message:"Parse error"},[cR]:{code:-32600,message:"Invalid Request"},[lR]:{code:-32601,message:"Method not found"},[fR]:{code:-32602,message:"Invalid params"},[Hp]:{code:-32603,message:"Internal error"},[ll]:{code:-32e3,message:"Server error"}},fl=ll});function eK(t){return t<=Gp[0]&&t>=Gp[1]}function jp(t){return PA.includes(t)}function hR(t){return typeof t=="number"}function Qp(t){return Object.keys(Wi).includes(t)?Wi[t]:Wi[fl]}function Wp(t){let e=Object.values(Wi).find(r=>r.code===t);return e||Wi[fl]}function tK(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(!hR(t.error.code))return{valid:!1,error:`Invalid error code type for JSON-RPC: ${t.error.code}`};if(jp(t.error.code)){let e=Wp(t.error.code);if(e.message!==Wi[fl].message&&t.error.message===e.message)return{valid:!1,error:`Invalid error code message for JSON-RPC: ${t.error.code}`}}return{valid:!0}}function RA(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var BA=ge(()=>{c();kp()});var pR=m($i=>{"use strict";c();Object.defineProperty($i,"__esModule",{value:!0});$i.isBrowserCryptoAvailable=$i.getSubtleCrypto=$i.getBrowerCrypto=void 0;function LA(){return(global===null||global===void 0?void 0:global.crypto)||(global===null||global===void 0?void 0:global.msCrypto)||{}}$i.getBrowerCrypto=LA;function dR(){let t=LA();return t.subtle||t.webkitSubtle}$i.getSubtleCrypto=dR;function rK(){return!!LA()&&!!dR()}$i.isBrowserCryptoAvailable=rK});var mR=m(zi=>{"use strict";c();Object.defineProperty(zi,"__esModule",{value:!0});zi.isBrowser=zi.isNode=zi.isReactNative=void 0;function gR(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}zi.isReactNative=gR;function yR(){return typeof p.default<"u"&&typeof p.default.versions<"u"&&typeof p.default.versions.node<"u"}zi.isNode=yR;function nK(){return!gR()&&!yR()}zi.isBrowser=nK});var FA=m($p=>{"use strict";c();Object.defineProperty($p,"__esModule",{value:!0});var wR=(vr(),ct(Er));wR.__exportStar(pR(),$p);wR.__exportStar(mR(),$p)});var Ft={};ft(Ft,{isNodeJs:()=>vR});var ER,vR,AR=ge(()=>{c();ER=_e(FA());Ht(Ft,_e(FA()));vR=ER.isNode});function MA(t=3){let e=Date.now()*Math.pow(10,t),r=Math.floor(Math.random()*Math.pow(10,t));return e+r}function UA(t=6){return BigInt(MA(t))}function qA(t,e,r){return{id:r||MA(),jsonrpc:"2.0",method:t,params:e}}function iK(t,e){return{id:t,jsonrpc:"2.0",result:e}}function VA(t,e,r){return{id:t,jsonrpc:"2.0",error:bR(e,r)}}function bR(t,e){return typeof t>"u"?Qp(Hp):(typeof t=="string"&&(t=Object.assign(Object.assign({},Qp(ll)),{message:t})),typeof e<"u"&&(t.data=e),jp(t.code)&&(t=Wp(t.code)),t)}var _R=ge(()=>{c();BA();kp()});function sK(t){return t.includes("*")?Kp(t):!/\W/g.test(t)}function zp(t){return t==="*"}function Kp(t){return zp(t)?!0:!(!t.includes("*")||t.split("*").length!==2||t.split("*").filter(e=>e.trim()==="").length!==1)}function oK(t){return!zp(t)&&Kp(t)&&!t.split("*")[0].trim()}function aK(t){return!zp(t)&&Kp(t)&&!t.split("*")[1].trim()}var IR=ge(()=>{c()});var SR=ge(()=>{c()});var ja,HA=ge(()=>{c();ja=class{}});var GA,Yp,hl,TR=ge(()=>{c();HA();GA=class extends ja{constructor(e){super()}},Yp=class extends ja{constructor(){super()}},hl=class extends Yp{constructor(e){super()}}});var CR=ge(()=>{c()});var xR=ge(()=>{c();SR();HA();TR();CR()});var NR=ge(()=>{c();xR()});function lK(t){let e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function OR(t,e){let r=lK(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function fK(t){return OR(t,uK)}function Jp(t){return OR(t,cK)}function kA(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}var uK,cK,DR=ge(()=>{c();uK="^https?:",cK="^wss?:"});function jA(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function hK(t){return jA(t)&&"method"in t}function QA(t){return jA(t)&&(PR(t)||Xp(t))}function PR(t){return"result"in t}function Xp(t){return"error"in t}function dK(t){return"error"in t&&t.valid===!1}var RR=ge(()=>{c()});var Zt={};ft(Zt,{DEFAULT_ERROR:()=>fl,IBaseJsonRpcProvider:()=>Yp,IEvents:()=>ja,IJsonRpcConnection:()=>GA,IJsonRpcProvider:()=>hl,INTERNAL_ERROR:()=>Hp,INVALID_PARAMS:()=>fR,INVALID_REQUEST:()=>cR,METHOD_NOT_FOUND:()=>lR,PARSE_ERROR:()=>uR,RESERVED_ERROR_CODES:()=>PA,SERVER_ERROR:()=>ll,SERVER_ERROR_CODE_RANGE:()=>Gp,STANDARD_ERROR_MAP:()=>Wi,formatErrorMessage:()=>bR,formatJsonRpcError:()=>VA,formatJsonRpcRequest:()=>qA,formatJsonRpcResult:()=>iK,getBigIntRpcId:()=>UA,getError:()=>Qp,getErrorByCode:()=>Wp,isHttpUrl:()=>fK,isJsonRpcError:()=>Xp,isJsonRpcPayload:()=>jA,isJsonRpcRequest:()=>hK,isJsonRpcResponse:()=>QA,isJsonRpcResult:()=>PR,isJsonRpcValidationInvalid:()=>dK,isLocalhostUrl:()=>kA,isNodeJs:()=>vR,isReservedErrorCode:()=>jp,isServerErrorCode:()=>eK,isValidDefaultRoute:()=>zp,isValidErrorCode:()=>hR,isValidLeadingWildcardRoute:()=>oK,isValidRoute:()=>sK,isValidTrailingWildcardRoute:()=>aK,isValidWildcardRoute:()=>Kp,isWsUrl:()=>Jp,parseConnectionError:()=>RA,payloadId:()=>MA,validateJsonRpcError:()=>tK});var dl=ge(()=>{c();kp();BA();AR();Ht(Zt,Ft);_R();IR();NR();DR();RR()});var BR,Zp,LR,WA=ge(()=>{c();BR=_e(Kn());dl();Zp=class extends hl{constructor(e){super(e),this.events=new BR.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(qA(e.method,e.params||[],e.id||UA().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),QA(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)}},LR=Zp});var FR={};ft(FR,{JsonRpcProvider:()=>Zp,default:()=>pK});var pK,MR=ge(()=>{c();WA();WA();pK=LR});var qR=m((bge,UR)=>{"use strict";c();UR.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}});var VR,HR,$A,GR=ge(()=>{c();VR=()=>typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:qR(),HR=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",$A=t=>t.split("?")[0]});var jR,kR,gK,eg,QR,zA=ge(()=>{c();jR=_e(Kn());Qd();dl();GR();kR=10,gK=VR(),eg=class{constructor(e){if(this.url=e,this.events=new jR.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(qc(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,Zt.isReactNative)()?void 0:{rejectUnauthorized:!kA(e)},s=new gK(e,[],i);HR()?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"?Uc(e.data):e.data;this.events.emit("payload",r)}onError(e,r){let n=this.parseError(r),i=n.message||n.toString(),s=VA(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return RA(e,$A(r),"WS")}resetMaxListeners(){this.events.getMaxListeners()>kR&&this.events.setMaxListeners(kR)}emitError(e){let r=this.parseError(new Error(e?.message||`WebSocket connection failed for host: ${$A(this.url)}`));return this.events.emit("register_error",r),r}},QR=eg});var WR={};ft(WR,{WsConnection:()=>eg,default:()=>yK});var yK,$R=ge(()=>{c();zA();zA();yK=QR});var x6=m((pl,Wa)=>{c();var mK=200,sb="__lodash_hash_undefined__",ug=1,s6=2,o6=9007199254740991,tg="[object Arguments]",XA="[object Array]",wK="[object AsyncFunction]",a6="[object Boolean]",u6="[object Date]",c6="[object Error]",l6="[object Function]",EK="[object GeneratorFunction]",rg="[object Map]",f6="[object Number]",vK="[object Null]",Qa="[object Object]",zR="[object Promise]",AK="[object Proxy]",h6="[object RegExp]",ng="[object Set]",d6="[object String]",bK="[object Symbol]",_K="[object Undefined]",ZA="[object WeakMap]",p6="[object ArrayBuffer]",ig="[object DataView]",IK="[object Float32Array]",SK="[object Float64Array]",TK="[object Int8Array]",CK="[object Int16Array]",xK="[object Int32Array]",NK="[object Uint8Array]",OK="[object Uint8ClampedArray]",DK="[object Uint16Array]",PK="[object Uint32Array]",RK=/[\\^$.*+?()[\]{}|]/g,BK=/^\[object .+?Constructor\]$/,LK=/^(?:0|[1-9]\d*)$/,rt={};rt[IK]=rt[SK]=rt[TK]=rt[CK]=rt[xK]=rt[NK]=rt[OK]=rt[DK]=rt[PK]=!0;rt[tg]=rt[XA]=rt[p6]=rt[a6]=rt[ig]=rt[u6]=rt[c6]=rt[l6]=rt[rg]=rt[f6]=rt[Qa]=rt[h6]=rt[ng]=rt[d6]=rt[ZA]=!1;var g6=typeof global=="object"&&global&&global.Object===Object&&global,FK=typeof self=="object"&&self&&self.Object===Object&&self,si=g6||FK||Function("return this")(),y6=typeof pl=="object"&&pl&&!pl.nodeType&&pl,KR=y6&&typeof Wa=="object"&&Wa&&!Wa.nodeType&&Wa,m6=KR&&KR.exports===y6,KA=m6&&g6.process,YR=function(){try{return KA&&KA.binding&&KA.binding("util")}catch{}}(),JR=YR&&YR.isTypedArray;function MK(t,e){for(var r=-1,n=t==null?0:t.length,i=0,s=[];++r-1}function dY(t,e){var r=this.__data__,n=lg(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}oi.prototype.clear=cY;oi.prototype.delete=lY;oi.prototype.get=fY;oi.prototype.has=hY;oi.prototype.set=dY;function to(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&s6?new og:void 0;for(s.set(t,e),s.set(e,t);++f-1&&t%1==0&&t-1&&t%1==0&&t<=o6}function T6(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}function ml(t){return t!=null&&typeof t=="object"}var C6=JR?HK(JR):OY;function jY(t){return GY(t)?TY(t):DY(t)}function QY(){return[]}function WY(){return!1}Wa.exports=kY});var P8=m(me=>{"use strict";c();Object.defineProperty(me,"__esModule",{value:!0});var no=Kn(),$Y=KO(),Al=f2(),Qe=qv(),ui=n1(),N6=(Qd(),ct(S2)),zY=(KD(),ct(zD)),ee=cl(),KY=(uA(),ct(aA)),We=ks(),YY=(MR(),ct(FR)),_r=(dl(),ct(Zt)),JY=($R(),ct(WR)),XY=x6();function Tg(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}function ZY(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 eJ=Tg(no),tJ=Tg($Y),hg=ZY(zY),rJ=Tg(JY),nJ=Tg(XY);function iJ(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,A=new Uint8Array(U);B!==W;){for(var I=E[B],N=0,_=U-1;(I!==0||N>>0,A[_]=I%a>>>0,I=I/a>>>0;if(I!==0)throw new Error("Non-zero carry");D=N,B++}for(var S=U-D;S!==U&&A[S]===0;)S++;for(var R=u.repeat(T);S>>0,U=new Uint8Array(W);E[T];){var A=r[E.charCodeAt(T)];if(A===255)return;for(var I=0,N=W-1;(A!==0||I>>0,U[N]=A%256>>>0,A=A/256>>>0;if(A!==0)throw new Error("Non-zero carry");B=I,T++}if(E[T]!==" "){for(var _=W-B;_!==W&&U[_]===0;)_++;for(var S=new Uint8Array(D+(W-_)),R=D;_!==W;)S[R++]=U[_++];return S}}}function w(E){var T=g(E);if(T)return T;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:g,decode:w}}var sJ=iJ,oJ=sJ,W6=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")},aJ=t=>new TextEncoder().encode(t),uJ=t=>new TextDecoder().decode(t),ub=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")}},cb=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 $6(this,e)}},lb=class{constructor(e){this.decoders=e}or(e){return $6(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`)}},$6=(t,e)=>new lb({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),fb=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new ub(e,r,n),this.decoder=new cb(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},Cg=({name:t,prefix:e,encode:r,decode:n})=>new fb(t,e,r,n),bl=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=oJ(r,e);return Cg({prefix:t,name:e,encode:n,decode:s=>W6(i(s))})},cJ=(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},lJ=(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<Cg({prefix:e,name:t,encode(i){return lJ(i,n,r)},decode(i){return cJ(i,n,r,t)}}),fJ=Cg({prefix:"\0",name:"identity",encode:t=>uJ(t),decode:t=>aJ(t)}),hJ=Object.freeze({__proto__:null,identity:fJ}),dJ=kt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),pJ=Object.freeze({__proto__:null,base2:dJ}),gJ=kt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),yJ=Object.freeze({__proto__:null,base8:gJ}),mJ=bl({prefix:"9",name:"base10",alphabet:"0123456789"}),wJ=Object.freeze({__proto__:null,base10:mJ}),EJ=kt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),vJ=kt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),AJ=Object.freeze({__proto__:null,base16:EJ,base16upper:vJ}),bJ=kt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),_J=kt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),IJ=kt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),SJ=kt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),TJ=kt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),CJ=kt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),xJ=kt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),NJ=kt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),OJ=kt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),DJ=Object.freeze({__proto__:null,base32:bJ,base32upper:_J,base32pad:IJ,base32padupper:SJ,base32hex:TJ,base32hexupper:CJ,base32hexpad:xJ,base32hexpadupper:NJ,base32z:OJ}),PJ=bl({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),RJ=bl({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),BJ=Object.freeze({__proto__:null,base36:PJ,base36upper:RJ}),LJ=bl({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),FJ=bl({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),MJ=Object.freeze({__proto__:null,base58btc:LJ,base58flickr:FJ}),UJ=kt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),qJ=kt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),VJ=kt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),HJ=kt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),GJ=Object.freeze({__proto__:null,base64:UJ,base64pad:qJ,base64url:VJ,base64urlpad:HJ}),z6=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}"),kJ=z6.reduce((t,e,r)=>(t[r]=e,t),[]),jJ=z6.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function QJ(t){return t.reduce((e,r)=>(e+=kJ[r],e),"")}function WJ(t){let e=[];for(let r of t){let n=jJ[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var $J=Cg({prefix:"\u{1F680}",name:"base256emoji",encode:QJ,decode:WJ}),zJ=Object.freeze({__proto__:null,base256emoji:$J}),KJ=K6,O6=128,YJ=127,JJ=~YJ,XJ=Math.pow(2,31);function K6(t,e,r){e=e||[],r=r||0;for(var n=r;t>=XJ;)e[r++]=t&255|O6,t/=128;for(;t&JJ;)e[r++]=t&255|O6,t>>>=7;return e[r]=t|0,K6.bytes=r-n+1,e}var ZJ=hb,eX=128,D6=127;function hb(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw hb.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&D6)<=eX);return hb.bytes=s-n,r}var tX=Math.pow(2,7),rX=Math.pow(2,14),nX=Math.pow(2,21),iX=Math.pow(2,28),sX=Math.pow(2,35),oX=Math.pow(2,42),aX=Math.pow(2,49),uX=Math.pow(2,56),cX=Math.pow(2,63),lX=function(t){return t(Y6.encode(t,e,r),e),R6=t=>Y6.encodingLength(t),db=(t,e)=>{let r=e.byteLength,n=R6(t),i=n+R6(r),s=new Uint8Array(i+r);return P6(t,s,0),P6(r,s,n),s.set(e,i),new pb(t,r,e,s)},pb=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}},J6=({name:t,code:e,encode:r})=>new gb(t,e,r),gb=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?db(this.code,r):r.then(n=>db(this.code,n))}else throw Error("Unknown type, must be binary type")}},X6=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),hX=J6({name:"sha2-256",code:18,encode:X6("SHA-256")}),dX=J6({name:"sha2-512",code:19,encode:X6("SHA-512")}),pX=Object.freeze({__proto__:null,sha256:hX,sha512:dX}),Z6=0,gX="identity",e8=W6,yX=t=>db(Z6,e8(t)),mX={code:Z6,name:gX,encode:e8,digest:yX},wX=Object.freeze({__proto__:null,identity:mX});new TextEncoder,new TextDecoder;var B6={...hJ,...pJ,...yJ,...wJ,...AJ,...DJ,...BJ,...MJ,...GJ,...zJ};({...pX,...wX});function t8(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function EX(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?t8(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function r8(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var L6=r8("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),ob=r8("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);let e=EX(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=Qe.generateChildLogger(r,this.name)}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,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)}}},yg=class{constructor(e,r,n){this.core=e,this.logger=r,this.name=o8,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=a8;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=N6.safeJsonStringify(s);if(ee.isTypeOneEnvelope(a)){let g=a.senderPublicKey,w=a.receiverPublicKey;i=await this.generateSharedKey(g,w)}let l=this.getSymKey(i),{type:f,senderPublicKey:d}=a;return ee.encrypt({type:f,symKey:l,message:u,senderPublicKey:d})},this.decode=async(i,s,o)=>{this.isInitialized();let a=ee.validateDecoding(s,o);if(ee.isTypeOneEnvelope(a)){let u=a.receiverPublicKey,l=a.senderPublicKey;i=await this.generateSharedKey(u,l)}try{let u=this.getSymKey(i),l=ee.decrypt({symKey:u,encoded:s});return N6.safeJsonParse(l)}catch(u){this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`),this.logger.error(u)}},this.getPayloadType=i=>{let s=ee.deserialize(i);return ee.decodeTypeByte(s.type)},this.getPayloadSenderPublicKey=i=>{let s=ee.deserialize(i);return s.senderPublicKey?KY.toString(s.senderPublicKey,ee.BASE16):void 0},this.core=e,this.logger=Qe.generateChildLogger(r,this.name),this.keychain=n||new gg(this.core,this.logger)}get context(){return Qe.getLoggerContext(this.logger)}async setPrivateKey(e,r){return await this.keychain.set(e,r),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(yb)}catch{e=ee.generateRandomBytes32(),await this.keychain.set(yb,e)}return AX(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)}}},mg=class extends ui.IMessageTracker{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=l8,this.version=f8,this.initialized=!1,this.storagePrefix=ai,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=Qe.generateChildLogger(e,this.name),this.core=r}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,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)}}},Eb=class extends ui.IPublisher{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new no.EventEmitter,this.name=d8,this.queue=new Map,this.publishTimeout=We.toMiliseconds(We.TEN_SECONDS),this.needsTransportRestart=!1,this.publish=async(n,i,s)=>{var o;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}});try{let a=s?.ttl||h8,u=ee.getRelayProtocolName(s),l=s?.prompt||!1,f=s?.tag||0,d=s?.id||_r.getBigIntRpcId().toString(),g={topic:n,message:i,opts:{ttl:a,relay:u,prompt:l,tag:f,id:d}},w=setTimeout(()=>this.queue.set(d,g),this.publishTimeout);try{await await ee.createExpiringPromise(this.rpcPublish(n,i,a,u,l,f,d),this.publishTimeout,"Failed to publish payload, please try again."),this.removeRequestFromQueue(d),this.relayer.events.emit(nr.publish,g)}catch(E){if(this.logger.debug("Publishing Payload stalled"),this.needsTransportRestart=!0,(o=s?.internal)!=null&&o.throwOnFailedPublish)throw this.removeRequestFromQueue(d),E;return}finally{clearTimeout(w)}this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}})}catch(a){throw this.logger.debug("Failed to Publish Payload"),this.logger.error(a),a}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.relayer=e,this.logger=Qe.generateChildLogger(r,this.name),this.registerEventListeners()}get context(){return Qe.getLoggerContext(this.logger)}rpcPublish(e,r,n,i,s,o,a){var u,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)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{let{topic:r,message:n,opts:i}=e;await this.publish(r,n,i)})}registerEventListeners(){this.relayer.core.heartbeat.on(Al.HEARTBEAT_EVENTS.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(nr.connection_stalled);return}this.checkQueue()}),this.relayer.on(nr.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}},vb=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())}},TX=Object.defineProperty,CX=Object.defineProperties,xX=Object.getOwnPropertyDescriptors,F6=Object.getOwnPropertySymbols,NX=Object.prototype.hasOwnProperty,OX=Object.prototype.propertyIsEnumerable,M6=(t,e,r)=>e in t?TX(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,El=(t,e)=>{for(var r in e||(e={}))NX.call(e,r)&&M6(t,r,e[r]);if(F6)for(var r of F6(e))OX.call(e,r)&&M6(t,r,e[r]);return t},ab=(t,e)=>CX(t,xX(e)),wg=class extends ui.ISubscriber{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new vb,this.events=new no.EventEmitter,this.name=_8,this.version=I8,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=ai,this.subscribeTimeout=1e4,this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId())},this.subscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}});try{let s=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 We.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)>=S8&&(clearInterval(a),o.stop(this.pendingSubscriptionWatchLabel),s(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=Qe.generateChildLogger(r,this.name),this.clientId=""}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,r){let n=!1;try{n=this.getSubscription(e).topic===r}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,r){let n=this.topicMap.get(e);await Promise.all(n.map(async i=>await this.unsubscribeById(e,i,r)))}async unsubscribeById(e,r,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}});try{let i=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(nr.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(nr.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,ab(El({},r),{id:e})),this.pending.delete(r.topic)}onBatchSubscribe(e){e.length&&e.forEach(r=>{this.setSubscription(r.id,El({},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,El({},r)),this.topicMap.set(r.topic,e),this.events.emit(Hr.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(Hr.deleted,ab(El({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Hr.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)=>ab(El({},e[i]),{id:n})))}async onConnect(){this.restartInProgress||(await this.restart(),this.onEnable())}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||this.relayer.transportExplicitlyClosed)return;let e=[];this.pending.forEach(r=>{e.push(r)}),await this.batchSubscribe(e)}registerEventListeners(){this.relayer.core.heartbeat.on(Al.HEARTBEAT_EVENTS.pulse,async()=>{await this.checkPending()}),this.relayer.on(nr.connect,async()=>{await this.onConnect()}),this.relayer.on(nr.disconnect,()=>{this.onDisconnect()}),this.events.on(Hr.created,async e=>{let r=Hr.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()}),this.events.on(Hr.deleted,async e=>{let r=Hr.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)})}},DX=Object.defineProperty,U6=Object.getOwnPropertySymbols,PX=Object.prototype.hasOwnProperty,RX=Object.prototype.propertyIsEnumerable,q6=(t,e,r)=>e in t?DX(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,BX=(t,e)=>{for(var r in e||(e={}))PX.call(e,r)&&q6(t,r,e[r]);if(U6)for(var r of U6(e))RX.call(e,r)&&q6(t,r,e[r]);return t},Eg=class extends ui.IRelayer{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new no.EventEmitter,this.name=y8,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","socket stalled"],this.hasExperiencedNetworkDisruption=!1,this.request=async r=>{this.logger.debug("Publishing Request Payload");try{return await this.toEstablishConnection(),await this.provider.request(r)}catch(n){throw this.logger.debug("Failed to Publish Request"),this.logger.error(n),n}},this.onPayloadHandler=r=>{this.onProviderPayload(r)},this.onConnectHandler=()=>{this.events.emit(nr.connect)},this.onDisconnectHandler=()=>{this.onProviderDisconnect()},this.onProviderErrorHandler=r=>{this.logger.error(r),this.events.emit(nr.error,r),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(Nn.payload,this.onPayloadHandler),this.provider.on(Nn.connect,this.onConnectHandler),this.provider.on(Nn.disconnect,this.onDisconnectHandler),this.provider.on(Nn.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?Qe.generateChildLogger(e.logger,this.name):Qe.pino(Qe.getDefaultLoggerOptions({level:e.logger||g8})),this.messages=new mg(this.logger,e.core),this.subscriber=new wg(this,this.logger),this.publisher=new Eb(this,this.logger),this.relayUrl=e?.relayUrl||bb,this.projectId=e.projectId,this.provider={}}async init(){this.logger.trace("Initialized"),this.registerEventListeners(),await this.createProvider(),await Promise.all([this.messages.init(),this.subscriber.init()]);try{await this.transportOpen()}catch{this.logger.warn(`Connection via ${this.relayUrl} failed, attempting to connect via failover domain ${mb}...`),await this.restartTransport(mb)}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)},v8)}get context(){return Qe.getLoggerContext(this.logger)}get connected(){return this.provider.connection.connected}get connecting(){return this.provider.connection.connecting}async publish(e,r,n){this.isInitialized(),await this.publisher.publish(e,r,n),await this.recordMessageEvent({topic:e,message:r,publishedAt:Date.now()})}async subscribe(e,r){var n;this.isInitialized();let i=((n=this.subscriber.topicMap.get(e))==null?void 0:n[0])||"";if(i)return i;let s,o=a=>{a.topic===e&&(this.subscriber.off(Hr.created,o),s())};return await Promise.all([new Promise(a=>{s=a,this.subscriber.on(Hr.created,o)}),new Promise(async a=>{i=await this.subscriber.subscribe(e,r),a()})]),i}async unsubscribe(e,r){this.isInitialized(),await this.subscriber.unsubscribe(e,r)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async transportClose(){this.transportExplicitlyClosed=!0,this.hasExperiencedNetworkDisruption&&this.connected?await ee.createExpiringPromise(this.provider.disconnect(),1e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.connected&&await this.provider.disconnect()}async transportOpen(e){if(this.transportExplicitlyClosed=!1,await this.confirmOnlineStateOrThrow(),!this.connectionAttemptInProgress){e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportClose(),await this.createProvider()),this.connectionAttemptInProgress=!0;try{await Promise.all([new Promise(r=>{if(!this.initialized)return r();this.subscriber.once(Hr.resubscribed,()=>{r()})}),new Promise(async(r,n)=>{try{await ee.createExpiringPromise(this.provider.connect(),1e4,`Socket stalled when trying to connect to ${this.relayUrl}`)}catch(i){n(i);return}r()})])}catch(r){this.logger.error(r);let n=r;if(!this.isConnectionStalled(n.message))throw r;this.provider.events.emit(Nn.disconnect)}finally{this.connectionAttemptInProgress=!1,this.hasExperiencedNetworkDisruption=!1}}}async restartTransport(e){await this.confirmOnlineStateOrThrow(),!this.connectionAttemptInProgress&&(this.relayUrl=e||this.relayUrl,await this.transportClose(),await this.createProvider(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await ee.isOnline())throw new Error("No internet connection detected. Please restart your network and try again.")}isConnectionStalled(e){return this.staleConnectionErrors.some(r=>e.includes(r))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();let e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new YY.JsonRpcProvider(new rJ.default(ee.formatRelayRpcUrl({sdkVersion:E8,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;if(!n||n.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isSubscribed(r))return this.logger.debug(`Ignoring message for non-subscribed topic ${r}`),!0;let i=this.messages.has(r,n);return i&&this.logger.debug(`Ignoring duplicate message: ${n}`),i}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),_r.isJsonRpcRequest(e)){if(!e.method.endsWith(m8))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(BX({type:"event",event:r.id},o)),this.events.emit(r.id,o),await this.acknowledgePayload(e),await this.onMessageEvent(o)}else _r.isJsonRpcResponse(e)&&this.events.emit(nr.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(nr.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){let r=_r.formatJsonRpcResult(e.id,!0);await this.provider.connection.send(r)}unregisterProviderListeners(){this.provider.off(Nn.payload,this.onPayloadHandler),this.provider.off(Nn.connect,this.onConnectHandler),this.provider.off(Nn.disconnect,this.onDisconnectHandler),this.provider.off(Nn.error,this.onProviderErrorHandler)}async registerEventListeners(){this.events.on(nr.connection_stalled,()=>{this.restartTransport().catch(r=>this.logger.error(r))});let e=await ee.isOnline();ee.subscribeToNetworkChange(async r=>{this.initialized&&e!==r&&(e=r,r?await this.restartTransport().catch(n=>this.logger.error(n)):(this.hasExperiencedNetworkDisruption=!0,await this.transportClose().catch(n=>this.logger.error(n))))})}onProviderDisconnect(){this.events.emit(nr.disconnect),this.attemptToReconnect()}attemptToReconnect(){this.transportExplicitlyClosed||(this.logger.info("attemptToReconnect called. Connecting..."),setTimeout(async()=>{await this.restartTransport().catch(e=>this.logger.error(e))},We.toMiliseconds(w8)))}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){if(await this.confirmOnlineStateOrThrow(),!this.connected){if(this.connectionAttemptInProgress)return await new Promise(e=>{let r=setInterval(()=>{this.connected&&(clearInterval(r),e())},this.connectionStatusPollingInterval)});await this.restartTransport()}}},LX=Object.defineProperty,V6=Object.getOwnPropertySymbols,FX=Object.prototype.hasOwnProperty,MX=Object.prototype.propertyIsEnumerable,H6=(t,e,r)=>e in t?LX(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,G6=(t,e)=>{for(var r in e||(e={}))FX.call(e,r)&&H6(t,r,e[r]);if(V6)for(var r of V6(e))MX.call(e,r)&&H6(t,r,e[r]);return t},vg=class extends ui.IStore{constructor(e,r,n,i=ai,s=void 0){super(e,r,n,i),this.core=e,this.logger=r,this.name=n,this.map=new Map,this.version=A8,this.cached=[],this.initialized=!1,this.storagePrefix=ai,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=>nJ.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=G6(G6({},this.getData(o)),a);this.map.set(o,u),await this.persist()},this.delete=async(o,a)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:a}),this.map.delete(o),await this.persist())},this.logger=Qe.generateChildLogger(r,this.name),this.storagePrefix=i,this.getKey=s}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){let r=this.map.get(e);if(!r){let{message:n}=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)}}},Ag=class{constructor(e,r){this.core=e,this.logger=r,this.name=T8,this.version=C8,this.events=new eJ.default,this.initialized=!1,this.storagePrefix=ai,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(We.FIVE_MINUTES),o={protocol:p8},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),a;if(this.pairings.keys.includes(i)&&(a=this.pairings.get(i),a.active))throw new Error(`Pairing already exists: ${i}. Please try again with a new connection URI.`);this.core.crypto.keychain.has(i)||(await this.core.crypto.setSymKey(s,i),await this.core.relayer.subscribe(i,{relay:o}));let u=ee.calcExpiry(We.FIVE_MINUTES),l={topic:i,relay:o,expiry:u,active:!1};return await this.pairings.set(i,l),this.core.expirer.set(i,u),n.activatePairing&&await this.activate({topic:i}),this.events.emit(vl.create,l),l},this.activate=async({topic:n})=>{this.isInitialized();let i=ee.calcExpiry(We.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=_r.formatJsonRpcRequest(i,s),a=await this.core.crypto.encode(n,o),u=za[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=_r.formatJsonRpcResult(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=za[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=_r.formatJsonRpcError(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=za[u.request.method]?za[u.request.method].res:za.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;switch(s.method){case"wc_pairingPing":return this.onPairingPingRequest(i,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(i,s);default:return this.onUnknownRpcMethodRequest(i,s)}},this.onRelayEventResponse=async n=>{let{topic:i,payload:s}=n,o=(await this.core.history.get(i,s.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(i,s);default:return this.onUnknownRpcMethodResponse(o)}},this.onPairingPingRequest=async(n,i)=>{let{id:s}=i;try{this.isValidPing({topic:n}),await this.sendResult(s,n,!0),this.events.emit(vl.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(()=>{_r.isJsonRpcResult(i)?this.events.emit(ee.engineEvent("pairing_ping",s),{}):_r.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(vl.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=Qe.generateChildLogger(r,this.name),this.pairings=new vg(this.core,this.logger,this.name,this.storagePrefix)}get context(){return Qe.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(nr.message,async e=>{let{topic:r,message:n}=e;if(!this.pairings.keys.includes(r)||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;let i=await this.core.crypto.decode(r,n);try{_r.isJsonRpcRequest(i)?(this.core.history.set(r,i),this.onRelayEventRequest({topic:r,payload:i})):_r.isJsonRpcResponse(i)&&(await this.core.history.resolve(i),await this.onRelayEventResponse({topic:r,payload:i}),this.core.history.delete(r,i.id))}catch(s){this.logger.error(s)}})}registerExpirerEvents(){this.core.expirer.on(Vr.expired,async e=>{let{topic:r}=ee.parseExpirerTarget(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit(vl.expire,{topic:r}))})}},bg=class extends ui.IJsonRpcHistory{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new no.EventEmitter,this.name=x8,this.version=N8,this.cached=[],this.initialized=!1,this.storagePrefix=ai,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(We.THIRTY_DAYS)};this.records.set(o.id,o),this.events.emit(Yr.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=_r.isJsonRpcError(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.events.emit(Yr.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(Yr.deleted,s)}})},this.exists=async(n,i)=>(this.isInitialized(),this.records.has(i)?(await this.getRecord(i)).topic===n:!1),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=Qe.generateChildLogger(r,this.name)}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){let e=[];return this.values.forEach(r=>{if(typeof r.response<"u")return;let n={topic:r.topic,request:_r.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(Yr.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(Yr.created,e=>{let r=Yr.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.events.on(Yr.updated,e=>{let r=Yr.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.events.on(Yr.deleted,e=>{let r=Yr.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.core.heartbeat.on(Al.HEARTBEAT_EVENTS.pulse,()=>{this.cleanup()})}cleanup(){try{this.records.forEach(e=>{We.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)}}},_g=class extends ui.IExpirer{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new no.EventEmitter,this.name=O8,this.version=D8,this.cached=[],this.initialized=!1,this.storagePrefix=ai,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(Vr.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(Vr.deleted,{target:i,expiration:s})}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=Qe.generateChildLogger(r,this.name)}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return 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(Vr.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;We.toMiliseconds(n)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(Vr.expired,{target:e,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(Al.HEARTBEAT_EVENTS.pulse,()=>this.checkExpirations()),this.events.on(Vr.created,e=>{let r=Vr.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Vr.expired,e=>{let r=Vr.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Vr.deleted,e=>{let r=Vr.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)}}},Ig=class extends ui.IVerify{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.name=dg,this.initialized=!1,this.queue=[],this.verifyDisabled=!1,this.init=async()=>{if(this.verifyDisabled||ee.isReactNative()||!ee.isBrowser())return;let n=pg;this.verifyUrl!==n&&this.removeIframe(),this.verifyUrl=n;try{await this.createIframe()}catch(i){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(i)}if(!this.initialized){this.removeIframe(),this.verifyUrl=wb;try{await this.createIframe()}catch(i){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(i),this.verifyDisabled=!0}}},this.register=async n=>{this.initialized?this.sendPost(n.attestationId):(this.addToQueue(n.attestationId),await this.init())},this.resolve=async n=>{if(this.isDevEnv)return"";let i=n?.verifyUrl||pg,s;try{s=await this.fetchAttestation(n.attestationId,i)}catch(o){this.logger.info(`failed to resolve attestation: ${n.attestationId} from url: ${i}`),this.logger.info(o),s=await this.fetchAttestation(n.attestationId,wb)}return s},this.fetchAttestation=async(n,i)=>{this.logger.info(`resolving attestation: ${n} from url: ${i}`);let s=this.startAbortTimer(We.ONE_SECOND*2),o=await fetch(`${i}/attestation/${n}`,{signal:this.abortController.signal});return clearTimeout(s),o.status===200?await o.json():void 0},this.addToQueue=n=>{this.queue.push(n)},this.processQueue=()=>{this.queue.length!==0&&(this.queue.forEach(n=>this.sendPost(n)),this.queue=[])},this.sendPost=n=>{var i;try{if(!this.iframe)return;(i=this.iframe.contentWindow)==null||i.postMessage(n,"*"),this.logger.info(`postMessage sent: ${n} ${this.verifyUrl}`)}catch{}},this.createIframe=async()=>{let n,i=s=>{s.data==="verify_ready"&&(this.initialized=!0,this.processQueue(),window.removeEventListener("message",i),n())};await Promise.race([new Promise(s=>{if(document.getElementById(dg))return s();window.addEventListener("message",i);let o=document.createElement("iframe");o.id=dg,o.src=`${this.verifyUrl}/${this.projectId}`,o.style.display="none",document.body.append(o),this.iframe=o,n=s}),new Promise((s,o)=>setTimeout(()=>{window.removeEventListener("message",i),o("verify iframe load timeout")},We.toMiliseconds(We.FIVE_SECONDS)))])},this.removeIframe=()=>{this.iframe&&(this.iframe.remove(),this.iframe=void 0,this.initialized=!1)},this.logger=Qe.generateChildLogger(r,this.name),this.verifyUrl=pg,this.abortController=new AbortController,this.isDevEnv=ee.isNode()&&p.default.env.IS_VITEST}get context(){return Qe.getLoggerContext(this.logger)}startAbortTimer(e){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),We.toMiliseconds(e))}},UX=Object.defineProperty,k6=Object.getOwnPropertySymbols,qX=Object.prototype.hasOwnProperty,VX=Object.prototype.propertyIsEnumerable,j6=(t,e,r)=>e in t?UX(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Q6=(t,e)=>{for(var r in e||(e={}))qX.call(e,r)&&j6(t,r,e[r]);if(k6)for(var r of k6(e))VX.call(e,r)&&j6(t,r,e[r]);return t},Sg=class t extends ui.ICore{constructor(e){super(e),this.protocol=Ab,this.version=n8,this.name=xg,this.events=new no.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||bb,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";let r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:Qe.pino(Qe.getDefaultLoggerOptions({level:e?.logger||i8.logger}));this.logger=Qe.generateChildLogger(r,this.name),this.heartbeat=new Al.HeartBeat,this.crypto=new yg(this,this.logger,e?.keychain),this.history=new bg(this,this.logger),this.expirer=new _g(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new tJ.default(Q6(Q6({},s8),e?.storageOptions)),this.relayer=new Eg({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new Ag(this,this.logger),this.verify=new Ig(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(b8,n),r}get context(){return Qe.getLoggerContext(this.logger)}async start(){this.initialized||await this.initialize()}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}},HX=Sg;me.CORE_CONTEXT=xg,me.CORE_DEFAULT=i8,me.CORE_PROTOCOL=Ab,me.CORE_STORAGE_OPTIONS=s8,me.CORE_STORAGE_PREFIX=ai,me.CORE_VERSION=n8,me.CRYPTO_CLIENT_SEED=yb,me.CRYPTO_CONTEXT=o8,me.CRYPTO_JWT_TTL=a8,me.Core=HX,me.Crypto=yg,me.EXPIRER_CONTEXT=O8,me.EXPIRER_DEFAULT_TTL=SX,me.EXPIRER_EVENTS=Vr,me.EXPIRER_STORAGE_VERSION=D8,me.Expirer=_g,me.HISTORY_CONTEXT=x8,me.HISTORY_EVENTS=Yr,me.HISTORY_STORAGE_VERSION=N8,me.JsonRpcHistory=bg,me.KEYCHAIN_CONTEXT=u8,me.KEYCHAIN_STORAGE_VERSION=c8,me.KeyChain=gg,me.MESSAGES_CONTEXT=l8,me.MESSAGES_STORAGE_VERSION=f8,me.MessageTracker=mg,me.PAIRING_CONTEXT=T8,me.PAIRING_DEFAULT_TTL=IX,me.PAIRING_EVENTS=vl,me.PAIRING_RPC_OPTS=za,me.PAIRING_STORAGE_VERSION=C8,me.PENDING_SUB_RESOLUTION_TIMEOUT=S8,me.PUBLISHER_CONTEXT=d8,me.PUBLISHER_DEFAULT_TTL=h8,me.Pairing=Ag,me.RELAYER_CONTEXT=y8,me.RELAYER_DEFAULT_LOGGER=g8,me.RELAYER_DEFAULT_PROTOCOL=p8,me.RELAYER_DEFAULT_RELAY_URL=bb,me.RELAYER_EVENTS=nr,me.RELAYER_FAILOVER_RELAY_URL=mb,me.RELAYER_PROVIDER_EVENTS=Nn,me.RELAYER_RECONNECT_TIMEOUT=w8,me.RELAYER_SDK_VERSION=E8,me.RELAYER_STORAGE_OPTIONS=bX,me.RELAYER_SUBSCRIBER_SUFFIX=m8,me.RELAYER_TRANSPORT_CUTOFF=v8,me.Relayer=Eg,me.STORE_STORAGE_VERSION=A8,me.SUBSCRIBER_CONTEXT=_8,me.SUBSCRIBER_DEFAULT_TTL=_X,me.SUBSCRIBER_EVENTS=Hr,me.SUBSCRIBER_STORAGE_VERSION=I8,me.Store=vg,me.Subscriber=wg,me.VERIFY_CONTEXT=dg,me.VERIFY_FALLBACK_SERVER=wb,me.VERIFY_SERVER=pg,me.Verify=Ig,me.WALLETCONNECT_CLIENT_ID=b8,me.default=Sg});var k8=m(Je=>{"use strict";c();Object.defineProperty(Je,"__esModule",{value:!0});var Dn=P8(),Ng=qv(),L8=n1(),j=cl(),F8=Kn(),Xe=ks(),yt=(dl(),ct(Zt));function GX(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var kX=GX(F8),xb="wc",Nb=2,Ob="client",Rg=`${xb}@${Nb}:${Ob}:`,Og={name:Ob,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},jX={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"},QX={database:":memory:"},_b="WALLETCONNECT_DEEPLINK_CHOICE",WX={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},$X="history",zX="0.3",M8="proposal",KX=Xe.THIRTY_DAYS,U8="Proposal expired",q8="session",Il=Xe.SEVEN_DAYS,V8="engine",Ka={wc_sessionPropose:{req:{ttl:Xe.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:Xe.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:Xe.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:Xe.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:Xe.ONE_DAY,prompt:!1,tag:1104},res:{ttl:Xe.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:Xe.ONE_DAY,prompt:!1,tag:1106},res:{ttl:Xe.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:Xe.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:Xe.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:Xe.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:Xe.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:Xe.ONE_DAY,prompt:!1,tag:1112},res:{ttl:Xe.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:Xe.THIRTY_SECONDS,prompt:!1,tag:1114},res:{ttl:Xe.THIRTY_SECONDS,prompt:!1,tag:1115}}},Dg={min:Xe.FIVE_MINUTES,max:Xe.SEVEN_DAYS},On={idle:"IDLE",active:"ACTIVE"},H8="request",G8=["wc_sessionPropose","wc_sessionRequest","wc_authRequest"],YX=Object.defineProperty,JX=Object.defineProperties,XX=Object.getOwnPropertyDescriptors,R8=Object.getOwnPropertySymbols,ZX=Object.prototype.hasOwnProperty,eZ=Object.prototype.propertyIsEnumerable,B8=(t,e,r)=>e in t?YX(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,gr=(t,e)=>{for(var r in e||(e={}))ZX.call(e,r)&&B8(t,r,e[r]);if(R8)for(var r of R8(e))eZ.call(e,r)&&B8(t,r,e[r]);return t},_l=(t,e)=>JX(t,XX(e)),Ib=class extends L8.IEngine{constructor(e){super(e),this.name=V8,this.events=new kX.default,this.initialized=!1,this.ignoredPayloadTypes=[j.TYPE_1],this.requestQueue={state:On.idle,queue:[]},this.sessionRequestQueue={state:On.idle,queue:[]},this.requestQueueDelay=Xe.ONE_SECOND,this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),this.client.core.pairing.register({methods:Object.keys(Ka)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},Xe.toMiliseconds(this.requestQueueDelay)))},this.connect=async r=>{await this.isInitialized();let n=_l(gr({},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:U,uri:A}=await this.client.core.pairing.create();l=U,f=A}let g=await this.client.core.crypto.generateKeyPair(),w=gr({requiredNamespaces:s,optionalNamespaces:o,relays:u??[{protocol:Dn.RELAYER_DEFAULT_PROTOCOL}],proposer:{publicKey:g,metadata:this.client.metadata}},a&&{sessionProperties:a}),{reject:E,resolve:T,done:D}=j.createDelayedPromise(Xe.FIVE_MINUTES,U8);if(this.events.once(j.engineEvent("session_connect"),async({error:U,session:A})=>{if(U)E(U);else if(A){A.self.publicKey=g;let I=_l(gr({},A),{requiredNamespaces:A.requiredNamespaces,optionalNamespaces:A.optionalNamespaces});await this.client.session.set(A.topic,I),await this.setExpiry(A.topic,A.expiry),l&&await this.client.core.pairing.updateMetadata({topic:l,metadata:A.peer.metadata}),T(I)}}),!l){let{message:U}=j.getInternalError("NO_MATCHING_KEY",`connect() pairing topic: ${l}`);throw new Error(U)}let B=await this.sendRequest({topic:l,method:"wc_sessionPropose",params:w}),W=j.calcExpiry(Xe.FIVE_MINUTES);return await this.setProposal(B,gr({id:B,expiry:W},w)),{uri:f,approval:D}},this.pair=async r=>(await this.isInitialized(),await this.client.core.pairing.pair(r)),this.approve=async r=>{await this.isInitialized(),await this.isValidApprove(r);let{id:n,relayProtocol:i,namespaces:s,sessionProperties:o}=r,a=this.client.proposal.get(n),{pairingTopic:u,proposer:l,requiredNamespaces:f,optionalNamespaces:d}=a;u=u||"",j.isValidObject(f)||(f=j.getRequiredNamespacesFromNamespaces(s,"approve()"));let g=await this.client.core.crypto.generateKeyPair(),w=l.publicKey,E=await this.client.core.crypto.generateSharedKey(g,w);u&&n&&(await this.client.core.pairing.updateMetadata({topic:u,metadata:l.metadata}),await this.sendResult({id:n,topic:u,result:{relay:{protocol:i??"irn"},responderPublicKey:g}}),await this.client.proposal.delete(n,j.getSdkError("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:u}));let T=gr({relay:{protocol:i??"irn"},namespaces:s,requiredNamespaces:f,optionalNamespaces:d,pairingTopic:u,controller:{publicKey:g,metadata:this.client.metadata},expiry:j.calcExpiry(Il)},o&&{sessionProperties:o});await this.client.core.relayer.subscribe(E),await this.sendRequest({topic:E,method:"wc_sessionSettle",params:T,throwOnFailedPublish:!0});let D=_l(gr({},T),{topic:E,pairingTopic:u,acknowledged:!1,self:T.controller,peer:{publicKey:l.publicKey,metadata:l.metadata},controller:g});return await this.client.session.set(E,D),await this.setExpiry(E,j.calcExpiry(Il)),{topic:E,acknowledged:()=>new Promise(B=>setTimeout(()=>B(this.client.session.get(E)),500))}},this.reject=async r=>{await this.isInitialized(),await this.isValidReject(r);let{id:n,reason:i}=r,{pairingTopic:s}=this.client.proposal.get(n);s&&(await this.sendError(n,s,i),await this.client.proposal.delete(n,j.getSdkError("USER_DISCONNECTED")))},this.update=async r=>{await this.isInitialized(),await this.isValidUpdate(r);let{topic:n,namespaces:i}=r,s=await this.sendRequest({topic:n,method:"wc_sessionUpdate",params:{namespaces:i}}),{done:o,resolve:a,reject:u}=j.createDelayedPromise();return this.events.once(j.engineEvent("session_update",s),({error:l})=>{l?u(l):a()}),await this.client.session.update(n,{namespaces:i}),{acknowledged:o}},this.extend=async r=>{await this.isInitialized(),await this.isValidExtend(r);let{topic:n}=r,i=await this.sendRequest({topic:n,method:"wc_sessionExtend",params:{}}),{done:s,resolve:o,reject:a}=j.createDelayedPromise();return this.events.once(j.engineEvent("session_extend",i),({error:u})=>{u?a(u):o()}),await this.setExpiry(n,j.calcExpiry(Il)),{acknowledged:s}},this.request=async r=>{await this.isInitialized(),await this.isValidRequest(r);let{chainId:n,request:i,topic:s,expiry:o}=r,a=yt.payloadId(),{done:u,resolve:l,reject:f}=j.createDelayedPromise(o,"Request expired. Please try again.");return this.events.once(j.engineEvent("session_request",a),({error:d,result:g})=>{d?f(d):l(g)}),await Promise.all([new Promise(async d=>{await this.sendRequest({clientRpcId:a,topic:s,method:"wc_sessionRequest",params:{request:i,chainId:n},expiry:o,throwOnFailedPublish:!0}).catch(g=>f(g)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:a}),d()}),new Promise(async d=>{let g=await this.client.core.storage.getItem(_b);j.handleDeeplinkRedirect({id:a,topic:s,wcDeepLink:g}),d()}),u()]).then(d=>d[2])},this.respond=async r=>{await this.isInitialized(),await this.isValidRespond(r);let{topic:n,response:i}=r,{id:s}=i;yt.isJsonRpcResult(i)?await this.sendResult({id:s,topic:n,result:i.result,throwOnFailedPublish:!0}):yt.isJsonRpcError(i)&&await this.sendError(s,n,i.error),this.cleanupAfterResponse(r)},this.ping=async r=>{await this.isInitialized(),await this.isValidPing(r);let{topic:n}=r;if(this.client.session.keys.includes(n)){let i=await this.sendRequest({topic:n,method:"wc_sessionPing",params:{}}),{done:s,resolve:o,reject:a}=j.createDelayedPromise();this.events.once(j.engineEvent("session_ping",i),({error:u})=>{u?a(u):o()}),await s()}else this.client.core.pairing.pairings.keys.includes(n)&&await this.client.core.pairing.ping({topic:n})},this.emit=async r=>{await this.isInitialized(),await this.isValidEmit(r);let{topic:n,event:i,chainId:s}=r;await this.sendRequest({topic:n,method:"wc_sessionEvent",params:{event:i,chainId:s}})},this.disconnect=async r=>{await this.isInitialized(),await this.isValidDisconnect(r);let{topic:n}=r;this.client.session.keys.includes(n)?(await this.sendRequest({topic:n,method:"wc_sessionDelete",params:j.getSdkError("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession(n)):await this.client.core.pairing.disconnect({topic:n})},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(n=>j.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,j.getSdkError("USER_DISCONNECTED")),this.client.core.crypto.keychain.has(i.publicKey)&&await this.client.core.crypto.deleteKeyPair(i.publicKey),this.client.core.crypto.keychain.has(r)&&await this.client.core.crypto.deleteSymKey(r),n||this.client.core.expirer.del(r),this.client.core.storage.removeItem(_b).catch(s=>this.client.logger.warn(s))},this.deleteProposal=async(r,n)=>{await Promise.all([this.client.proposal.delete(r,j.getSdkError("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(r)])},this.deletePendingSessionRequest=async(r,n,i=!1)=>{await Promise.all([this.client.pendingRequest.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)]),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==r),i&&(this.sessionRequestQueue.state=On.idle)},this.setExpiry=async(r,n)=>{this.client.session.keys.includes(r)&&await this.client.session.update(r,{expiry:n}),this.client.core.expirer.set(r,n)},this.setProposal=async(r,n)=>{await this.client.proposal.set(r,n),this.client.core.expirer.set(r,n.expiry)},this.setPendingSessionRequest=async r=>{let n=Ka.wc_sessionRequest.req.ttl,{id:i,topic:s,params:o,verifyContext:a}=r;await this.client.pendingRequest.set(i,{id:i,topic:s,params:o,verifyContext:a}),n&&this.client.core.expirer.set(i,j.calcExpiry(n))},this.sendRequest=async r=>{let{topic:n,method:i,params:s,expiry:o,relayRpcId:a,clientRpcId:u,throwOnFailedPublish:l}=r,f=yt.formatJsonRpcRequest(i,s,u);if(j.isBrowser()&&G8.includes(i)){let w=j.hashMessage(JSON.stringify(f));this.client.core.verify.register({attestationId:w})}let d=await this.client.core.crypto.encode(n,f),g=Ka[i].req;return o&&(g.ttl=o),a&&(g.id=a),this.client.core.history.set(n,f),l?(g.internal=_l(gr({},g.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,d,g)):this.client.core.relayer.publish(n,d,g).catch(w=>this.client.logger.error(w)),f.id},this.sendResult=async r=>{let{id:n,topic:i,result:s,throwOnFailedPublish:o}=r,a=yt.formatJsonRpcResult(n,s),u=await this.client.core.crypto.encode(i,a),l=await this.client.core.history.get(i,n),f=Ka[l.request.method].res;o?(f.internal=_l(gr({},f.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,u,f)):this.client.core.relayer.publish(i,u,f).catch(d=>this.client.logger.error(d)),await this.client.core.history.resolve(a)},this.sendError=async(r,n,i)=>{let s=yt.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=>{j.isExpired(i.expiry)&&r.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{j.isExpired(i.expiry)&&n.push(i.id)}),await Promise.all([...r.map(i=>this.deleteSession(i)),...n.map(i=>this.deleteProposal(i))])},this.onRelayEventRequest=async r=>{this.requestQueue.queue.push(r),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===On.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=On.active;let r=this.requestQueue.queue.shift();if(r)try{this.processRequest(r),await new Promise(n=>setTimeout(n,300))}catch(n){this.client.logger.warn(n)}}this.requestQueue.state=On.idle},this.processRequest=r=>{let{topic:n,payload:i}=r,s=i.method;switch(s){case"wc_sessionPropose":return this.onSessionProposeRequest(n,i);case"wc_sessionSettle":return this.onSessionSettleRequest(n,i);case"wc_sessionUpdate":return this.onSessionUpdateRequest(n,i);case"wc_sessionExtend":return this.onSessionExtendRequest(n,i);case"wc_sessionPing":return this.onSessionPingRequest(n,i);case"wc_sessionDelete":return this.onSessionDeleteRequest(n,i);case"wc_sessionRequest":return this.onSessionRequest(n,i);case"wc_sessionEvent":return this.onSessionEventRequest(n,i);default:return this.client.logger.info(`Unsupported request method ${s}`)}},this.onRelayEventResponse=async r=>{let{topic:n,payload:i}=r,s=(await this.client.core.history.get(n,i.id)).request.method;switch(s){case"wc_sessionPropose":return this.onSessionProposeResponse(n,i);case"wc_sessionSettle":return this.onSessionSettleResponse(n,i);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,i);case"wc_sessionExtend":return this.onSessionExtendResponse(n,i);case"wc_sessionPing":return this.onSessionPingResponse(n,i);case"wc_sessionRequest":return this.onSessionRequestResponse(n,i);default:return this.client.logger.info(`Unsupported response method ${s}`)}},this.onRelayEventUnknownPayload=r=>{let{topic:n}=r,{message:i}=j.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(gr({},n.params));let o=j.calcExpiry(Xe.FIVE_MINUTES),a=gr({id:s,pairingTopic:r,expiry:o},i);await this.setProposal(s,a);let u=j.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(yt.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 yt.isJsonRpcError(n)&&(await this.client.proposal.delete(i,j.getSdkError("USER_DISCONNECTED")),this.events.emit(j.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:w}=n.params,E=gr({topic:r,relay:o,expiry:u,namespaces:l,acknowledged:!0,pairingTopic:w,requiredNamespaces:f,optionalNamespaces:d,controller:a.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}},g&&{sessionProperties:g});await this.sendResult({id:n.id,topic:r,result:!0}),this.events.emit(j.engineEvent("session_connect"),{session:E}),this.cleanupDuplicatePairings(E)}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.onSessionSettleResponse=async(r,n)=>{let{id:i}=n;yt.isJsonRpcResult(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(j.engineEvent("session_approve",i),{})):yt.isJsonRpcError(n)&&(await this.client.session.delete(r,j.getSdkError("USER_DISCONNECTED")),this.events.emit(j.engineEvent("session_approve",i),{error:n.error}))},this.onSessionUpdateRequest=async(r,n)=>{let{params:i,id:s}=n;try{let o=`${r}_session_update`,a=j.MemoryStore.get(o);if(a&&this.isRequestOutOfSync(a,s)){this.client.logger.info(`Discarding out of sync request - ${s}`);return}this.isValidUpdate(gr({topic:r},i)),await this.client.session.update(r,{namespaces:i.namespaces}),await this.sendResult({id:s,topic:r,result:!0}),this.client.events.emit("session_update",{id:s,topic:r,params:i}),j.MemoryStore.set(o,s)}catch(o){await this.sendError(s,r,o),this.client.logger.error(o)}},this.isRequestOutOfSync=(r,n)=>parseInt(n.toString().slice(0,-3))<=parseInt(r.toString().slice(0,-3)),this.onSessionUpdateResponse=(r,n)=>{let{id:i}=n;yt.isJsonRpcResult(n)?this.events.emit(j.engineEvent("session_update",i),{}):yt.isJsonRpcError(n)&&this.events.emit(j.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,j.calcExpiry(Il)),await this.sendResult({id:i,topic:r,result:!0}),this.client.events.emit("session_extend",{id:i,topic:r})}catch(s){await this.sendError(i,r,s),this.client.logger.error(s)}},this.onSessionExtendResponse=(r,n)=>{let{id:i}=n;yt.isJsonRpcResult(n)?this.events.emit(j.engineEvent("session_extend",i),{}):yt.isJsonRpcError(n)&&this.events.emit(j.engineEvent("session_extend",i),{error:n.error})},this.onSessionPingRequest=async(r,n)=>{let{id:i}=n;try{this.isValidPing({topic:r}),await this.sendResult({id:i,topic:r,result:!0}),this.client.events.emit("session_ping",{id:i,topic:r})}catch(s){await this.sendError(i,r,s),this.client.logger.error(s)}},this.onSessionPingResponse=(r,n)=>{let{id:i}=n;setTimeout(()=>{yt.isJsonRpcResult(n)?this.events.emit(j.engineEvent("session_ping",i),{}):yt.isJsonRpcError(n)&&this.events.emit(j.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(Dn.RELAYER_EVENTS.publish,async()=>{s(await this.deleteSession(r))})}),this.sendResult({id:i,topic:r,result:!0})]),this.client.events.emit("session_delete",{id:i,topic:r})}catch(s){this.client.logger.error(s)}},this.onSessionRequest=async(r,n)=>{let{id:i,params:s}=n;try{this.isValidRequest(gr({topic:r},s));let o=j.hashMessage(JSON.stringify(yt.formatJsonRpcRequest("wc_sessionRequest",s,i))),a=this.client.session.get(r),u=await this.getVerifyContext(o,a.peer.metadata),l={id:i,topic:r,params:s,verifyContext:u};await this.setPendingSessionRequest(l),this.addSessionRequestToSessionRequestQueue(l),this.processSessionRequestQueue()}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.onSessionRequestResponse=(r,n)=>{let{id:i}=n;yt.isJsonRpcResult(n)?this.events.emit(j.engineEvent("session_request",i),{result:n.result}):yt.isJsonRpcError(n)&&this.events.emit(j.engineEvent("session_request",i),{error:n.error})},this.onSessionEventRequest=async(r,n)=>{let{id:i,params:s}=n;try{let o=`${r}_session_event_${s.event.name}`,a=j.MemoryStore.get(o);if(a&&this.isRequestOutOfSync(a,i)){this.client.logger.info(`Discarding out of sync request - ${i}`);return}this.isValidEmit(gr({topic:r},s)),this.client.events.emit("session_event",{id:i,topic:r,params:s}),j.MemoryStore.set(o,i)}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.addSessionRequestToSessionRequestQueue=r=>{this.sessionRequestQueue.queue.push(r)},this.cleanupAfterResponse=r=>{this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=On.idle,this.processSessionRequestQueue()},Xe.toMiliseconds(this.requestQueueDelay))},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===On.active){this.client.logger.info("session request queue is already active.");return}let r=this.sessionRequestQueue.queue[0];if(!r){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=On.active,this.client.events.emit("session_request",r)}catch(n){this.client.logger.error(n)}},this.onPairingCreated=r=>{if(r.active)return;let n=this.client.proposal.getAll().find(i=>i.pairingTopic===r.topic);n&&this.onSessionProposeRequest(r.topic,yt.formatJsonRpcRequest("wc_sessionPropose",{requiredNamespaces:n.requiredNamespaces,optionalNamespaces:n.optionalNamespaces,relays:n.relays,proposer:n.proposer},n.id))},this.isValidConnect=async r=>{if(!j.isValidParams(r)){let{message:u}=j.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(j.isUndefined(n)||await this.isValidPairingTopic(n),!j.isValidRelays(a,!0)){let{message:u}=j.getInternalError("MISSING_OR_INVALID",`connect() relays: ${a}`);throw new Error(u)}!j.isUndefined(i)&&j.isValidObject(i)!==0&&this.validateNamespaces(i,"requiredNamespaces"),!j.isUndefined(s)&&j.isValidObject(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),j.isUndefined(o)||this.validateSessionProps(o,"sessionProperties")},this.validateNamespaces=(r,n)=>{let i=j.isValidRequiredNamespaces(r,"connect()",n);if(i)throw new Error(i.message)},this.isValidApprove=async r=>{if(!j.isValidParams(r))throw new Error(j.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=j.isValidNamespaces(i,"approve()");if(u)throw new Error(u.message);let l=j.isConformingNamespaces(a.requiredNamespaces,i,"approve()");if(l)throw new Error(l.message);if(!j.isValidString(s,!0)){let{message:f}=j.getInternalError("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(f)}j.isUndefined(o)||this.validateSessionProps(o,"sessionProperties")},this.isValidReject=async r=>{if(!j.isValidParams(r)){let{message:s}=j.getInternalError("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(s)}let{id:n,reason:i}=r;if(await this.isValidProposalId(n),!j.isValidErrorReason(i)){let{message:s}=j.getInternalError("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidSessionSettleRequest=r=>{if(!j.isValidParams(r)){let{message:l}=j.getInternalError("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(l)}let{relay:n,controller:i,namespaces:s,expiry:o}=r;if(!j.isValidRelay(n)){let{message:l}=j.getInternalError("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(l)}let a=j.isValidController(i,"onSessionSettleRequest()");if(a)throw new Error(a.message);let u=j.isValidNamespaces(s,"onSessionSettleRequest()");if(u)throw new Error(u.message);if(j.isExpired(o)){let{message:l}=j.getInternalError("EXPIRED","onSessionSettleRequest()");throw new Error(l)}},this.isValidUpdate=async r=>{if(!j.isValidParams(r)){let{message:u}=j.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=j.isValidNamespaces(i,"update()");if(o)throw new Error(o.message);let a=j.isConformingNamespaces(s.requiredNamespaces,i,"update()");if(a)throw new Error(a.message)},this.isValidExtend=async r=>{if(!j.isValidParams(r)){let{message:i}=j.getInternalError("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionTopic(n)},this.isValidRequest=async r=>{if(!j.isValidParams(r)){let{message:u}=j.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(!j.isValidNamespacesChainId(a,s)){let{message:u}=j.getInternalError("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(u)}if(!j.isValidRequest(i)){let{message:u}=j.getInternalError("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(u)}if(!j.isValidNamespacesRequest(a,s,i.method)){let{message:u}=j.getInternalError("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(u)}if(o&&!j.isValidRequestExpiry(o,Dg)){let{message:u}=j.getInternalError("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${Dg.min} and ${Dg.max}`);throw new Error(u)}},this.isValidRespond=async r=>{if(!j.isValidParams(r)){let{message:s}=j.getInternalError("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(s)}let{topic:n,response:i}=r;if(await this.isValidSessionTopic(n),!j.isValidResponse(i)){let{message:s}=j.getInternalError("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidPing=async r=>{if(!j.isValidParams(r)){let{message:i}=j.getInternalError("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async r=>{if(!j.isValidParams(r)){let{message:a}=j.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(!j.isValidNamespacesChainId(o,s)){let{message:a}=j.getInternalError("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(a)}if(!j.isValidEvent(i)){let{message:a}=j.getInternalError("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}if(!j.isValidNamespacesEvent(o,s,i.name)){let{message:a}=j.getInternalError("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}},this.isValidDisconnect=async r=>{if(!j.isValidParams(r)){let{message:i}=j.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||Dn.VERIFY_SERVER,validation:"UNKNOWN",origin:n.url||""}};try{let s=await this.client.core.verify.resolve({attestationId:r,verifyUrl:n.verifyUrl});s&&(i.verified.origin=s.origin,i.verified.isScam=s.isScam,i.verified.validation=s.origin===new URL(n.url).origin?"VALID":"INVALID")}catch(s){this.client.logger.info(s)}return this.client.logger.info(`Verify context: ${JSON.stringify(i)}`),i},this.validateSessionProps=(r,n)=>{Object.values(r).forEach(i=>{if(!j.isValidString(i,!1)){let{message:s}=j.getInternalError("MISSING_OR_INVALID",`${n} must be in Record format. Received: ${JSON.stringify(i)}`);throw new Error(s)}})}}async isInitialized(){if(!this.initialized){let{message:e}=j.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(Dn.RELAYER_EVENTS.message,async e=>{let{topic:r,message:n}=e;if(this.ignoredPayloadTypes.includes(this.client.core.crypto.getPayloadType(n)))return;let i=await this.client.core.crypto.decode(r,n);try{yt.isJsonRpcRequest(i)?(this.client.core.history.set(r,i),this.onRelayEventRequest({topic:r,payload:i})):yt.isJsonRpcResponse(i)?(await this.client.core.history.resolve(i),await this.onRelayEventResponse({topic:r,payload:i}),this.client.core.history.delete(r,i.id)):this.onRelayEventUnknownPayload({topic:r,payload:i})}catch(s){this.client.logger.error(s)}})}registerExpirerEvents(){this.client.core.expirer.on(Dn.EXPIRER_EVENTS.expired,async e=>{let{topic:r,id:n}=j.parseExpirerTarget(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,j.getInternalError("EXPIRED"),!0);r?this.client.session.keys.includes(r)&&(await this.deleteSession(r,!0),this.client.events.emit("session_expire",{topic:r})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}registerPairingEvents(){this.client.core.pairing.events.on(Dn.PAIRING_EVENTS.create,e=>this.onPairingCreated(e))}isValidPairingTopic(e){if(!j.isValidString(e,!1)){let{message:r}=j.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}=j.getInternalError("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(j.isExpired(this.client.core.pairing.pairings.get(e).expiry)){let{message:r}=j.getInternalError("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!j.isValidString(e,!1)){let{message:r}=j.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}=j.getInternalError("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(j.isExpired(this.client.session.get(e).expiry)){await this.deleteSession(e);let{message:r}=j.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(j.isValidString(e,!1)){let{message:r}=j.getInternalError("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{let{message:r}=j.getInternalError("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!j.isValidId(e)){let{message:r}=j.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}=j.getInternalError("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(j.isExpired(this.client.proposal.get(e).expiry)){await this.deleteProposal(e);let{message:r}=j.getInternalError("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}},Sb=class extends Dn.Store{constructor(e,r){super(e,r,M8,Rg),this.core=e,this.logger=r}},Tb=class extends Dn.Store{constructor(e,r){super(e,r,q8,Rg),this.core=e,this.logger=r}},Cb=class extends Dn.Store{constructor(e,r){super(e,r,H8,Rg,n=>n.id),this.core=e,this.logger=r}},Pg=class t extends L8.ISignClient{constructor(e){super(e),this.protocol=xb,this.version=Nb,this.name=Og.name,this.events=new F8.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||Og.name,this.metadata=e?.metadata||j.getAppMetadata();let r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:Ng.pino(Ng.getDefaultLoggerOptions({level:e?.logger||Og.logger}));this.core=e?.core||new Dn.Core(e),this.logger=Ng.generateChildLogger(r,this.name),this.session=new Tb(this.core,this.logger),this.proposal=new Sb(this.core,this.logger),this.pendingRequest=new Cb(this.core,this.logger),this.engine=new Ib(this)}static async init(e){let r=new t(e);return await r.initialize(),r}get context(){return Ng.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}}},tZ=Pg;Je.ENGINE_CONTEXT=V8,Je.ENGINE_QUEUE_STATES=On,Je.ENGINE_RPC_OPTS=Ka,Je.HISTORY_CONTEXT=$X,Je.HISTORY_EVENTS=WX,Je.HISTORY_STORAGE_VERSION=zX,Je.METHODS_TO_VERIFY=G8,Je.PROPOSAL_CONTEXT=M8,Je.PROPOSAL_EXPIRY=KX,Je.PROPOSAL_EXPIRY_MESSAGE=U8,Je.REQUEST_CONTEXT=H8,Je.SESSION_CONTEXT=q8,Je.SESSION_EXPIRY=Il,Je.SESSION_REQUEST_EXPIRY_BOUNDARIES=Dg,Je.SIGN_CLIENT_CONTEXT=Ob,Je.SIGN_CLIENT_DEFAULT=Og,Je.SIGN_CLIENT_EVENTS=jX,Je.SIGN_CLIENT_PROTOCOL=xb,Je.SIGN_CLIENT_STORAGE_OPTIONS=QX,Je.SIGN_CLIENT_STORAGE_PREFIX=Rg,Je.SIGN_CLIENT_VERSION=Nb,Je.SignClient=tZ,Je.WALLETCONNECT_DEEPLINK_CHOICE=_b,Je.default=Pg});var Bg=m(Ji=>{"use strict";c();Object.defineProperty(Ji,"__esModule",{value:!0});Ji.OptionalOperation=Ji.Operation=void 0;var rZ;(function(t){t.SIGN_TRANSACTION="mvx_signTransaction",t.SIGN_TRANSACTIONS="mvx_signTransactions",t.SIGN_MESSAGE="mvx_signMessage"})(rZ=Ji.Operation||(Ji.Operation={}));var nZ;(function(t){t.SIGN_LOGIN_TOKEN="mvx_signLoginToken",t.SIGN_NATIVE_AUTH_TOKEN="mvx_signNativeAuthToken",t.CANCEL_ACTION="mvx_cancelAction"})(nZ=Ji.OptionalOperation||(Ji.OptionalOperation={}))});var Db=m(Pn=>{"use strict";c();Object.defineProperty(Pn,"__esModule",{value:!0});Pn.WALLETCONNECT_SIGN_LOGIN_DELAY=Pn.WALLETCONNECT_MULTIVERSX_OPTIONAL_METHODS=Pn.WALLETCONNECT_MULTIVERSX_METHODS=Pn.WALLETCONNECT_MULTIVERSX_NAMESPACE=void 0;var j8=Bg();Pn.WALLETCONNECT_MULTIVERSX_NAMESPACE="mvx";Pn.WALLETCONNECT_MULTIVERSX_METHODS=Object.values(j8.Operation);Pn.WALLETCONNECT_MULTIVERSX_OPTIONAL_METHODS=Object.values(j8.OptionalOperation);Pn.WALLETCONNECT_SIGN_LOGIN_DELAY=200});var Bb=m(Jr=>{"use strict";c();Object.defineProperty(Jr,"__esModule",{value:!0});Jr.WalletConnectV2ProviderErrorMessagesEnum=Jr.ErrBadAddress=Jr.ErrNotImplemented=Jr.Err=void 0;var Sl=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};Jr.Err=Sl;var Pb=class extends Sl{constructor(){super("Method not yet implemented")}};Jr.ErrNotImplemented=Pb;var Rb=class extends Sl{constructor(e,r){super(`Bad address: ${e}`,r)}};Jr.ErrBadAddress=Rb;var iZ;(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"})(iZ=Jr.WalletConnectV2ProviderErrorMessagesEnum||(Jr.WalletConnectV2ProviderErrorMessagesEnum={}))});var Fb=m(Lg=>{"use strict";c();Object.defineProperty(Lg,"__esModule",{value:!0});Lg.Logger=void 0;var Lb=class{static error(e){console.error(e)}static trace(e){console.trace(e)}};Lg.Logger=Lb});var Q8=m(()=>{"use strict";c();global.Buffer||(global.Buffer=Ps().Buffer)});var $8=m(W8=>{"use strict";c();Object.defineProperty(W8,"__esModule",{value:!0})});var K8=m(z8=>{"use strict";c();Object.defineProperty(z8,"__esModule",{value:!0})});var Y8=m(Ya=>{"use strict";c();var sZ=Ya&&Ya.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ya,"__esModule",{value:!0});Ya.RelayedTransactionV1Builder=void 0;var oZ=sZ(Gt()),Mb=ht(),aZ=Be(),uZ=wn(),cZ=jn(),Ub=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 aZ.ErrInvalidRelayedV1BuilderArguments;let e=this.prepareInnerTransaction(),r=`relayedTx@${h.Buffer.from(e).toString("hex")}`,n=new cZ.TransactionPayload(r),i=this.netConfig.MinGasLimit+this.netConfig.GasPerDataByte*n.length()+this.innerTransaction.getGasLimit().valueOf(),s=new uZ.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 Mb.Address(this.innerTransaction.getSender().bech32()).pubkey().toString("base64"),receiver:new Mb.Address(this.innerTransaction.getReceiver().bech32()).pubkey().toString("base64"),value:new oZ.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 Mb.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)}};Ya.RelayedTransactionV1Builder=Ub});var J8=m(Fg=>{"use strict";c();Object.defineProperty(Fg,"__esModule",{value:!0});Fg.Code=void 0;var qb=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")}};Fg.Code=qb});var Z8=m(X8=>{"use strict";c();Object.defineProperty(X8,"__esModule",{value:!0})});var nB=m(Xa=>{"use strict";c();Object.defineProperty(Xa,"__esModule",{value:!0});Xa.bech32m=Xa.bech32=void 0;var Mg="qpzry9x8gf2tvdw0s3jn54khce6mua7l",tB={};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 eB(t){let e=1;for(let r=0;r126)return"Invalid prefix ("+t+")";e=Ja(e)^n>>5}e=Ja(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=eB(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=Ja(l)^g,f+=Mg.charAt(g)}for(let d=0;d<6;++d)l=Ja(l);l^=e;for(let d=0;d<6;++d){let g=l>>(5-d)*5&31;f+=Mg.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 w=eB(d);if(typeof w=="string")return w;let E=[];for(let T=0;T=g.length)&&E.push(B)}return w!==e?"Invalid checksum for "+o:{prefix:d,words:E}}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:lZ,fromWordsUnsafe:fZ,fromWords:hZ}}Xa.bech32=rB("bech32");Xa.bech32m=rB("bech32m")});var sB=m(Gr=>{"use strict";c();Object.defineProperty(Gr,"__esModule",{value:!0});Gr.TokenTransferProperties=Gr.TransactionMetadataTransfer=Gr.TransactionMetadata=Gr.TransactionToDecode=Gr.TransactionDecoder=void 0;var iB=nB(),Hb=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 io;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 Ug;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 io;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 io;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 io;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=iB.bech32.toWords(r);return iB.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)}};Gr.TransactionDecoder=Hb;var Ug=class{constructor(){this.sender="",this.receiver="",this.data="",this.value="0"}};Gr.TransactionToDecode=Ug;var io=class{constructor(){this.sender="",this.receiver="",this.value=BigInt(0)}};Gr.TransactionMetadata=io;var Gb=class{constructor(){this.value=BigInt(0)}};Gr.TransactionMetadataTransfer=Gb;var kb=class{};Gr.TokenTransferProperties=kb});var jb=m(qg=>{"use strict";c();Object.defineProperty(qg,"__esModule",{value:!0});qg.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)}};qg.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 uB=m(Vg=>{"use strict";c();Object.defineProperty(Vg,"__esModule",{value:!0});Vg.ResultsParser=void 0;var dZ=sB(),oB=ht(),aB=Be(),Xi=na(),pZ=Wo(),Za=jb(),eu;(function(t){t.OnTransactionCompleted="completedTxEvent",t.OnSignalError="signalError",t.OnWriteLog="writeLog"})(eu||(eu={}));var Qb;(function(t){t.TooMuchGas="@too much gas provided for processing"})(Qb||(Qb={}));var gZ={argsSerializer:new pZ.ArgSerializer},Wb=class{constructor(e){e=Object.assign(Object.assign({},gZ),e),this.argsSerializer=e.argsSerializer}parseQueryResponse(e,r){let n=e.getReturnDataParts(),i=this.argsSerializer.buffersToValues(n,r.output);return{returnCode:new Za.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 Za.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 Xi.Logger.trace("parseUntypedOutcome(): on simple move balance"),r;if(r=this.createBundleOnInvalidTransaction(e),r)return Xi.Logger.trace("parseUntypedOutcome(): on invalid transaction"),r;if(r=this.createBundleOnEasilyFoundResultWithReturnData(e.contractResults),r)return Xi.Logger.trace("parseUntypedOutcome(): on easily found result with return data"),r;if(r=this.createBundleOnSignalError(e.logs),r)return Xi.Logger.trace("parseUntypedOutcome(): on signal error"),r;if(r=this.createBundleOnTooMuchGasWarning(e.logs),r)return Xi.Logger.trace("parseUntypedOutcome(): on 'too much gas' warning"),r;if(r=this.createBundleOnWriteLogWhereFirstTopicEqualsAddress(e.logs,e.sender),r)return Xi.Logger.trace("parseUntypedOutcome(): on writelog with topics[0] == tx.sender"),r;if(r=this.createBundleWithCustomHeuristics(e,n),r)return Xi.Logger.trace("parseUntypedOutcome(): with custom heuristics"),r;if(r=this.createBundleWithFallbackHeuristics(e,n),r)return Xi.Logger.trace("parseUntypedOutcome(): with fallback heuristics"),r;throw new aB.ErrCannotParseContractResults(`transaction ${e.hash.toString()}`)}parseTransactionMetadata(e){return new dZ.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:Za.ReturnCode.None,returnMessage:Za.ReturnCode.None.toString(),values:[]}:null}createBundleOnInvalidTransaction(e){return e.status.isInvalid()&&e.receipt.data?{returnCode:Za.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(eu.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(eu.OnWriteLog,a=>a.findFirstOrNoneTopic(u=>u.toString().startsWith(Qb.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 oB.Address(r.bech32()).hex(),i=e.findSingleOrNoneEvent(eu.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 oB.Address(r.receiver);for(let i of e.contractResults.items){let s=i.logs.findSingleOrNoneEvent(eu.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 aB.ErrCannotParseContractResults("no return code");return{returnCode:Za.ReturnCode.fromBuffer(i),returnDataParts:s}}};Vg.ResultsParser=Wb});var $b=m(At=>{"use strict";c();var yZ=At&&At.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ir=At&&At.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&yZ(e,t,r)};Object.defineProperty(At,"__esModule",{value:!0});ir(Wo(),At);ir(J8(),At);ir(pw(),At);ir(cE(),At);ir(wc(),At);ir(wE(),At);ir(dE(),At);ir(Z8(),At);ir(AE(),At);ir(Ec(),At);ir(uB(),At);ir(jb(),At);ir(fv(),At);ir(xE(),At);ir(St(),At)});var lB=m(Hg=>{"use strict";c();Object.defineProperty(Hg,"__esModule",{value:!0});Hg.RelayedTransactionV2Builder=void 0;var cB=Be(),Tl=$b(),mZ=wn(),wZ=jn(),zb=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 cB.ErrInvalidRelayedV2BuilderArguments;if(this.innerTransaction.getGasLimit()!=0)throw new cB.ErrGasLimitShouldBe0ForInnerTransaction;let{argumentsString:e}=new Tl.ArgSerializer().valuesToString([new Tl.AddressValue(this.innerTransaction.getReceiver()),new Tl.U64Value(this.innerTransaction.getNonce().valueOf()),new Tl.BytesValue(this.innerTransaction.getData().valueOf()),new Tl.BytesValue(this.innerTransaction.getSignature())]),r=`relayedTxV2@${e}`,n=new wZ.TransactionPayload(r),i=new mZ.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}};Hg.RelayedTransactionV2Builder=zb});var fB=m(so=>{"use strict";c();Object.defineProperty(so,"__esModule",{value:!0});so.SignableMessage=so.MESSAGE_PREFIX=void 0;var EZ=ht(),vZ=av();so.MESSAGE_PREFIX=`Elrond Signed Message: +`;var Kb=class{constructor(e){this.message=h.Buffer.from([]),this.signature=h.Buffer.from([]),this.version=1,this.signer="ErdJS",this.address=new EZ.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(so.MESSAGE_PREFIX),r]);return vZ("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}}};so.SignableMessage=Kb});var Jb=m(at=>{"use strict";c();var AZ=at&&at.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),bZ=at&&at.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hB=at&&at.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&AZ(e,t,r);return bZ(e,t),e},_Z=at&&at.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(at,"__esModule",{value:!0});at.addressToHex=at.bufferToHex=at.utf8ToHex=at.bigIntToHex=at.bigIntToBuffer=at.bufferToBigInt=at.stringToBuffer=void 0;var IZ=_Z(Gt()),SZ=ht(),Yb=hB(ac()),dB=hB(ph());function TZ(t){return h.Buffer.from(t)}at.stringToBuffer=TZ;function CZ(t){return t.length==0?new IZ.default(0):Yb.bufferToBigInt(t)}at.bufferToBigInt=CZ;function xZ(t){return t==0?h.Buffer.from([]):Yb.bigIntToBuffer(t)}at.bigIntToBuffer=xZ;function NZ(t){return t==0?"":Yb.getHexMagnitudeOfBigInt(t)}at.bigIntToHex=NZ;function OZ(t){let e=h.Buffer.from(t).toString("hex");return dB.zeroPadStringIfOddLength(e)}at.utf8ToHex=OZ;function DZ(t){let e=t.toString("hex");return dB.zeroPadStringIfOddLength(e)}at.bufferToHex=DZ;function PZ(t){return SZ.Address.fromBech32(t.toString()).pubkey().toString("hex")}at.addressToHex=PZ});var gB=m(Gg=>{"use strict";c();Object.defineProperty(Gg,"__esModule",{value:!0});Gg.TokenOperationsFactory=void 0;var Xb=bs(),RZ=na(),pB=cc(),BZ=wn(),LZ=jn(),ne=Jb(),Zb=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(){RZ.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 z6.TransactionVersion(qb.TRANSACTION_VERSION_DEFAULT),g=new z6.TransactionOptions(qb.TRANSACTION_OPTIONS_DEFAULT);return new rZ.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(qb.ARGUMENTS_SEPARATOR);return new nZ.TransactionPayload(r)}computeGasLimit(e,r){return this.config.minGasLimit.valueOf()+this.config.gasLimitPerByte.valueOf()*e.length()+r.valueOf()}};Pg.TokenOperationsFactory=Vb});var K6=m(Rg=>{"use strict";c();Object.defineProperty(Rg,"__esModule",{value:!0});Rg.TokenOperationsFactoryConfig=void 0;var iZ=ht(),Hb=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=iZ.Address.fromBech32("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u"),this.chainID=e}};Rg.TokenOperationsFactoryConfig=Hb});var J6=m(Bg=>{"use strict";c();Object.defineProperty(Bg,"__esModule",{value:!0});Bg.TokenOperationsOutcomeParser=void 0;var sZ=ht(),Gb=Be(),Y6=Ub(),jb=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 Gb.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 Gb.ErrCannotParseTransactionOutcome(e.hash,`cannot find event of type ${r}`);if(n.length>1)throw new Gb.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 Y6.bufferToBigInt((r=e.topics[1])===null||r===void 0?void 0:r.valueOf()).toFixed(0)}extractAmount(e){var r;return Y6.bufferToBigInt((r=e.topics[2])===null||r===void 0?void 0:r.valueOf()).toFixed(0)}extractAddress(e){var r;return sZ.Address.fromBuffer((r=e.topics[3])===null||r===void 0?void 0:r.valueOf()).toString()}};Bg.TokenOperationsOutcomeParser=jb});var X6=m(si=>{"use strict";c();var oZ=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]}),kb=si&&si.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&oZ(e,t,r)};Object.defineProperty(si,"__esModule",{value:!0});kb($6(),si);kb(K6(),si);kb(J6(),si)});var Z6=m(Ze=>{"use strict";c();var aZ=Ze&&Ze.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Tt=Ze&&Ze.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&aZ(e,t,r)};Object.defineProperty(Ze,"__esModule",{value:!0});I6();Tt(Yo(),Ze);Tt(ht(),Ze);Tt(Kw(),Ze);Tt(Be(),Ze);Tt(Qw(),Ze);Tt(T6(),Ze);Tt(x6(),Ze);Tt(Jo(),Ze);Tt(oc(),Ze);Tt(N6(),Ze);Tt(j6(),Ze);Tt(k6(),Ze);Tt(Bb(),Ze);Tt(X6(),Ze);Tt(um(),Ze);Tt(mn(),Ze);Tt(qn(),Ze);Tt(Wh(),Ze);Tt(jw(),Ze);Tt(gr(),Ze)});var sB=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 rB=Z6(),eB=Fh(),uZ=ol(),Lg=wb(),oi=Ab(),Qb=_b(),tB=Ig();function nB(t,e){if(!e)throw new Error(oi.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=e.find(iB(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 Qb.Logger.error(oi.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),new Error(oi.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected)}Xt.getCurrentSession=nB;function cZ(t,e){if(!e)throw new Error(oi.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=nB(t,e);if(!r?.topic)throw new Error(oi.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);return r.topic}Xt.getCurrentTopic=cZ;function iB(t,e){var r,n,i;let s=[...Lg.WALLETCONNECT_MULTIVERSX_METHODS,...(r=e?.methods)!==null&&r!==void 0?r:[]];!((n=e?.methods)===null||n===void 0)&&n.includes(tB.OptionalOperation.SIGN_LOGIN_TOKEN)||s.push(tB.OptionalOperation.SIGN_LOGIN_TOKEN);let o=[`${Lg.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${t}`],a=(i=e?.events)!==null&&i!==void 0?i:[];return{requiredNamespaces:{[Lg.WALLETCONNECT_MULTIVERSX_NAMESPACE]:{methods:s,chains:o,events:a}}}}Xt.getConnectionParams=iB;function lZ(t){try{return!rB.Address.fromBech32(t).isEmpty()}catch{return!1}}Xt.addressIsValid=lZ;function fZ(t){let e=t.namespaces[Lg.WALLETCONNECT_MULTIVERSX_NAMESPACE];if(e&&e.accounts){let r=e.accounts[0],[n,i,s]=r.split(":");return s}return""}Xt.getAddressFromSession=fZ;function hZ({transaction:t,response:e}){if(!e)throw Qb.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 Qb.Logger.error(oi.WalletConnectV2ProviderErrorMessagesEnum.invalidGuardian),new Error(oi.WalletConnectV2ProviderErrorMessagesEnum.invalidGuardian);return o&&t.setGuardian(rB.Address.fromBech32(o)),i&&t.setVersion(i),s!=null&&t.setOptions(s),t.applySignature(new eB.Signature(r)),n&&t.applyGuardianSignature(new eB.Signature(n)),t}Xt.applyTransactionSignature=hZ;function dZ(t){if(t)return Object.assign(Object.assign({},t),{url:uZ.getAppMetadata().url})}Xt.getMetadata=dZ});var bl=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())})},pZ=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 gZ=Fh(),yZ=pZ(b6()),Wb=ol(),Xa=wb(),ye=Ab();Object.defineProperty(dr,"WalletConnectV2ProviderErrorMessagesEnum",{enumerable:!0,get:function(){return ye.WalletConnectV2ProviderErrorMessagesEnum}});var Le=_b(),Ki=Ig();Object.defineProperty(dr,"Operation",{enumerable:!0,get:function(){return Ki.Operation}});Object.defineProperty(dr,"OptionalOperation",{enumerable:!0,get:function(){return Ki.OptionalOperation}});var Zt=sB(),zb=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 yZ.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[Xa.WALLETCONNECT_MULTIVERSX_NAMESPACE].methods.includes(Ki.OptionalOperation.SIGN_NATIVE_AUTH_TOKEN)?Ki.OptionalOperation.SIGN_NATIVE_AUTH_TOKEN:Ki.OptionalOperation.SIGN_LOGIN_TOKEN,{signature:a}=yield this.walletConnector.request({chainId:`${Xa.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:Wb.getSdkError("USER_DISCONNECTED")});else{let r=Zt.getCurrentTopic(this.chainId,this.walletConnector);this.processingTopic=r,yield this.walletConnector.disconnect({topic:r,reason:Wb.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:`${Xa.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:Zt.getCurrentTopic(this.chainId,this.walletConnector),request:{method:Ki.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 gZ.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:`${Xa.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:Zt.getCurrentTopic(this.chainId,this.walletConnector),request:{method:Ki.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:`${Xa.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:Zt.getCurrentTopic(this.chainId,this.walletConnector),request:{method:Ki.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:`${Xa.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(!Wb.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=zb});var aB=m((jge,oB)=>{"use strict";c();oB.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 lB=m((Qge,cB)=>{"use strict";c();var uB=typeof Symbol<"u"&&Symbol,mZ=aB();cB.exports=function(){return typeof uB!="function"||typeof Symbol!="function"||typeof uB("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:mZ()}});var dB=m((zge,hB)=>{"use strict";c();var fB={foo:{}},wZ=Object;hB.exports=function(){return{__proto__:fB}.foo===fB.foo&&!({__proto__:null}instanceof wZ)}});var gB=m((Kge,pB)=>{"use strict";c();var EZ="Function.prototype.bind called on incompatible ",$b=Array.prototype.slice,vZ=Object.prototype.toString,AZ="[object Function]";pB.exports=function(e){var r=this;if(typeof r!="function"||vZ.call(r)!==AZ)throw new TypeError(EZ+r);for(var n=$b.call(arguments,1),i,s=function(){if(this instanceof i){var f=r.apply(this,n.concat($b.call(arguments)));return Object(f)===f?f:this}else return r.apply(e,n.concat($b.call(arguments)))},o=Math.max(0,r.length-n.length),a=[],u=0;u{"use strict";c();var bZ=gB();yB.exports=Function.prototype.bind||bZ});var wB=m((Zge,mB)=>{"use strict";c();var _Z=Fg();mB.exports=_Z.call(Function.call,Object.prototype.hasOwnProperty)});var qg=m((tye,_B)=>{"use strict";c();var De,ru=SyntaxError,bB=Function,tu=TypeError,Kb=function(t){try{return bB('"use strict"; return ('+t+").constructor;")()}catch{}},Zs=Object.getOwnPropertyDescriptor;if(Zs)try{Zs({},"")}catch{Zs=null}var Yb=function(){throw new tu},IZ=Zs?function(){try{return arguments.callee,Yb}catch{try{return Zs(arguments,"callee").get}catch{return Yb}}}():Yb,Za=lB()(),SZ=dB()(),Mt=Object.getPrototypeOf||(SZ?function(t){return t.__proto__}:null),eu={},TZ=typeof Uint8Array>"u"||!Mt?De:Mt(Uint8Array),eo={"%AggregateError%":typeof AggregateError>"u"?De:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?De:ArrayBuffer,"%ArrayIteratorPrototype%":Za&&Mt?Mt([][Symbol.iterator]()):De,"%AsyncFromSyncIteratorPrototype%":De,"%AsyncFunction%":eu,"%AsyncGenerator%":eu,"%AsyncGeneratorFunction%":eu,"%AsyncIteratorPrototype%":eu,"%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%":bB,"%GeneratorFunction%":eu,"%Int8Array%":typeof Int8Array>"u"?De:Int8Array,"%Int16Array%":typeof Int16Array>"u"?De:Int16Array,"%Int32Array%":typeof Int32Array>"u"?De:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Za&&Mt?Mt(Mt([][Symbol.iterator]())):De,"%JSON%":typeof JSON=="object"?JSON:De,"%Map%":typeof Map>"u"?De:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Za||!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"||!Za||!Mt?De:Mt(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?De:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Za&&Mt?Mt(""[Symbol.iterator]()):De,"%Symbol%":Za?Symbol:De,"%SyntaxError%":ru,"%ThrowTypeError%":IZ,"%TypedArray%":TZ,"%TypeError%":tu,"%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){EB=Mt(Mt(t)),eo["%Error.prototype%"]=EB}var EB,CZ=function t(e){var r;if(e==="%AsyncFunction%")r=Kb("async function () {}");else if(e==="%GeneratorFunction%")r=Kb("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=Kb("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 eo[e]=r,r},vB={"%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"]},_l=Fg(),Mg=wB(),xZ=_l.call(Function.call,Array.prototype.concat),NZ=_l.call(Function.apply,Array.prototype.splice),AB=_l.call(Function.call,String.prototype.replace),Ug=_l.call(Function.call,String.prototype.slice),OZ=_l.call(Function.call,RegExp.prototype.exec),DZ=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,PZ=/\\(\\)?/g,RZ=function(e){var r=Ug(e,0,1),n=Ug(e,-1);if(r==="%"&&n!=="%")throw new ru("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new ru("invalid intrinsic syntax, expected opening `%`");var i=[];return AB(e,DZ,function(s,o,a,u){i[i.length]=a?AB(u,PZ,"$1"):o||s}),i},BZ=function(e,r){var n=e,i;if(Mg(vB,n)&&(i=vB[n],n="%"+i[0]+"%"),Mg(eo,n)){var s=eo[n];if(s===eu&&(s=CZ(n)),typeof s>"u"&&!r)throw new tu("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:s}}throw new ru("intrinsic "+e+" does not exist!")};_B.exports=function(e,r){if(typeof e!="string"||e.length===0)throw new tu("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new tu('"allowMissing" argument must be a boolean');if(OZ(/^%?[^%]*%?$/,e)===null)throw new ru("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=RZ(e),i=n.length>0?n[0]:"",s=BZ("%"+i+"%",r),o=s.name,a=s.value,u=!1,l=s.alias;l&&(i=l[0],NZ(n,xZ([0,1],l)));for(var f=1,d=!0;f=n.length){var x=Zs(a,g);d=!!x,d&&"get"in x&&!("originalValue"in x.get)?a=x.get:a=a[g]}else d=Mg(a,g),a=a[g];d&&!u&&(eo[o]=a)}}return a}});var NB=m((nye,Vg)=>{"use strict";c();var Jb=Fg(),nu=qg(),TB=nu("%Function.prototype.apply%"),CB=nu("%Function.prototype.call%"),xB=nu("%Reflect.apply%",!0)||Jb.call(CB,TB),IB=nu("%Object.getOwnPropertyDescriptor%",!0),to=nu("%Object.defineProperty%",!0),LZ=nu("%Math.max%");if(to)try{to({},"a",{value:1})}catch{to=null}Vg.exports=function(e){var r=xB(Jb,CB,arguments);if(IB&&to){var n=IB(r,"length");n.configurable&&to(r,"length",{value:1+LZ(0,e.length-(arguments.length-1))})}return r};var SB=function(){return xB(Jb,TB,arguments)};to?to(Vg.exports,"apply",{value:SB}):Vg.exports.apply=SB});var RB=m((sye,PB)=>{"use strict";c();var OB=qg(),DB=NB(),FZ=DB(OB("String.prototype.indexOf"));PB.exports=function(e,r){var n=OB(e,!!r);return typeof n=="function"&&FZ(e,".prototype.")>-1?DB(n):n}});var BB=m(()=>{c()});var eL=m((lye,ZB)=>{c();var a_=typeof Map=="function"&&Map.prototype,Xb=Object.getOwnPropertyDescriptor&&a_?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Gg=a_&&Xb&&typeof Xb.get=="function"?Xb.get:null,LB=a_&&Map.prototype.forEach,u_=typeof Set=="function"&&Set.prototype,Zb=Object.getOwnPropertyDescriptor&&u_?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,jg=u_&&Zb&&typeof Zb.get=="function"?Zb.get:null,FB=u_&&Set.prototype.forEach,MZ=typeof WeakMap=="function"&&WeakMap.prototype,Sl=MZ?WeakMap.prototype.has:null,UZ=typeof WeakSet=="function"&&WeakSet.prototype,Tl=UZ?WeakSet.prototype.has:null,qZ=typeof WeakRef=="function"&&WeakRef.prototype,MB=qZ?WeakRef.prototype.deref:null,VZ=Boolean.prototype.valueOf,HZ=Object.prototype.toString,GZ=Function.prototype.toString,jZ=String.prototype.match,c_=String.prototype.slice,Ji=String.prototype.replace,kZ=String.prototype.toUpperCase,UB=String.prototype.toLowerCase,zB=RegExp.prototype.test,qB=Array.prototype.concat,Nn=Array.prototype.join,QZ=Array.prototype.slice,VB=Math.floor,r_=typeof BigInt=="function"?BigInt.prototype.valueOf:null,e_=Object.getOwnPropertySymbols,n_=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,iu=typeof Symbol=="function"&&typeof Symbol.iterator=="object",er=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===iu||"symbol")?Symbol.toStringTag:null,$B=Object.prototype.propertyIsEnumerable,HB=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function GB(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||zB.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var n=t<0?-VB(-t):VB(t);if(n!==t){var i=String(n),s=c_.call(e,i.length+1);return Ji.call(i,r,"$&_")+"."+Ji.call(Ji.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Ji.call(e,r,"$&_")}var i_=BB(),jB=i_.custom,kB=YB(jB)?jB:null;ZB.exports=function t(e,r,n,i){var s=r||{};if(Yi(s,"quoteStyle")&&s.quoteStyle!=="single"&&s.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Yi(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=Yi(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(Yi(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(Yi(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 XB(e,s);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var u=String(e);return a?GB(e,u):u}if(typeof e=="bigint"){var l=String(e)+"n";return a?GB(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 s_(e)?"[Array]":"[Object]";var d=cee(s,n);if(typeof i>"u")i=[];else if(JB(i,e)>=0)return"[Circular]";function g(j,K,de){if(K&&(i=QZ.call(i),i.push(K)),de){var ue={depth:s.depth};return Yi(s,"quoteStyle")&&(ue.quoteStyle=s.quoteStyle),t(j,ue,n+1,i)}return t(j,s,n+1,i)}if(typeof e=="function"&&!QB(e)){var w=eee(e),E=Hg(e,g);return"[Function"+(w?": "+w:" (anonymous)")+"]"+(E.length>0?" { "+Nn.call(E,", ")+" }":"")}if(YB(e)){var x=iu?Ji.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):n_.call(e);return typeof e=="object"&&!iu?Il(x):x}if(oee(e)){for(var O="<"+UB.call(String(e.nodeName)),F=e.attributes||[],_=0;_",O}if(s_(e)){if(e.length===0)return"[]";var I=Hg(e,g);return d&&!uee(I)?"["+o_(I,d)+"]":"[ "+Nn.call(I,", ")+" ]"}if($Z(e)){var S=Hg(e,g);return!("cause"in Error.prototype)&&"cause"in e&&!$B.call(e,"cause")?"{ ["+String(e)+"] "+Nn.call(qB.call("[cause]: "+g(e.cause),S),", ")+" }":S.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+Nn.call(S,", ")+" }"}if(typeof e=="object"&&o){if(kB&&typeof e[kB]=="function"&&i_)return i_(e,{depth:f-n});if(o!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(tee(e)){var R=[];return LB&&LB.call(e,function(j,K){R.push(g(K,e,!0)+" => "+g(j,e))}),WB("Map",Gg.call(e),R,d)}if(iee(e)){var B=[];return FB&&FB.call(e,function(j){B.push(g(j,e))}),WB("Set",jg.call(e),B,d)}if(ree(e))return t_("WeakMap");if(see(e))return t_("WeakSet");if(nee(e))return t_("WeakRef");if(YZ(e))return Il(g(Number(e)));if(XZ(e))return Il(g(r_.call(e)));if(JZ(e))return Il(VZ.call(e));if(KZ(e))return Il(g(String(e)));if(!zZ(e)&&!QB(e)){var b=Hg(e,g),T=HB?HB(e)===Object.prototype:e instanceof Object||e.constructor===Object,L=e instanceof Object?"":"null prototype",X=!T&&er&&Object(e)===e&&er in e?c_.call(Xi(e),8,-1):L?"Object":"",W=T||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",G=W+(X||L?"["+Nn.call(qB.call([],X||[],L||[]),": ")+"] ":"");return b.length===0?G+"{}":d?G+"{"+o_(b,d)+"}":G+"{ "+Nn.call(b,", ")+" }"}return String(e)};function KB(t,e,r){var n=(r.quoteStyle||e)==="double"?'"':"'";return n+t+n}function WZ(t){return Ji.call(String(t),/"/g,""")}function s_(t){return Xi(t)==="[object Array]"&&(!er||!(typeof t=="object"&&er in t))}function zZ(t){return Xi(t)==="[object Date]"&&(!er||!(typeof t=="object"&&er in t))}function QB(t){return Xi(t)==="[object RegExp]"&&(!er||!(typeof t=="object"&&er in t))}function $Z(t){return Xi(t)==="[object Error]"&&(!er||!(typeof t=="object"&&er in t))}function KZ(t){return Xi(t)==="[object String]"&&(!er||!(typeof t=="object"&&er in t))}function YZ(t){return Xi(t)==="[object Number]"&&(!er||!(typeof t=="object"&&er in t))}function JZ(t){return Xi(t)==="[object Boolean]"&&(!er||!(typeof t=="object"&&er in t))}function YB(t){if(iu)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!n_)return!1;try{return n_.call(t),!0}catch{}return!1}function XZ(t){if(!t||typeof t!="object"||!r_)return!1;try{return r_.call(t),!0}catch{}return!1}var ZZ=Object.prototype.hasOwnProperty||function(t){return t in this};function Yi(t,e){return ZZ.call(t,e)}function Xi(t){return HZ.call(t)}function eee(t){if(t.name)return t.name;var e=jZ.call(GZ.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function JB(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 XB(c_.call(t,0,e.maxStringLength),e)+n}var i=Ji.call(Ji.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,aee);return KB(i,"single",e)}function aee(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":"")+kZ.call(e.toString(16))}function Il(t){return"Object("+t+")"}function t_(t){return t+" { ? }"}function WB(t,e,r,n){var i=n?o_(r,n):Nn.call(r,", ");return t+" ("+e+") {"+i+"}"}function uee(t){for(var e=0;e=0)return!1;return!0}function cee(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 o_(t,e){if(t.length===0)return"";var r=` -`+e.prev+e.base;return r+Nn.call(t,","+r)+` -`+e.prev}function Hg(t,e){var r=s_(t),n=[];if(r){n.length=t.length;for(var i=0;i{"use strict";c();var l_=qg(),su=RB(),lee=eL(),fee=l_("%TypeError%"),kg=l_("%WeakMap%",!0),Qg=l_("%Map%",!0),hee=su("WeakMap.prototype.get",!0),dee=su("WeakMap.prototype.set",!0),pee=su("WeakMap.prototype.has",!0),gee=su("Map.prototype.get",!0),yee=su("Map.prototype.set",!0),mee=su("Map.prototype.has",!0),f_=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},wee=function(t,e){var r=f_(t,e);return r&&r.value},Eee=function(t,e,r){var n=f_(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}},vee=function(t,e){return!!f_(t,e)};tL.exports=function(){var e,r,n,i={assert:function(s){if(!i.has(s))throw new fee("Side channel does not contain "+lee(s))},get:function(s){if(kg&&s&&(typeof s=="object"||typeof s=="function")){if(e)return hee(e,s)}else if(Qg){if(r)return gee(r,s)}else if(n)return wee(n,s)},has:function(s){if(kg&&s&&(typeof s=="object"||typeof s=="function")){if(e)return pee(e,s)}else if(Qg){if(r)return mee(r,s)}else if(n)return vee(n,s);return!1},set:function(s,o){kg&&s&&(typeof s=="object"||typeof s=="function")?(e||(e=new kg),dee(e,s,o)):Qg?(r||(r=new Qg),yee(r,s,o)):(n||(n={key:{},next:null}),Eee(n,s,o))}};return i}});var Wg=m((pye,nL)=>{"use strict";c();var Aee=String.prototype.replace,bee=/%20/g,h_={RFC1738:"RFC1738",RFC3986:"RFC3986"};nL.exports={default:h_.RFC3986,formatters:{RFC1738:function(t){return Aee.call(t,bee,"+")},RFC3986:function(t){return String(t)}},RFC1738:h_.RFC1738,RFC3986:h_.RFC3986}});var p_=m((yye,sL)=>{"use strict";c();var _ee=Wg(),d_=Object.prototype.hasOwnProperty,ro=Array.isArray,On=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),Iee=function(e){for(;e.length>1;){var r=e.pop(),n=r.obj[r.prop];if(ro(n)){for(var i=[],s=0;s=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122||s===_ee.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},Nee=function(e){for(var r=[{obj:{o:e},prop:"o"}],n=[],i=0;i{"use strict";c();var uL=rL(),y_=p_(),Cl=Wg(),Bee=Object.prototype.hasOwnProperty,oL={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,r){return e+"["+r+"]"},repeat:function(e){return e}},no=Array.isArray,Lee=String.prototype.split,Fee=Array.prototype.push,cL=function(t,e){Fee.apply(t,no(e)?e:[e])},Mee=Date.prototype.toISOString,aL=Cl.default,kt={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:y_.encode,encodeValuesOnly:!1,format:aL,formatter:Cl.formatters[aL],indices:!1,serializeDate:function(e){return Mee.call(e)},skipNulls:!1,strictNullHandling:!1},Uee=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},g_={},qee=function t(e,r,n,i,s,o,a,u,l,f,d,g,w,E,x){for(var O=e,F=x,_=0,I=!1;(F=F.get(g_))!==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(g_)>"u"&&(_=0)}if(typeof a=="function"?O=a(r,O):O instanceof Date?O=f(O):n==="comma"&&no(O)&&(O=y_.maybeMap(O,function(re){return re instanceof Date?f(re):re})),O===null){if(i)return o&&!w?o(r,kt.encoder,E,"key",d):r;O=""}if(Uee(O)||y_.isBuffer(O)){if(o){var R=w?r:o(r,kt.encoder,E,"key",d);if(n==="comma"&&w){for(var B=Lee.call(String(O),","),b="",T=0;T"u")return L;var X;if(n==="comma"&&no(O))X=[{value:O.length>0?O.join(",")||null:void 0}];else if(no(a))X=a;else{var W=Object.keys(O);X=u?W.sort(u):W}for(var G=0;G"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}};lL.exports=function(t,e){var r=t,n=Vee(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 oL?a=e.arrayFormat:e&&"indices"in e?a=e.indices?"indices":"repeat":a="indices";var u=oL[a];i||(i=Object.keys(r)),n.sort&&i.sort(n.sort);for(var l=uL(),f=0;f0?w+g:""}});var pL=m((vye,dL)=>{"use strict";c();var ou=p_(),m_=Object.prototype.hasOwnProperty,Hee=Array.isArray,Ut={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:ou.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},Gee=function(t){return t.replace(/&#(\d+);/g,function(e,r){return String.fromCharCode(parseInt(r,10))})},hL=function(t,e){return t&&typeof t=="string"&&e.comma&&t.indexOf(",")>-1?t.split(","):t},jee="utf8=%26%2310003%3B",kee="utf8=%E2%9C%93",Qee=function(e,r){var n={},i=r.ignoreQueryPrefix?e.replace(/^\?/,""):e,s=r.parameterLimit===1/0?void 0:r.parameterLimit,o=i.split(r.delimiter,s),a=-1,u,l=r.charset;if(r.charsetSentinel)for(u=0;u-1&&(E=Hee(E)?[E]:E),m_.call(n,w)?n[w]=ou.combine(n[w],E):n[w]=E}return n},Wee=function(t,e,r,n){for(var i=n?e:hL(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},zee=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&&m_.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"||ou.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}};dL.exports=function(t,e){var r=$ee(e);if(t===""||t===null||typeof t>"u")return r.plainObjects?Object.create(null):{};for(var n=typeof t=="string"?Qee(t,r):t,i=r.plainObjects?Object.create(null):{},s=Object.keys(n),o=0;o{"use strict";c();var Kee=fL(),Yee=pL(),Jee=Wg();gL.exports={formats:Jee,parse:Yee,stringify:Kee}});var w_=m(ut=>{"use strict";c();Object.defineProperty(ut,"__esModule",{value:!0});ut.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED=ut.WALLET_PROVIDER_CALLBACK_PARAM=ut.WALLET_PROVIDER_SIGN_MESSAGE_URL=ut.WALLET_PROVIDER_GUARD_TRANSACTION_URL=ut.WALLET_PROVIDER_SIGN_TRANSACTION_URL=ut.WALLET_PROVIDER_SEND_TRANSACTION_URL=ut.WALLET_PROVIDER_DISCONNECT_URL=ut.WALLET_PROVIDER_CONNECT_URL=ut.WALLET_PROVIDER_TESTNET=ut.WALLET_PROVIDER_DEVNET=ut.WALLET_PROVIDER_MAINNET=void 0;ut.WALLET_PROVIDER_MAINNET="https://wallet.multiversx.com/dapp/init";ut.WALLET_PROVIDER_DEVNET="https://devnet-wallet.multiversx.com/dapp/init";ut.WALLET_PROVIDER_TESTNET="https://testnet-wallet.multiversx.com/dapp/init";ut.WALLET_PROVIDER_CONNECT_URL="hook/login";ut.WALLET_PROVIDER_DISCONNECT_URL="hook/logout";ut.WALLET_PROVIDER_SEND_TRANSACTION_URL="hook/transaction";ut.WALLET_PROVIDER_SIGN_TRANSACTION_URL="hook/sign";ut.WALLET_PROVIDER_GUARD_TRANSACTION_URL="hook/2fa";ut.WALLET_PROVIDER_SIGN_MESSAGE_URL="hook/sign-message";ut.WALLET_PROVIDER_CALLBACK_PARAM="walletProviderStatus";ut.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED="transactionsSigned"});var mL=m(au=>{"use strict";c();Object.defineProperty(au,"__esModule",{value:!0});au.ErrCannotSignedMessage=au.ErrCannotGetSignedTransactions=void 0;var E_=class extends Error{constructor(){super("Cannot get signed transaction(s)")}};au.ErrCannotGetSignedTransactions=E_;var v_=class extends Error{constructor(){super("Cannot get signed message")}};au.ErrCannotSignedMessage=v_});var wL=m(zg=>{"use strict";c();Object.defineProperty(zg,"__esModule",{value:!0});zg.PlainSignedTransaction=void 0;var A_=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)}};zg.PlainSignedTransaction=A_});var xl=m(ts=>{"use strict";c();var Zi=ts&&ts.__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())})},Xee=ts&&ts.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ts,"__esModule",{value:!0});ts.WalletProvider=void 0;var b_=Xee(yL()),es=w_(),__=mL(),Zee=wL(),I_=class t{constructor(e){this.walletUrl=e}login(e){return Zi(this,void 0,void 0,function*(){let r=this.buildWalletUrl({endpoint:es.WALLET_PROVIDER_CONNECT_URL,callbackUrl:e?.callbackUrl,params:{token:e?.token}});return yield this.redirect(r,e?.redirectDelayMilliseconds),r})}redirect(e,r){return Zi(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 Zi(this,void 0,void 0,function*(){yield new Promise(n=>{setTimeout(()=>{window.location.href=e,n(!0)},r)})})}logout(e){return Zi(this,void 0,void 0,function*(){let r=this.buildWalletUrl({endpoint:es.WALLET_PROVIDER_DISCONNECT_URL,callbackUrl:e?.callbackUrl});return yield this.redirect(r,e?.redirectDelayMilliseconds),!0})}signMessage(e,r){return Zi(this,void 0,void 0,function*(){let n=this.buildWalletUrl({endpoint:es.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=b_.default.parse(n);if((((e=i.status)===null||e===void 0?void 0:e.toString())||"")!=="signed")throw new __.ErrCannotSignedMessage;return((r=i.signature)===null||r===void 0?void 0:r.toString())||""}guardTransactions(e,r){return Zi(this,void 0,void 0,function*(){this.redirectTransactionsToEndpoint(es.WALLET_PROVIDER_GUARD_TRANSACTION_URL,e,r)})}signTransactions(e,r){return Zi(this,void 0,void 0,function*(){this.redirectTransactionsToEndpoint(es.WALLET_PROVIDER_SIGN_TRANSACTION_URL,e,r)})}signTransaction(e,r){return Zi(this,void 0,void 0,function*(){yield this.signTransactions([e],r)})}getTransactionsFromWalletUrl(){let e=b_.default.parse(window.location.search.slice(1));return t.isTxSignReturnSuccess(e)?this.getTxSignReturnValue(e):[]}static isTxSignReturnSuccess(e){return e.hasOwnProperty(es.WALLET_PROVIDER_CALLBACK_PARAM)&&e[es.WALLET_PROVIDER_CALLBACK_PARAM]===es.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 __.ErrCannotGetSignedTransactions;let i=e.nonce.length;for(let o of n)if(e[o].length!==i)throw new __.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}};ts.WalletProvider=I_});var S_=m((Pye,EL)=>{"use strict";c();EL.exports=function(e,r){return function(){for(var i=new Array(arguments.length),s=0;s{"use strict";c();var ete=S_(),io=Object.prototype.toString;function x_(t){return io.call(t)==="[object Array]"}function T_(t){return typeof t>"u"}function tte(t){return t!==null&&!T_(t)&&t.constructor!==null&&!T_(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function rte(t){return io.call(t)==="[object ArrayBuffer]"}function nte(t){return typeof FormData<"u"&&t instanceof FormData}function ite(t){var e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&t.buffer instanceof ArrayBuffer,e}function ste(t){return typeof t=="string"}function ote(t){return typeof t=="number"}function vL(t){return t!==null&&typeof t=="object"}function $g(t){if(io.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function ate(t){return io.call(t)==="[object Date]"}function ute(t){return io.call(t)==="[object File]"}function cte(t){return io.call(t)==="[object Blob]"}function AL(t){return io.call(t)==="[object Function]"}function lte(t){return vL(t)&&AL(t.pipe)}function fte(t){return typeof URLSearchParams<"u"&&t instanceof URLSearchParams}function hte(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function dte(){return typeof navigator<"u"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window<"u"&&typeof document<"u"}function N_(t,e){if(!(t===null||typeof t>"u"))if(typeof t!="object"&&(t=[t]),x_(t))for(var r=0,n=t.length;r{"use strict";c();var uu=pr();function _L(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}IL.exports=function(e,r,n){if(!r)return e;var i;if(n)i=n(r);else if(uu.isURLSearchParams(r))i=r.toString();else{var s=[];uu.forEach(r,function(u,l){u===null||typeof u>"u"||(uu.isArray(u)?l=l+"[]":u=[u],uu.forEach(u,function(d){uu.isDate(d)?d=d.toISOString():uu.isObject(d)&&(d=JSON.stringify(d)),s.push(_L(l)+"="+_L(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 TL=m((Uye,SL)=>{"use strict";c();var yte=pr();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){yte.forEach(this.handlers,function(n){n!==null&&e(n)})};SL.exports=Kg});var xL=m((Vye,CL)=>{"use strict";c();var mte=pr();CL.exports=function(e,r){mte.forEach(e,function(i,s){s!==r&&s.toUpperCase()===r.toUpperCase()&&(e[r]=i,delete e[s])})}});var D_=m((Gye,NL)=>{"use strict";c();NL.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 P_=m((kye,OL)=>{"use strict";c();var wte=D_();OL.exports=function(e,r,n,i,s){var o=new Error(e);return wte(o,r,n,i,s)}});var PL=m((Wye,DL)=>{"use strict";c();var Ete=P_();DL.exports=function(e,r,n){var i=n.config.validateStatus;!n.status||!i||i(n.status)?e(n):r(Ete("Request failed with status code "+n.status,n.config,null,n.request,n))}});var BL=m(($ye,RL)=>{"use strict";c();var Yg=pr();RL.exports=Yg.isStandardBrowserEnv()?function(){return{write:function(r,n,i,s,o,a){var u=[];u.push(r+"="+encodeURIComponent(n)),Yg.isNumber(i)&&u.push("expires="+new Date(i).toGMTString()),Yg.isString(s)&&u.push("path="+s),Yg.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 FL=m((Yye,LL)=>{"use strict";c();LL.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}});var UL=m((Xye,ML)=>{"use strict";c();ML.exports=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e}});var VL=m((e0e,qL)=>{"use strict";c();var vte=FL(),Ate=UL();qL.exports=function(e,r){return e&&!vte(r)?Ate(e,r):r}});var GL=m((r0e,HL)=>{"use strict";c();var R_=pr(),bte=["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"];HL.exports=function(e){var r={},n,i,s;return e&&R_.forEach(e.split(` -`),function(a){if(s=a.indexOf(":"),n=R_.trim(a.substr(0,s)).toLowerCase(),i=R_.trim(a.substr(s+1)),n){if(r[n]&&bte.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 QL=m((i0e,kL)=>{"use strict";c();var jL=pr();kL.exports=jL.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=jL.isString(o)?i(o):o;return a.protocol===n.protocol&&a.host===n.host}}():function(){return function(){return!0}}()});var Nl=m((o0e,WL)=>{"use strict";c();function B_(t){this.message=t}B_.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};B_.prototype.__CANCEL__=!0;WL.exports=B_});var F_=m((u0e,zL)=>{"use strict";c();var Jg=pr(),_te=PL(),Ite=BL(),Ste=O_(),Tte=VL(),Cte=GL(),xte=QL(),L_=P_(),Nte=Ol(),Ote=Nl();zL.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)}Jg.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 w=Tte(e.baseURL,e.url);f.open(e.method.toUpperCase(),Ste(w,e.params,e.paramsSerializer),!0),f.timeout=e.timeout;function E(){if(f){var O="getAllResponseHeaders"in f?Cte(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};_te(function(S){n(S),l()},function(S){i(S),l()},_),f=null}}if("onloadend"in f?f.onloadend=E:f.onreadystatechange=function(){!f||f.readyState!==4||f.status===0&&!(f.responseURL&&f.responseURL.indexOf("file:")===0)||setTimeout(E)},f.onabort=function(){f&&(i(L_("Request aborted",e,"ECONNABORTED",f)),f=null)},f.onerror=function(){i(L_("Network Error",e,null,f)),f=null},f.ontimeout=function(){var F=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",_=e.transitional||Nte.transitional;e.timeoutErrorMessage&&(F=e.timeoutErrorMessage),i(L_(F,e,_.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",f)),f=null},Jg.isStandardBrowserEnv()){var x=(e.withCredentials||xte(w))&&e.xsrfCookieName?Ite.read(e.xsrfCookieName):void 0;x&&(o[e.xsrfHeaderName]=x)}"setRequestHeader"in f&&Jg.forEach(o,function(F,_){typeof s>"u"&&_.toLowerCase()==="content-type"?delete o[_]:f.setRequestHeader(_,F)}),Jg.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 Ote("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 Ol=m((l0e,YL)=>{"use strict";c();var Qt=pr(),$L=xL(),Dte=D_(),Pte={"Content-Type":"application/x-www-form-urlencoded"};function KL(t,e){!Qt.isUndefined(t)&&Qt.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function Rte(){var t;return typeof XMLHttpRequest<"u"?t=F_():typeof p.default<"u"&&Object.prototype.toString.call(p.default)==="[object process]"&&(t=F_()),t}function Bte(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 Xg={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:Rte(),transformRequest:[function(e,r){return $L(r,"Accept"),$L(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)?(KL(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):Qt.isObject(e)||r&&r["Content-Type"]==="application/json"?(KL(r,"application/json"),Bte(e)):e}],transformResponse:[function(e){var r=this.transitional||Xg.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"?Dte(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){Xg.headers[e]={}});Qt.forEach(["post","put","patch"],function(e){Xg.headers[e]=Qt.merge(Pte)});YL.exports=Xg});var XL=m((h0e,JL)=>{"use strict";c();var Lte=pr(),Fte=Ol();JL.exports=function(e,r,n){var i=this||Fte;return Lte.forEach(n,function(o){e=o.call(i,e,r)}),e}});var M_=m((p0e,ZL)=>{"use strict";c();ZL.exports=function(e){return!!(e&&e.__CANCEL__)}});var rF=m((y0e,tF)=>{"use strict";c();var eF=pr(),U_=XL(),Mte=M_(),Ute=Ol(),qte=Nl();function q_(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new qte("canceled")}tF.exports=function(e){q_(e),e.headers=e.headers||{},e.data=U_.call(e,e.data,e.headers,e.transformRequest),e.headers=eF.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),eF.forEach(["delete","get","head","post","put","patch","common"],function(i){delete e.headers[i]});var r=e.adapter||Ute.adapter;return r(e).then(function(i){return q_(e),i.data=U_.call(e,i.data,i.headers,e.transformResponse),i},function(i){return Mte(i)||(q_(e),i&&i.response&&(i.response.data=U_.call(e,i.response.data,i.response.headers,e.transformResponse))),Promise.reject(i)})}});var V_=m((w0e,nF)=>{"use strict";c();var Ar=pr();nF.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,w=g(d);Ar.isUndefined(w)&&g!==u||(n[d]=w)}),n}});var H_=m((v0e,iF)=>{c();iF.exports={version:"0.24.0"}});var aF=m((b0e,oF)=>{"use strict";c();var Vte=H_().version,G_={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){G_[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var sF={};G_.transitional=function(e,r,n){function i(s,o){return"[Axios v"+Vte+"] 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&&!sF[o]&&(sF[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 Hte(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)}}oF.exports={assertOptions:Hte,validators:G_}});var dF=m((I0e,hF)=>{"use strict";c();var lF=pr(),Gte=O_(),uF=TL(),cF=rF(),Zg=V_(),fF=aF(),cu=fF.validators;function Dl(t){this.defaults=t,this.interceptors={request:new uF,response:new uF}}Dl.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=Zg(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&&fF.assertOptions(r,{silentJSONParsing:cu.transitional(cu.boolean),forcedJSONParsing:cu.transitional(cu.boolean),clarifyTimeoutError:cu.transitional(cu.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=[cF,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=cF(u)}catch(d){return Promise.reject(d)}for(;s.length;)o=o.then(s.shift(),s.shift());return o};Dl.prototype.getUri=function(e){return e=Zg(this.defaults,e),Gte(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};lF.forEach(["delete","get","head","options"],function(e){Dl.prototype[e]=function(r,n){return this.request(Zg(n||{},{method:e,url:r,data:(n||{}).data}))}});lF.forEach(["post","put","patch"],function(e){Dl.prototype[e]=function(r,n,i){return this.request(Zg(i||{},{method:e,url:r,data:n}))}});hF.exports=Dl});var gF=m((T0e,pF)=>{"use strict";c();var jte=Nl();function lu(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();yF.exports=function(e){return function(n){return e.apply(null,n)}}});var EF=m((O0e,wF)=>{"use strict";c();wF.exports=function(e){return typeof e=="object"&&e.isAxiosError===!0}});var bF=m((P0e,j_)=>{"use strict";c();var vF=pr(),kte=S_(),ey=dF(),Qte=V_(),Wte=Ol();function AF(t){var e=new ey(t),r=kte(ey.prototype.request,e);return vF.extend(r,ey.prototype,e),vF.extend(r,e),r.create=function(i){return AF(Qte(t,i))},r}var Dn=AF(Wte);Dn.Axios=ey;Dn.Cancel=Nl();Dn.CancelToken=gF();Dn.isCancel=M_();Dn.VERSION=H_().version;Dn.all=function(e){return Promise.all(e)};Dn.spread=mF();Dn.isAxiosError=EF();j_.exports=Dn;j_.exports.default=Dn});var IF=m((B0e,_F)=>{c();_F.exports=bF()});var SF=m(ty=>{"use strict";c();Object.defineProperty(ty,"__esModule",{value:!0});ty.NativeAuthClientConfig=void 0;var k_=class{constructor(){this.origin=typeof window<"u"?window.location.hostname:"",this.apiUrl="https://api.multiversx.com",this.expirySeconds=60*60*24}};ty.NativeAuthClientConfig=k_});var W_=m(fu=>{"use strict";c();var so=fu&&fu.__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(fu,"__esModule",{value:!0});fu.NativeAuthClient=void 0;var zte=IF(),$te=SF(),Q_=class{constructor(e){this.config=Object.assign(new $te.NativeAuthClientConfig,e)}getToken(e,r,n){let i=this.encodeValue(e),s=this.encodeValue(r);return`${i}.${s}.${n}`}initialize(e={}){return so(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 so(this,void 0,void 0,function*(){return this.config.gatewayUrl?yield this.getCurrentBlockHashWithGateway():yield this.getCurrentBlockHashWithApi()})}getCurrentBlockHashWithGateway(){return so(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 so(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 so(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 so(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 so(this,void 0,void 0,function*(){return yield zte.default.get(e,{headers:this.config.extraRequestHeaders})})}};fu.NativeAuthClient=Q_});var OF=m(iy=>{"use strict";c();Object.defineProperty(iy,"__esModule",{value:!0});iy.TransactionStatus=void 0;var z_=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}};iy.TransactionStatus=z_});var pu=m(Vt=>{"use strict";c();var Kte=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]}),Yte=Vt&&Vt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Jte=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)&&Kte(e,t,r);return Yte(e,t),e};Object.defineProperty(Vt,"__esModule",{value:!0});Vt.zeroPadStringIfOddLength=Vt.isPaddedHex=Vt.numberToPaddedHex=Vt.Nonce=Vt.Address=void 0;var DF=Jte(bm()),Xte="erd",$_=class t{constructor(e){this.value=e}static fromPubkey(e){let r=DF.toWords(e),n=DF.encode(Xte,r);return new t(n)}bech32(){return this.value}toString(){return this.bech32()}};Vt.Address=$_;var K_=class{constructor(e){this.value=e}valueOf(){return this.value}hex(){return PF(this.value)}};Vt.Nonce=K_;function PF(t){let e=t.toString(16);return RF(e)}Vt.numberToPaddedHex=PF;function Zte(t){t=t||"";let e=h.Buffer.from(t,"hex").toString("hex");return t.toUpperCase()==e.toUpperCase()}Vt.isPaddedHex=Zte;function RF(t){return t=t||"",t.length%2==1?"0"+t:t}Vt.zeroPadStringIfOddLength=RF});var LF=m(sy=>{"use strict";c();Object.defineProperty(sy,"__esModule",{value:!0});sy.TransactionReceipt=void 0;var BF=pu(),Y_=class t{constructor(){this.value="",this.sender=new BF.Address(""),this.data="",this.hash=""}static fromHttpResponse(e){let r=new t;return r.value=(e.value||0).toString(),r.sender=new BF.Address(e.sender),r.data=e.data,r.hash=e.txHash,r}};sy.TransactionReceipt=Y_});var FF=m(Pn=>{"use strict";c();Object.defineProperty(Pn,"__esModule",{value:!0});Pn.ErrContractQuery=Pn.ErrNetworkProvider=Pn.ErrUnexpectedCondition=Pn.Err=void 0;var gu=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};Pn.Err=gu;var J_=class extends gu{constructor(e){super(`Unexpected condition: [${e}]`)}};Pn.ErrUnexpectedCondition=J_;var X_=class extends gu{constructor(e,r,n){let i=`Request error on url [${e}]: [${r}]`;super(i,n)}};Pn.ErrNetworkProvider=X_;var Z_=class extends gu{constructor(e){super(e.message.replace("executeQuery:",""))}};Pn.ErrContractQuery=Z_});var UF=m(is=>{"use strict";c();Object.defineProperty(is,"__esModule",{value:!0});is.TransactionEventTopic=is.TransactionEventData=is.TransactionEvent=void 0;var MF=pu(),eI=class t{constructor(e){this.address=new MF.Address(""),this.identifier="",this.topics=[],this.dataPayload=new Pl(h.Buffer.from("","utf8")),this.data="",Object.assign(this,e)}static fromHttpResponse(e){let r=new t;r.address=new MF.Address(e.address),r.identifier=e.identifier||"",r.topics=(e.topics||[]).map(i=>new oy(i));let n=h.Buffer.from(e.data||"","base64");return r.dataPayload=new Pl(n),r.data=n.toString(),r}findFirstOrNoneTopic(e){return this.topics.filter(r=>e(r))[0]}getLastTopic(){return this.topics[this.topics.length-1]}};is.TransactionEvent=eI;var Pl=class{constructor(e){this.raw=e}toString(){return this.raw.toString("utf8")}hex(){return this.raw.toString("hex")}valueOf(){return this.raw}};is.TransactionEventData=Pl;var oy=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}};is.TransactionEventTopic=oy});var rI=m(ay=>{"use strict";c();Object.defineProperty(ay,"__esModule",{value:!0});ay.TransactionLogs=void 0;var ere=FF(),qF=pu(),tre=UF(),tI=class t{constructor(e){this.address=new qF.Address(""),this.events=[],Object.assign(this,e)}static fromHttpResponse(e){let r=new t;return r.address=new qF.Address(e.address),r.events=(e.events||[]).map(n=>tre.TransactionEvent.fromHttpResponse(n)),r}findSingleOrNoneEvent(e,r){let n=this.findEvents(e,r);if(n.length>1)throw new ere.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}};ay.TransactionLogs=tI});var HF=m(yu=>{"use strict";c();Object.defineProperty(yu,"__esModule",{value:!0});yu.ContractResultItem=yu.ContractResults=void 0;var VF=rI(),uy=pu(),nI=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=>Rl.fromProxyHttpResponse(n));return new t(r)}static fromApiHttpResponse(e){let r=e.map(n=>Rl.fromApiHttpResponse(n));return new t(r)}};yu.ContractResults=nI;var Rl=class t{constructor(e){this.hash="",this.nonce=0,this.value="",this.receiver=new uy.Address(""),this.sender=new uy.Address(""),this.data="",this.previousHash="",this.originalHash="",this.gasLimit=0,this.gasPrice=0,this.callType=0,this.returnMessage="",this.logs=new VF.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 uy.Address(e.receiver),r.sender=new uy.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=VF.TransactionLogs.fromHttpResponse(e.logs||{}),r}};yu.ContractResultItem=Rl});var GF=m(ss=>{"use strict";c();var rre=ss&&ss.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ss,"__esModule",{value:!0});ss.EsdtContractAddress=ss.MaxUint64AsBigNumber=void 0;var nre=rre(Gt()),ire=pu();ss.MaxUint64AsBigNumber=new nre.default("18446744073709551615");ss.EsdtContractAddress=new ire.Address("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u")});var jF=m(mu=>{"use strict";c();var sre=mu&&mu.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(mu,"__esModule",{value:!0});mu.ContractQueryResponse=void 0;var ore=sre(Gt()),are=GF(),iI=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 ore.default(e.gasRemaining||e.GasRemaining||0),o=are.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()}}};mu.ContractQueryResponse=iI});var kF=m(cy=>{"use strict";c();Object.defineProperty(cy,"__esModule",{value:!0});cy.ContractQueryRequest=void 0;var sI=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}};cy.ContractQueryRequest=sI});var tM=m((zme,eM)=>{c();eM.exports=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}});var os=m(ao=>{c();var oI,ure=[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];ao.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};ao.getSymbolTotalCodewords=function(e){return ure[e]};ao.getBCHDigit=function(t){let e=0;for(;t!==0;)e++,t>>>=1;return e};ao.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');oI=e};ao.isKanjiModeEnabled=function(){return typeof oI<"u"};ao.toSJIS=function(e){return oI(e)}});var hy=m(Hr=>{c();Hr.L={bit:1};Hr.M={bit:0};Hr.Q={bit:3};Hr.H={bit:2};function cre(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return Hr.L;case"m":case"medium":return Hr.M;case"q":case"quartile":return Hr.Q;case"h":case"high":return Hr.H;default:throw new Error("Unknown EC Level: "+t)}}Hr.isValid=function(e){return e&&typeof e.bit<"u"&&e.bit>=0&&e.bit<4};Hr.from=function(e,r){if(Hr.isValid(e))return e;try{return cre(e)}catch{return r}}});var iM=m((Zme,nM)=>{c();function rM(){this.buffer=[],this.length=0}rM.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++}};nM.exports=rM});var oM=m((twe,sM)=>{c();function Bl(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)}Bl.prototype.set=function(t,e,r,n){let i=t*this.size+e;this.data[i]=r,n&&(this.reservedBit[i]=!0)};Bl.prototype.get=function(t,e){return this.data[t*this.size+e]};Bl.prototype.xor=function(t,e,r){this.data[t*this.size+e]^=r};Bl.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};sM.exports=Bl});var aM=m(dy=>{c();var lre=os().getSymbolSize;dy.getRowColCoords=function(e){if(e===1)return[];let r=Math.floor(e/7)+2,n=lre(e),i=n===145?26:Math.ceil((n-13)/(2*r-2))*2,s=[n-7];for(let o=1;o{c();var fre=os().getSymbolSize,uM=7;cM.getPositions=function(e){let r=fre(e);return[[0,0],[r-uM,0],[0,r-uM]]}});var fM=m(et=>{c();et.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var uo={N1:3,N2:3,N3:40,N4:10};et.isValid=function(e){return e!=null&&e!==""&&!isNaN(e)&&e>=0&&e<=7};et.from=function(e){return et.isValid(e)?parseInt(e,10):void 0};et.getPenaltyN1=function(e){let r=e.size,n=0,i=0,s=0,o=null,a=null;for(let u=0;u=5&&(n+=uo.N1+(i-5)),o=f,i=1),f=e.get(l,u),f===a?s++:(s>=5&&(n+=uo.N1+(s-5)),a=f,s=1)}i>=5&&(n+=uo.N1+(i-5)),s>=5&&(n+=uo.N1+(s-5))}return n};et.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*uo.N3};et.getPenaltyN4=function(e){let r=0,n=e.data.length;for(let s=0;s{c();var as=hy(),py=[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],gy=[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];aI.getBlocksCount=function(e,r){switch(r){case as.L:return py[(e-1)*4+0];case as.M:return py[(e-1)*4+1];case as.Q:return py[(e-1)*4+2];case as.H:return py[(e-1)*4+3];default:return}};aI.getTotalCodewordsCount=function(e,r){switch(r){case as.L:return gy[(e-1)*4+0];case as.M:return gy[(e-1)*4+1];case as.Q:return gy[(e-1)*4+2];case as.H:return gy[(e-1)*4+3];default:return}}});var hM=m(my=>{c();var Ll=new Uint8Array(512),yy=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)Ll[r]=e,yy[e]=r,e<<=1,e&256&&(e^=285);for(let r=255;r<512;r++)Ll[r]=Ll[r-255]})();my.log=function(e){if(e<1)throw new Error("log("+e+")");return yy[e]};my.exp=function(e){return Ll[e]};my.mul=function(e,r){return e===0||r===0?0:Ll[yy[e]+yy[r]]}});var dM=m(Fl=>{c();var cI=hM();Fl.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 pM=dM();function lI(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}lI.prototype.initialize=function(e){this.degree=e,this.genPoly=pM.generateECPolynomial(this.degree)};lI.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=pM.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};gM.exports=lI});var fI=m(mM=>{c();mM.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}});var hI=m(ai=>{c();var wM="[0-9]+",dre="[A-Z $%*+\\-./:]+",Ml="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";Ml=Ml.replace(/u/g,"\\u");var pre="(?:(?![A-Z0-9 $%*+\\-./:]|"+Ml+`)(?:.|[\r -]))+`;ai.KANJI=new RegExp(Ml,"g");ai.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");ai.BYTE=new RegExp(pre,"g");ai.NUMERIC=new RegExp(wM,"g");ai.ALPHANUMERIC=new RegExp(dre,"g");var gre=new RegExp("^"+Ml+"$"),yre=new RegExp("^"+wM+"$"),mre=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");ai.testKanji=function(e){return gre.test(e)};ai.testNumeric=function(e){return yre.test(e)};ai.testAlphanumeric=function(e){return mre.test(e)}});var us=m(Ct=>{c();var wre=fI(),dI=hI();Ct.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]};Ct.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]};Ct.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]};Ct.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]};Ct.MIXED={bit:-1};Ct.getCharCountIndicator=function(e,r){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!wre.isValid(r))throw new Error("Invalid version: "+r);return r>=1&&r<10?e.ccBits[0]:r<27?e.ccBits[1]:e.ccBits[2]};Ct.getBestModeForData=function(e){return dI.testNumeric(e)?Ct.NUMERIC:dI.testAlphanumeric(e)?Ct.ALPHANUMERIC:dI.testKanji(e)?Ct.KANJI:Ct.BYTE};Ct.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")};Ct.isValid=function(e){return e&&e.bit&&e.ccBits};function Ere(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return Ct.NUMERIC;case"alphanumeric":return Ct.ALPHANUMERIC;case"kanji":return Ct.KANJI;case"byte":return Ct.BYTE;default:throw new Error("Unknown mode: "+t)}}Ct.from=function(e,r){if(Ct.isValid(e))return e;try{return Ere(e)}catch{return r}}});var _M=m(co=>{c();var wy=os(),vre=uI(),EM=hy(),cs=us(),pI=fI(),AM=7973,vM=wy.getBCHDigit(AM);function Are(t,e,r){for(let n=1;n<=40;n++)if(e<=co.getCapacity(n,r,t))return n}function bM(t,e){return cs.getCharCountIndicator(t,e)+4}function bre(t,e){let r=0;return t.forEach(function(n){let i=bM(n.mode,e);r+=i+n.getBitsLength()}),r}function _re(t,e){for(let r=1;r<=40;r++)if(bre(t,r)<=co.getCapacity(r,e,cs.MIXED))return r}co.from=function(e,r){return pI.isValid(e)?parseInt(e,10):r};co.getCapacity=function(e,r,n){if(!pI.isValid(e))throw new Error("Invalid QR Code version");typeof n>"u"&&(n=cs.BYTE);let i=wy.getSymbolTotalCodewords(e),s=vre.getTotalCodewordsCount(e,r),o=(i-s)*8;if(n===cs.MIXED)return o;let a=o-bM(n,e);switch(n){case cs.NUMERIC:return Math.floor(a/10*3);case cs.ALPHANUMERIC:return Math.floor(a/11*2);case cs.KANJI:return Math.floor(a/13);case cs.BYTE:default:return Math.floor(a/8)}};co.getBestVersionForData=function(e,r){let n,i=EM.from(r,EM.M);if(Array.isArray(e)){if(e.length>1)return _re(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return Are(n.mode,n.getLength(),i)};co.getEncodedBits=function(e){if(!pI.isValid(e)||e<7)throw new Error("Invalid QR Code version");let r=e<<12;for(;wy.getBCHDigit(r)-vM>=0;)r^=AM<{c();var gI=os(),SM=1335,Ire=21522,IM=gI.getBCHDigit(SM);TM.getEncodedBits=function(e,r){let n=e.bit<<3|r,i=n<<10;for(;gI.getBCHDigit(i)-IM>=0;)i^=SM<{c();var Sre=us();function wu(t){this.mode=Sre.NUMERIC,this.data=t.toString()}wu.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)};wu.prototype.getLength=function(){return this.data.length};wu.prototype.getBitsLength=function(){return wu.getBitsLength(this.data.length)};wu.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))};xM.exports=wu});var DM=m((Nwe,OM)=>{c();var Tre=us(),yI=["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 Eu(t){this.mode=Tre.ALPHANUMERIC,this.data=t}Eu.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)};Eu.prototype.getLength=function(){return this.data.length};Eu.prototype.getBitsLength=function(){return Eu.getBitsLength(this.data.length)};Eu.prototype.write=function(e){let r;for(r=0;r+2<=this.data.length;r+=2){let n=yI.indexOf(this.data[r])*45;n+=yI.indexOf(this.data[r+1]),e.put(n,11)}this.data.length%2&&e.put(yI.indexOf(this.data[r]),6)};OM.exports=Eu});var RM=m((Dwe,PM)=>{"use strict";c();PM.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 LM=m((Rwe,BM)=>{c();var Cre=RM(),xre=us();function vu(t){this.mode=xre.BYTE,typeof t=="string"&&(t=Cre(t)),this.data=new Uint8Array(t)}vu.getBitsLength=function(e){return e*8};vu.prototype.getLength=function(){return this.data.length};vu.prototype.getBitsLength=function(){return vu.getBitsLength(this.data.length)};vu.prototype.write=function(t){for(let e=0,r=this.data.length;e{c();var Nre=us(),Ore=os();function Au(t){this.mode=Nre.KANJI,this.data=t}Au.getBitsLength=function(e){return e*13};Au.prototype.getLength=function(){return this.data.length};Au.prototype.getBitsLength=function(){return Au.getBitsLength(this.data.length)};Au.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)}};FM.exports=Au});var UM=m((Mwe,mI)=>{"use strict";c();var Ul={single_source_shortest_paths:function(t,e,r){var n={},i={};i[e]=0;var s=Ul.PriorityQueue.make();s.push(e,0);for(var o,a,u,l,f,d,g,w,E;!s.empty();){o=s.pop(),a=o.value,l=o.cost,f=t[a]||{};for(u in f)f.hasOwnProperty(u)&&(d=f[u],g=l+d,w=i[u],E=typeof i[u]>"u",(E||w>g)&&(i[u]=g,s.push(u,g),n[u]=a))}if(typeof r<"u"&&typeof i[r]>"u"){var x=["Could not find a path from ",e," to ",r,"."].join("");throw new Error(x)}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=Ul.single_source_shortest_paths(t,e,r);return Ul.extract_shortest_path_from_predecessor_list(n,r)},PriorityQueue:{make:function(t){var e=Ul.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 mI<"u"&&(mI.exports=Ul)});var WM=m(bu=>{c();var He=us(),HM=NM(),GM=DM(),jM=LM(),kM=MM(),ql=hI(),Ey=os(),Dre=UM();function qM(t){return unescape(encodeURIComponent(t)).length}function Vl(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 QM(t){let e=Vl(ql.NUMERIC,He.NUMERIC,t),r=Vl(ql.ALPHANUMERIC,He.ALPHANUMERIC,t),n,i;return Ey.isKanjiModeEnabled()?(n=Vl(ql.BYTE,He.BYTE,t),i=Vl(ql.KANJI,He.KANJI,t)):(n=Vl(ql.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 wI(t,e){switch(e){case He.NUMERIC:return HM.getBitsLength(t);case He.ALPHANUMERIC:return GM.getBitsLength(t);case He.KANJI:return kM.getBitsLength(t);case He.BYTE:return jM.getBitsLength(t)}}function Pre(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 Rre(t){let e=[];for(let r=0;r{c();var Ay=os(),EI=hy(),Lre=iM(),Fre=oM(),Mre=aM(),Ure=lM(),bI=fM(),_I=uI(),qre=yM(),vy=_M(),Vre=CM(),Hre=us(),vI=WM();function Gre(t,e){let r=t.size,n=Ure.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 jre(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 AI(t,e,r){let n=t.size,i=Vre.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 Wre(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 zre(t,e,r){let n=new Lre;r.forEach(function(u){n.put(u.mode.bit,4),n.put(u.getLength(),Hre.getCharCountIndicator(u.mode,t)),u.write(n)});let i=Ay.getSymbolTotalCodewords(t),s=_I.getTotalCodewordsCount(t,e),o=(i-s)*8;for(n.getLengthInBits()+4<=o&&n.put(0,4);n.getLengthInBits()%8!==0;)n.putBit(0);let a=(o-n.getLengthInBits())/8;for(let u=0;u{"use strict";c();Object.defineProperty(kg,"__esModule",{value:!0});kg.TokenOperationsFactoryConfig=void 0;var FZ=ht(),e_=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=FZ.Address.fromBech32("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u"),this.chainID=e}};kg.TokenOperationsFactoryConfig=e_});var wB=m(jg=>{"use strict";c();Object.defineProperty(jg,"__esModule",{value:!0});jg.TokenOperationsOutcomeParser=void 0;var MZ=ht(),t_=Be(),mB=Jb(),r_=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 t_.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 t_.ErrCannotParseTransactionOutcome(e.hash,`cannot find event of type ${r}`);if(n.length>1)throw new t_.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 mB.bufferToBigInt((r=e.topics[1])===null||r===void 0?void 0:r.valueOf()).toFixed(0)}extractAmount(e){var r;return mB.bufferToBigInt((r=e.topics[2])===null||r===void 0?void 0:r.valueOf()).toFixed(0)}extractAddress(e){var r;return MZ.Address.fromBuffer((r=e.topics[3])===null||r===void 0?void 0:r.valueOf()).toString()}};jg.TokenOperationsOutcomeParser=r_});var EB=m(ci=>{"use strict";c();var UZ=ci&&ci.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),n_=ci&&ci.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&UZ(e,t,r)};Object.defineProperty(ci,"__esModule",{value:!0});n_(gB(),ci);n_(yB(),ci);n_(wB(),ci)});var vB=m(Ze=>{"use strict";c();var qZ=Ze&&Ze.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.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=Ze&&Ze.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&qZ(e,t,r)};Object.defineProperty(Ze,"__esModule",{value:!0});Q8();Ct(ra(),Ze);Ct(ht(),Ze);Ct(sE(),Ze);Ct(Be(),Ze);Ct(tE(),Ze);Ct($8(),Ze);Ct(K8(),Ze);Ct(na(),Ze);Ct(cc(),Ze);Ct(Y8(),Ze);Ct(lB(),Ze);Ct(fB(),Ze);Ct($b(),Ze);Ct(EB(),Ze);Ct(Em(),Ze);Ct(wn(),Ze);Ct(jn(),Ze);Ct(ed(),Ze);Ct(Zw(),Ze);Ct(wr(),Ze)});var TB=m(xt=>{"use strict";c();var VZ=xt&&xt.__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(xt,"__esModule",{value:!0});xt.sleep=xt.getMetadata=xt.applyTransactionSignature=xt.getAddressFromSession=xt.addressIsValid=xt.getConnectionParams=xt.getCurrentTopic=xt.getCurrentSession=void 0;var _B=vB(),AB=jh(),HZ=cl(),Qg=Db(),li=Bb(),i_=Fb(),bB=Bg();function IB(t,e){if(!e)throw new Error(li.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=e.find(SB(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 i_.Logger.error(li.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),new Error(li.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected)}xt.getCurrentSession=IB;function GZ(t,e){if(!e)throw new Error(li.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=IB(t,e);if(!r?.topic)throw new Error(li.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);return r.topic}xt.getCurrentTopic=GZ;function SB(t,e){var r,n,i;let s=[...Qg.WALLETCONNECT_MULTIVERSX_METHODS,...(r=e?.methods)!==null&&r!==void 0?r:[]];!((n=e?.methods)===null||n===void 0)&&n.includes(bB.OptionalOperation.SIGN_LOGIN_TOKEN)||s.push(bB.OptionalOperation.SIGN_LOGIN_TOKEN);let o=[`${Qg.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${t}`],a=(i=e?.events)!==null&&i!==void 0?i:[];return{requiredNamespaces:{[Qg.WALLETCONNECT_MULTIVERSX_NAMESPACE]:{methods:s,chains:o,events:a}}}}xt.getConnectionParams=SB;function kZ(t){try{return!_B.Address.fromBech32(t).isEmpty()}catch{return!1}}xt.addressIsValid=kZ;function jZ(t){let e=t.namespaces[Qg.WALLETCONNECT_MULTIVERSX_NAMESPACE];if(e&&e.accounts){let r=e.accounts[0],[n,i,s]=r.split(":");return s}return""}xt.getAddressFromSession=jZ;function QZ({transaction:t,response:e}){if(!e)throw i_.Logger.error(li.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse),new Error(li.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse);let{signature:r,guardianSignature:n,version:i,options:s,guardian:o}=e,a=t.getGuardian().bech32();if(a&&a!==o)throw i_.Logger.error(li.WalletConnectV2ProviderErrorMessagesEnum.invalidGuardian),new Error(li.WalletConnectV2ProviderErrorMessagesEnum.invalidGuardian);return o&&t.setGuardian(_B.Address.fromBech32(o)),i&&t.setVersion(i),s!=null&&t.setOptions(s),t.applySignature(new AB.Signature(r)),n&&t.applyGuardianSignature(new AB.Signature(n)),t}xt.applyTransactionSignature=QZ;function WZ(t){if(t)return Object.assign(Object.assign({},t),{url:HZ.getAppMetadata().url})}xt.getMetadata=WZ;function $Z(t){return VZ(this,void 0,void 0,function*(){return yield new Promise(e=>setTimeout(()=>{e()},t))})}xt.sleep=$Z});var Cl=m(yr=>{"use strict";c();var bt=yr&&yr.__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())})},zZ=yr&&yr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(yr,"__esModule",{value:!0});yr.WalletConnectV2Provider=yr.OptionalOperation=yr.Operation=yr.WalletConnectV2ProviderErrorMessagesEnum=void 0;var KZ=jh(),YZ=zZ(k8()),s_=cl(),oo=Db(),ye=Bb();Object.defineProperty(yr,"WalletConnectV2ProviderErrorMessagesEnum",{enumerable:!0,get:function(){return ye.WalletConnectV2ProviderErrorMessagesEnum}});var Le=Fb(),Zi=Bg();Object.defineProperty(yr,"Operation",{enumerable:!0,get:function(){return Zi.Operation}});Object.defineProperty(yr,"OptionalOperation",{enumerable:!0,get:function(){return Zi.OptionalOperation}});var jt=TB(),o_=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 bt(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:jt.getMetadata((r=this.options)===null||r===void 0?void 0:r.metadata)}:{},i=yield YZ.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 bt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=jt.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 bt(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){yield jt.sleep(oo.WALLETCONNECT_SIGN_LOGIN_DELAY);let i=jt.getAddressFromSession(n),o=n.namespaces[oo.WALLETCONNECT_MULTIVERSX_NAMESPACE].methods.includes(Zi.OptionalOperation.SIGN_NATIVE_AUTH_TOKEN)?Zi.OptionalOperation.SIGN_NATIVE_AUTH_TOKEN:Zi.OptionalOperation.SIGN_LOGIN_TOKEN,{signature:a}=yield this.walletConnector.request({chainId:`${oo.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 bt(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||jt.getCurrentTopic(this.chainId,this.walletConnector)))return!0;if(e?.topic)this.processingTopic=e.topic,yield this.walletConnector.disconnect({topic:e.topic,reason:s_.getSdkError("USER_DISCONNECTED")});else{let r=jt.getCurrentTopic(this.chainId,this.walletConnector);this.processingTopic=r,yield this.walletConnector.disconnect({topic:r,reason:s_.getSdkError("USER_DISCONNECTED")}),this.reset(),yield this.cleanupPendingPairings({deletePairings:!0})}}catch{Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.alreadyLoggedOut)}finally{this.processingTopic=""}return!0})}getAddress(){return bt(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 bt(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 bt(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 bt(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:`${oo.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:jt.getCurrentTopic(this.chainId,this.walletConnector),request:{method:Zi.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 KZ.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 bt(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:`${oo.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:jt.getCurrentTopic(this.chainId,this.walletConnector),request:{method:Zi.Operation.SIGN_TRANSACTION,params:{transaction:r}}});return jt.applyTransactionSignature({transaction:e,response:n})}catch{throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.transactionError)}})}signTransactions(e){return bt(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:`${oo.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:jt.getCurrentTopic(this.chainId,this.walletConnector),request:{method:Zi.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];jt.applyTransactionSignature({transaction:s,response:o})}return e}catch{throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.transactionError)}})}sendCustomRequest(e){var r;return bt(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:`${oo.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:jt.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 bt(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=jt.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 bt(this,void 0,void 0,function*(){return e?jt.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 bt(this,void 0,void 0,function*(){if(!e)return"";this.session=e.session;let r=jt.getAddressFromSession(e.session);return r?(yield this.loginAccount({address:r,signature:e.signature}),r):""})}handleTopicUpdateEvent({topic:e}){return bt(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 bt(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&&jt.getCurrentTopic(this.chainId,this.walletConnector)===e){let s=i.data;this.onClientConnect.onClientEvent(s)}})}subscribeToEvents(e){var r,n,i,s;return bt(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})=>bt(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})=>bt(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 bt(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=jt.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 bt(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(!s_.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)}})}};yr.WalletConnectV2Provider=o_});var xB=m((Fye,CB)=>{"use strict";c();CB.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 DB=m((Uye,OB)=>{"use strict";c();var NB=typeof Symbol<"u"&&Symbol,JZ=xB();OB.exports=function(){return typeof NB!="function"||typeof Symbol!="function"||typeof NB("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:JZ()}});var BB=m((Vye,RB)=>{"use strict";c();var PB={foo:{}},XZ=Object;RB.exports=function(){return{__proto__:PB}.foo===PB.foo&&!({__proto__:null}instanceof XZ)}});var MB=m((Gye,FB)=>{"use strict";c();var ZZ="Function.prototype.bind called on incompatible ",eee=Object.prototype.toString,tee=Math.max,ree="[object Function]",LB=function(e,r){for(var n=[],i=0;i{"use strict";c();var see=MB();UB.exports=Function.prototype.bind||see});var VB=m((Wye,qB)=>{"use strict";c();var oee=Function.prototype.call,aee=Object.prototype.hasOwnProperty,uee=Wg();qB.exports=uee.call(oee,aee)});var es=m((zye,QB)=>{"use strict";c();var Pe,iu=SyntaxError,jB=Function,nu=TypeError,a_=function(t){try{return jB('"use strict"; return ('+t+").constructor;")()}catch{}},ao=Object.getOwnPropertyDescriptor;if(ao)try{ao({},"")}catch{ao=null}var u_=function(){throw new nu},cee=ao?function(){try{return arguments.callee,u_}catch{try{return ao(arguments,"callee").get}catch{return u_}}}():u_,tu=DB()(),lee=BB()(),Mt=Object.getPrototypeOf||(lee?function(t){return t.__proto__}:null),ru={},fee=typeof Uint8Array>"u"||!Mt?Pe:Mt(Uint8Array),uo={"%AggregateError%":typeof AggregateError>"u"?Pe:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Pe:ArrayBuffer,"%ArrayIteratorPrototype%":tu&&Mt?Mt([][Symbol.iterator]()):Pe,"%AsyncFromSyncIteratorPrototype%":Pe,"%AsyncFunction%":ru,"%AsyncGenerator%":ru,"%AsyncGeneratorFunction%":ru,"%AsyncIteratorPrototype%":ru,"%Atomics%":typeof Atomics>"u"?Pe:Atomics,"%BigInt%":typeof BigInt>"u"?Pe:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Pe:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Pe:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Pe:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?Pe:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Pe:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Pe:FinalizationRegistry,"%Function%":jB,"%GeneratorFunction%":ru,"%Int8Array%":typeof Int8Array>"u"?Pe:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Pe:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Pe:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":tu&&Mt?Mt(Mt([][Symbol.iterator]())):Pe,"%JSON%":typeof JSON=="object"?JSON:Pe,"%Map%":typeof Map>"u"?Pe:Map,"%MapIteratorPrototype%":typeof Map>"u"||!tu||!Mt?Pe:Mt(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Pe:Promise,"%Proxy%":typeof Proxy>"u"?Pe:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?Pe:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Pe:Set,"%SetIteratorPrototype%":typeof Set>"u"||!tu||!Mt?Pe:Mt(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Pe:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":tu&&Mt?Mt(""[Symbol.iterator]()):Pe,"%Symbol%":tu?Symbol:Pe,"%SyntaxError%":iu,"%ThrowTypeError%":cee,"%TypedArray%":fee,"%TypeError%":nu,"%Uint8Array%":typeof Uint8Array>"u"?Pe:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Pe:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Pe:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Pe:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?Pe:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Pe:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Pe:WeakSet};if(Mt)try{null.error}catch(t){HB=Mt(Mt(t)),uo["%Error.prototype%"]=HB}var HB,hee=function t(e){var r;if(e==="%AsyncFunction%")r=a_("async function () {}");else if(e==="%GeneratorFunction%")r=a_("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=a_("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 uo[e]=r,r},GB={"%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"]},xl=Wg(),$g=VB(),dee=xl.call(Function.call,Array.prototype.concat),pee=xl.call(Function.apply,Array.prototype.splice),kB=xl.call(Function.call,String.prototype.replace),zg=xl.call(Function.call,String.prototype.slice),gee=xl.call(Function.call,RegExp.prototype.exec),yee=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,mee=/\\(\\)?/g,wee=function(e){var r=zg(e,0,1),n=zg(e,-1);if(r==="%"&&n!=="%")throw new iu("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new iu("invalid intrinsic syntax, expected opening `%`");var i=[];return kB(e,yee,function(s,o,a,u){i[i.length]=a?kB(u,mee,"$1"):o||s}),i},Eee=function(e,r){var n=e,i;if($g(GB,n)&&(i=GB[n],n="%"+i[0]+"%"),$g(uo,n)){var s=uo[n];if(s===ru&&(s=hee(n)),typeof s>"u"&&!r)throw new nu("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:s}}throw new iu("intrinsic "+e+" does not exist!")};QB.exports=function(e,r){if(typeof e!="string"||e.length===0)throw new nu("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new nu('"allowMissing" argument must be a boolean');if(gee(/^%?[^%]*%?$/,e)===null)throw new iu("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=wee(e),i=n.length>0?n[0]:"",s=Eee("%"+i+"%",r),o=s.name,a=s.value,u=!1,l=s.alias;l&&(i=l[0],pee(n,dee([0,1],l)));for(var f=1,d=!0;f=n.length){var T=ao(a,g);d=!!T,d&&"get"in T&&!("originalValue"in T.get)?a=T.get:a=a[g]}else d=$g(a,g),a=a[g];d&&!u&&(uo[o]=a)}}return a}});var f_=m((Yye,WB)=>{"use strict";c();var vee=es(),c_=vee("%Object.defineProperty%",!0),l_=function(){if(c_)try{return c_({},"a",{value:1}),!0}catch{return!1}return!1};l_.hasArrayLengthDefineBug=function(){if(!l_())return null;try{return c_([],"length",{value:1}).length!==1}catch{return!0}};WB.exports=l_});var h_=m((Xye,$B)=>{"use strict";c();var Aee=es(),Kg=Aee("%Object.getOwnPropertyDescriptor%",!0);if(Kg)try{Kg([],"length")}catch{Kg=null}$B.exports=Kg});var YB=m((e0e,KB)=>{"use strict";c();var bee=f_()(),d_=es(),Nl=bee&&d_("%Object.defineProperty%",!0);if(Nl)try{Nl({},"a",{value:1})}catch{Nl=!1}var _ee=d_("%SyntaxError%"),su=d_("%TypeError%"),zB=h_();KB.exports=function(e,r,n){if(!e||typeof e!="object"&&typeof e!="function")throw new su("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new su("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new su("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new su("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new su("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new su("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,s=arguments.length>4?arguments[4]:null,o=arguments.length>5?arguments[5]:null,a=arguments.length>6?arguments[6]:!1,u=!!zB&&zB(e,r);if(Nl)Nl(e,r,{configurable:o===null&&u?u.configurable:!o,enumerable:i===null&&u?u.enumerable:!i,value:n,writable:s===null&&u?u.writable:!s});else if(a||!i&&!s&&!o)e[r]=n;else throw new _ee("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var rL=m((r0e,tL)=>{"use strict";c();var eL=es(),JB=YB(),Iee=f_()(),XB=h_(),ZB=eL("%TypeError%"),See=eL("%Math.floor%");tL.exports=function(e,r){if(typeof e!="function")throw new ZB("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||See(r)!==r)throw new ZB("`length` must be a positive 32-bit integer");var n=arguments.length>2&&!!arguments[2],i=!0,s=!0;if("length"in e&&XB){var o=XB(e,"length");o&&!o.configurable&&(i=!1),o&&!o.writable&&(s=!1)}return(i||s||!n)&&(Iee?JB(e,"length",r,!0,!0):JB(e,"length",r)),e}});var aL=m((i0e,Yg)=>{"use strict";c();var p_=Wg(),ou=es(),Tee=rL(),Cee=ou("%TypeError%"),iL=ou("%Function.prototype.apply%"),sL=ou("%Function.prototype.call%"),oL=ou("%Reflect.apply%",!0)||p_.call(sL,iL),Ol=ou("%Object.defineProperty%",!0),xee=ou("%Math.max%");if(Ol)try{Ol({},"a",{value:1})}catch{Ol=null}Yg.exports=function(e){if(typeof e!="function")throw new Cee("a function is required");var r=oL(p_,sL,arguments);return Tee(r,1+xee(0,e.length-(arguments.length-1)),!0)};var nL=function(){return oL(p_,iL,arguments)};Ol?Ol(Yg.exports,"apply",{value:nL}):Yg.exports.apply=nL});var fL=m((o0e,lL)=>{"use strict";c();var uL=es(),cL=aL(),Nee=cL(uL("String.prototype.indexOf"));lL.exports=function(e,r){var n=uL(e,!!r);return typeof n=="function"&&Nee(e,".prototype.")>-1?cL(n):n}});var hL=m(()=>{c()});var PL=m((f0e,DL)=>{c();var I_=typeof Map=="function"&&Map.prototype,g_=Object.getOwnPropertyDescriptor&&I_?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Xg=I_&&g_&&typeof g_.get=="function"?g_.get:null,dL=I_&&Map.prototype.forEach,S_=typeof Set=="function"&&Set.prototype,y_=Object.getOwnPropertyDescriptor&&S_?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Zg=S_&&y_&&typeof y_.get=="function"?y_.get:null,pL=S_&&Set.prototype.forEach,Oee=typeof WeakMap=="function"&&WeakMap.prototype,Pl=Oee?WeakMap.prototype.has:null,Dee=typeof WeakSet=="function"&&WeakSet.prototype,Rl=Dee?WeakSet.prototype.has:null,Pee=typeof WeakRef=="function"&&WeakRef.prototype,gL=Pee?WeakRef.prototype.deref:null,Ree=Boolean.prototype.valueOf,Bee=Object.prototype.toString,Lee=Function.prototype.toString,Fee=String.prototype.match,T_=String.prototype.slice,rs=String.prototype.replace,Mee=String.prototype.toUpperCase,yL=String.prototype.toLowerCase,SL=RegExp.prototype.test,mL=Array.prototype.concat,Rn=Array.prototype.join,Uee=Array.prototype.slice,wL=Math.floor,E_=typeof BigInt=="function"?BigInt.prototype.valueOf:null,m_=Object.getOwnPropertySymbols,v_=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,au=typeof Symbol=="function"&&typeof Symbol.iterator=="object",er=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===au||"symbol")?Symbol.toStringTag:null,TL=Object.prototype.propertyIsEnumerable,EL=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function vL(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||SL.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var n=t<0?-wL(-t):wL(t);if(n!==t){var i=String(n),s=T_.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 A_=hL(),AL=A_.custom,bL=xL(AL)?AL:null;DL.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 OL(e,s);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var u=String(e);return a?vL(e,u):u}if(typeof e=="bigint"){var l=String(e)+"n";return a?vL(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 b_(e)?"[Array]":"[Object]";var d=rte(s,n);if(typeof i>"u")i=[];else if(NL(i,e)>=0)return"[Circular]";function g(k,K,pe){if(K&&(i=Uee.call(i),i.push(K)),pe){var ue={depth:s.depth};return ts(s,"quoteStyle")&&(ue.quoteStyle=s.quoteStyle),t(k,ue,n+1,i)}return t(k,s,n+1,i)}if(typeof e=="function"&&!_L(e)){var w=$ee(e),E=Jg(e,g);return"[Function"+(w?": "+w:" (anonymous)")+"]"+(E.length>0?" { "+Rn.call(E,", ")+" }":"")}if(xL(e)){var T=au?rs.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):v_.call(e);return typeof e=="object"&&!au?Dl(T):T}if(Zee(e)){for(var D="<"+yL.call(String(e.nodeName)),B=e.attributes||[],W=0;W",D}if(b_(e)){if(e.length===0)return"[]";var U=Jg(e,g);return d&&!tte(U)?"["+__(U,d)+"]":"[ "+Rn.call(U,", ")+" ]"}if(Hee(e)){var A=Jg(e,g);return!("cause"in Error.prototype)&&"cause"in e&&!TL.call(e,"cause")?"{ ["+String(e)+"] "+Rn.call(mL.call("[cause]: "+g(e.cause),A),", ")+" }":A.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+Rn.call(A,", ")+" }"}if(typeof e=="object"&&o){if(bL&&typeof e[bL]=="function"&&A_)return A_(e,{depth:f-n});if(o!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(zee(e)){var I=[];return dL&&dL.call(e,function(k,K){I.push(g(K,e,!0)+" => "+g(k,e))}),IL("Map",Xg.call(e),I,d)}if(Jee(e)){var N=[];return pL&&pL.call(e,function(k){N.push(g(k,e))}),IL("Set",Zg.call(e),N,d)}if(Kee(e))return w_("WeakMap");if(Xee(e))return w_("WeakSet");if(Yee(e))return w_("WeakRef");if(kee(e))return Dl(g(Number(e)));if(Qee(e))return Dl(g(E_.call(e)));if(jee(e))return Dl(Ree.call(e));if(Gee(e))return Dl(g(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(e===global)return"{ [object globalThis] }";if(!Vee(e)&&!_L(e)){var _=Jg(e,g),S=EL?EL(e)===Object.prototype:e instanceof Object||e.constructor===Object,R=e instanceof Object?"":"null prototype",J=!S&&er&&Object(e)===e&&er in e?T_.call(ns(e),8,-1):R?"Object":"",Q=S||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",V=Q+(J||R?"["+Rn.call(mL.call([],J||[],R||[]),": ")+"] ":"");return _.length===0?V+"{}":d?V+"{"+__(_,d)+"}":V+"{ "+Rn.call(_,", ")+" }"}return String(e)};function CL(t,e,r){var n=(r.quoteStyle||e)==="double"?'"':"'";return n+t+n}function qee(t){return rs.call(String(t),/"/g,""")}function b_(t){return ns(t)==="[object Array]"&&(!er||!(typeof t=="object"&&er in t))}function Vee(t){return ns(t)==="[object Date]"&&(!er||!(typeof t=="object"&&er in t))}function _L(t){return ns(t)==="[object RegExp]"&&(!er||!(typeof t=="object"&&er in t))}function Hee(t){return ns(t)==="[object Error]"&&(!er||!(typeof t=="object"&&er in t))}function Gee(t){return ns(t)==="[object String]"&&(!er||!(typeof t=="object"&&er in t))}function kee(t){return ns(t)==="[object Number]"&&(!er||!(typeof t=="object"&&er in t))}function jee(t){return ns(t)==="[object Boolean]"&&(!er||!(typeof t=="object"&&er in t))}function xL(t){if(au)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!v_)return!1;try{return v_.call(t),!0}catch{}return!1}function Qee(t){if(!t||typeof t!="object"||!E_)return!1;try{return E_.call(t),!0}catch{}return!1}var Wee=Object.prototype.hasOwnProperty||function(t){return t in this};function ts(t,e){return Wee.call(t,e)}function ns(t){return Bee.call(t)}function $ee(t){if(t.name)return t.name;var e=Fee.call(Lee.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function NL(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 OL(T_.call(t,0,e.maxStringLength),e)+n}var i=rs.call(rs.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,ete);return CL(i,"single",e)}function ete(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":"")+Mee.call(e.toString(16))}function Dl(t){return"Object("+t+")"}function w_(t){return t+" { ? }"}function IL(t,e,r,n){var i=n?__(r,n):Rn.call(r,", ");return t+" ("+e+") {"+i+"}"}function tte(t){for(var e=0;e=0)return!1;return!0}function rte(t,e){var r;if(t.indent===" ")r=" ";else if(typeof t.indent=="number"&&t.indent>0)r=Rn.call(Array(t.indent+1)," ");else return null;return{base:r,prev:Rn.call(Array(e+1),r)}}function __(t,e){if(t.length===0)return"";var r=` +`+e.prev+e.base;return r+Rn.call(t,","+r)+` +`+e.prev}function Jg(t,e){var r=b_(t),n=[];if(r){n.length=t.length;for(var i=0;i{"use strict";c();var C_=es(),uu=fL(),nte=PL(),ite=C_("%TypeError%"),ey=C_("%WeakMap%",!0),ty=C_("%Map%",!0),ste=uu("WeakMap.prototype.get",!0),ote=uu("WeakMap.prototype.set",!0),ate=uu("WeakMap.prototype.has",!0),ute=uu("Map.prototype.get",!0),cte=uu("Map.prototype.set",!0),lte=uu("Map.prototype.has",!0),x_=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},fte=function(t,e){var r=x_(t,e);return r&&r.value},hte=function(t,e,r){var n=x_(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}},dte=function(t,e){return!!x_(t,e)};RL.exports=function(){var e,r,n,i={assert:function(s){if(!i.has(s))throw new ite("Side channel does not contain "+nte(s))},get:function(s){if(ey&&s&&(typeof s=="object"||typeof s=="function")){if(e)return ste(e,s)}else if(ty){if(r)return ute(r,s)}else if(n)return fte(n,s)},has:function(s){if(ey&&s&&(typeof s=="object"||typeof s=="function")){if(e)return ate(e,s)}else if(ty){if(r)return lte(r,s)}else if(n)return dte(n,s);return!1},set:function(s,o){ey&&s&&(typeof s=="object"||typeof s=="function")?(e||(e=new ey),ote(e,s,o)):ty?(r||(r=new ty),cte(r,s,o)):(n||(n={key:{},next:null}),hte(n,s,o))}};return i}});var ry=m((g0e,LL)=>{"use strict";c();var pte=String.prototype.replace,gte=/%20/g,N_={RFC1738:"RFC1738",RFC3986:"RFC3986"};LL.exports={default:N_.RFC3986,formatters:{RFC1738:function(t){return pte.call(t,gte,"+")},RFC3986:function(t){return String(t)}},RFC1738:N_.RFC1738,RFC3986:N_.RFC3986}});var D_=m((m0e,ML)=>{"use strict";c();var yte=ry(),O_=Object.prototype.hasOwnProperty,co=Array.isArray,Bn=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),mte=function(e){for(;e.length>1;){var r=e.pop(),n=r.obj[r.prop];if(co(n)){for(var i=[],s=0;s=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122||s===yte.RFC1738&&(l===40||l===41)){a+=o.charAt(u);continue}if(l<128){a=a+Bn[l];continue}if(l<2048){a=a+(Bn[192|l>>6]+Bn[128|l&63]);continue}if(l<55296||l>=57344){a=a+(Bn[224|l>>12]+Bn[128|l>>6&63]+Bn[128|l&63]);continue}u+=1,l=65536+((l&1023)<<10|o.charCodeAt(u)&1023),a+=Bn[240|l>>18]+Bn[128|l>>12&63]+Bn[128|l>>6&63]+Bn[128|l&63]}return a},bte=function(e){for(var r=[{obj:{o:e},prop:"o"}],n=[],i=0;i{"use strict";c();var VL=BL(),R_=D_(),Bl=ry(),Cte=Object.prototype.hasOwnProperty,UL={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,r){return e+"["+r+"]"},repeat:function(e){return e}},lo=Array.isArray,xte=String.prototype.split,Nte=Array.prototype.push,HL=function(t,e){Nte.apply(t,lo(e)?e:[e])},Ote=Date.prototype.toISOString,qL=Bl.default,Qt={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:R_.encode,encodeValuesOnly:!1,format:qL,formatter:Bl.formatters[qL],indices:!1,serializeDate:function(e){return Ote.call(e)},skipNulls:!1,strictNullHandling:!1},Dte=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},P_={},Pte=function t(e,r,n,i,s,o,a,u,l,f,d,g,w,E,T){for(var D=e,B=T,W=0,U=!1;(B=B.get(P_))!==void 0&&!U;){var A=B.get(e);if(W+=1,typeof A<"u"){if(A===W)throw new RangeError("Cyclic object value");U=!0}typeof B.get(P_)>"u"&&(W=0)}if(typeof a=="function"?D=a(r,D):D instanceof Date?D=f(D):n==="comma"&&lo(D)&&(D=R_.maybeMap(D,function(re){return re instanceof Date?f(re):re})),D===null){if(i)return o&&!w?o(r,Qt.encoder,E,"key",d):r;D=""}if(Dte(D)||R_.isBuffer(D)){if(o){var I=w?r:o(r,Qt.encoder,E,"key",d);if(n==="comma"&&w){for(var N=xte.call(String(D),","),_="",S=0;S"u")return R;var J;if(n==="comma"&&lo(D))J=[{value:D.length>0?D.join(",")||null:void 0}];else if(lo(a))J=a;else{var Q=Object.keys(D);J=u?Q.sort(u):Q}for(var V=0;V"u"?Qt.allowDots:!!e.allowDots,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Qt.charsetSentinel,delimiter:typeof e.delimiter>"u"?Qt.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:Qt.encode,encoder:typeof e.encoder=="function"?e.encoder:Qt.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:Qt.encodeValuesOnly,filter:s,format:n,formatter:i,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:Qt.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:Qt.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Qt.strictNullHandling}};GL.exports=function(t,e){var r=t,n=Rte(e),i,s;typeof n.filter=="function"?(s=n.filter,r=s("",r)):lo(n.filter)&&(s=n.filter,i=s);var o=[];if(typeof r!="object"||r===null)return"";var a;e&&e.arrayFormat in UL?a=e.arrayFormat:e&&"indices"in e?a=e.indices?"indices":"repeat":a="indices";var u=UL[a];i||(i=Object.keys(r)),n.sort&&i.sort(n.sort);for(var l=VL(),f=0;f0?w+g:""}});var WL=m((A0e,QL)=>{"use strict";c();var cu=D_(),B_=Object.prototype.hasOwnProperty,Bte=Array.isArray,Ut={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:cu.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},Lte=function(t){return t.replace(/&#(\d+);/g,function(e,r){return String.fromCharCode(parseInt(r,10))})},jL=function(t,e){return t&&typeof t=="string"&&e.comma&&t.indexOf(",")>-1?t.split(","):t},Fte="utf8=%26%2310003%3B",Mte="utf8=%E2%9C%93",Ute=function(e,r){var n={},i=r.ignoreQueryPrefix?e.replace(/^\?/,""):e,s=r.parameterLimit===1/0?void 0:r.parameterLimit,o=i.split(r.delimiter,s),a=-1,u,l=r.charset;if(r.charsetSentinel)for(u=0;u-1&&(E=Bte(E)?[E]:E),B_.call(n,w)?n[w]=cu.combine(n[w],E):n[w]=E}return n},qte=function(t,e,r,n){for(var i=n?e:jL(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},Vte=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&&B_.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"||cu.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}};QL.exports=function(t,e){var r=Hte(e);if(t===""||t===null||typeof t>"u")return r.plainObjects?Object.create(null):{};for(var n=typeof t=="string"?Ute(t,r):t,i=r.plainObjects?Object.create(null):{},s=Object.keys(n),o=0;o{"use strict";c();var Gte=kL(),kte=WL(),jte=ry();$L.exports={formats:jte,parse:kte,stringify:Gte}});var L_=m(ut=>{"use strict";c();Object.defineProperty(ut,"__esModule",{value:!0});ut.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED=ut.WALLET_PROVIDER_CALLBACK_PARAM=ut.WALLET_PROVIDER_SIGN_MESSAGE_URL=ut.WALLET_PROVIDER_GUARD_TRANSACTION_URL=ut.WALLET_PROVIDER_SIGN_TRANSACTION_URL=ut.WALLET_PROVIDER_SEND_TRANSACTION_URL=ut.WALLET_PROVIDER_DISCONNECT_URL=ut.WALLET_PROVIDER_CONNECT_URL=ut.WALLET_PROVIDER_TESTNET=ut.WALLET_PROVIDER_DEVNET=ut.WALLET_PROVIDER_MAINNET=void 0;ut.WALLET_PROVIDER_MAINNET="https://wallet.multiversx.com/dapp/init";ut.WALLET_PROVIDER_DEVNET="https://devnet-wallet.multiversx.com/dapp/init";ut.WALLET_PROVIDER_TESTNET="https://testnet-wallet.multiversx.com/dapp/init";ut.WALLET_PROVIDER_CONNECT_URL="hook/login";ut.WALLET_PROVIDER_DISCONNECT_URL="hook/logout";ut.WALLET_PROVIDER_SEND_TRANSACTION_URL="hook/transaction";ut.WALLET_PROVIDER_SIGN_TRANSACTION_URL="hook/sign";ut.WALLET_PROVIDER_GUARD_TRANSACTION_URL="hook/2fa";ut.WALLET_PROVIDER_SIGN_MESSAGE_URL="hook/sign-message";ut.WALLET_PROVIDER_CALLBACK_PARAM="walletProviderStatus";ut.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED="transactionsSigned"});var KL=m(lu=>{"use strict";c();Object.defineProperty(lu,"__esModule",{value:!0});lu.ErrCannotSignedMessage=lu.ErrCannotGetSignedTransactions=void 0;var F_=class extends Error{constructor(){super("Cannot get signed transaction(s)")}};lu.ErrCannotGetSignedTransactions=F_;var M_=class extends Error{constructor(){super("Cannot get signed message")}};lu.ErrCannotSignedMessage=M_});var YL=m(ny=>{"use strict";c();Object.defineProperty(ny,"__esModule",{value:!0});ny.PlainSignedTransaction=void 0;var U_=class{constructor(e){this.nonce=0,this.value="",this.receiver="",this.sender="",this.gasPrice=0,this.gasLimit=0,this.data="",this.chainID="",this.version=0,this.signature="",Object.assign(this,e)}};ny.PlainSignedTransaction=U_});var Ll=m(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())})},Qte=os&&os.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(os,"__esModule",{value:!0});os.WalletProvider=void 0;var q_=Qte(zL()),ss=L_(),V_=KL(),Wte=YL(),H_=class t{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=q_.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 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=q_.default.parse(window.location.search.slice(1));return t.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 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}};os.WalletProvider=H_});var G_=m((R0e,JL)=>{"use strict";c();JL.exports=function(e,r){return function(){for(var i=new Array(arguments.length),s=0;s{"use strict";c();var $te=G_(),fo=Object.prototype.toString;function Q_(t){return fo.call(t)==="[object Array]"}function k_(t){return typeof t>"u"}function zte(t){return t!==null&&!k_(t)&&t.constructor!==null&&!k_(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function Kte(t){return fo.call(t)==="[object ArrayBuffer]"}function Yte(t){return typeof FormData<"u"&&t instanceof FormData}function Jte(t){var e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&t.buffer instanceof ArrayBuffer,e}function Xte(t){return typeof t=="string"}function Zte(t){return typeof t=="number"}function XL(t){return t!==null&&typeof t=="object"}function iy(t){if(fo.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function ere(t){return fo.call(t)==="[object Date]"}function tre(t){return fo.call(t)==="[object File]"}function rre(t){return fo.call(t)==="[object Blob]"}function ZL(t){return fo.call(t)==="[object Function]"}function nre(t){return XL(t)&&ZL(t.pipe)}function ire(t){return typeof URLSearchParams<"u"&&t instanceof URLSearchParams}function sre(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function ore(){return typeof navigator<"u"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window<"u"&&typeof document<"u"}function W_(t,e){if(!(t===null||typeof t>"u"))if(typeof t!="object"&&(t=[t]),Q_(t))for(var r=0,n=t.length;r{"use strict";c();var fu=mr();function tF(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}rF.exports=function(e,r,n){if(!r)return e;var i;if(n)i=n(r);else if(fu.isURLSearchParams(r))i=r.toString();else{var s=[];fu.forEach(r,function(u,l){u===null||typeof u>"u"||(fu.isArray(u)?l=l+"[]":u=[u],fu.forEach(u,function(d){fu.isDate(d)?d=d.toISOString():fu.isObject(d)&&(d=JSON.stringify(d)),s.push(tF(l)+"="+tF(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 iF=m((q0e,nF)=>{"use strict";c();var cre=mr();function sy(){this.handlers=[]}sy.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};sy.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};sy.prototype.forEach=function(e){cre.forEach(this.handlers,function(n){n!==null&&e(n)})};nF.exports=sy});var oF=m((H0e,sF)=>{"use strict";c();var lre=mr();sF.exports=function(e,r){lre.forEach(e,function(i,s){s!==r&&s.toUpperCase()===r.toUpperCase()&&(e[r]=i,delete e[s])})}});var z_=m((k0e,aF)=>{"use strict";c();aF.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 K_=m((Q0e,uF)=>{"use strict";c();var fre=z_();uF.exports=function(e,r,n,i,s){var o=new Error(e);return fre(o,r,n,i,s)}});var lF=m(($0e,cF)=>{"use strict";c();var hre=K_();cF.exports=function(e,r,n){var i=n.config.validateStatus;!n.status||!i||i(n.status)?e(n):r(hre("Request failed with status code "+n.status,n.config,null,n.request,n))}});var hF=m((K0e,fF)=>{"use strict";c();var oy=mr();fF.exports=oy.isStandardBrowserEnv()?function(){return{write:function(r,n,i,s,o,a){var u=[];u.push(r+"="+encodeURIComponent(n)),oy.isNumber(i)&&u.push("expires="+new Date(i).toGMTString()),oy.isString(s)&&u.push("path="+s),oy.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 pF=m((J0e,dF)=>{"use strict";c();dF.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}});var yF=m((Z0e,gF)=>{"use strict";c();gF.exports=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e}});var wF=m((tme,mF)=>{"use strict";c();var dre=pF(),pre=yF();mF.exports=function(e,r){return e&&!dre(r)?pre(e,r):r}});var vF=m((nme,EF)=>{"use strict";c();var Y_=mr(),gre=["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"];EF.exports=function(e){var r={},n,i,s;return e&&Y_.forEach(e.split(` +`),function(a){if(s=a.indexOf(":"),n=Y_.trim(a.substr(0,s)).toLowerCase(),i=Y_.trim(a.substr(s+1)),n){if(r[n]&&gre.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 _F=m((sme,bF)=>{"use strict";c();var AF=mr();bF.exports=AF.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=AF.isString(o)?i(o):o;return a.protocol===n.protocol&&a.host===n.host}}():function(){return function(){return!0}}()});var Fl=m((ame,IF)=>{"use strict";c();function J_(t){this.message=t}J_.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};J_.prototype.__CANCEL__=!0;IF.exports=J_});var Z_=m((cme,SF)=>{"use strict";c();var ay=mr(),yre=lF(),mre=hF(),wre=$_(),Ere=wF(),vre=vF(),Are=_F(),X_=K_(),bre=Ml(),_re=Fl();SF.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)}ay.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 w=Ere(e.baseURL,e.url);f.open(e.method.toUpperCase(),wre(w,e.params,e.paramsSerializer),!0),f.timeout=e.timeout;function E(){if(f){var D="getAllResponseHeaders"in f?vre(f.getAllResponseHeaders()):null,B=!a||a==="text"||a==="json"?f.responseText:f.response,W={data:B,status:f.status,statusText:f.statusText,headers:D,config:e,request:f};yre(function(A){n(A),l()},function(A){i(A),l()},W),f=null}}if("onloadend"in f?f.onloadend=E:f.onreadystatechange=function(){!f||f.readyState!==4||f.status===0&&!(f.responseURL&&f.responseURL.indexOf("file:")===0)||setTimeout(E)},f.onabort=function(){f&&(i(X_("Request aborted",e,"ECONNABORTED",f)),f=null)},f.onerror=function(){i(X_("Network Error",e,null,f)),f=null},f.ontimeout=function(){var B=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",W=e.transitional||bre.transitional;e.timeoutErrorMessage&&(B=e.timeoutErrorMessage),i(X_(B,e,W.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",f)),f=null},ay.isStandardBrowserEnv()){var T=(e.withCredentials||Are(w))&&e.xsrfCookieName?mre.read(e.xsrfCookieName):void 0;T&&(o[e.xsrfHeaderName]=T)}"setRequestHeader"in f&&ay.forEach(o,function(B,W){typeof s>"u"&&W.toLowerCase()==="content-type"?delete o[W]:f.setRequestHeader(W,B)}),ay.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(D){f&&(i(!D||D&&D.type?new _re("canceled"):D),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 Ml=m((fme,xF)=>{"use strict";c();var Wt=mr(),TF=oF(),Ire=z_(),Sre={"Content-Type":"application/x-www-form-urlencoded"};function CF(t,e){!Wt.isUndefined(t)&&Wt.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function Tre(){var t;return typeof XMLHttpRequest<"u"?t=Z_():typeof p.default<"u"&&Object.prototype.toString.call(p.default)==="[object process]"&&(t=Z_()),t}function Cre(t,e,r){if(Wt.isString(t))try{return(e||JSON.parse)(t),Wt.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}var uy={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:Tre(),transformRequest:[function(e,r){return TF(r,"Accept"),TF(r,"Content-Type"),Wt.isFormData(e)||Wt.isArrayBuffer(e)||Wt.isBuffer(e)||Wt.isStream(e)||Wt.isFile(e)||Wt.isBlob(e)?e:Wt.isArrayBufferView(e)?e.buffer:Wt.isURLSearchParams(e)?(CF(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):Wt.isObject(e)||r&&r["Content-Type"]==="application/json"?(CF(r,"application/json"),Cre(e)):e}],transformResponse:[function(e){var r=this.transitional||uy.transitional,n=r&&r.silentJSONParsing,i=r&&r.forcedJSONParsing,s=!n&&this.responseType==="json";if(s||i&&Wt.isString(e)&&e.length)try{return JSON.parse(e)}catch(o){if(s)throw o.name==="SyntaxError"?Ire(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, */*"}}};Wt.forEach(["delete","get","head"],function(e){uy.headers[e]={}});Wt.forEach(["post","put","patch"],function(e){uy.headers[e]=Wt.merge(Sre)});xF.exports=uy});var OF=m((dme,NF)=>{"use strict";c();var xre=mr(),Nre=Ml();NF.exports=function(e,r,n){var i=this||Nre;return xre.forEach(n,function(o){e=o.call(i,e,r)}),e}});var eI=m((gme,DF)=>{"use strict";c();DF.exports=function(e){return!!(e&&e.__CANCEL__)}});var BF=m((mme,RF)=>{"use strict";c();var PF=mr(),tI=OF(),Ore=eI(),Dre=Ml(),Pre=Fl();function rI(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Pre("canceled")}RF.exports=function(e){rI(e),e.headers=e.headers||{},e.data=tI.call(e,e.data,e.headers,e.transformRequest),e.headers=PF.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),PF.forEach(["delete","get","head","post","put","patch","common"],function(i){delete e.headers[i]});var r=e.adapter||Dre.adapter;return r(e).then(function(i){return rI(e),i.data=tI.call(e,i.data,i.headers,e.transformResponse),i},function(i){return Ore(i)||(rI(e),i&&i.response&&(i.response.data=tI.call(e,i.response.data,i.response.headers,e.transformResponse))),Promise.reject(i)})}});var nI=m((Eme,LF)=>{"use strict";c();var Ir=mr();LF.exports=function(e,r){r=r||{};var n={};function i(f,d){return Ir.isPlainObject(f)&&Ir.isPlainObject(d)?Ir.merge(f,d):Ir.isPlainObject(d)?Ir.merge({},d):Ir.isArray(d)?d.slice():d}function s(f){if(Ir.isUndefined(r[f])){if(!Ir.isUndefined(e[f]))return i(void 0,e[f])}else return i(e[f],r[f])}function o(f){if(!Ir.isUndefined(r[f]))return i(void 0,r[f])}function a(f){if(Ir.isUndefined(r[f])){if(!Ir.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 Ir.forEach(Object.keys(e).concat(Object.keys(r)),function(d){var g=l[d]||s,w=g(d);Ir.isUndefined(w)&&g!==u||(n[d]=w)}),n}});var iI=m((Ame,FF)=>{c();FF.exports={version:"0.24.0"}});var qF=m((_me,UF)=>{"use strict";c();var Rre=iI().version,sI={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){sI[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var MF={};sI.transitional=function(e,r,n){function i(s,o){return"[Axios v"+Rre+"] 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&&!MF[o]&&(MF[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 Bre(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)}}UF.exports={assertOptions:Bre,validators:sI}});var QF=m((Sme,jF)=>{"use strict";c();var GF=mr(),Lre=$_(),VF=iF(),HF=BF(),cy=nI(),kF=qF(),hu=kF.validators;function Ul(t){this.defaults=t,this.interceptors={request:new VF,response:new VF}}Ul.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=cy(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&&kF.assertOptions(r,{silentJSONParsing:hu.transitional(hu.boolean),forcedJSONParsing:hu.transitional(hu.boolean),clarifyTimeoutError:hu.transitional(hu.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=[HF,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=HF(u)}catch(d){return Promise.reject(d)}for(;s.length;)o=o.then(s.shift(),s.shift());return o};Ul.prototype.getUri=function(e){return e=cy(this.defaults,e),Lre(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};GF.forEach(["delete","get","head","options"],function(e){Ul.prototype[e]=function(r,n){return this.request(cy(n||{},{method:e,url:r,data:(n||{}).data}))}});GF.forEach(["post","put","patch"],function(e){Ul.prototype[e]=function(r,n,i){return this.request(cy(i||{},{method:e,url:r,data:n}))}});jF.exports=Ul});var $F=m((Cme,WF)=>{"use strict";c();var Fre=Fl();function du(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();zF.exports=function(e){return function(n){return e.apply(null,n)}}});var JF=m((Dme,YF)=>{"use strict";c();YF.exports=function(e){return typeof e=="object"&&e.isAxiosError===!0}});var eM=m((Rme,oI)=>{"use strict";c();var XF=mr(),Mre=G_(),ly=QF(),Ure=nI(),qre=Ml();function ZF(t){var e=new ly(t),r=Mre(ly.prototype.request,e);return XF.extend(r,ly.prototype,e),XF.extend(r,e),r.create=function(i){return ZF(Ure(t,i))},r}var Ln=ZF(qre);Ln.Axios=ly;Ln.Cancel=Fl();Ln.CancelToken=$F();Ln.isCancel=eI();Ln.VERSION=iI().version;Ln.all=function(e){return Promise.all(e)};Ln.spread=KF();Ln.isAxiosError=JF();oI.exports=Ln;oI.exports.default=Ln});var rM=m((Lme,tM)=>{c();tM.exports=eM()});var nM=m(fy=>{"use strict";c();Object.defineProperty(fy,"__esModule",{value:!0});fy.NativeAuthClientConfig=void 0;var aI=class{constructor(){this.origin=typeof window<"u"&&typeof window.location<"u"?window.location.hostname:"",this.apiUrl="https://api.multiversx.com",this.expirySeconds=60*60*24}};fy.NativeAuthClientConfig=aI});var cI=m(pu=>{"use strict";c();var ho=pu&&pu.__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(pu,"__esModule",{value:!0});pu.NativeAuthClient=void 0;var Vre=rM(),Hre=nM(),uI=class{constructor(e){this.config=Object.assign(new Hre.NativeAuthClientConfig,e)}getToken(e,r,n){let i=this.encodeValue(e),s=this.encodeValue(r);return`${i}.${s}.${n}`}initialize(e={}){return ho(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 ho(this,void 0,void 0,function*(){return this.config.gatewayUrl?yield this.getCurrentBlockHashWithGateway():yield this.getCurrentBlockHashWithApi()})}getCurrentBlockHashWithGateway(){return ho(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 ho(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 ho(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 ho(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 ho(this,void 0,void 0,function*(){return yield Vre.default.get(e,{headers:this.config.extraRequestHeaders})})}};pu.NativeAuthClient=uI});var uM=m(py=>{"use strict";c();Object.defineProperty(py,"__esModule",{value:!0});py.TransactionStatus=void 0;var lI=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}};py.TransactionStatus=lI});var mu=m(Vt=>{"use strict";c();var Gre=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]}),kre=Vt&&Vt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jre=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)&&Gre(e,t,r);return kre(e,t),e};Object.defineProperty(Vt,"__esModule",{value:!0});Vt.zeroPadStringIfOddLength=Vt.isPaddedHex=Vt.numberToPaddedHex=Vt.Nonce=Vt.Address=void 0;var cM=jre(Rm()),Qre="erd",fI=class t{constructor(e){this.value=e}static fromPubkey(e){let r=cM.toWords(e),n=cM.encode(Qre,r);return new t(n)}bech32(){return this.value}toString(){return this.bech32()}};Vt.Address=fI;var hI=class{constructor(e){this.value=e}valueOf(){return this.value}hex(){return lM(this.value)}};Vt.Nonce=hI;function lM(t){let e=t.toString(16);return fM(e)}Vt.numberToPaddedHex=lM;function Wre(t){t=t||"";let e=h.Buffer.from(t,"hex").toString("hex");return t.toUpperCase()==e.toUpperCase()}Vt.isPaddedHex=Wre;function fM(t){return t=t||"",t.length%2==1?"0"+t:t}Vt.zeroPadStringIfOddLength=fM});var dM=m(gy=>{"use strict";c();Object.defineProperty(gy,"__esModule",{value:!0});gy.TransactionReceipt=void 0;var hM=mu(),dI=class t{constructor(){this.value="",this.sender=new hM.Address(""),this.data="",this.hash=""}static fromHttpResponse(e){let r=new t;return r.value=(e.value||0).toString(),r.sender=new hM.Address(e.sender),r.data=e.data,r.hash=e.txHash,r}};gy.TransactionReceipt=dI});var pM=m(Fn=>{"use strict";c();Object.defineProperty(Fn,"__esModule",{value:!0});Fn.ErrContractQuery=Fn.ErrNetworkProvider=Fn.ErrUnexpectedCondition=Fn.Err=void 0;var wu=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};Fn.Err=wu;var pI=class extends wu{constructor(e){super(`Unexpected condition: [${e}]`)}};Fn.ErrUnexpectedCondition=pI;var gI=class extends wu{constructor(e,r,n){let i=`Request error on url [${e}]: [${r}]`;super(i,n)}};Fn.ErrNetworkProvider=gI;var yI=class extends wu{constructor(e){super(e.message.replace("executeQuery:",""))}};Fn.ErrContractQuery=yI});var yM=m(cs=>{"use strict";c();Object.defineProperty(cs,"__esModule",{value:!0});cs.TransactionEventTopic=cs.TransactionEventData=cs.TransactionEvent=void 0;var gM=mu(),mI=class t{constructor(e){this.address=new gM.Address(""),this.identifier="",this.topics=[],this.dataPayload=new ql(h.Buffer.from("","utf8")),this.data="",Object.assign(this,e)}static fromHttpResponse(e){let r=new t;r.address=new gM.Address(e.address),r.identifier=e.identifier||"",r.topics=(e.topics||[]).map(i=>new yy(i));let n=h.Buffer.from(e.data||"","base64");return r.dataPayload=new ql(n),r.data=n.toString(),r}findFirstOrNoneTopic(e){return this.topics.filter(r=>e(r))[0]}getLastTopic(){return this.topics[this.topics.length-1]}};cs.TransactionEvent=mI;var ql=class{constructor(e){this.raw=e}toString(){return this.raw.toString("utf8")}hex(){return this.raw.toString("hex")}valueOf(){return this.raw}};cs.TransactionEventData=ql;var yy=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}};cs.TransactionEventTopic=yy});var EI=m(my=>{"use strict";c();Object.defineProperty(my,"__esModule",{value:!0});my.TransactionLogs=void 0;var $re=pM(),mM=mu(),zre=yM(),wI=class t{constructor(e){this.address=new mM.Address(""),this.events=[],Object.assign(this,e)}static fromHttpResponse(e){let r=new t;return r.address=new mM.Address(e.address),r.events=(e.events||[]).map(n=>zre.TransactionEvent.fromHttpResponse(n)),r}findSingleOrNoneEvent(e,r){let n=this.findEvents(e,r);if(n.length>1)throw new $re.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}};my.TransactionLogs=wI});var EM=m(Eu=>{"use strict";c();Object.defineProperty(Eu,"__esModule",{value:!0});Eu.ContractResultItem=Eu.ContractResults=void 0;var wM=EI(),wy=mu(),vI=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=>Vl.fromProxyHttpResponse(n));return new t(r)}static fromApiHttpResponse(e){let r=e.map(n=>Vl.fromApiHttpResponse(n));return new t(r)}};Eu.ContractResults=vI;var Vl=class t{constructor(e){this.hash="",this.nonce=0,this.value="",this.receiver=new wy.Address(""),this.sender=new wy.Address(""),this.data="",this.previousHash="",this.originalHash="",this.gasLimit=0,this.gasPrice=0,this.callType=0,this.returnMessage="",this.logs=new wM.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 wy.Address(e.receiver),r.sender=new wy.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=wM.TransactionLogs.fromHttpResponse(e.logs||{}),r}};Eu.ContractResultItem=Vl});var vM=m(ls=>{"use strict";c();var Kre=ls&&ls.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ls,"__esModule",{value:!0});ls.EsdtContractAddress=ls.MaxUint64AsBigNumber=void 0;var Yre=Kre(Gt()),Jre=mu();ls.MaxUint64AsBigNumber=new Yre.default("18446744073709551615");ls.EsdtContractAddress=new Jre.Address("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u")});var AM=m(vu=>{"use strict";c();var Xre=vu&&vu.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(vu,"__esModule",{value:!0});vu.ContractQueryResponse=void 0;var Zre=Xre(Gt()),ene=vM(),AI=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 Zre.default(e.gasRemaining||e.GasRemaining||0),o=ene.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()}}};vu.ContractQueryResponse=AI});var bM=m(Ey=>{"use strict";c();Object.defineProperty(Ey,"__esModule",{value:!0});Ey.ContractQueryRequest=void 0;var bI=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}};Ey.ContractQueryRequest=bI});var RM=m((zwe,PM)=>{c();PM.exports=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}});var fs=m(go=>{c();var _I,tne=[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];go.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};go.getSymbolTotalCodewords=function(e){return tne[e]};go.getBCHDigit=function(t){let e=0;for(;t!==0;)e++,t>>>=1;return e};go.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');_I=e};go.isKanjiModeEnabled=function(){return typeof _I<"u"};go.toSJIS=function(e){return _I(e)}});var by=m(kr=>{c();kr.L={bit:1};kr.M={bit:0};kr.Q={bit:3};kr.H={bit:2};function rne(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return kr.L;case"m":case"medium":return kr.M;case"q":case"quartile":return kr.Q;case"h":case"high":return kr.H;default:throw new Error("Unknown EC Level: "+t)}}kr.isValid=function(e){return e&&typeof e.bit<"u"&&e.bit>=0&&e.bit<4};kr.from=function(e,r){if(kr.isValid(e))return e;try{return rne(e)}catch{return r}}});var FM=m((eEe,LM)=>{c();function BM(){this.buffer=[],this.length=0}BM.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++}};LM.exports=BM});var UM=m((rEe,MM)=>{c();function Hl(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)}Hl.prototype.set=function(t,e,r,n){let i=t*this.size+e;this.data[i]=r,n&&(this.reservedBit[i]=!0)};Hl.prototype.get=function(t,e){return this.data[t*this.size+e]};Hl.prototype.xor=function(t,e,r){this.data[t*this.size+e]^=r};Hl.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};MM.exports=Hl});var qM=m(_y=>{c();var nne=fs().getSymbolSize;_y.getRowColCoords=function(e){if(e===1)return[];let r=Math.floor(e/7)+2,n=nne(e),i=n===145?26:Math.ceil((n-13)/(2*r-2))*2,s=[n-7];for(let o=1;o{c();var ine=fs().getSymbolSize,VM=7;HM.getPositions=function(e){let r=ine(e);return[[0,0],[r-VM,0],[0,r-VM]]}});var kM=m(et=>{c();et.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var yo={N1:3,N2:3,N3:40,N4:10};et.isValid=function(e){return e!=null&&e!==""&&!isNaN(e)&&e>=0&&e<=7};et.from=function(e){return et.isValid(e)?parseInt(e,10):void 0};et.getPenaltyN1=function(e){let r=e.size,n=0,i=0,s=0,o=null,a=null;for(let u=0;u=5&&(n+=yo.N1+(i-5)),o=f,i=1),f=e.get(l,u),f===a?s++:(s>=5&&(n+=yo.N1+(s-5)),a=f,s=1)}i>=5&&(n+=yo.N1+(i-5)),s>=5&&(n+=yo.N1+(s-5))}return n};et.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*yo.N3};et.getPenaltyN4=function(e){let r=0,n=e.data.length;for(let s=0;s{c();var hs=by(),Iy=[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],Sy=[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 hs.L:return Iy[(e-1)*4+0];case hs.M:return Iy[(e-1)*4+1];case hs.Q:return Iy[(e-1)*4+2];case hs.H:return Iy[(e-1)*4+3];default:return}};II.getTotalCodewordsCount=function(e,r){switch(r){case hs.L:return Sy[(e-1)*4+0];case hs.M:return Sy[(e-1)*4+1];case hs.Q:return Sy[(e-1)*4+2];case hs.H:return Sy[(e-1)*4+3];default:return}}});var jM=m(Cy=>{c();var Gl=new Uint8Array(512),Ty=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)Gl[r]=e,Ty[e]=r,e<<=1,e&256&&(e^=285);for(let r=255;r<512;r++)Gl[r]=Gl[r-255]})();Cy.log=function(e){if(e<1)throw new Error("log("+e+")");return Ty[e]};Cy.exp=function(e){return Gl[e]};Cy.mul=function(e,r){return e===0||r===0?0:Gl[Ty[e]+Ty[r]]}});var QM=m(kl=>{c();var TI=jM();kl.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 WM=QM();function CI(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}CI.prototype.initialize=function(e){this.degree=e,this.genPoly=WM.generateECPolynomial(this.degree)};CI.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=WM.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};$M.exports=CI});var xI=m(KM=>{c();KM.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}});var NI=m(fi=>{c();var YM="[0-9]+",one="[A-Z $%*+\\-./:]+",jl="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";jl=jl.replace(/u/g,"\\u");var ane="(?:(?![A-Z0-9 $%*+\\-./:]|"+jl+`)(?:.|[\r +]))+`;fi.KANJI=new RegExp(jl,"g");fi.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");fi.BYTE=new RegExp(ane,"g");fi.NUMERIC=new RegExp(YM,"g");fi.ALPHANUMERIC=new RegExp(one,"g");var une=new RegExp("^"+jl+"$"),cne=new RegExp("^"+YM+"$"),lne=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");fi.testKanji=function(e){return une.test(e)};fi.testNumeric=function(e){return cne.test(e)};fi.testAlphanumeric=function(e){return lne.test(e)}});var ds=m(Nt=>{c();var fne=xI(),OI=NI();Nt.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]};Nt.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]};Nt.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]};Nt.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]};Nt.MIXED={bit:-1};Nt.getCharCountIndicator=function(e,r){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!fne.isValid(r))throw new Error("Invalid version: "+r);return r>=1&&r<10?e.ccBits[0]:r<27?e.ccBits[1]:e.ccBits[2]};Nt.getBestModeForData=function(e){return OI.testNumeric(e)?Nt.NUMERIC:OI.testAlphanumeric(e)?Nt.ALPHANUMERIC:OI.testKanji(e)?Nt.KANJI:Nt.BYTE};Nt.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")};Nt.isValid=function(e){return e&&e.bit&&e.ccBits};function hne(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return Nt.NUMERIC;case"alphanumeric":return Nt.ALPHANUMERIC;case"kanji":return Nt.KANJI;case"byte":return Nt.BYTE;default:throw new Error("Unknown mode: "+t)}}Nt.from=function(e,r){if(Nt.isValid(e))return e;try{return hne(e)}catch{return r}}});var tU=m(mo=>{c();var xy=fs(),dne=SI(),JM=by(),ps=ds(),DI=xI(),ZM=7973,XM=xy.getBCHDigit(ZM);function pne(t,e,r){for(let n=1;n<=40;n++)if(e<=mo.getCapacity(n,r,t))return n}function eU(t,e){return ps.getCharCountIndicator(t,e)+4}function gne(t,e){let r=0;return t.forEach(function(n){let i=eU(n.mode,e);r+=i+n.getBitsLength()}),r}function yne(t,e){for(let r=1;r<=40;r++)if(gne(t,r)<=mo.getCapacity(r,e,ps.MIXED))return r}mo.from=function(e,r){return DI.isValid(e)?parseInt(e,10):r};mo.getCapacity=function(e,r,n){if(!DI.isValid(e))throw new Error("Invalid QR Code version");typeof n>"u"&&(n=ps.BYTE);let i=xy.getSymbolTotalCodewords(e),s=dne.getTotalCodewordsCount(e,r),o=(i-s)*8;if(n===ps.MIXED)return o;let a=o-eU(n,e);switch(n){case ps.NUMERIC:return Math.floor(a/10*3);case ps.ALPHANUMERIC:return Math.floor(a/11*2);case ps.KANJI:return Math.floor(a/13);case ps.BYTE:default:return Math.floor(a/8)}};mo.getBestVersionForData=function(e,r){let n,i=JM.from(r,JM.M);if(Array.isArray(e)){if(e.length>1)return yne(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return pne(n.mode,n.getLength(),i)};mo.getEncodedBits=function(e){if(!DI.isValid(e)||e<7)throw new Error("Invalid QR Code version");let r=e<<12;for(;xy.getBCHDigit(r)-XM>=0;)r^=ZM<{c();var PI=fs(),nU=1335,mne=21522,rU=PI.getBCHDigit(nU);iU.getEncodedBits=function(e,r){let n=e.bit<<3|r,i=n<<10;for(;PI.getBCHDigit(i)-rU>=0;)i^=nU<{c();var wne=ds();function Au(t){this.mode=wne.NUMERIC,this.data=t.toString()}Au.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)};Au.prototype.getLength=function(){return this.data.length};Au.prototype.getBitsLength=function(){return Au.getBitsLength(this.data.length)};Au.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))};oU.exports=Au});var cU=m((OEe,uU)=>{c();var Ene=ds(),RI=["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 bu(t){this.mode=Ene.ALPHANUMERIC,this.data=t}bu.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)};bu.prototype.getLength=function(){return this.data.length};bu.prototype.getBitsLength=function(){return bu.getBitsLength(this.data.length)};bu.prototype.write=function(e){let r;for(r=0;r+2<=this.data.length;r+=2){let n=RI.indexOf(this.data[r])*45;n+=RI.indexOf(this.data[r+1]),e.put(n,11)}this.data.length%2&&e.put(RI.indexOf(this.data[r]),6)};uU.exports=bu});var fU=m((PEe,lU)=>{"use strict";c();lU.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 dU=m((BEe,hU)=>{c();var vne=fU(),Ane=ds();function _u(t){this.mode=Ane.BYTE,typeof t=="string"&&(t=vne(t)),this.data=new Uint8Array(t)}_u.getBitsLength=function(e){return e*8};_u.prototype.getLength=function(){return this.data.length};_u.prototype.getBitsLength=function(){return _u.getBitsLength(this.data.length)};_u.prototype.write=function(t){for(let e=0,r=this.data.length;e{c();var bne=ds(),_ne=fs();function Iu(t){this.mode=bne.KANJI,this.data=t}Iu.getBitsLength=function(e){return e*13};Iu.prototype.getLength=function(){return this.data.length};Iu.prototype.getBitsLength=function(){return Iu.getBitsLength(this.data.length)};Iu.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)}};pU.exports=Iu});var yU=m((UEe,BI)=>{"use strict";c();var Ql={single_source_shortest_paths:function(t,e,r){var n={},i={};i[e]=0;var s=Ql.PriorityQueue.make();s.push(e,0);for(var o,a,u,l,f,d,g,w,E;!s.empty();){o=s.pop(),a=o.value,l=o.cost,f=t[a]||{};for(u in f)f.hasOwnProperty(u)&&(d=f[u],g=l+d,w=i[u],E=typeof i[u]>"u",(E||w>g)&&(i[u]=g,s.push(u,g),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=Ql.single_source_shortest_paths(t,e,r);return Ql.extract_shortest_path_from_predecessor_list(n,r)},PriorityQueue:{make:function(t){var e=Ql.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 BI<"u"&&(BI.exports=Ql)});var IU=m(Su=>{c();var He=ds(),EU=aU(),vU=cU(),AU=dU(),bU=gU(),Wl=NI(),Ny=fs(),Ine=yU();function mU(t){return unescape(encodeURIComponent(t)).length}function $l(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 _U(t){let e=$l(Wl.NUMERIC,He.NUMERIC,t),r=$l(Wl.ALPHANUMERIC,He.ALPHANUMERIC,t),n,i;return Ny.isKanjiModeEnabled()?(n=$l(Wl.BYTE,He.BYTE,t),i=$l(Wl.KANJI,He.KANJI,t)):(n=$l(Wl.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 LI(t,e){switch(e){case He.NUMERIC:return EU.getBitsLength(t);case He.ALPHANUMERIC:return vU.getBitsLength(t);case He.KANJI:return bU.getBitsLength(t);case He.BYTE:return AU.getBitsLength(t)}}function Sne(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 Tne(t){let e=[];for(let r=0;r{c();var Dy=fs(),FI=by(),xne=FM(),Nne=UM(),One=qM(),Dne=GM(),qI=kM(),VI=SI(),Pne=zM(),Oy=tU(),Rne=sU(),Bne=ds(),MI=IU();function Lne(t,e){let r=t.size,n=Dne.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 Fne(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 UI(t,e,r){let n=t.size,i=Rne.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 qne(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 Vne(t,e,r){let n=new xne;r.forEach(function(u){n.put(u.mode.bit,4),n.put(u.getLength(),Bne.getCharCountIndicator(u.mode,t)),u.write(n)});let i=Dy.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&&Qre(u,e),Wre(u,o),isNaN(n)&&(n=bI.getBestMask(u,AI.bind(null,u,r))),bI.applyMask(n,u),AI(u,r,n),{modules:u,version:e,errorCorrectionLevel:r,maskPattern:n,segments:i}}zM.create=function(e,r){if(typeof e>"u"||e==="")throw new Error("No input text");let n=EI.M,i,s;return typeof r<"u"&&(n=EI.from(r.errorCorrectionLevel,EI.M),i=vy.from(r.version),s=bI.from(r.maskPattern),r.toSJISFunc&&Ay.setToSJISFunction(r.toSJISFunc)),Kre(e,i,n,s)}});var II=m(lo=>{c();function KM(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("")}}lo.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:KM(e.color.dark||"#000000ff"),light:KM(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}};lo.getScale=function(e,r){return r.width&&r.width>=e+r.margin*2?r.width/(e+r.margin*2):r.scale};lo.getImageWidth=function(e,r){let n=lo.getScale(e,r);return Math.floor((e+r.margin*2)*n)};lo.qrToImageData=function(e,r,n){let i=r.modules.size,s=r.modules.data,o=lo.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 SI=II();function Yre(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 Jre(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}by.render=function(e,r,n){let i=n,s=r;typeof i>"u"&&(!r||!r.getContext)&&(i=r,r=void 0),r||(s=Jre()),i=SI.getOptions(i);let o=SI.getImageWidth(e.modules.size,i),a=s.getContext("2d"),u=a.createImageData(o,o);return SI.qrToImageData(u.data,e,i),Yre(a,s,o),a.putImageData(u,0,0),s};by.renderToDataURL=function(e,r,n){let i=n;typeof i>"u"&&(!r||!r.getContext)&&(i=r,r=void 0),i||(i={});let s=by.render(e,r,i),o=i.type||"image/png",a=i.rendererOpts||{};return s.toDataURL(o,a.quality)}});var ZM=m(XM=>{c();var Xre=II();function JM(t,e){let r=t.a/255,n=e+'="'+t.hex+'"';return r<1?n+" "+e+'-opacity="'+r.toFixed(2).slice(1)+'"':n}function TI(t,e,r){let n=t+e;return typeof r<"u"&&(n+=" "+r),n}function Zre(t,e,r){let n="",i=0,s=!1,o=0;for(let a=0;a0&&u>0&&t[a-1]||(n+=s?TI("M",u+r,.5+l+r):TI("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 tU=m(Hl=>{c();var ene=tM(),CI=$M(),eU=YM(),tne=ZM();function xI(t,e,r,n,i){let s=[].slice.call(arguments,1),o=s.length,a=typeof s[o-1]=="function";if(!a&&!ene())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=CI.create(r,n);u(t(f,e,n))}catch(f){l(f)}})}try{let u=CI.create(r,n);i(null,t(u,e,n))}catch(u){i(u)}}Hl.create=CI.create;Hl.toCanvas=xI.bind(null,eU.render);Hl.toDataURL=xI.bind(null,eU.renderToDataURL);Hl.toString=xI.bind(null,function(t,e,r){return tne.render(t,r)})});var OI=m(fs=>{"use strict";c();var dne=fs&&fs.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),dU=fs&&fs.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&dne(e,t,r)};Object.defineProperty(fs,"__esModule",{value:!0});dU(xl(),fs);dU(w_(),fs)});c();var gne=_e(um(),1),yne=_e(jw(),1),mne=_e(Qw(),1),wne=_e(ht(),1),Ene=_e(Yo(),1),vne=_e(mn(),1),Ane=_e(qn(),1),bne=_e(Wh(),1),_ne=_e(ev(),1),Ine=_e(gc(),1),TU=_e(di(),1),Rn=_e(Xu(),1),CU=_e(Bu(),1),xU=_e(Io(),1);c();c();var bO=_e(nv(),1);c();c();var wd="elvenjs_state",EO="https://devnet-api.multiversx.com";var Di="/dapp/init",Ed="devnet",vO="https://maiar.page.link/?apn=com.elrond.maiar.wallet&isi=1519405832&ibi=com.elrond.maiar.wallet&link=https://xportal.com/",AO=["wss://relay.walletconnect.com"],Fr={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(wd);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(wd,JSON.stringify(r))},clear(){localStorage.removeItem(wd)}};var vd=async()=>{let t=bO.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 bU=_e(nv(),1),_U=_e(bl(),1),IU=_e(xl(),1),SU=_e(W_(),1);c();var xF=_e(bl(),1);c();c();var Te=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 rs=(i=>(i.ledger="ledger",i.mobile="mobile",i.webWallet="web-wallet",i.browserExtension="browser-extension",i))(rs||{});var hu=async t=>{if(!t.dappProvider)throw new Error("Error: Logout failed: There is no active session!");Te.run("onLoginPending");let e=await t.dappProvider.logout();return e&&(Se.clear(),Te.run("onLogout")),e};c();var TF=_e(ht(),1),CF=_e(Yo(),1);c();var qt=t=>typeof t=="string"?t.toUpperCase():t instanceof Error?t.message:`Error: ${JSON.stringify(t)}`;c();var du=()=>new Date().setHours(new Date().getHours()+24),ry=t=>Date.now()>t;var ns=async t=>{let e=Se.get("address"),r=Se.get("expires");if(!(r&&ry(r))&&e&&t.networkProvider){let i=new TF.Address(e),s=new CF.Account(i);try{let o=await t.networkProvider.getAccount(i),a=await t.networkProvider.getGuardianData(i);Se.set("address",e),Se.set("activeGuardian",a.guarded&&a.activeGuardian?.address?a.activeGuardian.address:""),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 ny(t){return t[Math.floor(Math.random()*t.length)]}var NF=async t=>{if(!t.initOptions.walletConnectV2ProjectId||!t.initOptions.chainType)return;let e={onClientLogin:()=>{ns(t),Te.run("onLoggedIn")},onClientLogout:()=>hu(t),onClientEvent:i=>{console.log("wc2 session event: ",i)}},r=ny(t.initOptions.walletConnectV2RelayAddresses),n=new xF.WalletConnectV2Provider(e,Fr[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 QF=_e(Gt(),1),ly=_e(ht(),1),WF=_e(OF(),1),zF=_e(LF(),1),$F=_e(rI(),1),KF=_e(HF(),1),YF=_e(jF(),1),JF=_e(kF(),1),XF=_e(yc(),1);var fy=class{constructor({apiUrl:e,chainType:r,apiTimeout:n}){this.chainType=r||Ed,this.apiUrl=e||Fr[this.chainType]?.apiAddress,this.apiTimeout=n||Fr[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 ly.Address(r?.address||""),nonce:Number(r?.nonce||0),balance:new QF.default(r?.balance||0),code:r?.code||"",userName:r?.username||""}}async getGuardianData(e){let r=await this.apiGet(`address/${e.bech32()}/guardian-data`);return{guarded:r?.data?.guardianData?.guarded||!1,activeGuardian:r?.data?.guardianData?.activeGuardian,pendingGuardian:r?.data?.guardianData?.pendingGuardian}}async getTransaction(e){let r=await this.apiGet(`transactions/${e}`),n=new WF.TransactionStatus(r.status);return{hash:e,type:r.type||"",nonce:r.nonce||0,round:r.round,epoch:r.epoch||0,value:(r.value||0).toString(),sender:new ly.Address(r.sender),receiver:new ly.Address(r.receiver),gasPrice:r.gasPrice||0,gasLimit:r.gasLimit||0,data:h.Buffer.from(r.data||"","base64"),status:n,timestamp:r.timestamp||0,blockNonce:r.blockNonce||0,hyperblockNonce:r.hyperblockNonce||0,hyperblockHash:r.hyperblockHash||"",receipt:zF.TransactionReceipt.fromHttpResponse(r.receipt||{}),logs:$F.TransactionLogs.fromHttpResponse(r.logs||{}),contractResults:KF.ContractResults.fromApiHttpResponse(r.results||[]),isCompleted:!n.isPending()}}async queryContract({address:e,func:r,args:n,value:i,caller:s}){try{let o=new XF.Query({address:e,func:r,args:n,value:i,caller:s}),a=new JF.ContractQueryRequest(o).toHttpRequest(),u=await this.apiPost("query",a);return YF.ContractQueryResponse.fromHttpResponse(u)}catch(o){this.handleApiError(o,"query")}}};c();var ZF=async(t,e,r,n="/")=>{let i=await vd(),o={callbackUrl:encodeURIComponent(`${window.location.origin}${n}`),token:e};try{i&&(await i.login(o)?Te.run("onLoginPending"):Te.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",du()),await ns(t),Te.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}`),Te.run("onLogout")}};c();c();var rU=_e(tU(),1),nU=_e(bl(),1);var nne=t=>{let e=document.createElement("template");return e.innerHTML=t.trim(),e.content.firstChild?.cloneNode(!0)},ine=t=>{let e=`${vO}?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},sne=()=>{let t=document.createElement("div");return t.classList.add("elven-wc-pairings"),t},one=()=>{let t=document.createElement("div");return t.textContent="Existing WalletConnect pairings:",t.classList.add("elven-wc-pairings-header"),t},NI={},ane=(t,e)=>{let r=document.createElement("button");return r.classList.add("elven-wc-pairings-remove-btn"),r.textContent="\u2716",NI[t.topic]=new AbortController,r.addEventListener("click",n=>{n.stopImmediatePropagation(),e(t.topic)},{signal:NI[t.topic].signal}),r},_y={},une=(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=ane(t,e);return n.appendChild(s),_y[t.topic]=new AbortController,n.addEventListener("click",()=>r(t.topic),{signal:_y[t.topic].signal}),n},cne=()=>{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},lne=t=>{if(!t)return;document.getElementById(t)?.remove()},fne=()=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),hne=async t=>t?await rU.default.toString(t,{type:"svg"}):void 0,iU=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 hne(e),o;if(s&&(o=nne(s)),i&&o&&(i.replaceChildren(),i.appendChild(o),fne()&&i.appendChild(ine(e))),i&&r instanceof nU.WalletConnectV2Provider){let a=r.pairings,u=async f=>{try{f&&(await r.logout({topic:f}),lne(f))}catch(d){let g=qt(d);console.warn(`Something went wrong trying to remove the existing pairing: ${g}`)}finally{_y[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(cne()),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(_y))d?.abort();for(let d of Object.values(NI))d?.abort()}};if(a&&a.length>0){let f=sne();i.appendChild(f);let d=one();f.appendChild(d);for(let g of a){let w=une(g,u,l);f.appendChild(w)}}}return i};var Iy=_e(bl(),1);var sU=async(t,e,r,n)=>{if(!n)throw new Error("You haven't provided the QR code container DOM element id");let i=ny(t.initOptions.walletConnectV2RelayAddresses);if(!i||!t.networkProvider)throw new Error("Something wen't wrong with the initialization (ApiNetworkProvider or Wallet Connect Bridge address), plese try to refresh the page!");if(!t.initOptions.walletConnectV2ProjectId)throw new Error("Please provide your WalletConnect project id. You can get it here: https://cloud.walletconnect.com)");if(!t.initOptions.chainType)throw new Error("Please provide the chain type in ElvenJS.init function!");let s,o={onClientLogin:async()=>{if(t.dappProvider instanceof Iy.WalletConnectV2Provider){Te.run("onLoginPending");let u=await t.dappProvider.getAddress(),l=await t.dappProvider.getSignature();Se.set("address",u),Se.set("loginMethod","mobile"),Se.set("expires",du()),await ns(t),l&&Se.set("signature",l),Se.set("loginToken",e);let f=r.getToken(u,e,l);Se.set("accessToken",f),Te.run("onLoggedIn"),s?.replaceChildren()}},onClientLogout:async()=>{t.dappProvider instanceof Iy.WalletConnectV2Provider&&(await hu(t),Te.run("onLogout"))},onClientEvent:u=>{console.log("wc2 session event: ",u)}},a=new Iy.WalletConnectV2Provider(o,Fr[t.initOptions.chainType].shortId,i,t.initOptions.walletConnectV2ProjectId);try{if(a){t.dappProvider=a,Te.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 iU(n,f,a,e),Te.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}`),Te.run("onLogout")}};c();var oU=_e(xl(),1);var aU=async(t,e,r)=>{let n=new oU.WalletProvider(`${t}${Di}`),s={callbackUrl:typeof window<"u"?encodeURIComponent(`${window.location.origin}${r||"/"}`):"/",token:e};try{return Te.run("onLoginPending"),Se.set("loginMethod","web-wallet"),await n.login(s),Se.set("expires",du()),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",""),Te.run("onLogout")}};c();var ls=t=>{if(typeof window<"u"){let e=new URL(window.location.href);return new URLSearchParams(e.search).get(t)}};c();var uU=_e(xl(),1);var cU=_e(W_(),1),lU=async(t,e)=>{let r=ls("signature"),n=ls("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 uU.WalletProvider(`${t}${Di}`);if(r&&e&&n){let u=new cU.NativeAuthClient({apiUrl:e,origin:window.location.origin}).getToken(n,s,r);Se.set("accessToken",u)}return o}};c();var fU=_e(Yo(),1),hU=_e(Wh(),1);var Sy=async(t,e)=>{Te.run("onTxSent",t),await new hU.TransactionWatcher(e).awaitCompleted(t);let n=t.getSender(),i=new fU.Account(n),s=await e.getAccount(n);i.update(s),Se.set("address",i.address.bech32()),Se.set("balance",i.balance.toString()),Te.run("onTxFinalized",t)};c();var _u=_e(OI(),1),gU=_e(mn(),1);c();var pU=_e(Yo(),1);var Ty=t=>{let e=t.getSender(),r=new pU.Account(e),n=t.getNonce().valueOf();r.incrementNonce(),Se.set("nonce",n+1)};var yU=async(t,e,r,n)=>{if(ls(_u.WALLET_PROVIDER_CALLBACK_PARAM)===_u.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED&&t&&e){let s=Se.get("activeGuardian"),o=Se.get("loginMethod"),a=ls("hasWebWalletGuardianSign"),u;if("getTransactionsFromWalletUrl"in t){if(u=t.getTransactionsFromWalletUrl()?.[0],!u)return;u.data=h.Buffer.from(u.data).toString("base64")}else s&&o!=="web-wallet"&&a&&(u=new _u.WalletProvider(`${r}${Di}`).getTransactionsFromWalletUrl()?.[0]);if(u){let l=gU.Transaction.fromPlainObject(u);l.setNonce(n),Ty(l);try{Te.run("onTxStarted",l),await e.sendTransaction(l),await Sy(l,e)}catch(f){let d=qt(f);throw Te.run("onTxError",l,d),new Error(`Error: Transaction signing failed! ${d}`)}finally{window.history.replaceState(null,"",window.location.pathname)}}window.history.replaceState(null,"",window.location.pathname)}};c();var Cy=_e(oc(),1),mU=_e(ht(),1),wU=_e(OI(),1);var EU=t=>{let e=Se.get("activeGuardian");if(e){let r={guarded:!0};t.setVersion(Cy.TransactionVersion.withTxOptions()),t.setOptions(Cy.TransactionOptions.withOptions(r)),t.setGuardian(mU.Address.fromBech32(e))}return t},vU=async(t,e)=>{let r=new wU.WalletProvider(`${e}${Di}`),n=window?.location.href,i=new URL(n);i.searchParams.set("hasWebWalletGuardianSign","true"),await r.guardTransactions([t],{callbackUrl:encodeURIComponent(i.toString())})},AU=t=>{let e=Se.get("activeGuardian");return!(!Se.get("address")||!e||t.isGuardedTransaction())};var DI=class{static async init(e){let r=Se.get();if(r.expires&&ry(r.expires)){Se.clear(),this.dappProvider=void 0;return}this.initOptions={chainType:Ed,apiUrl:EO,apiTimeout:1e4,walletConnectV2ProjectId:"",walletConnectV2RelayAddresses:AO,...e},this.networkProvider=new fy(this.initOptions),this.initOptions.onLoginPending&&Te.set("onLoginPending",this.initOptions.onLoginPending),this.initOptions.onLoggedIn&&Te.set("onLoggedIn",this.initOptions.onLoggedIn),this.initOptions.onQrPending&&Te.set("onQrPending",this.initOptions.onQrPending),this.initOptions.onQrLoaded&&Te.set("onQrLoaded",this.initOptions.onQrLoaded),this.initOptions.onLogout&&Te.set("onLogout",this.initOptions.onLogout),this.initOptions.onTxStarted&&Te.set("onTxStarted",this.initOptions.onTxStarted),this.initOptions.onTxSent&&Te.set("onTxSent",this.initOptions.onTxSent),this.initOptions.onTxFinalized&&Te.set("onTxFinalized",this.initOptions.onTxFinalized),this.initOptions.onTxError&&Te.set("onTxError",this.initOptions.onTxError),(r?.address||r.loginMethod==="web-wallet"&&ls("address"))&&r?.loginMethod&&(Te.run("onLoginPending"),r.loginMethod==="browser-extension"&&(this.dappProvider=await vd()),r.loginMethod==="mobile"&&(this.dappProvider=await NF(this)),r.loginMethod==="web-wallet"&&this.initOptions.chainType&&(this.dappProvider=await lU(Fr[this.initOptions.chainType].walletAddress,this.initOptions.apiUrl)),await ns(this),Te.run("onLoggedIn"),this.initOptions?.chainType&&await yU(this.dappProvider,this.networkProvider,Fr[this.initOptions.chainType].walletAddress,r.nonce))}static async login(e,r){if(!Object.values(rs).includes(e))throw new Error("Error: Wrong login method!");if(!this.networkProvider)throw new Error("Error: Login failed: Use ElvenJs.init() first!");try{Te.run("onLoginPending");let i=new SU.NativeAuthClient({apiUrl:this.initOptions?.apiUrl,origin:window.location.origin}),s=await i.initialize();if(e==="browser-extension"){let o=await ZF(this,s,i,r?.callbackRoute);this.dappProvider=o}if(e==="mobile"){let o=await sU(this,s,i,r?.qrCodeContainer);this.dappProvider=o}if(e==="web-wallet"&&this.initOptions?.chainType){let o=await aU(Fr[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 hu(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!");let r=EU(e);try{Te.run("onTxStarted",e);let n=Se.get();if(e.setNonce(n.nonce),this.dappProvider instanceof bU.ExtensionProvider&&(r=await this.dappProvider.signTransaction(e)),this.dappProvider instanceof _U.WalletConnectV2Provider&&(r=await this.dappProvider.signTransaction(e)),this.dappProvider instanceof IU.WalletProvider&&await this.dappProvider.signTransaction(e),n.loginMethod!=="web-wallet"){let i=AU(r);if(i||Ty(r),i&&this.initOptions?.chainType){await vU(r,Fr[this.initOptions.chainType].walletAddress);return}await this.networkProvider.sendTransaction(r),await Sy(r,this.networkProvider)}}catch(n){let i=qt(n);throw Te.run("onTxError",r,i),new Error(`Error: Transaction signing failed! ${i}`)}return r}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,Te.clear()}}};var export_Account=Ene.Account;var export_Address=wne.Address;var export_AddressType=xU.AddressType;var export_AddressValue=xU.AddressValue;var export_BigUIntType=Rn.BigUIntType;var export_BigUIntValue=Rn.BigUIntValue;var export_BooleanType=CU.BooleanType;var export_BooleanValue=CU.BooleanValue;var export_BytesType=TU.BytesType;var export_BytesValue=TU.BytesValue;var export_ContractFunction=Ine.ContractFunction;var export_GasEstimator=mne.GasEstimator;var export_SmartContract=_ne.SmartContract;var export_TokenTransfer=gne.TokenTransfer;var export_Transaction=vne.Transaction;var export_TransactionPayload=Ane.TransactionPayload;var export_TransactionWatcher=bne.TransactionWatcher;var export_TransferTransactionsFactory=yne.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,DI as ElvenJS,export_GasEstimator as GasEstimator,rs 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=Vne(e,r,i),a=Dy.getSymbolSize(e),u=new Nne(a);return Lne(u,e),Fne(u),Mne(u,e),UI(u,r,0),e>=7&&Une(u,e),qne(u,o),isNaN(n)&&(n=qI.getBestMask(u,UI.bind(null,u,r))),qI.applyMask(n,u),UI(u,r,n),{modules:u,version:e,errorCorrectionLevel:r,maskPattern:n,segments:i}}SU.create=function(e,r){if(typeof e>"u"||e==="")throw new Error("No input text");let n=FI.M,i,s;return typeof r<"u"&&(n=FI.from(r.errorCorrectionLevel,FI.M),i=Oy.from(r.version),s=qI.from(r.maskPattern),r.toSJISFunc&&Dy.setToSJISFunction(r.toSJISFunc)),Gne(e,i,n,s)}});var HI=m(wo=>{c();function CU(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("")}}wo.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:CU(e.color.dark||"#000000ff"),light:CU(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}};wo.getScale=function(e,r){return r.width&&r.width>=e+r.margin*2?r.width/(e+r.margin*2):r.scale};wo.getImageWidth=function(e,r){let n=wo.getScale(e,r);return Math.floor((e+r.margin*2)*n)};wo.qrToImageData=function(e,r,n){let i=r.modules.size,s=r.modules.data,o=wo.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 GI=HI();function kne(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 jne(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}Py.render=function(e,r,n){let i=n,s=r;typeof i>"u"&&(!r||!r.getContext)&&(i=r,r=void 0),r||(s=jne()),i=GI.getOptions(i);let o=GI.getImageWidth(e.modules.size,i),a=s.getContext("2d"),u=a.createImageData(o,o);return GI.qrToImageData(u.data,e,i),kne(a,s,o),a.putImageData(u,0,0),s};Py.renderToDataURL=function(e,r,n){let i=n;typeof i>"u"&&(!r||!r.getContext)&&(i=r,r=void 0),i||(i={});let s=Py.render(e,r,i),o=i.type||"image/png",a=i.rendererOpts||{};return s.toDataURL(o,a.quality)}});var DU=m(OU=>{c();var Qne=HI();function NU(t,e){let r=t.a/255,n=e+'="'+t.hex+'"';return r<1?n+" "+e+'-opacity="'+r.toFixed(2).slice(1)+'"':n}function kI(t,e,r){let n=t+e;return typeof r<"u"&&(n+=" "+r),n}function Wne(t,e,r){let n="",i=0,s=!1,o=0;for(let a=0;a0&&u>0&&t[a-1]||(n+=s?kI("M",u+r,.5+l+r):kI("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 RU=m(zl=>{c();var $ne=RM(),jI=TU(),PU=xU(),zne=DU();function QI(t,e,r,n,i){let s=[].slice.call(arguments,1),o=s.length,a=typeof s[o-1]=="function";if(!a&&!$ne())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=jI.create(r,n);u(t(f,e,n))}catch(f){l(f)}})}try{let u=jI.create(r,n);i(null,t(u,e,n))}catch(u){i(u)}}zl.create=jI.create;zl.toCanvas=QI.bind(null,PU.render);zl.toDataURL=QI.bind(null,PU.renderToDataURL);zl.toString=QI.bind(null,function(t,e,r){return zne.render(t,r)})});var KI=m(ys=>{"use strict";c();var oie=ys&&ys.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),kU=ys&&ys.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&oie(e,t,r)};Object.defineProperty(ys,"__esModule",{value:!0});kU(Ll(),ys);kU(L_(),ys)});c();var uie=_e(Em(),1),cie=_e(Zw(),1),lie=_e(tE(),1),fie=_e(ht(),1),hie=_e(ra(),1),die=_e(wn(),1),pie=_e(jn(),1),gie=_e(ed(),1),yie=_e(fv(),1),mie=_e(wc(),1),r5=_e(mi(),1),Mn=_e(tc(),1),n5=_e(Mu(),1),i5=_e(Do(),1);c();c();var HO=_e(pv(),1);c();c();var Td="elvenjs_state",UO="https://devnet-api.multiversx.com";var Fi="/dapp/init",Cd="devnet",qO="https://maiar.page.link/?apn=com.elrond.maiar.wallet&isi=1519405832&ibi=com.elrond.maiar.wallet&link=https://xportal.com/",VO=["wss://relay.walletconnect.com"],Yt={devnet:{id:"devnet",shortId:"D",name:"Devnet",egldLabel:"xEGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://devnet-wallet.multiversx.com",xAliasAddress:"https://devnet.xalias.com",apiAddress:"https://devnet-api.multiversx.com",explorerAddress:"https://devnet-explorer.multiversx.com",apiTimeout:1e4},testnet:{id:"testnet",shortId:"T",name:"Testnet",egldLabel:"xEGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://testnet-wallet.multiversx.com",xAliasAddress:"https://testnet.xalias.com",apiAddress:"https://testnet-api.multiversx.com",explorerAddress:"https://testnet-explorer.multiversx.com",apiTimeout:1e4},mainnet:{id:"mainnet",shortId:"1",name:"Mainnet",egldLabel:"EGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://wallet.multiversx.com",xAliasAddress:"https://xalias.com",apiAddress:"https://api.multiversx.com",explorerAddress:"https://explorer.multiversx.com",apiTimeout:1e4}};var Se={get(t){let e=localStorage.getItem(Td);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(Td,JSON.stringify(r))},clear(){localStorage.removeItem(Td)}};var xd=async()=>{let t=HO.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 XU=_e(pv(),1),ZU=_e(Cl(),1),e5=_e(Ll(),1),t5=_e(cI(),1);c();var oM=_e(Cl(),1);c();c();var Te=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 as=(s=>(s.ledger="ledger",s.mobile="mobile",s.webWallet="web-wallet",s.browserExtension="browser-extension",s.xAlias="x-alias",s))(as||{});var gu=async t=>{if(!t.dappProvider)throw new Error("Error: Logout failed: There is no active session!");Te.run("onLoginPending");let e=await t.dappProvider.logout();return e&&(Se.clear(),Te.run("onLogout")),e};c();var iM=_e(ht(),1),sM=_e(ra(),1);c();var qt=t=>typeof t=="string"?t.toUpperCase():t instanceof Error?t.message:`Error: ${JSON.stringify(t)}`;c();var yu=()=>new Date().setHours(new Date().getHours()+24),hy=t=>Date.now()>t;var us=async t=>{let e=Se.get("address"),r=Se.get("expires");if(!(r&&hy(r))&&e&&t.networkProvider){let i=new iM.Address(e),s=new sM.Account(i);try{let o=await t.networkProvider.getAccount(i),a=await t.networkProvider.getGuardianData(i);Se.set("address",e),Se.set("activeGuardian",a.guarded&&a.activeGuardian?.address?a.activeGuardian.address:""),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 dy(t){return t[Math.floor(Math.random()*t.length)]}var aM=async t=>{if(!t.initOptions.walletConnectV2ProjectId||!t.initOptions.chainType)return;let e={onClientLogin:()=>{us(t),Te.run("onLoggedIn")},onClientLogout:()=>gu(t),onClientEvent:i=>{console.log("wc2 session event: ",i)}},r=dy(t.initOptions.walletConnectV2RelayAddresses),n=new oM.WalletConnectV2Provider(e,Yt[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 _M=_e(Gt(),1),vy=_e(ht(),1),IM=_e(uM(),1),SM=_e(dM(),1),TM=_e(EI(),1),CM=_e(EM(),1),xM=_e(AM(),1),NM=_e(bM(),1),OM=_e(Ec(),1);var Ay=class{constructor({apiUrl:e,chainType:r,apiTimeout:n}){this.chainType=r||Cd,this.apiUrl=e||Yt[this.chainType]?.apiAddress,this.apiTimeout=n||Yt[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 vy.Address(r?.address||""),nonce:Number(r?.nonce||0),balance:new _M.default(r?.balance||0),code:r?.code||"",userName:r?.username||""}}async getGuardianData(e){let r=await this.apiGet(`address/${e.bech32()}/guardian-data`);return{guarded:r?.data?.guardianData?.guarded||!1,activeGuardian:r?.data?.guardianData?.activeGuardian,pendingGuardian:r?.data?.guardianData?.pendingGuardian}}async getTransaction(e){let r=await this.apiGet(`transactions/${e}`),n=new IM.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 vy.Address(r.sender),receiver:new vy.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:SM.TransactionReceipt.fromHttpResponse(r.receipt||{}),logs:TM.TransactionLogs.fromHttpResponse(r.logs||{}),contractResults:CM.ContractResults.fromApiHttpResponse(r.results||[]),isCompleted:!n.isPending()}}async queryContract({address:e,func:r,args:n,value:i,caller:s}){try{let o=new OM.Query({address:e,func:r,args:n,value:i,caller:s}),a=new NM.ContractQueryRequest(o).toHttpRequest(),u=await this.apiPost("query",a);return xM.ContractQueryResponse.fromHttpResponse(u)}catch(o){this.handleApiError(o,"query")}}};c();var DM=async(t,e,r,n="/")=>{let i=await xd(),o={callbackUrl:encodeURIComponent(`${window.location.origin}${n}`),token:e};try{i&&(await i.login(o)?Te.run("onLoginPending"):Te.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",yu()),await us(t),Te.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}`),Te.run("onLogout")}};c();c();var BU=_e(RU(),1),LU=_e(Cl(),1);var Yne=t=>{let e=document.createElement("template");return e.innerHTML=t.trim(),e.content.firstChild?.cloneNode(!0)},Jne=t=>{let e=`${qO}?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},Xne=()=>{let t=document.createElement("div");return t.classList.add("elven-wc-pairings"),t},Zne=()=>{let t=document.createElement("div");return t.textContent="Existing WalletConnect pairings:",t.classList.add("elven-wc-pairings-header"),t},WI={},eie=(t,e)=>{let r=document.createElement("button");return r.classList.add("elven-wc-pairings-remove-btn"),r.textContent="\u2716",WI[t.topic]=new AbortController,r.addEventListener("click",n=>{n.stopImmediatePropagation(),e(t.topic)},{signal:WI[t.topic].signal}),r},Ry={},tie=(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=eie(t,e);return n.appendChild(s),Ry[t.topic]=new AbortController,n.addEventListener("click",()=>r(t.topic),{signal:Ry[t.topic].signal}),n},rie=()=>{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},nie=t=>{if(!t)return;document.getElementById(t)?.remove()},iie=()=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),sie=async t=>t?await BU.default.toString(t,{type:"svg"}):void 0,FU=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 sie(e),o;if(s&&(o=Yne(s)),i&&o&&(i.replaceChildren(),i.appendChild(o),iie()&&i.appendChild(Jne(e))),i&&r instanceof LU.WalletConnectV2Provider){let a=r.pairings,u=async f=>{try{f&&(await r.logout({topic:f}),nie(f))}catch(d){let g=qt(d);console.warn(`Something went wrong trying to remove the existing pairing: ${g}`)}finally{Ry[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(rie()),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(Ry))d?.abort();for(let d of Object.values(WI))d?.abort()}};if(a&&a.length>0){let f=Xne();i.appendChild(f);let d=Zne();f.appendChild(d);for(let g of a){let w=tie(g,u,l);f.appendChild(w)}}}return i};var By=_e(Cl(),1);var MU=async(t,e,r,n)=>{if(!n)throw new Error("You haven't provided the QR code container DOM element id");let i=dy(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){Te.run("onLoginPending");let u=await t.dappProvider.getAddress(),l=await t.dappProvider.getSignature();Se.set("address",u),Se.set("loginMethod","mobile"),Se.set("expires",yu()),await us(t),l&&Se.set("signature",l),Se.set("loginToken",e);let f=r.getToken(u,e,l);Se.set("accessToken",f),Te.run("onLoggedIn"),s?.replaceChildren()}},onClientLogout:async()=>{t.dappProvider instanceof By.WalletConnectV2Provider&&(await gu(t),Te.run("onLogout"))},onClientEvent:u=>{console.log("wc2 session event: ",u)}},a=new By.WalletConnectV2Provider(o,Yt[t.initOptions.chainType].shortId,i,t.initOptions.walletConnectV2ProjectId);try{if(a){t.dappProvider=a,Te.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 FU(n,f,a,e),Te.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}`),Te.run("onLogout")}};c();var UU=_e(Ll(),1);var $I=async(t,e,r,n)=>{let i=new UU.WalletProvider(`${t}${Fi}`),o={callbackUrl:typeof window<"u"?encodeURIComponent(`${window.location.origin}${n||"/"}`):"/",token:e};try{return Te.run("onLoginPending"),Se.set("loginMethod",Yt[r].xAliasAddress===t?"x-alias":"web-wallet"),await i.login(o),Se.set("expires",yu()),Se.set("loginToken",e),i}catch(a){let u=qt(a);console.warn(`Something went wrong trying to login the user: ${u}`),Se.set("loginMethod",""),Te.run("onLogout")}};c();var gs=t=>{if(typeof window<"u"){let e=new URL(window.location.href);return new URLSearchParams(e.search).get(t)}};c();var qU=_e(Ll(),1);var VU=_e(cI(),1),zI=async(t,e)=>{let r=gs("signature"),n=gs("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 qU.WalletProvider(`${t}${Fi}`);if(r&&e&&n){let u=new VU.NativeAuthClient({apiUrl:e,origin:window.location.origin}).getToken(n,s,r);Se.set("accessToken",u)}return o}};c();var HU=_e(ra(),1),GU=_e(ed(),1);var Ly=async(t,e)=>{Te.run("onTxSent",t),await new GU.TransactionWatcher(e).awaitCompleted(t);let n=t.getSender(),i=new HU.Account(n),s=await e.getAccount(n);i.update(s),Se.set("address",i.address.bech32()),Se.set("balance",i.balance.toString()),Te.run("onTxFinalized",t)};c();var Tu=_e(KI(),1),QU=_e(wn(),1);c();var jU=_e(ra(),1);var Fy=t=>{let e=t.getSender(),r=new jU.Account(e),n=t.getNonce().valueOf();r.incrementNonce(),Se.set("nonce",n+1)};var WU=async(t,e,r,n)=>{if(gs(Tu.WALLET_PROVIDER_CALLBACK_PARAM)===Tu.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED&&t&&e){let s=Se.get("activeGuardian"),o=Se.get("loginMethod"),a=gs("hasWebWalletGuardianSign"),u;if("getTransactionsFromWalletUrl"in t){if(u=t.getTransactionsFromWalletUrl()?.[0],!u)return;o==="web-wallet"&&(u.data=h.Buffer.from(u.data).toString("base64"))}else s&&o!=="web-wallet"&&o!=="x-alias"&&a&&(u=new Tu.WalletProvider(`${r}${Fi}`).getTransactionsFromWalletUrl()?.[0]);if(u){let l=QU.Transaction.fromPlainObject(u);l.setNonce(n),Fy(l);try{Te.run("onTxStarted",l),await e.sendTransaction(l),await Ly(l,e)}catch(f){let d=qt(f);throw Te.run("onTxError",l,d),new Error(`Error: Transaction signing failed! ${d}`)}finally{window.history.replaceState(null,"",window.location.pathname)}}window.history.replaceState(null,"",window.location.pathname)}};c();var My=_e(cc(),1),$U=_e(ht(),1),zU=_e(KI(),1);var KU=t=>{let e=Se.get("activeGuardian");if(e){let r={guarded:!0};t.setVersion(My.TransactionVersion.withTxOptions()),t.setOptions(My.TransactionOptions.withOptions(r)),t.setGuardian($U.Address.fromBech32(e))}return t},YU=async(t,e)=>{let r=new zU.WalletProvider(`${e}${Fi}`),n=window?.location.href,i=new URL(n);i.searchParams.set("hasWebWalletGuardianSign","true"),await r.guardTransactions([t],{callbackUrl:encodeURIComponent(i.toString())})},JU=t=>{let e=Se.get("activeGuardian");return!(!Se.get("address")||!e||t.isGuardedTransaction())};var YI=class{static async init(e){let r=Se.get();if(r.expires&&hy(r.expires)){Se.clear(),this.dappProvider=void 0;return}this.initOptions={chainType:Cd,apiUrl:UO,apiTimeout:1e4,walletConnectV2ProjectId:"",walletConnectV2RelayAddresses:VO,...e},this.networkProvider=new Ay(this.initOptions),this.initOptions.onLoginPending&&Te.set("onLoginPending",this.initOptions.onLoginPending),this.initOptions.onLoggedIn&&Te.set("onLoggedIn",this.initOptions.onLoggedIn),this.initOptions.onQrPending&&Te.set("onQrPending",this.initOptions.onQrPending),this.initOptions.onQrLoaded&&Te.set("onQrLoaded",this.initOptions.onQrLoaded),this.initOptions.onLogout&&Te.set("onLogout",this.initOptions.onLogout),this.initOptions.onTxStarted&&Te.set("onTxStarted",this.initOptions.onTxStarted),this.initOptions.onTxSent&&Te.set("onTxSent",this.initOptions.onTxSent),this.initOptions.onTxFinalized&&Te.set("onTxFinalized",this.initOptions.onTxFinalized),this.initOptions.onTxError&&Te.set("onTxError",this.initOptions.onTxError),(r?.address||(r.loginMethod==="web-wallet"||r.loginMethod==="x-alias")&&gs("address"))&&r?.loginMethod&&(Te.run("onLoginPending"),r.loginMethod==="browser-extension"&&(this.dappProvider=await xd()),r.loginMethod==="mobile"&&(this.dappProvider=await aM(this)),r.loginMethod==="web-wallet"&&this.initOptions.chainType&&(this.dappProvider=await zI(Yt[this.initOptions.chainType].walletAddress,this.initOptions.apiUrl)),r.loginMethod==="x-alias"&&this.initOptions.chainType&&(this.dappProvider=await zI(Yt[this.initOptions.chainType].xAliasAddress,this.initOptions.apiUrl)),await us(this),Te.run("onLoggedIn"),this.initOptions?.chainType&&await WU(this.dappProvider,this.networkProvider,Yt[this.initOptions.chainType][r.loginMethod==="x-alias"?"xAliasAddress":"walletAddress"],r.nonce))}static async login(e,r){if(!Object.values(as).includes(e))throw new Error("Error: Wrong login method!");if(!this.networkProvider)throw new Error("Error: Login failed: Use ElvenJs.init() first!");try{Te.run("onLoginPending");let i=new t5.NativeAuthClient({apiUrl:this.initOptions?.apiUrl,origin:window.location.origin}),s=await i.initialize();if(e==="browser-extension"){let o=await DM(this,s,i,r?.callbackRoute);this.dappProvider=o}if(e==="mobile"){let o=await MU(this,s,i,r?.qrCodeContainer);this.dappProvider=o}if(e==="web-wallet"&&this.initOptions?.chainType){let o=await $I(Yt[this.initOptions.chainType].walletAddress,s,this.initOptions?.chainType,r?.callbackRoute);this.dappProvider=o}if(e==="x-alias"&&this.initOptions?.chainType){let o=await $I(Yt[this.initOptions.chainType].xAliasAddress,s,this.initOptions?.chainType,r?.callbackRoute);this.dappProvider=o}}catch(i){let s=qt(i);throw new Error(`Error: ${s}`)}}static async logout(){try{let e=await gu(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!");let r=KU(e);try{Te.run("onTxStarted",e);let n=Se.get();if(e.setNonce(n.nonce),this.dappProvider instanceof XU.ExtensionProvider&&(r=await this.dappProvider.signTransaction(e)),this.dappProvider instanceof ZU.WalletConnectV2Provider&&(r=await this.dappProvider.signTransaction(e)),this.dappProvider instanceof e5.WalletProvider&&await this.dappProvider.signTransaction(e),n.loginMethod!=="web-wallet"&&n.loginMethod!=="x-alias"){let i=JU(r);if(i||Fy(r),i&&this.initOptions?.chainType){await YU(r,Yt[this.initOptions.chainType].walletAddress);return}await this.networkProvider.sendTransaction(r),await Ly(r,this.networkProvider)}}catch(n){let i=qt(n);throw Te.run("onTxError",r,i),new Error(`Error: Transaction signing failed! ${i}`)}return r}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,Te.clear()}}};var export_Account=hie.Account;var export_Address=fie.Address;var export_AddressType=i5.AddressType;var export_AddressValue=i5.AddressValue;var export_BigUIntType=Mn.BigUIntType;var export_BigUIntValue=Mn.BigUIntValue;var export_BooleanType=n5.BooleanType;var export_BooleanValue=n5.BooleanValue;var export_BytesType=r5.BytesType;var export_BytesValue=r5.BytesValue;var export_ContractFunction=mie.ContractFunction;var export_GasEstimator=lie.GasEstimator;var export_SmartContract=yie.SmartContract;var export_TokenTransfer=uie.TokenTransfer;var export_Transaction=die.Transaction;var export_TransactionPayload=pie.TransactionPayload;var export_TransactionWatcher=gie.TransactionWatcher;var export_TransferTransactionsFactory=cie.TransferTransactionsFactory;var export_U16Type=Mn.U16Type;var export_U16Value=Mn.U16Value;var export_U32Type=Mn.U32Type;var export_U32Value=Mn.U32Value;var export_U64Type=Mn.U64Type;var export_U64Value=Mn.U64Value;var export_U8Type=Mn.U8Type;var export_U8Value=Mn.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,YI as ElvenJS,export_GasEstimator as GasEstimator,as 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/auth/login-with-web-wallet.d.ts b/build/types/auth/login-with-web-wallet.d.ts index c97cbf9..ca38fe7 100644 --- a/build/types/auth/login-with-web-wallet.d.ts +++ b/build/types/auth/login-with-web-wallet.d.ts @@ -1,2 +1,2 @@ import { WalletProvider } from '@multiversx/sdk-web-wallet-provider/out/walletProvider'; -export declare const loginWithWebWallet: (webWalletAddress: string, loginToken: string, callbackRoute?: string) => Promise; +export declare const loginWithWebWallet: (urlAddress: string, loginToken: string, chainType: string, callbackRoute?: string) => Promise; diff --git a/build/types/interaction/web-wallet-tx-finalize.d.ts b/build/types/interaction/web-wallet-tx-finalize.d.ts index c6c5dc6..add4aca 100644 --- a/build/types/interaction/web-wallet-tx-finalize.d.ts +++ b/build/types/interaction/web-wallet-tx-finalize.d.ts @@ -1,3 +1,3 @@ import { DappProvider } from '../types'; import { ApiNetworkProvider } from '../network-provider'; -export declare const webWalletTxFinalize: (dappProvider: DappProvider, networkProvider: ApiNetworkProvider, walletUrlAddress: string, nonce: number) => Promise; +export declare const webWalletTxFinalize: (dappProvider: DappProvider, networkProvider: ApiNetworkProvider, urlAddress: string, nonce: number) => Promise; diff --git a/build/types/types.d.ts b/build/types/types.d.ts index 17b0a3f..2d61b52 100644 --- a/build/types/types.d.ts +++ b/build/types/types.d.ts @@ -22,7 +22,8 @@ export declare enum LoginMethodsEnum { ledger = "ledger", mobile = "mobile", webWallet = "web-wallet", - browserExtension = "browser-extension" + browserExtension = "browser-extension", + xAlias = "x-alias" } export type DappProvider = ExtensionProvider | WalletConnectV2Provider | WalletProvider | undefined; export interface LoginOptions { diff --git a/build/types/utils/constants.d.ts b/build/types/utils/constants.d.ts index c2dfffa..6122314 100644 --- a/build/types/utils/constants.d.ts +++ b/build/types/utils/constants.d.ts @@ -7,6 +7,7 @@ interface NetworkType { decimals: string; gasPerDataByte: string; walletAddress: string; + xAliasAddress: string; apiAddress: string; explorerAddress: string; apiTimeout: number; diff --git a/example/demo-ui-tools.js b/example/demo-ui-tools.js index 7934817..7c350db 100644 --- a/example/demo-ui-tools.js +++ b/example/demo-ui-tools.js @@ -17,6 +17,7 @@ export const uiLoggedInState = (loggedIn) => { ); const loginButton = document.getElementById('button-login-mobile'); const loginWebButton = document.getElementById('button-login-web'); + const loginXaliasButton = document.getElementById('button-login-x-alias'); const logoutButton = document.getElementById('button-logout'); const txButton = document.getElementById('button-tx'); const txEsdtButton = document.getElementById('button-tx-esdt'); @@ -26,6 +27,7 @@ export const uiLoggedInState = (loggedIn) => { loginExtensionButton.style.display = 'none'; loginButton.style.display = 'none'; loginWebButton.style.display = 'none'; + loginXaliasButton.style.display = 'none'; logoutButton.style.display = 'block'; txButton.style.display = 'block'; txEsdtButton.style.display = 'block'; @@ -35,6 +37,7 @@ export const uiLoggedInState = (loggedIn) => { loginExtensionButton.style.display = 'block'; loginButton.style.display = 'block'; loginWebButton.style.display = 'block'; + loginXaliasButton.style.display = 'block'; logoutButton.style.display = 'none'; txButton.style.display = 'none'; txEsdtButton.style.display = 'none'; diff --git a/example/elven.js b/example/elven.js index e4aac2b..5f9eced 100644 --- a/example/elven.js +++ b/example/elven.js @@ -1,9 +1,9 @@ -var NU=Object.create;var jl=Object.defineProperty;var OU=Object.getOwnPropertyDescriptor;var DU=Object.getOwnPropertyNames;var PU=Object.getPrototypeOf,RU=Object.prototype.hasOwnProperty;var PI=(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)jl(t,r,{get:e[r],enumerable:!0})},Gl=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of DU(e))!RU.call(t,i)&&i!==r&&jl(t,i,{get:()=>e[i],enumerable:!(n=OU(e,i))||n.enumerable});return t},Ht=(t,e,r)=>(Gl(t,e,"default"),r&&Gl(r,e,"default")),_e=(t,e,r)=>(r=t!=null?NU(PU(t)):{},Gl(e||!t||!t.__esModule?jl(r,"default",{value:t,enumerable:!0}):r,t)),ct=t=>Gl(jl({},"__esModule",{value:!0}),t);var m0=m(kl=>{"use strict";c();kl.byteLength=LU;kl.toByteArray=MU;kl.fromByteArray=VU;var Jr=[],br=[],BU=typeof Uint8Array<"u"?Uint8Array:Array,y0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(ps=0,RI=y0.length;ps0)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 LU(t){var e=BI(t),r=e[0],n=e[1];return(r+n)*3/4-n}function FU(t,e,r){return(e+r)*3/4-r}function MU(t){var e,r=BI(t),n=r[0],i=r[1],s=new BU(FU(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 UU(t){return Jr[t>>18&63]+Jr[t>>12&63]+Jr[t>>6&63]+Jr[t&63]}function qU(t,e,r){for(var n,i=[],s=e;sa?a:o+s));return n===1?(e=t[r-1],i.push(Jr[e>>2]+Jr[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(Jr[e>>10]+Jr[e>>4&63]+Jr[e<<2&63]+"=")),i.join("")}});var E0=m(w0=>{c();w0.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,w=t[e+d];for(d+=g,s=w&(1<<-f)-1,w>>=-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:(w?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-l}return(w?-1:1)*o*Math.pow(2,s-n)};w0.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,w=n?0:s-1,E=n?1:-1,x=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+w]=a&255,w+=E,a/=256,i-=8);for(o=o<0;t[r+w]=o&255,w+=E,o/=256,l-=8);t[r+w-E]|=x*128}});var zI=m(ho=>{"use strict";c();var v0=m0(),fo=E0(),LI=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;ho.Buffer=$;ho.SlowBuffer=WU;ho.INSPECT_MAX_BYTES=50;var Ql=2147483647;ho.kMaxLength=Ql;$.TYPED_ARRAY_SUPPORT=HU();!$.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 HU(){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>Ql)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 I0(t)}return UI(t,e,r)}$.poolSize=8192;function UI(t,e,r){if(typeof t=="string")return jU(t,e);if(ArrayBuffer.isView(t))return kU(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(Xr(t,ArrayBuffer)||t&&Xr(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Xr(t,SharedArrayBuffer)||t&&Xr(t.buffer,SharedArrayBuffer)))return b0(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=QU(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 UI(t,e,r)};Object.setPrototypeOf($.prototype,Uint8Array.prototype);Object.setPrototypeOf($,Uint8Array);function qI(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 GU(t,e,r){return qI(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 GU(t,e,r)};function I0(t){return qI(t),Ln(t<0?0:S0(t)|0)}$.allocUnsafe=function(t){return I0(t)};$.allocUnsafeSlow=function(t){return I0(t)};function jU(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!$.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=VI(t,e)|0,n=Ln(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function A0(t){for(var e=t.length<0?0:S0(t.length)|0,r=Ln(e),n=0;n=Ql)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Ql.toString(16)+" bytes");return t|0}function WU(t){return+t!=t&&(t=0),$.alloc(+t)}$.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==$.prototype};$.compare=function(e,r){if(Xr(e,Uint8Array)&&(e=$.from(e,e.offset,e.byteLength)),Xr(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 VI(t,e){if($.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Xr(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 _0(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return WI(t).length;default:if(i)return n?-1:_0(t).length;e=(""+e).toLowerCase(),i=!0}}$.byteLength=VI;function zU(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 n5(this,e,r);case"utf8":case"utf-8":return GI(this,e,r);case"ascii":return t5(this,e,r);case"latin1":case"binary":return r5(this,e,r);case"base64":return ZU(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return i5(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}$.prototype._isBuffer=!0;function gs(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+=" ... "),""};LI&&($.prototype[LI]=$.prototype.inspect);$.prototype.compare=function(e,r,n,i,s){if(Xr(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,T0(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:FI(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):FI(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function FI(t,e,r,n,i){var s=1,o=t.length,a=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;s=2,o/=2,a/=2,r/=2}function u(w,E){return s===1?w[E]:w.readUInt16BE(E*s)}var l;if(i){var f=-1;for(l=r;lo&&(r=o-a),l=r;l>=0;l--){for(var d=!0,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 $U(this,e,r,n);case"utf8":case"utf-8":return KU(this,e,r,n);case"ascii":case"latin1":case"binary":return YU(this,e,r,n);case"base64":return JU(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return XU(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 ZU(t,e,r){return e===0&&r===t.length?v0.fromByteArray(t):v0.fromByteArray(t.slice(e,r))}function GI(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 e5(n)}var MI=4096;function e5(t){var e=t.length;if(e<=MI)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 jI(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 kI(t,e,r,n,i){return e=+e,r=r>>>0,i||jI(t,e,r,4,34028234663852886e22,-34028234663852886e22),fo.write(t,e,r,n,23,4),r+4}$.prototype.writeFloatLE=function(e,r,n){return kI(this,e,r,!0,n)};$.prototype.writeFloatBE=function(e,r,n){return kI(this,e,r,!1,n)};function QI(t,e,r,n,i){return e=+e,r=r>>>0,i||jI(t,e,r,8,17976931348623157e292,-17976931348623157e292),fo.write(t,e,r,n,52,8),r+8}$.prototype.writeDoubleLE=function(e,r,n){return QI(this,e,r,!0,n)};$.prototype.writeDoubleBE=function(e,r,n){return QI(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 a5(t){for(var e=[],r=0;r>8,i=r%256,s.push(i),s.push(n);return s}function WI(t){return v0.toByteArray(o5(t))}function Wl(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function Xr(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function T0(t){return t!==t}var c5=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 XI=m((Pne,JI)=>{c();var yt=JI.exports={},Zr,en;function C0(){throw new Error("setTimeout has not been defined")}function x0(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?Zr=setTimeout:Zr=C0}catch{Zr=C0}try{typeof clearTimeout=="function"?en=clearTimeout:en=x0}catch{en=x0}})();function $I(t){if(Zr===setTimeout)return setTimeout(t,0);if((Zr===C0||!Zr)&&setTimeout)return Zr=setTimeout,setTimeout(t,0);try{return Zr(t,0)}catch{try{return Zr.call(null,t,0)}catch{return Zr.call(this,t,0)}}}function l5(t){if(en===clearTimeout)return clearTimeout(t);if((en===x0||!en)&&clearTimeout)return en=clearTimeout,clearTimeout(t);try{return en(t)}catch{try{return en.call(null,t)}catch{return en.call(this,t)}}}var Fn=[],po=!1,ys,zl=-1;function f5(){!po||!ys||(po=!1,ys.length?Fn=ys.concat(Fn):zl=-1,Fn.length&&KI())}function KI(){if(!po){var t=$I(f5);po=!0;for(var e=Fn.length;e;){for(ys=Fn,Fn=[];++zl1)for(var r=1;r{h=_e(zI()),p=_e(XI()),h5=function(t){function e(){var n=this||self;return delete t.prototype.__magic__,n}if(typeof globalThis=="object")return globalThis;if(this)return e();t.defineProperty(t.prototype,"__magic__",{configurable:!0,get:e});var r=__magic__;return r}(Object),global=h5});var Gt=m((ZI,$l)=>{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 w(R){var B,b,T,L=q.prototype={constructor:q,toString:null,valueOf:null},X=new q(1),W=20,G=4,j=-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,v){var A,P,C,D,M,N,U,H,V=this;if(!(V instanceof q))return new q(y,v);if(v==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 T(V,H,N);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(v,2,ie.length,"Base"),v==10)return V=new q(y),oe(V,W+V.e+1,G);if(H=String(y),N=typeof y=="number"){if(y*0!=0)return T(V,H,N,v);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,v),D=M=0,U=H.length;MD){D=U;continue}}else if(!C&&(H==H.toUpperCase()&&(H=H.toLowerCase())||H==H.toLowerCase()&&(H=H.toUpperCase()))){C=!0,M=-1,D=0;continue}return T(V,String(y),N,v)}N=!1,H=b(H,v,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,N&&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&&C<=g&&C===i(C)){if(P[0]===0){if(C===0&&P.length===1)return!0;break e}if(v=(C+1)%u,v<1&&(v+=u),String(P[0]).length==v){for(v=0;v=a||A!==i(A))break e;if(A!==0)return!0}}}else if(P===null&&C===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,v=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,C,D,M,N,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),N>=9e15?(C=crypto.getRandomValues(new Uint32Array(2)),P[U]=C[0],P[U+1]=C[1]):(H.push(N%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(N%1e14),U+=7);U=M/7}else throw re=!1,Error(s+"crypto unavailable");if(!re)for(;U=10;N/=10,U++);UC-1&&(N[M+1]==null&&(N[M+1]=0),N[M+1]+=N[M]/C|0,N[M]%=C)}return N.reverse()}return function(A,P,C,D,M){var N,U,H,V,Z,we,ve,Pe,tt=A.indexOf("."),lt=W,Oe=G;for(tt>=0&&(V=se,se=0,A=A.replace(".",""),Pe=new q(P),we=Pe.pow(A.length-tt),se=V,Pe.c=v(S(x(we.c),we.e,"0"),10,C,y),Pe.e=Pe.c.length),ve=v(A,P,C,M?(N=ie,y):(N=y,ie)),H=V=ve.length;ve[--V]==0;ve.pop());if(!ve[0])return N.charAt(0);if(tt<0?--H:(we.c=ve,we.e=H,we.s=D,we=B(we,Pe,lt,Oe,C),ve=we.c,Z=we.r,H=we.e),U=H+lt+1,tt=ve[U],V=C/2,Z=Z||U<0||ve[U+1]!=null,Z=Oe<4?(tt!=null||Z)&&(Oe==0||Oe==(we.s<0?3:2)):tt>V||tt==V&&(Oe==4||Z||Oe==6&&ve[U-1]&1||Oe==(we.s<0?8:7)),U<1||!ve[0])A=Z?S(N.charAt(1),-lt,N.charAt(0)):N.charAt(0);else{if(ve.length=U,Z)for(--C;++ve[--U]>C;)ve[U]=0,U||(++H,ve=[1].concat(ve));for(V=ve.length;!ve[--V];);for(tt=0,A="";tt<=V;A+=N.charAt(ve[tt++]));A=S(A,H,N.charAt(0))}return A}}(),B=function(){function y(P,C,D){var M,N,U,H,V=0,Z=P.length,we=C%d,ve=C/d|0;for(P=P.slice();Z--;)U=P[Z]%d,H=P[Z]/d|0,M=ve*U+H*we,N=we*U+M%d*d+V,V=(N/D|0)+(M/d|0)+ve*H,P[Z]=N%D;return V&&(P=[V].concat(P)),P}function v(P,C,D,M){var N,U;if(D!=M)U=D>M?1:-1;else for(N=U=0;NC[N]?1:-1;break}return U}function A(P,C,D,M){for(var N=0;D--;)P[D]-=N,N=P[D]1;P.splice(0,1));}return function(P,C,D,M,N){var U,H,V,Z,we,ve,Pe,tt,lt,Oe,Ue,xt,ui,hs,ds,nr,Bn,Wt=P.s==C.s?1:-1,Nt=P.c,ze=C.c;if(!Nt||!Nt[0]||!ze||!ze[0])return new q(!P.s||!C.s||(Nt?ze&&Nt[0]==ze[0]:!ze)?NaN:Nt&&Nt[0]==0||!ze?Wt*0:Wt/0);for(tt=new q(Wt),lt=tt.c=[],H=P.e-C.e,Wt=D+H+1,N||(N=a,H=E(P.e/u)-E(C.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(hs=Nt.length,nr=ze.length,V=0,Wt+=2,we=i(N/(ze[0]+1)),we>1&&(ze=y(ze,we,N),Nt=y(Nt,we,N),nr=ze.length,hs=Nt.length),ui=nr,Oe=Nt.slice(0,nr),Ue=Oe.length;Ue=N/2&&ds++;do{if(we=0,U=v(ze,Oe,nr,Ue),U<0){if(xt=Oe[0],nr!=Ue&&(xt=xt*N+(Oe[1]||0)),we=i(xt/ds),we>1)for(we>=N&&(we=N-1),ve=y(ze,we,N),Pe=ve.length,Ue=Oe.length;v(ve,Oe,Pe,Ue)==1;)we--,A(ve,nr=10;Wt/=10,V++);oe(tt,D+(tt.e=V+H*u-1)+1,M,Z)}else tt.e=H,tt.r=+Z;return tt}}();function le(y,v,A,P){var C,D,M,N,U;if(A==null?A=G:F(A,0,8),!y.c)return y.toString();if(C=y.c[0],M=y.e,v==null)U=x(y.c),U=P==1||P==2&&(M<=j||M>=K)?I(U,M):S(U,M,"0");else if(y=oe(new q(y),v,A),D=y.e,U=x(y.c),N=U.length,P==1||P==2&&(v<=D||D<=j)){for(;NN){if(--v>0)for(U+=".";v--;U+="0");}else if(v+=D-N,v>0)for(D+1==N&&(U+=".");v--;U+="0");return y.s<0&&C?"-"+U:U}function ae(y,v){for(var A,P=1,C=new q(y[0]);P=10;C/=10,P++);return(A=P+A*u-1)>ue?y.c=y.e=null:A=10;N/=10,C++);if(D=v-C,D<0)D+=u,M=v,U=Z[H=0],V=U/we[C-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,C=1,D%=u,M=D-u+1}else break e;else{for(U=N=Z[H],C=1;N>=10;N/=10,C++);D%=u,M=D-u+C,V=M<0?0:U/we[C-M-1]%10|0}if(P=P||v<0||Z[H+1]!=null||(M<0?U:U%we[C-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/we[C-M]:0:Z[H-1])%10&1||A==(y.s<0?8:7)),v<1||!Z[0])return Z.length=0,P?(v-=y.e+1,Z[0]=we[(u-v%u)%u],y.e=-v||0):Z[0]=y.e=0,y;if(D==0?(Z.length=H,N=1,H--):(Z.length=H+1,N=we[u-D],Z[H]=M>0?i(U/we[C-M]%we[M])*N:0),P)for(;;)if(H==0){for(D=1,M=Z[0];M>=10;M/=10,D++);for(M=Z[0]+=N,N=1;M>=10;M/=10,N++);D!=N&&(y.e++,Z[0]==a&&(Z[0]=1));break}else{if(Z[H]+=N,Z[H]!=a)break;Z[H--]=0,N=1}for(D=Z.length;Z[--D]===0;Z.pop());}y.e>ue?y.c=y.e=null:y.e=K?I(v,A):S(v,A,"0"),y.s<0?"-"+v:v)}return L.absoluteValue=L.abs=function(){var y=new q(this);return y.s<0&&(y.s=1),y},L.comparedTo=function(y,v){return O(this,new q(y,v))},L.decimalPlaces=L.dp=function(y,v){var A,P,C,D=this;if(y!=null)return F(y,0,g),v==null?v=G:F(v,0,8),oe(new q(D),y+D.e+1,v);if(!(A=D.c))return null;if(P=((C=A.length-1)-E(this.e/u))*u,C=A[C])for(;C%10==0;C/=10,P--);return P<0&&(P=0),P},L.dividedBy=L.div=function(y,v){return B(this,new q(y,v),W,G)},L.dividedToIntegerBy=L.idiv=function(y,v){return B(this,new q(y,v),0,1)},L.exponentiatedBy=L.pow=function(y,v){var A,P,C,D,M,N,U,H,V,Z=this;if(y=new q(y),y.c&&!y.isInteger())throw Error(s+"Exponent not an integer: "+ce(y));if(v!=null&&(v=new q(v)),N=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),N?2-_(y):+ce(y))),v?V.mod(v):V;if(U=y.s<0,v){if(v.c?!v.c[0]:!v.s)return new q(NaN);P=!U&&Z.isInteger()&&v.isInteger(),P&&(Z=Z.mod(v))}else{if(y.e>9&&(Z.e>0||Z.e<-1||(Z.e==0?Z.c[0]>1||N&&Z.c[1]>=24e7:Z.c[0]<8e13||N&&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(N?(A=new q(.5),U&&(y.s=1),H=_(y)):(C=Math.abs(+ce(y)),H=C%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(v))}if(C){if(C=i(C/2),C===0)break;H=C%2}else if(y=y.times(A),oe(y,y.e+1,1),y.e>14)H=_(y);else{if(C=+ce(y),C===0)break;H=C%2}Z=Z.times(Z),D?Z.c&&Z.c.length>D&&(Z.c.length=D):P&&(Z=Z.mod(v))}return P?V:(U&&(V=X.div(V)),v?V.mod(v):D?oe(V,se,G,M):V)},L.integerValue=function(y){var v=new q(this);return y==null?y=G:F(y,0,8),oe(v,v.e+1,y)},L.isEqualTo=L.eq=function(y,v){return O(this,new q(y,v))===0},L.isFinite=function(){return!!this.c},L.isGreaterThan=L.gt=function(y,v){return O(this,new q(y,v))>0},L.isGreaterThanOrEqualTo=L.gte=function(y,v){return(v=O(this,new q(y,v)))===1||v===0},L.isInteger=function(){return!!this.c&&E(this.e/u)>this.c.length-2},L.isLessThan=L.lt=function(y,v){return O(this,new q(y,v))<0},L.isLessThanOrEqualTo=L.lte=function(y,v){return(v=O(this,new q(y,v)))===-1||v===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,v){var A,P,C,D,M=this,N=M.s;if(y=new q(y,v),v=y.s,!N||!v)return new q(NaN);if(N!=v)return y.s=-v,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=-v,y):new q(Z?M:NaN);if(!V[0]||!Z[0])return Z[0]?(y.s=-v,y):new q(V[0]?M:G==3?-0:0)}if(U=E(U),H=E(H),V=V.slice(),N=U-H){for((D=N<0)?(N=-N,C=V):(H=U,C=Z),C.reverse(),v=N;v--;C.push(0));C.reverse()}else for(P=(D=(N=V.length)<(v=Z.length))?N:v,N=v=0;v0)for(;v--;V[A++]=0);for(v=a-1;P>N;){if(V[--P]=0;){for(A=0,we=xt[C]%lt,ve=xt[C]/lt|0,M=U,D=C+M;D>C;)H=Ue[--M]%lt,V=Ue[M]/lt|0,N=ve*H+V*we,H=we*H+N%lt*lt+Pe[D]+A,A=(H/tt|0)+(N/lt|0)+ve*V,Pe[D--]=H%tt;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,v){var A,P=this,C=P.s;if(y=new q(y,v),v=y.s,!C||!v)return new q(NaN);if(C!=v)return y.s=-v,P.minus(y);var D=P.e/u,M=y.e/u,N=P.c,U=y.c;if(!D||!M){if(!N||!U)return new q(C/0);if(!N[0]||!U[0])return U[0]?y:new q(N[0]?P:C*0)}if(D=E(D),M=E(M),N=N.slice(),C=D-M){for(C>0?(M=D,A=U):(C=-C,A=N),A.reverse();C--;A.push(0));A.reverse()}for(C=N.length,v=U.length,C-v<0&&(A=U,U=N,N=A,v=C),C=0;v;)C=(N[--v]=N[v]+U[v]+C)/a|0,N[v]=a===N[v]?0:N[v]%a;return C&&(N=[C].concat(N),++M),fe(y,N,M)},L.precision=L.sd=function(y,v){var A,P,C,D=this;if(y!=null&&y!==!!y)return F(y,1,g),v==null?v=G:F(v,0,8),oe(new q(D),y,v);if(!(A=D.c))return null;if(C=A.length-1,P=C*u+1,C=A[C]){for(;C%10==0;C/=10,P--);for(C=A[0];C>=10;C/=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,v,A,P,C,D=this,M=D.c,N=D.s,U=D.e,H=W+4,V=new q("0.5");if(N!==1||!M||!M[0])return new q(!N||N<0&&(!M||M[0])?NaN:M?D:1/0);if(N=Math.sqrt(+ce(D)),N==0||N==1/0?(v=x(M),(v.length+U)%2==0&&(v+="0"),N=Math.sqrt(+v),U=E((U+1)/2)-(U<0||U%2),N==1/0?v="5e"+U:(v=N.toExponential(),v=v.slice(0,v.indexOf("e")+1)+U),A=new q(v)):A=new q(N+""),A.c[0]){for(U=A.e,N=U+H,N<3&&(N=0);;)if(C=A,A=V.times(C.plus(B(D,C,H,1))),x(C.c).slice(0,N)===(v=x(A.c)).slice(0,N))if(A.e0&&Pe>0){for(D=Pe%N||N,V=ve.substr(0,D);D0&&(V+=H+ve.slice(D)),we&&(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 v,A,P,C,D,M,N,U,H,V,Z,we,ve=this,Pe=ve.c;if(y!=null&&(N=new q(y),!N.isInteger()&&(N.c||N.s!==1)||N.lt(X)))throw Error(s+"Argument "+(N.isInteger()?"out of range: ":"not an integer: ")+ce(N));if(!Pe)return new q(ve);for(v=new q(X),H=A=new q(X),P=U=new q(X),we=x(Pe),D=v.e=we.length-ve.e-1,v.c[0]=f[(M=D%u)<0?u+M:M],y=!y||N.comparedTo(v)>0?D>0?v:H:N,M=ue,ue=1/0,N=new q(we),U.c[0]=0;V=B(N,v,0,1),C=A.plus(V.times(P)),C.comparedTo(y)!=1;)A=P,P=C,H=U.plus(V.times(C=H)),U=C,v=N.minus(V.times(C=v)),N=C;return C=B(y.minus(A),P,0,1),U=U.plus(C.times(H)),A=A.plus(C.times(P)),U.s=H.s=ve.s,D=D*2,Z=B(H,P,D,G).minus(ve).abs().comparedTo(B(U,A,D,G).minus(ve).abs())<1?[H,P]:[U,A],ue=M,Z},L.toNumber=function(){return+ce(this)},L.toPrecision=function(y,v){return y!=null&&F(y,1,g),le(this,y,v,2)},L.toString=function(y){var v,A=this,P=A.s,C=A.e;return C===null?P?(v="Infinity",P<0&&(v="-"+v)):v="NaN":(y==null?v=C<=j||C>=K?I(x(A.c),C):S(x(A.c),C,"0"):y===10?(A=oe(new q(A),W+C+1,G),v=S(x(A.c),A.e,"0")):(F(y,2,ie.length,"Base"),v=b(S(x(A.c),C,"0"),10,y,P,!0)),P<0&&A.c[0]&&(v="-"+v)),v},L.valueOf=L.toJSON=function(){return ce(this)},L._isBigNumber=!0,R!=null&&q.set(R),q}function E(R){var B=R|0;return R>0||R===B?B:B-1}function x(R){for(var B,b,T=1,L=R.length,X=R[0]+"";TK^b?1:-1;for(G=(j=L.length)<(K=X.length)?j:K,W=0;WX[W]^b?1:-1;return j==K?0:j>K^b?1:-1}function F(R,B,b,T){if(Rb||R!==i(R))throw Error(s+(T||"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 E(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 T,L;if(B<0){for(L=b+".";++B;L+=b);R=L+R}else if(T=R.length,++B>T){for(L=b,B-=T;--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 N0=class extends Re{constructor(e,r){super(`Invalid argument: ${e}`,r)}};pe.ErrInvalidArgument=N0;var O0=class extends Re{constructor(e,r="not specified"){super(`Operation "${e}" not supported. Reason: ${r}`)}};pe.ErrUnsupportedOperation=O0;var D0=class extends Re{constructor(e,r,n){super(`Bad type of "${e}": ${n}. Expected type: ${r}`)}};pe.ErrBadType=D0;var P0=class extends Re{constructor(e){super(`Invariant failed: [${e}]`)}};pe.ErrInvariantFailed=P0;var R0=class extends Re{constructor(e){super(`Unexpected condition: [${e}]`)}};pe.ErrUnexpectedCondition=R0;var B0=class extends Re{constructor(e,r){let n=`Cannot create address from: ${e}`;super(n,r)}};pe.ErrAddressCannotCreate=B0;var L0=class extends Re{constructor(e,r){super(`Wrong address HRP. Expected: ${e}, got ${r}`)}};pe.ErrAddressBadHrp=L0;var F0=class extends Re{constructor(){super("Address is empty")}};pe.ErrAddressEmpty=F0;var M0=class extends Re{constructor(e){super(`Not enough gas provided: ${e}`)}};pe.ErrNotEnoughGas=M0;var U0=class extends Re{constructor(e){super(`Invalid nonce: ${e}`)}};pe.ErrNonceInvalid=U0;var q0=class extends Re{constructor(e){super(`Invalid transaction version: ${e}`)}};pe.ErrTransactionVersionInvalid=q0;var V0=class extends Re{constructor(e){super(`Invalid transaction options: ${e}`)}};pe.ErrTransactionOptionsInvalid=V0;var H0=class extends Re{constructor(e,r){let n=`Cannot create signature from: ${e}`;super(n,r)}};pe.ErrSignatureCannotCreate=H0;var G0=class extends Re{constructor(){super("Invalid function name")}};pe.ErrInvalidFunctionName=G0;var j0=class extends Re{constructor(){super("Async timer already running")}};pe.ErrAsyncTimerAlreadyRunning=j0;var k0=class extends Re{constructor(){super("Async timer aborted")}};pe.ErrAsyncTimerAborted=k0;var Q0=class extends Re{constructor(){super("TransactionWatcher has timed out")}};pe.ErrTransactionWatcherTimeout=Q0;var W0=class extends Re{constructor(){super("Expected transaction status not reached")}};pe.ErrExpectedTransactionStatusNotReached=W0;var z0=class extends Re{constructor(){super("Expected transaction events not found")}};pe.ErrExpectedTransactionEventsNotFound=z0;var Kl=class extends Re{constructor(e){super(e)}};pe.ErrContract=Kl;var $0=class extends Kl{constructor(){super(` +var s5=Object.create;var Yl=Object.defineProperty;var o5=Object.getOwnPropertyDescriptor;var a5=Object.getOwnPropertyNames;var u5=Object.getPrototypeOf,c5=Object.prototype.hasOwnProperty;var JI=(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)Yl(t,r,{get:e[r],enumerable:!0})},Kl=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of a5(e))!c5.call(t,i)&&i!==r&&Yl(t,i,{get:()=>e[i],enumerable:!(n=o5(e,i))||n.enumerable});return t},Ht=(t,e,r)=>(Kl(t,e,"default"),r&&Kl(r,e,"default")),_e=(t,e,r)=>(r=t!=null?s5(u5(t)):{},Kl(e||!t||!t.__esModule?Yl(r,"default",{value:t,enumerable:!0}):r,t)),ct=t=>Kl(Yl({},"__esModule",{value:!0}),t);var C0=m(Jl=>{"use strict";c();Jl.byteLength=f5;Jl.toByteArray=d5;Jl.fromByteArray=y5;var Xr=[],Sr=[],l5=typeof Uint8Array<"u"?Uint8Array:Array,T0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Es=0,XI=T0.length;Es0)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 f5(t){var e=ZI(t),r=e[0],n=e[1];return(r+n)*3/4-n}function h5(t,e,r){return(e+r)*3/4-r}function d5(t){var e,r=ZI(t),n=r[0],i=r[1],s=new l5(h5(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=Sr[t.charCodeAt(u)]<<2|Sr[t.charCodeAt(u+1)]>>4,s[o++]=e&255),i===1&&(e=Sr[t.charCodeAt(u)]<<10|Sr[t.charCodeAt(u+1)]<<4|Sr[t.charCodeAt(u+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function p5(t){return Xr[t>>18&63]+Xr[t>>12&63]+Xr[t>>6&63]+Xr[t&63]}function g5(t,e,r){for(var n,i=[],s=e;sa?a:o+s));return n===1?(e=t[r-1],i.push(Xr[e>>2]+Xr[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(Xr[e>>10]+Xr[e>>4&63]+Xr[e<<2&63]+"=")),i.join("")}});var N0=m(x0=>{c();x0.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,w=t[e+d];for(d+=g,s=w&(1<<-f)-1,w>>=-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:(w?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-l}return(w?-1:1)*o*Math.pow(2,s-n)};x0.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,w=n?0:s-1,E=n?1:-1,T=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=f):(o=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-o))<1&&(o--,u*=2),o+d>=1?e+=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+w]=a&255,w+=E,a/=256,i-=8);for(o=o<0;t[r+w]=o&255,w+=E,o/=256,l-=8);t[r+w-E]|=T*128}});var hS=m(vo=>{"use strict";c();var O0=C0(),Eo=N0(),eS=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;vo.Buffer=z;vo.SlowBuffer=b5;vo.INSPECT_MAX_BYTES=50;var Xl=2147483647;vo.kMaxLength=Xl;z.TYPED_ARRAY_SUPPORT=m5();!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 m5(){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(z.prototype,"parent",{enumerable:!0,get:function(){if(z.isBuffer(this))return this.buffer}});Object.defineProperty(z.prototype,"offset",{enumerable:!0,get:function(){if(z.isBuffer(this))return this.byteOffset}});function qn(t){if(t>Xl)throw new RangeError('The value "'+t+'" is invalid for option "size"');var 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 B0(t)}return nS(t,e,r)}z.poolSize=8192;function nS(t,e,r){if(typeof t=="string")return E5(t,e);if(ArrayBuffer.isView(t))return v5(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(Zr(t,ArrayBuffer)||t&&Zr(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Zr(t,SharedArrayBuffer)||t&&Zr(t.buffer,SharedArrayBuffer)))return P0(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 z.from(n,e,r);var i=A5(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 nS(t,e,r)};Object.setPrototypeOf(z.prototype,Uint8Array.prototype);Object.setPrototypeOf(z,Uint8Array);function iS(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 w5(t,e,r){return iS(t),t<=0?qn(t):e!==void 0?typeof r=="string"?qn(t).fill(e,r):qn(t).fill(e):qn(t)}z.alloc=function(t,e,r){return w5(t,e,r)};function B0(t){return iS(t),qn(t<0?0:L0(t)|0)}z.allocUnsafe=function(t){return B0(t)};z.allocUnsafeSlow=function(t){return B0(t)};function E5(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!z.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=sS(t,e)|0,n=qn(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function D0(t){for(var e=t.length<0?0:L0(t.length)|0,r=qn(e),n=0;n=Xl)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Xl.toString(16)+" bytes");return t|0}function b5(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(Zr(e,Uint8Array)&&(e=z.from(e,e.offset,e.byteLength)),Zr(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;for(var n=e.length,i=r.length,s=0,o=Math.min(n,i);si.length?z.from(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 sS(t,e){if(z.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Zr(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 R0(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return fS(t).length;default:if(i)return n?-1:R0(t).length;e=(""+e).toLowerCase(),i=!0}}z.byteLength=sS;function _5(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 R5(this,e,r);case"utf8":case"utf-8":return aS(this,e,r);case"ascii":return D5(this,e,r);case"latin1":case"binary":return P5(this,e,r);case"base64":return N5(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B5(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}z.prototype._isBuffer=!0;function vs(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}z.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+=" ... "),""};eS&&(z.prototype[eS]=z.prototype.inspect);z.prototype.compare=function(e,r,n,i,s){if(Zr(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;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,F0(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:tS(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):tS(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function tS(t,e,r,n,i){var s=1,o=t.length,a=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;s=2,o/=2,a/=2,r/=2}function u(w,E){return s===1?w[E]:w.readUInt16BE(E*s)}var l;if(i){var f=-1;for(l=r;lo&&(r=o-a),l=r;l>=0;l--){for(var d=!0,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 I5(this,e,r,n);case"utf8":case"utf-8":return S5(this,e,r,n);case"ascii":case"latin1":case"binary":return T5(this,e,r,n);case"base64":return C5(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x5(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 N5(t,e,r){return e===0&&r===t.length?O0.fromByteArray(t):O0.fromByteArray(t.slice(e,r))}function aS(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 O5(n)}var rS=4096;function O5(t){var e=t.length;if(e<=rS)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")}z.prototype.readUintLE=z.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};z.prototype.readUint8=z.prototype.readUInt8=function(e,r){return e=e>>>0,r||Rt(e,1,this.length),this[e]};z.prototype.readUint16LE=z.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||Rt(e,2,this.length),this[e]|this[e+1]<<8};z.prototype.readUint16BE=z.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||Rt(e,2,this.length),this[e]<<8|this[e+1]};z.prototype.readUint32LE=z.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};z.prototype.readUint32BE=z.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])};z.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};z.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};z.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]};z.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};z.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};z.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};z.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]};z.prototype.readFloatLE=function(e,r){return e=e>>>0,r||Rt(e,4,this.length),Eo.read(this,e,!0,23,4)};z.prototype.readFloatBE=function(e,r){return e=e>>>0,r||Rt(e,4,this.length),Eo.read(this,e,!1,23,4)};z.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||Rt(e,8,this.length),Eo.read(this,e,!0,52,8)};z.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||Rt(e,8,this.length),Eo.read(this,e,!1,52,8)};function or(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){var s=Math.pow(2,8*n)-1;or(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;or(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};z.prototype.writeUint8=z.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||or(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||or(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||or(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||or(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||or(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};z.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){var s=Math.pow(2,8*n-1);or(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};z.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){var s=Math.pow(2,8*n-1);or(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};z.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||or(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||or(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||or(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||or(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||or(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 uS(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 cS(t,e,r,n,i){return e=+e,r=r>>>0,i||uS(t,e,r,4,34028234663852886e22,-34028234663852886e22),Eo.write(t,e,r,n,23,4),r+4}z.prototype.writeFloatLE=function(e,r,n){return cS(this,e,r,!0,n)};z.prototype.writeFloatBE=function(e,r,n){return cS(this,e,r,!1,n)};function lS(t,e,r,n,i){return e=+e,r=r>>>0,i||uS(t,e,r,8,17976931348623157e292,-17976931348623157e292),Eo.write(t,e,r,n,52,8),r+8}z.prototype.writeDoubleLE=function(e,r,n){return lS(this,e,r,!0,n)};z.prototype.writeDoubleBE=function(e,r,n){return lS(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);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 M5(t){for(var e=[],r=0;r>8,i=r%256,s.push(i),s.push(n);return s}function fS(t){return O0.toByteArray(F5(t))}function Zl(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function Zr(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function F0(t){return t!==t}var q5=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 mS=m((Sie,yS)=>{c();var mt=yS.exports={},en,tn;function M0(){throw new Error("setTimeout has not been defined")}function U0(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?en=setTimeout:en=M0}catch{en=M0}try{typeof clearTimeout=="function"?tn=clearTimeout:tn=U0}catch{tn=U0}})();function dS(t){if(en===setTimeout)return setTimeout(t,0);if((en===M0||!en)&&setTimeout)return en=setTimeout,setTimeout(t,0);try{return en(t,0)}catch{try{return en.call(null,t,0)}catch{return en.call(this,t,0)}}}function V5(t){if(tn===clearTimeout)return clearTimeout(t);if((tn===U0||!tn)&&clearTimeout)return tn=clearTimeout,clearTimeout(t);try{return tn(t)}catch{try{return tn.call(null,t)}catch{return tn.call(this,t)}}}var Vn=[],Ao=!1,As,ef=-1;function H5(){!Ao||!As||(Ao=!1,As.length?Vn=As.concat(Vn):ef=-1,Vn.length&&pS())}function pS(){if(!Ao){var t=dS(H5);Ao=!0;for(var e=Vn.length;e;){for(As=Vn,Vn=[];++ef1)for(var r=1;r{h=_e(hS()),p=_e(mS()),G5=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=G5});var Gt=m((wS,tf)=>{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 w(I){var N,_,S,R=M.prototype={constructor:M,toString:null,valueOf:null},J=new M(1),Q=20,V=4,k=-7,K=21,pe=-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 M(y,v){var b,P,C,O,L,x,F,H,q=this;if(!(q instanceof M))return new M(y,v);if(v==null){if(y&&y._isBigNumber===!0){q.s=y.s,!y.c||y.e>ue?q.c=q.e=null:y.e=10;L/=10,O++);O>ue?q.c=q.e=null:(q.e=O,q.c=[y]);return}H=String(y)}else{if(!r.test(H=String(y)))return S(q,H,x);q.s=H.charCodeAt(0)==45?(H=H.slice(1),-1):1}(O=H.indexOf("."))>-1&&(H=H.replace(".","")),(L=H.search(/e/i))>0?(O<0&&(O=L),O+=+H.slice(L+1),H=H.substring(0,L)):O<0&&(O=H.length)}else{if(B(v,2,ie.length,"Base"),v==10)return q=new M(y),oe(q,Q+q.e+1,V);if(H=String(y),x=typeof y=="number"){if(y*0!=0)return S(q,H,x,v);if(q.s=1/y<0?(H=H.slice(1),-1):1,M.DEBUG&&H.replace(/^0\.0*|\./,"").length>15)throw Error(o+y)}else q.s=H.charCodeAt(0)===45?(H=H.slice(1),-1):1;for(b=ie.slice(0,v),O=L=0,F=H.length;LO){O=F;continue}}else if(!C&&(H==H.toUpperCase()&&(H=H.toLowerCase())||H==H.toLowerCase()&&(H=H.toUpperCase()))){C=!0,L=-1,O=0;continue}return S(q,String(y),x,v)}x=!1,H=_(H,v,10,q.s),(O=H.indexOf("."))>-1?H=H.replace(".",""):O=H.length}for(L=0;H.charCodeAt(L)===48;L++);for(F=H.length;H.charCodeAt(--F)===48;);if(H=H.slice(L,++F)){if(F-=L,x&&M.DEBUG&&F>15&&(y>l||y!==i(y)))throw Error(o+q.s*y);if((O=O-L-1)>ue)q.c=q.e=null;else if(O=-g&&C<=g&&C===i(C)){if(P[0]===0){if(C===0&&P.length===1)return!0;break e}if(v=(C+1)%u,v<1&&(v+=u),String(P[0]).length==v){for(v=0;v=a||b!==i(b))break e;if(b!==0)return!0}}}else if(P===null&&C===null&&(O===null||O===1||O===-1))return!0;throw Error(s+"Invalid BigNumber: "+y)},M.maximum=M.max=function(){return ae(arguments,R.lt)},M.minimum=M.min=function(){return ae(arguments,R.gt)},M.random=function(){var y=9007199254740992,v=Math.random()*y&2097151?function(){return i(Math.random()*y)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(b){var P,C,O,L,x,F=0,H=[],q=new M(J);if(b==null?b=Q:B(b,0,g),L=n(b/u),re)if(crypto.getRandomValues){for(P=crypto.getRandomValues(new Uint32Array(L*=2));F>>11),x>=9e15?(C=crypto.getRandomValues(new Uint32Array(2)),P[F]=C[0],P[F+1]=C[1]):(H.push(x%1e14),F+=2);F=L/2}else if(crypto.randomBytes){for(P=crypto.randomBytes(L*=7);F=9e15?crypto.randomBytes(7).copy(P,F):(H.push(x%1e14),F+=7);F=L/7}else throw re=!1,Error(s+"crypto unavailable");if(!re)for(;F=10;x/=10,F++);FC-1&&(x[L+1]==null&&(x[L+1]=0),x[L+1]+=x[L]/C|0,x[L]%=C)}return x.reverse()}return function(b,P,C,O,L){var x,F,H,q,Z,we,Ae,Re,tt=b.indexOf("."),lt=Q,Oe=V;for(tt>=0&&(q=se,se=0,b=b.replace(".",""),Re=new M(P),we=Re.pow(b.length-tt),se=q,Re.c=v(A(T(we.c),we.e,"0"),10,C,y),Re.e=Re.c.length),Ae=v(b,P,C,L?(x=ie,y):(x=y,ie)),H=q=Ae.length;Ae[--q]==0;Ae.pop());if(!Ae[0])return x.charAt(0);if(tt<0?--H:(we.c=Ae,we.e=H,we.s=O,we=N(we,Re,lt,Oe,C),Ae=we.c,Z=we.r,H=we.e),F=H+lt+1,tt=Ae[F],q=C/2,Z=Z||F<0||Ae[F+1]!=null,Z=Oe<4?(tt!=null||Z)&&(Oe==0||Oe==(we.s<0?3:2)):tt>q||tt==q&&(Oe==4||Z||Oe==6&&Ae[F-1]&1||Oe==(we.s<0?8:7)),F<1||!Ae[0])b=Z?A(x.charAt(1),-lt,x.charAt(0)):x.charAt(0);else{if(Ae.length=F,Z)for(--C;++Ae[--F]>C;)Ae[F]=0,F||(++H,Ae=[1].concat(Ae));for(q=Ae.length;!Ae[--q];);for(tt=0,b="";tt<=q;b+=x.charAt(Ae[tt++]));b=A(b,H,x.charAt(0))}return b}}(),N=function(){function y(P,C,O){var L,x,F,H,q=0,Z=P.length,we=C%d,Ae=C/d|0;for(P=P.slice();Z--;)F=P[Z]%d,H=P[Z]/d|0,L=Ae*F+H*we,x=we*F+L%d*d+q,q=(x/O|0)+(L/d|0)+Ae*H,P[Z]=x%O;return q&&(P=[q].concat(P)),P}function v(P,C,O,L){var x,F;if(O!=L)F=O>L?1:-1;else for(x=F=0;xC[x]?1:-1;break}return F}function b(P,C,O,L){for(var x=0;O--;)P[O]-=x,x=P[O]1;P.splice(0,1));}return function(P,C,O,L,x){var F,H,q,Z,we,Ae,Re,tt,lt,Oe,Ue,Ot,hi,ms,ws,sr,Un,$t=P.s==C.s?1:-1,Dt=P.c,$e=C.c;if(!Dt||!Dt[0]||!$e||!$e[0])return new M(!P.s||!C.s||(Dt?$e&&Dt[0]==$e[0]:!$e)?NaN:Dt&&Dt[0]==0||!$e?$t*0:$t/0);for(tt=new M($t),lt=tt.c=[],H=P.e-C.e,$t=O+H+1,x||(x=a,H=E(P.e/u)-E(C.e/u),$t=$t/u|0),q=0;$e[q]==(Dt[q]||0);q++);if($e[q]>(Dt[q]||0)&&H--,$t<0)lt.push(1),Z=!0;else{for(ms=Dt.length,sr=$e.length,q=0,$t+=2,we=i(x/($e[0]+1)),we>1&&($e=y($e,we,x),Dt=y(Dt,we,x),sr=$e.length,ms=Dt.length),hi=sr,Oe=Dt.slice(0,sr),Ue=Oe.length;Ue=x/2&&ws++;do{if(we=0,F=v($e,Oe,sr,Ue),F<0){if(Ot=Oe[0],sr!=Ue&&(Ot=Ot*x+(Oe[1]||0)),we=i(Ot/ws),we>1)for(we>=x&&(we=x-1),Ae=y($e,we,x),Re=Ae.length,Ue=Oe.length;v(Ae,Oe,Re,Ue)==1;)we--,b(Ae,sr=10;$t/=10,q++);oe(tt,O+(tt.e=q+H*u-1)+1,L,Z)}else tt.e=H,tt.r=+Z;return tt}}();function le(y,v,b,P){var C,O,L,x,F;if(b==null?b=V:B(b,0,8),!y.c)return y.toString();if(C=y.c[0],L=y.e,v==null)F=T(y.c),F=P==1||P==2&&(L<=k||L>=K)?U(F,L):A(F,L,"0");else if(y=oe(new M(y),v,b),O=y.e,F=T(y.c),x=F.length,P==1||P==2&&(v<=O||O<=k)){for(;xx){if(--v>0)for(F+=".";v--;F+="0");}else if(v+=O-x,v>0)for(O+1==x&&(F+=".");v--;F+="0");return y.s<0&&C?"-"+F:F}function ae(y,v){for(var b,P=1,C=new M(y[0]);P=10;C/=10,P++);return(b=P+b*u-1)>ue?y.c=y.e=null:b=10;x/=10,C++);if(O=v-C,O<0)O+=u,L=v,F=Z[H=0],q=F/we[C-L-1]%10|0;else if(H=n((O+1)/u),H>=Z.length)if(P){for(;Z.length<=H;Z.push(0));F=q=0,C=1,O%=u,L=O-u+1}else break e;else{for(F=x=Z[H],C=1;x>=10;x/=10,C++);O%=u,L=O-u+C,q=L<0?0:F/we[C-L-1]%10|0}if(P=P||v<0||Z[H+1]!=null||(L<0?F:F%we[C-L-1]),P=b<4?(q||P)&&(b==0||b==(y.s<0?3:2)):q>5||q==5&&(b==4||P||b==6&&(O>0?L>0?F/we[C-L]:0:Z[H-1])%10&1||b==(y.s<0?8:7)),v<1||!Z[0])return Z.length=0,P?(v-=y.e+1,Z[0]=we[(u-v%u)%u],y.e=-v||0):Z[0]=y.e=0,y;if(O==0?(Z.length=H,x=1,H--):(Z.length=H+1,x=we[u-O],Z[H]=L>0?i(F/we[C-L]%we[L])*x:0),P)for(;;)if(H==0){for(O=1,L=Z[0];L>=10;L/=10,O++);for(L=Z[0]+=x,x=1;L>=10;L/=10,x++);O!=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(O=Z.length;Z[--O]===0;Z.pop());}y.e>ue?y.c=y.e=null:y.e=K?U(v,b):A(v,b,"0"),y.s<0?"-"+v:v)}return R.absoluteValue=R.abs=function(){var y=new M(this);return y.s<0&&(y.s=1),y},R.comparedTo=function(y,v){return D(this,new M(y,v))},R.decimalPlaces=R.dp=function(y,v){var b,P,C,O=this;if(y!=null)return B(y,0,g),v==null?v=V:B(v,0,8),oe(new M(O),y+O.e+1,v);if(!(b=O.c))return null;if(P=((C=b.length-1)-E(this.e/u))*u,C=b[C])for(;C%10==0;C/=10,P--);return P<0&&(P=0),P},R.dividedBy=R.div=function(y,v){return N(this,new M(y,v),Q,V)},R.dividedToIntegerBy=R.idiv=function(y,v){return N(this,new M(y,v),0,1)},R.exponentiatedBy=R.pow=function(y,v){var b,P,C,O,L,x,F,H,q,Z=this;if(y=new M(y),y.c&&!y.isInteger())throw Error(s+"Exponent not an integer: "+ce(y));if(v!=null&&(v=new M(v)),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 q=new M(Math.pow(+ce(Z),x?2-W(y):+ce(y))),v?q.mod(v):q;if(F=y.s<0,v){if(v.c?!v.c[0]:!v.s)return new M(NaN);P=!F&&Z.isInteger()&&v.isInteger(),P&&(Z=Z.mod(v))}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 O=Z.s<0&&W(y)?-0:0,Z.e>-1&&(O=1/O),new M(F?1/O:O);se&&(O=n(se/u+2))}for(x?(b=new M(.5),F&&(y.s=1),H=W(y)):(C=Math.abs(+ce(y)),H=C%2),q=new M(J);;){if(H){if(q=q.times(Z),!q.c)break;O?q.c.length>O&&(q.c.length=O):P&&(q=q.mod(v))}if(C){if(C=i(C/2),C===0)break;H=C%2}else if(y=y.times(b),oe(y,y.e+1,1),y.e>14)H=W(y);else{if(C=+ce(y),C===0)break;H=C%2}Z=Z.times(Z),O?Z.c&&Z.c.length>O&&(Z.c.length=O):P&&(Z=Z.mod(v))}return P?q:(F&&(q=J.div(q)),v?q.mod(v):O?oe(q,se,V,L):q)},R.integerValue=function(y){var v=new M(this);return y==null?y=V:B(y,0,8),oe(v,v.e+1,y)},R.isEqualTo=R.eq=function(y,v){return D(this,new M(y,v))===0},R.isFinite=function(){return!!this.c},R.isGreaterThan=R.gt=function(y,v){return D(this,new M(y,v))>0},R.isGreaterThanOrEqualTo=R.gte=function(y,v){return(v=D(this,new M(y,v)))===1||v===0},R.isInteger=function(){return!!this.c&&E(this.e/u)>this.c.length-2},R.isLessThan=R.lt=function(y,v){return D(this,new M(y,v))<0},R.isLessThanOrEqualTo=R.lte=function(y,v){return(v=D(this,new M(y,v)))===-1||v===0},R.isNaN=function(){return!this.s},R.isNegative=function(){return this.s<0},R.isPositive=function(){return this.s>0},R.isZero=function(){return!!this.c&&this.c[0]==0},R.minus=function(y,v){var b,P,C,O,L=this,x=L.s;if(y=new M(y,v),v=y.s,!x||!v)return new M(NaN);if(x!=v)return y.s=-v,L.plus(y);var F=L.e/u,H=y.e/u,q=L.c,Z=y.c;if(!F||!H){if(!q||!Z)return q?(y.s=-v,y):new M(Z?L:NaN);if(!q[0]||!Z[0])return Z[0]?(y.s=-v,y):new M(q[0]?L:V==3?-0:0)}if(F=E(F),H=E(H),q=q.slice(),x=F-H){for((O=x<0)?(x=-x,C=q):(H=F,C=Z),C.reverse(),v=x;v--;C.push(0));C.reverse()}else for(P=(O=(x=q.length)<(v=Z.length))?x:v,x=v=0;v0)for(;v--;q[b++]=0);for(v=a-1;P>x;){if(q[--P]=0;){for(b=0,we=Ot[C]%lt,Ae=Ot[C]/lt|0,L=F,O=C+L;O>C;)H=Ue[--L]%lt,q=Ue[L]/lt|0,x=Ae*H+q*we,H=we*H+x%lt*lt+Re[O]+b,b=(H/tt|0)+(x/lt|0)+Ae*q,Re[O--]=H%tt;Re[O]=b}return b?++P:Re.splice(0,1),fe(y,Re,P)},R.negated=function(){var y=new M(this);return y.s=-y.s||null,y},R.plus=function(y,v){var b,P=this,C=P.s;if(y=new M(y,v),v=y.s,!C||!v)return new M(NaN);if(C!=v)return y.s=-v,P.minus(y);var O=P.e/u,L=y.e/u,x=P.c,F=y.c;if(!O||!L){if(!x||!F)return new M(C/0);if(!x[0]||!F[0])return F[0]?y:new M(x[0]?P:C*0)}if(O=E(O),L=E(L),x=x.slice(),C=O-L){for(C>0?(L=O,b=F):(C=-C,b=x),b.reverse();C--;b.push(0));b.reverse()}for(C=x.length,v=F.length,C-v<0&&(b=F,F=x,x=b,v=C),C=0;v;)C=(x[--v]=x[v]+F[v]+C)/a|0,x[v]=a===x[v]?0:x[v]%a;return C&&(x=[C].concat(x),++L),fe(y,x,L)},R.precision=R.sd=function(y,v){var b,P,C,O=this;if(y!=null&&y!==!!y)return B(y,1,g),v==null?v=V:B(v,0,8),oe(new M(O),y,v);if(!(b=O.c))return null;if(C=b.length-1,P=C*u+1,C=b[C]){for(;C%10==0;C/=10,P--);for(C=b[0];C>=10;C/=10,P++);}return y&&O.e+1>P&&(P=O.e+1),P},R.shiftedBy=function(y){return B(y,-l,l),this.times("1e"+y)},R.squareRoot=R.sqrt=function(){var y,v,b,P,C,O=this,L=O.c,x=O.s,F=O.e,H=Q+4,q=new M("0.5");if(x!==1||!L||!L[0])return new M(!x||x<0&&(!L||L[0])?NaN:L?O:1/0);if(x=Math.sqrt(+ce(O)),x==0||x==1/0?(v=T(L),(v.length+F)%2==0&&(v+="0"),x=Math.sqrt(+v),F=E((F+1)/2)-(F<0||F%2),x==1/0?v="5e"+F:(v=x.toExponential(),v=v.slice(0,v.indexOf("e")+1)+F),b=new M(v)):b=new M(x+""),b.c[0]){for(F=b.e,x=F+H,x<3&&(x=0);;)if(C=b,b=q.times(C.plus(N(O,C,H,1))),T(C.c).slice(0,x)===(v=T(b.c)).slice(0,x))if(b.e0&&Re>0){for(O=Re%x||x,q=Ae.substr(0,O);O0&&(q+=H+Ae.slice(O)),we&&(q="-"+q)}P=Z?q+(b.decimalSeparator||"")+((F=+b.fractionGroupSize)?Z.replace(new RegExp("\\d{"+F+"}\\B","g"),"$&"+(b.fractionGroupSeparator||"")):Z):q}return(b.prefix||"")+P+(b.suffix||"")},R.toFraction=function(y){var v,b,P,C,O,L,x,F,H,q,Z,we,Ae=this,Re=Ae.c;if(y!=null&&(x=new M(y),!x.isInteger()&&(x.c||x.s!==1)||x.lt(J)))throw Error(s+"Argument "+(x.isInteger()?"out of range: ":"not an integer: ")+ce(x));if(!Re)return new M(Ae);for(v=new M(J),H=b=new M(J),P=F=new M(J),we=T(Re),O=v.e=we.length-Ae.e-1,v.c[0]=f[(L=O%u)<0?u+L:L],y=!y||x.comparedTo(v)>0?O>0?v:H:x,L=ue,ue=1/0,x=new M(we),F.c[0]=0;q=N(x,v,0,1),C=b.plus(q.times(P)),C.comparedTo(y)!=1;)b=P,P=C,H=F.plus(q.times(C=H)),F=C,v=x.minus(q.times(C=v)),x=C;return C=N(y.minus(b),P,0,1),F=F.plus(C.times(H)),b=b.plus(C.times(P)),F.s=H.s=Ae.s,O=O*2,Z=N(H,P,O,V).minus(Ae).abs().comparedTo(N(F,b,O,V).minus(Ae).abs())<1?[H,P]:[F,b],ue=L,Z},R.toNumber=function(){return+ce(this)},R.toPrecision=function(y,v){return y!=null&&B(y,1,g),le(this,y,v,2)},R.toString=function(y){var v,b=this,P=b.s,C=b.e;return C===null?P?(v="Infinity",P<0&&(v="-"+v)):v="NaN":(y==null?v=C<=k||C>=K?U(T(b.c),C):A(T(b.c),C,"0"):y===10?(b=oe(new M(b),Q+C+1,V),v=A(T(b.c),b.e,"0")):(B(y,2,ie.length,"Base"),v=_(A(T(b.c),C,"0"),10,y,P,!0)),P<0&&b.c[0]&&(v="-"+v)),v},R.valueOf=R.toJSON=function(){return ce(this)},R._isBigNumber=!0,I!=null&&M.set(I),M}function E(I){var N=I|0;return I>0||I===N?N:N-1}function T(I){for(var N,_,S=1,R=I.length,J=I[0]+"";SK^_?1:-1;for(V=(k=R.length)<(K=J.length)?k:K,Q=0;QJ[Q]^_?1:-1;return k==K?0:k>K^_?1:-1}function B(I,N,_,S){if(I_||I!==i(I))throw Error(s+(S||"Argument")+(typeof I=="number"?I_?" out of range: ":" not an integer: ":" not a primitive number: ")+String(I))}function W(I){var N=I.c.length-1;return E(I.e/u)==N&&I.c[N]%2!=0}function U(I,N){return(I.length>1?I.charAt(0)+"."+I.slice(1):I)+(N<0?"e":"e+")+N}function A(I,N,_){var S,R;if(N<0){for(R=_+".";++N;R+=_);I=R+I}else if(S=I.length,++N>S){for(R=_,N-=S;--N;R+=_);I+=R}else N{"use strict";c();Object.defineProperty(he,"__esModule",{value:!0});he.ErrIsCompletedFieldIsMissingOnTransaction=he.ErrGasLimitShouldBe0ForInnerTransaction=he.ErrInvalidRelayedV2BuilderArguments=he.ErrInvalidRelayedV1BuilderArguments=he.ErrNotImplemented=he.ErrContractInteraction=he.ErrCodec=he.ErrCannotParseTransactionOutcome=he.ErrCannotParseContractResults=he.ErrMissingFieldOnEnum=he.ErrMissingFieldOnStruct=he.ErrTypingSystem=he.ErrMock=he.ErrContractHasNoAddress=he.ErrContract=he.ErrExpectedTransactionEventsNotFound=he.ErrExpectedTransactionStatusNotReached=he.ErrTransactionWatcherTimeout=he.ErrAsyncTimerAborted=he.ErrAsyncTimerAlreadyRunning=he.ErrInvalidFunctionName=he.ErrSignatureCannotCreate=he.ErrTransactionOptionsInvalid=he.ErrTransactionVersionInvalid=he.ErrNonceInvalid=he.ErrNotEnoughGas=he.ErrAddressEmpty=he.ErrAddressBadHrp=he.ErrAddressCannotCreate=he.ErrUnexpectedCondition=he.ErrInvariantFailed=he.ErrBadType=he.ErrUnsupportedOperation=he.ErrInvalidArgument=he.Err=void 0;var De=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}};he.Err=De;var q0=class extends De{constructor(e,r){super(`Invalid argument: ${e}`,r)}};he.ErrInvalidArgument=q0;var V0=class extends De{constructor(e,r="not specified"){super(`Operation "${e}" not supported. Reason: ${r}`)}};he.ErrUnsupportedOperation=V0;var H0=class extends De{constructor(e,r,n){super(`Bad type of "${e}": ${n}. Expected type: ${r}`)}};he.ErrBadType=H0;var G0=class extends De{constructor(e){super(`Invariant failed: [${e}]`)}};he.ErrInvariantFailed=G0;var k0=class extends De{constructor(e){super(`Unexpected condition: [${e}]`)}};he.ErrUnexpectedCondition=k0;var j0=class extends De{constructor(e,r){let n=`Cannot create address from: ${e}`;super(n,r)}};he.ErrAddressCannotCreate=j0;var Q0=class extends De{constructor(e,r){super(`Wrong address HRP. Expected: ${e}, got ${r}`)}};he.ErrAddressBadHrp=Q0;var W0=class extends De{constructor(){super("Address is empty")}};he.ErrAddressEmpty=W0;var $0=class extends De{constructor(e){super(`Not enough gas provided: ${e}`)}};he.ErrNotEnoughGas=$0;var z0=class extends De{constructor(e){super(`Invalid nonce: ${e}`)}};he.ErrNonceInvalid=z0;var K0=class extends De{constructor(e){super(`Invalid transaction version: ${e}`)}};he.ErrTransactionVersionInvalid=K0;var Y0=class extends De{constructor(e){super(`Invalid transaction options: ${e}`)}};he.ErrTransactionOptionsInvalid=Y0;var J0=class extends De{constructor(e,r){let n=`Cannot create signature from: ${e}`;super(n,r)}};he.ErrSignatureCannotCreate=J0;var X0=class extends De{constructor(){super("Invalid function name")}};he.ErrInvalidFunctionName=X0;var Z0=class extends De{constructor(){super("Async timer already running")}};he.ErrAsyncTimerAlreadyRunning=Z0;var em=class extends De{constructor(){super("Async timer aborted")}};he.ErrAsyncTimerAborted=em;var tm=class extends De{constructor(){super("TransactionWatcher has timed out")}};he.ErrTransactionWatcherTimeout=tm;var rm=class extends De{constructor(){super("Expected transaction status not reached")}};he.ErrExpectedTransactionStatusNotReached=rm;var nm=class extends De{constructor(){super("Expected transaction events not found")}};he.ErrExpectedTransactionEventsNotFound=nm;var rf=class extends De{constructor(e){super(e)}};he.ErrContract=rf;var im=class extends rf{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=$0;var K0=class extends Re{constructor(e){super(e)}};pe.ErrMock=K0;var Y0=class extends Re{constructor(e){super(e)}};pe.ErrTypingSystem=Y0;var J0=class extends Re{constructor(e,r){super(`field ${e} does not exist on struct ${r}`)}};pe.ErrMissingFieldOnStruct=J0;var X0=class extends Re{constructor(e,r){super(`field ${e} does not exist on enum ${r}`)}};pe.ErrMissingFieldOnEnum=X0;var Z0=class extends Re{constructor(e){super(`cannot parse contract results: ${e}`)}};pe.ErrCannotParseContractResults=Z0;var em=class extends Re{constructor(e,r){super(`cannot parse outcome of transaction ${e}: ${r}`)}};pe.ErrCannotParseTransactionOutcome=em;var tm=class extends Re{constructor(e){super(e)}};pe.ErrCodec=tm;var rm=class extends Re{constructor(e){super(e)}};pe.ErrContractInteraction=rm;var nm=class extends Re{constructor(){super("Method not yet implemented")}};pe.ErrNotImplemented=nm;var im=class extends Re{constructor(){super("invalid arguments for relayed v1 builder")}};pe.ErrInvalidRelayedV1BuilderArguments=im;var sm=class extends Re{constructor(){super("invalid arguments for relayed v2 builder")}};pe.ErrInvalidRelayedV2BuilderArguments=sm;var om=class extends Re{constructor(){super("gas limit must be 0 for the inner transaction for relayed v2")}};pe.ErrGasLimitShouldBe0ForInnerTransaction=om});var um=m(ci=>{"use strict";c();var d5=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 Iu=d5(Gt()),p5=Be(),eS="EGLD",tS=18;Iu.default.set({ROUNDING_MODE:1});var Yl=class t{constructor(e){let r=new Iu.default(e.amountAsBigInteger);if(!r.isInteger()||r.isNegative())throw new p5.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 Iu.default(e).shiftedBy(tS).decimalPlaces(0);return this.egldFromBigInteger(r)}static egldFromBigInteger(e){return new t({tokenIdentifier:eS,nonce:0,amountAsBigInteger:e,numDecimals:tS})}static fungibleFromAmount(e,r,n){let i=new Iu.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 Iu.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==eS}isFungible(){return this.nonce==0}};ci.TokenTransfer=Yl;var am=class extends Yl{constructor(e,r,n,i){super({tokenIdentifier:e,nonce:r,amountAsBigInteger:n,numDecimals:i})}};ci.TokenPayment=am});var ms=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(nt=>{"use strict";c();var g5=nt&&nt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.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=nt&&nt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),m5=nt&&nt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&g5(e,t,r);return y5(e,t),e};Object.defineProperty(nt,"__esModule",{value:!0});nt.isEmpty=nt.guardEmpty=nt.guardNotEmpty=nt.guardLength=nt.guardSameLength=nt.guardValueIsSetWithMessage=nt.guardValueIsSet=nt.guardTrue=void 0;var go=m5(Be());function w5(t,e){if(!t)throw new go.ErrInvariantFailed(`[<${e}>] isn't true`)}nt.guardTrue=w5;function E5(t,e){rS(`${t} isn't set (null or undefined)`,e)}nt.guardValueIsSet=E5;function rS(t,e){if(e==null||e===void 0)throw new go.ErrInvariantFailed(t)}nt.guardValueIsSetWithMessage=rS;function v5(t,e){if(t=t||[],e=e||[],t.length!=e.length)throw new go.ErrInvariantFailed("arrays do not have the same length")}nt.guardSameLength=v5;function A5(t,e){let r=t.length||0;if(r!=e)throw new go.ErrInvariantFailed(`wrong length, expected: ${e}, actual: ${r}`)}nt.guardLength=A5;function b5(t,e){if(cm(t))throw new go.ErrInvariantFailed(`${e} is empty`)}nt.guardNotEmpty=b5;function _5(t,e){if(!cm(t))throw new go.ErrInvariantFailed(`${e} is not empty`)}nt.guardEmpty=_5;function cm(t){return t.isEmpty?t.isEmpty():t.length===0}nt.isEmpty=cm});var nS=m(Jl=>{"use strict";c();Object.defineProperty(Jl,"__esModule",{value:!0});Jl.getJavascriptPrototypesInHierarchy=void 0;function I5(t,e){let r=[],n=Object.getPrototypeOf(t);for(;n&&e(n);)r.push(n),n=Object.getPrototypeOf(n);return r}Jl.getJavascriptPrototypesInHierarchy=I5});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 lm=nS(),iS=gr(),li=class t{constructor(e,r=[],n=Su.fixed(1)){iS.guardValueIsSet("name",e),this.name=e,this.typeParameters=r,this.cardinality=n}getName(){return this.name}getClassName(){return t.ClassName}getClassHierarchy(){return lm.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 iS.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 lm.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 Su=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=Su;Su.MaxCardinality=4096;var Xl=class t extends li{constructor(e){super(e)}getClassName(){return t.ClassName}};bt.PrimitiveType=Xl;Xl.ClassName="PrimitiveType";var Zl=class t extends li{getClassName(){return t.ClassName}};bt.CustomType=Zl;Zl.ClassName="CustomType";var Tu=class t{constructor(e){this.type=e}getClassName(){return t.ClassName}getClassHierarchy(){return lm.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=Tu;Tu.ClassName="TypedValue";var ef=class t extends Tu{constructor(e){super(e)}getClassName(){return t.ClassName}};bt.PrimitiveValue=ef;ef.ClassName="PrimitiveValue";function S5(t){return t.belongsToTypesystem!==void 0}bt.isTyped=S5;var tf=class t extends li{constructor(){super("...")}getClassName(){return t.ClassName}};bt.TypePlaceholder=tf;tf.ClassName="TypePlaceholder";var rf=class t extends li{constructor(){super("?")}getClassName(){return t.ClassName}};bt.NullType=rf;rf.ClassName="NullType"});var sS=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,w="-",E=/^xn--/,x=/[^\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 T(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 G(Y,se){return Y+22+75*(Y<26)-((se!=0)<<5)}function j(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,v,A,P,C,D;for(fe=Y.lastIndexOf(w),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)/v))&&B("overflow"),q+=P*v,C=A<=ae?a:A>=ae+u?u:A-ae,!(PI(s/D)&&B("overflow"),v*=D;ie=se.length+1,ae=j(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,v,A=[],P,C,D,M;for(Y=L(Y),P=Y.length,se=g,te=0,le=d,ae=0;ae=se&&vI((s-te)/C)&&B("overflow"),te+=(fe-se)*C,se=fe,ae=0;aes&&B("overflow"),v==se){for(oe=te,ce=o;y=ce<=le?a:ce>=le+u?u:ce-le,!(oe{"use strict";c();var aS=sS();function T5(t,e){this.__proto__=new Error(e),this.__proto__.name="BackslashError",this.offset=t}function fm(t){return t>="0"&&t<="7"}function C5(t){return t>="0"&&t<="9"||t>="a"&&t<="f"||t>="A"&&t<="F"}function oS(t){return t=parseInt(t,16),aS.ucs2.encode([t])}function uS(t,e,r){var n=!1,i=[];function s(u){var l=t[u];if(!C5(l))throw new T5(u,"Unexpected token ILLEGAL");return l}for(;e{c();var hS=cS();gS.exports={validate:x5,parse:N5};function x5(t,e){var r;if(e=e||!1,typeof t!="string")r="Input must be a string";else try{nf(t,0,e,!1)}catch(n){r=n.message}return r}function N5(t,e){if(typeof t!="string")throw new Error("Input must be a string");e=e||!1;var r=nf(t,0,e,!0);return r.value}function dS(t,e){for(var r=t.length,n=e,i,s=e;s-1&&t[r]==="\\";)n++,r--;return n%2===0}function R5(t,e,r,n){for(var i=e,s=",",o=[],a=e;ws(t[a]);)a++;if(t[a]==="]")return{start:e,end:a,value:o};for(;s===",";){var u=nf(t,i,r,n),l=dS(t,u.end);n&&o.push(u.value),i=l.end,s=l.value}return{start:e,end:i,value:o}}function B5(t,e){return t.substr(e,4)==="true"}function L5(t,e){return t.substr(e,5)==="false"}function F5(t,e){return t.substr(e,4)==="null"}var M5=new RegExp(/^\s$/);function ws(t){return M5.test(t)}var U5=new RegExp(/^\d$/);function lS(t){return U5.test(t)}function Un(t,e,r){var n=10,i;t.length{"use strict";c();var q5=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]}),V5=tn&&tn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),H5=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)&&q5(e,t,r);return V5(e,t),e};Object.defineProperty(tn,"__esModule",{value:!0});tn.TypeExpressionParser=void 0;var mS=H5(Be()),G5=_t(),j5=yS(),dm=class{parse(e){let r=this.doParse(e),n=Object.keys(r);if(n.length!=1)throw new mS.ErrTypingSystem(`bad type expression: ${e}`);let i=n[0];return this.nodeToType(i,r[i])}doParse(e){let r=this.getJsonedString(e);try{return j5.parse(r)}catch{throw new mS.ErrTypingSystem(`cannot parse type expression: ${e}. internal json: ${r}.`)}}getJsonedString(e){let r="";for(var n=0;n"?a!=">"?r+=": {} }":r+="}":o==","?u==">"||(a==">"?r+=",":r+=": {},"):r+=o}let i=/(:|\{|\}|,|\s)/,s=r.replace(/utf\-8\sstring/ig,"utf-8-string").split(i).filter(o=>o);return r=s.map(o=>i.test(o)?o:`"${o}"`).map(o=>o.replace(/utf\-8\-string/ig,"utf-8 string")).join(""),s.length==1?`{${r}: {}}`:`{${r}}`}nodeToType(e,r){e.charAt(e.length-1)==="1"&&(e=e.slice(0,-1));let n=Object.keys(r).map(i=>this.nodeToType(i,r[i]));return new G5.Type(e,n)}};tn.TypeExpressionParser=dm});var gm=m(fi=>{"use strict";c();Object.defineProperty(fi,"__esModule",{value:!0});fi.EndpointParameterDefinition=fi.EndpointModifiers=fi.EndpointDefinition=void 0;var k5=sf(),wS="?",Q5="N / A",pm=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?wS:e.name,e.payableInTokens=e.payableInTokens||[],e.inputs=e.inputs||[],e.outputs=e.outputs||[];let r=e.inputs.map(s=>Cu.fromJSON(s)),n=e.outputs.map(s=>Cu.fromJSON(s)),i=new of(e.mutability,e.payableInTokens);return new t(e.name,r,n,i)}};fi.EndpointDefinition=pm;var of=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=of;var Cu=class t{constructor(e,r,n){this.name=e,this.description=r,this.type=n}static fromJSON(e){let r=new k5.TypeExpressionParser().parse(e.type);return new t(e.name||wS,e.description||Q5,r)}};fi.EndpointParameterDefinition=Cu});var wo=m(sr=>{"use strict";c();var W5=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]}),z5=sr&&sr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$5=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)&&W5(e,t,r);return z5(e,t),e};Object.defineProperty(sr,"__esModule",{value:!0});sr.Fields=sr.Field=sr.FieldDefinition=void 0;var ym=$5(Be()),K5=sf(),mm=class t{constructor(e,r,n){this.name=e,this.description=r,this.type=n}static fromJSON(e){let r=new K5.TypeExpressionParser().parse(e.type);return new t(e.name,e.description,r)}};sr.FieldDefinition=mm;var wm=class{constructor(e,r=""){this.value=e,this.name=r}checkTyping(e){let r=this.value.getType();if(!r.equals(e.type))throw new ym.ErrTypingSystem(`check type of field "${e.name}; expected: ${e.type}, actual: ${r}"`);if(this.name!=e.name)throw new ym.ErrTypingSystem(`check name of field "${e.name}"`)}equals(e){return this.name==e.name&&this.value.equals(e.value)}};sr.Field=wm;var Em=class{static checkTyping(e,r){if(e.length!=r.length)throw new ym.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 Y5=Be(),vm=gr(),af=wo(),vS=_t(),ES=256,uf=class t extends vS.CustomType{constructor(e,r){super(e),this.variants=[],this.variants=r}getClassName(){return t.ClassName}static fromJSON(e){let r=(e.variants||[]).map(n=>cf.fromJSON(n));return new t(e.name,r)}getVariantByDiscriminant(e){let r=this.variants.find(n=>n.discriminant==e);return vm.guardValueIsSet(`variant by discriminant (${e})`,r),r}getVariantByName(e){let r=this.variants.find(n=>n.name==e);return vm.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=uf;uf.ClassName="EnumType";var cf=class t{constructor(e,r,n=[]){this.fieldsDefinitions=[],vm.guardTrue(raf.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 af.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};hi.EnumVariantDefinition=cf;var lf=class t extends vS.TypedValue{constructor(e,r,n){super(e),this.fields=[],this.name=r.name,this.discriminant=r.discriminant,this.fields=n,this.fieldsByName=new Map(n.map(s=>[s.name,s]));let i=r.getFieldsDefinitions();af.Fields.checkTyping(this.fields,i)}getClassName(){return 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=af.Fields.equals(r,n);return i&&s&&o}getFields(){return this.fields}getFieldValue(e){let r=this.fieldsByName.get(e);if(r)return r.value.valueOf();throw new Y5.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=lf;lf.ClassName="EnumValue"});var vo=m(Eo=>{"use strict";c();Object.defineProperty(Eo,"__esModule",{value:!0});Eo.Struct=Eo.StructType=void 0;var J5=Be(),ff=wo(),AS=_t(),hf=class t extends AS.CustomType{constructor(e,r){super(e),this.fieldsDefinitions=[],this.fieldsDefinitions=r}getClassName(){return t.ClassName}static fromJSON(e){let r=(e.fields||[]).map(n=>ff.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 ff.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};Eo.StructType=hf;hf.ClassName="StructType";var df=class t extends AS.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();ff.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 J5.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 ff.Fields.equals(r,n)}};Eo.Struct=df;df.ClassName="Struct"});var bm=m((cie,IS)=>{"use strict";c();var gf="qpzry9x8gf2tvdw0s3jn54khce6mua7l",Am={};for(Nu=0;Nu>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 bS(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=bS(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+=gf.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+=gf.charAt(a)}return i}function _S(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=bS(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 Z5(){var t=_S.apply(null,arguments);if(typeof t=="object")return t}function e4(t){var e=_S.apply(null,arguments);if(typeof e=="object")return e;throw new Error(e)}function yf(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 s4=rn&&rn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),o4=rn&&rn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SS=rn&&rn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&s4(e,t,r);return o4(e,t),e};Object.defineProperty(rn,"__esModule",{value:!0});rn.Address=void 0;var mf=SS(bm()),bo=SS(Be()),_m="erd",Im=32,a4="0".repeat(16),Sm=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!=Im)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==Im}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=mf.decode(e)}catch(s){throw new bo.ErrAddressCannotCreate(e,s)}let n=r.prefix;if(n!=_m)throw new bo.ErrAddressBadHrp(_m,n);let i=h.Buffer.from(mf.fromWords(r.words));if(i.length!=Im)throw new bo.ErrAddressCannotCreate(e);return t.fromValidHex(i.toString("hex"))}hex(){return this.isEmpty()?"":this.valueHex}bech32(){if(this.isEmpty())return"";let e=mf.toWords(this.pubkey());return mf.encode(_m,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(a4)}};rn.Address=Sm});var Io=m(_o=>{"use strict";c();Object.defineProperty(_o,"__esModule",{value:!0});_o.AddressValue=_o.AddressType=void 0;var u4=ht(),TS=_t(),Ou=class t extends TS.PrimitiveType{constructor(){super("Address")}getClassName(){return t.ClassName}};_o.AddressType=Ou;Ou.ClassName="AddressType";var wf=class t extends TS.PrimitiveValue{constructor(e){super(new Ou),this.value=new u4.Address(e.bech32())}getClassName(){return t.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};_o.AddressValue=wf;wf.ClassName="AddressValue"});var vf=m(So=>{"use strict";c();Object.defineProperty(So,"__esModule",{value:!0});So.OptionalValue=So.OptionalType=void 0;var c4=gr(),Du=_t(),Pu=class t extends Du.Type{constructor(e){super("Optional",[e],Du.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(Du.NullType.ClassName);return r||n}};So.OptionalType=Pu;Pu.ClassName="OptionalType";var Ef=class t extends Du.TypedValue{constructor(e,r=null){super(e),this.value=r}getClassName(){return t.ClassName}static newMissing(){let e=new Pu(new Du.NullType);return new t(e)}isSet(){return!!this.value}getTypedValue(){return c4.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=Ef;Ef.ClassName="OptionalValue"});var Bu=m(To=>{"use strict";c();Object.defineProperty(To,"__esModule",{value:!0});To.BooleanValue=To.BooleanType=void 0;var CS=_t(),Ru=class t extends CS.PrimitiveType{constructor(){super("bool")}getClassName(){return t.ClassName}};To.BooleanType=Ru;Ru.ClassName="BooleanType";var Af=class t extends CS.PrimitiveValue{constructor(e){super(new Ru),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}};To.BooleanValue=Af;Af.ClassName="BooleanValue"});var di=m(Co=>{"use strict";c();Object.defineProperty(Co,"__esModule",{value:!0});Co.BytesValue=Co.BytesType=void 0;var xS=_t(),Lu=class t extends xS.PrimitiveType{constructor(){super("bytes")}getClassName(){return t.ClassName}};Co.BytesType=Lu;Lu.ClassName="BytesType";var bf=class t extends xS.PrimitiveValue{constructor(e){super(new Lu),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()}};Co.BytesValue=bf;bf.ClassName="BytesValue"});var OS=m(xo=>{"use strict";c();Object.defineProperty(xo,"__esModule",{value:!0});xo.CodeMetadataValue=xo.CodeMetadataType=void 0;var NS=_t(),_f=class extends NS.PrimitiveType{constructor(){super("CodeMetadata")}};xo.CodeMetadataType=_f;var Tm=class extends NS.PrimitiveValue{constructor(e){super(new _f),this.value=e}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};xo.CodeMetadataValue=Tm});var Sf=m(No=>{"use strict";c();Object.defineProperty(No,"__esModule",{value:!0});No.CompositeValue=No.CompositeType=void 0;var l4=gr(),Cm=_t(),Fu=class t extends Cm.Type{constructor(...e){super("Composite",e,Cm.TypeCardinality.variable(e.length))}getClassName(){return t.ClassName}};No.CompositeType=Fu;Fu.ClassName="CompositeType";var If=class t extends Cm.TypedValue{constructor(e,r){super(e),l4.guardLength(r,e.getTypeParameters().length),this.items=r}getClassName(){return t.ClassName}static fromItems(...e){let r=e.map(i=>i.getType()),n=new Fu(...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(Tf,"__esModule",{value:!0});Tf.CollectionOfTypedValues=void 0;var xm=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(nn,"__esModule",{value:!0});nn.List=nn.OptionValue=nn.ListType=nn.OptionType=void 0;var f4=gr(),h4=Nm(),vs=_t(),Es=class t extends vs.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(vs.NullType.ClassName);return r||n}};nn.OptionType=Es;Es.ClassName="OptionType";var Mu=class t extends vs.Type{constructor(e){super("List",[e])}getClassName(){return t.ClassName}};nn.ListType=Mu;Mu.ClassName="ListType";var Cf=class t extends vs.TypedValue{constructor(e,r=null){super(e),this.value=r}getClassName(){return t.ClassName}static newMissing(){let e=new Es(new vs.NullType);return new t(e)}static newMissingTyped(e){return new t(new Es(e))}static newProvided(e){let r=new Es(e.getType());return new t(r,e)}isSet(){return!!this.value}getTypedValue(){return f4.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}};nn.OptionValue=Cf;Cf.ClassName="OptionValue";var xf=class t extends vs.TypedValue{constructor(e,r){super(e),this.backingCollection=new h4.CollectionOfTypedValues(r)}getClassName(){return t.ClassName}static fromItems(e){if(e.length==0)return new t(new vs.TypePlaceholder,[]);let r=e[0].getType(),n=new Mu(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)}};nn.List=xf;xf.ClassName="List"});var Df=m(Oo=>{"use strict";c();Object.defineProperty(Oo,"__esModule",{value:!0});Oo.ArrayVec=Oo.ArrayVecType=void 0;var DS=gr(),d4=Nm(),PS=_t(),Nf=class t extends PS.Type{constructor(e,r){super("Array",[r]),DS.guardTrue(e>0,"array length > 0"),this.length=e}getClassName(){return t.ClassName}};Oo.ArrayVecType=Nf;Nf.ClassName="ArrayVecType";var Of=class t extends PS.TypedValue{constructor(e,r){super(e),DS.guardLength(r,e.length),this.backingCollection=new d4.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=Of;Of.ClassName="ArrayVec"});var Vu=m(Do=>{"use strict";c();Object.defineProperty(Do,"__esModule",{value:!0});Do.H256Value=Do.H256Type=void 0;var RS=_t(),qu=class t extends RS.PrimitiveType{constructor(){super("H256")}getClassName(){return t.ClassName}};Do.H256Type=qu;qu.ClassName="H256Type";var Pf=class t extends RS.PrimitiveValue{constructor(e){super(new qu),this.value=e}getClassName(){return t.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};Do.H256Value=Pf;Pf.ClassName="H256Value"});var Bf=m(Po=>{"use strict";c();Object.defineProperty(Po,"__esModule",{value:!0});Po.NothingValue=Po.NothingType=void 0;var BS=_t(),Hu=class t extends BS.PrimitiveType{constructor(){super("nothing")}getClassName(){return t.ClassName}};Po.NothingType=Hu;Hu.ClassName="NothingType";var Rf=class t extends BS.PrimitiveValue{constructor(){super(new Hu)}getClassName(){return t.ClassName}equals(e){return!1}valueOf(){return{}}};Po.NothingValue=Rf;Rf.ClassName="NothingValue"});var Xu=m(Ie=>{"use strict";c();var p4=Ie&&Ie.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),g4=Ie&&Ie.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),y4=Ie&&Ie.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&p4(e,t,r);return g4(e,t),e},m4=Ie&&Ie.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ie,"__esModule",{value:!0});Ie.BigIntValue=Ie.BigUIntValue=Ie.I64Value=Ie.U64Value=Ie.I32Value=Ie.U32Value=Ie.I16Value=Ie.U16Value=Ie.I8Value=Ie.U8Value=Ie.NumericalValue=Ie.BigIntType=Ie.BigUIntType=Ie.I64Type=Ie.U64Type=Ie.I32Type=Ie.U32Type=Ie.I16Type=Ie.U16Type=Ie.I8Type=Ie.U8Type=Ie.NumericalType=void 0;var LS=y4(Be()),FS=_t(),As=m4(Gt()),or=class t extends FS.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()}};Ie.NumericalType=or;or.ClassName="NumericalType";var Gu=class t extends or{constructor(){super("u8",1,!1)}getClassName(){return t.ClassName}};Ie.U8Type=Gu;Gu.ClassName="U8Type";var ju=class t extends or{constructor(){super("i8",1,!0)}getClassName(){return t.ClassName}};Ie.I8Type=ju;ju.ClassName="I8Type";var ku=class t extends or{constructor(){super("u16",2,!1)}getClassName(){return t.ClassName}};Ie.U16Type=ku;ku.ClassName="U16Type";var Qu=class t extends or{constructor(){super("i16",2,!0)}getClassName(){return t.ClassName}};Ie.I16Type=Qu;Qu.ClassName="I16Type";var Wu=class t extends or{constructor(){super("u32",4,!1)}getClassName(){return t.ClassName}};Ie.U32Type=Wu;Wu.ClassName="U32Type";var zu=class t extends or{constructor(){super("i32",4,!0)}getClassName(){return t.ClassName}};Ie.I32Type=zu;zu.ClassName="I32Type";var $u=class t extends or{constructor(){super("u64",8,!1)}getClassName(){return t.ClassName}};Ie.U64Type=$u;$u.ClassName="U64Type";var Ku=class t extends or{constructor(){super("i64",8,!0)}getClassName(){return t.ClassName}};Ie.I64Type=Ku;Ku.ClassName="I64Type";var Yu=class t extends or{constructor(){super("BigUint",0,!1)}getClassName(){return t.ClassName}};Ie.BigUIntType=Yu;Yu.ClassName="BigUIntType";var Ju=class t extends or{constructor(){super("Bigint",0,!0)}getClassName(){return t.ClassName}};Ie.BigIntType=Ju;Ju.ClassName="BigIntType";var ar=class t extends FS.PrimitiveValue{constructor(e,r){if(super(e),this.value=new As.default(r),this.sizeInBytes=e.sizeInBytes,this.withSign=e.withSign,this.value.isNaN())throw new LS.ErrInvalidArgument(`not a number: ${r}`);if(!this.withSign&&this.value.isNegative())throw new LS.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()}};Ie.NumericalValue=ar;ar.ClassName="NumericalValue";var Lf=class t extends ar{constructor(e){super(new Gu,new As.default(e))}getClassName(){return t.ClassName}};Ie.U8Value=Lf;Lf.ClassName="U8Value";var Ff=class t extends ar{constructor(e){super(new ju,new As.default(e))}getClassName(){return t.ClassName}};Ie.I8Value=Ff;Ff.ClassName="I8Value";var Mf=class t extends ar{constructor(e){super(new ku,new As.default(e))}getClassName(){return t.ClassName}};Ie.U16Value=Mf;Mf.ClassName="U16Value";var Uf=class t extends ar{constructor(e){super(new Qu,new As.default(e))}getClassName(){return t.ClassName}};Ie.I16Value=Uf;Uf.ClassName="I16Value";var qf=class t extends ar{constructor(e){super(new Wu,new As.default(e))}getClassName(){return t.ClassName}};Ie.U32Value=qf;qf.ClassName="U32Value";var Vf=class t extends ar{constructor(e){super(new zu,new As.default(e))}getClassName(){return t.ClassName}};Ie.I32Value=Vf;Vf.ClassName="I32Value";var Hf=class t extends ar{constructor(e){super(new $u,e)}getClassName(){return t.ClassName}};Ie.U64Value=Hf;Hf.ClassName="U64Value";var Gf=class t extends ar{constructor(e){super(new Ku,e)}getClassName(){return t.ClassName}};Ie.I64Value=Gf;Gf.ClassName="I64Value";var jf=class t extends ar{constructor(e){super(new Yu,e)}getClassName(){return t.ClassName}};Ie.BigUIntValue=jf;jf.ClassName="BigUIntValue";var kf=class t extends ar{constructor(e){super(new Ju,e)}getClassName(){return t.ClassName}};Ie.BigIntValue=kf;kf.ClassName="BigIntValue"});var Wf=m(Ro=>{"use strict";c();Object.defineProperty(Ro,"__esModule",{value:!0});Ro.StringValue=Ro.StringType=void 0;var MS=_t(),Zu=class t extends MS.PrimitiveType{constructor(){super("utf-8 string")}getClassName(){return t.ClassName}};Ro.StringType=Zu;Zu.ClassName="StringType";var Qf=class t extends MS.PrimitiveValue{constructor(e){super(new Zu),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=Qf;Qf.ClassName="StringValue"});var Lo=m(Bo=>{"use strict";c();Object.defineProperty(Bo,"__esModule",{value:!0});Bo.TokenIdentifierValue=Bo.TokenIdentifierType=void 0;var US=_t(),w4="EGLD",ec=class t extends US.PrimitiveType{constructor(){super("TokenIdentifier")}getClassName(){return t.ClassName}};Bo.TokenIdentifierType=ec;ec.ClassName="TokenIdentifierType";var zf=class t extends US.PrimitiveValue{constructor(e){super(new ec),this.value=e}static egld(){return new t(w4)}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=zf;zf.ClassName="TokenIdentifierValue"});var Kf=m(_r=>{"use strict";c();var E4=_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]}),v4=_r&&_r.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),A4=_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)&&E4(e,t,r);return v4(e,t),e};Object.defineProperty(_r,"__esModule",{value:!0});_r.Tuple=_r.TupleType=void 0;var b4=A4(Be()),qS=wo(),VS=vo(),tc=class t extends VS.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 qS.FieldDefinition(HS(i),"anonymous tuple field",n))}};_r.TupleType=tc;tc.ClassName="TupleType";function HS(t){return`field${t}`}var $f=class t extends VS.Struct{constructor(e,r){super(e,r)}getClassName(){return t.ClassName}static fromItems(e){if(e.length<1)throw new b4.ErrTypingSystem("bad tuple items");let r=e.map(s=>s.getType()),n=new tc(...r),i=e.map((s,o)=>new qS.Field(s,HS(o)));return new t(n,i)}};_r.Tuple=$f;$f.ClassName="Tuple"});var Xf=m(Mo=>{"use strict";c();Object.defineProperty(Mo,"__esModule",{value:!0});Mo.VariadicValue=Mo.VariadicType=void 0;var Yf=_t(),Fo=class t extends Yf.Type{constructor(e){super("Variadic",[e],Yf.TypeCardinality.variable())}getClassName(){return t.ClassName}};Mo.VariadicType=Fo;Fo.ClassName="VariadicType";var Jf=class t extends Yf.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 Yf.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 _4=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]}),I4=sn&&sn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),S4=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)&&_4(e,t,r);return I4(e,t),e};Object.defineProperty(sn,"__esModule",{value:!0});sn.TypeMapper=void 0;var GS=S4(Be()),T4=Io(),Om=vf(),C4=Bu(),x4=di(),N4=OS(),Zf=Sf(),Dm=xu(),O4=wo(),jS=Uu(),pi=Df(),D4=Vu(),kS=Bf(),Ir=Xu(),P4=Wf(),QS=vo(),WS=Lo(),gi=Kf(),Pm=Xf(),Rm=class{constructor(e=[]){this.openTypesFactories=new Map([["Option",(...r)=>new jS.OptionType(r[0])],["List",(...r)=>new jS.ListType(r[0])],["VarArgs",(...r)=>new Pm.VariadicType(r[0])],["MultiResultVec",(...r)=>new Pm.VariadicType(r[0])],["variadic",(...r)=>new Pm.VariadicType(r[0])],["OptionalArg",(...r)=>new Om.OptionalType(r[0])],["optional",(...r)=>new Om.OptionalType(r[0])],["OptionalResult",(...r)=>new Om.OptionalType(r[0])],["multi",(...r)=>new Zf.CompositeType(...r)],["MultiArg",(...r)=>new Zf.CompositeType(...r)],["MultiResult",(...r)=>new Zf.CompositeType(...r)],["multi",(...r)=>new Zf.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 C4.BooleanType],["bytes",new x4.BytesType],["Address",new T4.AddressType],["H256",new D4.H256Type],["utf-8 string",new P4.StringType],["TokenIdentifier",new WS.TokenIdentifierType],["EgldOrEsdtTokenIdentifier",new WS.TokenIdentifierType],["CodeMetadata",new N4.CodeMetadataType],["nothing",new kS.NothingType],["AsyncCall",new kS.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 GS.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(Dm.EnumType.ClassName)?this.mapEnumType(e):e.hasExactClass(QS.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 QS.StructType(e.getName(),r)}mapEnumType(e){let r=e.variants.map(i=>new Dm.EnumVariantDefinition(i.name,i.discriminant,this.mappedFields(i.getFieldsDefinitions())));return new Dm.EnumType(e.getName(),r)}mappedFields(e){return e.map(r=>new O4.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 GS.ErrTypingSystem(`Cannot map the generic type "${e.getName()}" to a known type`);return i(...n)}};sn.TypeMapper=Rm});var JS=m(on=>{"use strict";c();var R4=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]}),B4=on&&on.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),L4=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)&&R4(e,t,r);return B4(e,t),e};Object.defineProperty(on,"__esModule",{value:!0});on.AbiRegistry=void 0;var zS=L4(Be()),Lm=gr(),rc=gm(),$S=xu(),KS=vo(),F4=Bm(),M4="?",Fm=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||M4,n=e.constructor||{},i=e.endpoints||[],s=e.types||{},o=rc.EndpointDefinition.fromJSON(Object.assign({name:"constructor"},n)),a=i.map(d=>rc.EndpointDefinition.fromJSON(d)),u=[];for(let d in s){let g=s[d];if(g.type=="struct")u.push(KS.StructType.fromJSON({name:d,fields:g.fields}));else if(g.type=="enum")u.push($S.EnumType.fromJSON({name:d,variants:g.variants}));else throw new zS.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(KS.StructType.ClassName));return Lm.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($S.EnumType.ClassName));return Lm.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 Lm.guardValueIsSetWithMessage(`endpoint [${e}] not found`,r),r}remapToKnownTypes(){let e=new F4.TypeMapper([]),r=[];for(let o of this.customTypes)this.mapCustomTypeDepthFirst(o,this.customTypes,e,r);if(this.customTypes.length!=r.length)throw new zS.ErrTypingSystem("Did not re-map all custom types");let n=YS(this.constructorDefinition,e),i=[];for(let o of this.endpoints)i.push(YS(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)}};on.AbiRegistry=Fm;function YS(t,e){let r=t.input.map(i=>new rc.EndpointParameterDefinition(i.name,i.description,e.mapType(i.type))),n=t.output.map(i=>new rc.EndpointParameterDefinition(i.name,i.description,e.mapType(i.type)));return new rc.EndpointDefinition(t.name,r,n,t.modifiers)}});var ZS=m(Uo=>{"use strict";c();Object.defineProperty(Uo,"__esModule",{value:!0});Uo.createListOfTokenIdentifiers=Uo.createListOfAddresses=void 0;var U4=Io(),XS=Uu(),q4=Lo();function V4(t){let e=t.map(n=>new U4.AddressValue(n));return XS.List.fromItems(e)}Uo.createListOfAddresses=V4;function H4(t){let e=t.map(n=>new q4.TokenIdentifierValue(n));return XS.List.fromItems(e)}Uo.createListOfTokenIdentifiers=H4});var dT=m(zt=>{"use strict";c();var G4=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]}),j4=zt&&zt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),k4=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)&&G4(e,t,r);return j4(e,t),e};Object.defineProperty(zt,"__esModule",{value:!0});zt.onPrimitiveTypeSelect=zt.onPrimitiveValueSelect=zt.onTypedValueSelect=zt.onTypeSelect=void 0;var th=k4(Be()),eT=Io(),tT=Bu(),rT=di(),nT=xu(),eh=Uu(),iT=Vu(),sT=Xu(),oT=Bf(),aT=vo(),uT=Lo(),cT=Kf(),lT=_t(),fT=Df(),hT=Wf();function Q4(t,e){if(t.hasExactClass(eh.OptionType.ClassName))return e.onOption();if(t.hasExactClass(eh.ListType.ClassName))return e.onList();if(t.hasExactClass(fT.ArrayVecType.ClassName))return e.onArray();if(t.hasClassOrSuperclass(lT.PrimitiveType.ClassName))return e.onPrimitive();if(t.hasExactClass(aT.StructType.ClassName))return e.onStruct();if(t.hasExactClass(cT.TupleType.ClassName))return e.onTuple();if(t.hasExactClass(nT.EnumType.ClassName))return e.onEnum();if(e.onOther)return e.onOther();throw new th.ErrTypingSystem(`type isn't known: ${t}`)}zt.onTypeSelect=Q4;function W4(t,e){if(t.hasClassOrSuperclass(lT.PrimitiveValue.ClassName))return e.onPrimitive();if(t.hasExactClass(eh.OptionValue.ClassName))return e.onOption();if(t.hasExactClass(eh.List.ClassName))return e.onList();if(t.hasExactClass(fT.ArrayVec.ClassName))return e.onArray();if(t.hasExactClass(aT.Struct.ClassName))return e.onStruct();if(t.hasExactClass(cT.Tuple.ClassName))return e.onTuple();if(t.hasExactClass(nT.EnumValue.ClassName))return e.onEnum();if(e.onOther)return e.onOther();throw new th.ErrTypingSystem(`value isn't typed: ${t}`)}zt.onTypedValueSelect=W4;function z4(t,e){if(t.hasExactClass(tT.BooleanValue.ClassName))return e.onBoolean();if(t.hasClassOrSuperclass(sT.NumericalValue.ClassName))return e.onNumerical();if(t.hasExactClass(eT.AddressValue.ClassName))return e.onAddress();if(t.hasExactClass(rT.BytesValue.ClassName))return e.onBytes();if(t.hasExactClass(hT.StringValue.ClassName))return e.onString();if(t.hasExactClass(iT.H256Value.ClassName))return e.onH256();if(t.hasExactClass(uT.TokenIdentifierValue.ClassName))return e.onTypeIdentifier();if(t.hasExactClass(oT.NothingValue.ClassName))return e.onNothing();if(e.onOther)return e.onOther();throw new th.ErrTypingSystem(`value isn't a primitive: ${t.getType()}`)}zt.onPrimitiveValueSelect=z4;function $4(t,e){if(t.hasExactClass(tT.BooleanType.ClassName))return e.onBoolean();if(t.hasClassOrSuperclass(sT.NumericalType.ClassName))return e.onNumerical();if(t.hasExactClass(eT.AddressType.ClassName))return e.onAddress();if(t.hasExactClass(rT.BytesType.ClassName))return e.onBytes();if(t.hasExactClass(hT.StringType.ClassName))return e.onString();if(t.hasExactClass(iT.H256Type.ClassName))return e.onH256();if(t.hasExactClass(uT.TokenIdentifierType.ClassName))return e.onTokenIndetifier();if(t.hasExactClass(oT.NothingType.ClassName))return e.onNothing();if(e.onOther)return e.onOther();throw new th.ErrTypingSystem(`type isn't a known primitive: ${t}`)}zt.onPrimitiveTypeSelect=$4});var Ot=m(qe=>{"use strict";c();var K4=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]}),it=qe&&qe.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&K4(e,t,r)};Object.defineProperty(qe,"__esModule",{value:!0});it(JS(),qe);it(Io(),qe);it(vf(),qe);it(Bu(),qe);it(di(),qe);it(Sf(),qe);it(gm(),qe);it(xu(),qe);it(ZS(),qe);it(wo(),qe);it(Uu(),qe);it(Df(),qe);it(Vu(),qe);it(dT(),qe);it(Bf(),qe);it(Xu(),qe);it(Wf(),qe);it(vo(),qe);it(Lo(),qe);it(Kf(),qe);it(sf(),qe);it(Bm(),qe);it(_t(),qe);it(Xf(),qe)});var gT=m(an=>{"use strict";c();var Y4=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]}),J4=an&&an.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),X4=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)&&Y4(e,t,r);return J4(e,t),e};Object.defineProperty(an,"__esModule",{value:!0});an.OptionValueBinaryCodec=void 0;var pT=X4(Be()),rh=Ot(),Mm=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){if(e[0]==0)return[rh.OptionValue.newMissingTyped(r),1];if(e[0]!=1)throw new pT.ErrCodec("invalid buffer for optional value");let[n,i]=this.binaryCodec.decodeNested(e.slice(1),r);return[rh.OptionValue.newProvided(n),i+1]}decodeTopLevel(e,r){if(e.length==0)return new rh.OptionValue(r);if(e[0]!=1)throw new pT.ErrCodec("invalid buffer for optional value");let[n,i]=this.binaryCodec.decodeNested(e.slice(1),r);return new rh.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([])}};an.OptionValueBinaryCodec=Mm});var yT=m(nh=>{"use strict";c();Object.defineProperty(nh,"__esModule",{value:!0});nh.AddressBinaryCodec=void 0;var Z4=ht(),eq=Ot(),Um=class{decodeNested(e){let r=e.slice(0,32),n=new Z4.Address(r);return[new eq.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()}};nh.AddressBinaryCodec=Um});var wT=m(un=>{"use strict";c();var tq=un&&un.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.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=un&&un.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nq=un&&un.__importStar||function(t){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};Object.defineProperty(un,"__esModule",{value:!0});un.BooleanBinaryCodec=void 0;var iq=nq(Be()),mT=Ot(),nc=class t{decodeNested(e){let r=e.readUInt8(0);return[new mT.BooleanValue(r==t.TRUE),1]}decodeTopLevel(e){if(e.length>1)throw new iq.ErrInvalidArgument("buffer should be of size <= 1");let r=e[0];return new mT.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([])}};un.BooleanBinaryCodec=nc;nc.TRUE=1;nc.FALSE=0});var sh=m(ih=>{"use strict";c();Object.defineProperty(ih,"__esModule",{value:!0});ih.SizeOfU32=void 0;ih.SizeOfU32=4});var oh=m(cn=>{"use strict";c();var sq=cn&&cn.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(cn,"__esModule",{value:!0});cn.zeroPadStringIfOddLength=cn.isPaddedHex=cn.numberToPaddedHex=void 0;var oq=sq(Gt());function aq(t){let e=new oq.default(t).toString(16);return ET(e)}cn.numberToPaddedHex=aq;function uq(t){t=t||"";let e=h.Buffer.from(t,"hex").toString("hex");return t.toUpperCase()==e.toUpperCase()}cn.isPaddedHex=uq;function ET(t){return t=t||"",t.length%2==1?"0"+t:t}cn.zeroPadStringIfOddLength=ET});var ic=m(It=>{"use strict";c();var cq=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 qm=cq(Gt()),lq=oh();function vT(t,e=0){return t[e]>>7==1}It.isMsbOne=vT;function fq(t,e=0){return!vT(t,e)}It.isMsbZero=fq;function hq(t){let e=h.Buffer.alloc(t.length);return t.copy(e),e}It.cloneBuffer=hq;function dq(t){let e=t.toString("hex");return new qm.default(`0x${e}`,16)}It.bufferToBigInt=dq;function pq(t){let e=AT(t);return h.Buffer.from(e,"hex")}It.bigIntToBuffer=pq;function AT(t){return t=new qm.default(t),t?(t.isNegative()&&(t=t.multipliedBy(new qm.default(-1))),lq.numberToPaddedHex(t)):""}It.getHexMagnitudeOfBigInt=AT;function gq(t){for(let e=0;e{"use strict";c();var mq=qo&&qo.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(qo,"__esModule",{value:!0});qo.NumericalBinaryCodec=void 0;var sc=mq(Gt()),Vm=Ot(),bT=sh(),mt=ic(),Hm=class{decodeNested(e,r){let n=0,i=r.sizeInBytes;i||(n=bT.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 Vm.NumericalValue(r,new sc.default(0));if(!r.withSign||mt.isMsbZero(n)){let l=mt.bufferToBigInt(n);return new Vm.NumericalValue(r,l)}mt.flipBufferBitsInPlace(n);let u=mt.bufferToBigInt(n).multipliedBy(new sc.default(-1)).minus(new sc.default(1));return new Vm.NumericalValue(r,u)}encodeNested(e){if(e.sizeInBytes)return this.encodeNestedFixedSize(e,e.sizeInBytes);let r=this.encodeTopLevel(e),n=h.Buffer.alloc(bT.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 sc.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 sc.default(1)),n=mt.bigIntToBuffer(r);return mt.flipBufferBitsInPlace(n),mt.isMsbZero(n)&&(n=mt.prependByteToBuffer(n,255)),n}};qo.NumericalBinaryCodec=Hm});var IT=m(ah=>{"use strict";c();Object.defineProperty(ah,"__esModule",{value:!0});ah.H256BinaryCodec=void 0;var wq=Vu(),Gm=class{decodeNested(e){let r=e.slice(0,32);return[new wq.H256Value(r),32]}decodeTopLevel(e){let[r,n]=this.decodeNested(e);return r}encodeNested(e){return e.valueOf()}encodeTopLevel(e){return e.valueOf()}};ah.H256BinaryCodec=Gm});var lh=m(ch=>{"use strict";c();Object.defineProperty(ch,"__esModule",{value:!0});ch.BytesBinaryCodec=void 0;var ST=di(),uh=sh(),jm=class{decodeNested(e){let r=e.readUInt32BE(0),n=e.slice(uh.SizeOfU32,uh.SizeOfU32+r);return[new ST.BytesValue(n),uh.SizeOfU32+r]}decodeTopLevel(e){return new ST.BytesValue(e)}encodeNested(e){let r=h.Buffer.alloc(uh.SizeOfU32);return r.writeUInt32BE(e.getLength()),h.Buffer.concat([r,e.valueOf()])}encodeTopLevel(e){return e.valueOf()}};ch.BytesBinaryCodec=jm});var CT=m(fh=>{"use strict";c();Object.defineProperty(fh,"__esModule",{value:!0});fh.TokenIdentifierCodec=void 0;var Eq=di(),TT=Lo(),vq=lh(),km=class{constructor(){this.bytesCodec=new vq.BytesBinaryCodec}decodeNested(e){let[r,n]=this.bytesCodec.decodeNested(e);return[new TT.TokenIdentifierValue(r.toString()),n]}decodeTopLevel(e){let r=this.bytesCodec.decodeTopLevel(e);return new TT.TokenIdentifierValue(r.toString())}encodeNested(e){let r=Eq.BytesValue.fromUTF8(e.valueOf());return this.bytesCodec.encodeNested(r)}encodeTopLevel(e){return h.Buffer.from(e.valueOf())}};fh.TokenIdentifierCodec=km});var NT=m(hh=>{"use strict";c();Object.defineProperty(hh,"__esModule",{value:!0});hh.NothingCodec=void 0;var xT=Ot(),Qm=class{decodeNested(){return[new xT.NothingValue,0]}decodeTopLevel(){return new xT.NothingValue}encodeNested(){return h.Buffer.from([])}encodeTopLevel(){return h.Buffer.from([])}};hh.NothingCodec=Qm});var DT=m(dh=>{"use strict";c();Object.defineProperty(dh,"__esModule",{value:!0});dh.StringBinaryCodec=void 0;var OT=Ot(),Aq=di(),bq=lh(),Wm=class{constructor(){this.bytesBinaryCodec=new bq.BytesBinaryCodec}decodeNested(e){let[r,n]=this.bytesBinaryCodec.decodeNested(e);return[new OT.StringValue(r.valueOf().toString()),n]}decodeTopLevel(e){return new OT.StringValue(e.toString())}encodeNested(e){let r=Aq.BytesValue.fromUTF8(e.valueOf());return this.bytesBinaryCodec.encodeNested(r)}encodeTopLevel(e){return h.Buffer.from(e.valueOf())}};dh.StringBinaryCodec=Wm});var PT=m(gh=>{"use strict";c();Object.defineProperty(gh,"__esModule",{value:!0});gh.PrimitiveBinaryCodec=void 0;var ph=Ot(),_q=yT(),Iq=wT(),Sq=_T(),Tq=IT(),Cq=lh(),xq=CT(),Nq=NT(),Oq=DT(),zm=class{constructor(e){this.binaryCodec=e,this.booleanCodec=new Iq.BooleanBinaryCodec,this.numericalCodec=new Sq.NumericalBinaryCodec,this.addressCodec=new _q.AddressBinaryCodec,this.h256Codec=new Tq.H256BinaryCodec,this.bytesCodec=new Cq.BytesBinaryCodec,this.stringCodec=new Oq.StringBinaryCodec,this.tokenIdentifierCodec=new xq.TokenIdentifierCodec,this.nothingCodec=new Nq.NothingCodec}decodeNested(e,r){return ph.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 ph.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 ph.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 ph.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()})}};gh.PrimitiveBinaryCodec=zm});var LT=m(yh=>{"use strict";c();Object.defineProperty(yh,"__esModule",{value:!0});yh.ListBinaryCodec=void 0;var RT=Ot(),BT=sh(),$m=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=BT.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 RT.List(r,i)}encodeNested(e){this.binaryCodec.constraints.checkListLength(e.getLength());let r=h.Buffer.alloc(BT.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)}};yh.ListBinaryCodec=$m});var Ym=m(mh=>{"use strict";c();Object.defineProperty(mh,"__esModule",{value:!0});mh.FieldsBinaryCodec=void 0;var Dq=Ot(),Km=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 Dq.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)}};mh.FieldsBinaryCodec=Km});var Xm=m(wh=>{"use strict";c();Object.defineProperty(wh,"__esModule",{value:!0});wh.StructBinaryCodec=void 0;var Pq=Ot(),Rq=Ym(),Jm=class{constructor(e){this.fieldsCodec=new Rq.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 Pq.Struct(r,i),s]}encodeNested(e){let r=e.getFields();return this.fieldsCodec.encodeNested(r)}encodeTopLevel(e){return this.encodeNested(e)}};wh.StructBinaryCodec=Jm});var FT=m(vh=>{"use strict";c();Object.defineProperty(vh,"__esModule",{value:!0});vh.EnumBinaryCodec=void 0;var Eh=Ot(),Bq=Ym(),Zm=class{constructor(e){this.binaryCodec=e,this.fieldsCodec=new Bq.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 Eh.EnumValue(r,s,a),i+u]}readDiscriminant(e){let[r,n]=this.binaryCodec.decodeNested(e,new Eh.U8Type);return[r.valueOf(),n]}encodeNested(e){let r=new Eh.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 Eh.U8Value(e.discriminant),o=n?this.binaryCodec.encodeNested(s):this.binaryCodec.encodeTopLevel(s);return h.Buffer.concat([o,i])}};vh.EnumBinaryCodec=Zm});var MT=m(Ah=>{"use strict";c();Object.defineProperty(Ah,"__esModule",{value:!0});Ah.TupleBinaryCodec=void 0;var Lq=Xm(),ew=class{constructor(e){this.structCodec=new Lq.StructBinaryCodec(e)}decodeTopLevel(e,r){return this.structCodec.decodeTopLevel(e,r)}decodeNested(e,r){return this.structCodec.decodeNested(e,r)}encodeNested(e){return this.structCodec.encodeNested(e)}encodeTopLevel(e){return this.structCodec.encodeTopLevel(e)}};Ah.TupleBinaryCodec=ew});var UT=m(bh=>{"use strict";c();Object.defineProperty(bh,"__esModule",{value:!0});bh.ArrayVecBinaryCodec=void 0;var Fq=Ot(),tw=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 Mq=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]}),Uq=Sr&&Sr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qq=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)&&Mq(e,t,r);return Uq(e,t),e};Object.defineProperty(Sr,"__esModule",{value:!0});Sr.BinaryCodecConstraints=Sr.BinaryCodec=void 0;var qT=qq(Be()),_h=Ot(),VT=gr(),Vq=gT(),Hq=PT(),Gq=LT(),jq=Xm(),kq=FT(),Qq=MT(),Wq=UT(),rw=class{constructor(e=null){this.constraints=e||new Ih,this.optionCodec=new Vq.OptionValueBinaryCodec(this),this.listCodec=new Gq.ListBinaryCodec(this),this.arrayCodec=new Wq.ArrayVecBinaryCodec(this),this.primitiveCodec=new Hq.PrimitiveBinaryCodec(this),this.structCodec=new jq.StructBinaryCodec(this),this.tupleCodec=new Qq.TupleBinaryCodec(this),this.enumCodec=new kq.EnumBinaryCodec(this)}decodeTopLevel(e,r){return this.constraints.checkBufferLength(e),_h.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]=_h.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 VT.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),_h.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 VT.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),_h.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=rw;var Ih=class{constructor(e){this.maxBufferLength=e?.maxBufferLength||256e3,this.maxListLength=e?.maxListLength||128e3}checkBufferLength(e){if(e.length>this.maxBufferLength)throw new qT.ErrCodec(`Buffer too large: ${e.length} > ${this.maxBufferLength}`)}checkListLength(e){if(e>this.maxListLength)throw new qT.ErrCodec(`List too large: ${e} > ${this.maxListLength}`)}};Sr.BinaryCodecConstraints=Ih});var HT=m(Tr=>{"use strict";c();var zq=Tr&&Tr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Tr,"__esModule",{value:!0});Tr.decodeBigNumber=Tr.decodeString=Tr.decodeBool=Tr.decodeUnsignedNumber=void 0;var $q=zq(Gt()),Sh=Ot(),Kq=nw(),Th=new Kq.BinaryCodec;function Yq(t){let e=Th.decodeTopLevel(t,new Sh.BigUIntType);return Number(e.valueOf())}Tr.decodeUnsignedNumber=Yq;function Jq(t){return!!Th.decodeTopLevel(t,new Sh.BooleanType).valueOf()}Tr.decodeBool=Jq;function Xq(t){let e=Th.decodeTopLevel(t,new Sh.BytesType);return String(e.valueOf())}Tr.decodeString=Xq;function Zq(t){let e=Th.decodeTopLevel(t,new Sh.BigUIntType);return new $q.default(e.valueOf())}Tr.decodeBigNumber=Zq});var iw=m(yi=>{"use strict";c();var eV=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]}),GT=yi&&yi.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&eV(e,t,r)};Object.defineProperty(yi,"__esModule",{value:!0});GT(nw(),yi);GT(HT(),yi)});var Vo=m(Ch=>{"use strict";c();Object.defineProperty(Ch,"__esModule",{value:!0});Ch.ArgSerializer=void 0;var jT=ms(),tV=iw(),sw=vf(),ow=Sf(),aw=Xf(),rV={codec:new tV.BinaryCodec},uw=class{constructor(e){e=Object.assign(Object.assign({},rV),e),this.codec=e.codec}stringToValues(e,r){let n=this.stringToBuffers(e);return this.buffersToValues(n,r)}stringToBuffers(e){return e.split(jT.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(jT.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(sw.OptionalValue.ClassName)){let o=s;o.isSet()&&i(o.getTypedValue())}else if(s.hasExactClass(aw.VariadicValue.ClassName)){let o=s;for(let a of o.getItems())i(a)}else if(s.hasExactClass(ow.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}};Ch.ArgSerializer=uw});var Oh=m(Nh=>{"use strict";c();Object.defineProperty(Nh,"__esModule",{value:!0});Nh.Compatibility=void 0;var nV=ht(),xh=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()==nV.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.`))}};Nh.Compatibility=xh;xh.areWarningsEnabled=!0});var kT=m(ln=>{"use strict";c();var iV=ln&&ln.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),sV=ln&&ln.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oV=ln&&ln.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&iV(e,t,r);return sV(e,t),e};Object.defineProperty(ln,"__esModule",{value:!0});ln.Hash=void 0;var aV=oV(Be()),cw=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 aV.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}};ln.Hash=cw});var oc=m(Cr=>{"use strict";c();var uV=Cr&&Cr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),cV=Cr&&Cr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lV=Cr&&Cr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&uV(e,t,r);return cV(e,t),e};Object.defineProperty(Cr,"__esModule",{value:!0});Cr.TransactionOptions=Cr.TransactionVersion=void 0;var Gr=ms(),QT=lV(Be()),lw=class t{constructor(e){if(e=Number(e),e<1)throw new QT.ErrTransactionVersionInvalid(e);this.value=e}static withDefaultVersion(){return new t(Gr.TRANSACTION_VERSION_DEFAULT)}static withTxOptions(){return new t(Gr.TRANSACTION_VERSION_WITH_OPTIONS)}valueOf(){return this.value}};Cr.TransactionVersion=lw;var fw=class t{constructor(e){if(e=Number(e),e<0)throw new QT.ErrTransactionOptionsInvalid(e);this.value=e}static withDefaultOptions(){return new t(Gr.TRANSACTION_OPTIONS_DEFAULT)}static withOptions(e){let r=0;return e.hashSign&&(r|=Gr.TRANSACTION_OPTIONS_TX_HASH_SIGN),e.guarded&&(r|=Gr.TRANSACTION_OPTIONS_TX_GUARDED),new t(r)}isWithHashSign(){return(this.value&Gr.TRANSACTION_OPTIONS_TX_HASH_SIGN)==Gr.TRANSACTION_OPTIONS_TX_HASH_SIGN}isWithGuardian(){return(this.value&Gr.TRANSACTION_OPTIONS_TX_GUARDED)==Gr.TRANSACTION_OPTIONS_TX_GUARDED}setWithHashSign(){this.value|=Gr.TRANSACTION_OPTIONS_TX_HASH_SIGN}setWithGuardian(){this.value|=Gr.TRANSACTION_OPTIONS_TX_GUARDED}valueOf(){return this.value}};Cr.TransactionOptions=fw});var zT=m((Zse,WT)=>{"use strict";c();WT.exports=fV;function fV(t,e){for(var r=new Array(arguments.length-1),n=0,i=2,s=!0;i{"use strict";c();var Dh=YT;Dh.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),KT=new Array(123);for(jr=0;jr<64;)KT[Ho[jr]=jr<26?jr+65:jr<52?jr+71:jr<62?jr-4:jr-59|43]=jr++;var jr;Dh.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 $T="invalid encoding";Dh.decode=function(e,r,n){for(var i=n,s=0,o,a=0;a1)break;if((u=KT[u])===void 0)throw Error($T);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($T);return n-i};Dh.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var ZT=m((noe,XT)=>{"use strict";c();XT.exports=Ph;function Ph(){this._listeners={}}Ph.prototype.on=function(e,r,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:r,ctx:n||this}),this};Ph.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();sC.exports=eC(eC);function eC(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,tC),t.writeFloatBE=e.bind(null,rC);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,nC),t.readFloatBE=r.bind(null,iC)}(),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,tC,0,4),t.writeDoubleBE=e.bind(null,rC,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,nC,0,4),t.readDoubleBE=r.bind(null,iC,4,0)}(),t}function tC(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 rC(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 nC(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0}function iC(t,e){return(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}});var aC=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 cC=m(uC=>{"use strict";c();var hw=uC;hw.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))};hw.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 fC=m((loe,lC)=>{"use strict";c();lC.exports=hV;function hV(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 dC=m((hoe,hC)=>{"use strict";c();hC.exports=Bt;var ac=wi();function Bt(t,e){this.lo=t>>>0,this.hi=e>>>0}var bs=Bt.zero=new Bt(0,0);bs.toNumber=function(){return 0};bs.zzEncode=bs.zzDecode=function(){return this};bs.length=function(){return 1};var dV=Bt.zeroHash="\0\0\0\0\0\0\0\0";Bt.fromNumber=function(e){if(e===0)return bs;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(ac.isString(e))if(ac.Long)e=ac.Long.fromString(e);else return Bt.fromNumber(parseInt(e,10));return e.low||e.high?new Bt(e.low>>>0,e.high>>>0):bs};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 ac.Long?new ac.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===dV?bs: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 wi=m(dw=>{"use strict";c();var Ee=dw;Ee.asPromise=zT();Ee.base64=JT();Ee.EventEmitter=ZT();Ee.float=oC();Ee.inquire=aC();Ee.utf8=cC();Ee.pool=fC();Ee.LongBits=dC();Ee.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);Ee.global=Ee.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||dw;Ee.emptyArray=Object.freeze?Object.freeze([]):[];Ee.emptyObject=Object.freeze?Object.freeze({}):{};Ee.isInteger=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};Ee.isString=function(e){return typeof e=="string"||e instanceof String};Ee.isObject=function(e){return e&&typeof e=="object"};Ee.isset=Ee.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};Ee.Buffer=function(){try{var t=Ee.inquire("buffer").Buffer;return t.prototype.utf8Write?t:null}catch{return null}}();Ee._Buffer_from=null;Ee._Buffer_allocUnsafe=null;Ee.newBuffer=function(e){return typeof e=="number"?Ee.Buffer?Ee._Buffer_allocUnsafe(e):new Ee.Array(e):Ee.Buffer?Ee._Buffer_from(e):typeof Uint8Array>"u"?e:new Uint8Array(e)};Ee.Array=typeof Uint8Array<"u"?Uint8Array:Array;Ee.Long=Ee.global.dcodeIO&&Ee.global.dcodeIO.Long||Ee.global.Long||Ee.inquire("long");Ee.key2Re=/^true|false|0|1$/;Ee.key32Re=/^-?(?:0|[1-9][0-9]*)$/;Ee.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;Ee.longToHash=function(e){return e?Ee.LongBits.from(e).toHash():Ee.LongBits.zeroHash};Ee.longFromHash=function(e,r){var n=Ee.LongBits.fromHash(e);return Ee.Long?Ee.Long.fromBits(n.lo,n.hi,r):n.toNumber(!!r)};function pC(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]}};Ee.oneOfSetter=function(e){return function(r){for(var n=0;n{"use strict";c();EC.exports=Fe;var xr=wi(),pw,Rh=xr.LongBits,yC=xr.base64,mC=xr.utf8;function uc(t,e,r){this.fn=t,this.len=e,this.next=void 0,this.val=r}function yw(){}function pV(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 uc(yw,0,0),this.tail=this.head,this.states=null}var wC=function(){return xr.Buffer?function(){return(Fe.create=function(){return new pw})()}:function(){return new Fe}};Fe.create=wC();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 uc(e,r,n),this.len+=r,this};function mw(t,e,r){e[r]=t&255}function gV(t,e,r){for(;t>127;)e[r++]=t&127|128,t>>>=7;e[r]=t}function ww(t,e){this.len=t,this.next=void 0,this.val=e}ww.prototype=Object.create(uc.prototype);ww.prototype.fn=gV;Fe.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new ww((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(Ew,10,Rh.fromNumber(e)):this.uint32(e)};Fe.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function Ew(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=Rh.from(e);return this._push(Ew,r.length(),r)};Fe.prototype.int64=Fe.prototype.uint64;Fe.prototype.sint64=function(e){var r=Rh.from(e).zzEncode();return this._push(Ew,r.length(),r)};Fe.prototype.bool=function(e){return this._push(mw,1,e?1:0)};function gw(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(gw,4,e>>>0)};Fe.prototype.sfixed32=Fe.prototype.fixed32;Fe.prototype.fixed64=function(e){var r=Rh.from(e);return this._push(gw,4,r.lo)._push(gw,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 yV=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(mw,1,0);if(xr.isString(e)){var n=Fe.alloc(r=yC.length(e));yC.decode(e,n,0),e=n}return this.uint32(r)._push(yV,r,e)};Fe.prototype.string=function(e){var r=mC.length(e);return r?this.uint32(r)._push(mC.write,r,e):this._push(mw,1,0)};Fe.prototype.fork=function(){return this.states=new pV(this),this.head=this.tail=new uc(yw,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 uc(yw,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){pw=t,Fe.create=wC(),pw._configure()}});var bC=m((woe,AC)=>{"use strict";c();AC.exports=fn;var vC=vw();(fn.prototype=Object.create(vC.prototype)).constructor=fn;var Ei=wi();function fn(){vC.call(this)}fn._configure=function(){fn.alloc=Ei._Buffer_allocUnsafe,fn.writeBytesBuffer=Ei.Buffer&&Ei.Buffer.prototype instanceof Uint8Array&&Ei.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(fn.writeBytesBuffer,r,e),this};function mV(t,e,r){t.length<40?Ei.utf8.write(t,e,r):e.utf8Write?e.utf8Write(t,r):e.write(t,r)}fn.prototype.string=function(e){var r=Ei.Buffer.byteLength(e);return this.uint32(r),r&&this._push(mV,r,e),this};fn._configure()});var _w=m((voe,CC)=>{"use strict";c();CC.exports=wt;var hn=wi(),bw,SC=hn.LongBits,wV=hn.utf8;function kr(t,e){return RangeError("index out of range: "+t.pos+" + "+(e||1)+" > "+t.len)}function wt(t){this.buf=t,this.pos=0,this.len=t.length}var _C=typeof Uint8Array<"u"?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new wt(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new wt(e);throw Error("illegal buffer")},TC=function(){return hn.Buffer?function(r){return(wt.create=function(i){return hn.Buffer.isBuffer(i)?new bw(i):_C(i)})(r)}:_C};wt.create=TC();wt.prototype._slice=hn.Array.prototype.subarray||hn.Array.prototype.slice;wt.prototype.uint32=function(){var e=4294967295;return function(){if(e=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(e=(e|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,kr(this,10);return e}}();wt.prototype.int32=function(){return this.uint32()|0};wt.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(e&1)|0};function Aw(){var t=new SC(0,0),e=0;if(this.len-this.pos>4){for(;e<4;++e)if(t.lo=(t.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(this.buf[this.pos]&127)<<28)>>>0,t.hi=(t.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return t;e=0}else{for(;e<3;++e){if(this.pos>=this.len)throw kr(this);if(t.lo=(t.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(this.buf[this.pos++]&127)<>>0,t}if(this.len-this.pos>4){for(;e<5;++e)if(t.hi=(t.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t}else for(;e<5;++e){if(this.pos>=this.len)throw kr(this);if(t.hi=(t.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}wt.prototype.bool=function(){return this.uint32()!==0};function Bh(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}wt.prototype.fixed32=function(){if(this.pos+4>this.len)throw kr(this,4);return Bh(this.buf,this.pos+=4)};wt.prototype.sfixed32=function(){if(this.pos+4>this.len)throw kr(this,4);return Bh(this.buf,this.pos+=4)|0};function IC(){if(this.pos+8>this.len)throw kr(this,8);return new SC(Bh(this.buf,this.pos+=4),Bh(this.buf,this.pos+=4))}wt.prototype.float=function(){if(this.pos+4>this.len)throw kr(this,4);var e=hn.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};wt.prototype.double=function(){if(this.pos+8>this.len)throw kr(this,4);var e=hn.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e};wt.prototype.bytes=function(){var e=this.uint32(),r=this.pos,n=this.pos+e;if(n>this.len)throw kr(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(r,n):r===n?new this.buf.constructor(0):this._slice.call(this.buf,r,n)};wt.prototype.string=function(){var e=this.bytes();return wV.read(e,0,e.length)};wt.prototype.skip=function(e){if(typeof e=="number"){if(this.pos+e>this.len)throw kr(this,e);this.pos+=e}else do if(this.pos>=this.len)throw kr(this);while(this.buf[this.pos++]&128);return this};wt.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};wt._configure=function(t){bw=t,wt.create=TC(),bw._configure();var e=hn.Long?"toLong":"toNumber";hn.merge(wt.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 IC.call(this)[e](!0)},sfixed64:function(){return IC.call(this)[e](!1)}})}});var DC=m((boe,OC)=>{"use strict";c();OC.exports=_s;var NC=_w();(_s.prototype=Object.create(NC.prototype)).constructor=_s;var xC=wi();function _s(t){NC.call(this,t)}_s._configure=function(){xC.Buffer&&(_s.prototype._slice=xC.Buffer.prototype.slice)};_s.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))};_s._configure()});var RC=m((Ioe,PC)=>{"use strict";c();PC.exports=cc;var Iw=wi();(cc.prototype=Object.create(Iw.EventEmitter.prototype)).constructor=cc;function cc(t,e,r){if(typeof t!="function")throw TypeError("rpcImpl must be a function");Iw.EventEmitter.call(this),this.rpcImpl=t,this.requestDelimited=!!e,this.responseDelimited=!!r}cc.prototype.rpcCall=function t(e,r,n,i,s){if(!i)throw TypeError("request must be specified");var o=this;if(!s)return Iw.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}};cc.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var LC=m(BC=>{"use strict";c();var EV=BC;EV.Service=RC()});var MC=m((xoe,FC)=>{"use strict";c();FC.exports={}});var VC=m(qC=>{"use strict";c();var ur=qC;ur.build="minimal";ur.Writer=vw();ur.BufferWriter=bC();ur.Reader=_w();ur.BufferReader=DC();ur.util=wi();ur.rpc=LC();ur.roots=MC();ur.configure=UC;function UC(){ur.util._configure(),ur.Writer._configure(ur.BufferWriter),ur.Reader._configure(ur.BufferReader)}UC()});var GC=m((Poe,HC)=>{"use strict";c();HC.exports=VC()});var kC=m((Boe,jC)=>{"use strict";c();var Go=GC(),Lh=Go.Reader,vV=Go.Writer,J=Go.util,lc=Go.roots.default||(Go.roots.default={});lc.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 Lh||(n=new Lh(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 lc.proto.Transaction)return n;var i=new lc.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,Go.util.toJSONOptions)},e}(),t}();jC.exports=lc});var QC=m(Nr=>{"use strict";c();var AV=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]}),bV=Nr&&Nr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_V=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)&&AV(e,t,r);return bV(e,t),e},IV=Nr&&Nr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Nr,"__esModule",{value:!0});Nr.ProtoSerializer=void 0;var SV=IV(Gt()),Sw=ht(),TV=ms(),CV=_V(Be()),xV=ic(),Tw=class{serializeTransaction(e){let r=kC().proto,n=new Sw.Address(e.getReceiver().bech32()).pubkey(),i=new Sw.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()!==TV.TRANSACTION_OPTIONS_DEFAULT&&(s.Options=e.getOptions().valueOf()),e.isGuardedTransaction()){let u=e.getGuardian();s.GuardAddr=new Sw.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 SV.default(e.toString());if(r.isZero())return h.Buffer.from([0,0]);let n=xV.bigIntToBuffer(r);return n=h.Buffer.concat([h.Buffer.from([0]),n]),n}deserializeTransaction(e){throw new CV.ErrUnsupportedOperation("deserializeTransaction")}};Nr.ProtoSerializer=Tw});var WC=m(Is=>{"use strict";c();var NV=Is&&Is.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),OV=Is&&Is.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&NV(e,t,r)};Object.defineProperty(Is,"__esModule",{value:!0});OV(QC(),Is)});var Fh=m(dn=>{"use strict";c();var DV=dn&&dn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),PV=dn&&dn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),RV=dn&&dn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&DV(e,t,r);return PV(e,t),e};Object.defineProperty(dn,"__esModule",{value:!0});dn.Signature=void 0;var zC=RV(Be()),$C=64,Cw=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 zC.ErrSignatureCannotCreate(e);return t.fromValidHex(e)}static isValidHex(e){return h.Buffer.from(e,"hex").length==$C}static fromValidHex(e){let r=new t;return r.valueHex=e,r}static fromBuffer(e){if(e.length!=$C)throw new zC.ErrSignatureCannotCreate(e);return t.fromValidHex(e.toString("hex"))}hex(){return this.valueHex}};dn.Signature=Cw});var qn=m(Mh=>{"use strict";c();Object.defineProperty(Mh,"__esModule",{value:!0});Mh.TransactionPayload=void 0;var xw=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}};Mh.TransactionPayload=xw});var Nw=m((koe,KC)=>{c();Vn.notEqual=LV;Vn.notOk=FV;Vn.equal=BV;Vn.ok=Vn;KC.exports=Vn;function BV(t,e,r){Vn(t==e,r)}function LV(t,e,r){Vn(t!=e,r)}function FV(t,e){Vn(!t,e)}function Vn(t,e){if(!t)throw new Error(e||"AssertionError")}});var Ts=m(Wo=>{"use strict";c();var Ow=m0(),ko=E0(),YC=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Wo.Buffer=z;Wo.SlowBuffer=GV;Wo.INSPECT_MAX_BYTES=50;var Uh=2147483647;Wo.kMaxLength=Uh;z.TYPED_ARRAY_SUPPORT=MV();!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 MV(){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>Uh)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 Bw(t)}return ex(t,e,r)}z.poolSize=8192;function ex(t,e,r){if(typeof t=="string")return qV(t,e);if(ArrayBuffer.isView(t))return VV(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(pn(t,ArrayBuffer)||t&&pn(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(pn(t,SharedArrayBuffer)||t&&pn(t.buffer,SharedArrayBuffer)))return Pw(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=HV(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 ex(t,e,r)};Object.setPrototypeOf(z.prototype,Uint8Array.prototype);Object.setPrototypeOf(z,Uint8Array);function tx(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 UV(t,e,r){return tx(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 UV(t,e,r)};function Bw(t){return tx(t),Hn(t<0?0:Lw(t)|0)}z.allocUnsafe=function(t){return Bw(t)};z.allocUnsafeSlow=function(t){return Bw(t)};function qV(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!z.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=rx(t,e)|0,n=Hn(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function Dw(t){let e=t.length<0?0:Lw(t.length)|0,r=Hn(e);for(let n=0;n=Uh)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Uh.toString(16)+" bytes");return t|0}function GV(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(pn(e,Uint8Array)&&(e=z.from(e,e.offset,e.byteLength)),pn(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 rx(t,e){if(z.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||pn(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 Rw(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return fx(t).length;default:if(i)return n?-1:Rw(t).length;e=(""+e).toLowerCase(),i=!0}}z.byteLength=rx;function jV(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 ZV(this,e,r);case"utf8":case"utf-8":return ix(this,e,r);case"ascii":return JV(this,e,r);case"latin1":case"binary":return XV(this,e,r);case"base64":return KV(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return eH(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}z.prototype._isBuffer=!0;function Ss(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+=" ... "),""};YC&&(z.prototype[YC]=z.prototype.inspect);z.prototype.compare=function(e,r,n,i,s){if(pn(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,Mw(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:JC(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):JC(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function JC(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 kV(this,e,r,n);case"utf8":case"utf-8":return QV(this,e,r,n);case"ascii":case"latin1":case"binary":return WV(this,e,r,n);case"base64":return zV(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return $V(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 KV(t,e,r){return e===0&&r===t.length?Ow.fromByteArray(t):Ow.fromByteArray(t.slice(e,r))}function ix(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 YV(n)}var XC=4096;function YV(t){let e=t.length;if(e<=XC)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)&&fc(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)&&fc(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)&&fc(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)&&fc(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 sx(t,e,r,n,i){lx(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 ox(t,e,r,n,i){lx(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 sx(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});z.prototype.writeBigUInt64BE=vi(function(e,r=0){return ox(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 sx(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});z.prototype.writeBigInt64BE=vi(function(e,r=0){return ox(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function ax(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 ux(t,e,r,n,i){return e=+e,r=r>>>0,i||ax(t,e,r,4,34028234663852886e22,-34028234663852886e22),ko.write(t,e,r,n,23,4),r+4}z.prototype.writeFloatLE=function(e,r,n){return ux(this,e,r,!0,n)};z.prototype.writeFloatBE=function(e,r,n){return ux(this,e,r,!1,n)};function cx(t,e,r,n,i){return e=+e,r=r>>>0,i||ax(t,e,r,8,17976931348623157e292,-17976931348623157e292),ko.write(t,e,r,n,52,8),r+8}z.prototype.writeDoubleLE=function(e,r,n){return cx(this,e,r,!0,n)};z.prototype.writeDoubleBE=function(e,r,n){return cx(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=ZC(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=ZC(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);function ZC(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 tH(t,e,r){Qo(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&fc(e,t.length-(r+1))}function lx(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 jo.ERR_OUT_OF_RANGE("value",a,t)}tH(n,i,s)}function Qo(t,e){if(typeof t!="number")throw new jo.ERR_INVALID_ARG_TYPE(e,"number",t)}function fc(t,e,r){throw Math.floor(t)!==t?(Qo(t,r),new jo.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new jo.ERR_BUFFER_OUT_OF_BOUNDS:new jo.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var rH=/[^+/0-9A-Za-z-_]/g;function nH(t){if(t=t.split("=")[0],t=t.trim().replace(rH,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function Rw(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 iH(t){let e=[];for(let r=0;r>8,i=r%256,s.push(i),s.push(n);return s}function fx(t){return Ow.toByteArray(nH(t))}function qh(t,e,r,n){let i;for(i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function pn(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function Mw(t){return t!==t}var oH=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"?aH:t}function aH(){throw new Error("BigInt not supported")}});var dx=m((Koe,hx)=>{c();hx.exports=Uw;Uw.supported=typeof WebAssembly<"u";function Uw(t){if(!Uw.supported)return null;var e=t&&t.imports,r=uH("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 uH(t){return typeof atob=="function"?new Uint8Array(atob(t).split("").map(cH)):new(Ts()).Buffer(t,"base64")}function cH(t){return t.charCodeAt(0)}});var vx=m((Zoe,yn)=>{c();var gn=Nw(),Ke=dx()(),Gn=64,Vh=[];yn.exports=Or;var px=yn.exports.BYTES_MIN=16,gx=yn.exports.BYTES_MAX=64,Joe=yn.exports.BYTES=32,yx=yn.exports.KEYBYTES_MIN=16,mx=yn.exports.KEYBYTES_MAX=64,Xoe=yn.exports.KEYBYTES=32,wx=yn.exports.SALTBYTES=16,Ex=yn.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&&(gn(t>=px,"digestLength must be at least "+px+", was given "+t),gn(t<=gx,"digestLength must be at most "+gx+", was given "+t),e!=null&&gn(e.length>=yx,"key must be at least "+yx+", was given "+e.length),e!=null&&gn(e.length<=mx,"key must be at least "+mx+", was given "+e.length),r!=null&&gn(r.length===wx,"salt must be exactly "+wx+", was given "+r.length),n!=null&&gn(n.length===Ex,"personal must be exactly "+Ex+", was given "+n.length)),Vh.length||(Vh.push(Gn),Gn+=216),this.digestLength=t,this.finalized=!1,this.pointer=Vh.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,Gn,Gn+e.length),Ke.memory[this.pointer+200]=128)}Or.prototype.update=function(t){return gn(this.finalized===!1,"Hash instance finalized"),gn(t,"input must be TypedArray or Buffer"),Gn+t.length>Ke.memory.length&&Ke.realloc(Gn+t.length),Ke.memory.set(t,Gn),Ke.exports.blake2b_update(this.pointer,Gn,Gn+t.length),this};Or.prototype.digest=function(t){if(gn(this.finalized===!1,"Hash instance finalized"),this.finalized=!0,Vh.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 fH(Ke.memory,this.pointer+128,this.digestLength);gn(t.length>=this.digestLength,"input must be TypedArray or Buffer");for(var e=0;e{c();var _i=Nw(),dc=vx();function Hh(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 Ax(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 xx(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=hc[i],a=hc[i+1],u=hc[s],l=hc[s+1];Hh(Ce,t,e),Ax(Ce,t,o,a);var f=Ce[n]^Ce[t],d=Ce[n+1]^Ce[t+1];Ce[n]=d,Ce[n+1]=f,Hh(Ce,r,n),f=Ce[e]^Ce[r],d=Ce[e+1]^Ce[r+1],Ce[e]=f>>>24^d<<8,Ce[e+1]=d>>>24^f<<8,Hh(Ce,t,e),Ax(Ce,t,u,l),f=Ce[n]^Ce[t],d=Ce[n+1]^Ce[t+1],Ce[n]=f>>>16^d<<16,Ce[n+1]=d>>>16^f<<16,Hh(Ce,r,n),f=Ce[e]^Ce[r],d=Ce[e+1]^Ce[r+1],Ce[e]=d>>>31^f<<1,Ce[e+1]=f>>>31^d<<1}var Nx=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),dH=[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(dH.map(function(t){return t*2})),Ce=new Uint32Array(32),hc=new Uint32Array(32);function Ox(t,e){var r=0;for(r=0;r<16;r++)Ce[r]=t.h[r],Ce[r+16]=Nx[r];for(Ce[24]=Ce[24]^t.t,Ce[25]=Ce[25]^t.t/4294967296,e&&(Ce[28]=~Ce[28],Ce[29]=~Ce[29]),r=0;r<32;r++)hc[r]=xx(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]^Ce[r]^Ce[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]=Nx[i]^xx(bi,i*4);e&&(Dx(this,e),this.c=128)}zo.prototype.update=function(t){return _i(t!=null,"input must be Uint8Array or Buffer"),Dx(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"),pH(this,e),t==="hex"?gH(e):e};zo.prototype.final=zo.prototype.digest;zo.ready=function(t){dc.ready(function(){t()})};function Dx(t,e){for(var r=0;r>2]>>8*(r&3);return e}function gH(t){for(var e="",r=0;r=bx,"outlen must be at least "+bx+", was given "+e),_i(e<=_x,"outlen must be at most "+_x+", was given "+e),r!=null&&_i(r.length>=Ix,"key must be at least "+Ix+", was given "+r.length),r!=null&&_i(r.length<=Sx,"key must be at most "+Sx+", was given "+r.length),n!=null&&_i(n.length===Tx,"salt must be exactly "+Tx+", was given "+n.length),i!=null&&_i(i.length===Cx,"personal must be exactly "+Cx+", was given "+i.length)),new Px(e,r,n,i)};lr.exports.ready=function(t){dc.ready(function(){t()})};lr.exports.WASM_SUPPORTED=dc.SUPPORTED;lr.exports.WASM_LOADED=!1;var bx=lr.exports.BYTES_MIN=16,_x=lr.exports.BYTES_MAX=64,tae=lr.exports.BYTES=32,Ix=lr.exports.KEYBYTES_MIN=16,Sx=lr.exports.KEYBYTES_MAX=64,rae=lr.exports.KEYBYTES=32,Tx=lr.exports.SALTBYTES=16,Cx=lr.exports.PERSONALBYTES=16;dc.ready(function(t){t||(lr.exports.WASM_LOADED=!0,Px=dc)})});var mn=m(Dr=>{"use strict";c();var mH=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]}),wH=Dr&&Dr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),EH=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)&&mH(e,t,r);return wH(e,t),e};Object.defineProperty(Dr,"__esModule",{value:!0});Dr.TransactionHash=Dr.Transaction=void 0;var $o=Gt(),pc=ht(),vH=Oh(),AH=ms(),bH=EH(Be()),_H=kT(),jn=oc(),IH=WC(),Bx=Fh(),Lx=qn(),SH=gr(),TH=Rx(),CH=32,qw=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:w}){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||AH.TRANSACTION_MIN_GAS_PRICE,this.gasLimit=u,this.data=l||new Lx.TransactionPayload,this.chainID=f,this.version=d?new jn.TransactionVersion(d.valueOf()):jn.TransactionVersion.withDefaultVersion(),this.options=g?new jn.TransactionOptions(g.valueOf()):jn.TransactionOptions.withDefaultOptions(),this.guardian=w||pc.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 jn.TransactionVersion(e.valueOf())}getOptions(){return new jn.TransactionOptions(this.options.valueOf())}setOptions(e){this.options=new jn.TransactionOptions(e.valueOf())}getSignature(){return this.signature}getGuardianSignature(){return this.guardianSignature}setGuardian(e){this.guardian=e}getHash(){return SH.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 vH.Compatibility.guardAddressIsSetAndNonZero(new pc.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:pc.Address.fromString(e.receiver),receiverUsername:e.receiverUsername?h.Buffer.from(e.receiverUsername,"base64").toString():void 0,sender:pc.Address.fromString(e.sender),senderUsername:e.senderUsername?h.Buffer.from(e.senderUsername,"base64").toString():void 0,guardian:e.guardian?pc.Address.fromString(e.guardian):void 0,gasPrice:Number(e.gasPrice),gasLimit:Number(e.gasLimit),data:new Lx.TransactionPayload(h.Buffer.from(e.data||"","base64")),chainID:String(e.chainID),version:new jn.TransactionVersion(e.version),options:e.options!=null?new jn.TransactionOptions(e.options):void 0});return e.signature&&r.applySignature(new Bx.Signature(e.signature)),e.guardianSignature&&r.applyGuardianSignature(new Bx.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 bH.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=qw;var Ko=class t extends _H.Hash{constructor(e){super(e)}static compute(e){let n=new IH.ProtoSerializer().serializeTransaction(e),i=TH(CH).update(n).digest("hex");return new t(i)}};Dr.TransactionHash=Ko});var jw=m(jh=>{"use strict";c();Object.defineProperty(jh,"__esModule",{value:!0});jh.TransferTransactionsFactory=void 0;var Vw=Vo(),Qr=Ot(),Gh=mn(),Hw=qn(),Gw=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 Gh.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 Vw.ArgSerializer().valuesToString([Qr.BytesValue.fromUTF8(e.tokenTransfer.tokenIdentifier),new Qr.BigUIntValue(e.tokenTransfer.valueOf())]),n=`ESDTTransfer@${r}`,i=new Hw.TransactionPayload(n),s=i.length()||0,o=this.gasEstimator.forESDTTransfer(s);return new Gh.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 Vw.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 Hw.TransactionPayload(n),s=i.length()||0,o=this.gasEstimator.forESDTNFTTransfer(s);return new Gh.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 Vw.ArgSerializer().valuesToString(r),i=`MultiESDTNFTTransfer@${n}`,s=new Hw.TransactionPayload(i),o=s.length()||0,a=this.gasEstimator.forMultiESDTNFTTransfer(o,e.tokenTransfers.length);return new Gh.Transaction({nonce:e.nonce,receiver:e.sender,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||a,data:s,chainID:e.chainID})}};jh.TransferTransactionsFactory=Gw});var Qw=m(Cs=>{"use strict";c();Object.defineProperty(Cs,"__esModule",{value:!0});Cs.GasEstimator=Cs.DefaultGasConfiguration=void 0;Cs.DefaultGasConfiguration={minGasLimit:5e4,gasPerDataByte:1500,gasCostESDTTransfer:2e5,gasCostESDTNFTTransfer:2e5,gasCostESDTNFTMultiTransfer:2e5};var xH=1e5,Fx=8e5,kw=class{constructor(e){this.gasConfiguration=e||Cs.DefaultGasConfiguration}forEGLDTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasPerDataByte*e}forESDTTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasCostESDTTransfer+this.gasConfiguration.gasPerDataByte*e+xH}forESDTNFTTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasCostESDTNFTTransfer+this.gasConfiguration.gasPerDataByte*e+Fx}forMultiESDTNFTTransfer(e,r){return this.gasConfiguration.minGasLimit+(this.gasConfiguration.gasCostESDTNFTMultiTransfer+Fx)*r+this.gasConfiguration.gasPerDataByte*e}};Cs.GasEstimator=kw});var Yo=m(kh=>{"use strict";c();Object.defineProperty(kh,"__esModule",{value:!0});kh.Account=void 0;var NH=ht(),Ww=class{constructor(e){this.address=new NH.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=Ww});var Jo=m(Ns=>{"use strict";c();Object.defineProperty(Ns,"__esModule",{value:!0});Ns.Logger=Ns.LogLevel=void 0;var xs;(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"})(xs=Ns.LogLevel||(Ns.LogLevel={}));var Qh=class t{static setLevel(e){t.logLevel=e}static trace(e,...r){t.logLevel>=xs.Debug||console.debug(e,r)}static debug(e,...r){t.logLevel>=xs.Debug||console.debug(e,r)}static info(e,...r){t.logLevel>=xs.Info||console.log(e,r)}static warn(e,...r){t.logLevel>=xs.Warn||console.warn(e,r)}static error(e,...r){t.logLevel>=xs.Error||console.error(e,r)}};Ns.Logger=Qh;Qh.logLevel=xs.Debug});var Kw=m(wn=>{"use strict";c();var OH=wn&&wn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),DH=wn&&wn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),PH=wn&&wn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&OH(e,t,r);return DH(e,t),e};Object.defineProperty(wn,"__esModule",{value:!0});wn.AsyncTimer=void 0;var RH=PH(Be()),BH=Be(),zw=Jo(),$w=class{constructor(e){this.timeoutHandle=null,this.rejectionFunc=null,this.name=e,this.correlationTag=0}start(e){if(this.timeoutHandle)throw new RH.ErrAsyncTimerAlreadyRunning;return this.correlationTag++,zw.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(){zw.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].abort()`),this.rejectionFunc&&(this.rejectionFunc(new BH.ErrAsyncTimerAborted),this.rejectionFunc=null),this.stop()}stop(){this.isStopped()||(zw.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].stop()`),this.timeoutHandle&&(clearTimeout(this.timeoutHandle),this.timeoutHandle=null))}isStopped(){return!this.timeoutHandle}};wn.AsyncTimer=$w});var Wh=m(Zo=>{"use strict";c();var Pr=Zo&&Zo.__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(Zo,"__esModule",{value:!0});Zo.TransactionWatcher=void 0;var Yw=Kw(),Xo=Be(),Mx=Jo(),Ii=class t{constructor(e,r={}){this.fetcher=new Jw(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 Xo.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 Xo.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 Xo.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 Xo.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 Xo.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)})}awaitConditionally(e,r,n){return Pr(this,void 0,void 0,function*(){let i=new Yw.AsyncTimer("watcher:periodic"),s=new Yw.AsyncTimer("watcher:patience"),o=new Yw.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(Mx.Logger.debug("TransactionWatcher.awaitConditionally(): cannot (yet) fetch data."),!(f instanceof Xo.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}};Zo.TransactionWatcher=Ii;Ii.DefaultPollingInterval=6e3;Ii.DefaultTimeout=Ii.DefaultPollingInterval*15;Ii.DefaultPatience=0;Ii.NoopOnStatusReceived=t=>{};var Jw=class{constructor(e){this.fetcher=e}getTransaction(e){return Pr(this,void 0,void 0,function*(){return Mx.Logger.debug(`transactionWatcher, getTransaction(${e})`),yield this.fetcher.getTransaction(e)})}}});var Zw=m(Kh=>{"use strict";c();Object.defineProperty(Kh,"__esModule",{value:!0});Kh.CodeMetadata=void 0;var Xw=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|=zh.Upgradeable),this.readable&&(e|=zh.Readable),this.payable&&(r|=$h.Payable),this.payableBySc&&(r|=$h.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}};Kh.CodeMetadata=Xw;var zh;(function(t){t[t.Upgradeable=1]="Upgradeable",t[t.Reserved2=2]="Reserved2",t[t.Readable=4]="Readable"})(zh||(zh={}));var $h;(function(t){t[t.Reserved1=1]="Reserved1",t[t.Payable=2]="Payable",t[t.PayableBySc=4]="PayableBySc"})($h||($h={}))});var gc=m(En=>{"use strict";c();var LH=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]}),FH=En&&En.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MH=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)&&LH(e,t,r);return FH(e,t),e};Object.defineProperty(En,"__esModule",{value:!0});En.ContractFunction=void 0;var UH=MH(Be()),eE=class t{constructor(e){if(this.name=e,e==null)throw new UH.ErrInvalidFunctionName}static none(){return new t("untitled")}toString(){return this.name}valueOf(){return this.name}};En.ContractFunction=eE});var nE=m(Rr=>{"use strict";c();var qH=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]}),VH=Rr&&Rr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HH=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)&&qH(e,t,r);return VH(e,t),e},GH=Rr&&Rr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Rr,"__esModule",{value:!0});Rr.InteractionChecker=void 0;var tE=HH(Be()),jH=GH(Gt()),rE=class{checkInteraction(e,r){this.checkPayable(e,r),this.checkArguments(e,r)}checkPayable(e,r){let n=!new jH.default(e.getValue().toString()).isZero(),i=r.modifiers.isPayableInEGLD();if(n&&!i)throw new tE.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 tE.ErrContractInteraction(`bad arguments, expected: ${s}, got: ${o}`);for(let a=0;a{"use strict";c();Object.defineProperty(Yh,"__esModule",{value:!0});Yh.Query=void 0;var kH=ht(),QH=Vo(),iE=class{constructor(e){this.caller=e.caller||new kH.Address,this.address=e.address,this.func=e.func,this.args=e.args||[],this.value=e.value||0}getEncodedArguments(){return new QH.ArgSerializer().valuesToStrings(this.args)}};Yh.Query=iE});var uE=m(Jh=>{"use strict";c();Object.defineProperty(Jh,"__esModule",{value:!0});Jh.Interaction=void 0;var Ux=ht(),WH=Oh(),sE=ms(),oE=gc(),zH=nE(),$H=yc(),ea=Ot(),aE=class{constructor(e,r,n){this.nonce=0,this.value="0",this.gasLimit=0,this.gasPrice=void 0,this.chainID="",this.querent=new Ux.Address,this.sender=new Ux.Address,this.isWithSingleESDTTransfer=!1,this.isWithSingleESDTNFTTransfer=!1,this.isWithMultiESDTNFTTransfer=!1,this.contract=e,this.function=r,this.args=n,this.tokenTransfers=new ta([],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(){WH.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 oE.ContractFunction(sE.ESDT_TRANSFER_FUNCTION_NAME),n=this.tokenTransfers.buildArgsForSingleESDTTransfer()):this.isWithSingleESDTNFTTransfer?(e=this.sender,r=new oE.ContractFunction(sE.ESDTNFT_TRANSFER_FUNCTION_NAME),n=this.tokenTransfers.buildArgsForSingleESDTNFTTransfer()):this.isWithMultiESDTNFTTransfer&&(e=this.sender,r=new oE.ContractFunction(sE.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 $H.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 ta([e],this),this}withSingleESDTNFTTransfer(e,r){return this.isWithSingleESDTNFTTransfer=!0,this.tokenTransfers=new ta([e],this),r&&(this.sender=r),this}withMultiESDTNFTTransfer(e,r){return this.isWithMultiESDTNFTTransfer=!0,this.tokenTransfers=new ta(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 zH.InteractionChecker().checkInteraction(this,this.getEndpoint()),this}};Jh.Interaction=aE;var ta=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 ea.U8Value(this.transfers.length)}getTypedTokenIdentifier(e){return ea.BytesValue.fromUTF8(e.tokenIdentifier)}getTypedTokenNonce(e){return new ea.U64Value(e.nonce)}getTypedTokenQuantity(e){return new ea.BigUIntValue(e.amountAsBigInteger)}getTypedTokensReceiver(){return new ea.AddressValue(this.interaction.getContractAddress())}getTypedInteractionFunction(){return ea.BytesValue.fromUTF8(this.interaction.getFunction().valueOf())}getInteractionArguments(){return this.interaction.getArguments()}}});var qx=m(Xh=>{"use strict";c();Object.defineProperty(Xh,"__esModule",{value:!0});Xh.ArgumentErrorContext=void 0;var KH=Be(),cE=class{constructor(e,r,n){this.endpointName=e,this.argumentIndex=r,this.parameterDefinition=n}throwError(e){throw new KH.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)})`)}};Xh.ArgumentErrorContext=cE});var lE=m(Os=>{"use strict";c();var YH=Os&&Os.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Os,"__esModule",{value:!0});Os.NativeSerializer=void 0;var JH=YH(Gt()),XH=ht(),Vx=Be(),ZH=oh(),eG=qx(),Ae=Ot(),tG;(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 w(_,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(Wr,"__esModule",{value:!0});Wr.ContractCallPayloadBuilder=Wr.ContractUpgradePayloadBuilder=Wr.ContractDeployPayloadBuilder=Wr.ArwenVirtualMachine=void 0;var pE=qn(),gE=gr(),rG=Vo();Wr.ArwenVirtualMachine="0500";var fE=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(){gE.guardValueIsSet("code",this.code);let e=this.code.toString(),r=this.codeMetadata.toString(),n=`${e}@${Wr.ArwenVirtualMachine}@${r}`;return n=yE(n,this.arguments),new pE.TransactionPayload(n)}};Wr.ContractDeployPayloadBuilder=fE;var hE=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(){gE.guardValueIsSet("code",this.code);let e=this.code.toString(),r=this.codeMetadata.toString(),n=`upgradeContract@${e}@${r}`;return n=yE(n,this.arguments),new pE.TransactionPayload(n)}};Wr.ContractUpgradePayloadBuilder=hE;var dE=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(){gE.guardValueIsSet("calledFunction",this.contractFunction);let e=this.contractFunction.name;return e=yE(e,this.arguments),new pE.TransactionPayload(e)}};Wr.ContractCallPayloadBuilder=dE;function yE(t,e){let{argumentsString:r,count:n}=new rG.ArgSerializer().valuesToString(e);return n==0?t:`${t}@${r}`}});var kn=m((Lae,wE)=>{"use strict";c();var ra=typeof Reflect=="object"?Reflect:null,Hx=ra&&typeof ra.apply=="function"?ra.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},Zh;ra&&typeof ra.ownKeys=="function"?Zh=ra.ownKeys:Object.getOwnPropertySymbols?Zh=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Zh=function(e){return Object.getOwnPropertyNames(e)};function nG(t){console&&console.warn&&console.warn(t)}var jx=Number.isNaN||function(e){return e!==e};function ke(){ke.init.call(this)}wE.exports=ke;wE.exports.once=aG;ke.EventEmitter=ke;ke.prototype._events=void 0;ke.prototype._eventsCount=0;ke.prototype._maxListeners=void 0;var Gx=10;function ed(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 Gx},set:function(t){if(typeof t!="number"||t<0||jx(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Gx=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||jx(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 kx(t){return t._maxListeners===void 0?ke.defaultMaxListeners:t._maxListeners}ke.prototype.getMaxListeners=function(){return kx(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")Hx(u,this,r);else for(var l=u.length,f=Kx(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,nG(a)}return t}ke.prototype.addListener=function(e,r){return Qx(this,e,r,!1)};ke.prototype.on=ke.prototype.addListener;ke.prototype.prependListener=function(e,r){return Qx(this,e,r,!0)};function iG(){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 Wx(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=iG.bind(n);return i.listener=r,n.wrapFn=i,i}ke.prototype.once=function(e,r){return ed(r),this.on(e,Wx(this,e,r)),this};ke.prototype.prependOnceListener=function(e,r){return ed(r),this.prependListener(e,Wx(this,e,r)),this};ke.prototype.removeListener=function(e,r){var n,i,s,o,a;if(ed(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():sG(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 zx(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?oG(i):Kx(i,i.length)}ke.prototype.listeners=function(e){return zx(this,e,!0)};ke.prototype.rawListeners=function(e){return zx(this,e,!1)};ke.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):$x.call(t,e)};ke.prototype.listenerCount=$x;function $x(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?Zh(this._events):[]};function Kx(t,e){for(var r=new Array(e),n=0;n{c();Jx.exports=kn().EventEmitter});var vE=m(()=>{c()});var nN=m((Gae,rN)=>{"use strict";c();function Xx(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 Zx(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 td.alloc(0);for(var n=td.allocUnsafe(r>>>0),i=this.head,s=0;i;)yG(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=td.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:gG,value:function(r,n){return AE(this,Zx(Zx({},n),{},{depth:0,customInspect:!1}))}}]),t}()});var _E=m((kae,sN)=>{"use strict";c();function mG(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(bE,this,t)):p.default.nextTick(bE,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(rd,r):(r._writableState.errorEmitted=!0,p.default.nextTick(iN,r,s)):p.default.nextTick(iN,r,s):e?(p.default.nextTick(rd,r),e(s)):p.default.nextTick(rd,r)}),this)}function iN(t,e){bE(t,e),rd(t)}function rd(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function wG(){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 bE(t,e){t.emit("error",e)}function EG(t,e){var r=t._readableState,n=t._writableState;r&&r.autoDestroy||n&&n.autoDestroy?t.destroy(e):t.emit("error",e)}sN.exports={destroy:mG,undestroy:wG,errorOrDestroy:EG}});var Ds=m((Wae,uN)=>{"use strict";c();function vG(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var aN={};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){vG(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,aN[t]=i}function oN(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 AG(t,e,r){return t.substr(!r||r<0?0:+r,e.length)===e}function bG(t,e,r){return(r===void 0||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}function _G(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"&&AG(e,"not ")?(n="must not be",e=e.replace(/^not /,"")):n="must be";var i;if(bG(t," argument"))i="The ".concat(t," ").concat(n," ").concat(oN(e,"type"));else{var s=_G(t,".")?"property":"argument";i='The "'.concat(t,'" ').concat(s," ").concat(n," ").concat(oN(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");uN.exports.codes=aN});var IE=m(($ae,cN)=>{"use strict";c();var IG=Ds().codes.ERR_INVALID_OPT_VALUE;function SG(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function TG(t,e,r,n){var i=SG(e,n,r);if(i!=null){if(!(isFinite(i)&&Math.floor(i)===i)||i<0){var s=n?r:"highWaterMark";throw new IG(s,i)}return Math.floor(i)}return t.objectMode?16:16*1024}cN.exports={getHighWaterMark:TG}});var na=m((Yae,SE)=>{c();typeof Object.create=="function"?SE.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:SE.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 fN=m((Xae,lN)=>{c();lN.exports=CG;function CG(t,e){if(TE("noDeprecation"))return t;var r=!1;function n(){if(!r){if(TE("throwDeprecation"))throw new Error(e);TE("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}return n}function TE(t){try{if(!global.localStorage)return!1}catch{return!1}var e=global.localStorage[t];return e==null?!1:String(e).toLowerCase()==="true"}});var NE=m((eue,mN)=>{"use strict";c();mN.exports=dt;function dN(t){var e=this;this.next=null,this.entry=null,this.finish=function(){ej(e,t)}}var ia;dt.WritableState=wc;var xG={deprecate:fN()},pN=EE(),id=Ts().Buffer,NG=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function OG(t){return id.from(t)}function DG(t){return id.isBuffer(t)||t instanceof NG}var xE=_E(),PG=IE(),RG=PG.getHighWaterMark,Si=Ds().codes,BG=Si.ERR_INVALID_ARG_TYPE,LG=Si.ERR_METHOD_NOT_IMPLEMENTED,FG=Si.ERR_MULTIPLE_CALLBACK,MG=Si.ERR_STREAM_CANNOT_PIPE,UG=Si.ERR_STREAM_DESTROYED,qG=Si.ERR_STREAM_NULL_VALUES,VG=Si.ERR_STREAM_WRITE_AFTER_END,HG=Si.ERR_UNKNOWN_ENCODING,sa=xE.errorOrDestroy;na()(dt,pN);function GG(){}function wc(t,e,r){ia=ia||Ps(),t=t||{},typeof r!="boolean"&&(r=e instanceof ia),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=RG(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){KG(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 dN(this)}wc.prototype.getBuffer=function(){for(var e=this.bufferedRequest,r=[];e;)r.push(e),e=e.next;return r};(function(){try{Object.defineProperty(wc.prototype,"buffer",{get:xG.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var nd;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(nd=Function.prototype[Symbol.hasInstance],Object.defineProperty(dt,Symbol.hasInstance,{value:function(e){return nd.call(this,e)?!0:this!==dt?!1:e&&e._writableState instanceof wc}})):nd=function(e){return e instanceof this};function dt(t){ia=ia||Ps();var e=this instanceof ia;if(!e&&!nd.call(dt,this))return new dt(t);this._writableState=new wc(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)),pN.call(this)}dt.prototype.pipe=function(){sa(this,new MG)};function jG(t,e){var r=new VG;sa(t,r),p.default.nextTick(e,r)}function kG(t,e,r,n){var i;return r===null?i=new qG:typeof r!="string"&&!e.objectMode&&(i=new BG("chunk",["string","Buffer"],r)),i?(sa(t,i),p.default.nextTick(n,i),!1):!0}dt.prototype.write=function(t,e,r){var n=this._writableState,i=!1,s=!n.objectMode&&DG(t);return s&&!id.isBuffer(t)&&(t=OG(t)),typeof e=="function"&&(r=e,e=null),s?e="buffer":e||(e=n.defaultEncoding),typeof r!="function"&&(r=GG),n.ending?jG(this,r):(s||kG(this,n,t,r))&&(n.pendingcb++,i=WG(this,n,s,t,e,r)),i};dt.prototype.cork=function(){this._writableState.corked++};dt.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,!t.writing&&!t.corked&&!t.bufferProcessing&&t.bufferedRequest&&gN(this,t))};dt.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 HG(e);return this._writableState.defaultEncoding=e,this};Object.defineProperty(dt.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function QG(t,e,r){return!t.objectMode&&t.decodeStrings!==!1&&typeof e=="string"&&(e=id.from(e,r)),e}Object.defineProperty(dt.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function WG(t,e,r,n,i,s){if(!r){var o=QG(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 tj=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};EN.exports=vn;var wN=PE(),DE=NE();na()(vn,wN);for(OE=tj(DE.prototype),sd=0;sd{c();var ad=Ts(),An=ad.Buffer;function vN(t,e){for(var r in t)e[r]=t[r]}An.from&&An.alloc&&An.allocUnsafe&&An.allocUnsafeSlow?AN.exports=ad:(vN(ad,RE),RE.Buffer=Rs);function Rs(t,e,r){return An(t,e,r)}Rs.prototype=Object.create(An.prototype);vN(An,Rs);Rs.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return An(t,e,r)};Rs.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=An(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};Rs.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return An(t)};Rs.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return ad.SlowBuffer(t)}});var FE=m(IN=>{"use strict";c();var LE=bN().Buffer,_N=LE.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 ij(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 sj(t){var e=ij(t);if(typeof e!="string"&&(LE.isEncoding===_N||!_N(t)))throw new Error("Unknown encoding: "+t);return e||t}IN.StringDecoder=Ec;function Ec(t){this.encoding=sj(t);var e;switch(this.encoding){case"utf16le":this.text=fj,this.end=hj,e=4;break;case"utf8":this.fillLast=uj,e=4;break;case"base64":this.text=dj,this.end=pj,e=3;break;default:this.write=gj,this.end=yj;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=LE.allocUnsafe(e)}Ec.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 oj(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 aj(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 uj(t){var e=this.lastTotal-this.lastNeed,r=aj(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 cj(t,e){var r=oj(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 lj(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function fj(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 hj(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 dj(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 pj(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function gj(t){return t.toString(this.encoding)}function yj(t){return t&&t.length?this.write(t):""}});var ud=m((aue,CN)=>{"use strict";c();var SN=Ds().codes.ERR_STREAM_PREMATURE_CLOSE;function mj(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 cd;function Ti(t,e,r){return e=vj(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function vj(t){var e=Aj(t,"string");return typeof e=="symbol"?e:String(e)}function Aj(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 bj=ud(),Ci=Symbol("lastResolve"),Bs=Symbol("lastReject"),vc=Symbol("error"),ld=Symbol("ended"),Ls=Symbol("lastPromise"),ME=Symbol("handlePromise"),Fs=Symbol("stream");function xi(t,e){return{value:t,done:e}}function _j(t){var e=t[Ci];if(e!==null){var r=t[Fs].read();r!==null&&(t[Ls]=null,t[Ci]=null,t[Bs]=null,e(xi(r,!1)))}}function Ij(t){p.default.nextTick(_j,t)}function Sj(t,e){return function(r,n){t.then(function(){if(e[ld]){r(xi(void 0,!0));return}e[ME](r,n)},n)}}var Tj=Object.getPrototypeOf(function(){}),Cj=Object.setPrototypeOf((cd={get stream(){return this[Fs]},next:function(){var e=this,r=this[vc];if(r!==null)return Promise.reject(r);if(this[ld])return Promise.resolve(xi(void 0,!0));if(this[Fs].destroyed)return new Promise(function(o,a){p.default.nextTick(function(){e[vc]?a(e[vc]):o(xi(void 0,!0))})});var n=this[Ls],i;if(n)i=new Promise(Sj(n,this));else{var s=this[Fs].read();if(s!==null)return Promise.resolve(xi(s,!1));i=new Promise(this[ME])}return this[Ls]=i,i}},Ti(cd,Symbol.asyncIterator,function(){return this}),Ti(cd,"return",function(){var e=this;return new Promise(function(r,n){e[Fs].destroy(null,function(i){if(i){n(i);return}r(xi(void 0,!0))})})}),cd),Tj),xj=function(e){var r,n=Object.create(Cj,(r={},Ti(r,Fs,{value:e,writable:!0}),Ti(r,Ci,{value:null,writable:!0}),Ti(r,Bs,{value:null,writable:!0}),Ti(r,vc,{value:null,writable:!0}),Ti(r,ld,{value:e._readableState.endEmitted,writable:!0}),Ti(r,ME,{value:function(s,o){var a=n[Fs].read();a?(n[Ls]=null,n[Ci]=null,n[Bs]=null,s(xi(a,!1))):(n[Ci]=s,n[Bs]=o)},writable:!0}),r));return n[Ls]=null,bj(e,function(i){if(i&&i.code!=="ERR_STREAM_PREMATURE_CLOSE"){var s=n[Bs];s!==null&&(n[Ls]=null,n[Ci]=null,n[Bs]=null,s(i)),n[vc]=i;return}var o=n[Ci];o!==null&&(n[Ls]=null,n[Ci]=null,n[Bs]=null,o(xi(void 0,!0))),n[ld]=!0}),e.on("readable",Ij.bind(null,n)),n};xN.exports=xj});var DN=m((fue,ON)=>{c();ON.exports=function(){throw new Error("Readable.from is not available in the browser")}});var PE=m((pue,HN)=>{"use strict";c();HN.exports=Me;var oa;Me.ReadableState=LN;var due=kn().EventEmitter,BN=function(e,r){return e.listeners(r).length},bc=EE(),fd=Ts().Buffer,Nj=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function Oj(t){return fd.from(t)}function Dj(t){return fd.isBuffer(t)||t instanceof Nj}var UE=vE(),xe;UE&&UE.debuglog?xe=UE.debuglog("stream"):xe=function(){};var Pj=nN(),QE=_E(),Rj=IE(),Bj=Rj.getHighWaterMark,hd=Ds().codes,Lj=hd.ERR_INVALID_ARG_TYPE,Fj=hd.ERR_STREAM_PUSH_AFTER_EOF,Mj=hd.ERR_METHOD_NOT_IMPLEMENTED,Uj=hd.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,aa,qE,VE;na()(Me,bc);var Ac=QE.errorOrDestroy,HE=["error","close","destroy","pause","resume"];function qj(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 LN(t,e,r){oa=oa||Ps(),t=t||{},typeof r!="boolean"&&(r=e instanceof oa),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=Bj(this,t,"readableHighWaterMark",r),this.buffer=new Pj,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&&(aa||(aa=FE().StringDecoder),this.decoder=new aa(t.encoding),this.encoding=t.encoding)}function Me(t){if(oa=oa||Ps(),!(this instanceof Me))return new Me(t);var e=this instanceof oa;this._readableState=new LN(t,this,e),this.readable=!0,t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy)),bc.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=QE.destroy;Me.prototype._undestroy=QE.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=fd.from(t,e),e=""),n=!0),FN(this,t,e,!1,n)};Me.prototype.unshift=function(t){return FN(this,t,null,!0,!1)};function FN(t,e,r,n,i){xe("readableAddChunk",e);var s=t._readableState;if(e===null)s.reading=!1,Gj(t,s);else{var o;if(i||(o=Vj(s,e)),o)Ac(t,o);else if(s.objectMode||e&&e.length>0)if(typeof e!="string"&&!s.objectMode&&Object.getPrototypeOf(e)!==fd.prototype&&(e=Oj(e)),n)s.endEmitted?Ac(t,new Uj):GE(t,s,e,!0);else if(s.ended)Ac(t,new Fj);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(e=s.decoder.write(e),s.objectMode||e.length!==0?GE(t,s,e,!1):kE(t,s)):GE(t,s,e,!1)}else n||(s.reading=!1,kE(t,s))}return!s.ended&&(s.length=PN?t=PN:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}function RN(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=Hj(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?jE(this):dd(this),null;if(t=RN(t,e),t===0&&e.ended)return e.length===0&&jE(this),null;var n=e.needReadable;xe("need readable",n),(e.length===0||e.length-t0?i=qN(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&&jE(this)),i!==null&&this.emit("data",i),i};function Gj(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?dd(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,MN(t)))}}function dd(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(MN,t))}function MN(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,WE(t)}function kE(t,e){e.readingMore||(e.readingMore=!0,p.default.nextTick(jj,t,e))}function jj(t,e){for(;!e.reading&&!e.ended&&(e.length1&&VN(n.pipes,t)!==-1)&&!l&&(xe("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function g(O){xe("onerror",O),x(),t.removeListener("error",g),BN(t,"error")===0&&Ac(t,O)}qj(t,"error",g);function w(){t.removeListener("finish",E),x()}t.once("close",w);function E(){xe("onfinish"),t.removeListener("close",w),x()}t.once("finish",E);function x(){xe("unpipe"),r.unpipe(t)}return t.emit("pipe",r),n.flowing||(xe("pipe resume"),r.resume()),t};function kj(t){return function(){var r=t._readableState;xe("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,r.awaitDrain===0&&BN(t,"data")&&(r.flowing=!0,WE(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?dd(this):n.reading||p.default.nextTick(Qj,this)),r};Me.prototype.addListener=Me.prototype.on;Me.prototype.removeListener=function(t,e){var r=bc.prototype.removeListener.call(this,t,e);return t==="readable"&&p.default.nextTick(UN,this),r};Me.prototype.removeAllListeners=function(t){var e=bc.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&p.default.nextTick(UN,this),e};function UN(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 Qj(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,Wj(this,t)),t.paused=!1,this};function Wj(t,e){e.resumeScheduled||(e.resumeScheduled=!0,p.default.nextTick(zj,t,e))}function zj(t,e){xe("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),WE(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 WE(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 jE(t){var e=t._readableState;xe("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,p.default.nextTick($j,e,t))}function $j(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 VE===void 0&&(VE=DN()),VE(Me,t,e)});function VN(t,e){for(var r=0,n=t.length;r{"use strict";c();jN.exports=Qn;var pd=Ds().codes,Kj=pd.ERR_METHOD_NOT_IMPLEMENTED,Yj=pd.ERR_MULTIPLE_CALLBACK,Jj=pd.ERR_TRANSFORM_ALREADY_TRANSFORMING,Xj=pd.ERR_TRANSFORM_WITH_LENGTH_0,gd=Ps();na()(Qn,gd);function Zj(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(n===null)return this.emit("error",new Yj);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();QN.exports=_c;var kN=zE();na()(_c,kN);function _c(t){if(!(this instanceof _c))return new _c(t);kN.call(this,t)}_c.prototype._transform=function(t,e,r){r(null,t)}});var JN=m((vue,YN)=>{"use strict";c();var $E;function tk(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}var KN=Ds().codes,rk=KN.ERR_MISSING_ARGS,nk=KN.ERR_STREAM_DESTROYED;function zN(t){if(t)throw t}function ik(t){return t.setHeader&&typeof t.abort=="function"}function sk(t,e,r,n){n=tk(n);var i=!1;t.on("close",function(){i=!0}),$E===void 0&&($E=ud()),$E(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,ik(t))return t.abort();if(typeof t.destroy=="function")return t.destroy();n(o||new nk("pipe"))}}}function $N(t){t()}function ok(t,e){return t.pipe(e)}function ak(t){return!t.length||typeof t[t.length-1]!="function"?zN:t.pop()}function uk(){for(var t=arguments.length,e=new Array(t),r=0;r0;return sk(o,u,l,function(f){i||(i=f),f&&s.forEach($N),!u&&(s.forEach($N),n(i))})});return e.reduce(ok)}YN.exports=uk});var KE=m((Lr,XN)=>{c();Lr=XN.exports=PE();Lr.Stream=Lr;Lr.Readable=Lr;Lr.Writable=NE();Lr.Duplex=Ps();Lr.Transform=zE();Lr.PassThrough=WN();Lr.finished=ud();Lr.pipeline=JN()});var tO=m((_ue,eO)=>{c();var{Transform:ck}=KE();eO.exports=t=>class ZN extends ck{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 ZN(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}}});var iO=m((Sue,nO)=>{c();var{Transform:lk}=KE();nO.exports=t=>class rO extends lk{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 rO(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}}});var oO=m((Cue,sO)=>{c();var fk=tO(),hk=iO();sO.exports=function(t){let e=fk(t),r=hk(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 cO=m(uO=>{c();var aO=[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];uO.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),w=d^(s<<1|i>>>31),E=t[0]^g,x=t[1]^w,O=t[10]^g,F=t[11]^w,_=t[20]^g,I=t[21]^w,S=t[30]^g,R=t[31]^w,B=t[40]^g,b=t[41]^w;g=r^(o<<1|a>>>31),w=n^(a<<1|o>>>31);let T=t[2]^g,L=t[3]^w,X=t[12]^g,W=t[13]^w,G=t[22]^g,j=t[23]^w,K=t[32]^g,de=t[33]^w,ue=t[42]^g,re=t[43]^w;g=i^(u<<1|l>>>31),w=s^(l<<1|u>>>31);let Y=t[4]^g,se=t[5]^w,te=t[14]^g,ie=t[15]^w,q=t[24]^g,le=t[25]^w,ae=t[34]^g,fe=t[35]^w,oe=t[44]^g,ce=t[45]^w;g=o^(f<<1|d>>>31),w=a^(d<<1|f>>>31);let y=t[6]^g,v=t[7]^w,A=t[16]^g,P=t[17]^w,C=t[26]^g,D=t[27]^w,M=t[36]^g,N=t[37]^w,U=t[46]^g,H=t[47]^w;g=u^(r<<1|n>>>31),w=l^(n<<1|r>>>31);let V=t[8]^g,Z=t[9]^w,we=t[18]^g,ve=t[19]^w,Pe=t[28]^g,tt=t[29]^w,lt=t[38]^g,Oe=t[39]^w,Ue=t[48]^g,xt=t[49]^w,ui=E,hs=x,ds=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,xy=B<<18|b>>>14,Ny=b<<18|B>>>14,Oy=T<<1|L>>>31,Dy=L<<1|T>>>31,Py=W<<12|X>>>20,Ry=X<<12|W>>>20,By=G<<10|j>>>22,Ly=j<<10|G>>>22,Fy=de<<13|K>>>19,My=K<<13|de>>>19,Uy=ue<<2|re>>>30,qy=re<<2|ue>>>30,Vy=se<<30|Y>>>2,Hy=Y<<30|se>>>2,Gy=te<<6|ie>>>26,jy=ie<<6|te>>>26,ky=le<<11|q>>>21,Qy=q<<11|le>>>21,Wy=ae<<15|fe>>>17,zy=fe<<15|ae>>>17,$y=ce<<29|oe>>>3,Ky=oe<<29|ce>>>3,Yy=y<<28|v>>>4,Jy=v<<28|y>>>4,Xy=P<<23|A>>>9,Zy=A<<23|P>>>9,e0=C<<25|D>>>7,t0=D<<25|C>>>7,r0=M<<21|N>>>11,n0=N<<21|M>>>11,i0=H<<24|U>>>8,s0=U<<24|H>>>8,o0=V<<27|Z>>>5,a0=Z<<27|V>>>5,u0=we<<20|ve>>>12,c0=ve<<20|we>>>12,l0=tt<<7|Pe>>>25,f0=Pe<<7|tt>>>25,h0=lt<<8|Oe>>>24,d0=Oe<<8|lt>>>24,p0=Ue<<14|xt>>>18,g0=xt<<14|Ue>>>18;t[0]=ui^~Py&ky,t[1]=hs^~Ry&Qy,t[10]=Yy^~u0&Bn,t[11]=Jy^~c0&Wt,t[20]=Oy^~Gy&e0,t[21]=Dy^~jy&t0,t[30]=o0^~ds&By,t[31]=a0^~nr&Ly,t[40]=Vy^~Xy&l0,t[41]=Hy^~Zy&f0,t[2]=Py^~ky&r0,t[3]=Ry^~Qy&n0,t[12]=u0^~Bn&Fy,t[13]=c0^~Wt&My,t[22]=Gy^~e0&h0,t[23]=jy^~t0&d0,t[32]=ds^~By&Wy,t[33]=nr^~Ly&zy,t[42]=Xy^~l0&Nt,t[43]=Zy^~f0&ze,t[4]=ky^~r0&p0,t[5]=Qy^~n0&g0,t[14]=Bn^~Fy&$y,t[15]=Wt^~My&Ky,t[24]=e0^~h0&xy,t[25]=t0^~d0&Ny,t[34]=By^~Wy&i0,t[35]=Ly^~zy&s0,t[44]=l0^~Nt&Uy,t[45]=f0^~ze&qy,t[6]=r0^~p0&ui,t[7]=n0^~g0&hs,t[16]=Fy^~$y&Yy,t[17]=My^~Ky&Jy,t[26]=h0^~xy&Oy,t[27]=d0^~Ny&Dy,t[36]=Wy^~i0&o0,t[37]=zy^~s0&a0,t[46]=Nt^~Uy&Vy,t[47]=ze^~qy&Hy,t[8]=p0^~ui&Py,t[9]=g0^~hs&Ry,t[18]=$y^~Yy&u0,t[19]=Ky^~Jy&c0,t[28]=xy^~Oy&Gy,t[29]=Ny^~Dy&jy,t[38]=i0^~o0&ds,t[39]=s0^~a0&nr,t[48]=Uy^~Vy&Xy,t[49]=qy^~Hy&Zy,t[0]^=aO[e*2],t[1]^=aO[e*2+1]}}});var fO=m((Due,lO)=>{c();var yd=cO();function ua(){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}ua.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};ua.prototype.absorb=function(t){for(let e=0;e>>8*(this.count%4)&255,this.count+=1,this.count===this.blockSize&&(yd.p1600(this.state),this.count=0);return e};ua.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};lO.exports=ua});var YE=m((Rue,hO)=>{c();hO.exports=oO()(fO())});var ev=m(ca=>{"use strict";c();var dk=ca&&ca.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ca,"__esModule",{value:!0});ca.SmartContract=void 0;var pk=dk(Gt()),Ic=ht(),JE=Oh(),gk=Be(),XE=mn(),yk=gr(),mk=ic(),dO=Zw(),pO=gc(),gO=uE(),wk=lE(),Ek=yc(),md=mE(),vk=YE(),ZE=class{constructor(e={}){this.address=new Ic.Address,this.methodsExplicit={},this.methods={},this.address=e.address||new Ic.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 pO.ContractFunction(i);return new gO.Interaction(e,o,s||[])},this.methods[i]=function(s){let o=new pO.ContractFunction(i),a=wk.NativeSerializer.nativeToTypedValues(s||[],n);return new gO.Interaction(e,o,a||[])}}}setAddress(e){this.address=e}getAddress(){return this.address}getAbi(){return yk.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}){JE.Compatibility.guardAddressIsSetAndNonZero(e,"'deployer' of SmartContract.deploy()","pass the actual address to deploy()"),n=n||new dO.CodeMetadata,i=i||[],s=s||0;let l=new md.ContractDeployPayloadBuilder().setCode(r).setCodeMetadata(n).setInitArgs(i).build();return new XE.Transaction({receiver:Ic.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}){JE.Compatibility.guardAddressIsSetAndNonZero(e,"'caller' of SmartContract.upgrade()","pass the actual address to upgrade()"),this.ensureHasAddress(),n=n||new dO.CodeMetadata,i=i||[],s=s||0;let l=new md.ContractUpgradePayloadBuilder().setCode(r).setCodeMetadata(n).setInitArgs(i).build();return new XE.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}){JE.Compatibility.guardAddressIsSetAndNonZero(u,"'caller' of SmartContract.call()","pass the actual address to call()"),this.ensureHasAddress(),r=r||[],n=n||0;let l=new md.ContractCallPayloadBuilder().setFunction(e).setArgs(r).build();return new XE.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 Ek.Query({address:this.getAddress(),func:e,args:r,value:n,caller:i})}ensureHasAddress(){if(!this.getAddress().bech32())throw new gk.ErrContractHasNoAddress}static computeAddress(e,r){let n=h.Buffer.alloc(8,0),i=new Ic.Address(e.bech32()).pubkey(),s=i.slice(30),o=h.Buffer.alloc(8),a=new pk.default(r.valueOf().toString(10)),u=mk.bigIntToBuffer(a);o.write(u.reverse().toString("hex"),"hex");let l=h.Buffer.concat([i,o]),f=vk("keccak256").update(l).digest(),d=h.Buffer.from(md.ArwenVirtualMachine,"hex"),g=h.Buffer.concat([n,d,f.slice(10,30),s]);return new Ic.Address(g)}};ca.SmartContract=ZE});var yO=m(Ni=>{"use strict";c();Object.defineProperty(Ni,"__esModule",{value:!0});Ni.ErrAccountNotConnected=Ni.ErrCannotSignSingleTransaction=Ni.Err=void 0;var Sc=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};Ni.Err=Sc;var tv=class extends Sc{constructor(){super("Cannot sign single transaction.")}};Ni.ErrCannotSignSingleTransaction=tv;var rv=class extends Sc{constructor(){super("Account is not connected.")}};Ni.ErrAccountNotConnected=rv});var mO=m(Tc=>{"use strict";c();Object.defineProperty(Tc,"__esModule",{value:!0});Tc.Operation=void 0;var Ak;(function(t){t.Connect="connect",t.Logout="logout",t.SignTransactions="signTransactions",t.SignMessage="signMessage",t.CancelAction="cancelAction"})(Ak=Tc.Operation||(Tc.Operation={}))});var nv=m(la=>{"use strict";c();var Oi=la&&la.__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(la,"__esModule",{value:!0});la.ExtensionProvider=void 0;var bk=mn(),wO=yO(),Cc=mO(),xc=class t{constructor(){if(this.account={address:""},this.initialized=!1,t._instance)throw new Error("Error: Instantiation failed: Use ExtensionProvider.getInstance() instead of new.");t._instance=this}static getInstance(){return t._instance}setAddress(e){return this.account.address=e,t._instance}init(){return 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(Cc.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(Cc.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 wO.ErrCannotSignSingleTransaction;return r[0]})}ensureConnected(){if(!this.account.address)throw new wO.ErrAccountNotConnected}signTransactions(e){return Oi(this,void 0,void 0,function*(){this.ensureConnected();let r=yield this.startBgrMsgChannel(Cc.Operation.SignTransactions,{from:this.account.address,transactions:e.map(n=>n.toPlainObject())});try{return r.map(i=>bk.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(Cc.Operation.SignMessage,r)).signature,s=h.Buffer.from(i,"hex");return e.applySignature(s),e})}cancelAction(){return this.startBgrMsgChannel(Cc.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)})}};la.ExtensionProvider=xc;xc._instance=new xc});var yr={};ft(yr,{__assign:()=>sv,__asyncDelegator:()=>Lk,__asyncGenerator:()=>Bk,__asyncValues:()=>Fk,__await:()=>Nc,__awaiter:()=>xk,__classPrivateFieldGet:()=>Vk,__classPrivateFieldSet:()=>Hk,__createBinding:()=>Ok,__decorate:()=>Sk,__exportStar:()=>Dk,__extends:()=>_k,__generator:()=>Nk,__importDefault:()=>qk,__importStar:()=>Uk,__makeTemplateObject:()=>Mk,__metadata:()=>Ck,__param:()=>Tk,__read:()=>_O,__rest:()=>Ik,__spread:()=>Pk,__spreadArrays:()=>Rk,__values:()=>ov});function _k(t,e){iv(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function Ik(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 Tk(t,e){return function(r,n){e(r,n,t)}}function Ck(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function xk(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 Nk(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 _O(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 Pk(){for(var t=[],e=0;e1||a(g,w)})})}function a(g,w){try{u(n[g](w))}catch(E){d(s[0][3],E)}}function u(g){g.value instanceof Nc?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,w){g(w),s.shift(),s.length&&a(s[0][0],s[0][1])}}function Lk(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:Nc(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function Fk(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 ov=="function"?ov(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 Mk(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function Uk(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 qk(t){return t&&t.__esModule?t:{default:t}}function Vk(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function Hk(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 iv,sv,mr=ge(()=>{c();iv=function(t,e){return iv=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])},iv(t,e)};sv=function(){return sv=Object.assign||function(e){for(var r,n=1,i=arguments.length;n{"use strict";c();Object.defineProperty(Ad,"__esModule",{value:!0});function Gk(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}}Ad.safeJsonParse=Gk;function jk(t){return typeof t=="string"?t:JSON.stringify(t,(e,r)=>typeof r>"u"?null:r)}Ad.safeJsonStringify=jk});var IO=m((ece,bd)=>{"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?bd.exports=global.localStorage:typeof window<"u"&&window.localStorage?bd.exports=window.localStorage:bd.exports=new e})()});var SO=m(_d=>{"use strict";c();Object.defineProperty(_d,"__esModule",{value:!0});_d.IKeyValueStorage=void 0;var uv=class{};_d.IKeyValueStorage=uv});var TO=m(Id=>{"use strict";c();Object.defineProperty(Id,"__esModule",{value:!0});Id.parseEntry=void 0;var kk=av();function Qk(t){var e;return[t[0],kk.safeJsonParse((e=t[1])!==null&&e!==void 0?e:"")]}Id.parseEntry=Qk});var xO=m(Sd=>{"use strict";c();Object.defineProperty(Sd,"__esModule",{value:!0});var CO=(mr(),ct(yr));CO.__exportStar(SO(),Sd);CO.__exportStar(TO(),Sd)});var OO=m(Oc=>{"use strict";c();Object.defineProperty(Oc,"__esModule",{value:!0});Oc.KeyValueStorage=void 0;var fa=(mr(),ct(yr)),NO=av(),Wk=fa.__importDefault(IO()),zk=xO(),Td=class{constructor(){this.localStorage=Wk.default}getKeys(){return fa.__awaiter(this,void 0,void 0,function*(){return Object.keys(this.localStorage)})}getEntries(){return fa.__awaiter(this,void 0,void 0,function*(){return Object.entries(this.localStorage).map(zk.parseEntry)})}getItem(e){return fa.__awaiter(this,void 0,void 0,function*(){let r=this.localStorage.getItem(e);if(r!==null)return NO.safeJsonParse(r)})}setItem(e,r){return fa.__awaiter(this,void 0,void 0,function*(){this.localStorage.setItem(e,NO.safeJsonStringify(r))})}removeItem(e){return fa.__awaiter(this,void 0,void 0,function*(){this.localStorage.removeItem(e)})}};Oc.KeyValueStorage=Td;Oc.default=Td});var DO=m(Cd=>{"use strict";c();Object.defineProperty(Cd,"__esModule",{value:!0});Cd.delay=void 0;function $k(t){return new Promise(e=>{setTimeout(()=>{e(!0)},t)})}Cd.delay=$k});var PO=m(ha=>{"use strict";c();Object.defineProperty(ha,"__esModule",{value:!0});ha.ONE_THOUSAND=ha.ONE_HUNDRED=void 0;ha.ONE_HUNDRED=100;ha.ONE_THOUSAND=1e3});var RO=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 cv=m(xd=>{"use strict";c();Object.defineProperty(xd,"__esModule",{value:!0});var BO=(mr(),ct(yr));BO.__exportStar(PO(),xd);BO.__exportStar(RO(),xd)});var FO=m(da=>{"use strict";c();Object.defineProperty(da,"__esModule",{value:!0});da.fromMiliseconds=da.toMiliseconds=void 0;var LO=cv();function Kk(t){return t*LO.ONE_THOUSAND}da.toMiliseconds=Kk;function Yk(t){return Math.floor(t/LO.ONE_THOUSAND)}da.fromMiliseconds=Yk});var UO=m(Nd=>{"use strict";c();Object.defineProperty(Nd,"__esModule",{value:!0});var MO=(mr(),ct(yr));MO.__exportStar(DO(),Nd);MO.__exportStar(FO(),Nd)});var qO=m(Dc=>{"use strict";c();Object.defineProperty(Dc,"__esModule",{value:!0});Dc.Watch=void 0;var Od=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}};Dc.Watch=Od;Dc.default=Od});var VO=m(Dd=>{"use strict";c();Object.defineProperty(Dd,"__esModule",{value:!0});Dd.IWatch=void 0;var lv=class{};Dd.IWatch=lv});var HO=m(fv=>{"use strict";c();Object.defineProperty(fv,"__esModule",{value:!0});var Jk=(mr(),ct(yr));Jk.__exportStar(VO(),fv)});var Ms=m(pa=>{"use strict";c();Object.defineProperty(pa,"__esModule",{value:!0});var Pd=(mr(),ct(yr));Pd.__exportStar(UO(),pa);Pd.__exportStar(qO(),pa);Pd.__exportStar(HO(),pa);Pd.__exportStar(cv(),pa)});var hv,GO=ge(()=>{c();hv=class{}});var dv={};ft(dv,{IEvents:()=>hv});var pv=ge(()=>{c();GO()});var jO=m(Rd=>{"use strict";c();Object.defineProperty(Rd,"__esModule",{value:!0});Rd.IHeartBeat=void 0;var Xk=(pv(),ct(dv)),gv=class extends Xk.IEvents{constructor(e){super()}};Rd.IHeartBeat=gv});var mv=m(yv=>{"use strict";c();Object.defineProperty(yv,"__esModule",{value:!0});var Zk=(mr(),ct(yr));Zk.__exportStar(jO(),yv)});var kO=m(ga=>{"use strict";c();Object.defineProperty(ga,"__esModule",{value:!0});ga.HEARTBEAT_EVENTS=ga.HEARTBEAT_INTERVAL=void 0;var e7=Ms();ga.HEARTBEAT_INTERVAL=e7.FIVE_SECONDS;ga.HEARTBEAT_EVENTS={pulse:"heartbeat_pulse"}});var Ev=m(wv=>{"use strict";c();Object.defineProperty(wv,"__esModule",{value:!0});var t7=(mr(),ct(yr));t7.__exportStar(kO(),wv)});var QO=m(Bd=>{"use strict";c();Object.defineProperty(Bd,"__esModule",{value:!0});Bd.HeartBeat=void 0;var vv=(mr(),ct(yr)),r7=kn(),n7=Ms(),i7=mv(),Av=Ev(),bv=class t extends i7.IHeartBeat{constructor(e){super(e),this.events=new r7.EventEmitter,this.interval=Av.HEARTBEAT_INTERVAL,this.interval=e?.interval||Av.HEARTBEAT_INTERVAL}static init(e){return vv.__awaiter(this,void 0,void 0,function*(){let r=new t(e);return yield r.init(),r})}init(){return vv.__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 vv.__awaiter(this,void 0,void 0,function*(){this.intervalRef=setInterval(()=>this.pulse(),n7.toMiliseconds(this.interval))})}pulse(){this.events.emit(Av.HEARTBEAT_EVENTS.pulse)}};Bd.HeartBeat=bv});var WO=m(Pc=>{"use strict";c();Object.defineProperty(Pc,"__esModule",{value:!0});var _v=(mr(),ct(yr));_v.__exportStar(QO(),Pc);_v.__exportStar(mv(),Pc);_v.__exportStar(Ev(),Pc)});var $O=m((Wce,zO)=>{"use strict";c();function s7(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}zO.exports=o7;function o7(t,e,r){var n=r&&r.stringify||s7,i=1;if(typeof t=="object"&&t!==null){var s=e.length+i;if(s===1)return t;var o=new Array(s);o[0]=n(t);for(var a=1;a-1?d:0,t.charCodeAt(w+1)){case 100:case 102:if(f>=u||e[f]==null)break;d=u||e[f]==null)break;d=u||e[f]===void 0)break;d",d=w+2,w++;break}l+=n(e[f]),d=w+2,w++;break;case 115:if(f>=u)break;d{"use strict";c();var KO=$O();XO.exports=bn;var Rc=y7().console||{},a7={mapHttpRequest:Ld,mapHttpResponse:Ld,wrapRequestSerializer:Iv,wrapResponseSerializer:Iv,wrapErrorSerializer:Iv,req:Ld,res:Ld,err:h7};function u7(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||Rc;t.browser.write&&(t.browser.asObject=!0);let n=t.serializers||{},i=u7(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=Bc),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:d7(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=Bc,u.serializers=n,u._serialize=i,u._stdErrSerialize=s,u.child=w,e&&(u._logEvent=Sv());function f(){return this.level==="silent"?1/0:this.levels.values[this.level]}function d(){return this._level}function g(E){if(E!=="silent"&&!this.levels.values[E])throw Error("unknown level "+E);this._level=E,ya(l,u,"error","log"),ya(l,u,"fatal","error"),ya(l,u,"warn","error"),ya(l,u,"info","log"),ya(l,u,"debug","log"),ya(l,u,"trace","log")}function w(E,x){if(!E)throw new Error("missing bindings for child Pino");x=x||{},i&&E.serializers&&(x.serializers=E.serializers);let O=x.serializers;if(i&&O){var F=Object.assign({},n,O),_=t.browser.serialize===!0?Object.keys(F):i;delete E.serializers,Fd([E],_,F,this._stdErrSerialize)}function I(S){this._childLevel=(S._childLevel|0)+1,this.error=ma(S,E,"error"),this.fatal=ma(S,E,"fatal"),this.warn=ma(S,E,"warn"),this.info=ma(S,E,"info"),this.debug=ma(S,E,"debug"),this.trace=ma(S,E,"trace"),F&&(this.serializers=F,this._serialize=_),e&&(this._logEvent=Sv([].concat(S._logEvent.bindings,E)))}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=a7;bn.stdTimeFunctions=Object.assign({},{nullTime:YO,epochTime:JO,unixTime:p7,isoTime:g7});function ya(t,e,r,n){let i=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?Bc:i[r]?i[r]:Rc[r]||Rc[n]||Bc,c7(t,e,r)}function c7(t,e,r){!t.transmit&&e[r]===Bc||(e[r]=function(n){return function(){let s=t.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Rc?Rc:this;for(var u=0;u-1&&s in r&&(t[i][s]=r[s](t[i][s]))}function ma(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(wa,"__esModule",{value:!0});wa.PINO_CUSTOM_CONTEXT_KEY=wa.PINO_LOGGER_DEFAULTS=void 0;wa.PINO_LOGGER_DEFAULTS={level:"info"};wa.PINO_CUSTOM_CONTEXT_KEY="custom_context"});var i2=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=Tv();function m7(t){return Object.assign(Object.assign({},t),{level:t?.level||Ea.PINO_LOGGER_DEFAULTS.level})}fr.getDefaultLoggerOptions=m7;function e2(t,e=Ea.PINO_CUSTOM_CONTEXT_KEY){return t[e]||""}fr.getBrowserLoggerContext=e2;function t2(t,e,r=Ea.PINO_CUSTOM_CONTEXT_KEY){return t[r]=e,t}fr.setBrowserLoggerContext=t2;function r2(t,e=Ea.PINO_CUSTOM_CONTEXT_KEY){let r="";return typeof t.bindings>"u"?r=e2(t,e):r=t.bindings().context||"",r}fr.getLoggerContext=r2;function n2(t,e,r=Ea.PINO_CUSTOM_CONTEXT_KEY){let n=r2(t,r);return n.trim()?`${n}/${e}`:e}fr.formatChildLoggerContext=n2;function w7(t,e,r=Ea.PINO_CUSTOM_CONTEXT_KEY){let n=n2(t,e,r),i=t.child({context:n});return t2(i,n,r)}fr.generateChildLogger=w7});var xv=m(va=>{"use strict";c();Object.defineProperty(va,"__esModule",{value:!0});va.pino=void 0;var Cv=(mr(),ct(yr)),E7=Cv.__importDefault(ZO());Object.defineProperty(va,"pino",{enumerable:!0,get:function(){return E7.default}});Cv.__exportStar(Tv(),va);Cv.__exportStar(i2(),va)});var Wv=m(Dt=>{"use strict";c();Object.defineProperty(Dt,"__esModule",{value:!0});var Aa=(pv(),ct(dv)),s2=kn();function v7(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var A7=v7(s2),Nv=class extends Aa.IEvents{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},Ov=class{constructor(e,r,n){this.core=e,this.logger=r}},Dv=class extends Aa.IEvents{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}},Pv=class{constructor(e,r){this.logger=e,this.core=r}},Rv=class extends Aa.IEvents{constructor(e,r){super(),this.relayer=e,this.logger=r}},Bv=class extends Aa.IEvents{constructor(e){super()}},Lv=class{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}},Fv=class{constructor(){this.map=new Map}},Mv=class extends Aa.IEvents{constructor(e,r){super(),this.relayer=e,this.logger=r}},Uv=class{constructor(e,r){this.core=e,this.logger=r}},qv=class extends Aa.IEvents{constructor(e,r){super(),this.core=e,this.logger=r}},Vv=class{constructor(e,r){this.logger=e,this.core=r}},Hv=class{constructor(e,r){this.projectId=e,this.logger=r}},Gv=class extends A7.default{constructor(){super()}},jv=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},kv=class extends s2.EventEmitter{constructor(){super()}},Qv=class{constructor(e){this.client=e}};Dt.ICore=Nv,Dt.ICrypto=Ov,Dt.IEngine=Qv,Dt.IEngineEvents=kv,Dt.IExpirer=qv,Dt.IJsonRpcHistory=Dv,Dt.IKeyChain=Uv,Dt.IMessageTracker=Pv,Dt.IPairing=Vv,Dt.IPublisher=Rv,Dt.IRelayer=Bv,Dt.ISignClient=jv,Dt.ISignClientEvents=Gv,Dt.IStore=Lv,Dt.ISubscriber=Mv,Dt.ISubscriberTopicMap=Fv,Dt.IVerify=Hv});var o2={};ft(o2,{safeJsonParse:()=>Lc,safeJsonStringify:()=>Fc});function Lc(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return _7(t)}catch{return t}}function Fc(t){return typeof t=="string"?t:b7(t)||""}var b7,_7,Md=ge(()=>{c();b7=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),_7=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 u2=m(Ud=>{"use strict";c();Object.defineProperty(Ud,"__esModule",{value:!0});Ud.BrowserRandomSource=void 0;var a2=65536,zv=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($v,"__esModule",{value:!0});function I7(t){for(var e=0;e{c()});var l2=m(qd=>{"use strict";c();Object.defineProperty(qd,"__esModule",{value:!0});qd.NodeRandomSource=void 0;var S7=Mr(),Kv=class{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof PI<"u"){let e=c2();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(Vd,"__esModule",{value:!0});Vd.SystemRandomSource=void 0;var T7=u2(),C7=l2(),Yv=class{constructor(){if(this.isAvailable=!1,this.name="",this._source=new T7.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new C7.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)}};Vd.SystemRandomSource=Yv});var h2=m(wr=>{"use strict";c();Object.defineProperty(wr,"__esModule",{value:!0});function x7(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}wr.mul=Math.imul||x7;function N7(t,e){return t+e|0}wr.add=N7;function O7(t,e){return t-e|0}wr.sub=O7;function D7(t,e){return t<>>32-e}wr.rotl=D7;function P7(t,e){return t<<32-e|t>>>e}wr.rotr=P7;function R7(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t}wr.isInteger=Number.isInteger||R7;wr.MAX_SAFE_INTEGER=9007199254740991;wr.isSafeInteger=function(t){return wr.isInteger(t)&&t>=-wr.MAX_SAFE_INTEGER&&t<=wr.MAX_SAFE_INTEGER}});var ba=m(Ne=>{"use strict";c();Object.defineProperty(Ne,"__esModule",{value:!0});var d2=h2();function B7(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}Ne.readInt16BE=B7;function L7(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}Ne.readUint16BE=L7;function F7(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}Ne.readInt16LE=F7;function M7(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}Ne.readUint16LE=M7;function p2(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}Ne.writeUint16BE=p2;Ne.writeInt16BE=p2;function g2(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=g2;Ne.writeInt16LE=g2;function Jv(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}Ne.readInt32BE=Jv;function Xv(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=Xv;function Zv(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}Ne.readInt32LE=Zv;function e1(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=e1;function Hd(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=Hd;Ne.writeInt32BE=Hd;function Gd(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=Gd;Ne.writeInt32LE=Gd;function U7(t,e){e===void 0&&(e=0);var r=Jv(t,e),n=Jv(t,e+4);return r*4294967296+n-(n>>31)*4294967296}Ne.readInt64BE=U7;function q7(t,e){e===void 0&&(e=0);var r=Xv(t,e),n=Xv(t,e+4);return r*4294967296+n}Ne.readUint64BE=q7;function V7(t,e){e===void 0&&(e=0);var r=Zv(t,e),n=Zv(t,e+4);return n*4294967296+r-(r>>31)*4294967296}Ne.readInt64LE=V7;function H7(t,e){e===void 0&&(e=0);var r=e1(t,e),n=e1(t,e+4);return n*4294967296+r}Ne.readUint64LE=H7;function y2(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),Hd(t/4294967296>>>0,e,r),Hd(t>>>0,e,r+4),e}Ne.writeUint64BE=y2;Ne.writeInt64BE=y2;function m2(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),Gd(t>>>0,e,r),Gd(t/4294967296>>>0,e,r+4),e}Ne.writeUint64LE=m2;Ne.writeInt64LE=m2;function G7(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=G7;function j7(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=k7;function Q7(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(!d2.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 e9=f2(),t9=ba(),w2=Mr();Kt.defaultRandomSource=new e9.SystemRandomSource;function t1(t,e=Kt.defaultRandomSource){return e.randomBytes(t)}Kt.randomBytes=t1;function r9(t=Kt.defaultRandomSource){let e=t1(4,t),r=(0,t9.readUint32LE)(e);return(0,w2.wipe)(e),r}Kt.randomUint32=r9;var E2="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function v2(t,e=E2,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=t1(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 Ia=ba(),_a=Mr();Wn.DIGEST_LENGTH=64;Wn.BLOCK_SIZE=128;var b2=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(){_a.wipe(this._buffer),_a.wipe(this._tempHi),_a.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&&(r1(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(n=r1(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){_a.wipe(e.stateHi),_a.wipe(e.stateLo),e.buffer&&_a.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},t}();Wn.SHA512=b2;var A2=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 r1(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],w=r[6],E=r[7],x=n[0],O=n[1],F=n[2],_=n[3],I=n[4],S=n[5],R=n[6],B=n[7],b,T,L,X,W,G,j,K;o>=128;){for(var de=0;de<16;de++){var ue=8*de+s;t[de]=Ia.readUint32BE(i,ue),e[de]=Ia.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=w,ae=E,fe=x,oe=O,ce=F,y=_,v=I,A=S,P=R,C=B;if(b=E,T=B,W=T&65535,G=T>>>16,j=b&65535,K=b>>>16,b=(d>>>14|I<<32-14)^(d>>>18|I<<32-18)^(I>>>41-32|d<<32-(41-32)),T=(I>>>14|d<<32-14)^(I>>>18|d<<32-18)^(d>>>41-32|I<<32-(41-32)),W+=T&65535,G+=T>>>16,j+=b&65535,K+=b>>>16,b=d&g^~d&w,T=I&S^~I&R,W+=T&65535,G+=T>>>16,j+=b&65535,K+=b>>>16,b=A2[de*2],T=A2[de*2+1],W+=T&65535,G+=T>>>16,j+=b&65535,K+=b>>>16,b=t[de%16],T=e[de%16],W+=T&65535,G+=T>>>16,j+=b&65535,K+=b>>>16,G+=W>>>16,j+=G>>>16,K+=j>>>16,L=j&65535|K<<16,X=W&65535|G<<16,b=L,T=X,W=T&65535,G=T>>>16,j=b&65535,K=b>>>16,b=(a>>>28|x<<32-28)^(x>>>34-32|a<<32-(34-32))^(x>>>39-32|a<<32-(39-32)),T=(x>>>28|a<<32-28)^(a>>>34-32|x<<32-(34-32))^(a>>>39-32|x<<32-(39-32)),W+=T&65535,G+=T>>>16,j+=b&65535,K+=b>>>16,b=a&u^a&l^u&l,T=x&O^x&F^O&F,W+=T&65535,G+=T>>>16,j+=b&65535,K+=b>>>16,G+=W>>>16,j+=G>>>16,K+=j>>>16,ae=j&65535|K<<16,C=W&65535|G<<16,b=te,T=y,W=T&65535,G=T>>>16,j=b&65535,K=b>>>16,b=L,T=X,W+=T&65535,G+=T>>>16,j+=b&65535,K+=b>>>16,G+=W>>>16,j+=G>>>16,K+=j>>>16,te=j&65535|K<<16,y=W&65535|G<<16,u=re,l=Y,f=se,d=te,g=ie,w=q,E=le,a=ae,O=fe,F=oe,_=ce,I=y,S=v,R=A,B=P,x=C,de%16===15)for(var ue=0;ue<16;ue++)b=t[ue],T=e[ue],W=T&65535,G=T>>>16,j=b&65535,K=b>>>16,b=t[(ue+9)%16],T=e[(ue+9)%16],W+=T&65535,G+=T>>>16,j+=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,T=(X>>>1|L<<32-1)^(X>>>8|L<<32-8)^(X>>>7|L<<32-7),W+=T&65535,G+=T>>>16,j+=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,T=(X>>>19|L<<32-19)^(L>>>61-32|X<<32-(61-32))^(X>>>6|L<<32-6),W+=T&65535,G+=T>>>16,j+=b&65535,K+=b>>>16,G+=W>>>16,j+=G>>>16,K+=j>>>16,t[ue]=j&65535|K<<16,e[ue]=W&65535|G<<16}b=a,T=x,W=T&65535,G=T>>>16,j=b&65535,K=b>>>16,b=r[0],T=n[0],W+=T&65535,G+=T>>>16,j+=b&65535,K+=b>>>16,G+=W>>>16,j+=G>>>16,K+=j>>>16,r[0]=a=j&65535|K<<16,n[0]=x=W&65535|G<<16,b=u,T=O,W=T&65535,G=T>>>16,j=b&65535,K=b>>>16,b=r[1],T=n[1],W+=T&65535,G+=T>>>16,j+=b&65535,K+=b>>>16,G+=W>>>16,j+=G>>>16,K+=j>>>16,r[1]=u=j&65535|K<<16,n[1]=O=W&65535|G<<16,b=l,T=F,W=T&65535,G=T>>>16,j=b&65535,K=b>>>16,b=r[2],T=n[2],W+=T&65535,G+=T>>>16,j+=b&65535,K+=b>>>16,G+=W>>>16,j+=G>>>16,K+=j>>>16,r[2]=l=j&65535|K<<16,n[2]=F=W&65535|G<<16,b=f,T=_,W=T&65535,G=T>>>16,j=b&65535,K=b>>>16,b=r[3],T=n[3],W+=T&65535,G+=T>>>16,j+=b&65535,K+=b>>>16,G+=W>>>16,j+=G>>>16,K+=j>>>16,r[3]=f=j&65535|K<<16,n[3]=_=W&65535|G<<16,b=d,T=I,W=T&65535,G=T>>>16,j=b&65535,K=b>>>16,b=r[4],T=n[4],W+=T&65535,G+=T>>>16,j+=b&65535,K+=b>>>16,G+=W>>>16,j+=G>>>16,K+=j>>>16,r[4]=d=j&65535|K<<16,n[4]=I=W&65535|G<<16,b=g,T=S,W=T&65535,G=T>>>16,j=b&65535,K=b>>>16,b=r[5],T=n[5],W+=T&65535,G+=T>>>16,j+=b&65535,K+=b>>>16,G+=W>>>16,j+=G>>>16,K+=j>>>16,r[5]=g=j&65535|K<<16,n[5]=S=W&65535|G<<16,b=w,T=R,W=T&65535,G=T>>>16,j=b&65535,K=b>>>16,b=r[6],T=n[6],W+=T&65535,G+=T>>>16,j+=b&65535,K+=b>>>16,G+=W>>>16,j+=G>>>16,K+=j>>>16,r[6]=w=j&65535|K<<16,n[6]=R=W&65535|G<<16,b=E,T=B,W=T&65535,G=T>>>16,j=b&65535,K=b>>>16,b=r[7],T=n[7],W+=T&65535,G+=T>>>16,j+=b&65535,K+=b>>>16,G+=W>>>16,j+=G>>>16,K+=j>>>16,r[7]=E=j&65535|K<<16,n[7]=B=W&65535|G<<16,s+=128,o-=128}return s}function i9(t){var e=new b2;e.update(t);var r=e.digest();return e.clean(),r}Wn.hash=i9});var M2=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 s9=Mc(),Uc=_2(),x2=Mr();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,N2(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 O2(t,e){let r=0;for(let n=0;n<32;n++)r|=t[n]^e[n];return(1&r-1>>>8)-1}function T2(t,e){let r=new Uint8Array(32),n=new Uint8Array(32);return qc(r,t),qc(n,e),O2(r,n)}function D2(t){let e=new Uint8Array(32);return qc(e,t),e[0]&1}function l9(t,e){for(let r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function Us(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]+r[n]}function Vs(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,w=0,E=0,x=0,O=0,F=0,_=0,I=0,S=0,R=0,B=0,b=0,T=0,L=0,X=0,W=0,G=0,j=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],v=r[9],A=r[10],P=r[11],C=r[12],D=r[13],M=r[14],N=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,w+=n*y,E+=n*v,x+=n*A,O+=n*P,F+=n*C,_+=n*D,I+=n*M,S+=n*N,n=e[1],o+=n*te,a+=n*ie,u+=n*q,l+=n*le,f+=n*ae,d+=n*fe,g+=n*oe,w+=n*ce,E+=n*y,x+=n*v,O+=n*A,F+=n*P,_+=n*C,I+=n*D,S+=n*M,R+=n*N,n=e[2],a+=n*te,u+=n*ie,l+=n*q,f+=n*le,d+=n*ae,g+=n*fe,w+=n*oe,E+=n*ce,x+=n*y,O+=n*v,F+=n*A,_+=n*P,I+=n*C,S+=n*D,R+=n*M,B+=n*N,n=e[3],u+=n*te,l+=n*ie,f+=n*q,d+=n*le,g+=n*ae,w+=n*fe,E+=n*oe,x+=n*ce,O+=n*y,F+=n*v,_+=n*A,I+=n*P,S+=n*C,R+=n*D,B+=n*M,b+=n*N,n=e[4],l+=n*te,f+=n*ie,d+=n*q,g+=n*le,w+=n*ae,E+=n*fe,x+=n*oe,O+=n*ce,F+=n*y,_+=n*v,I+=n*A,S+=n*P,R+=n*C,B+=n*D,b+=n*M,T+=n*N,n=e[5],f+=n*te,d+=n*ie,g+=n*q,w+=n*le,E+=n*ae,x+=n*fe,O+=n*oe,F+=n*ce,_+=n*y,I+=n*v,S+=n*A,R+=n*P,B+=n*C,b+=n*D,T+=n*M,L+=n*N,n=e[6],d+=n*te,g+=n*ie,w+=n*q,E+=n*le,x+=n*ae,O+=n*fe,F+=n*oe,_+=n*ce,I+=n*y,S+=n*v,R+=n*A,B+=n*P,b+=n*C,T+=n*D,L+=n*M,X+=n*N,n=e[7],g+=n*te,w+=n*ie,E+=n*q,x+=n*le,O+=n*ae,F+=n*fe,_+=n*oe,I+=n*ce,S+=n*y,R+=n*v,B+=n*A,b+=n*P,T+=n*C,L+=n*D,X+=n*M,W+=n*N,n=e[8],w+=n*te,E+=n*ie,x+=n*q,O+=n*le,F+=n*ae,_+=n*fe,I+=n*oe,S+=n*ce,R+=n*y,B+=n*v,b+=n*A,T+=n*P,L+=n*C,X+=n*D,W+=n*M,G+=n*N,n=e[9],E+=n*te,x+=n*ie,O+=n*q,F+=n*le,_+=n*ae,I+=n*fe,S+=n*oe,R+=n*ce,B+=n*y,b+=n*v,T+=n*A,L+=n*P,X+=n*C,W+=n*D,G+=n*M,j+=n*N,n=e[10],x+=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,T+=n*v,L+=n*A,X+=n*P,W+=n*C,G+=n*D,j+=n*M,K+=n*N,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,T+=n*y,L+=n*v,X+=n*A,W+=n*P,G+=n*C,j+=n*D,K+=n*M,de+=n*N,n=e[12],F+=n*te,_+=n*ie,I+=n*q,S+=n*le,R+=n*ae,B+=n*fe,b+=n*oe,T+=n*ce,L+=n*y,X+=n*v,W+=n*A,G+=n*P,j+=n*C,K+=n*D,de+=n*M,ue+=n*N,n=e[13],_+=n*te,I+=n*ie,S+=n*q,R+=n*le,B+=n*ae,b+=n*fe,T+=n*oe,L+=n*ce,X+=n*y,W+=n*v,G+=n*A,j+=n*P,K+=n*C,de+=n*D,ue+=n*M,re+=n*N,n=e[14],I+=n*te,S+=n*ie,R+=n*q,B+=n*le,b+=n*ae,T+=n*fe,L+=n*oe,X+=n*ce,W+=n*y,G+=n*v,j+=n*A,K+=n*P,de+=n*C,ue+=n*D,re+=n*M,Y+=n*N,n=e[15],S+=n*te,R+=n*ie,B+=n*q,b+=n*le,T+=n*ae,L+=n*fe,X+=n*oe,W+=n*ce,G+=n*y,j+=n*v,K+=n*A,de+=n*P,ue+=n*C,re+=n*D,Y+=n*M,se+=n*N,s+=38*R,o+=38*B,a+=38*b,u+=38*T,l+=38*L,f+=38*X,d+=38*W,g+=38*G,w+=38*j,E+=38*K,x+=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=w+i+65535,i=Math.floor(n/65536),w=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=x+i+65535,i=Math.floor(n/65536),x=n-i*65536,n=O+i+65535,i=Math.floor(n/65536),O=n-i*65536,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=w+i+65535,i=Math.floor(n/65536),w=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=x+i+65535,i=Math.floor(n/65536),x=n-i*65536,n=O+i+65535,i=Math.floor(n/65536),O=n-i*65536,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]=w,t[9]=E,t[10]=x,t[11]=O,t[12]=F,t[13]=_,t[14]=I,t[15]=S}function qs(t,e){Qe(t,e,e)}function P2(t,e){let r=be(),n;for(n=0;n<16;n++)r[n]=e[n];for(n=253;n>=0;n--)qs(r,r),n!==2&&n!==4&&Qe(r,r,e);for(n=0;n<16;n++)t[n]=r[n]}function f9(t,e){let r=be(),n;for(n=0;n<16;n++)r[n]=e[n];for(n=250;n>=0;n--)qs(r,r),n!==1&&Qe(r,r,e);for(n=0;n<16;n++)t[n]=r[n]}function o1(t,e){let r=be(),n=be(),i=be(),s=be(),o=be(),a=be(),u=be(),l=be(),f=be();Vs(r,t[1],t[0]),Vs(f,e[1],e[0]),Qe(r,r,f),Us(n,t[0],t[1]),Us(f,e[0],e[1]),Qe(n,n,f),Qe(i,t[3],e[3]),Qe(i,i,u9),Qe(s,t[2],e[2]),Us(s,s,s),Vs(o,n,r),Vs(a,s,i),Us(u,s,i),Us(l,n,r),Qe(t[0],o,a),Qe(t[1],l,u),Qe(t[2],u,a),Qe(t[3],o,l)}function C2(t,e,r){for(let n=0;n<4;n++)N2(t[n],e[n],r)}function u1(t,e){let r=be(),n=be(),i=be();P2(i,e[2]),Qe(r,e[0],i),Qe(n,e[1],i),qc(t,n),t[31]^=D2(r)<<7}function R2(t,e,r){Pi(t[0],s1),Pi(t[1],Sa),Pi(t[2],Sa),Pi(t[3],s1);for(let n=255;n>=0;--n){let i=r[n/8|0]>>(n&7)&1;C2(t,e,i),o1(e,t),o1(t,t),C2(t,e,i)}}function c1(t,e){let r=[be(),be(),be(),be()];Pi(r[0],I2),Pi(r[1],S2),Pi(r[2],Sa),Qe(r[3],I2,S2),R2(t,r,e)}function B2(t){if(t.length!==Ve.SEED_LENGTH)throw new Error(`ed25519: seed must be ${Ve.SEED_LENGTH} bytes`);let e=(0,Uc.hash)(t);e[0]&=248,e[31]&=127,e[31]|=64;let r=new Uint8Array(32),n=[be(),be(),be(),be()];c1(n,e),u1(r,n);let i=new Uint8Array(64);return i.set(t),i.set(r,32),{publicKey:r,secretKey:i}}Ve.generateKeyPairFromSeed=B2;function h9(t){let e=(0,s9.randomBytes)(32,t),r=B2(e);return(0,x2.wipe)(e),r}Ve.generateKeyPair=h9;function d9(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=d9;var i1=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 L2(t,e){let r,n,i,s;for(n=63;n>=32;--n){for(r=0,i=n-32,s=n-12;i>4)*i1[i],r=e[i]>>8,e[i]&=255;for(i=0;i<32;i++)e[i]-=r*i1[i];for(n=0;n<32;n++)e[n+1]+=e[n]>>8,t[n]=e[n]&255}function a1(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;L2(t,e)}function p9(t,e){let r=new Float64Array(64),n=[be(),be(),be(),be()],i=(0,Uc.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 Uc.SHA512;o.update(s.subarray(32)),o.update(e);let a=o.digest();o.clean(),a1(a),c1(n,a),u1(s,n),o.reset(),o.update(s.subarray(0,32)),o.update(t.subarray(32)),o.update(e);let u=o.digest();a1(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 L2(s.subarray(32),r),s}Ve.sign=p9;function F2(t,e){let r=be(),n=be(),i=be(),s=be(),o=be(),a=be(),u=be();return Pi(t[2],Sa),l9(t[1],e),qs(i,t[1]),Qe(s,i,a9),Vs(i,i,t[2]),Us(s,t[2],s),qs(o,s),qs(a,o),Qe(u,a,o),Qe(r,u,i),Qe(r,r,s),f9(r,r),Qe(r,r,i),Qe(r,r,s),Qe(r,r,s),Qe(t[0],r,s),qs(n,t[0]),Qe(n,n,s),T2(n,i)&&Qe(t[0],t[0],c9),qs(n,t[0]),Qe(n,n,s),T2(n,i)?-1:(D2(t[0])===e[31]>>7&&Vs(t[0],s1,t[0]),Qe(t[3],t[0],t[1]),0)}function g9(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(F2(s,t))return!1;let o=new Uc.SHA512;o.update(r.subarray(0,32)),o.update(t),o.update(e);let a=o.digest();return a1(a),R2(i,s,a),c1(s,r.subarray(32)),o1(i,s),u1(n,i),!O2(r,n)}Ve.verify=g9;function y9(t){let e=[be(),be(),be(),be()];if(F2(e,t))throw new Error("Ed25519: invalid public key");let r=be(),n=be(),i=e[1];Us(r,Sa,i),Vs(n,Sa,i),P2(n,n),Qe(r,r,n);let s=new Uint8Array(32);return qc(s,r),s}Ve.convertPublicKeyToX25519=y9;function m9(t){let e=(0,Uc.hash)(t.subarray(0,32));e[0]&=248,e[31]&=127,e[31]|=64;let r=new Uint8Array(e.subarray(0,32));return(0,x2.wipe)(e),r}Ve.convertSecretKeyToX25519=m9});var jd,kd,Hs,Ta,Qd,Vc,Wd,zd,$d,Ca,Kd,Yd,U2,q2,Jd=ge(()=>{c();jd="EdDSA",kd="JWT",Hs=".",Ta="base64url",Qd="utf8",Vc="utf8",Wd=":",zd="did",$d="key",Ca="base58btc",Kd="z",Yd="K36",U2=32,q2=32});function Ri(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}var Hc=ge(()=>{c()});function xa(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?Ri(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}var Xd=ge(()=>{c();Hc()});function Zd(t,e){e||(e=t.reduce((i,s)=>i+s.length,0));let r=xa(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return Ri(r)}var l1=ge(()=>{c();Xd();Hc()});function w9(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=E[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 T=I-O;T!==I&&S[T]===0;)T++;for(var L=u.repeat(x);T>>0,I=new Uint8Array(_);E[x];){var S=r[E.charCodeAt(x)];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,x++}if(E[x]!==" "){for(var b=_-F;b!==_&&I[b]===0;)b++;for(var T=new Uint8Array(O+(_-b)),L=O;b!==_;)T[L++]=I[b++];return T}}}function w(E){var x=g(E);if(x)return x;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:g,decode:w}}var E9,v9,V2,H2=ge(()=>{c();E9=w9,v9=E9,V2=v9});var Vle,G2,zn,j2,k2,Bi=ge(()=>{c();Vle=new Uint8Array(0),G2=(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")},j2=t=>new TextEncoder().encode(t),k2=t=>new TextDecoder().decode(t)});var f1,h1,d1,W2,p1,Na,Li,A9,b9,pt,zr=ge(()=>{c();H2();Bi();f1=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")}},h1=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 W2(this,e)}},d1=class{constructor(e){this.decoders=e}or(e){return W2(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`)}},W2=(t,e)=>new d1({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),p1=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new f1(e,r,n),this.decoder=new h1(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},Na=({name:t,prefix:e,encode:r,decode:n})=>new p1(t,e,r,n),Li=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=V2(r,e);return Na({prefix:t,name:e,encode:n,decode:s=>zn(i(s))})},A9=(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},b9=(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<Na({prefix:e,name:t,encode(i){return b9(i,n,r)},decode(i){return A9(i,n,r,t)}})});var g1={};ft(g1,{identity:()=>_9});var _9,z2=ge(()=>{c();zr();Bi();_9=Na({prefix:"\0",name:"identity",encode:t=>k2(t),decode:t=>j2(t)})});var y1={};ft(y1,{base2:()=>I9});var I9,$2=ge(()=>{c();zr();I9=pt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1})});var m1={};ft(m1,{base8:()=>S9});var S9,K2=ge(()=>{c();zr();S9=pt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3})});var w1={};ft(w1,{base10:()=>T9});var T9,Y2=ge(()=>{c();zr();T9=Li({prefix:"9",name:"base10",alphabet:"0123456789"})});var E1={};ft(E1,{base16:()=>C9,base16upper:()=>x9});var C9,x9,J2=ge(()=>{c();zr();C9=pt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),x9=pt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})});var v1={};ft(v1,{base32:()=>Oa,base32hex:()=>P9,base32hexpad:()=>B9,base32hexpadupper:()=>L9,base32hexupper:()=>R9,base32pad:()=>O9,base32padupper:()=>D9,base32upper:()=>N9,base32z:()=>F9});var Oa,N9,O9,D9,P9,R9,B9,L9,F9,A1=ge(()=>{c();zr();Oa=pt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),N9=pt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),O9=pt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),D9=pt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),P9=pt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),R9=pt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),B9=pt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),L9=pt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),F9=pt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})});var b1={};ft(b1,{base36:()=>M9,base36upper:()=>U9});var M9,U9,X2=ge(()=>{c();zr();M9=Li({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),U9=Li({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})});var _1={};ft(_1,{base58btc:()=>_n,base58flickr:()=>q9});var _n,q9,I1=ge(()=>{c();zr();_n=Li({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),q9=Li({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})});var S1={};ft(S1,{base64:()=>V9,base64pad:()=>H9,base64url:()=>G9,base64urlpad:()=>j9});var V9,H9,G9,j9,Z2=ge(()=>{c();zr();V9=pt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),H9=pt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),G9=pt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),j9=pt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})});var T1={};ft(T1,{base256emoji:()=>$9});function W9(t){return t.reduce((e,r)=>(e+=k9[r],e),"")}function z9(t){let e=[];for(let r of t){let n=Q9[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var eD,k9,Q9,$9,tD=ge(()=>{c();zr();eD=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}"),k9=eD.reduce((t,e,r)=>(t[r]=e,t),[]),Q9=eD.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);$9=Na({prefix:"\u{1F680}",name:"base256emoji",encode:W9,decode:z9})});function iD(t,e,r){e=e||[],r=r||0;for(var n=r;t>=X9;)e[r++]=t&255|rD,t/=128;for(;t&J9;)e[r++]=t&255|rD,t>>>=7;return e[r]=t|0,iD.bytes=r-n+1,e}function C1(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw C1.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&nD)<=eQ);return C1.bytes=s-n,r}var K9,rD,Y9,J9,X9,Z9,eQ,nD,tQ,rQ,nQ,iQ,sQ,oQ,aQ,uQ,cQ,lQ,fQ,hQ,Gc,sD=ge(()=>{c();K9=iD,rD=128,Y9=127,J9=~Y9,X9=Math.pow(2,31);Z9=C1,eQ=128,nD=127;tQ=Math.pow(2,7),rQ=Math.pow(2,14),nQ=Math.pow(2,21),iQ=Math.pow(2,28),sQ=Math.pow(2,35),oQ=Math.pow(2,42),aQ=Math.pow(2,49),uQ=Math.pow(2,56),cQ=Math.pow(2,63),lQ=function(t){return t{c();sD();jc=(t,e=0)=>[Gc.decode(t,e),Gc.decode.bytes],Da=(t,e,r=0)=>(Gc.encode(t,e,r),e),Pa=t=>Gc.encodingLength(t)});var Gs,oD,aD,Ra,Qc=ge(()=>{c();Bi();tp();Gs=(t,e)=>{let r=e.byteLength,n=Pa(t),i=n+Pa(r),s=new Uint8Array(i+r);return Da(t,s,0),Da(r,s,n),s.set(e,i),new Ra(t,r,e,s)},oD=t=>{let e=zn(t),[r,n]=jc(e),[i,s]=jc(e.subarray(n)),o=e.subarray(n+s);if(o.byteLength!==i)throw new Error("Incorrect length");return new Ra(r,i,o,e)},aD=(t,e)=>t===e?!0:t.code===e.code&&t.size===e.size&&G2(t.bytes,e.bytes),Ra=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}});var N1,x1,O1=ge(()=>{c();Qc();N1=({name:t,code:e,encode:r})=>new x1(t,e,r),x1=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?Gs(this.code,r):r.then(n=>Gs(this.code,n))}else throw Error("Unknown type, must be binary type")}}});var D1={};ft(D1,{sha256:()=>dQ,sha512:()=>pQ});var cD,dQ,pQ,lD=ge(()=>{c();O1();cD=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),dQ=N1({name:"sha2-256",code:18,encode:cD("SHA-256")}),pQ=N1({name:"sha2-512",code:19,encode:cD("SHA-512")})});var P1={};ft(P1,{identity:()=>mQ});var fD,gQ,hD,yQ,mQ,dD=ge(()=>{c();Bi();Qc();fD=0,gQ="identity",hD=zn,yQ=t=>Gs(fD,hD(t)),mQ={code:fD,name:gQ,encode:hD,digest:yQ}});var pD=ge(()=>{c();Bi()});var Tfe,Cfe,gD=ge(()=>{c();Tfe=new TextEncoder,Cfe=new TextDecoder});var ip,vQ,AQ,bQ,Wc,_Q,yD,mD,rp,np,IQ,SQ,TQ,wD=ge(()=>{c();tp();Qc();I1();A1();Bi();ip=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:np,byteLength:np,code:rp,version:rp,multihash:rp,bytes:rp,_baseCache:np,asCID:np})}toV0(){switch(this.version){case 0:return this;default:{let{code:e,multihash:r}=this;if(e!==Wc)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==_Q)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=Gs(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&&aD(this.multihash,e.multihash)}toString(e){let{bytes:r,version:n,_baseCache:i}=this;switch(n){case 0:return AQ(r,i,e||_n.encoder);default:return bQ(r,i,e||Oa.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 SQ(/^0\.0/,TQ),!!(e&&(e[mD]||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||yD(r,n,i.bytes))}else if(e!=null&&e[mD]===!0){let{version:r,multihash:n,code:i}=e,s=oD(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!==Wc)throw new Error(`Version 0 CID must use dag-pb (code: ${Wc}) block encoding`);return new t(e,r,n,n.bytes)}case 1:{let i=yD(e,r,n.bytes);return new t(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return t.create(0,Wc,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 Ra(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]=jc(e.subarray(r));return r+=g,d},i=n(),s=Wc;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]=vQ(e,r),s=t.decode(i);return s._baseCache.set(n,e),s}},vQ=(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 Oa.prefix:{let r=e||Oa;return[Oa.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)]}}},AQ=(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},bQ=(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},Wc=112,_Q=18,yD=(t,e,r)=>{let n=Pa(t),i=n+Pa(e),s=new Uint8Array(i+r.byteLength);return Da(t,s,0),Da(e,s,n),s.set(r,i),s},mD=Symbol.for("@ipld/js-cid/CID"),rp={writable:!1,configurable:!1,enumerable:!0},np={writable:!1,enumerable:!1,configurable:!1},IQ="0.0.0-dev",SQ=(t,e)=>{if(t.test(IQ))console.warn(e);else throw new Error(e)},TQ=`CID.isCID(v) is deprecated and will be removed in the next major release. +`)}};he.ErrContractHasNoAddress=im;var sm=class extends De{constructor(e){super(e)}};he.ErrMock=sm;var om=class extends De{constructor(e){super(e)}};he.ErrTypingSystem=om;var am=class extends De{constructor(e,r){super(`field ${e} does not exist on struct ${r}`)}};he.ErrMissingFieldOnStruct=am;var um=class extends De{constructor(e,r){super(`field ${e} does not exist on enum ${r}`)}};he.ErrMissingFieldOnEnum=um;var cm=class extends De{constructor(e){super(`cannot parse contract results: ${e}`)}};he.ErrCannotParseContractResults=cm;var lm=class extends De{constructor(e,r){super(`cannot parse outcome of transaction ${e}: ${r}`)}};he.ErrCannotParseTransactionOutcome=lm;var fm=class extends De{constructor(e){super(e)}};he.ErrCodec=fm;var hm=class extends De{constructor(e){super(e)}};he.ErrContractInteraction=hm;var dm=class extends De{constructor(){super("Method not yet implemented")}};he.ErrNotImplemented=dm;var pm=class extends De{constructor(){super("invalid arguments for relayed v1 builder")}};he.ErrInvalidRelayedV1BuilderArguments=pm;var gm=class extends De{constructor(){super("invalid arguments for relayed v2 builder")}};he.ErrInvalidRelayedV2BuilderArguments=gm;var ym=class extends De{constructor(){super("gas limit must be 0 for the inner transaction for relayed v2")}};he.ErrGasLimitShouldBe0ForInnerTransaction=ym;var mm=class extends De{constructor(){super("The transaction watcher requires the `isCompleted` property to be defined on the transaction object. Perhaps you've used the sdk-network-provider's `ProxyNetworkProvider.getTransaction()` and in that case you should also pass `withProcessStatus=true`.")}};he.ErrIsCompletedFieldIsMissingOnTransaction=mm});var Em=m(di=>{"use strict";c();var k5=di&&di.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(di,"__esModule",{value:!0});di.TokenPayment=di.TokenTransfer=void 0;var Cu=k5(Gt()),j5=Be(),ES="EGLD",vS=18;Cu.default.set({ROUNDING_MODE:1});var nf=class t{constructor(e){let r=new Cu.default(e.amountAsBigInteger);if(!r.isInteger()||r.isNegative())throw new j5.ErrInvalidArgument(`bad amountAsBigInteger: ${e.amountAsBigInteger}`);this.tokenIdentifier=e.tokenIdentifier,this.nonce=e.nonce,this.amountAsBigInteger=r,this.numDecimals=e.numDecimals||0}static egldFromAmount(e){let r=new Cu.default(e).shiftedBy(vS).decimalPlaces(0);return this.egldFromBigInteger(r)}static egldFromBigInteger(e){return new t({tokenIdentifier:ES,nonce:0,amountAsBigInteger:e,numDecimals:vS})}static fungibleFromAmount(e,r,n){let i=new Cu.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 Cu.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==ES}isFungible(){return this.nonce==0}};di.TokenTransfer=nf;var wm=class extends nf{constructor(e,r,n,i){super({tokenIdentifier:e,nonce:r,amountAsBigInteger:n,numDecimals:i})}};di.TokenPayment=wm});var bs=m(ze=>{"use strict";c();Object.defineProperty(ze,"__esModule",{value:!0});ze.ARGUMENTS_SEPARATOR=ze.ESDT_TRANSFER_VALUE=ze.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME=ze.ESDTNFT_TRANSFER_FUNCTION_NAME=ze.ESDT_TRANSFER_FUNCTION_NAME=ze.ESDT_TRANSFER_GAS_LIMIT=ze.TRANSACTION_VERSION_WITH_OPTIONS=ze.TRANSACTION_VERSION_DEFAULT=ze.TRANSACTION_OPTIONS_TX_GUARDED=ze.TRANSACTION_OPTIONS_TX_HASH_SIGN=ze.TRANSACTION_OPTIONS_DEFAULT=ze.TRANSACTION_MIN_GAS_PRICE=void 0;ze.TRANSACTION_MIN_GAS_PRICE=1e9;ze.TRANSACTION_OPTIONS_DEFAULT=0;ze.TRANSACTION_OPTIONS_TX_HASH_SIGN=1;ze.TRANSACTION_OPTIONS_TX_GUARDED=2;ze.TRANSACTION_VERSION_DEFAULT=1;ze.TRANSACTION_VERSION_WITH_OPTIONS=2;ze.ESDT_TRANSFER_GAS_LIMIT=5e5;ze.ESDT_TRANSFER_FUNCTION_NAME="ESDTTransfer";ze.ESDTNFT_TRANSFER_FUNCTION_NAME="ESDTNFTTransfer";ze.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME="MultiESDTNFTTransfer";ze.ESDT_TRANSFER_VALUE="0";ze.ARGUMENTS_SEPARATOR="@"});var wr=m(nt=>{"use strict";c();var Q5=nt&&nt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),W5=nt&&nt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$5=nt&&nt.__importStar||function(t){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 W5(e,t),e};Object.defineProperty(nt,"__esModule",{value:!0});nt.isEmpty=nt.guardEmpty=nt.guardNotEmpty=nt.guardLength=nt.guardSameLength=nt.guardValueIsSetWithMessage=nt.guardValueIsSet=nt.guardTrue=void 0;var bo=$5(Be());function z5(t,e){if(!t)throw new bo.ErrInvariantFailed(`[<${e}>] isn't true`)}nt.guardTrue=z5;function K5(t,e){AS(`${t} isn't set (null or undefined)`,e)}nt.guardValueIsSet=K5;function AS(t,e){if(e==null||e===void 0)throw new bo.ErrInvariantFailed(t)}nt.guardValueIsSetWithMessage=AS;function Y5(t,e){if(t=t||[],e=e||[],t.length!=e.length)throw new bo.ErrInvariantFailed("arrays do not have the same length")}nt.guardSameLength=Y5;function J5(t,e){let r=t.length||0;if(r!=e)throw new bo.ErrInvariantFailed(`wrong length, expected: ${e}, actual: ${r}`)}nt.guardLength=J5;function X5(t,e){if(vm(t))throw new bo.ErrInvariantFailed(`${e} is empty`)}nt.guardNotEmpty=X5;function Z5(t,e){if(!vm(t))throw new bo.ErrInvariantFailed(`${e} is not empty`)}nt.guardEmpty=Z5;function vm(t){return t.isEmpty?t.isEmpty():t.length===0}nt.isEmpty=vm});var bS=m(sf=>{"use strict";c();Object.defineProperty(sf,"__esModule",{value:!0});sf.getJavascriptPrototypesInHierarchy=void 0;function e4(t,e){let r=[],n=Object.getPrototypeOf(t);for(;n&&e(n);)r.push(n),n=Object.getPrototypeOf(n);return r}sf.getJavascriptPrototypesInHierarchy=e4});var It=m(_t=>{"use strict";c();Object.defineProperty(_t,"__esModule",{value:!0});_t.NullType=_t.TypePlaceholder=_t.isTyped=_t.PrimitiveValue=_t.TypedValue=_t.CustomType=_t.PrimitiveType=_t.TypeCardinality=_t.Type=void 0;var Am=bS(),_S=wr(),pi=class t{constructor(e,r=[],n=xu.fixed(1)){_S.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 _S.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(){}};_t.Type=pi;pi.ClassName="Type";var xu=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}};_t.TypeCardinality=xu;xu.MaxCardinality=4096;var of=class t extends pi{constructor(e){super(e)}getClassName(){return t.ClassName}};_t.PrimitiveType=of;of.ClassName="PrimitiveType";var af=class t extends pi{getClassName(){return t.ClassName}};_t.CustomType=af;af.ClassName="CustomType";var Nu=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(){}};_t.TypedValue=Nu;Nu.ClassName="TypedValue";var uf=class t extends Nu{constructor(e){super(e)}getClassName(){return t.ClassName}};_t.PrimitiveValue=uf;uf.ClassName="PrimitiveValue";function t4(t){return t.belongsToTypesystem!==void 0}_t.isTyped=t4;var cf=class t extends pi{constructor(){super("...")}getClassName(){return t.ClassName}};_t.TypePlaceholder=cf;cf.ClassName="TypePlaceholder";var lf=class t extends pi{constructor(){super("?")}getClassName(){return t.ClassName}};_t.NullType=lf;lf.ClassName="NullType"});var IS=m((_o,Io)=>{c();(function(t){var e=typeof _o=="object"&&_o&&!_o.nodeType&&_o,r=typeof Io=="object"&&Io&&!Io.nodeType&&Io,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,w="-",E=/^xn--/,T=/[^\x20-\x7E]/,D=/[\x2E\u3002\uFF0E\uFF61]/g,B={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},W=o-a,U=Math.floor,A=String.fromCharCode,I;function N(Y){throw new RangeError(B[Y])}function _(Y,se){for(var te=Y.length,ie=[];te--;)ie[te]=se(Y[te]);return ie}function S(Y,se){var te=Y.split("@"),ie="";te.length>1&&(ie=te[0]+"@",Y=te[1]),Y=Y.replace(D,".");var M=Y.split("."),le=_(M,se).join(".");return ie+le}function R(Y){for(var se=[],te=0,ie=Y.length,M,le;te=55296&&M<=56319&&te65535&&(se-=65536,te+=A(se>>>10&1023|55296),se=56320|se&1023),te+=A(se),te}).join("")}function Q(Y){return Y-48<10?Y-22:Y-65<26?Y-65:Y-97<26?Y-97:o}function V(Y,se){return Y+22+75*(Y<26)-((se!=0)<<5)}function k(Y,se,te){var ie=0;for(Y=te?U(Y/f):Y>>1,Y+=U(Y/se);Y>W*u>>1;ie+=o)Y=U(Y/W);return U(ie+(W+1)*Y/(Y+l))}function K(Y){var se=[],te=Y.length,ie,M=0,le=g,ae=d,fe,oe,ce,y,v,b,P,C,O;for(fe=Y.lastIndexOf(w),fe<0&&(fe=0),oe=0;oe=128&&N("not-basic"),se.push(Y.charCodeAt(oe));for(ce=fe>0?fe+1:0;ce=te&&N("invalid-input"),P=Q(Y.charCodeAt(ce++)),(P>=o||P>U((s-M)/v))&&N("overflow"),M+=P*v,C=b<=ae?a:b>=ae+u?u:b-ae,!(PU(s/O)&&N("overflow"),v*=O;ie=se.length+1,ae=k(M-y,ie,y==0),U(M/ie)>s-le&&N("overflow"),le+=U(M/ie),M%=ie,se.splice(M++,0,le)}return J(se)}function pe(Y){var se,te,ie,M,le,ae,fe,oe,ce,y,v,b=[],P,C,O,L;for(Y=R(Y),P=Y.length,se=g,te=0,le=d,ae=0;ae=se&&vU((s-te)/C)&&N("overflow"),te+=(fe-se)*C,se=fe,ae=0;aes&&N("overflow"),v==se){for(oe=te,ce=o;y=ce<=le?a:ce>=le+u?u:ce-le,!(oe{"use strict";c();var TS=IS();function r4(t,e){this.__proto__=new Error(e),this.__proto__.name="BackslashError",this.offset=t}function bm(t){return t>="0"&&t<="7"}function n4(t){return t>="0"&&t<="9"||t>="a"&&t<="f"||t>="A"&&t<="F"}function SS(t){return t=parseInt(t,16),TS.ucs2.encode([t])}function CS(t,e,r){var n=!1,i=[];function s(u){var l=t[u];if(!n4(l))throw new r4(u,"Unexpected token ILLEGAL");return l}for(;e{c();var DS=xS();BS.exports={validate:i4,parse:s4};function i4(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 s4(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 PS(t,e){for(var r=t.length,n=e,i,s=e;s-1&&t[r]==="\\";)n++,r--;return n%2===0}function c4(t,e,r,n){for(var i=e,s=",",o=[],a=e;_s(t[a]);)a++;if(t[a]==="]")return{start:e,end:a,value:o};for(;s===",";){var u=ff(t,i,r,n),l=PS(t,u.end);n&&o.push(u.value),i=l.end,s=l.value}return{start:e,end:i,value:o}}function l4(t,e){return t.substr(e,4)==="true"}function f4(t,e){return t.substr(e,5)==="false"}function h4(t,e){return t.substr(e,4)==="null"}var d4=new RegExp(/^\s$/);function _s(t){return d4.test(t)}var p4=new RegExp(/^\d$/);function NS(t){return p4.test(t)}function Gn(t,e,r){var n=10,i;t.length{"use strict";c();var g4=rn&&rn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),y4=rn&&rn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),m4=rn&&rn.__importStar||function(t){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 y4(e,t),e};Object.defineProperty(rn,"__esModule",{value:!0});rn.TypeExpressionParser=void 0;var FS=m4(Be()),w4=It(),E4=LS(),Im=class{parse(e){let r=this.doParse(e),n=Object.keys(r);if(n.length!=1)throw new FS.ErrTypingSystem(`bad type expression: ${e}`);let i=n[0];return this.nodeToType(i,r[i])}doParse(e){let r=this.getJsonedString(e);try{return E4.parse(r)}catch{throw new FS.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 w4.Type(e,n)}};rn.TypeExpressionParser=Im});var Tm=m(gi=>{"use strict";c();Object.defineProperty(gi,"__esModule",{value:!0});gi.EndpointParameterDefinition=gi.EndpointModifiers=gi.EndpointDefinition=void 0;var v4=hf(),MS="?",A4="N / A",Sm=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?MS:e.name,e.onlyOwner=e.onlyOwner||!1,e.payableInTokens=e.payableInTokens||[],e.inputs=e.inputs||[],e.outputs=e.outputs||[];let r=e.inputs.map(s=>Ou.fromJSON(s)),n=e.outputs.map(s=>Ou.fromJSON(s)),i=new df(e.mutability,e.payableInTokens,e.onlyOwner);return new t(e.name,r,n,i)}};gi.EndpointDefinition=Sm;var df=class{constructor(e,r,n){this.mutability=e||"",this.payableInTokens=r||[],this.onlyOwner=n||!1}isPayableInEGLD(){return this.isPayableInToken("EGLD")}isPayableInToken(e){return this.payableInTokens.includes(e)?!0:this.payableInTokens.includes(`!${e}`)?!1:!!this.payableInTokens.includes("*")}isPayable(){return this.payableInTokens.length!=0}isReadonly(){return this.mutability=="readonly"}isOnlyOwner(){return this.onlyOwner}};gi.EndpointModifiers=df;var Ou=class t{constructor(e,r,n){this.name=e,this.description=r,this.type=n}static fromJSON(e){let r=new v4.TypeExpressionParser().parse(e.type);return new t(e.name||MS,e.description||A4,r)}};gi.EndpointParameterDefinition=Ou});var So=m(ar=>{"use strict";c();var b4=ar&&ar.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.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=ar&&ar.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),I4=ar&&ar.__importStar||function(t){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(ar,"__esModule",{value:!0});ar.Fields=ar.Field=ar.FieldDefinition=void 0;var Cm=I4(Be()),S4=hf(),xm=class t{constructor(e,r,n){this.name=e,this.description=r,this.type=n}static fromJSON(e){let r=new S4.TypeExpressionParser().parse(e.type);return new t(e.name,e.description,r)}};ar.FieldDefinition=xm;var Nm=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)}};ar.Field=Nm;var Om=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(yi,"__esModule",{value:!0});yi.EnumValue=yi.EnumVariantDefinition=yi.EnumType=void 0;var T4=Be(),Dm=wr(),pf=So(),qS=It(),US=256,gf=class t extends qS.CustomType{constructor(e,r){super(e),this.variants=[],this.variants=r}getClassName(){return t.ClassName}static fromJSON(e){let r=(e.variants||[]).map(n=>yf.fromJSON(n));return new t(e.name,r)}getVariantByDiscriminant(e){let r=this.variants.find(n=>n.discriminant==e);return Dm.guardValueIsSet(`variant by discriminant (${e})`,r),r}getVariantByName(e){let r=this.variants.find(n=>n.name==e);return Dm.guardValueIsSet(`variant by name (${e})`,r),r}getNamesOfDependencies(){let e=[];for(let r of this.variants)e.push(...r.getNamesOfDependencies());return[...new Set(e)]}};yi.EnumType=gf;gf.ClassName="EnumType";var yf=class t{constructor(e,r,n=[]){this.fieldsDefinitions=[],Dm.guardTrue(rpf.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 pf.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};yi.EnumVariantDefinition=yf;var mf=class t extends qS.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();pf.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=pf.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 T4.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}};yi.EnumValue=mf;mf.ClassName="EnumValue"});var Co=m(To=>{"use strict";c();Object.defineProperty(To,"__esModule",{value:!0});To.Struct=To.StructType=void 0;var C4=Be(),wf=So(),VS=It(),Ef=class t extends VS.CustomType{constructor(e,r){super(e),this.fieldsDefinitions=[],this.fieldsDefinitions=r}getClassName(){return t.ClassName}static fromJSON(e){let r=(e.fields||[]).map(n=>wf.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 wf.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};To.StructType=Ef;Ef.ClassName="StructType";var vf=class t extends VS.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();wf.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 C4.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 wf.Fields.equals(r,n)}};To.Struct=vf;vf.ClassName="Struct"});var Rm=m((rse,kS)=>{"use strict";c();var bf="qpzry9x8gf2tvdw0s3jn54khce6mua7l",Pm={};for(Pu=0;Pu>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 HS(t){for(var e=1,r=0;r126)return"Invalid prefix ("+t+")";e=xo(e)^n>>5}for(e=xo(e),r=0;rr)throw new TypeError("Exceeds length limit");t=t.toLowerCase();var n=HS(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=xo(n)^o,i+=bf.charAt(o)}for(s=0;s<6;++s)n=xo(n);for(n^=1,s=0;s<6;++s){var a=n>>(5-s)*5&31;i+=bf.charAt(a)}return i}function GS(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=HS(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 N4(){var t=GS.apply(null,arguments);if(typeof t=="object")return t}function O4(t){var e=GS.apply(null,arguments);if(typeof e=="object")return e;throw new Error(e)}function _f(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 L4=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]}),F4=nn&&nn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jS=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)&&L4(e,t,r);return F4(e,t),e};Object.defineProperty(nn,"__esModule",{value:!0});nn.Address=void 0;var If=jS(Rm()),No=jS(Be()),Bm="erd",Lm=32,M4="0".repeat(16),Fm=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 No.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!=Lm)throw new No.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==Lm}static fromHex(e){if(!t.isValidHex(e))throw new No.ErrAddressCannotCreate(e);return t.fromValidHex(e)}static empty(){return new t}static fromBech32(e){let r;try{r=If.decode(e)}catch(s){throw new No.ErrAddressCannotCreate(e,s)}let n=r.prefix;if(n!=Bm)throw new No.ErrAddressBadHrp(Bm,n);let i=h.Buffer.from(If.fromWords(r.words));if(i.length!=Lm)throw new No.ErrAddressCannotCreate(e);return t.fromValidHex(i.toString("hex"))}hex(){return this.isEmpty()?"":this.valueHex}bech32(){if(this.isEmpty())return"";let e=If.toWords(this.pubkey());return If.encode(Bm,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(M4)}};nn.Address=Fm});var Do=m(Oo=>{"use strict";c();Object.defineProperty(Oo,"__esModule",{value:!0});Oo.AddressValue=Oo.AddressType=void 0;var U4=ht(),QS=It(),Ru=class t extends QS.PrimitiveType{constructor(){super("Address")}getClassName(){return t.ClassName}};Oo.AddressType=Ru;Ru.ClassName="AddressType";var Sf=class t extends QS.PrimitiveValue{constructor(e){super(new Ru),this.value=new U4.Address(e.bech32())}getClassName(){return t.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};Oo.AddressValue=Sf;Sf.ClassName="AddressValue"});var Cf=m(Po=>{"use strict";c();Object.defineProperty(Po,"__esModule",{value:!0});Po.OptionalValue=Po.OptionalType=void 0;var q4=wr(),Bu=It(),Lu=class t extends Bu.Type{constructor(e){super("Optional",[e],Bu.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(Bu.NullType.ClassName);return r||n}};Po.OptionalType=Lu;Lu.ClassName="OptionalType";var Tf=class t extends Bu.TypedValue{constructor(e,r=null){super(e),this.value=r}getClassName(){return t.ClassName}static newMissing(){let e=new Lu(new Bu.NullType);return new t(e)}isSet(){return!!this.value}getTypedValue(){return q4.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}};Po.OptionalValue=Tf;Tf.ClassName="OptionalValue"});var Mu=m(Ro=>{"use strict";c();Object.defineProperty(Ro,"__esModule",{value:!0});Ro.BooleanValue=Ro.BooleanType=void 0;var WS=It(),Fu=class t extends WS.PrimitiveType{constructor(){super("bool")}getClassName(){return t.ClassName}};Ro.BooleanType=Fu;Fu.ClassName="BooleanType";var xf=class t extends WS.PrimitiveValue{constructor(e){super(new Fu),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}};Ro.BooleanValue=xf;xf.ClassName="BooleanValue"});var mi=m(Bo=>{"use strict";c();Object.defineProperty(Bo,"__esModule",{value:!0});Bo.BytesValue=Bo.BytesType=void 0;var $S=It(),Uu=class t extends $S.PrimitiveType{constructor(){super("bytes")}getClassName(){return t.ClassName}};Bo.BytesType=Uu;Uu.ClassName="BytesType";var Nf=class t extends $S.PrimitiveValue{constructor(e){super(new Uu),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()}};Bo.BytesValue=Nf;Nf.ClassName="BytesValue"});var KS=m(Lo=>{"use strict";c();Object.defineProperty(Lo,"__esModule",{value:!0});Lo.CodeMetadataValue=Lo.CodeMetadataType=void 0;var zS=It(),Of=class extends zS.PrimitiveType{constructor(){super("CodeMetadata")}};Lo.CodeMetadataType=Of;var Mm=class extends zS.PrimitiveValue{constructor(e){super(new Of),this.value=e}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};Lo.CodeMetadataValue=Mm});var Pf=m(Fo=>{"use strict";c();Object.defineProperty(Fo,"__esModule",{value:!0});Fo.CompositeValue=Fo.CompositeType=void 0;var V4=wr(),Um=It(),qu=class t extends Um.Type{constructor(...e){super("Composite",e,Um.TypeCardinality.variable(e.length))}getClassName(){return t.ClassName}};Fo.CompositeType=qu;qu.ClassName="CompositeType";var Df=class t extends Um.TypedValue{constructor(e,r){super(e),V4.guardLength(r,e.getTypeParameters().length),this.items=r}getClassName(){return t.ClassName}static fromItems(...e){let r=e.map(i=>i.getType()),n=new qu(...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(Rf,"__esModule",{value:!0});Rf.CollectionOfTypedValues=void 0;var qm=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(sn,"__esModule",{value:!0});sn.List=sn.OptionValue=sn.ListType=sn.OptionType=void 0;var H4=wr(),G4=Vm(),Ss=It(),Is=class t extends Ss.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(Ss.NullType.ClassName);return r||n}};sn.OptionType=Is;Is.ClassName="OptionType";var Vu=class t extends Ss.Type{constructor(e){super("List",[e])}getClassName(){return t.ClassName}};sn.ListType=Vu;Vu.ClassName="ListType";var Bf=class t extends Ss.TypedValue{constructor(e,r=null){super(e),this.value=r}getClassName(){return t.ClassName}static newMissing(){let e=new Is(new Ss.NullType);return new t(e)}static newMissingTyped(e){return new t(new Is(e))}static newProvided(e){let r=new Is(e.getType());return new t(r,e)}isSet(){return!!this.value}getTypedValue(){return H4.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}};sn.OptionValue=Bf;Bf.ClassName="OptionValue";var Lf=class t extends Ss.TypedValue{constructor(e,r){super(e),this.backingCollection=new G4.CollectionOfTypedValues(r)}getClassName(){return t.ClassName}static fromItems(e){if(e.length==0)return new t(new Ss.TypePlaceholder,[]);let r=e[0].getType(),n=new Vu(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)}};sn.List=Lf;Lf.ClassName="List"});var Uf=m(Mo=>{"use strict";c();Object.defineProperty(Mo,"__esModule",{value:!0});Mo.ArrayVec=Mo.ArrayVecType=void 0;var YS=wr(),k4=Vm(),JS=It(),Ff=class t extends JS.Type{constructor(e,r){super("Array",[r]),YS.guardTrue(e>0,"array length > 0"),this.length=e}getClassName(){return t.ClassName}};Mo.ArrayVecType=Ff;Ff.ClassName="ArrayVecType";var Mf=class t extends JS.TypedValue{constructor(e,r){super(e),YS.guardLength(r,e.length),this.backingCollection=new k4.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)}};Mo.ArrayVec=Mf;Mf.ClassName="ArrayVec"});var ku=m(Uo=>{"use strict";c();Object.defineProperty(Uo,"__esModule",{value:!0});Uo.H256Value=Uo.H256Type=void 0;var XS=It(),Gu=class t extends XS.PrimitiveType{constructor(){super("H256")}getClassName(){return t.ClassName}};Uo.H256Type=Gu;Gu.ClassName="H256Type";var qf=class t extends XS.PrimitiveValue{constructor(e){super(new Gu),this.value=e}getClassName(){return t.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};Uo.H256Value=qf;qf.ClassName="H256Value"});var Hf=m(qo=>{"use strict";c();Object.defineProperty(qo,"__esModule",{value:!0});qo.NothingValue=qo.NothingType=void 0;var ZS=It(),ju=class t extends ZS.PrimitiveType{constructor(){super("nothing")}getClassName(){return t.ClassName}};qo.NothingType=ju;ju.ClassName="NothingType";var Vf=class t extends ZS.PrimitiveValue{constructor(){super(new ju)}getClassName(){return t.ClassName}equals(e){return!1}valueOf(){return{}}};qo.NothingValue=Vf;Vf.ClassName="NothingValue"});var tc=m(Ie=>{"use strict";c();var j4=Ie&&Ie.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Q4=Ie&&Ie.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),W4=Ie&&Ie.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&j4(e,t,r);return Q4(e,t),e},$4=Ie&&Ie.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ie,"__esModule",{value:!0});Ie.BigIntValue=Ie.BigUIntValue=Ie.I64Value=Ie.U64Value=Ie.I32Value=Ie.U32Value=Ie.I16Value=Ie.U16Value=Ie.I8Value=Ie.U8Value=Ie.NumericalValue=Ie.BigIntType=Ie.BigUIntType=Ie.I64Type=Ie.U64Type=Ie.I32Type=Ie.U32Type=Ie.I16Type=Ie.U16Type=Ie.I8Type=Ie.U8Type=Ie.NumericalType=void 0;var eT=W4(Be()),tT=It(),Ts=$4(Gt()),ur=class t extends tT.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()}};Ie.NumericalType=ur;ur.ClassName="NumericalType";var Qu=class t extends ur{constructor(){super("u8",1,!1)}getClassName(){return t.ClassName}};Ie.U8Type=Qu;Qu.ClassName="U8Type";var Wu=class t extends ur{constructor(){super("i8",1,!0)}getClassName(){return t.ClassName}};Ie.I8Type=Wu;Wu.ClassName="I8Type";var $u=class t extends ur{constructor(){super("u16",2,!1)}getClassName(){return t.ClassName}};Ie.U16Type=$u;$u.ClassName="U16Type";var zu=class t extends ur{constructor(){super("i16",2,!0)}getClassName(){return t.ClassName}};Ie.I16Type=zu;zu.ClassName="I16Type";var Ku=class t extends ur{constructor(){super("u32",4,!1)}getClassName(){return t.ClassName}};Ie.U32Type=Ku;Ku.ClassName="U32Type";var Yu=class t extends ur{constructor(){super("i32",4,!0)}getClassName(){return t.ClassName}};Ie.I32Type=Yu;Yu.ClassName="I32Type";var Ju=class t extends ur{constructor(){super("u64",8,!1)}getClassName(){return t.ClassName}};Ie.U64Type=Ju;Ju.ClassName="U64Type";var Xu=class t extends ur{constructor(){super("i64",8,!0)}getClassName(){return t.ClassName}};Ie.I64Type=Xu;Xu.ClassName="I64Type";var Zu=class t extends ur{constructor(){super("BigUint",0,!1)}getClassName(){return t.ClassName}};Ie.BigUIntType=Zu;Zu.ClassName="BigUIntType";var ec=class t extends ur{constructor(){super("Bigint",0,!0)}getClassName(){return t.ClassName}};Ie.BigIntType=ec;ec.ClassName="BigIntType";var cr=class t extends tT.PrimitiveValue{constructor(e,r){if(super(e),this.value=new Ts.default(r),this.sizeInBytes=e.sizeInBytes,this.withSign=e.withSign,this.value.isNaN())throw new eT.ErrInvalidArgument(`not a number: ${r}`);if(!this.withSign&&this.value.isNegative())throw new eT.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()}};Ie.NumericalValue=cr;cr.ClassName="NumericalValue";var Gf=class t extends cr{constructor(e){super(new Qu,new Ts.default(e))}getClassName(){return t.ClassName}};Ie.U8Value=Gf;Gf.ClassName="U8Value";var kf=class t extends cr{constructor(e){super(new Wu,new Ts.default(e))}getClassName(){return t.ClassName}};Ie.I8Value=kf;kf.ClassName="I8Value";var jf=class t extends cr{constructor(e){super(new $u,new Ts.default(e))}getClassName(){return t.ClassName}};Ie.U16Value=jf;jf.ClassName="U16Value";var Qf=class t extends cr{constructor(e){super(new zu,new Ts.default(e))}getClassName(){return t.ClassName}};Ie.I16Value=Qf;Qf.ClassName="I16Value";var Wf=class t extends cr{constructor(e){super(new Ku,new Ts.default(e))}getClassName(){return t.ClassName}};Ie.U32Value=Wf;Wf.ClassName="U32Value";var $f=class t extends cr{constructor(e){super(new Yu,new Ts.default(e))}getClassName(){return t.ClassName}};Ie.I32Value=$f;$f.ClassName="I32Value";var zf=class t extends cr{constructor(e){super(new Ju,e)}getClassName(){return t.ClassName}};Ie.U64Value=zf;zf.ClassName="U64Value";var Kf=class t extends cr{constructor(e){super(new Xu,e)}getClassName(){return t.ClassName}};Ie.I64Value=Kf;Kf.ClassName="I64Value";var Yf=class t extends cr{constructor(e){super(new Zu,e)}getClassName(){return t.ClassName}};Ie.BigUIntValue=Yf;Yf.ClassName="BigUIntValue";var Jf=class t extends cr{constructor(e){super(new ec,e)}getClassName(){return t.ClassName}};Ie.BigIntValue=Jf;Jf.ClassName="BigIntValue"});var Zf=m(Vo=>{"use strict";c();Object.defineProperty(Vo,"__esModule",{value:!0});Vo.StringValue=Vo.StringType=void 0;var rT=It(),rc=class t extends rT.PrimitiveType{constructor(){super("utf-8 string")}getClassName(){return t.ClassName}};Vo.StringType=rc;rc.ClassName="StringType";var Xf=class t extends rT.PrimitiveValue{constructor(e){super(new rc),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}};Vo.StringValue=Xf;Xf.ClassName="StringValue"});var Go=m(Ho=>{"use strict";c();Object.defineProperty(Ho,"__esModule",{value:!0});Ho.TokenIdentifierValue=Ho.TokenIdentifierType=void 0;var nT=It(),z4="EGLD",nc=class t extends nT.PrimitiveType{constructor(){super("TokenIdentifier")}getClassName(){return t.ClassName}};Ho.TokenIdentifierType=nc;nc.ClassName="TokenIdentifierType";var eh=class t extends nT.PrimitiveValue{constructor(e){super(new nc),this.value=e}static egld(){return new t(z4)}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()}};Ho.TokenIdentifierValue=eh;eh.ClassName="TokenIdentifierValue"});var rh=m(Tr=>{"use strict";c();var K4=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]}),Y4=Tr&&Tr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),J4=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)&&K4(e,t,r);return Y4(e,t),e};Object.defineProperty(Tr,"__esModule",{value:!0});Tr.Tuple=Tr.TupleType=void 0;var X4=J4(Be()),iT=So(),sT=Co(),ic=class t extends sT.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 iT.FieldDefinition(oT(i),"anonymous tuple field",n))}};Tr.TupleType=ic;ic.ClassName="TupleType";function oT(t){return`field${t}`}var th=class t extends sT.Struct{constructor(e,r){super(e,r)}getClassName(){return t.ClassName}static fromItems(e){if(e.length<1)throw new X4.ErrTypingSystem("bad tuple items");let r=e.map(s=>s.getType()),n=new ic(...r),i=e.map((s,o)=>new iT.Field(s,oT(o)));return new t(n,i)}};Tr.Tuple=th;th.ClassName="Tuple"});var sh=m(wi=>{"use strict";c();Object.defineProperty(wi,"__esModule",{value:!0});wi.VariadicValue=wi.CountedVariadicType=wi.VariadicType=void 0;var ko=It(),Cs=class t extends ko.Type{constructor(e,r=!1){super("Variadic",[e],ko.TypeCardinality.variable()),this.isCounted=r}getClassName(){return t.ClassName}};wi.VariadicType=Cs;Cs.ClassName="VariadicType";var nh=class extends ko.Type{constructor(e){super("Variadic",[e],ko.TypeCardinality.variable())}getClassName(){return Cs.ClassName}};wi.CountedVariadicType=nh;nh.ClassName="VariadicType";var ih=class t extends ko.TypedValue{constructor(e,r){super(e),this.items=r}getClassName(){return t.ClassName}static fromItems(...e){return this.createFromItems(e,!1)}static fromItemsCounted(...e){return this.createFromItems(e,!0)}static createFromItems(e,r){if(e.length==0)return new t(new Cs(new ko.TypePlaceholder,r),[]);let n=e[0].getType();return new t(new Cs(n,r),e)}getItems(){return this.items}valueOf(){return this.items.map(e=>e.valueOf())}equals(e){if(this.getType().differs(e.getType()))return!1;for(let r=0;r{"use strict";c();var Z4=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]}),eq=on&&on.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tq=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)&&Z4(e,t,r);return eq(e,t),e};Object.defineProperty(on,"__esModule",{value:!0});on.TypeMapper=void 0;var aT=tq(Be()),rq=Do(),Hm=Cf(),nq=Mu(),iq=mi(),sq=KS(),oh=Pf(),Gm=Du(),oq=So(),uT=Hu(),kn=Uf(),aq=ku(),cT=Hf(),Cr=tc(),uq=Zf(),lT=Co(),fT=Go(),Ei=rh(),ah=sh(),km=class{constructor(e=[]){this.openTypesFactories=new Map([["Option",(...r)=>new uT.OptionType(r[0])],["List",(...r)=>new uT.ListType(r[0])],["VarArgs",(...r)=>new ah.VariadicType(r[0])],["MultiResultVec",(...r)=>new ah.VariadicType(r[0])],["variadic",(...r)=>new ah.VariadicType(r[0])],["counted-variadic",(...r)=>new ah.VariadicType(r[0],!0)],["OptionalArg",(...r)=>new Hm.OptionalType(r[0])],["optional",(...r)=>new Hm.OptionalType(r[0])],["OptionalResult",(...r)=>new Hm.OptionalType(r[0])],["multi",(...r)=>new oh.CompositeType(...r)],["MultiArg",(...r)=>new oh.CompositeType(...r)],["MultiResult",(...r)=>new oh.CompositeType(...r)],["multi",(...r)=>new oh.CompositeType(...r)],["tuple",(...r)=>new Ei.TupleType(...r)],["tuple2",(...r)=>new Ei.TupleType(...r)],["tuple3",(...r)=>new Ei.TupleType(...r)],["tuple4",(...r)=>new Ei.TupleType(...r)],["tuple5",(...r)=>new Ei.TupleType(...r)],["tuple6",(...r)=>new Ei.TupleType(...r)],["tuple7",(...r)=>new Ei.TupleType(...r)],["tuple8",(...r)=>new Ei.TupleType(...r)],["array2",(...r)=>new kn.ArrayVecType(2,r[0])],["array8",(...r)=>new kn.ArrayVecType(8,r[0])],["array16",(...r)=>new kn.ArrayVecType(16,r[0])],["array20",(...r)=>new kn.ArrayVecType(20,r[0])],["array32",(...r)=>new kn.ArrayVecType(32,r[0])],["array46",(...r)=>new kn.ArrayVecType(46,r[0])],["array64",(...r)=>new kn.ArrayVecType(64,r[0])],["array128",(...r)=>new kn.ArrayVecType(128,r[0])],["array256",(...r)=>new kn.ArrayVecType(256,r[0])]]),this.closedTypesMap=new Map([["u8",new Cr.U8Type],["u16",new Cr.U16Type],["u32",new Cr.U32Type],["u64",new Cr.U64Type],["U64",new Cr.U64Type],["BigUint",new Cr.BigUIntType],["i8",new Cr.I8Type],["i16",new Cr.I16Type],["i32",new Cr.I32Type],["i64",new Cr.I64Type],["Bigint",new Cr.BigIntType],["BigInt",new Cr.BigIntType],["bool",new nq.BooleanType],["bytes",new iq.BytesType],["Address",new rq.AddressType],["H256",new aq.H256Type],["utf-8 string",new uq.StringType],["TokenIdentifier",new fT.TokenIdentifierType],["EgldOrEsdtTokenIdentifier",new fT.TokenIdentifierType],["CodeMetadata",new sq.CodeMetadataType],["nothing",new cT.NothingType],["AsyncCall",new cT.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 aT.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(Gm.EnumType.ClassName)?this.mapEnumType(e):e.hasExactClass(lT.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 lT.StructType(e.getName(),r)}mapEnumType(e){let r=e.variants.map(i=>new Gm.EnumVariantDefinition(i.name,i.discriminant,this.mappedFields(i.getFieldsDefinitions())));return new Gm.EnumType(e.getName(),r)}mappedFields(e){return e.map(r=>new oq.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 aT.ErrTypingSystem(`Cannot map the generic type "${e.getName()}" to a known type`);return i(...n)}};on.TypeMapper=km});var yT=m(an=>{"use strict";c();var cq=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]}),lq=an&&an.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fq=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)&&cq(e,t,r);return lq(e,t),e};Object.defineProperty(an,"__esModule",{value:!0});an.AbiRegistry=void 0;var hT=fq(Be()),Qm=wr(),sc=Tm(),dT=Du(),pT=Co(),hq=jm(),dq="?",Wm=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||dq,n=e.constructor||{},i=e.endpoints||[],s=e.types||{},o=sc.EndpointDefinition.fromJSON(Object.assign({name:"constructor"},n)),a=i.map(d=>sc.EndpointDefinition.fromJSON(d)),u=[];for(let d in s){let g=s[d];if(g.type=="struct")u.push(pT.StructType.fromJSON({name:d,fields:g.fields}));else if(g.type=="enum")u.push(dT.EnumType.fromJSON({name:d,variants:g.variants}));else throw new hT.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(pT.StructType.ClassName));return Qm.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(dT.EnumType.ClassName));return Qm.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 Qm.guardValueIsSetWithMessage(`endpoint [${e}] not found`,r),r}remapToKnownTypes(){let e=new hq.TypeMapper([]),r=[];for(let o of this.customTypes)this.mapCustomTypeDepthFirst(o,this.customTypes,e,r);if(this.customTypes.length!=r.length)throw new hT.ErrTypingSystem("Did not re-map all custom types");let n=gT(this.constructorDefinition,e),i=[];for(let o of this.endpoints)i.push(gT(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)}};an.AbiRegistry=Wm;function gT(t,e){let r=t.input.map(i=>new sc.EndpointParameterDefinition(i.name,i.description,e.mapType(i.type))),n=t.output.map(i=>new sc.EndpointParameterDefinition(i.name,i.description,e.mapType(i.type)));return new sc.EndpointDefinition(t.name,r,n,t.modifiers)}});var wT=m(jo=>{"use strict";c();Object.defineProperty(jo,"__esModule",{value:!0});jo.createListOfTokenIdentifiers=jo.createListOfAddresses=void 0;var pq=Do(),mT=Hu(),gq=Go();function yq(t){let e=t.map(n=>new pq.AddressValue(n));return mT.List.fromItems(e)}jo.createListOfAddresses=yq;function mq(t){let e=t.map(n=>new gq.TokenIdentifierValue(n));return mT.List.fromItems(e)}jo.createListOfTokenIdentifiers=mq});var PT=m(zt=>{"use strict";c();var wq=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]}),Eq=zt&&zt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vq=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)&&wq(e,t,r);return Eq(e,t),e};Object.defineProperty(zt,"__esModule",{value:!0});zt.onPrimitiveTypeSelect=zt.onPrimitiveValueSelect=zt.onTypedValueSelect=zt.onTypeSelect=void 0;var ch=vq(Be()),ET=Do(),vT=Mu(),AT=mi(),bT=Du(),uh=Hu(),_T=ku(),IT=tc(),ST=Hf(),TT=Co(),CT=Go(),xT=rh(),NT=It(),OT=Uf(),DT=Zf();function Aq(t,e){if(t.hasExactClass(uh.OptionType.ClassName))return e.onOption();if(t.hasExactClass(uh.ListType.ClassName))return e.onList();if(t.hasExactClass(OT.ArrayVecType.ClassName))return e.onArray();if(t.hasClassOrSuperclass(NT.PrimitiveType.ClassName))return e.onPrimitive();if(t.hasExactClass(TT.StructType.ClassName))return e.onStruct();if(t.hasExactClass(xT.TupleType.ClassName))return e.onTuple();if(t.hasExactClass(bT.EnumType.ClassName))return e.onEnum();if(e.onOther)return e.onOther();throw new ch.ErrTypingSystem(`type isn't known: ${t}`)}zt.onTypeSelect=Aq;function bq(t,e){if(t.hasClassOrSuperclass(NT.PrimitiveValue.ClassName))return e.onPrimitive();if(t.hasExactClass(uh.OptionValue.ClassName))return e.onOption();if(t.hasExactClass(uh.List.ClassName))return e.onList();if(t.hasExactClass(OT.ArrayVec.ClassName))return e.onArray();if(t.hasExactClass(TT.Struct.ClassName))return e.onStruct();if(t.hasExactClass(xT.Tuple.ClassName))return e.onTuple();if(t.hasExactClass(bT.EnumValue.ClassName))return e.onEnum();if(e.onOther)return e.onOther();throw new ch.ErrTypingSystem(`value isn't typed: ${t}`)}zt.onTypedValueSelect=bq;function _q(t,e){if(t.hasExactClass(vT.BooleanValue.ClassName))return e.onBoolean();if(t.hasClassOrSuperclass(IT.NumericalValue.ClassName))return e.onNumerical();if(t.hasExactClass(ET.AddressValue.ClassName))return e.onAddress();if(t.hasExactClass(AT.BytesValue.ClassName))return e.onBytes();if(t.hasExactClass(DT.StringValue.ClassName))return e.onString();if(t.hasExactClass(_T.H256Value.ClassName))return e.onH256();if(t.hasExactClass(CT.TokenIdentifierValue.ClassName))return e.onTypeIdentifier();if(t.hasExactClass(ST.NothingValue.ClassName))return e.onNothing();if(e.onOther)return e.onOther();throw new ch.ErrTypingSystem(`value isn't a primitive: ${t.getType()}`)}zt.onPrimitiveValueSelect=_q;function Iq(t,e){if(t.hasExactClass(vT.BooleanType.ClassName))return e.onBoolean();if(t.hasClassOrSuperclass(IT.NumericalType.ClassName))return e.onNumerical();if(t.hasExactClass(ET.AddressType.ClassName))return e.onAddress();if(t.hasExactClass(AT.BytesType.ClassName))return e.onBytes();if(t.hasExactClass(DT.StringType.ClassName))return e.onString();if(t.hasExactClass(_T.H256Type.ClassName))return e.onH256();if(t.hasExactClass(CT.TokenIdentifierType.ClassName))return e.onTokenIndetifier();if(t.hasExactClass(ST.NothingType.ClassName))return e.onNothing();if(e.onOther)return e.onOther();throw new ch.ErrTypingSystem(`type isn't a known primitive: ${t}`)}zt.onPrimitiveTypeSelect=Iq});var St=m(qe=>{"use strict";c();var Sq=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]}),it=qe&&qe.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Sq(e,t,r)};Object.defineProperty(qe,"__esModule",{value:!0});it(yT(),qe);it(Do(),qe);it(Cf(),qe);it(Mu(),qe);it(mi(),qe);it(Pf(),qe);it(Tm(),qe);it(Du(),qe);it(wT(),qe);it(So(),qe);it(Hu(),qe);it(Uf(),qe);it(ku(),qe);it(PT(),qe);it(Hf(),qe);it(tc(),qe);it(Zf(),qe);it(Co(),qe);it(Go(),qe);it(rh(),qe);it(hf(),qe);it(jm(),qe);it(It(),qe);it(sh(),qe)});var BT=m(un=>{"use strict";c();var Tq=un&&un.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Cq=un&&un.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xq=un&&un.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Tq(e,t,r);return Cq(e,t),e};Object.defineProperty(un,"__esModule",{value:!0});un.OptionValueBinaryCodec=void 0;var RT=xq(Be()),lh=St(),$m=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){if(e[0]==0)return[lh.OptionValue.newMissingTyped(r),1];if(e[0]!=1)throw new RT.ErrCodec("invalid buffer for optional value");let[n,i]=this.binaryCodec.decodeNested(e.slice(1),r);return[lh.OptionValue.newProvided(n),i+1]}decodeTopLevel(e,r){if(e.length==0)return new lh.OptionValue(r);if(e[0]!=1)throw new RT.ErrCodec("invalid buffer for optional value");let[n,i]=this.binaryCodec.decodeNested(e.slice(1),r);return new lh.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([])}};un.OptionValueBinaryCodec=$m});var LT=m(fh=>{"use strict";c();Object.defineProperty(fh,"__esModule",{value:!0});fh.AddressBinaryCodec=void 0;var Nq=ht(),Oq=St(),zm=class{decodeNested(e){let r=e.slice(0,32),n=new Nq.Address(r);return[new Oq.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()}};fh.AddressBinaryCodec=zm});var MT=m(cn=>{"use strict";c();var Dq=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]}),Pq=cn&&cn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Rq=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)&&Dq(e,t,r);return Pq(e,t),e};Object.defineProperty(cn,"__esModule",{value:!0});cn.BooleanBinaryCodec=void 0;var Bq=Rq(Be()),FT=St(),oc=class t{decodeNested(e){let r=e.readUInt8(0);return[new FT.BooleanValue(r==t.TRUE),1]}decodeTopLevel(e){if(e.length>1)throw new Bq.ErrInvalidArgument("buffer should be of size <= 1");let r=e[0];return new FT.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([])}};cn.BooleanBinaryCodec=oc;oc.TRUE=1;oc.FALSE=0});var dh=m(hh=>{"use strict";c();Object.defineProperty(hh,"__esModule",{value:!0});hh.SizeOfU32=void 0;hh.SizeOfU32=4});var ph=m(ln=>{"use strict";c();var Lq=ln&&ln.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ln,"__esModule",{value:!0});ln.zeroPadStringIfOddLength=ln.isPaddedHex=ln.numberToPaddedHex=void 0;var Fq=Lq(Gt());function Mq(t){let e=new Fq.default(t).toString(16);return UT(e)}ln.numberToPaddedHex=Mq;function Uq(t){t=t||"";let e=h.Buffer.from(t,"hex").toString("hex");return t.toUpperCase()==e.toUpperCase()}ln.isPaddedHex=Uq;function UT(t){return t=t||"",t.length%2==1?"0"+t:t}ln.zeroPadStringIfOddLength=UT});var ac=m(Tt=>{"use strict";c();var qq=Tt&&Tt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Tt,"__esModule",{value:!0});Tt.prependByteToBuffer=Tt.flipBufferBitsInPlace=Tt.getHexMagnitudeOfBigInt=Tt.bigIntToBuffer=Tt.bufferToBigInt=Tt.cloneBuffer=Tt.isMsbZero=Tt.isMsbOne=void 0;var Km=qq(Gt()),Vq=ph();function qT(t,e=0){return t[e]>>7==1}Tt.isMsbOne=qT;function Hq(t,e=0){return!qT(t,e)}Tt.isMsbZero=Hq;function Gq(t){let e=h.Buffer.alloc(t.length);return t.copy(e),e}Tt.cloneBuffer=Gq;function kq(t){let e=t.toString("hex");return new Km.default(`0x${e}`,16)}Tt.bufferToBigInt=kq;function jq(t){let e=VT(t);return h.Buffer.from(e,"hex")}Tt.bigIntToBuffer=jq;function VT(t){return t=new Km.default(t),t?(t.isNegative()&&(t=t.multipliedBy(new Km.default(-1))),Vq.numberToPaddedHex(t)):""}Tt.getHexMagnitudeOfBigInt=VT;function Qq(t){for(let e=0;e{"use strict";c();var $q=Qo&&Qo.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Qo,"__esModule",{value:!0});Qo.NumericalBinaryCodec=void 0;var uc=$q(Gt()),Ym=St(),HT=dh(),wt=ac(),Jm=class{decodeNested(e,r){let n=0,i=r.sizeInBytes;i||(n=HT.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=wt.cloneBuffer(e);if(e.length==0)return new Ym.NumericalValue(r,new uc.default(0));if(!r.withSign||wt.isMsbZero(n)){let l=wt.bufferToBigInt(n);return new Ym.NumericalValue(r,l)}wt.flipBufferBitsInPlace(n);let u=wt.bufferToBigInt(n).multipliedBy(new uc.default(-1)).minus(new uc.default(1));return new Ym.NumericalValue(r,u)}encodeNested(e){if(e.sizeInBytes)return this.encodeNestedFixedSize(e,e.sizeInBytes);let r=this.encodeTopLevel(e),n=h.Buffer.alloc(HT.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=wt.bigIntToBuffer(e.value),a=h.Buffer.alloc(r-o.length,0);return h.Buffer.concat([a,o])}if(e.value.isPositive()){let o=wt.bigIntToBuffer(e.value);wt.isMsbOne(o)&&(o=wt.prependByteToBuffer(o,0));let a=h.Buffer.alloc(r-o.length,0);return h.Buffer.concat([a,o])}let n=e.value.plus(new uc.default(1)),i=wt.bigIntToBuffer(n);wt.flipBufferBitsInPlace(i),wt.isMsbZero(i)&&(i=wt.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):wt.bigIntToBuffer(e.value)}encodePrimitive(e){if(e.value.isPositive()){let i=wt.bigIntToBuffer(e.value);return wt.isMsbOne(i)&&(i=wt.prependByteToBuffer(i,0)),i}let r=e.value.plus(new uc.default(1)),n=wt.bigIntToBuffer(r);return wt.flipBufferBitsInPlace(n),wt.isMsbZero(n)&&(n=wt.prependByteToBuffer(n,255)),n}};Qo.NumericalBinaryCodec=Jm});var kT=m(gh=>{"use strict";c();Object.defineProperty(gh,"__esModule",{value:!0});gh.H256BinaryCodec=void 0;var zq=ku(),Xm=class{decodeNested(e){let r=e.slice(0,32);return[new zq.H256Value(r),32]}decodeTopLevel(e){let[r,n]=this.decodeNested(e);return r}encodeNested(e){return e.valueOf()}encodeTopLevel(e){return e.valueOf()}};gh.H256BinaryCodec=Xm});var wh=m(mh=>{"use strict";c();Object.defineProperty(mh,"__esModule",{value:!0});mh.BytesBinaryCodec=void 0;var jT=mi(),yh=dh(),Zm=class{decodeNested(e){let r=e.readUInt32BE(0),n=e.slice(yh.SizeOfU32,yh.SizeOfU32+r);return[new jT.BytesValue(n),yh.SizeOfU32+r]}decodeTopLevel(e){return new jT.BytesValue(e)}encodeNested(e){let r=h.Buffer.alloc(yh.SizeOfU32);return r.writeUInt32BE(e.getLength()),h.Buffer.concat([r,e.valueOf()])}encodeTopLevel(e){return e.valueOf()}};mh.BytesBinaryCodec=Zm});var WT=m(Eh=>{"use strict";c();Object.defineProperty(Eh,"__esModule",{value:!0});Eh.TokenIdentifierCodec=void 0;var Kq=mi(),QT=Go(),Yq=wh(),ew=class{constructor(){this.bytesCodec=new Yq.BytesBinaryCodec}decodeNested(e){let[r,n]=this.bytesCodec.decodeNested(e);return[new QT.TokenIdentifierValue(r.toString()),n]}decodeTopLevel(e){let r=this.bytesCodec.decodeTopLevel(e);return new QT.TokenIdentifierValue(r.toString())}encodeNested(e){let r=Kq.BytesValue.fromUTF8(e.valueOf());return this.bytesCodec.encodeNested(r)}encodeTopLevel(e){return h.Buffer.from(e.valueOf())}};Eh.TokenIdentifierCodec=ew});var zT=m(vh=>{"use strict";c();Object.defineProperty(vh,"__esModule",{value:!0});vh.NothingCodec=void 0;var $T=St(),tw=class{decodeNested(){return[new $T.NothingValue,0]}decodeTopLevel(){return new $T.NothingValue}encodeNested(){return h.Buffer.from([])}encodeTopLevel(){return h.Buffer.from([])}};vh.NothingCodec=tw});var YT=m(Ah=>{"use strict";c();Object.defineProperty(Ah,"__esModule",{value:!0});Ah.StringBinaryCodec=void 0;var KT=St(),Jq=mi(),Xq=wh(),rw=class{constructor(){this.bytesBinaryCodec=new Xq.BytesBinaryCodec}decodeNested(e){let[r,n]=this.bytesBinaryCodec.decodeNested(e);return[new KT.StringValue(r.valueOf().toString()),n]}decodeTopLevel(e){return new KT.StringValue(e.toString())}encodeNested(e){let r=Jq.BytesValue.fromUTF8(e.valueOf());return this.bytesBinaryCodec.encodeNested(r)}encodeTopLevel(e){return h.Buffer.from(e.valueOf())}};Ah.StringBinaryCodec=rw});var JT=m(_h=>{"use strict";c();Object.defineProperty(_h,"__esModule",{value:!0});_h.PrimitiveBinaryCodec=void 0;var bh=St(),Zq=LT(),eV=MT(),tV=GT(),rV=kT(),nV=wh(),iV=WT(),sV=zT(),oV=YT(),nw=class{constructor(e){this.binaryCodec=e,this.booleanCodec=new eV.BooleanBinaryCodec,this.numericalCodec=new tV.NumericalBinaryCodec,this.addressCodec=new Zq.AddressBinaryCodec,this.h256Codec=new rV.H256BinaryCodec,this.bytesCodec=new nV.BytesBinaryCodec,this.stringCodec=new oV.StringBinaryCodec,this.tokenIdentifierCodec=new iV.TokenIdentifierCodec,this.nothingCodec=new sV.NothingCodec}decodeNested(e,r){return bh.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 bh.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 bh.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 bh.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()})}};_h.PrimitiveBinaryCodec=nw});var eC=m(Ih=>{"use strict";c();Object.defineProperty(Ih,"__esModule",{value:!0});Ih.ListBinaryCodec=void 0;var XT=St(),ZT=dh(),iw=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=ZT.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 XT.List(r,i)}encodeNested(e){this.binaryCodec.constraints.checkListLength(e.getLength());let r=h.Buffer.alloc(ZT.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)}};Ih.ListBinaryCodec=iw});var ow=m(Sh=>{"use strict";c();Object.defineProperty(Sh,"__esModule",{value:!0});Sh.FieldsBinaryCodec=void 0;var aV=St(),sw=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){let n=[],i=0;for(let s of r){let[o,a]=this.binaryCodec.decodeNested(e,s.type);e=e.slice(a),i+=a;let u=new aV.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)}};Sh.FieldsBinaryCodec=sw});var uw=m(Th=>{"use strict";c();Object.defineProperty(Th,"__esModule",{value:!0});Th.StructBinaryCodec=void 0;var uV=St(),cV=ow(),aw=class{constructor(e){this.fieldsCodec=new cV.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 uV.Struct(r,i),s]}encodeNested(e){let r=e.getFields();return this.fieldsCodec.encodeNested(r)}encodeTopLevel(e){return this.encodeNested(e)}};Th.StructBinaryCodec=aw});var tC=m(xh=>{"use strict";c();Object.defineProperty(xh,"__esModule",{value:!0});xh.EnumBinaryCodec=void 0;var Ch=St(),lV=ow(),cw=class{constructor(e){this.binaryCodec=e,this.fieldsCodec=new lV.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 Ch.EnumValue(r,s,a),i+u]}readDiscriminant(e){let[r,n]=this.binaryCodec.decodeNested(e,new Ch.U8Type);return[r.valueOf(),n]}encodeNested(e){let r=new Ch.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 Ch.U8Value(e.discriminant),o=n?this.binaryCodec.encodeNested(s):this.binaryCodec.encodeTopLevel(s);return h.Buffer.concat([o,i])}};xh.EnumBinaryCodec=cw});var rC=m(Nh=>{"use strict";c();Object.defineProperty(Nh,"__esModule",{value:!0});Nh.TupleBinaryCodec=void 0;var fV=uw(),lw=class{constructor(e){this.structCodec=new fV.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)}};Nh.TupleBinaryCodec=lw});var nC=m(Oh=>{"use strict";c();Object.defineProperty(Oh,"__esModule",{value:!0});Oh.ArrayVecBinaryCodec=void 0;var hV=St(),fw=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 dV=xr&&xr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),pV=xr&&xr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gV=xr&&xr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&dV(e,t,r);return pV(e,t),e};Object.defineProperty(xr,"__esModule",{value:!0});xr.BinaryCodecConstraints=xr.BinaryCodec=void 0;var iC=gV(Be()),Dh=St(),sC=wr(),yV=BT(),mV=JT(),wV=eC(),EV=uw(),vV=tC(),AV=rC(),bV=nC(),hw=class{constructor(e=null){this.constraints=e||new Ph,this.optionCodec=new yV.OptionValueBinaryCodec(this),this.listCodec=new wV.ListBinaryCodec(this),this.arrayCodec=new bV.ArrayVecBinaryCodec(this),this.primitiveCodec=new mV.PrimitiveBinaryCodec(this),this.structCodec=new EV.StructBinaryCodec(this),this.tupleCodec=new AV.TupleBinaryCodec(this),this.enumCodec=new vV.EnumBinaryCodec(this)}decodeTopLevel(e,r){return this.constraints.checkBufferLength(e),Dh.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]=Dh.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 sC.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),Dh.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 sC.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),Dh.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)})}};xr.BinaryCodec=hw;var Ph=class{constructor(e){this.maxBufferLength=e?.maxBufferLength||256e3,this.maxListLength=e?.maxListLength||128e3}checkBufferLength(e){if(e.length>this.maxBufferLength)throw new iC.ErrCodec(`Buffer too large: ${e.length} > ${this.maxBufferLength}`)}checkListLength(e){if(e>this.maxListLength)throw new iC.ErrCodec(`List too large: ${e} > ${this.maxListLength}`)}};xr.BinaryCodecConstraints=Ph});var oC=m(Nr=>{"use strict";c();var _V=Nr&&Nr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Nr,"__esModule",{value:!0});Nr.decodeBigNumber=Nr.decodeString=Nr.decodeBool=Nr.decodeUnsignedNumber=void 0;var IV=_V(Gt()),Rh=St(),SV=dw(),Bh=new SV.BinaryCodec;function TV(t){let e=Bh.decodeTopLevel(t,new Rh.BigUIntType);return Number(e.valueOf())}Nr.decodeUnsignedNumber=TV;function CV(t){return!!Bh.decodeTopLevel(t,new Rh.BooleanType).valueOf()}Nr.decodeBool=CV;function xV(t){let e=Bh.decodeTopLevel(t,new Rh.BytesType);return String(e.valueOf())}Nr.decodeString=xV;function NV(t){let e=Bh.decodeTopLevel(t,new Rh.BigUIntType);return new IV.default(e.valueOf())}Nr.decodeBigNumber=NV});var pw=m(vi=>{"use strict";c();var OV=vi&&vi.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),aC=vi&&vi.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&OV(e,t,r)};Object.defineProperty(vi,"__esModule",{value:!0});aC(dw(),vi);aC(oC(),vi)});var Wo=m(Lh=>{"use strict";c();Object.defineProperty(Lh,"__esModule",{value:!0});Lh.ArgSerializer=void 0;var uC=bs(),DV=pw(),cC=St(),gw=Cf(),yw=Pf(),mw=sh(),PV={codec:new DV.BinaryCodec},ww=class{constructor(e){e=Object.assign(Object.assign({},PV),e),this.codec=e.codec}stringToValues(e,r){let n=this.stringToBuffers(e);return this.buffersToValues(n,r)}stringToBuffers(e){return e.split(uC.ARGUMENTS_SEPARATOR).map(r=>h.Buffer.from(r,"hex"))}buffersToValues(e,r){let n=this;e=e||[];let i=[],s=0,o=e.length;for(let d=0;d=o}return i}valuesToString(e){let r=this.valuesToStrings(e),n=r.join(uC.ARGUMENTS_SEPARATOR),i=r.length;return{argumentsString:n,count:i}}valuesToStrings(e){return this.valuesToBuffers(e).map(i=>i.toString("hex"))}valuesToBuffers(e){let r=this,n=[];for(let o of e)i(o);function i(o){if(o.hasExactClass(gw.OptionalValue.ClassName)){let u=o;u.isSet()&&i(u.getTypedValue());return}if(o.hasExactClass(mw.VariadicValue.ClassName)){s(o);return}if(o.hasExactClass(yw.CompositeValue.ClassName)){let u=o;for(let l of u.getItems())i(l);return}let a=r.codec.encodeTopLevel(o);n.push(a)}function s(o){if(o.getType().isCounted){let u=new cC.U32Value(o.getItems().length);n.push(r.codec.encodeTopLevel(u))}for(let u of o.getItems())i(u)}return n}};Lh.ArgSerializer=ww});var Uh=m(Mh=>{"use strict";c();Object.defineProperty(Mh,"__esModule",{value:!0});Mh.Compatibility=void 0;var RV=ht(),Fh=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()==RV.Address.Zero().bech32()&&console.warn(`${r}: address should not be the 'zero' address (also known as the 'contracts deployment address'); ${n}. In the future, this will throw an exception instead of emitting a WARN.`))}};Mh.Compatibility=Fh;Fh.areWarningsEnabled=!0});var lC=m(fn=>{"use strict";c();var BV=fn&&fn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),LV=fn&&fn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FV=fn&&fn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&BV(e,t,r);return LV(e,t),e};Object.defineProperty(fn,"__esModule",{value:!0});fn.Hash=void 0;var MV=FV(Be()),Ew=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 MV.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}};fn.Hash=Ew});var cc=m(Or=>{"use strict";c();var UV=Or&&Or.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qV=Or&&Or.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VV=Or&&Or.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&UV(e,t,r);return qV(e,t),e};Object.defineProperty(Or,"__esModule",{value:!0});Or.TransactionOptions=Or.TransactionVersion=void 0;var jr=bs(),fC=VV(Be()),vw=class t{constructor(e){if(e=Number(e),e<1)throw new fC.ErrTransactionVersionInvalid(e);this.value=e}static withDefaultVersion(){return new t(jr.TRANSACTION_VERSION_DEFAULT)}static withTxOptions(){return new t(jr.TRANSACTION_VERSION_WITH_OPTIONS)}valueOf(){return this.value}};Or.TransactionVersion=vw;var Aw=class t{constructor(e){if(e=Number(e),e<0)throw new fC.ErrTransactionOptionsInvalid(e);this.value=e}static withDefaultOptions(){return new t(jr.TRANSACTION_OPTIONS_DEFAULT)}static withOptions(e){let r=0;return e.hashSign&&(r|=jr.TRANSACTION_OPTIONS_TX_HASH_SIGN),e.guarded&&(r|=jr.TRANSACTION_OPTIONS_TX_GUARDED),new t(r)}isWithHashSign(){return(this.value&jr.TRANSACTION_OPTIONS_TX_HASH_SIGN)==jr.TRANSACTION_OPTIONS_TX_HASH_SIGN}isWithGuardian(){return(this.value&jr.TRANSACTION_OPTIONS_TX_GUARDED)==jr.TRANSACTION_OPTIONS_TX_GUARDED}setWithHashSign(){this.value|=jr.TRANSACTION_OPTIONS_TX_HASH_SIGN}setWithGuardian(){this.value|=jr.TRANSACTION_OPTIONS_TX_GUARDED}valueOf(){return this.value}};Or.TransactionOptions=Aw});var dC=m((Woe,hC)=>{"use strict";c();hC.exports=HV;function HV(t,e){for(var r=new Array(arguments.length-1),n=0,i=2,s=!0;i{"use strict";c();var qh=yC;qh.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 $o=new Array(64),gC=new Array(123);for(Qr=0;Qr<64;)gC[$o[Qr]=Qr<26?Qr+65:Qr<52?Qr+71:Qr<62?Qr-4:Qr-59|43]=Qr++;var Qr;qh.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++]=$o[u|l>>4],u=(l&15)<<2,a=2;break;case 2:s[o++]=$o[u|l>>6],s[o++]=$o[l&63],a=0;break}o>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,s)),o=0)}return a&&(s[o++]=$o[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 pC="invalid encoding";qh.decode=function(e,r,n){for(var i=n,s=0,o,a=0;a1)break;if((u=gC[u])===void 0)throw Error(pC);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(pC);return n-i};qh.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var EC=m((Yoe,wC)=>{"use strict";c();wC.exports=Vh;function Vh(){this._listeners={}}Vh.prototype.on=function(e,r,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:r,ctx:n||this}),this};Vh.prototype.off=function(e,r){if(e===void 0)this._listeners={};else if(r===void 0)this._listeners[e]=[];else for(var n=this._listeners[e],i=0;i{"use strict";c();SC.exports=vC(vC);function vC(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,AC),t.writeFloatBE=e.bind(null,bC);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,_C),t.readFloatBE=r.bind(null,IC)}(),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,AC,0,4),t.writeDoubleBE=e.bind(null,bC,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,_C,0,4),t.readDoubleBE=r.bind(null,IC,4,0)}(),t}function AC(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 bC(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 _C(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0}function IC(t,e){return(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}});var CC=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 NC=m(xC=>{"use strict";c();var bw=xC;bw.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))};bw.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 DC=m((nae,OC)=>{"use strict";c();OC.exports=GV;function GV(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 RC=m((sae,PC)=>{"use strict";c();PC.exports=Bt;var lc=bi();function Bt(t,e){this.lo=t>>>0,this.hi=e>>>0}var xs=Bt.zero=new Bt(0,0);xs.toNumber=function(){return 0};xs.zzEncode=xs.zzDecode=function(){return this};xs.length=function(){return 1};var kV=Bt.zeroHash="\0\0\0\0\0\0\0\0";Bt.fromNumber=function(e){if(e===0)return xs;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(lc.isString(e))if(lc.Long)e=lc.Long.fromString(e);else return Bt.fromNumber(parseInt(e,10));return e.low||e.high?new Bt(e.low>>>0,e.high>>>0):xs};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 lc.Long?new lc.Long(this.lo|0,this.hi|0,!!e):{low:this.lo|0,high:this.hi|0,unsigned:!!e}};var Ai=String.prototype.charCodeAt;Bt.fromHash=function(e){return e===kV?xs:new Bt((Ai.call(e,0)|Ai.call(e,1)<<8|Ai.call(e,2)<<16|Ai.call(e,3)<<24)>>>0,(Ai.call(e,4)|Ai.call(e,5)<<8|Ai.call(e,6)<<16|Ai.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 bi=m(_w=>{"use strict";c();var Ee=_w;Ee.asPromise=dC();Ee.base64=mC();Ee.EventEmitter=EC();Ee.float=TC();Ee.inquire=CC();Ee.utf8=NC();Ee.pool=DC();Ee.LongBits=RC();Ee.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);Ee.global=Ee.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||_w;Ee.emptyArray=Object.freeze?Object.freeze([]):[];Ee.emptyObject=Object.freeze?Object.freeze({}):{};Ee.isInteger=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};Ee.isString=function(e){return typeof e=="string"||e instanceof String};Ee.isObject=function(e){return e&&typeof e=="object"};Ee.isset=Ee.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};Ee.Buffer=function(){try{var t=Ee.inquire("buffer").Buffer;return t.prototype.utf8Write?t:null}catch{return null}}();Ee._Buffer_from=null;Ee._Buffer_allocUnsafe=null;Ee.newBuffer=function(e){return typeof e=="number"?Ee.Buffer?Ee._Buffer_allocUnsafe(e):new Ee.Array(e):Ee.Buffer?Ee._Buffer_from(e):typeof Uint8Array>"u"?e:new Uint8Array(e)};Ee.Array=typeof Uint8Array<"u"?Uint8Array:Array;Ee.Long=Ee.global.dcodeIO&&Ee.global.dcodeIO.Long||Ee.global.Long||Ee.inquire("long");Ee.key2Re=/^true|false|0|1$/;Ee.key32Re=/^-?(?:0|[1-9][0-9]*)$/;Ee.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;Ee.longToHash=function(e){return e?Ee.LongBits.from(e).toHash():Ee.LongBits.zeroHash};Ee.longFromHash=function(e,r){var n=Ee.LongBits.fromHash(e);return Ee.Long?Ee.Long.fromBits(n.lo,n.hi,r):n.toNumber(!!r)};function BC(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]}};Ee.oneOfSetter=function(e){return function(r){for(var n=0;n{"use strict";c();qC.exports=Fe;var Dr=bi(),Iw,Hh=Dr.LongBits,FC=Dr.base64,MC=Dr.utf8;function fc(t,e,r){this.fn=t,this.len=e,this.next=void 0,this.val=r}function Tw(){}function jV(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 fc(Tw,0,0),this.tail=this.head,this.states=null}var UC=function(){return Dr.Buffer?function(){return(Fe.create=function(){return new Iw})()}:function(){return new Fe}};Fe.create=UC();Fe.alloc=function(e){return new Dr.Array(e)};Dr.Array!==Array&&(Fe.alloc=Dr.pool(Fe.alloc,Dr.Array.prototype.subarray));Fe.prototype._push=function(e,r,n){return this.tail=this.tail.next=new fc(e,r,n),this.len+=r,this};function Cw(t,e,r){e[r]=t&255}function QV(t,e,r){for(;t>127;)e[r++]=t&127|128,t>>>=7;e[r]=t}function xw(t,e){this.len=t,this.next=void 0,this.val=e}xw.prototype=Object.create(fc.prototype);xw.prototype.fn=QV;Fe.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new xw((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(Nw,10,Hh.fromNumber(e)):this.uint32(e)};Fe.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function Nw(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=Hh.from(e);return this._push(Nw,r.length(),r)};Fe.prototype.int64=Fe.prototype.uint64;Fe.prototype.sint64=function(e){var r=Hh.from(e).zzEncode();return this._push(Nw,r.length(),r)};Fe.prototype.bool=function(e){return this._push(Cw,1,e?1:0)};function Sw(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(Sw,4,e>>>0)};Fe.prototype.sfixed32=Fe.prototype.fixed32;Fe.prototype.fixed64=function(e){var r=Hh.from(e);return this._push(Sw,4,r.lo)._push(Sw,4,r.hi)};Fe.prototype.sfixed64=Fe.prototype.fixed64;Fe.prototype.float=function(e){return this._push(Dr.float.writeFloatLE,4,e)};Fe.prototype.double=function(e){return this._push(Dr.float.writeDoubleLE,8,e)};var WV=Dr.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(Cw,1,0);if(Dr.isString(e)){var n=Fe.alloc(r=FC.length(e));FC.decode(e,n,0),e=n}return this.uint32(r)._push(WV,r,e)};Fe.prototype.string=function(e){var r=MC.length(e);return r?this.uint32(r)._push(MC.write,r,e):this._push(Cw,1,0)};Fe.prototype.fork=function(){return this.states=new jV(this),this.head=this.tail=new fc(Tw,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 fc(Tw,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){Iw=t,Fe.create=UC(),Iw._configure()}});var GC=m((fae,HC)=>{"use strict";c();HC.exports=hn;var VC=Ow();(hn.prototype=Object.create(VC.prototype)).constructor=hn;var _i=bi();function hn(){VC.call(this)}hn._configure=function(){hn.alloc=_i._Buffer_allocUnsafe,hn.writeBytesBuffer=_i.Buffer&&_i.Buffer.prototype instanceof Uint8Array&&_i.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(hn.writeBytesBuffer,r,e),this};function $V(t,e,r){t.length<40?_i.utf8.write(t,e,r):e.utf8Write?e.utf8Write(t,r):e.write(t,r)}hn.prototype.string=function(e){var r=_i.Buffer.byteLength(e);return this.uint32(r),r&&this._push($V,r,e),this};hn._configure()});var Rw=m((dae,$C)=>{"use strict";c();$C.exports=Et;var dn=bi(),Pw,QC=dn.LongBits,zV=dn.utf8;function Wr(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 kC=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")},WC=function(){return dn.Buffer?function(r){return(Et.create=function(i){return dn.Buffer.isBuffer(i)?new Pw(i):kC(i)})(r)}:kC};Et.create=WC();Et.prototype._slice=dn.Array.prototype.subarray||dn.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,Wr(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 Dw(){var t=new QC(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 Wr(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 Wr(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 Gh(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 Wr(this,4);return Gh(this.buf,this.pos+=4)};Et.prototype.sfixed32=function(){if(this.pos+4>this.len)throw Wr(this,4);return Gh(this.buf,this.pos+=4)|0};function jC(){if(this.pos+8>this.len)throw Wr(this,8);return new QC(Gh(this.buf,this.pos+=4),Gh(this.buf,this.pos+=4))}Et.prototype.float=function(){if(this.pos+4>this.len)throw Wr(this,4);var e=dn.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};Et.prototype.double=function(){if(this.pos+8>this.len)throw Wr(this,4);var e=dn.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 Wr(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 zV.read(e,0,e.length)};Et.prototype.skip=function(e){if(typeof e=="number"){if(this.pos+e>this.len)throw Wr(this,e);this.pos+=e}else do if(this.pos>=this.len)throw Wr(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){Pw=t,Et.create=WC(),Pw._configure();var e=dn.Long?"toLong":"toNumber";dn.merge(Et.prototype,{int64:function(){return Dw.call(this)[e](!1)},uint64:function(){return Dw.call(this)[e](!0)},sint64:function(){return Dw.call(this).zzDecode()[e](!1)},fixed64:function(){return jC.call(this)[e](!0)},sfixed64:function(){return jC.call(this)[e](!1)}})}});var JC=m((gae,YC)=>{"use strict";c();YC.exports=Ns;var KC=Rw();(Ns.prototype=Object.create(KC.prototype)).constructor=Ns;var zC=bi();function Ns(t){KC.call(this,t)}Ns._configure=function(){zC.Buffer&&(Ns.prototype._slice=zC.Buffer.prototype.slice)};Ns.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))};Ns._configure()});var ZC=m((mae,XC)=>{"use strict";c();XC.exports=hc;var Bw=bi();(hc.prototype=Object.create(Bw.EventEmitter.prototype)).constructor=hc;function hc(t,e,r){if(typeof t!="function")throw TypeError("rpcImpl must be a function");Bw.EventEmitter.call(this),this.rpcImpl=t,this.requestDelimited=!!e,this.responseDelimited=!!r}hc.prototype.rpcCall=function t(e,r,n,i,s){if(!i)throw TypeError("request must be specified");var o=this;if(!s)return Bw.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}};hc.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var tx=m(ex=>{"use strict";c();var KV=ex;KV.Service=ZC()});var nx=m((Aae,rx)=>{"use strict";c();rx.exports={}});var ox=m(sx=>{"use strict";c();var lr=sx;lr.build="minimal";lr.Writer=Ow();lr.BufferWriter=GC();lr.Reader=Rw();lr.BufferReader=JC();lr.util=bi();lr.rpc=tx();lr.roots=nx();lr.configure=ix;function ix(){lr.util._configure(),lr.Writer._configure(lr.BufferWriter),lr.Reader._configure(lr.BufferReader)}ix()});var ux=m((Sae,ax)=>{"use strict";c();ax.exports=ox()});var lx=m((Cae,cx)=>{"use strict";c();var zo=ux(),kh=zo.Reader,YV=zo.Writer,X=zo.util,dc=zo.roots.default||(zo.roots.default={});dc.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 kh||(n=new kh(n)),this.decode(n,n.uint32())},e.verify=function(n){return typeof n!="object"||n===null?"object expected":n.Nonce!=null&&n.hasOwnProperty("Nonce")&&!X.isInteger(n.Nonce)&&!(n.Nonce&&X.isInteger(n.Nonce.low)&&X.isInteger(n.Nonce.high))?"Nonce: integer|Long expected":n.Value!=null&&n.hasOwnProperty("Value")&&!(n.Value&&typeof n.Value.length=="number"||X.isString(n.Value))?"Value: buffer expected":n.RcvAddr!=null&&n.hasOwnProperty("RcvAddr")&&!(n.RcvAddr&&typeof n.RcvAddr.length=="number"||X.isString(n.RcvAddr))?"RcvAddr: buffer expected":n.RcvUserName!=null&&n.hasOwnProperty("RcvUserName")&&!(n.RcvUserName&&typeof n.RcvUserName.length=="number"||X.isString(n.RcvUserName))?"RcvUserName: buffer expected":n.SndAddr!=null&&n.hasOwnProperty("SndAddr")&&!(n.SndAddr&&typeof n.SndAddr.length=="number"||X.isString(n.SndAddr))?"SndAddr: buffer expected":n.SndUserName!=null&&n.hasOwnProperty("SndUserName")&&!(n.SndUserName&&typeof n.SndUserName.length=="number"||X.isString(n.SndUserName))?"SndUserName: buffer expected":n.GasPrice!=null&&n.hasOwnProperty("GasPrice")&&!X.isInteger(n.GasPrice)&&!(n.GasPrice&&X.isInteger(n.GasPrice.low)&&X.isInteger(n.GasPrice.high))?"GasPrice: integer|Long expected":n.GasLimit!=null&&n.hasOwnProperty("GasLimit")&&!X.isInteger(n.GasLimit)&&!(n.GasLimit&&X.isInteger(n.GasLimit.low)&&X.isInteger(n.GasLimit.high))?"GasLimit: integer|Long expected":n.Data!=null&&n.hasOwnProperty("Data")&&!(n.Data&&typeof n.Data.length=="number"||X.isString(n.Data))?"Data: buffer expected":n.ChainID!=null&&n.hasOwnProperty("ChainID")&&!(n.ChainID&&typeof n.ChainID.length=="number"||X.isString(n.ChainID))?"ChainID: buffer expected":n.Version!=null&&n.hasOwnProperty("Version")&&!X.isInteger(n.Version)?"Version: integer expected":n.Signature!=null&&n.hasOwnProperty("Signature")&&!(n.Signature&&typeof n.Signature.length=="number"||X.isString(n.Signature))?"Signature: buffer expected":n.Options!=null&&n.hasOwnProperty("Options")&&!X.isInteger(n.Options)?"Options: integer expected":n.GuardAddr!=null&&n.hasOwnProperty("GuardAddr")&&!(n.GuardAddr&&typeof n.GuardAddr.length=="number"||X.isString(n.GuardAddr))?"GuardAddr: buffer expected":n.GuardSignature!=null&&n.hasOwnProperty("GuardSignature")&&!(n.GuardSignature&&typeof n.GuardSignature.length=="number"||X.isString(n.GuardSignature))?"GuardSignature: buffer expected":null},e.fromObject=function(n){if(n instanceof dc.proto.Transaction)return n;var i=new dc.proto.Transaction;return n.Nonce!=null&&(X.Long?(i.Nonce=X.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 X.LongBits(n.Nonce.low>>>0,n.Nonce.high>>>0).toNumber(!0))),n.Value!=null&&(typeof n.Value=="string"?X.base64.decode(n.Value,i.Value=X.newBuffer(X.base64.length(n.Value)),0):n.Value.length&&(i.Value=n.Value)),n.RcvAddr!=null&&(typeof n.RcvAddr=="string"?X.base64.decode(n.RcvAddr,i.RcvAddr=X.newBuffer(X.base64.length(n.RcvAddr)),0):n.RcvAddr.length&&(i.RcvAddr=n.RcvAddr)),n.RcvUserName!=null&&(typeof n.RcvUserName=="string"?X.base64.decode(n.RcvUserName,i.RcvUserName=X.newBuffer(X.base64.length(n.RcvUserName)),0):n.RcvUserName.length&&(i.RcvUserName=n.RcvUserName)),n.SndAddr!=null&&(typeof n.SndAddr=="string"?X.base64.decode(n.SndAddr,i.SndAddr=X.newBuffer(X.base64.length(n.SndAddr)),0):n.SndAddr.length&&(i.SndAddr=n.SndAddr)),n.SndUserName!=null&&(typeof n.SndUserName=="string"?X.base64.decode(n.SndUserName,i.SndUserName=X.newBuffer(X.base64.length(n.SndUserName)),0):n.SndUserName.length&&(i.SndUserName=n.SndUserName)),n.GasPrice!=null&&(X.Long?(i.GasPrice=X.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 X.LongBits(n.GasPrice.low>>>0,n.GasPrice.high>>>0).toNumber(!0))),n.GasLimit!=null&&(X.Long?(i.GasLimit=X.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 X.LongBits(n.GasLimit.low>>>0,n.GasLimit.high>>>0).toNumber(!0))),n.Data!=null&&(typeof n.Data=="string"?X.base64.decode(n.Data,i.Data=X.newBuffer(X.base64.length(n.Data)),0):n.Data.length&&(i.Data=n.Data)),n.ChainID!=null&&(typeof n.ChainID=="string"?X.base64.decode(n.ChainID,i.ChainID=X.newBuffer(X.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"?X.base64.decode(n.Signature,i.Signature=X.newBuffer(X.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"?X.base64.decode(n.GuardAddr,i.GuardAddr=X.newBuffer(X.base64.length(n.GuardAddr)),0):n.GuardAddr.length&&(i.GuardAddr=n.GuardAddr)),n.GuardSignature!=null&&(typeof n.GuardSignature=="string"?X.base64.decode(n.GuardSignature,i.GuardSignature=X.newBuffer(X.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(X.Long){var o=new X.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=X.newBuffer(s.Value))),i.bytes===String?s.RcvAddr="":(s.RcvAddr=[],i.bytes!==Array&&(s.RcvAddr=X.newBuffer(s.RcvAddr))),i.bytes===String?s.RcvUserName="":(s.RcvUserName=[],i.bytes!==Array&&(s.RcvUserName=X.newBuffer(s.RcvUserName))),i.bytes===String?s.SndAddr="":(s.SndAddr=[],i.bytes!==Array&&(s.SndAddr=X.newBuffer(s.SndAddr))),i.bytes===String?s.SndUserName="":(s.SndUserName=[],i.bytes!==Array&&(s.SndUserName=X.newBuffer(s.SndUserName))),X.Long){var o=new X.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(X.Long){var o=new X.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=X.newBuffer(s.Data))),i.bytes===String?s.ChainID="":(s.ChainID=[],i.bytes!==Array&&(s.ChainID=X.newBuffer(s.ChainID))),s.Version=0,i.bytes===String?s.Signature="":(s.Signature=[],i.bytes!==Array&&(s.Signature=X.newBuffer(s.Signature))),s.Options=0,i.bytes===String?s.GuardAddr="":(s.GuardAddr=[],i.bytes!==Array&&(s.GuardAddr=X.newBuffer(s.GuardAddr))),i.bytes===String?s.GuardSignature="":(s.GuardSignature=[],i.bytes!==Array&&(s.GuardSignature=X.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?X.Long.prototype.toString.call(n.Nonce):i.longs===Number?new X.LongBits(n.Nonce.low>>>0,n.Nonce.high>>>0).toNumber(!0):n.Nonce),n.Value!=null&&n.hasOwnProperty("Value")&&(s.Value=i.bytes===String?X.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?X.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?X.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?X.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?X.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?X.Long.prototype.toString.call(n.GasPrice):i.longs===Number?new X.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?X.Long.prototype.toString.call(n.GasLimit):i.longs===Number?new X.LongBits(n.GasLimit.low>>>0,n.GasLimit.high>>>0).toNumber(!0):n.GasLimit),n.Data!=null&&n.hasOwnProperty("Data")&&(s.Data=i.bytes===String?X.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?X.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?X.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?X.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?X.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,zo.util.toJSONOptions)},e}(),t}();cx.exports=dc});var fx=m(Pr=>{"use strict";c();var JV=Pr&&Pr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),XV=Pr&&Pr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZV=Pr&&Pr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&JV(e,t,r);return XV(e,t),e},eH=Pr&&Pr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Pr,"__esModule",{value:!0});Pr.ProtoSerializer=void 0;var tH=eH(Gt()),Lw=ht(),rH=bs(),nH=ZV(Be()),iH=ac(),Fw=class{serializeTransaction(e){let r=lx().proto,n=new Lw.Address(e.getReceiver().bech32()).pubkey(),i=new Lw.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()!==rH.TRANSACTION_OPTIONS_DEFAULT&&(s.Options=e.getOptions().valueOf()),e.isGuardedTransaction()){let u=e.getGuardian();s.GuardAddr=new Lw.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 tH.default(e.toString());if(r.isZero())return h.Buffer.from([0,0]);let n=iH.bigIntToBuffer(r);return n=h.Buffer.concat([h.Buffer.from([0]),n]),n}deserializeTransaction(e){throw new nH.ErrUnsupportedOperation("deserializeTransaction")}};Pr.ProtoSerializer=Fw});var hx=m(Os=>{"use strict";c();var sH=Os&&Os.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),oH=Os&&Os.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&sH(e,t,r)};Object.defineProperty(Os,"__esModule",{value:!0});oH(fx(),Os)});var jh=m(pn=>{"use strict";c();var aH=pn&&pn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),uH=pn&&pn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cH=pn&&pn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&aH(e,t,r);return uH(e,t),e};Object.defineProperty(pn,"__esModule",{value:!0});pn.Signature=void 0;var dx=cH(Be()),px=64,Mw=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 dx.ErrSignatureCannotCreate(e);return t.fromValidHex(e)}static isValidHex(e){return h.Buffer.from(e,"hex").length==px}static fromValidHex(e){let r=new t;return r.valueHex=e,r}static fromBuffer(e){if(e.length!=px)throw new dx.ErrSignatureCannotCreate(e);return t.fromValidHex(e.toString("hex"))}hex(){return this.valueHex}};pn.Signature=Mw});var jn=m(Qh=>{"use strict";c();Object.defineProperty(Qh,"__esModule",{value:!0});Qh.TransactionPayload=void 0;var Uw=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}};Qh.TransactionPayload=Uw});var qw=m((Mae,gx)=>{c();Qn.notEqual=fH;Qn.notOk=hH;Qn.equal=lH;Qn.ok=Qn;gx.exports=Qn;function lH(t,e,r){Qn(t==e,r)}function fH(t,e,r){Qn(t!=e,r)}function hH(t,e){Qn(!t,e)}function Qn(t,e){if(!t)throw new Error(e||"AssertionError")}});var Ps=m(Xo=>{"use strict";c();var Vw=C0(),Yo=N0(),yx=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Xo.Buffer=$;Xo.SlowBuffer=wH;Xo.INSPECT_MAX_BYTES=50;var Wh=2147483647;Xo.kMaxLength=Wh;$.TYPED_ARRAY_SUPPORT=dH();!$.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 dH(){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($.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 Wn(t){if(t>Wh)throw new RangeError('The value "'+t+'" is invalid for option "size"');let 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 jw(t)}return vx(t,e,r)}$.poolSize=8192;function vx(t,e,r){if(typeof t=="string")return gH(t,e);if(ArrayBuffer.isView(t))return yH(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(gn(t,ArrayBuffer)||t&&gn(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(gn(t,SharedArrayBuffer)||t&&gn(t.buffer,SharedArrayBuffer)))return Gw(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 $.from(n,e,r);let i=mH(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 vx(t,e,r)};Object.setPrototypeOf($.prototype,Uint8Array.prototype);Object.setPrototypeOf($,Uint8Array);function Ax(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 pH(t,e,r){return Ax(t),t<=0?Wn(t):e!==void 0?typeof r=="string"?Wn(t).fill(e,r):Wn(t).fill(e):Wn(t)}$.alloc=function(t,e,r){return pH(t,e,r)};function jw(t){return Ax(t),Wn(t<0?0:Qw(t)|0)}$.allocUnsafe=function(t){return jw(t)};$.allocUnsafeSlow=function(t){return jw(t)};function gH(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!$.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=bx(t,e)|0,n=Wn(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function Hw(t){let e=t.length<0?0:Qw(t.length)|0,r=Wn(e);for(let n=0;n=Wh)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Wh.toString(16)+" bytes");return t|0}function wH(t){return+t!=t&&(t=0),$.alloc(+t)}$.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==$.prototype};$.compare=function(e,r){if(gn(e,Uint8Array)&&(e=$.from(e,e.offset,e.byteLength)),gn(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;let n=e.length,i=r.length;for(let s=0,o=Math.min(n,i);si.length?($.isBuffer(o)||(o=$.from(o)),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 bx(t,e){if($.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||gn(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 kw(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return Dx(t).length;default:if(i)return n?-1:kw(t).length;e=(""+e).toLowerCase(),i=!0}}$.byteLength=bx;function EH(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 NH(this,e,r);case"utf8":case"utf-8":return Ix(this,e,r);case"ascii":return CH(this,e,r);case"latin1":case"binary":return xH(this,e,r);case"base64":return SH(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return OH(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}$.prototype._isBuffer=!0;function Ds(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}$.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+=" ... "),""};yx&&($.prototype[yx]=$.prototype.inspect);$.prototype.compare=function(e,r,n,i,s){if(gn(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;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,$w(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:mx(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):mx(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function mx(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 vH(this,e,r,n);case"utf8":case"utf-8":return AH(this,e,r,n);case"ascii":case"latin1":case"binary":return bH(this,e,r,n);case"base64":return _H(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return IH(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 SH(t,e,r){return e===0&&r===t.length?Vw.fromByteArray(t):Vw.fromByteArray(t.slice(e,r))}function Ix(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 TH(n)}var wx=4096;function TH(t){let e=t.length;if(e<=wx)return String.fromCharCode.apply(String,t);let r="",n=0;for(;nn)&&(r=n);let i="";for(let s=e;sn&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),rr)throw new RangeError("Trying to access beyond buffer length")}$.prototype.readUintLE=$.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};$.prototype.readUint8=$.prototype.readUInt8=function(e,r){return e=e>>>0,r||Lt(e,1,this.length),this[e]};$.prototype.readUint16LE=$.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||Lt(e,2,this.length),this[e]|this[e+1]<<8};$.prototype.readUint16BE=$.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||Lt(e,2,this.length),this[e]<<8|this[e+1]};$.prototype.readUint32LE=$.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};$.prototype.readUint32BE=$.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])};$.prototype.readBigUInt64LE=Ii(function(e){e=e>>>0,Jo(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&pc(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,Jo(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&pc(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};$.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};$.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]};$.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};$.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};$.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};$.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]};$.prototype.readBigInt64LE=Ii(function(e){e=e>>>0,Jo(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&pc(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,Jo(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&pc(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),Yo.read(this,e,!0,23,4)};$.prototype.readFloatBE=function(e,r){return e=e>>>0,r||Lt(e,4,this.length),Yo.read(this,e,!1,23,4)};$.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||Lt(e,8,this.length),Yo.read(this,e,!0,52,8)};$.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||Lt(e,8,this.length),Yo.read(this,e,!1,52,8)};function fr(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){let a=Math.pow(2,8*n)-1;fr(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;fr(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};$.prototype.writeUint8=$.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||fr(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||fr(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||fr(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||fr(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||fr(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 Sx(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 Tx(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}$.prototype.writeBigUInt64LE=Ii(function(e,r=0){return Sx(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});$.prototype.writeBigUInt64BE=Ii(function(e,r=0){return Tx(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});$.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let u=Math.pow(2,8*n-1);fr(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};$.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let u=Math.pow(2,8*n-1);fr(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};$.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||fr(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||fr(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||fr(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||fr(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||fr(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};$.prototype.writeBigInt64LE=Ii(function(e,r=0){return Sx(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});$.prototype.writeBigInt64BE=Ii(function(e,r=0){return Tx(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Cx(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 xx(t,e,r,n,i){return e=+e,r=r>>>0,i||Cx(t,e,r,4,34028234663852886e22,-34028234663852886e22),Yo.write(t,e,r,n,23,4),r+4}$.prototype.writeFloatLE=function(e,r,n){return xx(this,e,r,!0,n)};$.prototype.writeFloatBE=function(e,r,n){return xx(this,e,r,!1,n)};function Nx(t,e,r,n,i){return e=+e,r=r>>>0,i||Cx(t,e,r,8,17976931348623157e292,-17976931348623157e292),Yo.write(t,e,r,n,52,8),r+8}$.prototype.writeDoubleLE=function(e,r,n){return Nx(this,e,r,!0,n)};$.prototype.writeDoubleBE=function(e,r,n){return Nx(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);let s;if(typeof e=="number")for(s=r;s2**32?i=Ex(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=Ex(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);function Ex(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 DH(t,e,r){Jo(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&pc(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 Ko.ERR_OUT_OF_RANGE("value",a,t)}DH(n,i,s)}function Jo(t,e){if(typeof t!="number")throw new Ko.ERR_INVALID_ARG_TYPE(e,"number",t)}function pc(t,e,r){throw Math.floor(t)!==t?(Jo(t,r),new Ko.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new Ko.ERR_BUFFER_OUT_OF_BOUNDS:new Ko.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var PH=/[^+/0-9A-Za-z-_]/g;function RH(t){if(t=t.split("=")[0],t=t.trim().replace(PH,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function kw(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 BH(t){let e=[];for(let r=0;r>8,i=r%256,s.push(i),s.push(n);return s}function Dx(t){return Vw.toByteArray(RH(t))}function $h(t,e,r,n){let i;for(i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function gn(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function $w(t){return t!==t}var FH=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 Ii(t){return typeof BigInt>"u"?MH:t}function MH(){throw new Error("BigInt not supported")}});var Rx=m((Gae,Px)=>{c();Px.exports=zw;zw.supported=typeof WebAssembly<"u";function zw(t){if(!zw.supported)return null;var e=t&&t.imports,r=UH("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 UH(t){return typeof atob=="function"?new Uint8Array(atob(t).split("").map(qH)):new(Ps()).Buffer(t,"base64")}function qH(t){return t.charCodeAt(0)}});var Vx=m((Wae,mn)=>{c();var yn=qw(),Ke=Rx()(),$n=64,zh=[];mn.exports=Rr;var Bx=mn.exports.BYTES_MIN=16,Lx=mn.exports.BYTES_MAX=64,jae=mn.exports.BYTES=32,Fx=mn.exports.KEYBYTES_MIN=16,Mx=mn.exports.KEYBYTES_MAX=64,Qae=mn.exports.KEYBYTES=32,Ux=mn.exports.SALTBYTES=16,qx=mn.exports.PERSONALBYTES=16;function Rr(t,e,r,n,i){if(!(this instanceof Rr))return new Rr(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&&(yn(t>=Bx,"digestLength must be at least "+Bx+", was given "+t),yn(t<=Lx,"digestLength must be at most "+Lx+", was given "+t),e!=null&&yn(e.length>=Fx,"key must be at least "+Fx+", was given "+e.length),e!=null&&yn(e.length<=Mx,"key must be at least "+Mx+", was given "+e.length),r!=null&&yn(r.length===Ux,"salt must be exactly "+Ux+", was given "+r.length),n!=null&&yn(n.length===qx,"personal must be exactly "+qx+", was given "+n.length)),zh.length||(zh.push($n),$n+=216),this.digestLength=t,this.finalized=!1,this.pointer=zh.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,$n,$n+e.length),Ke.memory[this.pointer+200]=128)}Rr.prototype.update=function(t){return yn(this.finalized===!1,"Hash instance finalized"),yn(t,"input must be TypedArray or Buffer"),$n+t.length>Ke.memory.length&&Ke.realloc($n+t.length),Ke.memory.set(t,$n),Ke.exports.blake2b_update(this.pointer,$n,$n+t.length),this};Rr.prototype.digest=function(t){if(yn(this.finalized===!1,"Hash instance finalized"),this.finalized=!0,zh.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 HH(Ke.memory,this.pointer+128,this.digestLength);yn(t.length>=this.digestLength,"input must be TypedArray or Buffer");for(var e=0;e{c();var Ci=qw(),yc=Vx();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 Hx(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 zx(t,e){return t[e]^t[e+1]<<8^t[e+2]<<16^t[e+3]<<24}function Si(t,e,r,n,i,s){var o=gc[i],a=gc[i+1],u=gc[s],l=gc[s+1];Kh(Ce,t,e),Hx(Ce,t,o,a);var f=Ce[n]^Ce[t],d=Ce[n+1]^Ce[t+1];Ce[n]=d,Ce[n+1]=f,Kh(Ce,r,n),f=Ce[e]^Ce[r],d=Ce[e+1]^Ce[r+1],Ce[e]=f>>>24^d<<8,Ce[e+1]=d>>>24^f<<8,Kh(Ce,t,e),Hx(Ce,t,u,l),f=Ce[n]^Ce[t],d=Ce[n+1]^Ce[t+1],Ce[n]=f>>>16^d<<16,Ce[n+1]=d>>>16^f<<16,Kh(Ce,r,n),f=Ce[e]^Ce[r],d=Ce[e+1]^Ce[r+1],Ce[e]=d>>>31^f<<1,Ce[e+1]=f>>>31^d<<1}var Kx=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),kH=[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(kH.map(function(t){return t*2})),Ce=new Uint32Array(32),gc=new Uint32Array(32);function Yx(t,e){var r=0;for(r=0;r<16;r++)Ce[r]=t.h[r],Ce[r+16]=Kx[r];for(Ce[24]=Ce[24]^t.t,Ce[25]=Ce[25]^t.t/4294967296,e&&(Ce[28]=~Ce[28],Ce[29]=~Ce[29]),r=0;r<32;r++)gc[r]=zx(t.b,4*r);for(r=0;r<12;r++)Si(0,8,16,24,Kt[r*16+0],Kt[r*16+1]),Si(2,10,18,26,Kt[r*16+2],Kt[r*16+3]),Si(4,12,20,28,Kt[r*16+4],Kt[r*16+5]),Si(6,14,22,30,Kt[r*16+6],Kt[r*16+7]),Si(0,10,20,30,Kt[r*16+8],Kt[r*16+9]),Si(2,12,22,24,Kt[r*16+10],Kt[r*16+11]),Si(4,14,16,26,Kt[r*16+12],Kt[r*16+13]),Si(6,8,18,28,Kt[r*16+14],Kt[r*16+15]);for(r=0;r<16;r++)t.h[r]=t.h[r]^Ce[r]^Ce[r+16]}var Ti=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){Ti.fill(0),this.b=new Uint8Array(128),this.h=new Uint32Array(16),this.t=0,this.c=0,this.outlen=t,Ti[0]=t,e&&(Ti[1]=e.length),Ti[2]=1,Ti[3]=1,r&&Ti.set(r,32),n&&Ti.set(n,48);for(var i=0;i<16;i++)this.h[i]=Kx[i]^zx(Ti,i*4);e&&(Jx(this,e),this.c=128)}Zo.prototype.update=function(t){return Ci(t!=null,"input must be Uint8Array or Buffer"),Jx(this,t),this};Zo.prototype.digest=function(t){var e=!t||t==="binary"||t==="hex"?new Uint8Array(this.outlen):t;return Ci(e.length>=this.outlen,"out must have at least outlen bytes of space"),jH(this,e),t==="hex"?QH(e):e};Zo.prototype.final=Zo.prototype.digest;Zo.ready=function(t){yc.ready(function(){t()})};function Jx(t,e){for(var r=0;r>2]>>8*(r&3);return e}function QH(t){for(var e="",r=0;r=Gx,"outlen must be at least "+Gx+", was given "+e),Ci(e<=kx,"outlen must be at most "+kx+", was given "+e),r!=null&&Ci(r.length>=jx,"key must be at least "+jx+", was given "+r.length),r!=null&&Ci(r.length<=Qx,"key must be at most "+Qx+", was given "+r.length),n!=null&&Ci(n.length===Wx,"salt must be exactly "+Wx+", was given "+n.length),i!=null&&Ci(i.length===$x,"personal must be exactly "+$x+", was given "+i.length)),new Xx(e,r,n,i)};hr.exports.ready=function(t){yc.ready(function(){t()})};hr.exports.WASM_SUPPORTED=yc.SUPPORTED;hr.exports.WASM_LOADED=!1;var Gx=hr.exports.BYTES_MIN=16,kx=hr.exports.BYTES_MAX=64,zae=hr.exports.BYTES=32,jx=hr.exports.KEYBYTES_MIN=16,Qx=hr.exports.KEYBYTES_MAX=64,Kae=hr.exports.KEYBYTES=32,Wx=hr.exports.SALTBYTES=16,$x=hr.exports.PERSONALBYTES=16;yc.ready(function(t){t||(hr.exports.WASM_LOADED=!0,Xx=yc)})});var wn=m(Br=>{"use strict";c();var $H=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]}),zH=Br&&Br.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),KH=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)&&$H(e,t,r);return zH(e,t),e};Object.defineProperty(Br,"__esModule",{value:!0});Br.TransactionHash=Br.Transaction=void 0;var ea=Gt(),mc=ht(),YH=Uh(),JH=bs(),XH=KH(Be()),ZH=lC(),zn=cc(),eG=hx(),eN=jh(),tN=jn(),tG=wr(),rG=Zx(),nG=32,Kw=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:w}){this.nonce=e||0,this.value=r?new ea.BigNumber(r.toString()).toFixed(0):0,this.sender=n,this.receiver=i,this.senderUsername=s||"",this.receiverUsername=o||"",this.gasPrice=a||JH.TRANSACTION_MIN_GAS_PRICE,this.gasLimit=u,this.data=l||new tN.TransactionPayload,this.chainID=f,this.version=d?new zn.TransactionVersion(d.valueOf()):zn.TransactionVersion.withDefaultVersion(),this.options=g?new zn.TransactionOptions(g.valueOf()):zn.TransactionOptions.withDefaultOptions(),this.guardian=w||mc.Address.empty(),this.signature=h.Buffer.from([]),this.guardianSignature=h.Buffer.from([]),this.hash=ta.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 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 tG.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 YH.Compatibility.guardAddressIsSetAndNonZero(new mc.Address(r.sender),"'sender' of transaction","pass the actual sender to the Transaction constructor"),r}static fromPlainObject(e){let r=new t({nonce:Number(e.nonce),value:new ea.BigNumber(e.value).toFixed(0),receiver:mc.Address.fromString(e.receiver),receiverUsername:e.receiverUsername?h.Buffer.from(e.receiverUsername,"base64").toString():void 0,sender:mc.Address.fromString(e.sender),senderUsername:e.senderUsername?h.Buffer.from(e.senderUsername,"base64").toString():void 0,guardian:e.guardian?mc.Address.fromString(e.guardian):void 0,gasPrice:Number(e.gasPrice),gasLimit:Number(e.gasLimit),data:new tN.TransactionPayload(h.Buffer.from(e.data||"","base64")),chainID:String(e.chainID),version:new zn.TransactionVersion(e.version),options:e.options!=null?new zn.TransactionOptions(e.options):void 0});return e.signature&&r.applySignature(new eN.Signature(e.signature)),e.guardianSignature&&r.applyGuardianSignature(new eN.Signature(e.guardianSignature)),r}applySignature(e){this.signature=this.interpretSignatureAsBuffer(e),this.hash=ta.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=ta.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 XH.ErrNotEnoughGas(this.gasLimit.valueOf());let n=new ea.BigNumber(this.gasPrice.valueOf()),i=new ea.BigNumber(r).multipliedBy(n);if(r===this.gasLimit.valueOf())return i;let s=new ea.BigNumber(this.gasLimit.valueOf()-r),o=n.multipliedBy(new ea.BigNumber(e.GasPriceModifier.valueOf())),a=s.multipliedBy(o);return i.plus(a)}};Br.Transaction=Kw;var ta=class t extends ZH.Hash{constructor(e){super(e)}static compute(e){let n=new eG.ProtoSerializer().serializeTransaction(e),i=rG(nG).update(n).digest("hex");return new t(i)}};Br.TransactionHash=ta});var Zw=m(Jh=>{"use strict";c();Object.defineProperty(Jh,"__esModule",{value:!0});Jh.TransferTransactionsFactory=void 0;var Yw=Wo(),$r=St(),Yh=wn(),Jw=jn(),Xw=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 Yh.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 Yw.ArgSerializer().valuesToString([$r.BytesValue.fromUTF8(e.tokenTransfer.tokenIdentifier),new $r.BigUIntValue(e.tokenTransfer.valueOf())]),n=`ESDTTransfer@${r}`,i=new Jw.TransactionPayload(n),s=i.length()||0,o=this.gasEstimator.forESDTTransfer(s);return new Yh.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 Yw.ArgSerializer().valuesToString([$r.BytesValue.fromUTF8(e.tokenTransfer.tokenIdentifier),new $r.U64Value(e.tokenTransfer.nonce),new $r.BigUIntValue(e.tokenTransfer.valueOf()),new $r.AddressValue(e.destination)]),n=`ESDTNFTTransfer@${r}`,i=new Jw.TransactionPayload(n),s=i.length()||0,o=this.gasEstimator.forESDTNFTTransfer(s);return new Yh.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 $r.AddressValue(e.destination),new $r.U16Value(e.tokenTransfers.length)];for(let u of e.tokenTransfers)r.push($r.BytesValue.fromUTF8(u.tokenIdentifier),new $r.U64Value(u.nonce),new $r.BigUIntValue(u.valueOf()));let{argumentsString:n}=new Yw.ArgSerializer().valuesToString(r),i=`MultiESDTNFTTransfer@${n}`,s=new Jw.TransactionPayload(i),o=s.length()||0,a=this.gasEstimator.forMultiESDTNFTTransfer(o,e.tokenTransfers.length);return new Yh.Transaction({nonce:e.nonce,receiver:e.sender,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||a,data:s,chainID:e.chainID})}};Jh.TransferTransactionsFactory=Xw});var tE=m(Rs=>{"use strict";c();Object.defineProperty(Rs,"__esModule",{value:!0});Rs.GasEstimator=Rs.DefaultGasConfiguration=void 0;Rs.DefaultGasConfiguration={minGasLimit:5e4,gasPerDataByte:1500,gasCostESDTTransfer:2e5,gasCostESDTNFTTransfer:2e5,gasCostESDTNFTMultiTransfer:2e5};var iG=1e5,rN=8e5,eE=class{constructor(e){this.gasConfiguration=e||Rs.DefaultGasConfiguration}forEGLDTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasPerDataByte*e}forESDTTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasCostESDTTransfer+this.gasConfiguration.gasPerDataByte*e+iG}forESDTNFTTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasCostESDTNFTTransfer+this.gasConfiguration.gasPerDataByte*e+rN}forMultiESDTNFTTransfer(e,r){return this.gasConfiguration.minGasLimit+(this.gasConfiguration.gasCostESDTNFTMultiTransfer+rN)*r+this.gasConfiguration.gasPerDataByte*e}};Rs.GasEstimator=eE});var ra=m(Xh=>{"use strict";c();Object.defineProperty(Xh,"__esModule",{value:!0});Xh.Account=void 0;var sG=ht(),rE=class{constructor(e){this.address=new sG.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()}}};Xh.Account=rE});var na=m(Ls=>{"use strict";c();Object.defineProperty(Ls,"__esModule",{value:!0});Ls.Logger=Ls.LogLevel=void 0;var Bs;(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"})(Bs=Ls.LogLevel||(Ls.LogLevel={}));var Zh=class t{static setLevel(e){t.logLevel=e}static trace(e,...r){t.logLevel>=Bs.Debug||console.debug(e,r)}static debug(e,...r){t.logLevel>=Bs.Debug||console.debug(e,r)}static info(e,...r){t.logLevel>=Bs.Info||console.log(e,r)}static warn(e,...r){t.logLevel>=Bs.Warn||console.warn(e,r)}static error(e,...r){t.logLevel>=Bs.Error||console.error(e,r)}};Ls.Logger=Zh;Zh.logLevel=Bs.Debug});var sE=m(En=>{"use strict";c();var oG=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]}),aG=En&&En.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uG=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)&&oG(e,t,r);return aG(e,t),e};Object.defineProperty(En,"__esModule",{value:!0});En.AsyncTimer=void 0;var cG=uG(Be()),lG=Be(),nE=na(),iE=class{constructor(e){this.timeoutHandle=null,this.rejectionFunc=null,this.name=e,this.correlationTag=0}start(e){if(this.timeoutHandle)throw new cG.ErrAsyncTimerAlreadyRunning;return this.correlationTag++,nE.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(){nE.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].abort()`),this.rejectionFunc&&(this.rejectionFunc(new lG.ErrAsyncTimerAborted),this.rejectionFunc=null),this.stop()}stop(){this.isStopped()||(nE.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].stop()`),this.timeoutHandle&&(clearTimeout(this.timeoutHandle),this.timeoutHandle=null))}isStopped(){return!this.timeoutHandle}};En.AsyncTimer=iE});var ed=m(ia=>{"use strict";c();var Lr=ia&&ia.__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(ia,"__esModule",{value:!0});ia.TransactionWatcher=void 0;var oE=sE(),xi=Be(),nN=na(),Ni=class t{constructor(e,r={}){this.fetcher=new aE(e),this.pollingIntervalMilliseconds=r.pollingIntervalMilliseconds||t.DefaultPollingInterval,this.timeoutMilliseconds=r.timeoutMilliseconds||t.DefaultTimeout,this.patienceMilliseconds=r.patienceMilliseconds||t.DefaultPatience}awaitPending(e){return Lr(this,void 0,void 0,function*(){let r=s=>s.status.isPending(),n=()=>Lr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),i=()=>new xi.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)})}awaitCompleted(e){return Lr(this,void 0,void 0,function*(){let r=s=>{if(s.isCompleted===void 0)throw new xi.ErrIsCompletedFieldIsMissingOnTransaction;return s.isCompleted},n=()=>Lr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),i=()=>new xi.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)})}awaitAllEvents(e,r){return Lr(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=()=>Lr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),s=()=>new xi.ErrExpectedTransactionEventsNotFound;return this.awaitConditionally(n,i,s)})}awaitAnyEvent(e,r){return Lr(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=()=>Lr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),s=()=>new xi.ErrExpectedTransactionEventsNotFound;return this.awaitConditionally(n,i,s)})}awaitOnCondition(e,r){return Lr(this,void 0,void 0,function*(){let n=()=>Lr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),i=()=>new xi.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)})}awaitConditionally(e,r,n){return Lr(this,void 0,void 0,function*(){let i=new oE.AsyncTimer("watcher:periodic"),s=new oE.AsyncTimer("watcher:patience"),o=new oE.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(nN.Logger.debug("TransactionWatcher.awaitConditionally(): cannot (yet) fetch data."),f instanceof xi.ErrIsCompletedFieldIsMissingOnTransaction||!(f instanceof xi.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}};ia.TransactionWatcher=Ni;Ni.DefaultPollingInterval=6e3;Ni.DefaultTimeout=Ni.DefaultPollingInterval*15;Ni.DefaultPatience=0;Ni.NoopOnStatusReceived=t=>{};var aE=class{constructor(e){this.fetcher=e}getTransaction(e){return Lr(this,void 0,void 0,function*(){return nN.Logger.debug(`transactionWatcher, getTransaction(${e})`),yield this.fetcher.getTransaction(e)})}}});var cE=m(nd=>{"use strict";c();Object.defineProperty(nd,"__esModule",{value:!0});nd.CodeMetadata=void 0;var uE=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|=td.Upgradeable),this.readable&&(e|=td.Readable),this.payable&&(r|=rd.Payable),this.payableBySc&&(r|=rd.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}};nd.CodeMetadata=uE;var td;(function(t){t[t.Upgradeable=1]="Upgradeable",t[t.Reserved2=2]="Reserved2",t[t.Readable=4]="Readable"})(td||(td={}));var rd;(function(t){t[t.Reserved1=1]="Reserved1",t[t.Payable=2]="Payable",t[t.PayableBySc=4]="PayableBySc"})(rd||(rd={}))});var wc=m(vn=>{"use strict";c();var fG=vn&&vn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),hG=vn&&vn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dG=vn&&vn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&fG(e,t,r);return hG(e,t),e};Object.defineProperty(vn,"__esModule",{value:!0});vn.ContractFunction=void 0;var pG=dG(Be()),lE=class t{constructor(e){if(this.name=e,e==null)throw new pG.ErrInvalidFunctionName}static none(){return new t("untitled")}toString(){return this.name}valueOf(){return this.name}};vn.ContractFunction=lE});var dE=m(Fr=>{"use strict";c();var gG=Fr&&Fr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yG=Fr&&Fr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mG=Fr&&Fr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&gG(e,t,r);return yG(e,t),e},wG=Fr&&Fr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Fr,"__esModule",{value:!0});Fr.InteractionChecker=void 0;var fE=mG(Be()),EG=wG(Gt()),hE=class{checkInteraction(e,r){this.checkPayable(e,r),this.checkArguments(e,r)}checkPayable(e,r){let n=!new EG.default(e.getValue().toString()).isZero(),i=r.modifiers.isPayableInEGLD();if(n&&!i)throw new fE.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 fE.ErrContractInteraction(`bad arguments, expected: ${s}, got: ${o}`);for(let a=0;a{"use strict";c();Object.defineProperty(id,"__esModule",{value:!0});id.Query=void 0;var vG=ht(),AG=Wo(),pE=class{constructor(e){this.caller=e.caller||new vG.Address,this.address=e.address,this.func=e.func,this.args=e.args||[],this.value=e.value||0}getEncodedArguments(){return new AG.ArgSerializer().valuesToStrings(this.args)}};id.Query=pE});var wE=m(sd=>{"use strict";c();Object.defineProperty(sd,"__esModule",{value:!0});sd.Interaction=void 0;var iN=ht(),bG=Uh(),gE=bs(),yE=wc(),_G=dE(),IG=Ec(),sa=St(),mE=class{constructor(e,r,n){this.nonce=0,this.value="0",this.gasLimit=0,this.gasPrice=void 0,this.chainID="",this.querent=new iN.Address,this.sender=new iN.Address,this.isWithSingleESDTTransfer=!1,this.isWithSingleESDTNFTTransfer=!1,this.isWithMultiESDTNFTTransfer=!1,this.contract=e,this.function=r,this.args=n,this.tokenTransfers=new oa([],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(){bG.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 yE.ContractFunction(gE.ESDT_TRANSFER_FUNCTION_NAME),n=this.tokenTransfers.buildArgsForSingleESDTTransfer()):this.isWithSingleESDTNFTTransfer?(e=this.sender,r=new yE.ContractFunction(gE.ESDTNFT_TRANSFER_FUNCTION_NAME),n=this.tokenTransfers.buildArgsForSingleESDTNFTTransfer()):this.isWithMultiESDTNFTTransfer&&(e=this.sender,r=new yE.ContractFunction(gE.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 IG.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 oa([e],this),this}withSingleESDTNFTTransfer(e,r){return this.isWithSingleESDTNFTTransfer=!0,this.tokenTransfers=new oa([e],this),r&&(this.sender=r),this}withMultiESDTNFTTransfer(e,r){return this.isWithMultiESDTNFTTransfer=!0,this.tokenTransfers=new oa(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 _G.InteractionChecker().checkInteraction(this,this.getEndpoint()),this}};sd.Interaction=mE;var oa=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 sa.U8Value(this.transfers.length)}getTypedTokenIdentifier(e){return sa.BytesValue.fromUTF8(e.tokenIdentifier)}getTypedTokenNonce(e){return new sa.U64Value(e.nonce)}getTypedTokenQuantity(e){return new sa.BigUIntValue(e.amountAsBigInteger)}getTypedTokensReceiver(){return new sa.AddressValue(this.interaction.getContractAddress())}getTypedInteractionFunction(){return sa.BytesValue.fromUTF8(this.interaction.getFunction().valueOf())}getInteractionArguments(){return this.interaction.getArguments()}}});var sN=m(od=>{"use strict";c();Object.defineProperty(od,"__esModule",{value:!0});od.ArgumentErrorContext=void 0;var SG=Be(),EE=class{constructor(e,r,n){this.endpointName=e,this.argumentIndex=r,this.parameterDefinition=n}throwError(e){throw new SG.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)})`)}};od.ArgumentErrorContext=EE});var AE=m(Fs=>{"use strict";c();var TG=Fs&&Fs.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Fs,"__esModule",{value:!0});Fs.NativeSerializer=void 0;var CG=TG(Gt()),xG=ht(),vE=Be(),NG=ph(),OG=sN(),ve=St(),DG;(function(t){function e(A,I){A=A||[],r(A,I),n(I)&&(A=i(A,I));let N=I.input,_=[];for(let S=0;S0&&I[0].type.getCardinality().isComposite()&&(_=1/0,S=!0);for(let R of I){if(R.type.getCardinality().isSingular())break;N-=1}return{min:N,max:_,variadic:S}}function o(A,I,N){if(A&&A.belongsToTypesystem)return A;if(I instanceof ve.OptionType)return a(A,I,N);if(I instanceof ve.OptionalType)return u(A,I,N);if(I instanceof ve.VariadicType)return l(A,I,N);if(I instanceof ve.CompositeType)return d(A,I,N);if(I instanceof ve.TupleType)return g(A,I,N);if(I instanceof ve.StructType)return w(A,I,N);if(I instanceof ve.ListType)return f(A,I,N);if(I instanceof ve.PrimitiveType)return E(A,I,N);if(I instanceof ve.EnumType)return T(A,I,N);N.throwError(`convertToTypedValue: unhandled type ${I}`)}function a(A,I,N){if(A==null)return ve.OptionValue.newMissing();let _=o(A,I.getFirstTypeParameter(),N);return ve.OptionValue.newProvided(_)}function u(A,I,N){if(A==null)return new ve.OptionalValue(I);let _=o(A,I.getFirstTypeParameter(),N);return new ve.OptionalValue(I,_)}function l(A,I,N){if(I.isCounted)throw new vE.ErrInvalidArgument('Counted variadic arguments must be explicitly typed. E.g. use "VariadicValue.fromItemsCounted()" or "new VariadicValue()"');A==null&&(A=[]),A.map===void 0&&N.convertError(A,"Variadic");let _=A.map(function(S){return o(S,I.getFirstTypeParameter(),N)});return new ve.VariadicValue(I,_)}function f(A,I,N){A.map===void 0&&N.convertError(A,"List");let _=A.map(function(S){return o(S,I.getFirstTypeParameter(),N)});return new ve.List(I,_)}function d(A,I,N){let _=[],S=I.getTypeParameters();N.guardSameLength(A,S);for(let R=0;R{"use strict";c();Object.defineProperty(zr,"__esModule",{value:!0});zr.ContractCallPayloadBuilder=zr.ContractUpgradePayloadBuilder=zr.ContractDeployPayloadBuilder=zr.ArwenVirtualMachine=void 0;var SE=jn(),TE=wr(),PG=Wo();zr.ArwenVirtualMachine="0500";var bE=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(){TE.guardValueIsSet("code",this.code);let e=this.code.toString(),r=this.codeMetadata.toString(),n=`${e}@${zr.ArwenVirtualMachine}@${r}`;return n=CE(n,this.arguments),new SE.TransactionPayload(n)}};zr.ContractDeployPayloadBuilder=bE;var _E=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(){TE.guardValueIsSet("code",this.code);let e=this.code.toString(),r=this.codeMetadata.toString(),n=`upgradeContract@${e}@${r}`;return n=CE(n,this.arguments),new SE.TransactionPayload(n)}};zr.ContractUpgradePayloadBuilder=_E;var IE=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(){TE.guardValueIsSet("calledFunction",this.contractFunction);let e=this.contractFunction.toString();return e=CE(e,this.arguments),new SE.TransactionPayload(e)}};zr.ContractCallPayloadBuilder=IE;function CE(t,e){let{argumentsString:r,count:n}=new PG.ArgSerializer().valuesToString(e);return n==0?t:`${t}@${r}`}});var Kn=m((xue,NE)=>{"use strict";c();var aa=typeof Reflect=="object"?Reflect:null,oN=aa&&typeof aa.apply=="function"?aa.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},ad;aa&&typeof aa.ownKeys=="function"?ad=aa.ownKeys:Object.getOwnPropertySymbols?ad=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:ad=function(e){return Object.getOwnPropertyNames(e)};function RG(t){console&&console.warn&&console.warn(t)}var uN=Number.isNaN||function(e){return e!==e};function ke(){ke.init.call(this)}NE.exports=ke;NE.exports.once=MG;ke.EventEmitter=ke;ke.prototype._events=void 0;ke.prototype._eventsCount=0;ke.prototype._maxListeners=void 0;var aN=10;function ud(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 aN},set:function(t){if(typeof t!="number"||t<0||uN(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");aN=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||uN(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 cN(t){return t._maxListeners===void 0?ke.defaultMaxListeners:t._maxListeners}ke.prototype.getMaxListeners=function(){return cN(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")oN(u,this,r);else for(var l=u.length,f=pN(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,RG(a)}return t}ke.prototype.addListener=function(e,r){return lN(this,e,r,!1)};ke.prototype.on=ke.prototype.addListener;ke.prototype.prependListener=function(e,r){return lN(this,e,r,!0)};function BG(){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 fN(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=BG.bind(n);return i.listener=r,n.wrapFn=i,i}ke.prototype.once=function(e,r){return ud(r),this.on(e,fN(this,e,r)),this};ke.prototype.prependOnceListener=function(e,r){return ud(r),this.prependListener(e,fN(this,e,r)),this};ke.prototype.removeListener=function(e,r){var n,i,s,o,a;if(ud(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():LG(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};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 hN(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?FG(i):pN(i,i.length)}ke.prototype.listeners=function(e){return hN(this,e,!0)};ke.prototype.rawListeners=function(e){return hN(this,e,!1)};ke.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):dN.call(t,e)};ke.prototype.listenerCount=dN;function dN(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?ad(this._events):[]};function pN(t,e){for(var r=new Array(e),n=0;n{c();yN.exports=Kn().EventEmitter});var DE=m(()=>{c()});var bN=m((Lue,AN)=>{"use strict";c();function mN(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function wN(t){for(var e=1;e0?this.tail.next=n:this.head=n,this.tail=n,++this.length}},{key:"unshift",value:function(r){var n={data:r,next:this.head};this.length===0&&(this.tail=n),this.head=n,++this.length}},{key:"shift",value:function(){if(this.length!==0){var r=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,r}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(r){if(this.length===0)return"";for(var n=this.head,i=""+n.data;n=n.next;)i+=r+n.data;return i}},{key:"concat",value:function(r){if(this.length===0)return cd.alloc(0);for(var n=cd.allocUnsafe(r>>>0),i=this.head,s=0;i;)WG(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=cd.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:QG,value:function(r,n){return PE(this,wN(wN({},n),{},{depth:0,customInspect:!1}))}}]),t}()});var BE=m((Mue,IN)=>{"use strict";c();function $G(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(RE,this,t)):p.default.nextTick(RE,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(ld,r):(r._writableState.errorEmitted=!0,p.default.nextTick(_N,r,s)):p.default.nextTick(_N,r,s):e?(p.default.nextTick(ld,r),e(s)):p.default.nextTick(ld,r)}),this)}function _N(t,e){RE(t,e),ld(t)}function ld(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function zG(){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 RE(t,e){t.emit("error",e)}function KG(t,e){var r=t._readableState,n=t._writableState;r&&r.autoDestroy||n&&n.autoDestroy?t.destroy(e):t.emit("error",e)}IN.exports={destroy:$G,undestroy:zG,errorOrDestroy:KG}});var Ms=m((que,CN)=>{"use strict";c();function YG(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var TN={};function Mr(t,e,r){r||(r=Error);function n(s,o,a){return typeof e=="string"?e:e(s,o,a)}var i=function(s){YG(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,TN[t]=i}function SN(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 JG(t,e,r){return t.substr(!r||r<0?0:+r,e.length)===e}function XG(t,e,r){return(r===void 0||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}function ZG(t,e,r){return typeof r!="number"&&(r=0),r+e.length>t.length?!1:t.indexOf(e,r)!==-1}Mr("ERR_INVALID_OPT_VALUE",function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'},TypeError);Mr("ERR_INVALID_ARG_TYPE",function(t,e,r){var n;typeof e=="string"&&JG(e,"not ")?(n="must not be",e=e.replace(/^not /,"")):n="must be";var i;if(XG(t," argument"))i="The ".concat(t," ").concat(n," ").concat(SN(e,"type"));else{var s=ZG(t,".")?"property":"argument";i='The "'.concat(t,'" ').concat(s," ").concat(n," ").concat(SN(e,"type"))}return i+=". Received type ".concat(typeof r),i},TypeError);Mr("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");Mr("ERR_METHOD_NOT_IMPLEMENTED",function(t){return"The "+t+" method is not implemented"});Mr("ERR_STREAM_PREMATURE_CLOSE","Premature close");Mr("ERR_STREAM_DESTROYED",function(t){return"Cannot call "+t+" after a stream was destroyed"});Mr("ERR_MULTIPLE_CALLBACK","Callback called multiple times");Mr("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");Mr("ERR_STREAM_WRITE_AFTER_END","write after end");Mr("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Mr("ERR_UNKNOWN_ENCODING",function(t){return"Unknown encoding: "+t},TypeError);Mr("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");CN.exports.codes=TN});var LE=m((Hue,xN)=>{"use strict";c();var ek=Ms().codes.ERR_INVALID_OPT_VALUE;function tk(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function rk(t,e,r,n){var i=tk(e,n,r);if(i!=null){if(!(isFinite(i)&&Math.floor(i)===i)||i<0){var s=n?r:"highWaterMark";throw new ek(s,i)}return Math.floor(i)}return t.objectMode?16:16*1024}xN.exports={getHighWaterMark:rk}});var ua=m((kue,FE)=>{c();typeof Object.create=="function"?FE.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:FE.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 ON=m((Que,NN)=>{c();NN.exports=nk;function nk(t,e){if(ME("noDeprecation"))return t;var r=!1;function n(){if(!r){if(ME("throwDeprecation"))throw new Error(e);ME("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}return n}function ME(t){try{if(!global.localStorage)return!1}catch{return!1}var e=global.localStorage[t];return e==null?!1:String(e).toLowerCase()==="true"}});var VE=m(($ue,FN)=>{"use strict";c();FN.exports=dt;function PN(t){var e=this;this.next=null,this.entry=null,this.finish=function(){Ok(e,t)}}var ca;dt.WritableState=Ac;var ik={deprecate:ON()},RN=OE(),hd=Ps().Buffer,sk=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function ok(t){return hd.from(t)}function ak(t){return hd.isBuffer(t)||t instanceof sk}var qE=BE(),uk=LE(),ck=uk.getHighWaterMark,Oi=Ms().codes,lk=Oi.ERR_INVALID_ARG_TYPE,fk=Oi.ERR_METHOD_NOT_IMPLEMENTED,hk=Oi.ERR_MULTIPLE_CALLBACK,dk=Oi.ERR_STREAM_CANNOT_PIPE,pk=Oi.ERR_STREAM_DESTROYED,gk=Oi.ERR_STREAM_NULL_VALUES,yk=Oi.ERR_STREAM_WRITE_AFTER_END,mk=Oi.ERR_UNKNOWN_ENCODING,la=qE.errorOrDestroy;ua()(dt,RN);function wk(){}function Ac(t,e,r){ca=ca||Us(),t=t||{},typeof r!="boolean"&&(r=e instanceof ca),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=ck(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){Sk(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 PN(this)}Ac.prototype.getBuffer=function(){for(var e=this.bufferedRequest,r=[];e;)r.push(e),e=e.next;return r};(function(){try{Object.defineProperty(Ac.prototype,"buffer",{get:ik.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var fd;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(fd=Function.prototype[Symbol.hasInstance],Object.defineProperty(dt,Symbol.hasInstance,{value:function(e){return fd.call(this,e)?!0:this!==dt?!1:e&&e._writableState instanceof Ac}})):fd=function(e){return e instanceof this};function dt(t){ca=ca||Us();var e=this instanceof ca;if(!e&&!fd.call(dt,this))return new dt(t);this._writableState=new Ac(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)),RN.call(this)}dt.prototype.pipe=function(){la(this,new dk)};function Ek(t,e){var r=new yk;la(t,r),p.default.nextTick(e,r)}function vk(t,e,r,n){var i;return r===null?i=new gk:typeof r!="string"&&!e.objectMode&&(i=new lk("chunk",["string","Buffer"],r)),i?(la(t,i),p.default.nextTick(n,i),!1):!0}dt.prototype.write=function(t,e,r){var n=this._writableState,i=!1,s=!n.objectMode&&ak(t);return s&&!hd.isBuffer(t)&&(t=ok(t)),typeof e=="function"&&(r=e,e=null),s?e="buffer":e||(e=n.defaultEncoding),typeof r!="function"&&(r=wk),n.ending?Ek(this,r):(s||vk(this,n,t,r))&&(n.pendingcb++,i=bk(this,n,s,t,e,r)),i};dt.prototype.cork=function(){this._writableState.corked++};dt.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,!t.writing&&!t.corked&&!t.bufferProcessing&&t.bufferedRequest&&BN(this,t))};dt.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 mk(e);return this._writableState.defaultEncoding=e,this};Object.defineProperty(dt.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function Ak(t,e,r){return!t.objectMode&&t.decodeStrings!==!1&&typeof e=="string"&&(e=hd.from(e,r)),e}Object.defineProperty(dt.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function bk(t,e,r,n,i,s){if(!r){var o=Ak(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 Dk=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};UN.exports=An;var MN=kE(),GE=VE();ua()(An,MN);for(HE=Dk(GE.prototype),dd=0;dd{c();var gd=Ps(),bn=gd.Buffer;function qN(t,e){for(var r in t)e[r]=t[r]}bn.from&&bn.alloc&&bn.allocUnsafe&&bn.allocUnsafeSlow?VN.exports=gd:(qN(gd,jE),jE.Buffer=qs);function qs(t,e,r){return bn(t,e,r)}qs.prototype=Object.create(bn.prototype);qN(bn,qs);qs.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return bn(t,e,r)};qs.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=bn(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};qs.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return bn(t)};qs.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return gd.SlowBuffer(t)}});var $E=m(kN=>{"use strict";c();var WE=HN().Buffer,GN=WE.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 Bk(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 Lk(t){var e=Bk(t);if(typeof e!="string"&&(WE.isEncoding===GN||!GN(t)))throw new Error("Unknown encoding: "+t);return e||t}kN.StringDecoder=bc;function bc(t){this.encoding=Lk(t);var e;switch(this.encoding){case"utf16le":this.text=Hk,this.end=Gk,e=4;break;case"utf8":this.fillLast=Uk,e=4;break;case"base64":this.text=kk,this.end=jk,e=3;break;default:this.write=Qk,this.end=Wk;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=WE.allocUnsafe(e)}bc.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 Fk(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 Mk(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 Uk(t){var e=this.lastTotal-this.lastNeed,r=Mk(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 qk(t,e){var r=Fk(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 Vk(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function Hk(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 Gk(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 kk(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 jk(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function Qk(t){return t.toString(this.encoding)}function Wk(t){return t&&t.length?this.write(t):""}});var yd=m((ece,WN)=>{"use strict";c();var jN=Ms().codes.ERR_STREAM_PREMATURE_CLOSE;function $k(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 md;function Di(t,e,r){return e=Yk(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Yk(t){var e=Jk(t,"string");return typeof e=="symbol"?e:String(e)}function Jk(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 Xk=yd(),Pi=Symbol("lastResolve"),Vs=Symbol("lastReject"),_c=Symbol("error"),wd=Symbol("ended"),Hs=Symbol("lastPromise"),zE=Symbol("handlePromise"),Gs=Symbol("stream");function Ri(t,e){return{value:t,done:e}}function Zk(t){var e=t[Pi];if(e!==null){var r=t[Gs].read();r!==null&&(t[Hs]=null,t[Pi]=null,t[Vs]=null,e(Ri(r,!1)))}}function ej(t){p.default.nextTick(Zk,t)}function tj(t,e){return function(r,n){t.then(function(){if(e[wd]){r(Ri(void 0,!0));return}e[zE](r,n)},n)}}var rj=Object.getPrototypeOf(function(){}),nj=Object.setPrototypeOf((md={get stream(){return this[Gs]},next:function(){var e=this,r=this[_c];if(r!==null)return Promise.reject(r);if(this[wd])return Promise.resolve(Ri(void 0,!0));if(this[Gs].destroyed)return new Promise(function(o,a){p.default.nextTick(function(){e[_c]?a(e[_c]):o(Ri(void 0,!0))})});var n=this[Hs],i;if(n)i=new Promise(tj(n,this));else{var s=this[Gs].read();if(s!==null)return Promise.resolve(Ri(s,!1));i=new Promise(this[zE])}return this[Hs]=i,i}},Di(md,Symbol.asyncIterator,function(){return this}),Di(md,"return",function(){var e=this;return new Promise(function(r,n){e[Gs].destroy(null,function(i){if(i){n(i);return}r(Ri(void 0,!0))})})}),md),rj),ij=function(e){var r,n=Object.create(nj,(r={},Di(r,Gs,{value:e,writable:!0}),Di(r,Pi,{value:null,writable:!0}),Di(r,Vs,{value:null,writable:!0}),Di(r,_c,{value:null,writable:!0}),Di(r,wd,{value:e._readableState.endEmitted,writable:!0}),Di(r,zE,{value:function(s,o){var a=n[Gs].read();a?(n[Hs]=null,n[Pi]=null,n[Vs]=null,s(Ri(a,!1))):(n[Pi]=s,n[Vs]=o)},writable:!0}),r));return n[Hs]=null,Xk(e,function(i){if(i&&i.code!=="ERR_STREAM_PREMATURE_CLOSE"){var s=n[Vs];s!==null&&(n[Hs]=null,n[Pi]=null,n[Vs]=null,s(i)),n[_c]=i;return}var o=n[Pi];o!==null&&(n[Hs]=null,n[Pi]=null,n[Vs]=null,o(Ri(void 0,!0))),n[wd]=!0}),e.on("readable",ej.bind(null,n)),n};$N.exports=ij});var YN=m((ice,KN)=>{c();KN.exports=function(){throw new Error("Readable.from is not available in the browser")}});var kE=m((ace,oO)=>{"use strict";c();oO.exports=Me;var fa;Me.ReadableState=eO;var oce=Kn().EventEmitter,ZN=function(e,r){return e.listeners(r).length},Sc=OE(),Ed=Ps().Buffer,sj=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function oj(t){return Ed.from(t)}function aj(t){return Ed.isBuffer(t)||t instanceof sj}var KE=DE(),xe;KE&&KE.debuglog?xe=KE.debuglog("stream"):xe=function(){};var uj=bN(),rv=BE(),cj=LE(),lj=cj.getHighWaterMark,vd=Ms().codes,fj=vd.ERR_INVALID_ARG_TYPE,hj=vd.ERR_STREAM_PUSH_AFTER_EOF,dj=vd.ERR_METHOD_NOT_IMPLEMENTED,pj=vd.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,ha,YE,JE;ua()(Me,Sc);var Ic=rv.errorOrDestroy,XE=["error","close","destroy","pause","resume"];function gj(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}function eO(t,e,r){fa=fa||Us(),t=t||{},typeof r!="boolean"&&(r=e instanceof fa),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=lj(this,t,"readableHighWaterMark",r),this.buffer=new uj,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&&(ha||(ha=$E().StringDecoder),this.decoder=new ha(t.encoding),this.encoding=t.encoding)}function Me(t){if(fa=fa||Us(),!(this instanceof Me))return new Me(t);var e=this instanceof fa;this._readableState=new eO(t,this,e),this.readable=!0,t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy)),Sc.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=rv.destroy;Me.prototype._undestroy=rv.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=Ed.from(t,e),e=""),n=!0),tO(this,t,e,!1,n)};Me.prototype.unshift=function(t){return tO(this,t,null,!0,!1)};function tO(t,e,r,n,i){xe("readableAddChunk",e);var s=t._readableState;if(e===null)s.reading=!1,wj(t,s);else{var o;if(i||(o=yj(s,e)),o)Ic(t,o);else if(s.objectMode||e&&e.length>0)if(typeof e!="string"&&!s.objectMode&&Object.getPrototypeOf(e)!==Ed.prototype&&(e=oj(e)),n)s.endEmitted?Ic(t,new pj):ZE(t,s,e,!0);else if(s.ended)Ic(t,new hj);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(e=s.decoder.write(e),s.objectMode||e.length!==0?ZE(t,s,e,!1):tv(t,s)):ZE(t,s,e,!1)}else n||(s.reading=!1,tv(t,s))}return!s.ended&&(s.length=JN?t=JN:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}function XN(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=mj(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?ev(this):Ad(this),null;if(t=XN(t,e),t===0&&e.ended)return e.length===0&&ev(this),null;var n=e.needReadable;xe("need readable",n),(e.length===0||e.length-t0?i=iO(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&&ev(this)),i!==null&&this.emit("data",i),i};function wj(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?Ad(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,rO(t)))}}function Ad(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(rO,t))}function rO(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,nv(t)}function tv(t,e){e.readingMore||(e.readingMore=!0,p.default.nextTick(Ej,t,e))}function Ej(t,e){for(;!e.reading&&!e.ended&&(e.length1&&sO(n.pipes,t)!==-1)&&!l&&(xe("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function g(D){xe("onerror",D),T(),t.removeListener("error",g),ZN(t,"error")===0&&Ic(t,D)}gj(t,"error",g);function w(){t.removeListener("finish",E),T()}t.once("close",w);function E(){xe("onfinish"),t.removeListener("close",w),T()}t.once("finish",E);function T(){xe("unpipe"),r.unpipe(t)}return t.emit("pipe",r),n.flowing||(xe("pipe resume"),r.resume()),t};function vj(t){return function(){var r=t._readableState;xe("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,r.awaitDrain===0&&ZN(t,"data")&&(r.flowing=!0,nv(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?Ad(this):n.reading||p.default.nextTick(Aj,this)),r};Me.prototype.addListener=Me.prototype.on;Me.prototype.removeListener=function(t,e){var r=Sc.prototype.removeListener.call(this,t,e);return t==="readable"&&p.default.nextTick(nO,this),r};Me.prototype.removeAllListeners=function(t){var e=Sc.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&p.default.nextTick(nO,this),e};function nO(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 Aj(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,bj(this,t)),t.paused=!1,this};function bj(t,e){e.resumeScheduled||(e.resumeScheduled=!0,p.default.nextTick(_j,t,e))}function _j(t,e){xe("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),nv(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 nv(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 ev(t){var e=t._readableState;xe("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,p.default.nextTick(Ij,e,t))}function Ij(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 JE===void 0&&(JE=YN()),JE(Me,t,e)});function sO(t,e){for(var r=0,n=t.length;r{"use strict";c();uO.exports=Yn;var bd=Ms().codes,Sj=bd.ERR_METHOD_NOT_IMPLEMENTED,Tj=bd.ERR_MULTIPLE_CALLBACK,Cj=bd.ERR_TRANSFORM_ALREADY_TRANSFORMING,xj=bd.ERR_TRANSFORM_WITH_LENGTH_0,_d=Us();ua()(Yn,_d);function Nj(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(n===null)return this.emit("error",new Tj);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();lO.exports=Tc;var cO=iv();ua()(Tc,cO);function Tc(t){if(!(this instanceof Tc))return new Tc(t);cO.call(this,t)}Tc.prototype._transform=function(t,e,r){r(null,t)}});var yO=m((dce,gO)=>{"use strict";c();var sv;function Dj(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}var pO=Ms().codes,Pj=pO.ERR_MISSING_ARGS,Rj=pO.ERR_STREAM_DESTROYED;function hO(t){if(t)throw t}function Bj(t){return t.setHeader&&typeof t.abort=="function"}function Lj(t,e,r,n){n=Dj(n);var i=!1;t.on("close",function(){i=!0}),sv===void 0&&(sv=yd()),sv(t,{readable:e,writable:r},function(o){if(o)return n(o);i=!0,n()});var s=!1;return function(o){if(!i&&!s){if(s=!0,Bj(t))return t.abort();if(typeof t.destroy=="function")return t.destroy();n(o||new Rj("pipe"))}}}function dO(t){t()}function Fj(t,e){return t.pipe(e)}function Mj(t){return!t.length||typeof t[t.length-1]!="function"?hO:t.pop()}function Uj(){for(var t=arguments.length,e=new Array(t),r=0;r0;return Lj(o,u,l,function(f){i||(i=f),f&&s.forEach(dO),!u&&(s.forEach(dO),n(i))})});return e.reduce(Fj)}gO.exports=Uj});var ov=m((Ur,mO)=>{c();Ur=mO.exports=kE();Ur.Stream=Ur;Ur.Readable=Ur;Ur.Writable=VE();Ur.Duplex=Us();Ur.Transform=iv();Ur.PassThrough=fO();Ur.finished=yd();Ur.pipeline=yO()});var vO=m((yce,EO)=>{c();var{Transform:qj}=ov();EO.exports=t=>class wO extends qj{constructor(r,n,i,s,o){super(o),this._rate=r,this._capacity=n,this._delimitedSuffix=i,this._hashBitLength=s,this._options=o,this._state=new t,this._state.initialize(r,n),this._finalized=!1}_transform(r,n,i){let s=null;try{this.update(r,n)}catch(o){s=o}i(s)}_flush(r){let n=null;try{this.push(this.digest())}catch(i){n=i}r(n)}update(r,n){if(!h.Buffer.isBuffer(r)&&typeof r!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");return h.Buffer.isBuffer(r)||(r=h.Buffer.from(r,n)),this._state.absorb(r),this}digest(r){if(this._finalized)throw new Error("Digest already called");this._finalized=!0,this._delimitedSuffix&&this._state.absorbLastFewBits(this._delimitedSuffix);let n=this._state.squeeze(this._hashBitLength/8);return r!==void 0&&(n=n.toString(r)),this._resetState(),n}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){let r=new wO(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}}});var _O=m((wce,bO)=>{c();var{Transform:Vj}=ov();bO.exports=t=>class AO extends Vj{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 AO(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}}});var SO=m((vce,IO)=>{c();var Hj=vO(),Gj=_O();IO.exports=function(t){let e=Hj(t),r=Gj(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 xO=m(CO=>{c();var TO=[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];CO.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),w=d^(s<<1|i>>>31),E=t[0]^g,T=t[1]^w,D=t[10]^g,B=t[11]^w,W=t[20]^g,U=t[21]^w,A=t[30]^g,I=t[31]^w,N=t[40]^g,_=t[41]^w;g=r^(o<<1|a>>>31),w=n^(a<<1|o>>>31);let S=t[2]^g,R=t[3]^w,J=t[12]^g,Q=t[13]^w,V=t[22]^g,k=t[23]^w,K=t[32]^g,pe=t[33]^w,ue=t[42]^g,re=t[43]^w;g=i^(u<<1|l>>>31),w=s^(l<<1|u>>>31);let Y=t[4]^g,se=t[5]^w,te=t[14]^g,ie=t[15]^w,M=t[24]^g,le=t[25]^w,ae=t[34]^g,fe=t[35]^w,oe=t[44]^g,ce=t[45]^w;g=o^(f<<1|d>>>31),w=a^(d<<1|f>>>31);let y=t[6]^g,v=t[7]^w,b=t[16]^g,P=t[17]^w,C=t[26]^g,O=t[27]^w,L=t[36]^g,x=t[37]^w,F=t[46]^g,H=t[47]^w;g=u^(r<<1|n>>>31),w=l^(n<<1|r>>>31);let q=t[8]^g,Z=t[9]^w,we=t[18]^g,Ae=t[19]^w,Re=t[28]^g,tt=t[29]^w,lt=t[38]^g,Oe=t[39]^w,Ue=t[48]^g,Ot=t[49]^w,hi=E,ms=T,ws=B<<4|D>>>28,sr=D<<4|B>>>28,Un=W<<3|U>>>29,$t=U<<3|W>>>29,Dt=I<<9|A>>>23,$e=A<<9|I>>>23,Uy=N<<18|_>>>14,qy=_<<18|N>>>14,Vy=S<<1|R>>>31,Hy=R<<1|S>>>31,Gy=Q<<12|J>>>20,ky=J<<12|Q>>>20,jy=V<<10|k>>>22,Qy=k<<10|V>>>22,Wy=pe<<13|K>>>19,$y=K<<13|pe>>>19,zy=ue<<2|re>>>30,Ky=re<<2|ue>>>30,Yy=se<<30|Y>>>2,Jy=Y<<30|se>>>2,Xy=te<<6|ie>>>26,Zy=ie<<6|te>>>26,e0=le<<11|M>>>21,t0=M<<11|le>>>21,r0=ae<<15|fe>>>17,n0=fe<<15|ae>>>17,i0=ce<<29|oe>>>3,s0=oe<<29|ce>>>3,o0=y<<28|v>>>4,a0=v<<28|y>>>4,u0=P<<23|b>>>9,c0=b<<23|P>>>9,l0=C<<25|O>>>7,f0=O<<25|C>>>7,h0=L<<21|x>>>11,d0=x<<21|L>>>11,p0=H<<24|F>>>8,g0=F<<24|H>>>8,y0=q<<27|Z>>>5,m0=Z<<27|q>>>5,w0=we<<20|Ae>>>12,E0=Ae<<20|we>>>12,v0=tt<<7|Re>>>25,A0=Re<<7|tt>>>25,b0=lt<<8|Oe>>>24,_0=Oe<<8|lt>>>24,I0=Ue<<14|Ot>>>18,S0=Ot<<14|Ue>>>18;t[0]=hi^~Gy&e0,t[1]=ms^~ky&t0,t[10]=o0^~w0&Un,t[11]=a0^~E0&$t,t[20]=Vy^~Xy&l0,t[21]=Hy^~Zy&f0,t[30]=y0^~ws&jy,t[31]=m0^~sr&Qy,t[40]=Yy^~u0&v0,t[41]=Jy^~c0&A0,t[2]=Gy^~e0&h0,t[3]=ky^~t0&d0,t[12]=w0^~Un&Wy,t[13]=E0^~$t&$y,t[22]=Xy^~l0&b0,t[23]=Zy^~f0&_0,t[32]=ws^~jy&r0,t[33]=sr^~Qy&n0,t[42]=u0^~v0&Dt,t[43]=c0^~A0&$e,t[4]=e0^~h0&I0,t[5]=t0^~d0&S0,t[14]=Un^~Wy&i0,t[15]=$t^~$y&s0,t[24]=l0^~b0&Uy,t[25]=f0^~_0&qy,t[34]=jy^~r0&p0,t[35]=Qy^~n0&g0,t[44]=v0^~Dt&zy,t[45]=A0^~$e&Ky,t[6]=h0^~I0&hi,t[7]=d0^~S0&ms,t[16]=Wy^~i0&o0,t[17]=$y^~s0&a0,t[26]=b0^~Uy&Vy,t[27]=_0^~qy&Hy,t[36]=r0^~p0&y0,t[37]=n0^~g0&m0,t[46]=Dt^~zy&Yy,t[47]=$e^~Ky&Jy,t[8]=I0^~hi&Gy,t[9]=S0^~ms&ky,t[18]=i0^~o0&w0,t[19]=s0^~a0&E0,t[28]=Uy^~Vy&Xy,t[29]=qy^~Hy&Zy,t[38]=p0^~y0&ws,t[39]=g0^~m0&sr,t[48]=zy^~Yy&u0,t[49]=Ky^~Jy&c0,t[0]^=TO[e*2],t[1]^=TO[e*2+1]}}});var OO=m((Ice,NO)=>{c();var Id=xO();function da(){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}da.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};da.prototype.absorb=function(t){for(let e=0;e>>8*(this.count%4)&255,this.count+=1,this.count===this.blockSize&&(Id.p1600(this.state),this.count=0);return e};da.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};NO.exports=da});var av=m((Tce,DO)=>{c();DO.exports=SO()(OO())});var fv=m(pa=>{"use strict";c();var kj=pa&&pa.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(pa,"__esModule",{value:!0});pa.SmartContract=void 0;var jj=kj(Gt()),Cc=ht(),uv=Uh(),Qj=Be(),cv=wn(),Wj=wr(),$j=ac(),PO=cE(),RO=wc(),BO=wE(),zj=AE(),Kj=Ec(),Sd=xE(),Yj=av(),lv=class{constructor(e={}){this.address=new Cc.Address,this.methodsExplicit={},this.methods={},this.address=e.address||new Cc.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 RO.ContractFunction(i);return new BO.Interaction(e,o,s||[])},this.methods[i]=function(s){let o=new RO.ContractFunction(i),a=zj.NativeSerializer.nativeToTypedValues(s||[],n);return new BO.Interaction(e,o,a||[])}}}setAddress(e){this.address=e}getAddress(){return this.address}getAbi(){return Wj.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}){uv.Compatibility.guardAddressIsSetAndNonZero(e,"'deployer' of SmartContract.deploy()","pass the actual address to deploy()"),n=n||new PO.CodeMetadata,i=i||[],s=s||0;let l=new Sd.ContractDeployPayloadBuilder().setCode(r).setCodeMetadata(n).setInitArgs(i).build();return new cv.Transaction({receiver:Cc.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}){uv.Compatibility.guardAddressIsSetAndNonZero(e,"'caller' of SmartContract.upgrade()","pass the actual address to upgrade()"),this.ensureHasAddress(),n=n||new PO.CodeMetadata,i=i||[],s=s||0;let l=new Sd.ContractUpgradePayloadBuilder().setCode(r).setCodeMetadata(n).setInitArgs(i).build();return new cv.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}){uv.Compatibility.guardAddressIsSetAndNonZero(u,"'caller' of SmartContract.call()","pass the actual address to call()"),this.ensureHasAddress(),r=r||[],n=n||0;let l=new Sd.ContractCallPayloadBuilder().setFunction(e).setArgs(r).build();return new cv.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 Kj.Query({address:this.getAddress(),func:e,args:r,value:n,caller:i})}ensureHasAddress(){if(!this.getAddress().bech32())throw new Qj.ErrContractHasNoAddress}static computeAddress(e,r){let n=h.Buffer.alloc(8,0),i=new Cc.Address(e.bech32()).pubkey(),s=i.slice(30),o=h.Buffer.alloc(8),a=new jj.default(r.valueOf().toString(10)),u=$j.bigIntToBuffer(a);o.write(u.reverse().toString("hex"),"hex");let l=h.Buffer.concat([i,o]),f=Yj("keccak256").update(l).digest(),d=h.Buffer.from(Sd.ArwenVirtualMachine,"hex"),g=h.Buffer.concat([n,d,f.slice(10,30),s]);return new Cc.Address(g)}};pa.SmartContract=lv});var LO=m(Bi=>{"use strict";c();Object.defineProperty(Bi,"__esModule",{value:!0});Bi.ErrAccountNotConnected=Bi.ErrCannotSignSingleTransaction=Bi.Err=void 0;var xc=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};Bi.Err=xc;var hv=class extends xc{constructor(){super("Cannot sign single transaction.")}};Bi.ErrCannotSignSingleTransaction=hv;var dv=class extends xc{constructor(){super("Account is not connected.")}};Bi.ErrAccountNotConnected=dv});var FO=m(Nc=>{"use strict";c();Object.defineProperty(Nc,"__esModule",{value:!0});Nc.Operation=void 0;var Jj;(function(t){t.Connect="connect",t.Logout="logout",t.SignTransactions="signTransactions",t.SignMessage="signMessage",t.CancelAction="cancelAction"})(Jj=Nc.Operation||(Nc.Operation={}))});var pv=m(ga=>{"use strict";c();var Li=ga&&ga.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{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(ga,"__esModule",{value:!0});ga.ExtensionProvider=void 0;var Xj=wn(),MO=LO(),Oc=FO(),Dc=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 Li(this,void 0,void 0,function*(){return window&&window.elrondWallet&&(this.initialized=!0),this.initialized})}login(e={}){return Li(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(Oc.Operation.Connect,n),this.account.address})}logout(){return Li(this,void 0,void 0,function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");try{yield this.startBgrMsgChannel(Oc.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 Li(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 Li(this,void 0,void 0,function*(){return!!this.account.address})}signTransaction(e){return Li(this,void 0,void 0,function*(){this.ensureConnected();let r=yield this.signTransactions([e]);if(r.length!=1)throw new MO.ErrCannotSignSingleTransaction;return r[0]})}ensureConnected(){if(!this.account.address)throw new MO.ErrAccountNotConnected}signTransactions(e){return Li(this,void 0,void 0,function*(){this.ensureConnected();let r=yield this.startBgrMsgChannel(Oc.Operation.SignTransactions,{from:this.account.address,transactions:e.map(n=>n.toPlainObject())});try{return r.map(i=>Xj.Transaction.fromPlainObject(i))}catch(n){throw new Error(`Transaction canceled: ${n.message}.`)}})}signMessage(e){return Li(this,void 0,void 0,function*(){this.ensureConnected();let r={account:this.account.address,message:e.message.toString()},i=(yield this.startBgrMsgChannel(Oc.Operation.SignMessage,r)).signature,s=h.Buffer.from(i,"hex");return e.applySignature(s),e})}cancelAction(){return this.startBgrMsgChannel(Oc.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)})}};ga.ExtensionProvider=Dc;Dc._instance=new Dc});var Er={};ft(Er,{__assign:()=>yv,__asyncDelegator:()=>fQ,__asyncGenerator:()=>lQ,__asyncValues:()=>hQ,__await:()=>Pc,__awaiter:()=>iQ,__classPrivateFieldGet:()=>yQ,__classPrivateFieldSet:()=>mQ,__createBinding:()=>oQ,__decorate:()=>tQ,__exportStar:()=>aQ,__extends:()=>Zj,__generator:()=>sQ,__importDefault:()=>gQ,__importStar:()=>pQ,__makeTemplateObject:()=>dQ,__metadata:()=>nQ,__param:()=>rQ,__read:()=>GO,__rest:()=>eQ,__spread:()=>uQ,__spreadArrays:()=>cQ,__values:()=>mv});function Zj(t,e){gv(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function eQ(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 rQ(t,e){return function(r,n){e(r,n,t)}}function nQ(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function iQ(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 sQ(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 GO(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 uQ(){for(var t=[],e=0;e1||a(g,w)})})}function a(g,w){try{u(n[g](w))}catch(E){d(s[0][3],E)}}function u(g){g.value instanceof Pc?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,w){g(w),s.shift(),s.length&&a(s[0][0],s[0][1])}}function fQ(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:Pc(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function hQ(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 mv=="function"?mv(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 dQ(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function pQ(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 gQ(t){return t&&t.__esModule?t:{default:t}}function yQ(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function mQ(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 gv,yv,vr=ge(()=>{c();gv=function(t,e){return gv=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])},gv(t,e)};yv=function(){return yv=Object.assign||function(e){for(var r,n=1,i=arguments.length;n{"use strict";c();Object.defineProperty(Nd,"__esModule",{value:!0});function wQ(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}}Nd.safeJsonParse=wQ;function EQ(t){return typeof t=="string"?t:JSON.stringify(t,(e,r)=>typeof r>"u"?null:r)}Nd.safeJsonStringify=EQ});var kO=m(($ce,Od)=>{"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?Od.exports=global.localStorage:typeof window<"u"&&window.localStorage?Od.exports=window.localStorage:Od.exports=new e})()});var jO=m(Dd=>{"use strict";c();Object.defineProperty(Dd,"__esModule",{value:!0});Dd.IKeyValueStorage=void 0;var Ev=class{};Dd.IKeyValueStorage=Ev});var QO=m(Pd=>{"use strict";c();Object.defineProperty(Pd,"__esModule",{value:!0});Pd.parseEntry=void 0;var vQ=wv();function AQ(t){var e;return[t[0],vQ.safeJsonParse((e=t[1])!==null&&e!==void 0?e:"")]}Pd.parseEntry=AQ});var $O=m(Rd=>{"use strict";c();Object.defineProperty(Rd,"__esModule",{value:!0});var WO=(vr(),ct(Er));WO.__exportStar(jO(),Rd);WO.__exportStar(QO(),Rd)});var KO=m(Rc=>{"use strict";c();Object.defineProperty(Rc,"__esModule",{value:!0});Rc.KeyValueStorage=void 0;var ya=(vr(),ct(Er)),zO=wv(),bQ=ya.__importDefault(kO()),_Q=$O(),Bd=class{constructor(){this.localStorage=bQ.default}getKeys(){return ya.__awaiter(this,void 0,void 0,function*(){return Object.keys(this.localStorage)})}getEntries(){return ya.__awaiter(this,void 0,void 0,function*(){return Object.entries(this.localStorage).map(_Q.parseEntry)})}getItem(e){return ya.__awaiter(this,void 0,void 0,function*(){let r=this.localStorage.getItem(e);if(r!==null)return zO.safeJsonParse(r)})}setItem(e,r){return ya.__awaiter(this,void 0,void 0,function*(){this.localStorage.setItem(e,zO.safeJsonStringify(r))})}removeItem(e){return ya.__awaiter(this,void 0,void 0,function*(){this.localStorage.removeItem(e)})}};Rc.KeyValueStorage=Bd;Rc.default=Bd});var YO=m(Ld=>{"use strict";c();Object.defineProperty(Ld,"__esModule",{value:!0});Ld.delay=void 0;function IQ(t){return new Promise(e=>{setTimeout(()=>{e(!0)},t)})}Ld.delay=IQ});var JO=m(ma=>{"use strict";c();Object.defineProperty(ma,"__esModule",{value:!0});ma.ONE_THOUSAND=ma.ONE_HUNDRED=void 0;ma.ONE_HUNDRED=100;ma.ONE_THOUSAND=1e3});var XO=m(de=>{"use strict";c();Object.defineProperty(de,"__esModule",{value:!0});de.ONE_YEAR=de.FOUR_WEEKS=de.THREE_WEEKS=de.TWO_WEEKS=de.ONE_WEEK=de.THIRTY_DAYS=de.SEVEN_DAYS=de.FIVE_DAYS=de.THREE_DAYS=de.ONE_DAY=de.TWENTY_FOUR_HOURS=de.TWELVE_HOURS=de.SIX_HOURS=de.THREE_HOURS=de.ONE_HOUR=de.SIXTY_MINUTES=de.THIRTY_MINUTES=de.TEN_MINUTES=de.FIVE_MINUTES=de.ONE_MINUTE=de.SIXTY_SECONDS=de.THIRTY_SECONDS=de.TEN_SECONDS=de.FIVE_SECONDS=de.ONE_SECOND=void 0;de.ONE_SECOND=1;de.FIVE_SECONDS=5;de.TEN_SECONDS=10;de.THIRTY_SECONDS=30;de.SIXTY_SECONDS=60;de.ONE_MINUTE=de.SIXTY_SECONDS;de.FIVE_MINUTES=de.ONE_MINUTE*5;de.TEN_MINUTES=de.ONE_MINUTE*10;de.THIRTY_MINUTES=de.ONE_MINUTE*30;de.SIXTY_MINUTES=de.ONE_MINUTE*60;de.ONE_HOUR=de.SIXTY_MINUTES;de.THREE_HOURS=de.ONE_HOUR*3;de.SIX_HOURS=de.ONE_HOUR*6;de.TWELVE_HOURS=de.ONE_HOUR*12;de.TWENTY_FOUR_HOURS=de.ONE_HOUR*24;de.ONE_DAY=de.TWENTY_FOUR_HOURS;de.THREE_DAYS=de.ONE_DAY*3;de.FIVE_DAYS=de.ONE_DAY*5;de.SEVEN_DAYS=de.ONE_DAY*7;de.THIRTY_DAYS=de.ONE_DAY*30;de.ONE_WEEK=de.SEVEN_DAYS;de.TWO_WEEKS=de.ONE_WEEK*2;de.THREE_WEEKS=de.ONE_WEEK*3;de.FOUR_WEEKS=de.ONE_WEEK*4;de.ONE_YEAR=de.ONE_DAY*365});var vv=m(Fd=>{"use strict";c();Object.defineProperty(Fd,"__esModule",{value:!0});var ZO=(vr(),ct(Er));ZO.__exportStar(JO(),Fd);ZO.__exportStar(XO(),Fd)});var t2=m(wa=>{"use strict";c();Object.defineProperty(wa,"__esModule",{value:!0});wa.fromMiliseconds=wa.toMiliseconds=void 0;var e2=vv();function SQ(t){return t*e2.ONE_THOUSAND}wa.toMiliseconds=SQ;function TQ(t){return Math.floor(t/e2.ONE_THOUSAND)}wa.fromMiliseconds=TQ});var n2=m(Md=>{"use strict";c();Object.defineProperty(Md,"__esModule",{value:!0});var r2=(vr(),ct(Er));r2.__exportStar(YO(),Md);r2.__exportStar(t2(),Md)});var i2=m(Bc=>{"use strict";c();Object.defineProperty(Bc,"__esModule",{value:!0});Bc.Watch=void 0;var Ud=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}};Bc.Watch=Ud;Bc.default=Ud});var s2=m(qd=>{"use strict";c();Object.defineProperty(qd,"__esModule",{value:!0});qd.IWatch=void 0;var Av=class{};qd.IWatch=Av});var o2=m(bv=>{"use strict";c();Object.defineProperty(bv,"__esModule",{value:!0});var CQ=(vr(),ct(Er));CQ.__exportStar(s2(),bv)});var ks=m(Ea=>{"use strict";c();Object.defineProperty(Ea,"__esModule",{value:!0});var Vd=(vr(),ct(Er));Vd.__exportStar(n2(),Ea);Vd.__exportStar(i2(),Ea);Vd.__exportStar(o2(),Ea);Vd.__exportStar(vv(),Ea)});var _v,a2=ge(()=>{c();_v=class{}});var Iv={};ft(Iv,{IEvents:()=>_v});var Sv=ge(()=>{c();a2()});var u2=m(Hd=>{"use strict";c();Object.defineProperty(Hd,"__esModule",{value:!0});Hd.IHeartBeat=void 0;var xQ=(Sv(),ct(Iv)),Tv=class extends xQ.IEvents{constructor(e){super()}};Hd.IHeartBeat=Tv});var xv=m(Cv=>{"use strict";c();Object.defineProperty(Cv,"__esModule",{value:!0});var NQ=(vr(),ct(Er));NQ.__exportStar(u2(),Cv)});var c2=m(va=>{"use strict";c();Object.defineProperty(va,"__esModule",{value:!0});va.HEARTBEAT_EVENTS=va.HEARTBEAT_INTERVAL=void 0;var OQ=ks();va.HEARTBEAT_INTERVAL=OQ.FIVE_SECONDS;va.HEARTBEAT_EVENTS={pulse:"heartbeat_pulse"}});var Ov=m(Nv=>{"use strict";c();Object.defineProperty(Nv,"__esModule",{value:!0});var DQ=(vr(),ct(Er));DQ.__exportStar(c2(),Nv)});var l2=m(Gd=>{"use strict";c();Object.defineProperty(Gd,"__esModule",{value:!0});Gd.HeartBeat=void 0;var Dv=(vr(),ct(Er)),PQ=Kn(),RQ=ks(),BQ=xv(),Pv=Ov(),Rv=class t extends BQ.IHeartBeat{constructor(e){super(e),this.events=new PQ.EventEmitter,this.interval=Pv.HEARTBEAT_INTERVAL,this.interval=e?.interval||Pv.HEARTBEAT_INTERVAL}static init(e){return Dv.__awaiter(this,void 0,void 0,function*(){let r=new t(e);return yield r.init(),r})}init(){return Dv.__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 Dv.__awaiter(this,void 0,void 0,function*(){this.intervalRef=setInterval(()=>this.pulse(),RQ.toMiliseconds(this.interval))})}pulse(){this.events.emit(Pv.HEARTBEAT_EVENTS.pulse)}};Gd.HeartBeat=Rv});var f2=m(Lc=>{"use strict";c();Object.defineProperty(Lc,"__esModule",{value:!0});var Bv=(vr(),ct(Er));Bv.__exportStar(l2(),Lc);Bv.__exportStar(xv(),Lc);Bv.__exportStar(Ov(),Lc)});var d2=m((qle,h2)=>{"use strict";c();function LQ(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}h2.exports=FQ;function FQ(t,e,r){var n=r&&r.stringify||LQ,i=1;if(typeof t=="object"&&t!==null){var s=e.length+i;if(s===1)return t;var o=new Array(s);o[0]=n(t);for(var a=1;a-1?d:0,t.charCodeAt(w+1)){case 100:case 102:if(f>=u||e[f]==null)break;d=u||e[f]==null)break;d=u||e[f]===void 0)break;d",d=w+2,w++;break}l+=n(e[f]),d=w+2,w++;break;case 115:if(f>=u)break;d{"use strict";c();var p2=d2();m2.exports=_n;var Fc=WQ().console||{},MQ={mapHttpRequest:kd,mapHttpResponse:kd,wrapRequestSerializer:Lv,wrapResponseSerializer:Lv,wrapErrorSerializer:Lv,req:kd,res:kd,err:GQ};function UQ(t,e){return Array.isArray(t)?t.filter(function(n){return n!=="!stdSerializers.err"}):t===!0?Object.keys(e):!1}function _n(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||Fc;t.browser.write&&(t.browser.asObject=!0);let n=t.serializers||{},i=UQ(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=Mc),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:kQ(t)};u.levels=_n.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=Mc,u.serializers=n,u._serialize=i,u._stdErrSerialize=s,u.child=w,e&&(u._logEvent=Fv());function f(){return this.level==="silent"?1/0:this.levels.values[this.level]}function d(){return this._level}function g(E){if(E!=="silent"&&!this.levels.values[E])throw Error("unknown level "+E);this._level=E,Aa(l,u,"error","log"),Aa(l,u,"fatal","error"),Aa(l,u,"warn","error"),Aa(l,u,"info","log"),Aa(l,u,"debug","log"),Aa(l,u,"trace","log")}function w(E,T){if(!E)throw new Error("missing bindings for child Pino");T=T||{},i&&E.serializers&&(T.serializers=E.serializers);let D=T.serializers;if(i&&D){var B=Object.assign({},n,D),W=t.browser.serialize===!0?Object.keys(B):i;delete E.serializers,jd([E],W,B,this._stdErrSerialize)}function U(A){this._childLevel=(A._childLevel|0)+1,this.error=ba(A,E,"error"),this.fatal=ba(A,E,"fatal"),this.warn=ba(A,E,"warn"),this.info=ba(A,E,"info"),this.debug=ba(A,E,"debug"),this.trace=ba(A,E,"trace"),B&&(this.serializers=B,this._serialize=W),e&&(this._logEvent=Fv([].concat(A._logEvent.bindings,E)))}return U.prototype=this,new U(this)}return u}_n.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"}};_n.stdSerializers=MQ;_n.stdTimeFunctions=Object.assign({},{nullTime:g2,epochTime:y2,unixTime:jQ,isoTime:QQ});function Aa(t,e,r,n){let i=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?Mc:i[r]?i[r]:Fc[r]||Fc[n]||Mc,qQ(t,e,r)}function qQ(t,e,r){!t.transmit&&e[r]===Mc||(e[r]=function(n){return function(){let s=t.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Fc?Fc:this;for(var u=0;u-1&&s in r&&(t[i][s]=r[s](t[i][s]))}function ba(t,e,r){return function(){let n=new Array(1+arguments.length);n[0]=e;for(var i=1;i{"use strict";c();Object.defineProperty(_a,"__esModule",{value:!0});_a.PINO_CUSTOM_CONTEXT_KEY=_a.PINO_LOGGER_DEFAULTS=void 0;_a.PINO_LOGGER_DEFAULTS={level:"info"};_a.PINO_CUSTOM_CONTEXT_KEY="custom_context"});var _2=m(dr=>{"use strict";c();Object.defineProperty(dr,"__esModule",{value:!0});dr.generateChildLogger=dr.formatChildLoggerContext=dr.getLoggerContext=dr.setBrowserLoggerContext=dr.getBrowserLoggerContext=dr.getDefaultLoggerOptions=void 0;var Ia=Mv();function $Q(t){return Object.assign(Object.assign({},t),{level:t?.level||Ia.PINO_LOGGER_DEFAULTS.level})}dr.getDefaultLoggerOptions=$Q;function E2(t,e=Ia.PINO_CUSTOM_CONTEXT_KEY){return t[e]||""}dr.getBrowserLoggerContext=E2;function v2(t,e,r=Ia.PINO_CUSTOM_CONTEXT_KEY){return t[r]=e,t}dr.setBrowserLoggerContext=v2;function A2(t,e=Ia.PINO_CUSTOM_CONTEXT_KEY){let r="";return typeof t.bindings>"u"?r=E2(t,e):r=t.bindings().context||"",r}dr.getLoggerContext=A2;function b2(t,e,r=Ia.PINO_CUSTOM_CONTEXT_KEY){let n=A2(t,r);return n.trim()?`${n}/${e}`:e}dr.formatChildLoggerContext=b2;function zQ(t,e,r=Ia.PINO_CUSTOM_CONTEXT_KEY){let n=b2(t,e,r),i=t.child({context:n});return v2(i,n,r)}dr.generateChildLogger=zQ});var qv=m(Sa=>{"use strict";c();Object.defineProperty(Sa,"__esModule",{value:!0});Sa.pino=void 0;var Uv=(vr(),ct(Er)),KQ=Uv.__importDefault(w2());Object.defineProperty(Sa,"pino",{enumerable:!0,get:function(){return KQ.default}});Uv.__exportStar(Mv(),Sa);Uv.__exportStar(_2(),Sa)});var n1=m(Pt=>{"use strict";c();Object.defineProperty(Pt,"__esModule",{value:!0});var Ta=(Sv(),ct(Iv)),I2=Kn();function YQ(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var JQ=YQ(I2),Vv=class extends Ta.IEvents{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},Hv=class{constructor(e,r,n){this.core=e,this.logger=r}},Gv=class extends Ta.IEvents{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}},kv=class{constructor(e,r){this.logger=e,this.core=r}},jv=class extends Ta.IEvents{constructor(e,r){super(),this.relayer=e,this.logger=r}},Qv=class extends Ta.IEvents{constructor(e){super()}},Wv=class{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}},$v=class{constructor(){this.map=new Map}},zv=class extends Ta.IEvents{constructor(e,r){super(),this.relayer=e,this.logger=r}},Kv=class{constructor(e,r){this.core=e,this.logger=r}},Yv=class extends Ta.IEvents{constructor(e,r){super(),this.core=e,this.logger=r}},Jv=class{constructor(e,r){this.logger=e,this.core=r}},Xv=class{constructor(e,r){this.projectId=e,this.logger=r}},Zv=class extends JQ.default{constructor(){super()}},e1=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},t1=class extends I2.EventEmitter{constructor(){super()}},r1=class{constructor(e){this.client=e}};Pt.ICore=Vv,Pt.ICrypto=Hv,Pt.IEngine=r1,Pt.IEngineEvents=t1,Pt.IExpirer=Yv,Pt.IJsonRpcHistory=Gv,Pt.IKeyChain=Kv,Pt.IMessageTracker=kv,Pt.IPairing=Jv,Pt.IPublisher=jv,Pt.IRelayer=Qv,Pt.ISignClient=e1,Pt.ISignClientEvents=Zv,Pt.IStore=Wv,Pt.ISubscriber=zv,Pt.ISubscriberTopicMap=$v,Pt.IVerify=Xv});var S2={};ft(S2,{safeJsonParse:()=>Uc,safeJsonStringify:()=>qc});function Uc(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return ZQ(t)}catch{return t}}function qc(t){return typeof t=="string"?t:XQ(t)||""}var XQ,ZQ,Qd=ge(()=>{c();XQ=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),ZQ=t=>{let e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,r=t.replace(e,'$1"$2n"$3');return JSON.parse(r,(n,i)=>typeof i=="string"&&i.match(/^\d+n$/)?BigInt(i.substring(0,i.length-1)):i)}});var C2=m(Wd=>{"use strict";c();Object.defineProperty(Wd,"__esModule",{value:!0});Wd.BrowserRandomSource=void 0;var T2=65536,i1=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(s1,"__esModule",{value:!0});function e7(t){for(var e=0;e{c()});var N2=m($d=>{"use strict";c();Object.defineProperty($d,"__esModule",{value:!0});$d.NodeRandomSource=void 0;var t7=qr(),o1=class{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof JI<"u"){let e=x2();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(zd,"__esModule",{value:!0});zd.SystemRandomSource=void 0;var r7=C2(),n7=N2(),a1=class{constructor(){if(this.isAvailable=!1,this.name="",this._source=new r7.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new n7.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)}};zd.SystemRandomSource=a1});var D2=m(Ar=>{"use strict";c();Object.defineProperty(Ar,"__esModule",{value:!0});function i7(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}Ar.mul=Math.imul||i7;function s7(t,e){return t+e|0}Ar.add=s7;function o7(t,e){return t-e|0}Ar.sub=o7;function a7(t,e){return t<>>32-e}Ar.rotl=a7;function u7(t,e){return t<<32-e|t>>>e}Ar.rotr=u7;function c7(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t}Ar.isInteger=Number.isInteger||c7;Ar.MAX_SAFE_INTEGER=9007199254740991;Ar.isSafeInteger=function(t){return Ar.isInteger(t)&&t>=-Ar.MAX_SAFE_INTEGER&&t<=Ar.MAX_SAFE_INTEGER}});var Ca=m(Ne=>{"use strict";c();Object.defineProperty(Ne,"__esModule",{value:!0});var P2=D2();function l7(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}Ne.readInt16BE=l7;function f7(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}Ne.readUint16BE=f7;function h7(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}Ne.readInt16LE=h7;function d7(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}Ne.readUint16LE=d7;function R2(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}Ne.writeUint16BE=R2;Ne.writeInt16BE=R2;function B2(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}Ne.writeUint16LE=B2;Ne.writeInt16LE=B2;function u1(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}Ne.readInt32BE=u1;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 l1(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}Ne.readInt32LE=l1;function f1(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=f1;function Kd(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=Kd;Ne.writeInt32BE=Kd;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 p7(t,e){e===void 0&&(e=0);var r=u1(t,e),n=u1(t,e+4);return r*4294967296+n-(n>>31)*4294967296}Ne.readInt64BE=p7;function g7(t,e){e===void 0&&(e=0);var r=c1(t,e),n=c1(t,e+4);return r*4294967296+n}Ne.readUint64BE=g7;function y7(t,e){e===void 0&&(e=0);var r=l1(t,e),n=l1(t,e+4);return n*4294967296+r-(r>>31)*4294967296}Ne.readInt64LE=y7;function m7(t,e){e===void 0&&(e=0);var r=f1(t,e),n=f1(t,e+4);return n*4294967296+r}Ne.readUint64LE=m7;function L2(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),Kd(t/4294967296>>>0,e,r),Kd(t>>>0,e,r+4),e}Ne.writeUint64BE=L2;Ne.writeInt64BE=L2;function F2(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=F2;Ne.writeInt64LE=F2;function w7(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=w7;function E7(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=v7;function A7(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(!P2.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,s=n;s{"use strict";c();Object.defineProperty(Jt,"__esModule",{value:!0});Jt.randomStringForEntropy=Jt.randomString=Jt.randomUint32=Jt.randomBytes=Jt.defaultRandomSource=void 0;var O7=O2(),D7=Ca(),M2=qr();Jt.defaultRandomSource=new O7.SystemRandomSource;function h1(t,e=Jt.defaultRandomSource){return e.randomBytes(t)}Jt.randomBytes=h1;function P7(t=Jt.defaultRandomSource){let e=h1(4,t),r=(0,D7.readUint32LE)(e);return(0,M2.wipe)(e),r}Jt.randomUint32=P7;var U2="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function q2(t,e=U2,r=Jt.defaultRandomSource){if(e.length<2)throw new Error("randomString charset is too short");if(e.length>256)throw new Error("randomString charset is too long");let n="",i=e.length,s=256-256%i;for(;t>0;){let o=h1(Math.ceil(t*256/s),r);for(let a=0;a0;a++){let u=o[a];u{"use strict";c();Object.defineProperty(Jn,"__esModule",{value:!0});var Na=Ca(),xa=qr();Jn.DIGEST_LENGTH=64;Jn.BLOCK_SIZE=128;var H2=function(){function t(){this.digestLength=Jn.DIGEST_LENGTH,this.blockSize=Jn.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(){xa.wipe(this._buffer),xa.wipe(this._tempHi),xa.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&&(d1(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(n=d1(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){xa.wipe(e.stateHi),xa.wipe(e.stateLo),e.buffer&&xa.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},t}();Jn.SHA512=H2;var V2=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 d1(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],w=r[6],E=r[7],T=n[0],D=n[1],B=n[2],W=n[3],U=n[4],A=n[5],I=n[6],N=n[7],_,S,R,J,Q,V,k,K;o>=128;){for(var pe=0;pe<16;pe++){var ue=8*pe+s;t[pe]=Na.readUint32BE(i,ue),e[pe]=Na.readUint32BE(i,ue+4)}for(var pe=0;pe<80;pe++){var re=a,Y=u,se=l,te=f,ie=d,M=g,le=w,ae=E,fe=T,oe=D,ce=B,y=W,v=U,b=A,P=I,C=N;if(_=E,S=N,Q=S&65535,V=S>>>16,k=_&65535,K=_>>>16,_=(d>>>14|U<<32-14)^(d>>>18|U<<32-18)^(U>>>41-32|d<<32-(41-32)),S=(U>>>14|d<<32-14)^(U>>>18|d<<32-18)^(d>>>41-32|U<<32-(41-32)),Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,_=d&g^~d&w,S=U&A^~U&I,Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,_=V2[pe*2],S=V2[pe*2+1],Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,_=t[pe%16],S=e[pe%16],Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,R=k&65535|K<<16,J=Q&65535|V<<16,_=R,S=J,Q=S&65535,V=S>>>16,k=_&65535,K=_>>>16,_=(a>>>28|T<<32-28)^(T>>>34-32|a<<32-(34-32))^(T>>>39-32|a<<32-(39-32)),S=(T>>>28|a<<32-28)^(a>>>34-32|T<<32-(34-32))^(a>>>39-32|T<<32-(39-32)),Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,_=a&u^a&l^u&l,S=T&D^T&B^D&B,Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,ae=k&65535|K<<16,C=Q&65535|V<<16,_=te,S=y,Q=S&65535,V=S>>>16,k=_&65535,K=_>>>16,_=R,S=J,Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,te=k&65535|K<<16,y=Q&65535|V<<16,u=re,l=Y,f=se,d=te,g=ie,w=M,E=le,a=ae,D=fe,B=oe,W=ce,U=y,A=v,I=b,N=P,T=C,pe%16===15)for(var ue=0;ue<16;ue++)_=t[ue],S=e[ue],Q=S&65535,V=S>>>16,k=_&65535,K=_>>>16,_=t[(ue+9)%16],S=e[(ue+9)%16],Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,R=t[(ue+1)%16],J=e[(ue+1)%16],_=(R>>>1|J<<32-1)^(R>>>8|J<<32-8)^R>>>7,S=(J>>>1|R<<32-1)^(J>>>8|R<<32-8)^(J>>>7|R<<32-7),Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,R=t[(ue+14)%16],J=e[(ue+14)%16],_=(R>>>19|J<<32-19)^(J>>>61-32|R<<32-(61-32))^R>>>6,S=(J>>>19|R<<32-19)^(R>>>61-32|J<<32-(61-32))^(J>>>6|R<<32-6),Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,t[ue]=k&65535|K<<16,e[ue]=Q&65535|V<<16}_=a,S=T,Q=S&65535,V=S>>>16,k=_&65535,K=_>>>16,_=r[0],S=n[0],Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,r[0]=a=k&65535|K<<16,n[0]=T=Q&65535|V<<16,_=u,S=D,Q=S&65535,V=S>>>16,k=_&65535,K=_>>>16,_=r[1],S=n[1],Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,r[1]=u=k&65535|K<<16,n[1]=D=Q&65535|V<<16,_=l,S=B,Q=S&65535,V=S>>>16,k=_&65535,K=_>>>16,_=r[2],S=n[2],Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,r[2]=l=k&65535|K<<16,n[2]=B=Q&65535|V<<16,_=f,S=W,Q=S&65535,V=S>>>16,k=_&65535,K=_>>>16,_=r[3],S=n[3],Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,r[3]=f=k&65535|K<<16,n[3]=W=Q&65535|V<<16,_=d,S=U,Q=S&65535,V=S>>>16,k=_&65535,K=_>>>16,_=r[4],S=n[4],Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,r[4]=d=k&65535|K<<16,n[4]=U=Q&65535|V<<16,_=g,S=A,Q=S&65535,V=S>>>16,k=_&65535,K=_>>>16,_=r[5],S=n[5],Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,r[5]=g=k&65535|K<<16,n[5]=A=Q&65535|V<<16,_=w,S=I,Q=S&65535,V=S>>>16,k=_&65535,K=_>>>16,_=r[6],S=n[6],Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,r[6]=w=k&65535|K<<16,n[6]=I=Q&65535|V<<16,_=E,S=N,Q=S&65535,V=S>>>16,k=_&65535,K=_>>>16,_=r[7],S=n[7],Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,r[7]=E=k&65535|K<<16,n[7]=N=Q&65535|V<<16,s+=128,o-=128}return s}function B7(t){var e=new H2;e.update(t);var r=e.digest();return e.clean(),r}Jn.hash=B7});var rD=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 L7=Vc(),Hc=G2(),$2=qr();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,z2(n,r,1-s)}for(let i=0;i<16;i++)t[2*i]=n[i]&255,t[2*i+1]=n[i]>>8}function K2(t,e){let r=0;for(let n=0;n<32;n++)r|=t[n]^e[n];return(1&r-1>>>8)-1}function Q2(t,e){let r=new Uint8Array(32),n=new Uint8Array(32);return Gc(r,t),Gc(n,e),K2(r,n)}function Y2(t){let e=new Uint8Array(32);return Gc(e,t),e[0]&1}function V7(t,e){for(let r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function js(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]+r[n]}function Ws(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]-r[n]}function je(t,e,r){let n,i,s=0,o=0,a=0,u=0,l=0,f=0,d=0,g=0,w=0,E=0,T=0,D=0,B=0,W=0,U=0,A=0,I=0,N=0,_=0,S=0,R=0,J=0,Q=0,V=0,k=0,K=0,pe=0,ue=0,re=0,Y=0,se=0,te=r[0],ie=r[1],M=r[2],le=r[3],ae=r[4],fe=r[5],oe=r[6],ce=r[7],y=r[8],v=r[9],b=r[10],P=r[11],C=r[12],O=r[13],L=r[14],x=r[15];n=e[0],s+=n*te,o+=n*ie,a+=n*M,u+=n*le,l+=n*ae,f+=n*fe,d+=n*oe,g+=n*ce,w+=n*y,E+=n*v,T+=n*b,D+=n*P,B+=n*C,W+=n*O,U+=n*L,A+=n*x,n=e[1],o+=n*te,a+=n*ie,u+=n*M,l+=n*le,f+=n*ae,d+=n*fe,g+=n*oe,w+=n*ce,E+=n*y,T+=n*v,D+=n*b,B+=n*P,W+=n*C,U+=n*O,A+=n*L,I+=n*x,n=e[2],a+=n*te,u+=n*ie,l+=n*M,f+=n*le,d+=n*ae,g+=n*fe,w+=n*oe,E+=n*ce,T+=n*y,D+=n*v,B+=n*b,W+=n*P,U+=n*C,A+=n*O,I+=n*L,N+=n*x,n=e[3],u+=n*te,l+=n*ie,f+=n*M,d+=n*le,g+=n*ae,w+=n*fe,E+=n*oe,T+=n*ce,D+=n*y,B+=n*v,W+=n*b,U+=n*P,A+=n*C,I+=n*O,N+=n*L,_+=n*x,n=e[4],l+=n*te,f+=n*ie,d+=n*M,g+=n*le,w+=n*ae,E+=n*fe,T+=n*oe,D+=n*ce,B+=n*y,W+=n*v,U+=n*b,A+=n*P,I+=n*C,N+=n*O,_+=n*L,S+=n*x,n=e[5],f+=n*te,d+=n*ie,g+=n*M,w+=n*le,E+=n*ae,T+=n*fe,D+=n*oe,B+=n*ce,W+=n*y,U+=n*v,A+=n*b,I+=n*P,N+=n*C,_+=n*O,S+=n*L,R+=n*x,n=e[6],d+=n*te,g+=n*ie,w+=n*M,E+=n*le,T+=n*ae,D+=n*fe,B+=n*oe,W+=n*ce,U+=n*y,A+=n*v,I+=n*b,N+=n*P,_+=n*C,S+=n*O,R+=n*L,J+=n*x,n=e[7],g+=n*te,w+=n*ie,E+=n*M,T+=n*le,D+=n*ae,B+=n*fe,W+=n*oe,U+=n*ce,A+=n*y,I+=n*v,N+=n*b,_+=n*P,S+=n*C,R+=n*O,J+=n*L,Q+=n*x,n=e[8],w+=n*te,E+=n*ie,T+=n*M,D+=n*le,B+=n*ae,W+=n*fe,U+=n*oe,A+=n*ce,I+=n*y,N+=n*v,_+=n*b,S+=n*P,R+=n*C,J+=n*O,Q+=n*L,V+=n*x,n=e[9],E+=n*te,T+=n*ie,D+=n*M,B+=n*le,W+=n*ae,U+=n*fe,A+=n*oe,I+=n*ce,N+=n*y,_+=n*v,S+=n*b,R+=n*P,J+=n*C,Q+=n*O,V+=n*L,k+=n*x,n=e[10],T+=n*te,D+=n*ie,B+=n*M,W+=n*le,U+=n*ae,A+=n*fe,I+=n*oe,N+=n*ce,_+=n*y,S+=n*v,R+=n*b,J+=n*P,Q+=n*C,V+=n*O,k+=n*L,K+=n*x,n=e[11],D+=n*te,B+=n*ie,W+=n*M,U+=n*le,A+=n*ae,I+=n*fe,N+=n*oe,_+=n*ce,S+=n*y,R+=n*v,J+=n*b,Q+=n*P,V+=n*C,k+=n*O,K+=n*L,pe+=n*x,n=e[12],B+=n*te,W+=n*ie,U+=n*M,A+=n*le,I+=n*ae,N+=n*fe,_+=n*oe,S+=n*ce,R+=n*y,J+=n*v,Q+=n*b,V+=n*P,k+=n*C,K+=n*O,pe+=n*L,ue+=n*x,n=e[13],W+=n*te,U+=n*ie,A+=n*M,I+=n*le,N+=n*ae,_+=n*fe,S+=n*oe,R+=n*ce,J+=n*y,Q+=n*v,V+=n*b,k+=n*P,K+=n*C,pe+=n*O,ue+=n*L,re+=n*x,n=e[14],U+=n*te,A+=n*ie,I+=n*M,N+=n*le,_+=n*ae,S+=n*fe,R+=n*oe,J+=n*ce,Q+=n*y,V+=n*v,k+=n*b,K+=n*P,pe+=n*C,ue+=n*O,re+=n*L,Y+=n*x,n=e[15],A+=n*te,I+=n*ie,N+=n*M,_+=n*le,S+=n*ae,R+=n*fe,J+=n*oe,Q+=n*ce,V+=n*y,k+=n*v,K+=n*b,pe+=n*P,ue+=n*C,re+=n*O,Y+=n*L,se+=n*x,s+=38*I,o+=38*N,a+=38*_,u+=38*S,l+=38*R,f+=38*J,d+=38*Q,g+=38*V,w+=38*k,E+=38*K,T+=38*pe,D+=38*ue,B+=38*re,W+=38*Y,U+=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=w+i+65535,i=Math.floor(n/65536),w=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=T+i+65535,i=Math.floor(n/65536),T=n-i*65536,n=D+i+65535,i=Math.floor(n/65536),D=n-i*65536,n=B+i+65535,i=Math.floor(n/65536),B=n-i*65536,n=W+i+65535,i=Math.floor(n/65536),W=n-i*65536,n=U+i+65535,i=Math.floor(n/65536),U=n-i*65536,n=A+i+65535,i=Math.floor(n/65536),A=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=w+i+65535,i=Math.floor(n/65536),w=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=T+i+65535,i=Math.floor(n/65536),T=n-i*65536,n=D+i+65535,i=Math.floor(n/65536),D=n-i*65536,n=B+i+65535,i=Math.floor(n/65536),B=n-i*65536,n=W+i+65535,i=Math.floor(n/65536),W=n-i*65536,n=U+i+65535,i=Math.floor(n/65536),U=n-i*65536,n=A+i+65535,i=Math.floor(n/65536),A=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]=w,t[9]=E,t[10]=T,t[11]=D,t[12]=B,t[13]=W,t[14]=U,t[15]=A}function Qs(t,e){je(t,e,e)}function J2(t,e){let r=be(),n;for(n=0;n<16;n++)r[n]=e[n];for(n=253;n>=0;n--)Qs(r,r),n!==2&&n!==4&&je(r,r,e);for(n=0;n<16;n++)t[n]=r[n]}function H7(t,e){let r=be(),n;for(n=0;n<16;n++)r[n]=e[n];for(n=250;n>=0;n--)Qs(r,r),n!==1&&je(r,r,e);for(n=0;n<16;n++)t[n]=r[n]}function m1(t,e){let r=be(),n=be(),i=be(),s=be(),o=be(),a=be(),u=be(),l=be(),f=be();Ws(r,t[1],t[0]),Ws(f,e[1],e[0]),je(r,r,f),js(n,t[0],t[1]),js(f,e[0],e[1]),je(n,n,f),je(i,t[3],e[3]),je(i,i,U7),je(s,t[2],e[2]),js(s,s,s),Ws(o,n,r),Ws(a,s,i),js(u,s,i),js(l,n,r),je(t[0],o,a),je(t[1],l,u),je(t[2],u,a),je(t[3],o,l)}function W2(t,e,r){for(let n=0;n<4;n++)z2(t[n],e[n],r)}function E1(t,e){let r=be(),n=be(),i=be();J2(i,e[2]),je(r,e[0],i),je(n,e[1],i),Gc(t,n),t[31]^=Y2(r)<<7}function X2(t,e,r){Mi(t[0],y1),Mi(t[1],Oa),Mi(t[2],Oa),Mi(t[3],y1);for(let n=255;n>=0;--n){let i=r[n/8|0]>>(n&7)&1;W2(t,e,i),m1(e,t),m1(t,t),W2(t,e,i)}}function v1(t,e){let r=[be(),be(),be(),be()];Mi(r[0],k2),Mi(r[1],j2),Mi(r[2],Oa),je(r[3],k2,j2),X2(t,r,e)}function Z2(t){if(t.length!==Ve.SEED_LENGTH)throw new Error(`ed25519: seed must be ${Ve.SEED_LENGTH} bytes`);let e=(0,Hc.hash)(t);e[0]&=248,e[31]&=127,e[31]|=64;let r=new Uint8Array(32),n=[be(),be(),be(),be()];v1(n,e),E1(r,n);let i=new Uint8Array(64);return i.set(t),i.set(r,32),{publicKey:r,secretKey:i}}Ve.generateKeyPairFromSeed=Z2;function G7(t){let e=(0,L7.randomBytes)(32,t),r=Z2(e);return(0,$2.wipe)(e),r}Ve.generateKeyPair=G7;function k7(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=k7;var g1=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 eD(t,e){let r,n,i,s;for(n=63;n>=32;--n){for(r=0,i=n-32,s=n-12;i>4)*g1[i],r=e[i]>>8,e[i]&=255;for(i=0;i<32;i++)e[i]-=r*g1[i];for(n=0;n<32;n++)e[n+1]+=e[n]>>8,t[n]=e[n]&255}function w1(t){let e=new Float64Array(64);for(let r=0;r<64;r++)e[r]=t[r];for(let r=0;r<64;r++)t[r]=0;eD(t,e)}function j7(t,e){let r=new Float64Array(64),n=[be(),be(),be(),be()],i=(0,Hc.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 Hc.SHA512;o.update(s.subarray(32)),o.update(e);let a=o.digest();o.clean(),w1(a),v1(n,a),E1(s,n),o.reset(),o.update(s.subarray(0,32)),o.update(t.subarray(32)),o.update(e);let u=o.digest();w1(u);for(let 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 eD(s.subarray(32),r),s}Ve.sign=j7;function tD(t,e){let r=be(),n=be(),i=be(),s=be(),o=be(),a=be(),u=be();return Mi(t[2],Oa),V7(t[1],e),Qs(i,t[1]),je(s,i,M7),Ws(i,i,t[2]),js(s,t[2],s),Qs(o,s),Qs(a,o),je(u,a,o),je(r,u,i),je(r,r,s),H7(r,r),je(r,r,i),je(r,r,s),je(r,r,s),je(t[0],r,s),Qs(n,t[0]),je(n,n,s),Q2(n,i)&&je(t[0],t[0],q7),Qs(n,t[0]),je(n,n,s),Q2(n,i)?-1:(Y2(t[0])===e[31]>>7&&Ws(t[0],y1,t[0]),je(t[3],t[0],t[1]),0)}function Q7(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(tD(s,t))return!1;let o=new Hc.SHA512;o.update(r.subarray(0,32)),o.update(t),o.update(e);let a=o.digest();return w1(a),X2(i,s,a),v1(s,r.subarray(32)),m1(i,s),E1(n,i),!K2(r,n)}Ve.verify=Q7;function W7(t){let e=[be(),be(),be(),be()];if(tD(e,t))throw new Error("Ed25519: invalid public key");let r=be(),n=be(),i=e[1];js(r,Oa,i),Ws(n,Oa,i),J2(n,n),je(r,r,n);let s=new Uint8Array(32);return Gc(s,r),s}Ve.convertPublicKeyToX25519=W7;function $7(t){let e=(0,Hc.hash)(t.subarray(0,32));e[0]&=248,e[31]&=127,e[31]|=64;let r=new Uint8Array(e.subarray(0,32));return(0,$2.wipe)(e),r}Ve.convertSecretKeyToX25519=$7});var Jd,Xd,$s,Da,Zd,kc,ep,tp,rp,Pa,np,ip,nD,iD,sp=ge(()=>{c();Jd="EdDSA",Xd="JWT",$s=".",Da="base64url",Zd="utf8",kc="utf8",ep=":",tp="did",rp="key",Pa="base58btc",np="z",ip="K36",nD=32,iD=32});function Ui(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}var jc=ge(()=>{c()});function Ra(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?Ui(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}var op=ge(()=>{c();jc()});function ap(t,e){e||(e=t.reduce((i,s)=>i+s.length,0));let r=Ra(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return Ui(r)}var A1=ge(()=>{c();op();jc()});function z7(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,A=new Uint8Array(U);B!==W;){for(var I=E[B],N=0,_=U-1;(I!==0||N>>0,A[_]=I%a>>>0,I=I/a>>>0;if(I!==0)throw new Error("Non-zero carry");D=N,B++}for(var S=U-D;S!==U&&A[S]===0;)S++;for(var R=u.repeat(T);S>>0,U=new Uint8Array(W);E[T];){var A=r[E.charCodeAt(T)];if(A===255)return;for(var I=0,N=W-1;(A!==0||I>>0,U[N]=A%256>>>0,A=A/256>>>0;if(A!==0)throw new Error("Non-zero carry");B=I,T++}if(E[T]!==" "){for(var _=W-B;_!==W&&U[_]===0;)_++;for(var S=new Uint8Array(D+(W-_)),R=D;_!==W;)S[R++]=U[_++];return S}}}function w(E){var T=g(E);if(T)return T;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:g,decode:w}}var K7,Y7,sD,oD=ge(()=>{c();K7=z7,Y7=K7,sD=Y7});var Rfe,aD,Xn,uD,cD,qi=ge(()=>{c();Rfe=new Uint8Array(0),aD=(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")},uD=t=>new TextEncoder().encode(t),cD=t=>new TextDecoder().decode(t)});var b1,_1,I1,fD,S1,Ba,Vi,J7,X7,pt,Kr=ge(()=>{c();oD();qi();b1=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")}},_1=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 fD(this,e)}},I1=class{constructor(e){this.decoders=e}or(e){return fD(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`)}},fD=(t,e)=>new I1({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),S1=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new b1(e,r,n),this.decoder=new _1(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},Ba=({name:t,prefix:e,encode:r,decode:n})=>new S1(t,e,r,n),Vi=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=sD(r,e);return Ba({prefix:t,name:e,encode:n,decode:s=>Xn(i(s))})},J7=(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},X7=(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<Ba({prefix:e,name:t,encode(i){return X7(i,n,r)},decode(i){return J7(i,n,r,t)}})});var T1={};ft(T1,{identity:()=>Z7});var Z7,hD=ge(()=>{c();Kr();qi();Z7=Ba({prefix:"\0",name:"identity",encode:t=>cD(t),decode:t=>uD(t)})});var C1={};ft(C1,{base2:()=>e9});var e9,dD=ge(()=>{c();Kr();e9=pt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1})});var x1={};ft(x1,{base8:()=>t9});var t9,pD=ge(()=>{c();Kr();t9=pt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3})});var N1={};ft(N1,{base10:()=>r9});var r9,gD=ge(()=>{c();Kr();r9=Vi({prefix:"9",name:"base10",alphabet:"0123456789"})});var O1={};ft(O1,{base16:()=>n9,base16upper:()=>i9});var n9,i9,yD=ge(()=>{c();Kr();n9=pt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),i9=pt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})});var D1={};ft(D1,{base32:()=>La,base32hex:()=>u9,base32hexpad:()=>l9,base32hexpadupper:()=>f9,base32hexupper:()=>c9,base32pad:()=>o9,base32padupper:()=>a9,base32upper:()=>s9,base32z:()=>h9});var La,s9,o9,a9,u9,c9,l9,f9,h9,P1=ge(()=>{c();Kr();La=pt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),s9=pt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),o9=pt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),a9=pt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),u9=pt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),c9=pt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),l9=pt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),f9=pt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),h9=pt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})});var R1={};ft(R1,{base36:()=>d9,base36upper:()=>p9});var d9,p9,mD=ge(()=>{c();Kr();d9=Vi({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),p9=Vi({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})});var B1={};ft(B1,{base58btc:()=>In,base58flickr:()=>g9});var In,g9,L1=ge(()=>{c();Kr();In=Vi({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),g9=Vi({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})});var F1={};ft(F1,{base64:()=>y9,base64pad:()=>m9,base64url:()=>w9,base64urlpad:()=>E9});var y9,m9,w9,E9,wD=ge(()=>{c();Kr();y9=pt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),m9=pt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),w9=pt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),E9=pt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})});var M1={};ft(M1,{base256emoji:()=>I9});function b9(t){return t.reduce((e,r)=>(e+=v9[r],e),"")}function _9(t){let e=[];for(let r of t){let n=A9[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var ED,v9,A9,I9,vD=ge(()=>{c();Kr();ED=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}"),v9=ED.reduce((t,e,r)=>(t[r]=e,t),[]),A9=ED.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);I9=Ba({prefix:"\u{1F680}",name:"base256emoji",encode:b9,decode:_9})});function _D(t,e,r){e=e||[],r=r||0;for(var n=r;t>=x9;)e[r++]=t&255|AD,t/=128;for(;t&C9;)e[r++]=t&255|AD,t>>>=7;return e[r]=t|0,_D.bytes=r-n+1,e}function U1(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw U1.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&bD)<=O9);return U1.bytes=s-n,r}var S9,AD,T9,C9,x9,N9,O9,bD,D9,P9,R9,B9,L9,F9,M9,U9,q9,V9,H9,G9,Qc,ID=ge(()=>{c();S9=_D,AD=128,T9=127,C9=~T9,x9=Math.pow(2,31);N9=U1,O9=128,bD=127;D9=Math.pow(2,7),P9=Math.pow(2,14),R9=Math.pow(2,21),B9=Math.pow(2,28),L9=Math.pow(2,35),F9=Math.pow(2,42),M9=Math.pow(2,49),U9=Math.pow(2,56),q9=Math.pow(2,63),V9=function(t){return t{c();ID();Wc=(t,e=0)=>[Qc.decode(t,e),Qc.decode.bytes],Fa=(t,e,r=0)=>(Qc.encode(t,e,r),e),Ma=t=>Qc.encodingLength(t)});var zs,SD,TD,Ua,zc=ge(()=>{c();qi();cp();zs=(t,e)=>{let r=e.byteLength,n=Ma(t),i=n+Ma(r),s=new Uint8Array(i+r);return Fa(t,s,0),Fa(r,s,n),s.set(e,i),new Ua(t,r,e,s)},SD=t=>{let e=Xn(t),[r,n]=Wc(e),[i,s]=Wc(e.subarray(n)),o=e.subarray(n+s);if(o.byteLength!==i)throw new Error("Incorrect length");return new Ua(r,i,o,e)},TD=(t,e)=>t===e?!0:t.code===e.code&&t.size===e.size&&aD(t.bytes,e.bytes),Ua=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}});var V1,q1,H1=ge(()=>{c();zc();V1=({name:t,code:e,encode:r})=>new q1(t,e,r),q1=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?zs(this.code,r):r.then(n=>zs(this.code,n))}else throw Error("Unknown type, must be binary type")}}});var G1={};ft(G1,{sha256:()=>k9,sha512:()=>j9});var xD,k9,j9,ND=ge(()=>{c();H1();xD=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),k9=V1({name:"sha2-256",code:18,encode:xD("SHA-256")}),j9=V1({name:"sha2-512",code:19,encode:xD("SHA-512")})});var k1={};ft(k1,{identity:()=>$9});var OD,Q9,DD,W9,$9,PD=ge(()=>{c();qi();zc();OD=0,Q9="identity",DD=Xn,W9=t=>zs(OD,DD(t)),$9={code:OD,name:Q9,encode:DD,digest:W9}});var RD=ge(()=>{c();qi()});var Ehe,vhe,BD=ge(()=>{c();Ehe=new TextEncoder,vhe=new TextDecoder});var hp,Y9,J9,X9,Kc,Z9,LD,FD,lp,fp,eW,tW,rW,MD=ge(()=>{c();cp();zc();L1();P1();qi();hp=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: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!==Kc)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==Z9)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=zs(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&&TD(this.multihash,e.multihash)}toString(e){let{bytes:r,version:n,_baseCache:i}=this;switch(n){case 0:return J9(r,i,e||In.encoder);default:return X9(r,i,e||La.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 tW(/^0\.0/,rW),!!(e&&(e[FD]||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||LD(r,n,i.bytes))}else if(e!=null&&e[FD]===!0){let{version:r,multihash:n,code:i}=e,s=SD(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!==Kc)throw new Error(`Version 0 CID must use dag-pb (code: ${Kc}) block encoding`);return new t(e,r,n,n.bytes)}case 1:{let i=LD(e,r,n.bytes);return new t(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return t.create(0,Kc,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=Xn(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 Ua(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]=Wc(e.subarray(r));return r+=g,d},i=n(),s=Kc;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]=Y9(e,r),s=t.decode(i);return s._baseCache.set(n,e),s}},Y9=(t,e)=>{switch(t[0]){case"Q":{let r=e||In;return[In.prefix,r.decode(`${In.prefix}${t}`)]}case In.prefix:{let r=e||In;return[In.prefix,r.decode(t)]}case La.prefix:{let r=e||La;return[La.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)]}}},J9=(t,e,r)=>{let{prefix:n}=r;if(n!==In.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},X9=(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},Kc=112,Z9=18,LD=(t,e,r)=>{let n=Ma(t),i=n+Ma(e),s=new Uint8Array(i+r.byteLength);return Fa(t,s,0),Fa(e,s,n),s.set(r,i),s},FD=Symbol.for("@ipld/js-cid/CID"),lp={writable:!1,configurable:!1,enumerable:!0},fp={writable:!1,enumerable:!1,configurable:!1},eW="0.0.0-dev",tW=(t,e)=>{if(t.test(eW))console.warn(e);else throw new Error(e)},rW=`CID.isCID(v) is deprecated and will be removed in the next major release. Following code pattern: if (CID.isCID(value)) { @@ -17,33 +17,33 @@ if (cid) { // Make sure to use cid instead of value doSomethingWithCID(cid) } -`});var ED=ge(()=>{c();wD();tp();Bi();O1();Qc()});var R1,Ufe,vD=ge(()=>{c();z2();$2();K2();Y2();J2();A1();X2();I1();Z2();tD();lD();dD();pD();gD();ED();R1={...g1,...y1,...m1,...w1,...E1,...v1,...b1,..._1,...S1,...T1},Ufe={...D1,...P1}});function bD(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var AD,B1,CQ,sp,L1=ge(()=>{c();vD();Xd();AD=bD("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),B1=bD("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);let e=xa(t.length);for(let r=0;r{c();L1()});function In(t,e="utf8"){let r=sp[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Ri(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}var M1=ge(()=>{c();L1();Hc()});function zc(t){return Lc($n(In(t,Ta),Qd))}function $c(t){return $n(In(Fc(t),Qd),Ta)}function U1(t){let e=In(Yd,Ca),r=Kd+$n(Zd([e,t]),Ca);return[zd,$d,r].join(Wd)}function q1(t){let[e,r,n]=t.split(Wd);if(e!==zd||r!==$d)throw new Error('Issuer must be a DID with method "key"');if(n.slice(0,1)!==Kd)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)!==Yd)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 _D(t){return $n(t,Ta)}function ID(t){return In(t,Ta)}function V1(t){return In([$c(t.header),$c(t.payload)].join(Hs),Vc)}function xQ(t){let e=$n(t,Vc).split(Hs),r=zc(e[0]),n=zc(e[1]);return{header:r,payload:n}}function H1(t){return[$c(t.header),$c(t.payload),_D(t.signature)].join(Hs)}function G1(t){let e=t.split(Hs),r=zc(e[0]),n=zc(e[1]),i=ID(e[2]),s=In(e.slice(0,2).join(Hs),Vc);return{header:r,payload:n,signature:i,data:s}}var j1=ge(()=>{c();l1();F1();M1();Md();Jd()});function NQ(t=(0,SD.randomBytes)(32)){return Ba.generateKeyPairFromSeed(t)}async function OQ(t,e,r,n,i=(0,TD.fromMiliseconds)(Date.now())){let s={alg:jd,typ:kd},o=U1(n.publicKey),a=i+r,u={iss:o,sub:t,aud:e,iat:i,exp:a},l=V1({header:s,payload:u}),f=Ba.sign(n.secretKey,l);return H1({header:s,payload:u,signature:f})}async function DQ(t){let{header:e,payload:r,data:n,signature:i}=G1(t);if(e.alg!==jd||e.typ!==kd)throw new Error("JWT must use EdDSA algorithm");let s=q1(r.iss);return Ba.verify(s,n,i)}var Ba,SD,TD,CD=ge(()=>{c();Ba=_e(M2()),SD=_e(Mc()),TD=_e(Ms());Jd();j1()});var xD=ge(()=>{c()});var ND={};ft(ND,{DATA_ENCODING:()=>Vc,DID_DELIMITER:()=>Wd,DID_METHOD:()=>$d,DID_PREFIX:()=>zd,JSON_ENCODING:()=>Qd,JWT_DELIMITER:()=>Hs,JWT_ENCODING:()=>Ta,JWT_IRIDIUM_ALG:()=>jd,JWT_IRIDIUM_TYP:()=>kd,KEY_PAIR_SEED_LENGTH:()=>q2,MULTICODEC_ED25519_BASE:()=>Kd,MULTICODEC_ED25519_ENCODING:()=>Ca,MULTICODEC_ED25519_HEADER:()=>Yd,MULTICODEC_ED25519_LENGTH:()=>U2,decodeData:()=>xQ,decodeIss:()=>q1,decodeJSON:()=>zc,decodeJWT:()=>G1,decodeSig:()=>ID,encodeData:()=>V1,encodeIss:()=>U1,encodeJSON:()=>$c,encodeJWT:()=>H1,encodeSig:()=>_D,generateKeyPair:()=>NQ,signJWT:()=>OQ,verifyJWT:()=>DQ});var OD=ge(()=>{c();CD();Jd();xD();j1()});var PD=m(op=>{"use strict";c();Object.defineProperty(op,"__esModule",{value:!0});var Yt=ba(),k1=Mr(),PQ=20;function RQ(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],w=r[27]<<24|r[26]<<16|r[25]<<8|r[24],E=r[31]<<24|r[30]<<16|r[29]<<8|r[28],x=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,T=u,L=l,X=f,W=d,G=g,j=w,K=E,de=x,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+T|0,ue^=S,ue=ue>>>32-16|ue<<16,G=G+ue|0,T^=G,T=T>>>32-12|T<<12,R=R+L|0,re^=R,re=re>>>32-16|re<<16,j=j+re|0,L^=j,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,j=j+re|0,L^=j,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+T|0,ue^=S,ue=ue>>>32-8|ue<<8,G=G+ue|0,T^=G,T=T>>>32-7|T<<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+T|0,Y^=I,Y=Y>>>32-16|Y<<16,j=j+Y|0,T^=j,T=T>>>32-12|T<<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,G=G+re|0,b^=G,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,G=G+re|0,b^=G,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+T|0,Y^=I,Y=Y>>>32-8|Y<<8,j=j+Y|0,T^=j,T=T>>>32-7|T<<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(T+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(G+g|0,t,36),Yt.writeUint32LE(j+w|0,t,40),Yt.writeUint32LE(K+E|0,t,44),Yt.writeUint32LE(de+x|0,t,48),Yt.writeUint32LE(ue+O|0,t,52),Yt.writeUint32LE(re+F|0,t,56),Yt.writeUint32LE(Y+_|0,t,60)}function DD(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 ap=m(La=>{"use strict";c();Object.defineProperty(La,"__esModule",{value:!0});function FQ(t,e,r){return~(t-1)&e|t-1&r}La.select=FQ;function MQ(t,e){return(t|0)-(e|0)-1>>>31&1}La.lessOrEqual=MQ;function RD(t,e){if(t.length!==e.length)return 0;for(var r=0,n=0;n>>8}La.compare=RD;function UQ(t,e){return t.length===0||e.length===0?!1:RD(t,e)!==0}La.equal=UQ});var LD=m(Kn=>{"use strict";c();Object.defineProperty(Kn,"__esModule",{value:!0});var qQ=ap(),up=Mr();Kn.DIGEST_LENGTH=16;var BD=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],w=this._h[8],E=this._h[9],x=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],T=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 G=e[r+6]|e[r+7]<<8;u+=(W>>>7|G<<9)&8191;var j=e[r+8]|e[r+9]<<8;l+=(G>>>4|j<<12)&8191,f+=j>>>1&8191;var K=e[r+10]|e[r+11]<<8;d+=(j>>>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;w+=(de>>>8|ue<<8)&8191,E+=ue>>>5|i;var re=0,Y=re;Y+=s*x,Y+=o*(5*T),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+=w*(5*F),Y+=E*(5*O),re+=Y>>>13,Y&=8191;var se=re;se+=s*O,se+=o*x,se+=a*(5*T),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+=w*(5*_),se+=E*(5*F),re+=se>>>13,se&=8191;var te=re;te+=s*F,te+=o*O,te+=a*x,te+=u*(5*T),te+=l*(5*b),re=te>>>13,te&=8191,te+=f*(5*B),te+=d*(5*R),te+=g*(5*S),te+=w*(5*I),te+=E*(5*_),re+=te>>>13,te&=8191;var ie=re;ie+=s*_,ie+=o*F,ie+=a*O,ie+=u*x,ie+=l*(5*T),re=ie>>>13,ie&=8191,ie+=f*(5*b),ie+=d*(5*B),ie+=g*(5*R),ie+=w*(5*S),ie+=E*(5*I),re+=ie>>>13,ie&=8191;var q=re;q+=s*I,q+=o*_,q+=a*F,q+=u*O,q+=l*x,re=q>>>13,q&=8191,q+=f*(5*T),q+=d*(5*b),q+=g*(5*B),q+=w*(5*R),q+=E*(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*x,le+=d*(5*T),le+=g*(5*b),le+=w*(5*B),le+=E*(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*x,ae+=g*(5*T),ae+=w*(5*b),ae+=E*(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*x,fe+=w*(5*T),fe+=E*(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+=w*x,oe+=E*(5*T),re+=oe>>>13,oe&=8191;var ce=re;ce+=s*T,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+=w*O,ce+=E*x,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,w=oe,E=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]=w,this._h[9]=E},t.prototype.finish=function(e,r){r===void 0&&(r=0);var n=new Uint16Array(10),i,s,o,a;if(this._leftover){for(a=this._leftover,this._buffer[a++]=1;a<16;a++)this._buffer[a]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(i=this._h[1]>>>13,this._h[1]&=8191,a=2;a<10;a++)this._h[a]+=i,i=this._h[a]>>>13,this._h[a]&=8191;for(this._h[0]+=i*5,i=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=i,i=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=i,n[0]=this._h[0]+5,i=n[0]>>>13,n[0]&=8191,a=1;a<10;a++)n[a]=this._h[a]+i,i=n[a]>>>13,n[a]&=8191;for(n[9]-=8192,s=(i^1)-1,a=0;a<10;a++)n[a]&=s;for(s=~s,a=0;a<10;a++)this._h[a]=this._h[a]&s|n[a];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,o=this._h[0]+this._pad[0],this._h[0]=o&65535,a=1;a<8;a++)o=(this._h[a]+this._pad[a]|0)+(o>>>16)|0,this._h[a]=o&65535;return e[r+0]=this._h[0]>>>0,e[r+1]=this._h[0]>>>8,e[r+2]=this._h[1]>>>0,e[r+3]=this._h[1]>>>8,e[r+4]=this._h[2]>>>0,e[r+5]=this._h[2]>>>8,e[r+6]=this._h[3]>>>0,e[r+7]=this._h[3]>>>8,e[r+8]=this._h[4]>>>0,e[r+9]=this._h[4]>>>8,e[r+10]=this._h[5]>>>0,e[r+11]=this._h[5]>>>8,e[r+12]=this._h[6]>>>0,e[r+13]=this._h[6]>>>8,e[r+14]=this._h[7]>>>0,e[r+15]=this._h[7]>>>8,this._finished=!0,this},t.prototype.update=function(e){var r=0,n=e.length,i;if(this._leftover){i=16-this._leftover,i>n&&(i=n);for(var s=0;s=16&&(i=n-n%16,this._blocks(e,r,i),r+=i,n-=i),n){for(var s=0;s{"use strict";c();Object.defineProperty(Yn,"__esModule",{value:!0});var cp=PD(),GQ=LD(),Kc=Mr(),FD=ba(),jQ=ap();Yn.KEY_LENGTH=32;Yn.NONCE_LENGTH=12;Yn.TAG_LENGTH=16;var MD=new Uint8Array(16),kQ=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);cp.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 cp.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),Kc.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(MD.subarray(i.length%16))),s.update(n),n.length%16>0&&s.update(MD.subarray(n.length%16));var o=new Uint8Array(8);i&&FD.writeUint64LE(i.length,o),s.update(o),FD.writeUint64LE(n.length,o),s.update(o);for(var a=s.digest(),u=0;u{"use strict";c();Object.defineProperty(Q1,"__esModule",{value:!0});function QQ(t){return typeof t.saveState<"u"&&typeof t.restoreState<"u"&&typeof t.cleanSavedState<"u"}Q1.isSerializableHash=QQ});var HD=m(Yc=>{"use strict";c();Object.defineProperty(Yc,"__esModule",{value:!0});var Sn=qD(),WQ=ap(),zQ=Mr(),VD=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(W1,"__esModule",{value:!0});var GD=HD(),jD=Mr(),KQ=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=GD.hmac(this._hash,n,r);this._hmac=new GD.HMAC(e,s),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return t.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(e===0)throw new Error("hkdf: cannot expand more");this._hmac.reset(),e>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},t.prototype.expand=function(e){for(var r=new Uint8Array(e),n=0;n{"use strict";c();Object.defineProperty(Fi,"__esModule",{value:!0});var fp=ba(),lp=Mr();Fi.DIGEST_LENGTH=32;Fi.BLOCK_SIZE=64;var QD=function(){function t(){this.digestLength=Fi.DIGEST_LENGTH,this.blockSize=Fi.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return t.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},t.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},t.prototype.clean=function(){lp.wipe(this._buffer),lp.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&&(z1(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(n=z1(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){lp.wipe(e.state),e.buffer&&lp.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},t}();Fi.SHA256=QD;var YQ=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 z1(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],w=0;w<16;w++){var E=n+w*4;t[w]=fp.readUint32BE(r,E)}for(var w=16;w<64;w++){var x=t[w-2],O=(x>>>17|x<<32-17)^(x>>>19|x<<32-19)^x>>>10;x=t[w-15];var F=(x>>>7|x<<32-7)^(x>>>18|x<<32-18)^x>>>3;t[w]=(O+t[w-7]|0)+(F+t[w-16]|0)}for(var w=0;w<64;w++){var O=(((l>>>6|l<<26)^(l>>>11|l<<21)^(l>>>25|l<<7))+(l&f^~l&d)|0)+(g+(YQ[w]+t[w]|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 JQ(t){var e=new QD;e.update(t);var r=e.digest();return e.clean(),r}Fi.hash=JQ});var YD=m(gt=>{"use strict";c();Object.defineProperty(gt,"__esModule",{value:!0});gt.sharedKey=gt.generateKeyPair=gt.generateKeyPairFromSeed=gt.scalarMultBase=gt.scalarMult=gt.SHARED_KEY_LENGTH=gt.SECRET_KEY_LENGTH=gt.PUBLIC_KEY_LENGTH=void 0;var XQ=Mc(),ZQ=Mr();gt.PUBLIC_KEY_LENGTH=32;gt.SECRET_KEY_LENGTH=32;gt.SHARED_KEY_LENGTH=32;function Tn(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,Jc(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 rW(t,e){for(let r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function hp(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]+r[n]}function dp(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,w=0,E=0,x=0,O=0,F=0,_=0,I=0,S=0,R=0,B=0,b=0,T=0,L=0,X=0,W=0,G=0,j=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],v=r[9],A=r[10],P=r[11],C=r[12],D=r[13],M=r[14],N=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,w+=n*y,E+=n*v,x+=n*A,O+=n*P,F+=n*C,_+=n*D,I+=n*M,S+=n*N,n=e[1],o+=n*te,a+=n*ie,u+=n*q,l+=n*le,f+=n*ae,d+=n*fe,g+=n*oe,w+=n*ce,E+=n*y,x+=n*v,O+=n*A,F+=n*P,_+=n*C,I+=n*D,S+=n*M,R+=n*N,n=e[2],a+=n*te,u+=n*ie,l+=n*q,f+=n*le,d+=n*ae,g+=n*fe,w+=n*oe,E+=n*ce,x+=n*y,O+=n*v,F+=n*A,_+=n*P,I+=n*C,S+=n*D,R+=n*M,B+=n*N,n=e[3],u+=n*te,l+=n*ie,f+=n*q,d+=n*le,g+=n*ae,w+=n*fe,E+=n*oe,x+=n*ce,O+=n*y,F+=n*v,_+=n*A,I+=n*P,S+=n*C,R+=n*D,B+=n*M,b+=n*N,n=e[4],l+=n*te,f+=n*ie,d+=n*q,g+=n*le,w+=n*ae,E+=n*fe,x+=n*oe,O+=n*ce,F+=n*y,_+=n*v,I+=n*A,S+=n*P,R+=n*C,B+=n*D,b+=n*M,T+=n*N,n=e[5],f+=n*te,d+=n*ie,g+=n*q,w+=n*le,E+=n*ae,x+=n*fe,O+=n*oe,F+=n*ce,_+=n*y,I+=n*v,S+=n*A,R+=n*P,B+=n*C,b+=n*D,T+=n*M,L+=n*N,n=e[6],d+=n*te,g+=n*ie,w+=n*q,E+=n*le,x+=n*ae,O+=n*fe,F+=n*oe,_+=n*ce,I+=n*y,S+=n*v,R+=n*A,B+=n*P,b+=n*C,T+=n*D,L+=n*M,X+=n*N,n=e[7],g+=n*te,w+=n*ie,E+=n*q,x+=n*le,O+=n*ae,F+=n*fe,_+=n*oe,I+=n*ce,S+=n*y,R+=n*v,B+=n*A,b+=n*P,T+=n*C,L+=n*D,X+=n*M,W+=n*N,n=e[8],w+=n*te,E+=n*ie,x+=n*q,O+=n*le,F+=n*ae,_+=n*fe,I+=n*oe,S+=n*ce,R+=n*y,B+=n*v,b+=n*A,T+=n*P,L+=n*C,X+=n*D,W+=n*M,G+=n*N,n=e[9],E+=n*te,x+=n*ie,O+=n*q,F+=n*le,_+=n*ae,I+=n*fe,S+=n*oe,R+=n*ce,B+=n*y,b+=n*v,T+=n*A,L+=n*P,X+=n*C,W+=n*D,G+=n*M,j+=n*N,n=e[10],x+=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,T+=n*v,L+=n*A,X+=n*P,W+=n*C,G+=n*D,j+=n*M,K+=n*N,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,T+=n*y,L+=n*v,X+=n*A,W+=n*P,G+=n*C,j+=n*D,K+=n*M,de+=n*N,n=e[12],F+=n*te,_+=n*ie,I+=n*q,S+=n*le,R+=n*ae,B+=n*fe,b+=n*oe,T+=n*ce,L+=n*y,X+=n*v,W+=n*A,G+=n*P,j+=n*C,K+=n*D,de+=n*M,ue+=n*N,n=e[13],_+=n*te,I+=n*ie,S+=n*q,R+=n*le,B+=n*ae,b+=n*fe,T+=n*oe,L+=n*ce,X+=n*y,W+=n*v,G+=n*A,j+=n*P,K+=n*C,de+=n*D,ue+=n*M,re+=n*N,n=e[14],I+=n*te,S+=n*ie,R+=n*q,B+=n*le,b+=n*ae,T+=n*fe,L+=n*oe,X+=n*ce,W+=n*y,G+=n*v,j+=n*A,K+=n*P,de+=n*C,ue+=n*D,re+=n*M,Y+=n*N,n=e[15],S+=n*te,R+=n*ie,B+=n*q,b+=n*le,T+=n*ae,L+=n*fe,X+=n*oe,W+=n*ce,G+=n*y,j+=n*v,K+=n*A,de+=n*P,ue+=n*C,re+=n*D,Y+=n*M,se+=n*N,s+=38*R,o+=38*B,a+=38*b,u+=38*T,l+=38*L,f+=38*X,d+=38*W,g+=38*G,w+=38*j,E+=38*K,x+=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=w+i+65535,i=Math.floor(n/65536),w=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=x+i+65535,i=Math.floor(n/65536),x=n-i*65536,n=O+i+65535,i=Math.floor(n/65536),O=n-i*65536,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=w+i+65535,i=Math.floor(n/65536),w=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=x+i+65535,i=Math.floor(n/65536),x=n-i*65536,n=O+i+65535,i=Math.floor(n/65536),O=n-i*65536,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]=w,t[9]=E,t[10]=x,t[11]=O,t[12]=F,t[13]=_,t[14]=I,t[15]=S}function Xc(t,e){Jn(t,e,e)}function nW(t,e){let r=Tn();for(let n=0;n<16;n++)r[n]=e[n];for(let n=253;n>=0;n--)Xc(r,r),n!==2&&n!==4&&Jn(r,r,e);for(let n=0;n<16;n++)t[n]=r[n]}function K1(t,e){let r=new Uint8Array(32),n=new Float64Array(80),i=Tn(),s=Tn(),o=Tn(),a=Tn(),u=Tn(),l=Tn();for(let w=0;w<31;w++)r[w]=t[w];r[31]=t[31]&127|64,r[0]&=248,rW(n,e);for(let w=0;w<16;w++)s[w]=n[w];i[0]=a[0]=1;for(let w=254;w>=0;--w){let E=r[w>>>3]>>>(w&7)&1;Jc(i,s,E),Jc(o,a,E),hp(u,i,o),dp(i,i,o),hp(o,s,a),dp(s,s,a),Xc(a,u),Xc(l,i),Jn(i,o,i),Jn(o,s,u),hp(u,i,o),dp(i,i,o),Xc(s,i),dp(o,a,l),Jn(i,o,eW),hp(i,i,a),Jn(o,o,i),Jn(i,a,l),Jn(a,s,n),Xc(s,u),Jc(i,s,E),Jc(o,a,E)}for(let w=0;w<16;w++)n[w+16]=i[w],n[w+32]=o[w],n[w+48]=s[w],n[w+64]=a[w];let f=n.subarray(32),d=n.subarray(16);nW(f,f),Jn(d,d,f);let g=new Uint8Array(32);return tW(g,d),g}gt.scalarMult=K1;function $D(t){return K1(t,zD)}gt.scalarMultBase=$D;function KD(t){if(t.length!==gt.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${gt.SECRET_KEY_LENGTH} bytes`);let e=new Uint8Array(t);return{publicKey:$D(e),secretKey:e}}gt.generateKeyPairFromSeed=KD;function iW(t){let e=(0,XQ.randomBytes)(32,t),r=KD(e);return(0,ZQ.wipe)(e),r}gt.generateKeyPair=iW;function sW(t,e,r=!1){if(t.length!==gt.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(e.length!==gt.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");let n=K1(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 ZD(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r{c()});function tP(t,e){if(t.length!==e.length)throw new Error("Inputs should have the same length");let r=xa(t.length);for(let n=0;n{c();Xd();Hc()});var Y1={};ft(Y1,{compare:()=>JD,concat:()=>Zd,equals:()=>ZD,fromString:()=>In,toString:()=>$n,xor:()=>tP});var J1=ge(()=>{c();XD();l1();eP();M1();F1();rP()});var pP=m(st=>{"use strict";c();var nP=st&&st.__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 lP:typeof navigator<"u"?X1(navigator.userAgent):dP()}st.detect=cW;function fP(t){return t!==""&&uW.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 lW(t){var e=fP(t);return e?e[0]:null}st.browserName=lW;function X1(t){var e=fP(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new cP;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 js(t){let e;return typeof window<"u"&&typeof window[t]<"u"&&(e=window[t]),e}Ye.getFromWindow=js;function Fa(t){let e=js(t);if(!e)throw new Error(`${t} is not defined in Window`);return e}Ye.getFromWindowOrThrow=Fa;function hW(){return Fa("document")}Ye.getDocumentOrThrow=hW;function dW(){return js("document")}Ye.getDocument=dW;function pW(){return Fa("navigator")}Ye.getNavigatorOrThrow=pW;function gW(){return js("navigator")}Ye.getNavigator=gW;function yW(){return Fa("location")}Ye.getLocationOrThrow=yW;function mW(){return js("location")}Ye.getLocation=mW;function wW(){return Fa("crypto")}Ye.getCryptoOrThrow=wW;function EW(){return js("crypto")}Ye.getCrypto=EW;function vW(){return Fa("localStorage")}Ye.getLocalStorageOrThrow=vW;function AW(){return js("localStorage")}Ye.getLocalStorage=AW});var yP=m(pp=>{"use strict";c();Object.defineProperty(pp,"__esModule",{value:!0});pp.getWindowMetadata=void 0;var gP=Z1();function bW(){let t,e;try{t=gP.getDocumentOrThrow(),e=gP.getLocationOrThrow()}catch{return null}function r(){let d=t.getElementsByTagName("link"),g=[];for(let w=0;w-1){let O=E.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 w=0;wE.getAttribute(O)).filter(O=>O?d.includes(O):!1);if(x.length&&x){let O=E.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}}pp.getWindowMetadata=bW});var wP=m((ede,mP)=>{"use strict";c();mP.exports=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)});var _P=m((rde,bP)=>{"use strict";c();var AP="%[a-f0-9]{2}",EP=new RegExp("("+AP+")|([^%]+?)","gi"),vP=new RegExp("("+AP+")+","gi");function eA(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([],eA(r),eA(n))}function _W(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(EP)||[],r=1;r{"use strict";c();IP.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 CP=m((ode,TP)=>{"use strict";c();TP.exports=function(t,e){for(var r={},n=Object.keys(t),i=Array.isArray(e),s=0;s{"use strict";c();var SW=wP(),TW=_P(),NP=SP(),CW=CP(),xW=t=>t==null,tA=Symbol("encodeFragmentIdentifier");function NW(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,[Et(e,t),"[",i,"]"].join("")]:[...r,[Et(e,t),"[",Et(i,t),"]=",Et(n,t)].join("")]};case"bracket":return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[Et(e,t),"[]"].join("")]:[...r,[Et(e,t),"[]=",Et(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,[Et(e,t),":list="].join("")]:[...r,[Et(e,t),":list=",Et(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?[[Et(r,t),e,Et(i,t)].join("")]:[[n,Et(i,t)].join(t.arrayFormatSeparator)])}default:return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,Et(e,t)]:[...r,[Et(e,t),"=",Et(n,t)].join("")]}}function OW(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 OP(t){if(typeof t!="string"||t.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function Et(t,e){return e.encode?e.strict?SW(t):encodeURIComponent(t):t}function Xn(t,e){return e.decode?TW(t):t}function DP(t){return Array.isArray(t)?t.sort():typeof t=="object"?DP(Object.keys(t)).sort((e,r)=>Number(e)-Number(r)).map(e=>t[e]):t}function PP(t){let e=t.indexOf("#");return e!==-1&&(t=t.slice(0,e)),t}function DW(t){let e="",r=t.indexOf("#");return r!==-1&&(e=t.slice(r)),e}function RP(t){t=PP(t);let e=t.indexOf("?");return e===-1?"":t.slice(e+1)}function xP(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 BP(t,e){e=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},e),OP(e.arrayFormatSeparator);let r=OW(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]=NP(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]=xP(s[o],e);else n[i]=xP(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]=DP(o):i[s]=o,i},Object.create(null))}hr.extract=RP;hr.parse=BP;hr.stringify=(t,e)=>{if(!t)return"";e=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},e),OP(e.arrayFormatSeparator);let r=o=>e.skipNull&&xW(t[o])||e.skipEmptyString&&t[o]==="",n=NW(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?Et(o,e):Array.isArray(a)?a.length===0&&e.arrayFormat==="bracket-separator"?Et(o,e)+"[]":a.reduce(n(o),[]).join("&"):Et(o,e)+"="+Et(a,e)}).filter(o=>o.length>0).join("&")};hr.parseUrl=(t,e)=>{e=Object.assign({decode:!0},e);let[r,n]=NP(t,"#");return Object.assign({url:r.split("?")[0]||"",query:BP(RP(t),e)},e&&e.parseFragmentIdentifier&&n?{fragmentIdentifier:Xn(n,e)}:{})};hr.stringifyUrl=(t,e)=>{e=Object.assign({encode:!0,strict:!0,[tA]:!0},e);let r=PP(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=DW(t.url);return t.fragmentIdentifier&&(a=`#${e[tA]?Et(t.fragmentIdentifier,e):t.fragmentIdentifier}`),`${r}${o}${a}`};hr.pick=(t,e,r)=>{r=Object.assign({parseFragmentIdentifier:!0,[tA]:!1},r);let{url:n,query:i,fragmentIdentifier:s}=hr.parseUrl(t,r);return hr.stringifyUrl({url:n,query:CW(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 FP=ge(()=>{c()});function Mi(t,e,r="string"){if(!t[e]||typeof t[e]!==r)throw new Error(`Missing or invalid "${e}" param`)}function PW(t,e){let r=!0;return e.forEach(n=>{n in t||(r=!1)}),r}function RW(t,e){return Array.isArray(t)?t.length===e:Object.keys(t).length===e}function BW(t,e){return Array.isArray(t)?t.length>=e:Object.keys(t).length>=e}function Zc(t,e,r){return(!r.length?RW(t,e.length):BW(t,e.length))?PW(t,e):!1}function el(t,e,r="_"){let n=t.split(r);return n[n.length-1].trim().toLowerCase()===e.trim().toLowerCase()}var rA=ge(()=>{c()});function LW(t){return gp(t.method)&&yp(t.params)}function gp(t){return el(t,"subscribe")}function yp(t){return Zc(t,["topic"],[])}function FW(t){return mp(t.method)&&wp(t.params)}function mp(t){return el(t,"publish")}function wp(t){return Zc(t,["message","topic","ttl"],["prompt","tag"])}function MW(t){return Ep(t.method)&&vp(t.params)}function Ep(t){return el(t,"unsubscribe")}function vp(t){return Zc(t,["id","topic"],[])}function UW(t){return Ap(t.method)&&bp(t.params)}function Ap(t){return el(t,"subscription")}function bp(t){return Zc(t,["id","data"],[])}var nA=ge(()=>{c();rA()});function qW(t){if(!gp(t.method))throw new Error("JSON-RPC Request has invalid subscribe method");if(!yp(t.params))throw new Error("JSON-RPC Request has invalid subscribe params");let e=t.params;return Mi(e,"topic"),e}function VW(t){if(!mp(t.method))throw new Error("JSON-RPC Request has invalid publish method");if(!wp(t.params))throw new Error("JSON-RPC Request has invalid publish params");let e=t.params;return Mi(e,"topic"),Mi(e,"message"),Mi(e,"ttl","number"),e}function HW(t){if(!Ep(t.method))throw new Error("JSON-RPC Request has invalid unsubscribe method");if(!vp(t.params))throw new Error("JSON-RPC Request has invalid unsubscribe params");let e=t.params;return Mi(e,"id"),e}function GW(t){if(!Ap(t.method))throw new Error("JSON-RPC Request has invalid subscription method");if(!bp(t.params))throw new Error("JSON-RPC Request has invalid subscription params");let e=t.params;return Mi(e,"id"),Mi(e,"data"),e}var MP=ge(()=>{c();rA();nA()});var jW,UP=ge(()=>{c();jW={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 qP={};ft(qP,{RELAY_JSONRPC:()=>jW,isPublishMethod:()=>mp,isPublishParams:()=>wp,isPublishRequest:()=>FW,isSubscribeMethod:()=>gp,isSubscribeParams:()=>yp,isSubscribeRequest:()=>LW,isSubscriptionMethod:()=>Ap,isSubscriptionParams:()=>bp,isSubscriptionRequest:()=>UW,isUnsubscribeMethod:()=>Ep,isUnsubscribeParams:()=>vp,isUnsubscribeRequest:()=>MW,parsePublishRequest:()=>VW,parseSubscribeRequest:()=>qW,parseSubscriptionRequest:()=>GW,parseUnsubscribeRequest:()=>HW});var VP=ge(()=>{c();FP();MP();UP();nA()});var ol=m(k=>{"use strict";c();Object.defineProperty(k,"__esModule",{value:!0});var YP=UD(),kW=kD(),JP=Mc(),aA=WD(),QW=YD(),ot=(J1(),ct(Y1)),WW=pP(),Ma=Ms(),tl=Z1(),zW=yP(),$W=LP(),KW=(VP(),ct(qP));function XP(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 ZP=XP(QW),_p=XP($W),Tp=":";function e3(t){let[e,r]=t.split(Tp);return{namespace:e,reference:r}}function t3(t){let{namespace:e,reference:r}=t;return[e,r].join(Tp)}function uA(t){let[e,r,n]=t.split(Tp);return{namespace:e,reference:r,address:n}}function r3(t){let{namespace:e,reference:r,address:n}=t;return[e,r,n].join(Tp)}function cA(t,e){let r=[];return t.forEach(n=>{let i=e(n);r.includes(i)||r.push(i)}),r}function n3(t){let{address:e}=uA(t);return e}function i3(t){let{namespace:e,reference:r}=uA(t);return t3({namespace:e,reference:r})}function YW(t,e){let{namespace:r,reference:n}=e3(e);return r3({namespace:r,reference:n,address:t})}function JW(t){return cA(t,n3)}function s3(t){return cA(t,i3)}function XW(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 ZW(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...s3(i.accounts))}),r}function ez(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...Cp(n,i))}),r}function Cp(t,e){return t.includes(":")?[t]:e.chains||[]}var xp=t=>t?.split(":"),o3=t=>{let e=t&&xp(t);if(e)return e[3]},tz=t=>{let e=t&&xp(t);if(e)return e[2]+":"+e[3]},a3=t=>{let e=t&&xp(t);if(e)return e.pop()},rz=(t,e)=>{let r=`${t.domain} wants you to sign in with your Ethereum account:`,n=a3(e),i=t.statement,s=`URI: ${t.aud}`,o=`Version: ${t.version}`,a=`Chain ID: ${o3(e)}`,u=`Nonce: ${t.nonce}`,l=`Issued At: ${t.iat}`,f=t.resources&&t.resources.length>0?`Resources: +`});var UD=ge(()=>{c();MD();cp();qi();H1();zc()});var j1,Dhe,qD=ge(()=>{c();hD();dD();pD();gD();yD();P1();mD();L1();wD();vD();ND();PD();RD();BD();UD();j1={...T1,...C1,...x1,...N1,...O1,...D1,...R1,...B1,...F1,...M1},Dhe={...G1,...k1}});function HD(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var VD,Q1,nW,dp,W1=ge(()=>{c();qD();op();VD=HD("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),Q1=HD("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);let e=Ra(t.length);for(let r=0;r{c();W1()});function Sn(t,e="utf8"){let r=dp[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Ui(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}var z1=ge(()=>{c();W1();jc()});function Yc(t){return Uc(Zn(Sn(t,Da),Zd))}function Jc(t){return Zn(Sn(qc(t),Zd),Da)}function K1(t){let e=Sn(ip,Pa),r=np+Zn(ap([e,t]),Pa);return[tp,rp,r].join(ep)}function Y1(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=Sn(n.slice(1),Pa);if(Zn(s.slice(0,2),Pa)!==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 GD(t){return Zn(t,Da)}function kD(t){return Sn(t,Da)}function J1(t){return Sn([Jc(t.header),Jc(t.payload)].join($s),kc)}function iW(t){let e=Zn(t,kc).split($s),r=Yc(e[0]),n=Yc(e[1]);return{header:r,payload:n}}function X1(t){return[Jc(t.header),Jc(t.payload),GD(t.signature)].join($s)}function Z1(t){let e=t.split($s),r=Yc(e[0]),n=Yc(e[1]),i=kD(e[2]),s=Sn(e.slice(0,2).join($s),kc);return{header:r,payload:n,signature:i,data:s}}var eA=ge(()=>{c();A1();$1();z1();Qd();sp()});function sW(t=(0,jD.randomBytes)(32)){return qa.generateKeyPairFromSeed(t)}async function oW(t,e,r,n,i=(0,QD.fromMiliseconds)(Date.now())){let s={alg:Jd,typ:Xd},o=K1(n.publicKey),a=i+r,u={iss:o,sub:t,aud:e,iat:i,exp:a},l=J1({header:s,payload:u}),f=qa.sign(n.secretKey,l);return X1({header:s,payload:u,signature:f})}async function aW(t){let{header:e,payload:r,data:n,signature:i}=Z1(t);if(e.alg!==Jd||e.typ!==Xd)throw new Error("JWT must use EdDSA algorithm");let s=Y1(r.iss);return qa.verify(s,n,i)}var qa,jD,QD,WD=ge(()=>{c();qa=_e(rD()),jD=_e(Vc()),QD=_e(ks());sp();eA()});var $D=ge(()=>{c()});var zD={};ft(zD,{DATA_ENCODING:()=>kc,DID_DELIMITER:()=>ep,DID_METHOD:()=>rp,DID_PREFIX:()=>tp,JSON_ENCODING:()=>Zd,JWT_DELIMITER:()=>$s,JWT_ENCODING:()=>Da,JWT_IRIDIUM_ALG:()=>Jd,JWT_IRIDIUM_TYP:()=>Xd,KEY_PAIR_SEED_LENGTH:()=>iD,MULTICODEC_ED25519_BASE:()=>np,MULTICODEC_ED25519_ENCODING:()=>Pa,MULTICODEC_ED25519_HEADER:()=>ip,MULTICODEC_ED25519_LENGTH:()=>nD,decodeData:()=>iW,decodeIss:()=>Y1,decodeJSON:()=>Yc,decodeJWT:()=>Z1,decodeSig:()=>kD,encodeData:()=>J1,encodeIss:()=>K1,encodeJSON:()=>Jc,encodeJWT:()=>X1,encodeSig:()=>GD,generateKeyPair:()=>sW,signJWT:()=>oW,verifyJWT:()=>aW});var KD=ge(()=>{c();WD();sp();$D();eA()});var JD=m(pp=>{"use strict";c();Object.defineProperty(pp,"__esModule",{value:!0});var Xt=Ca(),tA=qr(),uW=20;function cW(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],w=r[27]<<24|r[26]<<16|r[25]<<8|r[24],E=r[31]<<24|r[30]<<16|r[29]<<8|r[28],T=e[3]<<24|e[2]<<16|e[1]<<8|e[0],D=e[7]<<24|e[6]<<16|e[5]<<8|e[4],B=e[11]<<24|e[10]<<16|e[9]<<8|e[8],W=e[15]<<24|e[14]<<16|e[13]<<8|e[12],U=n,A=i,I=s,N=o,_=a,S=u,R=l,J=f,Q=d,V=g,k=w,K=E,pe=T,ue=D,re=B,Y=W,se=0;se>>32-16|pe<<16,Q=Q+pe|0,_^=Q,_=_>>>32-12|_<<12,A=A+S|0,ue^=A,ue=ue>>>32-16|ue<<16,V=V+ue|0,S^=V,S=S>>>32-12|S<<12,I=I+R|0,re^=I,re=re>>>32-16|re<<16,k=k+re|0,R^=k,R=R>>>32-12|R<<12,N=N+J|0,Y^=N,Y=Y>>>32-16|Y<<16,K=K+Y|0,J^=K,J=J>>>32-12|J<<12,I=I+R|0,re^=I,re=re>>>32-8|re<<8,k=k+re|0,R^=k,R=R>>>32-7|R<<7,N=N+J|0,Y^=N,Y=Y>>>32-8|Y<<8,K=K+Y|0,J^=K,J=J>>>32-7|J<<7,A=A+S|0,ue^=A,ue=ue>>>32-8|ue<<8,V=V+ue|0,S^=V,S=S>>>32-7|S<<7,U=U+_|0,pe^=U,pe=pe>>>32-8|pe<<8,Q=Q+pe|0,_^=Q,_=_>>>32-7|_<<7,U=U+S|0,Y^=U,Y=Y>>>32-16|Y<<16,k=k+Y|0,S^=k,S=S>>>32-12|S<<12,A=A+R|0,pe^=A,pe=pe>>>32-16|pe<<16,K=K+pe|0,R^=K,R=R>>>32-12|R<<12,I=I+J|0,ue^=I,ue=ue>>>32-16|ue<<16,Q=Q+ue|0,J^=Q,J=J>>>32-12|J<<12,N=N+_|0,re^=N,re=re>>>32-16|re<<16,V=V+re|0,_^=V,_=_>>>32-12|_<<12,I=I+J|0,ue^=I,ue=ue>>>32-8|ue<<8,Q=Q+ue|0,J^=Q,J=J>>>32-7|J<<7,N=N+_|0,re^=N,re=re>>>32-8|re<<8,V=V+re|0,_^=V,_=_>>>32-7|_<<7,A=A+R|0,pe^=A,pe=pe>>>32-8|pe<<8,K=K+pe|0,R^=K,R=R>>>32-7|R<<7,U=U+S|0,Y^=U,Y=Y>>>32-8|Y<<8,k=k+Y|0,S^=k,S=S>>>32-7|S<<7;Xt.writeUint32LE(U+n|0,t,0),Xt.writeUint32LE(A+i|0,t,4),Xt.writeUint32LE(I+s|0,t,8),Xt.writeUint32LE(N+o|0,t,12),Xt.writeUint32LE(_+a|0,t,16),Xt.writeUint32LE(S+u|0,t,20),Xt.writeUint32LE(R+l|0,t,24),Xt.writeUint32LE(J+f|0,t,28),Xt.writeUint32LE(Q+d|0,t,32),Xt.writeUint32LE(V+g|0,t,36),Xt.writeUint32LE(k+w|0,t,40),Xt.writeUint32LE(K+E|0,t,44),Xt.writeUint32LE(pe+T|0,t,48),Xt.writeUint32LE(ue+D|0,t,52),Xt.writeUint32LE(re+B|0,t,56),Xt.writeUint32LE(Y+W|0,t,60)}function YD(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 gp=m(Va=>{"use strict";c();Object.defineProperty(Va,"__esModule",{value:!0});function hW(t,e,r){return~(t-1)&e|t-1&r}Va.select=hW;function dW(t,e){return(t|0)-(e|0)-1>>>31&1}Va.lessOrEqual=dW;function XD(t,e){if(t.length!==e.length)return 0;for(var r=0,n=0;n>>8}Va.compare=XD;function pW(t,e){return t.length===0||e.length===0?!1:XD(t,e)!==0}Va.equal=pW});var eP=m(ei=>{"use strict";c();Object.defineProperty(ei,"__esModule",{value:!0});var gW=gp(),yp=qr();ei.DIGEST_LENGTH=16;var ZD=function(){function t(e){this.digestLength=ei.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],w=this._h[8],E=this._h[9],T=this._r[0],D=this._r[1],B=this._r[2],W=this._r[3],U=this._r[4],A=this._r[5],I=this._r[6],N=this._r[7],_=this._r[8],S=this._r[9];n>=16;){var R=e[r+0]|e[r+1]<<8;s+=R&8191;var J=e[r+2]|e[r+3]<<8;o+=(R>>>13|J<<3)&8191;var Q=e[r+4]|e[r+5]<<8;a+=(J>>>10|Q<<6)&8191;var V=e[r+6]|e[r+7]<<8;u+=(Q>>>7|V<<9)&8191;var k=e[r+8]|e[r+9]<<8;l+=(V>>>4|k<<12)&8191,f+=k>>>1&8191;var K=e[r+10]|e[r+11]<<8;d+=(k>>>14|K<<2)&8191;var pe=e[r+12]|e[r+13]<<8;g+=(K>>>11|pe<<5)&8191;var ue=e[r+14]|e[r+15]<<8;w+=(pe>>>8|ue<<8)&8191,E+=ue>>>5|i;var re=0,Y=re;Y+=s*T,Y+=o*(5*S),Y+=a*(5*_),Y+=u*(5*N),Y+=l*(5*I),re=Y>>>13,Y&=8191,Y+=f*(5*A),Y+=d*(5*U),Y+=g*(5*W),Y+=w*(5*B),Y+=E*(5*D),re+=Y>>>13,Y&=8191;var se=re;se+=s*D,se+=o*T,se+=a*(5*S),se+=u*(5*_),se+=l*(5*N),re=se>>>13,se&=8191,se+=f*(5*I),se+=d*(5*A),se+=g*(5*U),se+=w*(5*W),se+=E*(5*B),re+=se>>>13,se&=8191;var te=re;te+=s*B,te+=o*D,te+=a*T,te+=u*(5*S),te+=l*(5*_),re=te>>>13,te&=8191,te+=f*(5*N),te+=d*(5*I),te+=g*(5*A),te+=w*(5*U),te+=E*(5*W),re+=te>>>13,te&=8191;var ie=re;ie+=s*W,ie+=o*B,ie+=a*D,ie+=u*T,ie+=l*(5*S),re=ie>>>13,ie&=8191,ie+=f*(5*_),ie+=d*(5*N),ie+=g*(5*I),ie+=w*(5*A),ie+=E*(5*U),re+=ie>>>13,ie&=8191;var M=re;M+=s*U,M+=o*W,M+=a*B,M+=u*D,M+=l*T,re=M>>>13,M&=8191,M+=f*(5*S),M+=d*(5*_),M+=g*(5*N),M+=w*(5*I),M+=E*(5*A),re+=M>>>13,M&=8191;var le=re;le+=s*A,le+=o*U,le+=a*W,le+=u*B,le+=l*D,re=le>>>13,le&=8191,le+=f*T,le+=d*(5*S),le+=g*(5*_),le+=w*(5*N),le+=E*(5*I),re+=le>>>13,le&=8191;var ae=re;ae+=s*I,ae+=o*A,ae+=a*U,ae+=u*W,ae+=l*B,re=ae>>>13,ae&=8191,ae+=f*D,ae+=d*T,ae+=g*(5*S),ae+=w*(5*_),ae+=E*(5*N),re+=ae>>>13,ae&=8191;var fe=re;fe+=s*N,fe+=o*I,fe+=a*A,fe+=u*U,fe+=l*W,re=fe>>>13,fe&=8191,fe+=f*B,fe+=d*D,fe+=g*T,fe+=w*(5*S),fe+=E*(5*_),re+=fe>>>13,fe&=8191;var oe=re;oe+=s*_,oe+=o*N,oe+=a*I,oe+=u*A,oe+=l*U,re=oe>>>13,oe&=8191,oe+=f*W,oe+=d*B,oe+=g*D,oe+=w*T,oe+=E*(5*S),re+=oe>>>13,oe&=8191;var ce=re;ce+=s*S,ce+=o*_,ce+=a*N,ce+=u*I,ce+=l*A,re=ce>>>13,ce&=8191,ce+=f*U,ce+=d*W,ce+=g*B,ce+=w*D,ce+=E*T,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=M,f=le,d=ae,g=fe,w=oe,E=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]=w,this._h[9]=E},t.prototype.finish=function(e,r){r===void 0&&(r=0);var n=new Uint16Array(10),i,s,o,a;if(this._leftover){for(a=this._leftover,this._buffer[a++]=1;a<16;a++)this._buffer[a]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(i=this._h[1]>>>13,this._h[1]&=8191,a=2;a<10;a++)this._h[a]+=i,i=this._h[a]>>>13,this._h[a]&=8191;for(this._h[0]+=i*5,i=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=i,i=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=i,n[0]=this._h[0]+5,i=n[0]>>>13,n[0]&=8191,a=1;a<10;a++)n[a]=this._h[a]+i,i=n[a]>>>13,n[a]&=8191;for(n[9]-=8192,s=(i^1)-1,a=0;a<10;a++)n[a]&=s;for(s=~s,a=0;a<10;a++)this._h[a]=this._h[a]&s|n[a];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,o=this._h[0]+this._pad[0],this._h[0]=o&65535,a=1;a<8;a++)o=(this._h[a]+this._pad[a]|0)+(o>>>16)|0,this._h[a]=o&65535;return e[r+0]=this._h[0]>>>0,e[r+1]=this._h[0]>>>8,e[r+2]=this._h[1]>>>0,e[r+3]=this._h[1]>>>8,e[r+4]=this._h[2]>>>0,e[r+5]=this._h[2]>>>8,e[r+6]=this._h[3]>>>0,e[r+7]=this._h[3]>>>8,e[r+8]=this._h[4]>>>0,e[r+9]=this._h[4]>>>8,e[r+10]=this._h[5]>>>0,e[r+11]=this._h[5]>>>8,e[r+12]=this._h[6]>>>0,e[r+13]=this._h[6]>>>8,e[r+14]=this._h[7]>>>0,e[r+15]=this._h[7]>>>8,this._finished=!0,this},t.prototype.update=function(e){var r=0,n=e.length,i;if(this._leftover){i=16-this._leftover,i>n&&(i=n);for(var s=0;s=16&&(i=n-n%16,this._blocks(e,r,i),r+=i,n-=i),n){for(var s=0;s{"use strict";c();Object.defineProperty(ti,"__esModule",{value:!0});var mp=JD(),wW=eP(),Xc=qr(),tP=Ca(),EW=gp();ti.KEY_LENGTH=32;ti.NONCE_LENGTH=12;ti.TAG_LENGTH=16;var rP=new Uint8Array(16),vW=function(){function t(e){if(this.nonceLength=ti.NONCE_LENGTH,this.tagLength=ti.TAG_LENGTH,e.length!==ti.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);mp.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 mp.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),Xc.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(rP.subarray(i.length%16))),s.update(n),n.length%16>0&&s.update(rP.subarray(n.length%16));var o=new Uint8Array(8);i&&tP.writeUint64LE(i.length,o),s.update(o),tP.writeUint64LE(n.length,o),s.update(o);for(var a=s.digest(),u=0;u{"use strict";c();Object.defineProperty(rA,"__esModule",{value:!0});function AW(t){return typeof t.saveState<"u"&&typeof t.restoreState<"u"&&typeof t.cleanSavedState<"u"}rA.isSerializableHash=AW});var oP=m(Zc=>{"use strict";c();Object.defineProperty(Zc,"__esModule",{value:!0});var Tn=iP(),bW=gp(),_W=qr(),sP=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(nA,"__esModule",{value:!0});var aP=oP(),uP=qr(),SW=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=aP.hmac(this._hash,n,r);this._hmac=new aP.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 Ep=Ca(),wp=qr();Hi.DIGEST_LENGTH=32;Hi.BLOCK_SIZE=64;var lP=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(){wp.wipe(this._buffer),wp.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&&(iA(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(n=iA(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){wp.wipe(e.state),e.buffer&&wp.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},t}();Hi.SHA256=lP;var TW=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 iA(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],w=0;w<16;w++){var E=n+w*4;t[w]=Ep.readUint32BE(r,E)}for(var w=16;w<64;w++){var T=t[w-2],D=(T>>>17|T<<32-17)^(T>>>19|T<<32-19)^T>>>10;T=t[w-15];var B=(T>>>7|T<<32-7)^(T>>>18|T<<32-18)^T>>>3;t[w]=(D+t[w-7]|0)+(B+t[w-16]|0)}for(var w=0;w<64;w++){var D=(((l>>>6|l<<26)^(l>>>11|l<<21)^(l>>>25|l<<7))+(l&f^~l&d)|0)+(g+(TW[w]+t[w]|0)|0)|0,B=((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+D|0,u=a,a=o,o=s,s=D+B|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 CW(t){var e=new lP;e.update(t);var r=e.digest();return e.clean(),r}Hi.hash=CW});var gP=m(gt=>{"use strict";c();Object.defineProperty(gt,"__esModule",{value:!0});gt.sharedKey=gt.generateKeyPair=gt.generateKeyPairFromSeed=gt.scalarMultBase=gt.scalarMult=gt.SHARED_KEY_LENGTH=gt.SECRET_KEY_LENGTH=gt.PUBLIC_KEY_LENGTH=void 0;var xW=Vc(),NW=qr();gt.PUBLIC_KEY_LENGTH=32;gt.SECRET_KEY_LENGTH=32;gt.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,el(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 PW(t,e){for(let r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function vp(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]+r[n]}function Ap(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]-r[n]}function ri(t,e,r){let n,i,s=0,o=0,a=0,u=0,l=0,f=0,d=0,g=0,w=0,E=0,T=0,D=0,B=0,W=0,U=0,A=0,I=0,N=0,_=0,S=0,R=0,J=0,Q=0,V=0,k=0,K=0,pe=0,ue=0,re=0,Y=0,se=0,te=r[0],ie=r[1],M=r[2],le=r[3],ae=r[4],fe=r[5],oe=r[6],ce=r[7],y=r[8],v=r[9],b=r[10],P=r[11],C=r[12],O=r[13],L=r[14],x=r[15];n=e[0],s+=n*te,o+=n*ie,a+=n*M,u+=n*le,l+=n*ae,f+=n*fe,d+=n*oe,g+=n*ce,w+=n*y,E+=n*v,T+=n*b,D+=n*P,B+=n*C,W+=n*O,U+=n*L,A+=n*x,n=e[1],o+=n*te,a+=n*ie,u+=n*M,l+=n*le,f+=n*ae,d+=n*fe,g+=n*oe,w+=n*ce,E+=n*y,T+=n*v,D+=n*b,B+=n*P,W+=n*C,U+=n*O,A+=n*L,I+=n*x,n=e[2],a+=n*te,u+=n*ie,l+=n*M,f+=n*le,d+=n*ae,g+=n*fe,w+=n*oe,E+=n*ce,T+=n*y,D+=n*v,B+=n*b,W+=n*P,U+=n*C,A+=n*O,I+=n*L,N+=n*x,n=e[3],u+=n*te,l+=n*ie,f+=n*M,d+=n*le,g+=n*ae,w+=n*fe,E+=n*oe,T+=n*ce,D+=n*y,B+=n*v,W+=n*b,U+=n*P,A+=n*C,I+=n*O,N+=n*L,_+=n*x,n=e[4],l+=n*te,f+=n*ie,d+=n*M,g+=n*le,w+=n*ae,E+=n*fe,T+=n*oe,D+=n*ce,B+=n*y,W+=n*v,U+=n*b,A+=n*P,I+=n*C,N+=n*O,_+=n*L,S+=n*x,n=e[5],f+=n*te,d+=n*ie,g+=n*M,w+=n*le,E+=n*ae,T+=n*fe,D+=n*oe,B+=n*ce,W+=n*y,U+=n*v,A+=n*b,I+=n*P,N+=n*C,_+=n*O,S+=n*L,R+=n*x,n=e[6],d+=n*te,g+=n*ie,w+=n*M,E+=n*le,T+=n*ae,D+=n*fe,B+=n*oe,W+=n*ce,U+=n*y,A+=n*v,I+=n*b,N+=n*P,_+=n*C,S+=n*O,R+=n*L,J+=n*x,n=e[7],g+=n*te,w+=n*ie,E+=n*M,T+=n*le,D+=n*ae,B+=n*fe,W+=n*oe,U+=n*ce,A+=n*y,I+=n*v,N+=n*b,_+=n*P,S+=n*C,R+=n*O,J+=n*L,Q+=n*x,n=e[8],w+=n*te,E+=n*ie,T+=n*M,D+=n*le,B+=n*ae,W+=n*fe,U+=n*oe,A+=n*ce,I+=n*y,N+=n*v,_+=n*b,S+=n*P,R+=n*C,J+=n*O,Q+=n*L,V+=n*x,n=e[9],E+=n*te,T+=n*ie,D+=n*M,B+=n*le,W+=n*ae,U+=n*fe,A+=n*oe,I+=n*ce,N+=n*y,_+=n*v,S+=n*b,R+=n*P,J+=n*C,Q+=n*O,V+=n*L,k+=n*x,n=e[10],T+=n*te,D+=n*ie,B+=n*M,W+=n*le,U+=n*ae,A+=n*fe,I+=n*oe,N+=n*ce,_+=n*y,S+=n*v,R+=n*b,J+=n*P,Q+=n*C,V+=n*O,k+=n*L,K+=n*x,n=e[11],D+=n*te,B+=n*ie,W+=n*M,U+=n*le,A+=n*ae,I+=n*fe,N+=n*oe,_+=n*ce,S+=n*y,R+=n*v,J+=n*b,Q+=n*P,V+=n*C,k+=n*O,K+=n*L,pe+=n*x,n=e[12],B+=n*te,W+=n*ie,U+=n*M,A+=n*le,I+=n*ae,N+=n*fe,_+=n*oe,S+=n*ce,R+=n*y,J+=n*v,Q+=n*b,V+=n*P,k+=n*C,K+=n*O,pe+=n*L,ue+=n*x,n=e[13],W+=n*te,U+=n*ie,A+=n*M,I+=n*le,N+=n*ae,_+=n*fe,S+=n*oe,R+=n*ce,J+=n*y,Q+=n*v,V+=n*b,k+=n*P,K+=n*C,pe+=n*O,ue+=n*L,re+=n*x,n=e[14],U+=n*te,A+=n*ie,I+=n*M,N+=n*le,_+=n*ae,S+=n*fe,R+=n*oe,J+=n*ce,Q+=n*y,V+=n*v,k+=n*b,K+=n*P,pe+=n*C,ue+=n*O,re+=n*L,Y+=n*x,n=e[15],A+=n*te,I+=n*ie,N+=n*M,_+=n*le,S+=n*ae,R+=n*fe,J+=n*oe,Q+=n*ce,V+=n*y,k+=n*v,K+=n*b,pe+=n*P,ue+=n*C,re+=n*O,Y+=n*L,se+=n*x,s+=38*I,o+=38*N,a+=38*_,u+=38*S,l+=38*R,f+=38*J,d+=38*Q,g+=38*V,w+=38*k,E+=38*K,T+=38*pe,D+=38*ue,B+=38*re,W+=38*Y,U+=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=w+i+65535,i=Math.floor(n/65536),w=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=T+i+65535,i=Math.floor(n/65536),T=n-i*65536,n=D+i+65535,i=Math.floor(n/65536),D=n-i*65536,n=B+i+65535,i=Math.floor(n/65536),B=n-i*65536,n=W+i+65535,i=Math.floor(n/65536),W=n-i*65536,n=U+i+65535,i=Math.floor(n/65536),U=n-i*65536,n=A+i+65535,i=Math.floor(n/65536),A=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=w+i+65535,i=Math.floor(n/65536),w=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=T+i+65535,i=Math.floor(n/65536),T=n-i*65536,n=D+i+65535,i=Math.floor(n/65536),D=n-i*65536,n=B+i+65535,i=Math.floor(n/65536),B=n-i*65536,n=W+i+65535,i=Math.floor(n/65536),W=n-i*65536,n=U+i+65535,i=Math.floor(n/65536),U=n-i*65536,n=A+i+65535,i=Math.floor(n/65536),A=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]=w,t[9]=E,t[10]=T,t[11]=D,t[12]=B,t[13]=W,t[14]=U,t[15]=A}function tl(t,e){ri(t,e,e)}function RW(t,e){let r=Cn();for(let n=0;n<16;n++)r[n]=e[n];for(let n=253;n>=0;n--)tl(r,r),n!==2&&n!==4&&ri(r,r,e);for(let n=0;n<16;n++)t[n]=r[n]}function oA(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 w=0;w<31;w++)r[w]=t[w];r[31]=t[31]&127|64,r[0]&=248,PW(n,e);for(let w=0;w<16;w++)s[w]=n[w];i[0]=a[0]=1;for(let w=254;w>=0;--w){let E=r[w>>>3]>>>(w&7)&1;el(i,s,E),el(o,a,E),vp(u,i,o),Ap(i,i,o),vp(o,s,a),Ap(s,s,a),tl(a,u),tl(l,i),ri(i,o,i),ri(o,s,u),vp(u,i,o),Ap(i,i,o),tl(s,i),Ap(o,a,l),ri(i,o,OW),vp(i,i,a),ri(o,o,i),ri(i,a,l),ri(a,s,n),tl(s,u),el(i,s,E),el(o,a,E)}for(let w=0;w<16;w++)n[w+16]=i[w],n[w+32]=o[w],n[w+48]=s[w],n[w+64]=a[w];let f=n.subarray(32),d=n.subarray(16);RW(f,f),ri(d,d,f);let g=new Uint8Array(32);return DW(g,d),g}gt.scalarMult=oA;function dP(t){return oA(t,hP)}gt.scalarMultBase=dP;function pP(t){if(t.length!==gt.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${gt.SECRET_KEY_LENGTH} bytes`);let e=new Uint8Array(t);return{publicKey:dP(e),secretKey:e}}gt.generateKeyPairFromSeed=pP;function BW(t){let e=(0,xW.randomBytes)(32,t),r=pP(e);return(0,NW.wipe)(e),r}gt.generateKeyPair=BW;function LW(t,e,r=!1){if(t.length!==gt.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(e.length!==gt.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");let n=oA(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 wP(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r{c()});function vP(t,e){if(t.length!==e.length)throw new Error("Inputs should have the same length");let r=Ra(t.length);for(let n=0;n{c();op();jc()});var aA={};ft(aA,{compare:()=>yP,concat:()=>ap,equals:()=>wP,fromString:()=>Sn,toString:()=>Zn,xor:()=>vP});var uA=ge(()=>{c();mP();A1();EP();z1();$1();AP()});var RP=m(st=>{"use strict";c();var bP=st&&st.__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 NP:typeof navigator<"u"?cA(navigator.userAgent):PP()}st.detect=qW;function OP(t){return t!==""&&UW.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 VW(t){var e=OP(t);return e?e[0]:null}st.browserName=VW;function cA(t){var e=OP(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new xP;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length<_P&&(i=bP(bP([],i,!0),HW(_P-i.length),!0)):i=[];var s=i.join("."),o=DP(t),a=MW.exec(t);return a&&a[1]?new CP(r,s,o,a[1]):new SP(r,s,o)}st.parseUserAgent=cA;function DP(t){for(var e=0,r=IP.length;e{"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 Ks(t){let e;return typeof window<"u"&&typeof window[t]<"u"&&(e=window[t]),e}Ye.getFromWindow=Ks;function Ha(t){let e=Ks(t);if(!e)throw new Error(`${t} is not defined in Window`);return e}Ye.getFromWindowOrThrow=Ha;function GW(){return Ha("document")}Ye.getDocumentOrThrow=GW;function kW(){return Ks("document")}Ye.getDocument=kW;function jW(){return Ha("navigator")}Ye.getNavigatorOrThrow=jW;function QW(){return Ks("navigator")}Ye.getNavigator=QW;function WW(){return Ha("location")}Ye.getLocationOrThrow=WW;function $W(){return Ks("location")}Ye.getLocation=$W;function zW(){return Ha("crypto")}Ye.getCryptoOrThrow=zW;function KW(){return Ks("crypto")}Ye.getCrypto=KW;function YW(){return Ha("localStorage")}Ye.getLocalStorageOrThrow=YW;function JW(){return Ks("localStorage")}Ye.getLocalStorage=JW});var LP=m(bp=>{"use strict";c();Object.defineProperty(bp,"__esModule",{value:!0});bp.getWindowMetadata=void 0;var BP=lA();function XW(){let t,e;try{t=BP.getDocumentOrThrow(),e=BP.getLocationOrThrow()}catch{return null}function r(){let d=t.getElementsByTagName("link"),g=[];for(let w=0;w-1){let D=E.getAttribute("href");if(D)if(D.toLowerCase().indexOf("https:")===-1&&D.toLowerCase().indexOf("http:")===-1&&D.indexOf("//")!==0){let B=e.protocol+"//"+e.host;if(D.indexOf("/")===0)B+=D;else{let W=e.pathname.split("/");W.pop();let U=W.join("/");B+=U+"/"+D}g.push(B)}else if(D.indexOf("//")===0){let B=e.protocol+D;g.push(B)}else g.push(D)}}return g}function n(...d){let g=t.getElementsByTagName("meta");for(let w=0;wE.getAttribute(D)).filter(D=>D?d.includes(D):!1);if(T.length&&T){let D=E.getAttribute("content");if(D)return D}}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}}bp.getWindowMetadata=XW});var MP=m(($de,FP)=>{"use strict";c();FP.exports=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)});var GP=m((Kde,HP)=>{"use strict";c();var VP="%[a-f0-9]{2}",UP=new RegExp("("+VP+")|([^%]+?)","gi"),qP=new RegExp("("+VP+")+","gi");function fA(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([],fA(r),fA(n))}function ZW(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(UP)||[],r=1;r{"use strict";c();kP.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 WP=m((Zde,QP)=>{"use strict";c();QP.exports=function(t,e){for(var r={},n=Object.keys(t),i=Array.isArray(e),s=0;s{"use strict";c();var t$=MP(),r$=GP(),zP=jP(),n$=WP(),i$=t=>t==null,hA=Symbol("encodeFragmentIdentifier");function s$(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,[vt(e,t),"[",i,"]"].join("")]:[...r,[vt(e,t),"[",vt(i,t),"]=",vt(n,t)].join("")]};case"bracket":return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[vt(e,t),"[]"].join("")]:[...r,[vt(e,t),"[]=",vt(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,[vt(e,t),":list="].join("")]:[...r,[vt(e,t),":list=",vt(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?[[vt(r,t),e,vt(i,t)].join("")]:[[n,vt(i,t)].join(t.arrayFormatSeparator)])}default:return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,vt(e,t)]:[...r,[vt(e,t),"=",vt(n,t)].join("")]}}function o$(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&&ni(n,t).includes(t.arrayFormatSeparator);n=o?ni(n,t):n;let a=s||o?n.split(t.arrayFormatSeparator).map(u=>ni(u,t)):n===null?n:ni(n,t);i[r]=a};case"bracket-separator":return(r,n,i)=>{let s=/(\[\])$/.test(r);if(r=r.replace(/\[\]$/,""),!s){i[r]=n&&ni(n,t);return}let o=n===null?[]:n.split(t.arrayFormatSeparator).map(a=>ni(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 KP(t){if(typeof t!="string"||t.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function vt(t,e){return e.encode?e.strict?t$(t):encodeURIComponent(t):t}function ni(t,e){return e.decode?r$(t):t}function YP(t){return Array.isArray(t)?t.sort():typeof t=="object"?YP(Object.keys(t)).sort((e,r)=>Number(e)-Number(r)).map(e=>t[e]):t}function JP(t){let e=t.indexOf("#");return e!==-1&&(t=t.slice(0,e)),t}function a$(t){let e="",r=t.indexOf("#");return r!==-1&&(e=t.slice(r)),e}function XP(t){t=JP(t);let e=t.indexOf("?");return e===-1?"":t.slice(e+1)}function $P(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 ZP(t,e){e=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},e),KP(e.arrayFormatSeparator);let r=o$(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]=zP(e.decode?i.replace(/\+/g," "):i,"=");o=o===void 0?null:["comma","separator","bracket-separator"].includes(e.arrayFormat)?o:ni(o,e),r(ni(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]=$P(s[o],e);else n[i]=$P(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]=YP(o):i[s]=o,i},Object.create(null))}pr.extract=XP;pr.parse=ZP;pr.stringify=(t,e)=>{if(!t)return"";e=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},e),KP(e.arrayFormatSeparator);let r=o=>e.skipNull&&i$(t[o])||e.skipEmptyString&&t[o]==="",n=s$(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?vt(o,e):Array.isArray(a)?a.length===0&&e.arrayFormat==="bracket-separator"?vt(o,e)+"[]":a.reduce(n(o),[]).join("&"):vt(o,e)+"="+vt(a,e)}).filter(o=>o.length>0).join("&")};pr.parseUrl=(t,e)=>{e=Object.assign({decode:!0},e);let[r,n]=zP(t,"#");return Object.assign({url:r.split("?")[0]||"",query:ZP(XP(t),e)},e&&e.parseFragmentIdentifier&&n?{fragmentIdentifier:ni(n,e)}:{})};pr.stringifyUrl=(t,e)=>{e=Object.assign({encode:!0,strict:!0,[hA]:!0},e);let r=JP(t.url).split("?")[0]||"",n=pr.extract(t.url),i=pr.parse(n,{sort:!1}),s=Object.assign(i,t.query),o=pr.stringify(s,e);o&&(o=`?${o}`);let a=a$(t.url);return t.fragmentIdentifier&&(a=`#${e[hA]?vt(t.fragmentIdentifier,e):t.fragmentIdentifier}`),`${r}${o}${a}`};pr.pick=(t,e,r)=>{r=Object.assign({parseFragmentIdentifier:!0,[hA]:!1},r);let{url:n,query:i,fragmentIdentifier:s}=pr.parseUrl(t,r);return pr.stringifyUrl({url:n,query:n$(i,e),fragmentIdentifier:s},r)};pr.exclude=(t,e,r)=>{let n=Array.isArray(e)?i=>!e.includes(i):(i,s)=>!e(i,s);return pr.pick(t,n,r)}});var t3=ge(()=>{c()});function Gi(t,e,r="string"){if(!t[e]||typeof t[e]!==r)throw new Error(`Missing or invalid "${e}" param`)}function u$(t,e){let r=!0;return e.forEach(n=>{n in t||(r=!1)}),r}function c$(t,e){return Array.isArray(t)?t.length===e:Object.keys(t).length===e}function l$(t,e){return Array.isArray(t)?t.length>=e:Object.keys(t).length>=e}function rl(t,e,r){return(!r.length?c$(t,e.length):l$(t,e.length))?u$(t,e):!1}function nl(t,e,r="_"){let n=t.split(r);return n[n.length-1].trim().toLowerCase()===e.trim().toLowerCase()}var dA=ge(()=>{c()});function f$(t){return _p(t.method)&&Ip(t.params)}function _p(t){return nl(t,"subscribe")}function Ip(t){return rl(t,["topic"],[])}function h$(t){return Sp(t.method)&&Tp(t.params)}function Sp(t){return nl(t,"publish")}function Tp(t){return rl(t,["message","topic","ttl"],["prompt","tag"])}function d$(t){return Cp(t.method)&&xp(t.params)}function Cp(t){return nl(t,"unsubscribe")}function xp(t){return rl(t,["id","topic"],[])}function p$(t){return Np(t.method)&&Op(t.params)}function Np(t){return nl(t,"subscription")}function Op(t){return rl(t,["id","data"],[])}var pA=ge(()=>{c();dA()});function g$(t){if(!_p(t.method))throw new Error("JSON-RPC Request has invalid subscribe method");if(!Ip(t.params))throw new Error("JSON-RPC Request has invalid subscribe params");let e=t.params;return Gi(e,"topic"),e}function y$(t){if(!Sp(t.method))throw new Error("JSON-RPC Request has invalid publish method");if(!Tp(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 m$(t){if(!Cp(t.method))throw new Error("JSON-RPC Request has invalid unsubscribe method");if(!xp(t.params))throw new Error("JSON-RPC Request has invalid unsubscribe params");let e=t.params;return Gi(e,"id"),e}function w$(t){if(!Np(t.method))throw new Error("JSON-RPC Request has invalid subscription method");if(!Op(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 r3=ge(()=>{c();dA();pA()});var E$,n3=ge(()=>{c();E$={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 i3={};ft(i3,{RELAY_JSONRPC:()=>E$,isPublishMethod:()=>Sp,isPublishParams:()=>Tp,isPublishRequest:()=>h$,isSubscribeMethod:()=>_p,isSubscribeParams:()=>Ip,isSubscribeRequest:()=>f$,isSubscriptionMethod:()=>Np,isSubscriptionParams:()=>Op,isSubscriptionRequest:()=>p$,isUnsubscribeMethod:()=>Cp,isUnsubscribeParams:()=>xp,isUnsubscribeRequest:()=>d$,parsePublishRequest:()=>y$,parseSubscribeRequest:()=>g$,parseSubscriptionRequest:()=>w$,parseUnsubscribeRequest:()=>m$});var s3=ge(()=>{c();t3();r3();n3();pA()});var cl=m(G=>{"use strict";c();Object.defineProperty(G,"__esModule",{value:!0});var g3=nP(),v$=cP(),y3=Vc(),vA=fP(),A$=gP(),ot=(uA(),ct(aA)),b$=RP(),Ga=ks(),il=lA(),_$=LP(),I$=e3(),S$=(s3(),ct(i3));function m3(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 w3=m3(A$),Dp=m3(I$),Bp=":";function E3(t){let[e,r]=t.split(Bp);return{namespace:e,reference:r}}function v3(t){let{namespace:e,reference:r}=t;return[e,r].join(Bp)}function AA(t){let[e,r,n]=t.split(Bp);return{namespace:e,reference:r,address:n}}function A3(t){let{namespace:e,reference:r,address:n}=t;return[e,r,n].join(Bp)}function bA(t,e){let r=[];return t.forEach(n=>{let i=e(n);r.includes(i)||r.push(i)}),r}function b3(t){let{address:e}=AA(t);return e}function _3(t){let{namespace:e,reference:r}=AA(t);return v3({namespace:e,reference:r})}function T$(t,e){let{namespace:r,reference:n}=E3(e);return A3({namespace:r,reference:n,address:t})}function C$(t){return bA(t,b3)}function I3(t){return bA(t,_3)}function x$(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 N$(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...I3(i.accounts))}),r}function O$(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...Lp(n,i))}),r}function Lp(t,e){return t.includes(":")?[t]:e.chains||[]}var Fp=t=>t?.split(":"),S3=t=>{let e=t&&Fp(t);if(e)return e[3]},D$=t=>{let e=t&&Fp(t);if(e)return e[2]+":"+e[3]},T3=t=>{let e=t&&Fp(t);if(e)return e.pop()},P$=(t,e)=>{let r=`${t.domain} wants you to sign in with your Ethereum account:`,n=T3(e),i=t.statement,s=`URI: ${t.aud}`,o=`Version: ${t.version}`,a=`Chain ID: ${S3(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(` -`)},lA="base10",tr="base16",Ip="base64pad",Np="utf8",fA=0,Ua=1,nz=0,HP=1,iA=12,hA=32;function iz(){let t=ZP.generateKeyPair();return{privateKey:ot.toString(t.secretKey,tr),publicKey:ot.toString(t.publicKey,tr)}}function sz(){let t=JP.randomBytes(hA);return ot.toString(t,tr)}function oz(t,e){let r=ZP.sharedKey(ot.fromString(t,tr),ot.fromString(e,tr)),n=new kW.HKDF(aA.SHA256,r).expand(hA);return ot.toString(n,tr)}function az(t){let e=aA.hash(ot.fromString(t,tr));return ot.toString(e,tr)}function uz(t){let e=aA.hash(ot.fromString(t,Np));return ot.toString(e,tr)}function u3(t){return ot.fromString(`${t}`,lA)}function nl(t){return Number(ot.toString(t,lA))}function cz(t){let e=u3(typeof t.type<"u"?t.type:fA);if(nl(e)===Ua&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");let r=typeof t.senderPublicKey<"u"?ot.fromString(t.senderPublicKey,tr):void 0,n=typeof t.iv<"u"?ot.fromString(t.iv,tr):JP.randomBytes(iA),i=new YP.ChaCha20Poly1305(ot.fromString(t.symKey,tr)).seal(n,ot.fromString(t.message,Np));return c3({type:e,sealed:i,iv:n,senderPublicKey:r})}function lz(t){let e=new YP.ChaCha20Poly1305(ot.fromString(t.symKey,tr)),{sealed:r,iv:n}=dA(t.encoded),i=e.open(n,r);if(i===null)throw new Error("Failed to decrypt");return ot.toString(i,Np)}function c3(t){if(nl(t.type)===Ua){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return ot.toString(ot.concat([t.type,t.senderPublicKey,t.iv,t.sealed]),Ip)}return ot.toString(ot.concat([t.type,t.iv,t.sealed]),Ip)}function dA(t){let e=ot.fromString(t,Ip),r=e.slice(nz,HP),n=HP;if(nl(r)===Ua){let a=n+hA,u=a+iA,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+iA,s=e.slice(n,i),o=e.slice(i);return{type:r,sealed:o,iv:s}}function fz(t,e){let r=dA(t);return l3({type:nl(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?ot.toString(r.senderPublicKey,tr):void 0,receiverPublicKey:e?.receiverPublicKey})}function l3(t){let e=t?.type||fA;if(e===Ua){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 hz(t){return t.type===Ua&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}var dz=Object.defineProperty,GP=Object.getOwnPropertySymbols,pz=Object.prototype.hasOwnProperty,gz=Object.prototype.propertyIsEnumerable,jP=(t,e,r)=>e in t?dz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,kP=(t,e)=>{for(var r in e||(e={}))pz.call(e,r)&&jP(t,r,e[r]);if(GP)for(var r of GP(e))gz.call(e,r)&&jP(t,r,e[r]);return t},f3="ReactNative",ei={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},Sp=" ",yz=":",h3="/",pA=2,mz=1e3,d3="js";function gA(){return typeof p.default<"u"&&typeof p.default.versions<"u"&&typeof p.default.versions.node<"u"}function p3(){return!tl.getDocument()&&!!tl.getNavigator()&&navigator.product===f3}function g3(){return!gA()&&!!tl.getNavigator()}function il(){return p3()?ei.reactNative:gA()?ei.node:g3()?ei.browser:ei.unknown}function y3(t,e){let r=_p.parse(t);return r=kP(kP({},r),e),t=_p.stringify(r),t}function wz(){return zW.getWindowMetadata()||{name:"",description:"",url:"",icons:[""]}}function Ez(t,e){var r;let n=il(),i={protocol:t,version:e,env:n};return n==="browser"&&(i.host=((r=tl.getLocation())==null?void 0:r.host)||"unknown"),i}function m3(){if(il()===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=WW.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 w3(){var t;let e=il();return e===ei.browser?[e,((t=tl.getLocation())==null?void 0:t.host)||"unknown"].join(":"):e}function E3(t,e,r){let n=m3(),i=w3();return[[t,e].join("-"),[d3,r].join("-"),n,i].join("/")}function vz({protocol:t,version:e,relayUrl:r,sdkVersion:n,auth:i,projectId:s,useOnCloseEvent:o}){let a=r.split("?"),u=E3(t,e,n),l={auth:i,ua:u,projectId:s,useOnCloseEvent:o||void 0},f=y3(a[1]||"",l);return a[0]+"?"+f}function Az(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 bz(t,e,r){if(!t[e]||typeof t[e]!==r)throw new Error(`Missing or invalid "${e}" param`)}function v3(t,e=pA){return A3(t.split(h3),e)}function _z(t){return v3(t).join(Sp)}function Ui(t,e){return t.filter(r=>e.includes(r)).length===t.length}function A3(t,e=pA){return t.slice(Math.max(t.length-e,0))}function Iz(t){return Object.fromEntries(t.entries())}function Sz(t){return new Map(Object.entries(t))}function Tz(t,e){let r={};return Object.keys(t).forEach(n=>{r[n]=e(t[n])}),r}var Cz=t=>t;function b3(t){return t.trim().replace(/^\w/,e=>e.toUpperCase())}function xz(t){return t.split(Sp).map(e=>b3(e)).join(Sp)}function Nz(t=Ma.FIVE_MINUTES,e){let r=Ma.toMiliseconds(t||Ma.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 Oz(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 yA(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 Dz(t){return yA("topic",t)}function Pz(t){return yA("id",t)}function Rz(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 Bz(t,e){return Ma.fromMiliseconds((e||Date.now())+Ma.toMiliseconds(t))}function Lz(t){return Date.now()>=Ma.toMiliseconds(t)}function Fz(t,e){return`${t}${e?`:${e}`:""}`}function qi(t=[],e=[]){return[...new Set([...t,...e])]}async function Mz({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=il();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 _3="irn";function Uz(t){return t?.relay||{protocol:_3}}function qz(t){let e=KW.RELAY_JSONRPC[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var Vz=Object.defineProperty,QP=Object.getOwnPropertySymbols,Hz=Object.prototype.hasOwnProperty,Gz=Object.prototype.propertyIsEnumerable,WP=(t,e,r)=>e in t?Vz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jz=(t,e)=>{for(var r in e||(e={}))Hz.call(e,r)&&WP(t,r,e[r]);if(QP)for(var r of QP(e))Gz.call(e,r)&&WP(t,r,e[r]);return t};function I3(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 kz(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=_p.parse(s);return{protocol:n,topic:S3(i[0]),version:parseInt(i[1],10),symKey:o.symKey,relay:I3(o)}}function S3(t){return t.startsWith("//")?t.substring(2):t}function T3(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 Qz(t){return`${t.protocol}:${t.topic}@${t.version}?`+_p.stringify(jz({symKey:t.symKey},T3(t.relay)))}var Wz=Object.defineProperty,zz=Object.defineProperties,$z=Object.getOwnPropertyDescriptors,zP=Object.getOwnPropertySymbols,Kz=Object.prototype.hasOwnProperty,Yz=Object.prototype.propertyIsEnumerable,$P=(t,e,r)=>e in t?Wz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Jz=(t,e)=>{for(var r in e||(e={}))Kz.call(e,r)&&$P(t,r,e[r]);if(zP)for(var r of zP(e))Yz.call(e,r)&&$P(t,r,e[r]);return t},Xz=(t,e)=>zz(t,$z(e));function Qs(t){let e=[];return t.forEach(r=>{let[n,i]=r.split(":");e.push(`${n}:${i}`)}),e}function C3(t){let e=[];return Object.values(t).forEach(r=>{e.push(...Qs(r.accounts))}),e}function x3(t,e){let r=[];return Object.values(t).forEach(n=>{Qs(n.accounts).includes(e)&&r.push(...n.methods)}),r}function N3(t,e){let r=[];return Object.values(t).forEach(n=>{Qs(n.accounts).includes(e)&&r.push(...n.events)}),r}function Zz(t,e){let r=M3(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 e$(t){let{proposal:{requiredNamespaces:e,optionalNamespaces:r={}},supportedNamespaces:n}=t,i=sA(e),s=sA(r),o={};Object.keys(n).forEach(l=>{let f=n[l].chains,d=n[l].methods,g=n[l].events,w=n[l].accounts;f.forEach(E=>{if(!w.some(x=>x.includes(E)))throw new Error(`No accounts provided for chain ${E} in namespace ${l}`)}),o[l]={chains:f,methods:d,events:g,accounts:w}});let a=q3(e,o,"approve()");if(a)throw new Error(a.message);let u={};return!Object.keys(e).length&&!Object.keys(r).length?o:(Object.keys(i).forEach(l=>{let f=n[l].chains.filter(E=>{var x,O;return(O=(x=i[l])==null?void 0:x.chains)==null?void 0:O.includes(E)}),d=n[l].methods.filter(E=>{var x,O;return(O=(x=i[l])==null?void 0:x.methods)==null?void 0:O.includes(E)}),g=n[l].events.filter(E=>{var x,O;return(O=(x=i[l])==null?void 0:x.events)==null?void 0:O.includes(E)}),w=f.map(E=>n[l].accounts.filter(x=>x.includes(`${E}:`))).flat();u[l]={chains:f,methods:d,events:g,accounts:w}}),Object.keys(s).forEach(l=>{var f,d,g,w,E,x;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:qi((g=u[l])==null?void 0:g.chains,O),methods:qi((w=u[l])==null?void 0:w.methods,F),events:qi((E=u[l])==null?void 0:E.events,_),accounts:qi((x=u[l])==null?void 0:x.accounts,I)}}),u)}function mA(t){return t.includes(":")}function O3(t){return mA(t)?t.split(":")[0]:t}function sA(t){var e,r,n;let i={};if(!Op(t))return i;for(let[s,o]of Object.entries(t)){let a=mA(s)?[s]:o.chains,u=o.methods||[],l=o.events||[],f=O3(s);i[f]=Xz(Jz({},i[f]),{chains:qi(a,(e=i[f])==null?void 0:e.chains),methods:qi(u,(r=i[f])==null?void 0:r.methods),events:qi(l,(n=i[f])==null?void 0:n.events)})}return i}var t$={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}},r$={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}=r$[t];return{message:e?`${r} ${e}`:r,code:n}}function ks(t,e){let{message:r,code:n}=t$[t];return{message:e?`${r} ${e}`:r,code:n}}function sl(t,e){return Array.isArray(t)?typeof e<"u"&&t.length?t.every(e):!0:!1}function Op(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function Vi(t){return typeof t>"u"}function Er(t,e){return e&&Vi(t)?!0:typeof t=="string"&&!!t.trim().length}function Dp(t,e){return e&&Vi(t)?!0:typeof t=="number"&&!isNaN(t)}function n$(t,e){let{requiredNamespaces:r}=e,n=Object.keys(t.namespaces),i=Object.keys(r),s=!0;return Ui(i,n)?(n.forEach(o=>{let{accounts:a,methods:u,events:l}=t.namespaces[o],f=Qs(a),d=r[o];(!Ui(Cp(o,d),f)||!Ui(d.methods,u)||!Ui(d.events,l))&&(s=!1)}),s):!1}function rl(t){return Er(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function D3(t){if(Er(t,!1)&&t.includes(":")){let e=t.split(":");if(e.length===3){let r=e[0]+":"+e[1];return!!e[2]&&rl(r)}}return!1}function i$(t){if(Er(t,!1))try{return typeof new URL(t)<"u"}catch{return!1}return!1}function s$(t){var e;return(e=t?.proposer)==null?void 0:e.publicKey}function o$(t){return t?.topic}function a$(t,e){let r=null;return Er(t?.publicKey,!1)||(r=Zn("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function oA(t){let e=!0;return sl(t)?t.length&&(e=t.every(r=>Er(r,!1))):e=!1,e}function P3(t,e,r){let n=null;return sl(e)&&e.length?e.forEach(i=>{n||rl(i)||(n=ks("UNSUPPORTED_CHAINS",`${r}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):rl(t)||(n=ks("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 R3(t,e,r){let n=null;return Object.entries(t).forEach(([i,s])=>{if(n)return;let o=P3(i,Cp(i,s),`${e} ${r}`);o&&(n=o)}),n}function B3(t,e){let r=null;return sl(t)?t.forEach(n=>{r||D3(n)||(r=ks("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):r=ks("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function L3(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;let i=B3(n?.accounts,`${e} namespace`);i&&(r=i)}),r}function F3(t,e){let r=null;return oA(t?.methods)?oA(t?.events)||(r=ks("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=ks("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function wA(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;let i=F3(n,`${e}, namespace`);i&&(r=i)}),r}function u$(t,e,r){let n=null;if(t&&Op(t)){let i=wA(t,e);i&&(n=i);let s=R3(t,e,r);s&&(n=s)}else n=Zn("MISSING_OR_INVALID",`${e}, ${r} should be an object with data`);return n}function M3(t,e){let r=null;if(t&&Op(t)){let n=wA(t,e);n&&(r=n);let i=L3(t,e);i&&(r=i)}else r=Zn("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function U3(t){return Er(t.protocol,!0)}function c$(t,e){let r=!1;return e&&!t?r=!0:t&&sl(t)&&t.length&&t.forEach(n=>{r=U3(n)}),r}function l$(t){return typeof t=="number"}function f$(t){return typeof t<"u"&&typeof t!==null}function h$(t){return!(!t||typeof t!="object"||!t.code||!Dp(t.code,!1)||!t.message||!Er(t.message,!1))}function d$(t){return!(Vi(t)||!Er(t.method,!1))}function p$(t){return!(Vi(t)||Vi(t.result)&&Vi(t.error)||!Dp(t.id,!1)||!Er(t.jsonrpc,!1))}function g$(t){return!(Vi(t)||!Er(t.name,!1))}function y$(t,e){return!(!rl(e)||!C3(t).includes(e))}function m$(t,e,r){return Er(r,!1)?x3(t,e).includes(r):!1}function w$(t,e,r){return Er(r,!1)?N3(t,e).includes(r):!1}function q3(t,e,r){let n=null,i=E$(t),s=v$(e),o=Object.keys(i),a=Object.keys(s),u=KP(Object.keys(t)),l=KP(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. +`)},_A="base10",rr="base16",Pp="base64pad",Mp="utf8",IA=0,ka=1,R$=0,o3=1,yA=12,SA=32;function B$(){let t=w3.generateKeyPair();return{privateKey:ot.toString(t.secretKey,rr),publicKey:ot.toString(t.publicKey,rr)}}function L$(){let t=y3.randomBytes(SA);return ot.toString(t,rr)}function F$(t,e){let r=w3.sharedKey(ot.fromString(t,rr),ot.fromString(e,rr),!0),n=new v$.HKDF(vA.SHA256,r).expand(SA);return ot.toString(n,rr)}function M$(t){let e=vA.hash(ot.fromString(t,rr));return ot.toString(e,rr)}function U$(t){let e=vA.hash(ot.fromString(t,Mp));return ot.toString(e,rr)}function C3(t){return ot.fromString(`${t}`,_A)}function ol(t){return Number(ot.toString(t,_A))}function q$(t){let e=C3(typeof t.type<"u"?t.type:IA);if(ol(e)===ka&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");let r=typeof t.senderPublicKey<"u"?ot.fromString(t.senderPublicKey,rr):void 0,n=typeof t.iv<"u"?ot.fromString(t.iv,rr):y3.randomBytes(yA),i=new g3.ChaCha20Poly1305(ot.fromString(t.symKey,rr)).seal(n,ot.fromString(t.message,Mp));return x3({type:e,sealed:i,iv:n,senderPublicKey:r})}function V$(t){let e=new g3.ChaCha20Poly1305(ot.fromString(t.symKey,rr)),{sealed:r,iv:n}=TA(t.encoded),i=e.open(n,r);if(i===null)throw new Error("Failed to decrypt");return ot.toString(i,Mp)}function x3(t){if(ol(t.type)===ka){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return ot.toString(ot.concat([t.type,t.senderPublicKey,t.iv,t.sealed]),Pp)}return ot.toString(ot.concat([t.type,t.iv,t.sealed]),Pp)}function TA(t){let e=ot.fromString(t,Pp),r=e.slice(R$,o3),n=o3;if(ol(r)===ka){let a=n+SA,u=a+yA,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+yA,s=e.slice(n,i),o=e.slice(i);return{type:r,sealed:o,iv:s}}function H$(t,e){let r=TA(t);return N3({type:ol(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?ot.toString(r.senderPublicKey,rr):void 0,receiverPublicKey:e?.receiverPublicKey})}function N3(t){let e=t?.type||IA;if(e===ka){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 G$(t){return t.type===ka&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}var k$=Object.defineProperty,a3=Object.getOwnPropertySymbols,j$=Object.prototype.hasOwnProperty,Q$=Object.prototype.propertyIsEnumerable,u3=(t,e,r)=>e in t?k$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,c3=(t,e)=>{for(var r in e||(e={}))j$.call(e,r)&&u3(t,r,e[r]);if(a3)for(var r of a3(e))Q$.call(e,r)&&u3(t,r,e[r]);return t},O3="ReactNative",tr={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},Rp=" ",W$=":",D3="/",CA=2,$$=1e3,P3="js";function xA(){return typeof p.default<"u"&&typeof p.default.versions<"u"&&typeof p.default.versions.node<"u"}function al(){return!il.getDocument()&&!!il.getNavigator()&&navigator.product===O3}function Up(){return!xA()&&!!il.getNavigator()}function Js(){return al()?tr.reactNative:xA()?tr.node:Up()?tr.browser:tr.unknown}function R3(t,e){let r=Dp.parse(t);return r=c3(c3({},r),e),t=Dp.stringify(r),t}function z$(){return _$.getWindowMetadata()||{name:"",description:"",url:"",icons:[""]}}function K$(t,e){var r;let n=Js(),i={protocol:t,version:e,env:n};return n==="browser"&&(i.host=((r=il.getLocation())==null?void 0:r.host)||"unknown"),i}function B3(){if(Js()===tr.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=b$.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 L3(){var t;let e=Js();return e===tr.browser?[e,((t=il.getLocation())==null?void 0:t.host)||"unknown"].join(":"):e}function F3(t,e,r){let n=B3(),i=L3();return[[t,e].join("-"),[P3,r].join("-"),n,i].join("/")}function Y$({protocol:t,version:e,relayUrl:r,sdkVersion:n,auth:i,projectId:s,useOnCloseEvent:o}){let a=r.split("?"),u=F3(t,e,n),l={auth:i,ua:u,projectId:s,useOnCloseEvent:o||void 0},f=R3(a[1]||"",l);return a[0]+"?"+f}function J$(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 X$(t,e,r){if(!t[e]||typeof t[e]!==r)throw new Error(`Missing or invalid "${e}" param`)}function M3(t,e=CA){return U3(t.split(D3),e)}function Z$(t){return M3(t).join(Rp)}function ki(t,e){return t.filter(r=>e.includes(r)).length===t.length}function U3(t,e=CA){return t.slice(Math.max(t.length-e,0))}function ez(t){return Object.fromEntries(t.entries())}function tz(t){return new Map(Object.entries(t))}function rz(t,e){let r={};return Object.keys(t).forEach(n=>{r[n]=e(t[n])}),r}var nz=t=>t;function q3(t){return t.trim().replace(/^\w/,e=>e.toUpperCase())}function iz(t){return t.split(Rp).map(e=>q3(e)).join(Rp)}function sz(t=Ga.FIVE_MINUTES,e){let r=Ga.toMiliseconds(t||Ga.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 oz(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 NA(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 az(t){return NA("topic",t)}function uz(t){return NA("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 lz(t,e){return Ga.fromMiliseconds((e||Date.now())+Ga.toMiliseconds(t))}function fz(t){return Date.now()>=Ga.toMiliseconds(t)}function hz(t,e){return`${t}${e?`:${e}`:""}`}function ji(t=[],e=[]){return[...new Set([...t,...e])]}async function dz({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=Js();o===tr.browser?s.startsWith("https://")?window.open(s,"_blank","noreferrer noopener"):window.open(s,"_self","noreferrer noopener"):o===tr.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(s)}catch(n){console.error(n)}}var V3="irn";function pz(t){return t?.relay||{protocol:V3}}function gz(t){let e=S$.RELAY_JSONRPC[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var yz=Object.defineProperty,l3=Object.getOwnPropertySymbols,mz=Object.prototype.hasOwnProperty,wz=Object.prototype.propertyIsEnumerable,f3=(t,e,r)=>e in t?yz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Ez=(t,e)=>{for(var r in e||(e={}))mz.call(e,r)&&f3(t,r,e[r]);if(l3)for(var r of l3(e))wz.call(e,r)&&f3(t,r,e[r]);return t};function H3(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 vz(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=Dp.parse(s);return{protocol:n,topic:G3(i[0]),version:parseInt(i[1],10),symKey:o.symKey,relay:H3(o)}}function G3(t){return t.startsWith("//")?t.substring(2):t}function k3(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 Az(t){return`${t.protocol}:${t.topic}@${t.version}?`+Dp.stringify(Ez({symKey:t.symKey},k3(t.relay)))}var bz=Object.defineProperty,_z=Object.defineProperties,Iz=Object.getOwnPropertyDescriptors,h3=Object.getOwnPropertySymbols,Sz=Object.prototype.hasOwnProperty,Tz=Object.prototype.propertyIsEnumerable,d3=(t,e,r)=>e in t?bz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Cz=(t,e)=>{for(var r in e||(e={}))Sz.call(e,r)&&d3(t,r,e[r]);if(h3)for(var r of h3(e))Tz.call(e,r)&&d3(t,r,e[r]);return t},xz=(t,e)=>_z(t,Iz(e));function Xs(t){let e=[];return t.forEach(r=>{let[n,i]=r.split(":");e.push(`${n}:${i}`)}),e}function j3(t){let e=[];return Object.values(t).forEach(r=>{e.push(...Xs(r.accounts))}),e}function Q3(t,e){let r=[];return Object.values(t).forEach(n=>{Xs(n.accounts).includes(e)&&r.push(...n.methods)}),r}function W3(t,e){let r=[];return Object.values(t).forEach(n=>{Xs(n.accounts).includes(e)&&r.push(...n.events)}),r}function Nz(t,e){let r=eR(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 Oz(t){let{proposal:{requiredNamespaces:e,optionalNamespaces:r={}},supportedNamespaces:n}=t,i=mA(e),s=mA(r),o={};Object.keys(n).forEach(l=>{let f=n[l].chains,d=n[l].methods,g=n[l].events,w=n[l].accounts;f.forEach(E=>{if(!w.some(T=>T.includes(E)))throw new Error(`No accounts provided for chain ${E} in namespace ${l}`)}),o[l]={chains:f,methods:d,events:g,accounts:w}});let a=rR(e,o,"approve()");if(a)throw new Error(a.message);let u={};return!Object.keys(e).length&&!Object.keys(r).length?o:(Object.keys(i).forEach(l=>{let f=n[l].chains.filter(E=>{var T,D;return(D=(T=i[l])==null?void 0:T.chains)==null?void 0:D.includes(E)}),d=n[l].methods.filter(E=>{var T,D;return(D=(T=i[l])==null?void 0:T.methods)==null?void 0:D.includes(E)}),g=n[l].events.filter(E=>{var T,D;return(D=(T=i[l])==null?void 0:T.events)==null?void 0:D.includes(E)}),w=f.map(E=>n[l].accounts.filter(T=>T.includes(`${E}:`))).flat();u[l]={chains:f,methods:d,events:g,accounts:w}}),Object.keys(s).forEach(l=>{var f,d,g,w,E,T;if(!n[l])return;let D=(d=(f=s[l])==null?void 0:f.chains)==null?void 0:d.filter(A=>n[l].chains.includes(A)),B=n[l].methods.filter(A=>{var I,N;return(N=(I=s[l])==null?void 0:I.methods)==null?void 0:N.includes(A)}),W=n[l].events.filter(A=>{var I,N;return(N=(I=s[l])==null?void 0:I.events)==null?void 0:N.includes(A)}),U=D?.map(A=>n[l].accounts.filter(I=>I.includes(`${A}:`))).flat();u[l]={chains:ji((g=u[l])==null?void 0:g.chains,D),methods:ji((w=u[l])==null?void 0:w.methods,B),events:ji((E=u[l])==null?void 0:E.events,W),accounts:ji((T=u[l])==null?void 0:T.accounts,U)}}),u)}function OA(t){return t.includes(":")}function $3(t){return OA(t)?t.split(":")[0]:t}function mA(t){var e,r,n;let i={};if(!qp(t))return i;for(let[s,o]of Object.entries(t)){let a=OA(s)?[s]:o.chains,u=o.methods||[],l=o.events||[],f=$3(s);i[f]=xz(Cz({},i[f]),{chains:ji(a,(e=i[f])==null?void 0:e.chains),methods:ji(u,(r=i[f])==null?void 0:r.methods),events:ji(l,(n=i[f])==null?void 0:n.events)})}return i}var Dz={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}},Pz={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 ii(t,e){let{message:r,code:n}=Pz[t];return{message:e?`${r} ${e}`:r,code:n}}function Ys(t,e){let{message:r,code:n}=Dz[t];return{message:e?`${r} ${e}`:r,code:n}}function ul(t,e){return Array.isArray(t)?typeof e<"u"&&t.length?t.every(e):!0:!1}function qp(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function Qi(t){return typeof t>"u"}function br(t,e){return e&&Qi(t)?!0:typeof t=="string"&&!!t.trim().length}function Vp(t,e){return e&&Qi(t)?!0:typeof t=="number"&&!isNaN(t)}function Rz(t,e){let{requiredNamespaces:r}=e,n=Object.keys(t.namespaces),i=Object.keys(r),s=!0;return ki(i,n)?(n.forEach(o=>{let{accounts:a,methods:u,events:l}=t.namespaces[o],f=Xs(a),d=r[o];(!ki(Lp(o,d),f)||!ki(d.methods,u)||!ki(d.events,l))&&(s=!1)}),s):!1}function sl(t){return br(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function z3(t){if(br(t,!1)&&t.includes(":")){let e=t.split(":");if(e.length===3){let r=e[0]+":"+e[1];return!!e[2]&&sl(r)}}return!1}function Bz(t){if(br(t,!1))try{return typeof new URL(t)<"u"}catch{return!1}return!1}function Lz(t){var e;return(e=t?.proposer)==null?void 0:e.publicKey}function Fz(t){return t?.topic}function Mz(t,e){let r=null;return br(t?.publicKey,!1)||(r=ii("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function wA(t){let e=!0;return ul(t)?t.length&&(e=t.every(r=>br(r,!1))):e=!1,e}function K3(t,e,r){let n=null;return ul(e)&&e.length?e.forEach(i=>{n||sl(i)||(n=Ys("UNSUPPORTED_CHAINS",`${r}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):sl(t)||(n=Ys("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 Y3(t,e,r){let n=null;return Object.entries(t).forEach(([i,s])=>{if(n)return;let o=K3(i,Lp(i,s),`${e} ${r}`);o&&(n=o)}),n}function J3(t,e){let r=null;return ul(t)?t.forEach(n=>{r||z3(n)||(r=Ys("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):r=Ys("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function X3(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;let i=J3(n?.accounts,`${e} namespace`);i&&(r=i)}),r}function Z3(t,e){let r=null;return wA(t?.methods)?wA(t?.events)||(r=Ys("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=Ys("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function DA(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;let i=Z3(n,`${e}, namespace`);i&&(r=i)}),r}function Uz(t,e,r){let n=null;if(t&&qp(t)){let i=DA(t,e);i&&(n=i);let s=Y3(t,e,r);s&&(n=s)}else n=ii("MISSING_OR_INVALID",`${e}, ${r} should be an object with data`);return n}function eR(t,e){let r=null;if(t&&qp(t)){let n=DA(t,e);n&&(r=n);let i=X3(t,e);i&&(r=i)}else r=ii("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function tR(t){return br(t.protocol,!0)}function qz(t,e){let r=!1;return e&&!t?r=!0:t&&ul(t)&&t.length&&t.forEach(n=>{r=tR(n)}),r}function Vz(t){return typeof t=="number"}function Hz(t){return typeof t<"u"&&typeof t!==null}function Gz(t){return!(!t||typeof t!="object"||!t.code||!Vp(t.code,!1)||!t.message||!br(t.message,!1))}function kz(t){return!(Qi(t)||!br(t.method,!1))}function jz(t){return!(Qi(t)||Qi(t.result)&&Qi(t.error)||!Vp(t.id,!1)||!br(t.jsonrpc,!1))}function Qz(t){return!(Qi(t)||!br(t.name,!1))}function Wz(t,e){return!(!sl(e)||!j3(t).includes(e))}function $z(t,e,r){return br(r,!1)?Q3(t,e).includes(r):!1}function zz(t,e,r){return br(r,!1)?W3(t,e).includes(r):!1}function rR(t,e,r){let n=null,i=Kz(t),s=Yz(e),o=Object.keys(i),a=Object.keys(s),u=p3(Object.keys(t)),l=p3(Object.keys(e)),f=u.filter(d=>!l.includes(d));return f.length&&(n=ii("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces. Required: ${f.toString()} - Received: ${Object.keys(e).toString()}`)),Ui(o,a)||(n=Zn("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces. + Received: ${Object.keys(e).toString()}`)),ki(o,a)||(n=ii("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces. Required: ${o.toString()} - Approved: ${a.toString()}`)),Object.keys(e).forEach(d=>{if(!d.includes(":")||n)return;let g=Qs(e[d].accounts);g.includes(d)||(n=Zn("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=Xs(e[d].accounts);g.includes(d)||(n=ii("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${d} Required: ${d} - Approved: ${g.toString()}`))}),o.forEach(d=>{n||(Ui(i[d].methods,s[d].methods)?Ui(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 E$(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 KP(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function v$(t){let e={};return Object.keys(t).forEach(r=>{r.includes(":")?e[r]=t[r]:Qs(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 A$(t,e){return Dp(t,!1)&&t<=e.max&&t>=e.min}k.BASE10=lA,k.BASE16=tr,k.BASE64=Ip,k.COLON=yz,k.DEFAULT_DEPTH=pA,k.EMPTY_SPACE=Sp,k.ENV_MAP=ei,k.ONE_THOUSAND=mz,k.REACT_NATIVE_PRODUCT=f3,k.RELAYER_DEFAULT_PROTOCOL=_3,k.SDK_TYPE=d3,k.SLASH=h3,k.TYPE_0=fA,k.TYPE_1=Ua,k.UTF8=Np,k.appendToQueryString=y3,k.assertType=bz,k.buildApprovedNamespaces=e$,k.calcExpiry=Bz,k.capitalize=xz,k.capitalizeWord=b3,k.createDelayedPromise=Nz,k.createExpiringPromise=Oz,k.decodeTypeByte=nl,k.decrypt=lz,k.deriveSymKey=oz,k.deserialize=dA,k.encodeTypeByte=u3,k.encrypt=cz,k.engineEvent=Fz,k.enumify=Cz,k.formatAccountId=r3,k.formatAccountWithChain=YW,k.formatChainId=t3,k.formatExpirerTarget=yA,k.formatIdTarget=Pz,k.formatMessage=rz,k.formatMessageContext=_z,k.formatRelayParams=T3,k.formatRelayRpcUrl=vz,k.formatTopicTarget=Dz,k.formatUA=E3,k.formatUri=Qz,k.generateKeyPair=iz,k.generateRandomBytes32=sz,k.getAccountsChains=Qs,k.getAccountsFromNamespaces=XW,k.getAddressFromAccount=n3,k.getAddressesFromAccounts=JW,k.getAppMetadata=wz,k.getChainFromAccount=i3,k.getChainsFromAccounts=s3,k.getChainsFromNamespace=Cp,k.getChainsFromNamespaces=ZW,k.getChainsFromRequiredNamespaces=ez,k.getDidAddress=a3,k.getDidAddressSegments=xp,k.getDidChainId=o3,k.getEnvironment=il,k.getHttpUrl=Az,k.getInternalError=Zn,k.getJavascriptID=w3,k.getJavascriptOS=m3,k.getLastItems=A3,k.getNamespacedDidChainId=tz,k.getNamespacesChains=C3,k.getNamespacesEventsForChainId=N3,k.getNamespacesMethodsForChainId=x3,k.getRelayClientMetadata=Ez,k.getRelayProtocolApi=qz,k.getRelayProtocolName=Uz,k.getRequiredNamespacesFromNamespaces=Zz,k.getSdkError=ks,k.getUniqueValues=cA,k.handleDeeplinkRedirect=Mz,k.hasOverlap=Ui,k.hashKey=az,k.hashMessage=uz,k.isBrowser=g3,k.isCaipNamespace=mA,k.isConformingNamespaces=q3,k.isExpired=Lz,k.isNode=gA,k.isProposalStruct=s$,k.isReactNative=p3,k.isSessionCompatible=n$,k.isSessionStruct=o$,k.isTypeOneEnvelope=hz,k.isUndefined=Vi,k.isValidAccountId=D3,k.isValidAccounts=B3,k.isValidActions=F3,k.isValidArray=sl,k.isValidChainId=rl,k.isValidChains=P3,k.isValidController=a$,k.isValidErrorReason=h$,k.isValidEvent=g$,k.isValidId=l$,k.isValidNamespaceAccounts=L3,k.isValidNamespaceActions=wA,k.isValidNamespaceChains=R3,k.isValidNamespaceMethodsOrEvents=oA,k.isValidNamespaces=M3,k.isValidNamespacesChainId=y$,k.isValidNamespacesEvent=w$,k.isValidNamespacesRequest=m$,k.isValidNumber=Dp,k.isValidObject=Op,k.isValidParams=f$,k.isValidRelay=U3,k.isValidRelays=c$,k.isValidRequest=d$,k.isValidRequestExpiry=A$,k.isValidRequiredNamespaces=u$,k.isValidResponse=p$,k.isValidString=Er,k.isValidUrl=i$,k.mapEntries=Tz,k.mapToObj=Iz,k.mergeArrays=qi,k.normalizeNamespaces=sA,k.objToMap=Sz,k.parseAccountId=uA,k.parseChainId=e3,k.parseContextNames=v3,k.parseExpirerTarget=Rz,k.parseNamespaceKey=O3,k.parseRelayParams=I3,k.parseTopic=S3,k.parseUri=kz,k.serialize=c3,k.validateDecoding=fz,k.validateEncoding=l3});var V3,H3,G3,j3,Pp,al,EA,Rp,Hi,ul,Bp=ge(()=>{c();V3="PARSE_ERROR",H3="INVALID_REQUEST",G3="METHOD_NOT_FOUND",j3="INVALID_PARAMS",Pp="INTERNAL_ERROR",al="SERVER_ERROR",EA=[-32700,-32600,-32601,-32602,-32603],Rp=[-32e3,-32099],Hi={[V3]:{code:-32700,message:"Parse error"},[H3]:{code:-32600,message:"Invalid Request"},[G3]:{code:-32601,message:"Method not found"},[j3]:{code:-32602,message:"Invalid params"},[Pp]:{code:-32603,message:"Internal error"},[al]:{code:-32e3,message:"Server error"}},ul=al});function b$(t){return t<=Rp[0]&&t>=Rp[1]}function Lp(t){return EA.includes(t)}function k3(t){return typeof t=="number"}function Fp(t){return Object.keys(Hi).includes(t)?Hi[t]:Hi[ul]}function Mp(t){let e=Object.values(Hi).find(r=>r.code===t);return e||Hi[ul]}function _$(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(!k3(t.error.code))return{valid:!1,error:`Invalid error code type for JSON-RPC: ${t.error.code}`};if(Lp(t.error.code)){let e=Mp(t.error.code);if(e.message!==Hi[ul].message&&t.error.message===e.message)return{valid:!1,error:`Invalid error code message for JSON-RPC: ${t.error.code}`}}return{valid:!0}}function vA(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var AA=ge(()=>{c();Bp()});var W3=m(Gi=>{"use strict";c();Object.defineProperty(Gi,"__esModule",{value:!0});Gi.isBrowserCryptoAvailable=Gi.getSubtleCrypto=Gi.getBrowerCrypto=void 0;function bA(){return(global===null||global===void 0?void 0:global.crypto)||(global===null||global===void 0?void 0:global.msCrypto)||{}}Gi.getBrowerCrypto=bA;function Q3(){let t=bA();return t.subtle||t.webkitSubtle}Gi.getSubtleCrypto=Q3;function I$(){return!!bA()&&!!Q3()}Gi.isBrowserCryptoAvailable=I$});var K3=m(ji=>{"use strict";c();Object.defineProperty(ji,"__esModule",{value:!0});ji.isBrowser=ji.isNode=ji.isReactNative=void 0;function z3(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}ji.isReactNative=z3;function $3(){return typeof p.default<"u"&&typeof p.default.versions<"u"&&typeof p.default.versions.node<"u"}ji.isNode=$3;function S$(){return!z3()&&!$3()}ji.isBrowser=S$});var _A=m(Up=>{"use strict";c();Object.defineProperty(Up,"__esModule",{value:!0});var Y3=(mr(),ct(yr));Y3.__exportStar(W3(),Up);Y3.__exportStar(K3(),Up)});var Ft={};ft(Ft,{isNodeJs:()=>X3});var J3,X3,Z3=ge(()=>{c();J3=_e(_A());Ht(Ft,_e(_A()));X3=J3.isNode});function IA(t=3){let e=Date.now()*Math.pow(10,t),r=Math.floor(Math.random()*Math.pow(10,t));return e+r}function SA(t=6){return BigInt(IA(t))}function TA(t,e,r){return{id:r||IA(),jsonrpc:"2.0",method:t,params:e}}function T$(t,e){return{id:t,jsonrpc:"2.0",result:e}}function CA(t,e,r){return{id:t,jsonrpc:"2.0",error:eR(e,r)}}function eR(t,e){return typeof t>"u"?Fp(Pp):(typeof t=="string"&&(t=Object.assign(Object.assign({},Fp(al)),{message:t})),typeof e<"u"&&(t.data=e),Lp(t.code)&&(t=Mp(t.code)),t)}var tR=ge(()=>{c();AA();Bp()});function C$(t){return t.includes("*")?Vp(t):!/\W/g.test(t)}function qp(t){return t==="*"}function Vp(t){return qp(t)?!0:!(!t.includes("*")||t.split("*").length!==2||t.split("*").filter(e=>e.trim()==="").length!==1)}function x$(t){return!qp(t)&&Vp(t)&&!t.split("*")[0].trim()}function N$(t){return!qp(t)&&Vp(t)&&!t.split("*")[1].trim()}var rR=ge(()=>{c()});var nR=ge(()=>{c()});var qa,xA=ge(()=>{c();qa=class{}});var NA,Hp,cl,iR=ge(()=>{c();xA();NA=class extends qa{constructor(e){super()}},Hp=class extends qa{constructor(){super()}},cl=class extends Hp{constructor(e){super()}}});var sR=ge(()=>{c()});var oR=ge(()=>{c();nR();xA();iR();sR()});var aR=ge(()=>{c();oR()});function P$(t){let e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function uR(t,e){let r=P$(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function R$(t){return uR(t,O$)}function Gp(t){return uR(t,D$)}function OA(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}var O$,D$,cR=ge(()=>{c();O$="^https?:",D$="^wss?:"});function DA(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function B$(t){return DA(t)&&"method"in t}function PA(t){return DA(t)&&(lR(t)||jp(t))}function lR(t){return"result"in t}function jp(t){return"error"in t}function L$(t){return"error"in t&&t.valid===!1}var fR=ge(()=>{c()});var Jt={};ft(Jt,{DEFAULT_ERROR:()=>ul,IBaseJsonRpcProvider:()=>Hp,IEvents:()=>qa,IJsonRpcConnection:()=>NA,IJsonRpcProvider:()=>cl,INTERNAL_ERROR:()=>Pp,INVALID_PARAMS:()=>j3,INVALID_REQUEST:()=>H3,METHOD_NOT_FOUND:()=>G3,PARSE_ERROR:()=>V3,RESERVED_ERROR_CODES:()=>EA,SERVER_ERROR:()=>al,SERVER_ERROR_CODE_RANGE:()=>Rp,STANDARD_ERROR_MAP:()=>Hi,formatErrorMessage:()=>eR,formatJsonRpcError:()=>CA,formatJsonRpcRequest:()=>TA,formatJsonRpcResult:()=>T$,getBigIntRpcId:()=>SA,getError:()=>Fp,getErrorByCode:()=>Mp,isHttpUrl:()=>R$,isJsonRpcError:()=>jp,isJsonRpcPayload:()=>DA,isJsonRpcRequest:()=>B$,isJsonRpcResponse:()=>PA,isJsonRpcResult:()=>lR,isJsonRpcValidationInvalid:()=>L$,isLocalhostUrl:()=>OA,isNodeJs:()=>X3,isReservedErrorCode:()=>Lp,isServerErrorCode:()=>b$,isValidDefaultRoute:()=>qp,isValidErrorCode:()=>k3,isValidLeadingWildcardRoute:()=>x$,isValidRoute:()=>C$,isValidTrailingWildcardRoute:()=>N$,isValidWildcardRoute:()=>Vp,isWsUrl:()=>Gp,parseConnectionError:()=>vA,payloadId:()=>IA,validateJsonRpcError:()=>_$});var ll=ge(()=>{c();Bp();AA();Z3();Ht(Jt,Ft);tR();rR();aR();cR();fR()});var hR,kp,dR,RA=ge(()=>{c();hR=_e(kn());ll();kp=class extends cl{constructor(e){super(e),this.events=new hR.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||[],e.id||SA().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=>{jp(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),PA(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)}},dR=kp});var pR={};ft(pR,{JsonRpcProvider:()=>kp,default:()=>F$});var F$,gR=ge(()=>{c();RA();RA();F$=dR});var mR=m((Npe,yR)=>{"use strict";c();yR.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}});var wR,ER,BA,vR=ge(()=>{c();wR=()=>typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:mR(),ER=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",BA=t=>t.split("?")[0]});var bR,AR,M$,Qp,_R,LA=ge(()=>{c();bR=_e(kn());Md();ll();vR();AR=10,M$=wR(),Qp=class{constructor(e){if(this.url=e,this.events=new bR.EventEmitter,this.registering=!1,!Gp(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(Fc(e))}catch(n){this.onError(e.id,n)}}register(e=this.url){if(!Gp(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:!OA(e)},s=new M$(e,[],i);ER()?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"?Lc(e.data):e.data;this.events.emit("payload",r)}onError(e,r){let n=this.parseError(r),i=n.message||n.toString(),s=CA(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return vA(e,BA(r),"WS")}resetMaxListeners(){this.events.getMaxListeners()>AR&&this.events.setMaxListeners(AR)}emitError(e){let r=this.parseError(new Error(e?.message||`WebSocket connection failed for host: ${BA(this.url)}`));return this.events.emit("register_error",r),r}},_R=Qp});var IR={};ft(IR,{WsConnection:()=>Qp,default:()=>U$});var U$,SR=ge(()=>{c();LA();LA();U$=_R});var o8=m((fl,Ha)=>{c();var q$=200,WA="__lodash_hash_undefined__",Zp=1,MR=2,UR=9007199254740991,Wp="[object Arguments]",qA="[object Array]",V$="[object AsyncFunction]",qR="[object Boolean]",VR="[object Date]",HR="[object Error]",GR="[object Function]",H$="[object GeneratorFunction]",zp="[object Map]",jR="[object Number]",G$="[object Null]",Va="[object Object]",TR="[object Promise]",j$="[object Proxy]",kR="[object RegExp]",$p="[object Set]",QR="[object String]",k$="[object Symbol]",Q$="[object Undefined]",VA="[object WeakMap]",WR="[object ArrayBuffer]",Kp="[object DataView]",W$="[object Float32Array]",z$="[object Float64Array]",$$="[object Int8Array]",K$="[object Int16Array]",Y$="[object Int32Array]",J$="[object Uint8Array]",X$="[object Uint8ClampedArray]",Z$="[object Uint16Array]",eK="[object Uint32Array]",tK=/[\\^$.*+?()[\]{}|]/g,rK=/^\[object .+?Constructor\]$/,nK=/^(?:0|[1-9]\d*)$/,rt={};rt[W$]=rt[z$]=rt[$$]=rt[K$]=rt[Y$]=rt[J$]=rt[X$]=rt[Z$]=rt[eK]=!0;rt[Wp]=rt[qA]=rt[WR]=rt[qR]=rt[Kp]=rt[VR]=rt[HR]=rt[GR]=rt[zp]=rt[jR]=rt[Va]=rt[kR]=rt[$p]=rt[QR]=rt[VA]=!1;var zR=typeof global=="object"&&global&&global.Object===Object&&global,iK=typeof self=="object"&&self&&self.Object===Object&&self,ti=zR||iK||Function("return this")(),$R=typeof fl=="object"&&fl&&!fl.nodeType&&fl,CR=$R&&typeof Ha=="object"&&Ha&&!Ha.nodeType&&Ha,KR=CR&&CR.exports===$R,FA=KR&&zR.process,xR=function(){try{return FA&&FA.binding&&FA.binding("util")}catch{}}(),NR=xR&&xR.isTypedArray;function sK(t,e){for(var r=-1,n=t==null?0:t.length,i=0,s=[];++r-1}function LK(t,e){var r=this.__data__,n=tg(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}ri.prototype.clear=DK;ri.prototype.delete=PK;ri.prototype.get=RK;ri.prototype.has=BK;ri.prototype.set=LK;function $s(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&MR?new Jp:void 0;for(s.set(t,e),s.set(e,t);++f-1&&t%1==0&&t-1&&t%1==0&&t<=UR}function i8(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}function pl(t){return t!=null&&typeof t=="object"}var s8=NR?cK(NR):XK;function hY(t){return lY(t)?$K(t):ZK(t)}function dY(){return[]}function pY(){return!1}Ha.exports=fY});var l6=m(me=>{"use strict";c();Object.defineProperty(me,"__esModule",{value:!0});var Ys=kn(),gY=OO(),ml=WO(),We=xv(),ii=Wv(),a8=(Md(),ct(o2)),yY=(OD(),ct(ND)),ee=ol(),mY=(J1(),ct(Y1)),Ge=Ms(),wY=(gR(),ct(pR)),vr=(ll(),ct(Jt)),EY=(SR(),ct(IR)),vY=o8();function yg(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}function AY(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 bY=yg(Ys),_Y=yg(gY),ng=AY(yY),IY=yg(EY),SY=yg(vY);function TY(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=E[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 T=I-O;T!==I&&S[T]===0;)T++;for(var L=u.repeat(x);T>>0,I=new Uint8Array(_);E[x];){var S=r[E.charCodeAt(x)];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,x++}if(E[x]!==" "){for(var b=_-F;b!==_&&I[b]===0;)b++;for(var T=new Uint8Array(O+(_-b)),L=O;b!==_;)T[L++]=I[b++];return T}}}function w(E){var x=g(E);if(x)return x;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:g,decode:w}}var CY=TY,xY=CY,I8=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")},NY=t=>new TextEncoder().encode(t),OY=t=>new TextDecoder().decode(t),KA=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")}},YA=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 S8(this,e)}},JA=class{constructor(e){this.decoders=e}or(e){return S8(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`)}},S8=(t,e)=>new JA({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),XA=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new KA(e,r,n),this.decoder=new YA(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},mg=({name:t,prefix:e,encode:r,decode:n})=>new XA(t,e,r,n),wl=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=xY(r,e);return mg({prefix:t,name:e,encode:n,decode:s=>I8(i(s))})},DY=(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},PY=(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<mg({prefix:e,name:t,encode(i){return PY(i,n,r)},decode(i){return DY(i,n,r,t)}}),RY=mg({prefix:"\0",name:"identity",encode:t=>OY(t),decode:t=>NY(t)}),BY=Object.freeze({__proto__:null,identity:RY}),LY=jt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),FY=Object.freeze({__proto__:null,base2:LY}),MY=jt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),UY=Object.freeze({__proto__:null,base8:MY}),qY=wl({prefix:"9",name:"base10",alphabet:"0123456789"}),VY=Object.freeze({__proto__:null,base10:qY}),HY=jt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),GY=jt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),jY=Object.freeze({__proto__:null,base16:HY,base16upper:GY}),kY=jt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),QY=jt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),WY=jt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),zY=jt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),$Y=jt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),KY=jt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),YY=jt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),JY=jt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),XY=jt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),ZY=Object.freeze({__proto__:null,base32:kY,base32upper:QY,base32pad:WY,base32padupper:zY,base32hex:$Y,base32hexupper:KY,base32hexpad:YY,base32hexpadupper:JY,base32z:XY}),eJ=wl({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),tJ=wl({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),rJ=Object.freeze({__proto__:null,base36:eJ,base36upper:tJ}),nJ=wl({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),iJ=wl({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),sJ=Object.freeze({__proto__:null,base58btc:nJ,base58flickr:iJ}),oJ=jt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),aJ=jt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),uJ=jt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),cJ=jt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),lJ=Object.freeze({__proto__:null,base64:oJ,base64pad:aJ,base64url:uJ,base64urlpad:cJ}),T8=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}"),fJ=T8.reduce((t,e,r)=>(t[r]=e,t),[]),hJ=T8.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function dJ(t){return t.reduce((e,r)=>(e+=fJ[r],e),"")}function pJ(t){let e=[];for(let r of t){let n=hJ[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var gJ=mg({prefix:"\u{1F680}",name:"base256emoji",encode:dJ,decode:pJ}),yJ=Object.freeze({__proto__:null,base256emoji:gJ}),mJ=C8,u8=128,wJ=127,EJ=~wJ,vJ=Math.pow(2,31);function C8(t,e,r){e=e||[],r=r||0;for(var n=r;t>=vJ;)e[r++]=t&255|u8,t/=128;for(;t&EJ;)e[r++]=t&255|u8,t>>>=7;return e[r]=t|0,C8.bytes=r-n+1,e}var AJ=ZA,bJ=128,c8=127;function ZA(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw ZA.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&c8)<=bJ);return ZA.bytes=s-n,r}var _J=Math.pow(2,7),IJ=Math.pow(2,14),SJ=Math.pow(2,21),TJ=Math.pow(2,28),CJ=Math.pow(2,35),xJ=Math.pow(2,42),NJ=Math.pow(2,49),OJ=Math.pow(2,56),DJ=Math.pow(2,63),PJ=function(t){return t<_J?1:t(x8.encode(t,e,r),e),f8=t=>x8.encodingLength(t),eb=(t,e)=>{let r=e.byteLength,n=f8(t),i=n+f8(r),s=new Uint8Array(i+r);return l8(t,s,0),l8(r,s,n),s.set(e,i),new tb(t,r,e,s)},tb=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}},N8=({name:t,code:e,encode:r})=>new rb(t,e,r),rb=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?eb(this.code,r):r.then(n=>eb(this.code,n))}else throw Error("Unknown type, must be binary type")}},O8=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),BJ=N8({name:"sha2-256",code:18,encode:O8("SHA-256")}),LJ=N8({name:"sha2-512",code:19,encode:O8("SHA-512")}),FJ=Object.freeze({__proto__:null,sha256:BJ,sha512:LJ}),D8=0,MJ="identity",P8=I8,UJ=t=>eb(D8,P8(t)),qJ={code:D8,name:MJ,encode:P8,digest:UJ},VJ=Object.freeze({__proto__:null,identity:qJ});new TextEncoder,new TextDecoder;var h8={...BY,...FY,...UY,...VY,...jY,...ZY,...rJ,...sJ,...lJ,...yJ};({...FJ,...VJ});function R8(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function HJ(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?R8(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function B8(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var d8=B8("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),zA=B8("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);let e=HJ(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)}}},og=class{constructor(e,r,n){this.core=e,this.logger=r,this.name=U8,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=ng.generateKeyPair(i);return ng.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=ng.generateKeyPair(s),a=ee.generateRandomBytes32(),u=q8;return await ng.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=a8.safeJsonStringify(s);if(ee.isTypeOneEnvelope(a)){let g=a.senderPublicKey,w=a.receiverPublicKey;i=await this.generateSharedKey(g,w)}let l=this.getSymKey(i),{type:f,senderPublicKey:d}=a;return ee.encrypt({type:f,symKey:l,message:u,senderPublicKey:d})},this.decode=async(i,s,o)=>{this.isInitialized();let a=ee.validateDecoding(s,o);if(ee.isTypeOneEnvelope(a)){let u=a.receiverPublicKey,l=a.senderPublicKey;i=await this.generateSharedKey(u,l)}try{let u=this.getSymKey(i),l=ee.decrypt({symKey:u,encoded:s});return a8.safeJsonParse(l)}catch(u){this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`),this.logger.error(u)}},this.getPayloadType=i=>{let s=ee.deserialize(i);return ee.decodeTypeByte(s.type)},this.getPayloadSenderPublicKey=i=>{let s=ee.deserialize(i);return s.senderPublicKey?mY.toString(s.senderPublicKey,ee.BASE16):void 0},this.core=e,this.logger=We.generateChildLogger(r,this.name),this.keychain=n||new sg(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(nb)}catch{e=ee.generateRandomBytes32(),await this.keychain.set(nb,e)}return jJ(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)}}},ag=class extends ii.IMessageTracker{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=G8,this.version=j8,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)}}},ob=class extends ii.IPublisher{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new Ys.EventEmitter,this.name=Q8,this.queue=new Map,this.publishTimeout=Ge.toMiliseconds(Ge.TEN_SECONDS),this.queueTimeout=Ge.toMiliseconds(Ge.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||k8,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(ml.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())})}},ab=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())}},$J=Object.defineProperty,KJ=Object.defineProperties,YJ=Object.getOwnPropertyDescriptors,p8=Object.getOwnPropertySymbols,JJ=Object.prototype.hasOwnProperty,XJ=Object.prototype.propertyIsEnumerable,g8=(t,e,r)=>e in t?$J(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,yl=(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},$A=(t,e)=>KJ(t,YJ(e)),ug=class extends ii.ISubscriber{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new ab,this.events=new Ys.EventEmitter,this.name=t6,this.version=r6,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 Ge.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)>=n6&&(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,$A(yl({},r),{id:e})),this.pending.delete(r.topic)}onBatchSubscribe(e){e.length&&e.forEach(r=>{this.setSubscription(r.id,yl({},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,yl({},r)),this.topicMap.set(r.topic,e),this.events.emit(Kr.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(Kr.deleted,$A(yl({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Kr.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)=>$A(yl({},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(ml.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(Kr.created,async e=>{let r=Kr.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()}),this.events.on(Kr.deleted,async e=>{let r=Kr.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)})}},ZJ=Object.defineProperty,y8=Object.getOwnPropertySymbols,eX=Object.prototype.hasOwnProperty,tX=Object.prototype.propertyIsEnumerable,m8=(t,e,r)=>e in t?ZJ(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,rX=(t,e)=>{for(var r in e||(e={}))eX.call(e,r)&&m8(t,r,e[r]);if(y8)for(var r of y8(e))tX.call(e,r)&&m8(t,r,e[r]);return t},cg=class extends ii.IRelayer{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new Ys.EventEmitter,this.name=$8,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||z8})),this.messages=new ag(this.logger,e.core),this.subscriber=new ug(this,this.logger),this.publisher=new ob(this,this.logger),this.relayUrl=e?.relayUrl||cb,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 ${ib}...`),await this.restartTransport(ib)}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)},X8)}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(Kr.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(Kr.resubscribed,()=>{r()})}),await Promise.race([new Promise(async(r,n)=>{await ee.createExpiringPromise(this.provider.connect(),1e4,`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 wY.JsonRpcProvider(new IY.default(ee.formatRelayRpcUrl({sdkVersion:J8,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;if(!n||n.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isSubscribed(r))return this.logger.debug(`Ignoring message for non-subscribed topic ${r}`),!0;let i=this.messages.has(r,n);return i&&this.logger.debug(`Ignoring duplicate message: ${n}`),i}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),vr.isJsonRpcRequest(e)){if(!e.method.endsWith(K8))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(rX({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()},Ge.toMiliseconds(Y8))}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()}}},nX=Object.defineProperty,w8=Object.getOwnPropertySymbols,iX=Object.prototype.hasOwnProperty,sX=Object.prototype.propertyIsEnumerable,E8=(t,e,r)=>e in t?nX(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,v8=(t,e)=>{for(var r in e||(e={}))iX.call(e,r)&&E8(t,r,e[r]);if(w8)for(var r of w8(e))sX.call(e,r)&&E8(t,r,e[r]);return t},lg=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=Z8,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=>SY.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=v8(v8({},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)}}},fg=class{constructor(e,r){this.core=e,this.logger=r,this.name=i6,this.version=s6,this.events=new bY.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(Ge.FIVE_MINUTES),o={protocol:W8},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(Ge.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(Ge.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=ka[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=ka[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=ka[u.request.method]?ka[u.request.method].res:ka.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;switch(s.method){case"wc_pairingPing":return this.onPairingPingRequest(i,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(i,s);default:return this.onUnknownRpcMethodRequest(i,s)}},this.onRelayEventResponse=async n=>{let{topic:i,payload:s}=n,o=(await this.core.history.get(i,s.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(i,s);default:return this.onUnknownRpcMethodResponse(o)}},this.onPairingPingRequest=async(n,i)=>{let{id:s}=i;try{this.isValidPing({topic:n}),await this.sendResult(s,n,!0),this.events.emit("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 lg(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.pairings.keys.includes(r)||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(Ur.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}))})}},hg=class extends ii.IJsonRpcHistory{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new Ys.EventEmitter,this.name=o6,this.version=a6,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(Ge.THIRTY_DAYS)};this.records.set(o.id,o),this.events.emit($r.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($r.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($r.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($r.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($r.created,e=>{let r=$r.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.events.on($r.updated,e=>{let r=$r.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.events.on($r.deleted,e=>{let r=$r.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.core.heartbeat.on(ml.HEARTBEAT_EVENTS.pulse,()=>{this.cleanup()})}cleanup(){try{this.records.forEach(e=>{Ge.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)}}},dg=class extends ii.IExpirer{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new Ys.EventEmitter,this.name=u6,this.version=c6,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(Ur.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(Ur.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(Ur.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;Ge.toMiliseconds(n)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(Ur.expired,{target:e,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(ml.HEARTBEAT_EVENTS.pulse,()=>this.checkExpirations()),this.events.on(Ur.created,e=>{let r=Ur.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Ur.expired,e=>{let r=Ur.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Ur.deleted,e=>{let r=Ur.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)}}},pg=class extends ii.IVerify{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.name=ig,this.initialized=!1,this.init=async n=>{ee.isReactNative()||!ee.isBrowser()||(this.verifyUrl=n?.verifyUrl||sb,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(Ge.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(ig))return n();let s=document.createElement("iframe");s.setAttribute("id",ig),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"),Ge.toMiliseconds(Ge.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=sb,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(),Ge.toMiliseconds(e))}},oX=Object.defineProperty,A8=Object.getOwnPropertySymbols,aX=Object.prototype.hasOwnProperty,uX=Object.prototype.propertyIsEnumerable,b8=(t,e,r)=>e in t?oX(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,_8=(t,e)=>{for(var r in e||(e={}))aX.call(e,r)&&b8(t,r,e[r]);if(A8)for(var r of A8(e))uX.call(e,r)&&b8(t,r,e[r]);return t},gg=class t extends ii.ICore{constructor(e){super(e),this.protocol=ub,this.version=L8,this.name=wg,this.events=new Ys.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||cb;let r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:We.pino(We.getDefaultLoggerOptions({level:e?.logger||F8.logger}));this.logger=We.generateChildLogger(r,this.name),this.heartbeat=new ml.HeartBeat,this.crypto=new og(this,this.logger,e?.keychain),this.history=new hg(this,this.logger),this.expirer=new dg(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new _Y.default(_8(_8({},M8),e?.storageOptions)),this.relayer=new cg({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new fg(this,this.logger),this.verify=new pg(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(e6,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}}},cX=gg;me.CORE_CONTEXT=wg,me.CORE_DEFAULT=F8,me.CORE_PROTOCOL=ub,me.CORE_STORAGE_OPTIONS=M8,me.CORE_STORAGE_PREFIX=ni,me.CORE_VERSION=L8,me.CRYPTO_CLIENT_SEED=nb,me.CRYPTO_CONTEXT=U8,me.CRYPTO_JWT_TTL=q8,me.Core=cX,me.Crypto=og,me.EXPIRER_CONTEXT=u6,me.EXPIRER_DEFAULT_TTL=zJ,me.EXPIRER_EVENTS=Ur,me.EXPIRER_STORAGE_VERSION=c6,me.Expirer=dg,me.HISTORY_CONTEXT=o6,me.HISTORY_EVENTS=$r,me.HISTORY_STORAGE_VERSION=a6,me.JsonRpcHistory=hg,me.KEYCHAIN_CONTEXT=V8,me.KEYCHAIN_STORAGE_VERSION=H8,me.KeyChain=sg,me.MESSAGES_CONTEXT=G8,me.MESSAGES_STORAGE_VERSION=j8,me.MessageTracker=ag,me.PAIRING_CONTEXT=i6,me.PAIRING_DEFAULT_TTL=WJ,me.PAIRING_RPC_OPTS=ka,me.PAIRING_STORAGE_VERSION=s6,me.PENDING_SUB_RESOLUTION_TIMEOUT=n6,me.PUBLISHER_CONTEXT=Q8,me.PUBLISHER_DEFAULT_TTL=k8,me.Pairing=fg,me.RELAYER_CONTEXT=$8,me.RELAYER_DEFAULT_LOGGER=z8,me.RELAYER_DEFAULT_PROTOCOL=W8,me.RELAYER_DEFAULT_RELAY_URL=cb,me.RELAYER_EVENTS=Pt,me.RELAYER_FAILOVER_RELAY_URL=ib,me.RELAYER_PROVIDER_EVENTS=ja,me.RELAYER_RECONNECT_TIMEOUT=Y8,me.RELAYER_SDK_VERSION=J8,me.RELAYER_STORAGE_OPTIONS=kJ,me.RELAYER_SUBSCRIBER_SUFFIX=K8,me.RELAYER_TRANSPORT_CUTOFF=X8,me.Relayer=cg,me.STORE_STORAGE_VERSION=Z8,me.SUBSCRIBER_CONTEXT=t6,me.SUBSCRIBER_DEFAULT_TTL=QJ,me.SUBSCRIBER_EVENTS=Kr,me.SUBSCRIBER_STORAGE_VERSION=r6,me.Store=lg,me.Subscriber=ug,me.VERIFY_CONTEXT=ig,me.VERIFY_SERVER=sb,me.Verify=pg,me.WALLETCONNECT_CLIENT_ID=e6,me.default=gg});var b6=m(Je=>{"use strict";c();Object.defineProperty(Je,"__esModule",{value:!0});var xn=l6(),Eg=xv(),d6=Wv(),Q=ol(),p6=kn(),Xe=Ms(),St=(ll(),ct(Jt));function lX(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var fX=lX(p6),gb="wc",yb=2,mb="client",_g=`${gb}@${yb}:${mb}:`,vg={name:mb,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},hX={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"},dX={database:":memory:"},g6="WALLETCONNECT_DEEPLINK_CHOICE",pX={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},gX="history",yX="0.3",y6="proposal",mX=Xe.THIRTY_DAYS,m6="Proposal expired",w6="session",El=Xe.SEVEN_DAYS,E6="engine",Qa={wc_sessionPropose:{req:{ttl:Xe.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:Xe.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:Xe.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:Xe.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:Xe.ONE_DAY,prompt:!1,tag:1104},res:{ttl:Xe.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:Xe.ONE_DAY,prompt:!1,tag:1106},res:{ttl:Xe.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:Xe.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:Xe.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:Xe.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:Xe.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:Xe.ONE_DAY,prompt:!1,tag:1112},res:{ttl:Xe.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:Xe.THIRTY_SECONDS,prompt:!1,tag:1114},res:{ttl:Xe.THIRTY_SECONDS,prompt:!1,tag:1115}}},Ag={min:Xe.FIVE_MINUTES,max:Xe.SEVEN_DAYS},Wa={idle:"idle",active:"active"},v6="request",A6=["wc_sessionPropose","wc_sessionRequest","wc_authRequest"],wX=Object.defineProperty,EX=Object.defineProperties,vX=Object.getOwnPropertyDescriptors,f6=Object.getOwnPropertySymbols,AX=Object.prototype.hasOwnProperty,bX=Object.prototype.propertyIsEnumerable,h6=(t,e,r)=>e in t?wX(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,qr=(t,e)=>{for(var r in e||(e={}))AX.call(e,r)&&h6(t,r,e[r]);if(f6)for(var r of f6(e))bX.call(e,r)&&h6(t,r,e[r]);return t},lb=(t,e)=>EX(t,vX(e)),fb=class extends d6.IEngine{constructor(e){super(e),this.name=E6,this.events=new fX.default,this.initialized=!1,this.ignoredPayloadTypes=[Q.TYPE_1],this.requestQueue={state:Wa.idle,requests:[]},this.requestQueueDelay=Xe.ONE_SECOND,this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.client.core.pairing.register({methods:Object.keys(Qa)}),this.initialized=!0,setTimeout(()=>{this.requestQueue.requests=this.getPendingSessionRequests(),this.processRequestQueue()},Xe.toMiliseconds(this.requestQueueDelay)))},this.connect=async r=>{this.isInitialized();let n=lb(qr({},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(),w=qr({requiredNamespaces:s,optionalNamespaces:o,relays:u??[{protocol:xn.RELAYER_DEFAULT_PROTOCOL}],proposer:{publicKey:g,metadata:this.client.metadata}},a&&{sessionProperties:a}),{reject:E,resolve:x,done:O}=Q.createDelayedPromise(Xe.FIVE_MINUTES,m6);if(this.events.once(Q.engineEvent("session_connect"),async({error:I,session:S})=>{if(I)E(I);else if(S){S.self.publicKey=g;let R=lb(qr({},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}),x(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",w),_=Q.calcExpiry(Xe.FIVE_MINUTES);return await this.setProposal(F,qr({id:F,expiry:_},w)),{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(),w=l.publicKey,E=await this.client.core.crypto.generateSharedKey(g,w);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 x=qr({relay:{protocol:i??"irn"},namespaces:s,requiredNamespaces:f,optionalNamespaces:d,pairingTopic:u,controller:{publicKey:g,metadata:this.client.metadata},expiry:Q.calcExpiry(El)},o&&{sessionProperties:o});await this.client.core.relayer.subscribe(E),await this.sendRequest(E,"wc_sessionSettle",x);let O=lb(qr({},x),{topic:E,pairingTopic:u,acknowledged:!1,self:x.controller,peer:{publicKey:l.publicKey,metadata:l.metadata},controller:g});return await this.client.session.set(E,O),await this.setExpiry(E,Q.calcExpiry(El)),{topic:E,acknowledged:()=>new Promise(F=>setTimeout(()=>F(this.client.session.get(E)),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(El)),{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:w})=>{g?f(g):l(w)}),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:a});let d=await this.client.core.storage.getItem(g6);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.cleanupAfterResponse(r)},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.requestQueue.requests=this.requestQueue.requests.filter(s=>s.id!==r),i&&(this.requestQueue.state=Wa.idle)},this.setExpiry=async(r,n)=>{this.client.session.keys.includes(r)&&await this.client.session.update(r,{expiry:n}),this.client.core.expirer.set(r,n)},this.setProposal=async(r,n)=>{await this.client.proposal.set(r,n),this.client.core.expirer.set(r,n.expiry)},this.setPendingSessionRequest=async r=>{let n=Qa.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()&&A6.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=Qa[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=Qa[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=Qa[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(qr({},n.params));let o=Q.calcExpiry(Xe.FIVE_MINUTES),a=qr({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:w}=n.params,E=qr({topic:r,relay:o,expiry:u,namespaces:l,acknowledged:!0,pairingTopic:w,requiredNamespaces:f,optionalNamespaces:d,controller:a.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}},g&&{sessionProperties:g});await this.sendResult(n.id,r,!0),this.events.emit(Q.engineEvent("session_connect"),{session:E}),this.cleanupDuplicatePairings(E)}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.onSessionSettleResponse=async(r,n)=>{let{id:i}=n;St.isJsonRpcResult(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(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(qr({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(El)),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(qr({topic:r},s)),await this.setPendingSessionRequest({id:i,topic:r,params:s}),this.addRequestToQueue({id:i,topic:r,params:s}),await this.processRequestQueue()}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(qr({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.addRequestToQueue=r=>{this.requestQueue.requests.push(r)},this.cleanupAfterResponse=r=>{this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.requestQueue.state=Wa.idle,this.processRequestQueue()},Xe.toMiliseconds(this.requestQueueDelay))},this.processRequestQueue=async()=>{if(this.requestQueue.state===Wa.active){this.client.logger.info("session request queue is already active.");return}let r=this.requestQueue.requests[0];if(!r){this.client.logger.info("session request queue is empty.");return}try{let{id:n,topic:i,params:s}=r,o=Q.hashMessage(JSON.stringify({id:n,params:s})),a=this.client.session.get(i),u=await this.getVerifyContext(o,a.peer.metadata);this.requestQueue.state=Wa.active,this.client.events.emit("session_request",{id:n,topic:i,params:s,verifyContext:u})}catch(n){this.client.logger.error(n)}},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,Ag)){let{message:u}=Q.getInternalError("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${Ag.min} and ${Ag.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)}}},hb=class extends xn.Store{constructor(e,r){super(e,r,y6,_g),this.core=e,this.logger=r}},db=class extends xn.Store{constructor(e,r){super(e,r,w6,_g),this.core=e,this.logger=r}},pb=class extends xn.Store{constructor(e,r){super(e,r,v6,_g,n=>n.id),this.core=e,this.logger=r}},bg=class t extends d6.ISignClient{constructor(e){super(e),this.protocol=gb,this.version=yb,this.name=vg.name,this.events=new p6.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||vg.name,this.metadata=e?.metadata||Q.getAppMetadata();let r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:Eg.pino(Eg.getDefaultLoggerOptions({level:e?.logger||vg.logger}));this.core=e?.core||new xn.Core(e),this.logger=Eg.generateChildLogger(r,this.name),this.session=new db(this.core,this.logger),this.proposal=new hb(this.core,this.logger),this.pendingRequest=new pb(this.core,this.logger),this.engine=new fb(this)}static async init(e){let r=new t(e);return await r.initialize(),r}get context(){return Eg.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}}},_X=bg;Je.ENGINE_CONTEXT=E6,Je.ENGINE_RPC_OPTS=Qa,Je.HISTORY_CONTEXT=gX,Je.HISTORY_EVENTS=pX,Je.HISTORY_STORAGE_VERSION=yX,Je.METHODS_TO_VERIFY=A6,Je.PROPOSAL_CONTEXT=y6,Je.PROPOSAL_EXPIRY=mX,Je.PROPOSAL_EXPIRY_MESSAGE=m6,Je.REQUEST_CONTEXT=v6,Je.REQUEST_QUEUE_STATES=Wa,Je.SESSION_CONTEXT=w6,Je.SESSION_EXPIRY=El,Je.SESSION_REQUEST_EXPIRY_BOUNDARIES=Ag,Je.SIGN_CLIENT_CONTEXT=mb,Je.SIGN_CLIENT_DEFAULT=vg,Je.SIGN_CLIENT_EVENTS=hX,Je.SIGN_CLIENT_PROTOCOL=gb,Je.SIGN_CLIENT_STORAGE_OPTIONS=dX,Je.SIGN_CLIENT_STORAGE_PREFIX=_g,Je.SIGN_CLIENT_VERSION=yb,Je.SignClient=_X,Je.WALLETCONNECT_DEEPLINK_CHOICE=g6,Je.default=bg});var Ig=m(Wi=>{"use strict";c();Object.defineProperty(Wi,"__esModule",{value:!0});Wi.OptionalOperation=Wi.Operation=void 0;var IX;(function(t){t.SIGN_TRANSACTION="mvx_signTransaction",t.SIGN_TRANSACTIONS="mvx_signTransactions",t.SIGN_MESSAGE="mvx_signMessage"})(IX=Wi.Operation||(Wi.Operation={}));var SX;(function(t){t.SIGN_LOGIN_TOKEN="mvx_signLoginToken",t.SIGN_NATIVE_AUTH_TOKEN="mvx_signNativeAuthToken",t.CANCEL_ACTION="mvx_cancelAction"})(SX=Wi.OptionalOperation||(Wi.OptionalOperation={}))});var wb=m(zi=>{"use strict";c();Object.defineProperty(zi,"__esModule",{value:!0});zi.WALLETCONNECT_MULTIVERSX_OPTIONAL_METHODS=zi.WALLETCONNECT_MULTIVERSX_METHODS=zi.WALLETCONNECT_MULTIVERSX_NAMESPACE=void 0;var _6=Ig();zi.WALLETCONNECT_MULTIVERSX_NAMESPACE="mvx";zi.WALLETCONNECT_MULTIVERSX_METHODS=Object.values(_6.Operation);zi.WALLETCONNECT_MULTIVERSX_OPTIONAL_METHODS=Object.values(_6.OptionalOperation)});var Ab=m(Yr=>{"use strict";c();Object.defineProperty(Yr,"__esModule",{value:!0});Yr.WalletConnectV2ProviderErrorMessagesEnum=Yr.ErrBadAddress=Yr.ErrNotImplemented=Yr.Err=void 0;var vl=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};Yr.Err=vl;var Eb=class extends vl{constructor(){super("Method not yet implemented")}};Yr.ErrNotImplemented=Eb;var vb=class extends vl{constructor(e,r){super(`Bad address: ${e}`,r)}};Yr.ErrBadAddress=vb;var TX;(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"})(TX=Yr.WalletConnectV2ProviderErrorMessagesEnum||(Yr.WalletConnectV2ProviderErrorMessagesEnum={}))});var _b=m(Sg=>{"use strict";c();Object.defineProperty(Sg,"__esModule",{value:!0});Sg.Logger=void 0;var bb=class{static error(e){console.error(e)}static trace(e){console.trace(e)}};Sg.Logger=bb});var I6=m(()=>{"use strict";c();global.Buffer||(global.Buffer=Ts().Buffer)});var T6=m(S6=>{"use strict";c();Object.defineProperty(S6,"__esModule",{value:!0})});var x6=m(C6=>{"use strict";c();Object.defineProperty(C6,"__esModule",{value:!0})});var N6=m(za=>{"use strict";c();var CX=za&&za.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(za,"__esModule",{value:!0});za.RelayedTransactionV1Builder=void 0;var xX=CX(Gt()),Ib=ht(),NX=Be(),OX=mn(),DX=qn(),Sb=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 NX.ErrInvalidRelayedV1BuilderArguments;let e=this.prepareInnerTransaction(),r=`relayedTx@${h.Buffer.from(e).toString("hex")}`,n=new DX.TransactionPayload(r),i=this.netConfig.MinGasLimit+this.netConfig.GasPerDataByte*n.length()+this.innerTransaction.getGasLimit().valueOf(),s=new OX.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 Ib.Address(this.innerTransaction.getSender().bech32()).pubkey().toString("base64"),receiver:new Ib.Address(this.innerTransaction.getReceiver().bech32()).pubkey().toString("base64"),value:new xX.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 Ib.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)}};za.RelayedTransactionV1Builder=Sb});var O6=m(Tg=>{"use strict";c();Object.defineProperty(Tg,"__esModule",{value:!0});Tg.Code=void 0;var Tb=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")}};Tg.Code=Tb});var P6=m(D6=>{"use strict";c();Object.defineProperty(D6,"__esModule",{value:!0})});var F6=m(Ka=>{"use strict";c();Object.defineProperty(Ka,"__esModule",{value:!0});Ka.bech32m=Ka.bech32=void 0;var Cg="qpzry9x8gf2tvdw0s3jn54khce6mua7l",B6={};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 R6(t){let e=1;for(let r=0;r126)return"Invalid prefix ("+t+")";e=$a(e)^n>>5}e=$a(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=R6(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=$a(l)^g,f+=Cg.charAt(g)}for(let d=0;d<6;++d)l=$a(l);l^=e;for(let d=0;d<6;++d){let g=l>>(5-d)*5&31;f+=Cg.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 w=R6(d);if(typeof w=="string")return w;let E=[];for(let x=0;x=g.length)&&E.push(F)}return w!==e?"Invalid checksum for "+o:{prefix:d,words:E}}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:PX,fromWordsUnsafe:RX,fromWords:BX}}Ka.bech32=L6("bech32");Ka.bech32m=L6("bech32m")});var U6=m(Vr=>{"use strict";c();Object.defineProperty(Vr,"__esModule",{value:!0});Vr.TokenTransferProperties=Vr.TransactionMetadataTransfer=Vr.TransactionMetadata=Vr.TransactionToDecode=Vr.TransactionDecoder=void 0;var M6=F6(),xb=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 Js;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 xg;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 Js;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 Js;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 Js;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=M6.bech32.toWords(r);return M6.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)}};Vr.TransactionDecoder=xb;var xg=class{constructor(){this.sender="",this.receiver="",this.data="",this.value="0"}};Vr.TransactionToDecode=xg;var Js=class{constructor(){this.sender="",this.receiver="",this.value=BigInt(0)}};Vr.TransactionMetadata=Js;var Nb=class{constructor(){this.value=BigInt(0)}};Vr.TransactionMetadataTransfer=Nb;var Ob=class{};Vr.TokenTransferProperties=Ob});var Db=m(Ng=>{"use strict";c();Object.defineProperty(Ng,"__esModule",{value:!0});Ng.ReturnCode=void 0;var je=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)}};Ng.ReturnCode=je;je.None=new je("");je.Ok=new je("ok");je.FunctionNotFound=new je("function not found");je.FunctionWrongSignature=new je("wrong signature for function");je.ContractNotFound=new je("contract not found");je.UserError=new je("user error");je.OutOfGas=new je("out of gas");je.AccountCollision=new je("account collision");je.OutOfFunds=new je("out of funds");je.CallStackOverFlow=new je("call stack overflow");je.ContractInvalid=new je("contract invalid");je.ExecutionFailed=new je("execution failed");je.Unknown=new je("unknown")});var H6=m(Og=>{"use strict";c();Object.defineProperty(Og,"__esModule",{value:!0});Og.ResultsParser=void 0;var LX=U6(),q6=ht(),V6=Be(),$i=Jo(),FX=Vo(),Ya=Db(),Ja;(function(t){t.OnTransactionCompleted="completedTxEvent",t.OnSignalError="signalError",t.OnWriteLog="writeLog"})(Ja||(Ja={}));var Pb;(function(t){t.TooMuchGas="@too much gas provided for processing"})(Pb||(Pb={}));var MX={argsSerializer:new FX.ArgSerializer},Rb=class{constructor(e){e=Object.assign(Object.assign({},MX),e),this.argsSerializer=e.argsSerializer}parseQueryResponse(e,r){let n=e.getReturnDataParts(),i=this.argsSerializer.buffersToValues(n,r.output);return{returnCode:new Ya.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 Ya.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 $i.Logger.trace("parseUntypedOutcome(): on simple move balance"),r;if(r=this.createBundleOnInvalidTransaction(e),r)return $i.Logger.trace("parseUntypedOutcome(): on invalid transaction"),r;if(r=this.createBundleOnEasilyFoundResultWithReturnData(e.contractResults),r)return $i.Logger.trace("parseUntypedOutcome(): on easily found result with return data"),r;if(r=this.createBundleOnSignalError(e.logs),r)return $i.Logger.trace("parseUntypedOutcome(): on signal error"),r;if(r=this.createBundleOnTooMuchGasWarning(e.logs),r)return $i.Logger.trace("parseUntypedOutcome(): on 'too much gas' warning"),r;if(r=this.createBundleOnWriteLogWhereFirstTopicEqualsAddress(e.logs,e.sender),r)return $i.Logger.trace("parseUntypedOutcome(): on writelog with topics[0] == tx.sender"),r;if(r=this.createBundleWithCustomHeuristics(e,n),r)return $i.Logger.trace("parseUntypedOutcome(): with custom heuristics"),r;if(r=this.createBundleWithFallbackHeuristics(e,n),r)return $i.Logger.trace("parseUntypedOutcome(): with fallback heuristics"),r;throw new V6.ErrCannotParseContractResults(`transaction ${e.hash.toString()}`)}parseTransactionMetadata(e){return new LX.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:Ya.ReturnCode.None,returnMessage:Ya.ReturnCode.None.toString(),values:[]}:null}createBundleOnInvalidTransaction(e){return e.status.isInvalid()&&e.receipt.data?{returnCode:Ya.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(Ja.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(Ja.OnWriteLog,a=>a.findFirstOrNoneTopic(u=>u.toString().startsWith(Pb.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 q6.Address(r.bech32()).hex(),i=e.findSingleOrNoneEvent(Ja.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 q6.Address(r.receiver);for(let i of e.contractResults.items){let s=i.logs.findSingleOrNoneEvent(Ja.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 V6.ErrCannotParseContractResults("no return code");return{returnCode:Ya.ReturnCode.fromBuffer(i),returnDataParts:s}}};Og.ResultsParser=Rb});var Bb=m(vt=>{"use strict";c();var UX=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)&&UX(e,t,r)};Object.defineProperty(vt,"__esModule",{value:!0});rr(Vo(),vt);rr(O6(),vt);rr(iw(),vt);rr(Zw(),vt);rr(gc(),vt);rr(uE(),vt);rr(nE(),vt);rr(P6(),vt);rr(lE(),vt);rr(yc(),vt);rr(H6(),vt);rr(Db(),vt);rr(ev(),vt);rr(mE(),vt);rr(Ot(),vt)});var j6=m(Dg=>{"use strict";c();Object.defineProperty(Dg,"__esModule",{value:!0});Dg.RelayedTransactionV2Builder=void 0;var G6=Be(),Al=Bb(),qX=mn(),VX=qn(),Lb=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 G6.ErrInvalidRelayedV2BuilderArguments;if(this.innerTransaction.getGasLimit()!=0)throw new G6.ErrGasLimitShouldBe0ForInnerTransaction;let{argumentsString:e}=new Al.ArgSerializer().valuesToString([new Al.AddressValue(this.innerTransaction.getReceiver()),new Al.U64Value(this.innerTransaction.getNonce().valueOf()),new Al.BytesValue(this.innerTransaction.getData().valueOf()),new Al.BytesValue(this.innerTransaction.getSignature())]),r=`relayedTxV2@${e}`,n=new VX.TransactionPayload(r),i=new qX.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}};Dg.RelayedTransactionV2Builder=Lb});var k6=m(Xs=>{"use strict";c();Object.defineProperty(Xs,"__esModule",{value:!0});Xs.SignableMessage=Xs.MESSAGE_PREFIX=void 0;var HX=ht(),GX=YE();Xs.MESSAGE_PREFIX=`Elrond Signed Message: -`;var Fb=class{constructor(e){this.message=h.Buffer.from([]),this.signature=h.Buffer.from([]),this.version=1,this.signer="ErdJS",this.address=new HX.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(Xs.MESSAGE_PREFIX),r]);return GX("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}}};Xs.SignableMessage=Fb});var Ub=m(at=>{"use strict";c();var jX=at&&at.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),kX=at&&at.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Q6=at&&at.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&jX(e,t,r);return kX(e,t),e},QX=at&&at.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(at,"__esModule",{value:!0});at.addressToHex=at.bufferToHex=at.utf8ToHex=at.bigIntToHex=at.bigIntToBuffer=at.bufferToBigInt=at.stringToBuffer=void 0;var WX=QX(Gt()),zX=ht(),Mb=Q6(ic()),W6=Q6(oh());function $X(t){return h.Buffer.from(t)}at.stringToBuffer=$X;function KX(t){return t.length==0?new WX.default(0):Mb.bufferToBigInt(t)}at.bufferToBigInt=KX;function YX(t){return t==0?h.Buffer.from([]):Mb.bigIntToBuffer(t)}at.bigIntToBuffer=YX;function JX(t){return t==0?"":Mb.getHexMagnitudeOfBigInt(t)}at.bigIntToHex=JX;function XX(t){let e=h.Buffer.from(t).toString("hex");return W6.zeroPadStringIfOddLength(e)}at.utf8ToHex=XX;function ZX(t){let e=t.toString("hex");return W6.zeroPadStringIfOddLength(e)}at.bufferToHex=ZX;function eZ(t){return zX.Address.fromBech32(t.toString()).pubkey().toString("hex")}at.addressToHex=eZ});var $6=m(Pg=>{"use strict";c();Object.defineProperty(Pg,"__esModule",{value:!0});Pg.TokenOperationsFactory=void 0;var qb=ms(),tZ=Jo(),z6=oc(),rZ=mn(),nZ=qn(),ne=Ub(),Vb=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(){tZ.Logger.info(` + Approved: ${g.toString()}`))}),o.forEach(d=>{n||(ki(i[d].methods,s[d].methods)?ki(i[d].events,s[d].events)||(n=ii("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${d}`)):n=ii("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${d}`))}),n}function Kz(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 p3(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function Yz(t){let e={};return Object.keys(t).forEach(r=>{r.includes(":")?e[r]=t[r]:Xs(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 Jz(t,e){return Vp(t,!1)&&t<=e.max&&t>=e.min}function Xz(){let t=Js();return new Promise(e=>{switch(t){case tr.browser:e(nR());break;case tr.reactNative:e(iR());break;case tr.node:e(sR());break;default:e(!0)}})}function nR(){return Up()&&navigator?.onLine}async function iR(){return al()&&typeof global<"u"&&global!=null&&global.NetInfo?(await(global==null?void 0:global.NetInfo.fetch()))?.isConnected:!0}function sR(){return!0}function Zz(t){switch(Js()){case tr.browser:oR(t);break;case tr.reactNative:aR(t);break;case tr.node:break}}function oR(t){!al()&&Up()&&(window.addEventListener("online",()=>t(!0)),window.addEventListener("offline",()=>t(!1)))}function aR(t){al()&&typeof global<"u"&&global!=null&&global.NetInfo&&global?.NetInfo.addEventListener(e=>t(e?.isConnected))}var gA={},EA=class{static get(e){return gA[e]}static set(e,r){gA[e]=r}static delete(e){delete gA[e]}};G.BASE10=_A,G.BASE16=rr,G.BASE64=Pp,G.COLON=W$,G.DEFAULT_DEPTH=CA,G.EMPTY_SPACE=Rp,G.ENV_MAP=tr,G.MemoryStore=EA,G.ONE_THOUSAND=$$,G.REACT_NATIVE_PRODUCT=O3,G.RELAYER_DEFAULT_PROTOCOL=V3,G.SDK_TYPE=P3,G.SLASH=D3,G.TYPE_0=IA,G.TYPE_1=ka,G.UTF8=Mp,G.appendToQueryString=R3,G.assertType=X$,G.buildApprovedNamespaces=Oz,G.calcExpiry=lz,G.capitalize=iz,G.capitalizeWord=q3,G.createDelayedPromise=sz,G.createExpiringPromise=oz,G.decodeTypeByte=ol,G.decrypt=V$,G.deriveSymKey=F$,G.deserialize=TA,G.encodeTypeByte=C3,G.encrypt=q$,G.engineEvent=hz,G.enumify=nz,G.formatAccountId=A3,G.formatAccountWithChain=T$,G.formatChainId=v3,G.formatExpirerTarget=NA,G.formatIdTarget=uz,G.formatMessage=P$,G.formatMessageContext=Z$,G.formatRelayParams=k3,G.formatRelayRpcUrl=Y$,G.formatTopicTarget=az,G.formatUA=F3,G.formatUri=Az,G.generateKeyPair=B$,G.generateRandomBytes32=L$,G.getAccountsChains=Xs,G.getAccountsFromNamespaces=x$,G.getAddressFromAccount=b3,G.getAddressesFromAccounts=C$,G.getAppMetadata=z$,G.getBrowserOnlineStatus=nR,G.getChainFromAccount=_3,G.getChainsFromAccounts=I3,G.getChainsFromNamespace=Lp,G.getChainsFromNamespaces=N$,G.getChainsFromRequiredNamespaces=O$,G.getDidAddress=T3,G.getDidAddressSegments=Fp,G.getDidChainId=S3,G.getEnvironment=Js,G.getHttpUrl=J$,G.getInternalError=ii,G.getJavascriptID=L3,G.getJavascriptOS=B3,G.getLastItems=U3,G.getNamespacedDidChainId=D$,G.getNamespacesChains=j3,G.getNamespacesEventsForChainId=W3,G.getNamespacesMethodsForChainId=Q3,G.getNodeOnlineStatus=sR,G.getReactNativeOnlineStatus=iR,G.getRelayClientMetadata=K$,G.getRelayProtocolApi=gz,G.getRelayProtocolName=pz,G.getRequiredNamespacesFromNamespaces=Nz,G.getSdkError=Ys,G.getUniqueValues=bA,G.handleDeeplinkRedirect=dz,G.hasOverlap=ki,G.hashKey=M$,G.hashMessage=U$,G.isBrowser=Up,G.isCaipNamespace=OA,G.isConformingNamespaces=rR,G.isExpired=fz,G.isNode=xA,G.isOnline=Xz,G.isProposalStruct=Lz,G.isReactNative=al,G.isSessionCompatible=Rz,G.isSessionStruct=Fz,G.isTypeOneEnvelope=G$,G.isUndefined=Qi,G.isValidAccountId=z3,G.isValidAccounts=J3,G.isValidActions=Z3,G.isValidArray=ul,G.isValidChainId=sl,G.isValidChains=K3,G.isValidController=Mz,G.isValidErrorReason=Gz,G.isValidEvent=Qz,G.isValidId=Vz,G.isValidNamespaceAccounts=X3,G.isValidNamespaceActions=DA,G.isValidNamespaceChains=Y3,G.isValidNamespaceMethodsOrEvents=wA,G.isValidNamespaces=eR,G.isValidNamespacesChainId=Wz,G.isValidNamespacesEvent=zz,G.isValidNamespacesRequest=$z,G.isValidNumber=Vp,G.isValidObject=qp,G.isValidParams=Hz,G.isValidRelay=tR,G.isValidRelays=qz,G.isValidRequest=kz,G.isValidRequestExpiry=Jz,G.isValidRequiredNamespaces=Uz,G.isValidResponse=jz,G.isValidString=br,G.isValidUrl=Bz,G.mapEntries=rz,G.mapToObj=ez,G.mergeArrays=ji,G.normalizeNamespaces=mA,G.objToMap=tz,G.parseAccountId=AA,G.parseChainId=E3,G.parseContextNames=M3,G.parseExpirerTarget=cz,G.parseNamespaceKey=$3,G.parseRelayParams=H3,G.parseTopic=G3,G.parseUri=vz,G.serialize=x3,G.subscribeToBrowserNetworkChange=oR,G.subscribeToNetworkChange=Zz,G.subscribeToReactNativeNetworkChange=aR,G.validateDecoding=H$,G.validateEncoding=N3});var uR,cR,lR,fR,Hp,ll,PA,Gp,Wi,fl,kp=ge(()=>{c();uR="PARSE_ERROR",cR="INVALID_REQUEST",lR="METHOD_NOT_FOUND",fR="INVALID_PARAMS",Hp="INTERNAL_ERROR",ll="SERVER_ERROR",PA=[-32700,-32600,-32601,-32602,-32603],Gp=[-32e3,-32099],Wi={[uR]:{code:-32700,message:"Parse error"},[cR]:{code:-32600,message:"Invalid Request"},[lR]:{code:-32601,message:"Method not found"},[fR]:{code:-32602,message:"Invalid params"},[Hp]:{code:-32603,message:"Internal error"},[ll]:{code:-32e3,message:"Server error"}},fl=ll});function eK(t){return t<=Gp[0]&&t>=Gp[1]}function jp(t){return PA.includes(t)}function hR(t){return typeof t=="number"}function Qp(t){return Object.keys(Wi).includes(t)?Wi[t]:Wi[fl]}function Wp(t){let e=Object.values(Wi).find(r=>r.code===t);return e||Wi[fl]}function tK(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(!hR(t.error.code))return{valid:!1,error:`Invalid error code type for JSON-RPC: ${t.error.code}`};if(jp(t.error.code)){let e=Wp(t.error.code);if(e.message!==Wi[fl].message&&t.error.message===e.message)return{valid:!1,error:`Invalid error code message for JSON-RPC: ${t.error.code}`}}return{valid:!0}}function RA(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var BA=ge(()=>{c();kp()});var pR=m($i=>{"use strict";c();Object.defineProperty($i,"__esModule",{value:!0});$i.isBrowserCryptoAvailable=$i.getSubtleCrypto=$i.getBrowerCrypto=void 0;function LA(){return(global===null||global===void 0?void 0:global.crypto)||(global===null||global===void 0?void 0:global.msCrypto)||{}}$i.getBrowerCrypto=LA;function dR(){let t=LA();return t.subtle||t.webkitSubtle}$i.getSubtleCrypto=dR;function rK(){return!!LA()&&!!dR()}$i.isBrowserCryptoAvailable=rK});var mR=m(zi=>{"use strict";c();Object.defineProperty(zi,"__esModule",{value:!0});zi.isBrowser=zi.isNode=zi.isReactNative=void 0;function gR(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}zi.isReactNative=gR;function yR(){return typeof p.default<"u"&&typeof p.default.versions<"u"&&typeof p.default.versions.node<"u"}zi.isNode=yR;function nK(){return!gR()&&!yR()}zi.isBrowser=nK});var FA=m($p=>{"use strict";c();Object.defineProperty($p,"__esModule",{value:!0});var wR=(vr(),ct(Er));wR.__exportStar(pR(),$p);wR.__exportStar(mR(),$p)});var Ft={};ft(Ft,{isNodeJs:()=>vR});var ER,vR,AR=ge(()=>{c();ER=_e(FA());Ht(Ft,_e(FA()));vR=ER.isNode});function MA(t=3){let e=Date.now()*Math.pow(10,t),r=Math.floor(Math.random()*Math.pow(10,t));return e+r}function UA(t=6){return BigInt(MA(t))}function qA(t,e,r){return{id:r||MA(),jsonrpc:"2.0",method:t,params:e}}function iK(t,e){return{id:t,jsonrpc:"2.0",result:e}}function VA(t,e,r){return{id:t,jsonrpc:"2.0",error:bR(e,r)}}function bR(t,e){return typeof t>"u"?Qp(Hp):(typeof t=="string"&&(t=Object.assign(Object.assign({},Qp(ll)),{message:t})),typeof e<"u"&&(t.data=e),jp(t.code)&&(t=Wp(t.code)),t)}var _R=ge(()=>{c();BA();kp()});function sK(t){return t.includes("*")?Kp(t):!/\W/g.test(t)}function zp(t){return t==="*"}function Kp(t){return zp(t)?!0:!(!t.includes("*")||t.split("*").length!==2||t.split("*").filter(e=>e.trim()==="").length!==1)}function oK(t){return!zp(t)&&Kp(t)&&!t.split("*")[0].trim()}function aK(t){return!zp(t)&&Kp(t)&&!t.split("*")[1].trim()}var IR=ge(()=>{c()});var SR=ge(()=>{c()});var ja,HA=ge(()=>{c();ja=class{}});var GA,Yp,hl,TR=ge(()=>{c();HA();GA=class extends ja{constructor(e){super()}},Yp=class extends ja{constructor(){super()}},hl=class extends Yp{constructor(e){super()}}});var CR=ge(()=>{c()});var xR=ge(()=>{c();SR();HA();TR();CR()});var NR=ge(()=>{c();xR()});function lK(t){let e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function OR(t,e){let r=lK(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function fK(t){return OR(t,uK)}function Jp(t){return OR(t,cK)}function kA(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}var uK,cK,DR=ge(()=>{c();uK="^https?:",cK="^wss?:"});function jA(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function hK(t){return jA(t)&&"method"in t}function QA(t){return jA(t)&&(PR(t)||Xp(t))}function PR(t){return"result"in t}function Xp(t){return"error"in t}function dK(t){return"error"in t&&t.valid===!1}var RR=ge(()=>{c()});var Zt={};ft(Zt,{DEFAULT_ERROR:()=>fl,IBaseJsonRpcProvider:()=>Yp,IEvents:()=>ja,IJsonRpcConnection:()=>GA,IJsonRpcProvider:()=>hl,INTERNAL_ERROR:()=>Hp,INVALID_PARAMS:()=>fR,INVALID_REQUEST:()=>cR,METHOD_NOT_FOUND:()=>lR,PARSE_ERROR:()=>uR,RESERVED_ERROR_CODES:()=>PA,SERVER_ERROR:()=>ll,SERVER_ERROR_CODE_RANGE:()=>Gp,STANDARD_ERROR_MAP:()=>Wi,formatErrorMessage:()=>bR,formatJsonRpcError:()=>VA,formatJsonRpcRequest:()=>qA,formatJsonRpcResult:()=>iK,getBigIntRpcId:()=>UA,getError:()=>Qp,getErrorByCode:()=>Wp,isHttpUrl:()=>fK,isJsonRpcError:()=>Xp,isJsonRpcPayload:()=>jA,isJsonRpcRequest:()=>hK,isJsonRpcResponse:()=>QA,isJsonRpcResult:()=>PR,isJsonRpcValidationInvalid:()=>dK,isLocalhostUrl:()=>kA,isNodeJs:()=>vR,isReservedErrorCode:()=>jp,isServerErrorCode:()=>eK,isValidDefaultRoute:()=>zp,isValidErrorCode:()=>hR,isValidLeadingWildcardRoute:()=>oK,isValidRoute:()=>sK,isValidTrailingWildcardRoute:()=>aK,isValidWildcardRoute:()=>Kp,isWsUrl:()=>Jp,parseConnectionError:()=>RA,payloadId:()=>MA,validateJsonRpcError:()=>tK});var dl=ge(()=>{c();kp();BA();AR();Ht(Zt,Ft);_R();IR();NR();DR();RR()});var BR,Zp,LR,WA=ge(()=>{c();BR=_e(Kn());dl();Zp=class extends hl{constructor(e){super(e),this.events=new BR.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(qA(e.method,e.params||[],e.id||UA().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),QA(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)}},LR=Zp});var FR={};ft(FR,{JsonRpcProvider:()=>Zp,default:()=>pK});var pK,MR=ge(()=>{c();WA();WA();pK=LR});var qR=m((bge,UR)=>{"use strict";c();UR.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}});var VR,HR,$A,GR=ge(()=>{c();VR=()=>typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:qR(),HR=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",$A=t=>t.split("?")[0]});var jR,kR,gK,eg,QR,zA=ge(()=>{c();jR=_e(Kn());Qd();dl();GR();kR=10,gK=VR(),eg=class{constructor(e){if(this.url=e,this.events=new jR.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(qc(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,Zt.isReactNative)()?void 0:{rejectUnauthorized:!kA(e)},s=new gK(e,[],i);HR()?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"?Uc(e.data):e.data;this.events.emit("payload",r)}onError(e,r){let n=this.parseError(r),i=n.message||n.toString(),s=VA(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return RA(e,$A(r),"WS")}resetMaxListeners(){this.events.getMaxListeners()>kR&&this.events.setMaxListeners(kR)}emitError(e){let r=this.parseError(new Error(e?.message||`WebSocket connection failed for host: ${$A(this.url)}`));return this.events.emit("register_error",r),r}},QR=eg});var WR={};ft(WR,{WsConnection:()=>eg,default:()=>yK});var yK,$R=ge(()=>{c();zA();zA();yK=QR});var x6=m((pl,Wa)=>{c();var mK=200,sb="__lodash_hash_undefined__",ug=1,s6=2,o6=9007199254740991,tg="[object Arguments]",XA="[object Array]",wK="[object AsyncFunction]",a6="[object Boolean]",u6="[object Date]",c6="[object Error]",l6="[object Function]",EK="[object GeneratorFunction]",rg="[object Map]",f6="[object Number]",vK="[object Null]",Qa="[object Object]",zR="[object Promise]",AK="[object Proxy]",h6="[object RegExp]",ng="[object Set]",d6="[object String]",bK="[object Symbol]",_K="[object Undefined]",ZA="[object WeakMap]",p6="[object ArrayBuffer]",ig="[object DataView]",IK="[object Float32Array]",SK="[object Float64Array]",TK="[object Int8Array]",CK="[object Int16Array]",xK="[object Int32Array]",NK="[object Uint8Array]",OK="[object Uint8ClampedArray]",DK="[object Uint16Array]",PK="[object Uint32Array]",RK=/[\\^$.*+?()[\]{}|]/g,BK=/^\[object .+?Constructor\]$/,LK=/^(?:0|[1-9]\d*)$/,rt={};rt[IK]=rt[SK]=rt[TK]=rt[CK]=rt[xK]=rt[NK]=rt[OK]=rt[DK]=rt[PK]=!0;rt[tg]=rt[XA]=rt[p6]=rt[a6]=rt[ig]=rt[u6]=rt[c6]=rt[l6]=rt[rg]=rt[f6]=rt[Qa]=rt[h6]=rt[ng]=rt[d6]=rt[ZA]=!1;var g6=typeof global=="object"&&global&&global.Object===Object&&global,FK=typeof self=="object"&&self&&self.Object===Object&&self,si=g6||FK||Function("return this")(),y6=typeof pl=="object"&&pl&&!pl.nodeType&&pl,KR=y6&&typeof Wa=="object"&&Wa&&!Wa.nodeType&&Wa,m6=KR&&KR.exports===y6,KA=m6&&g6.process,YR=function(){try{return KA&&KA.binding&&KA.binding("util")}catch{}}(),JR=YR&&YR.isTypedArray;function MK(t,e){for(var r=-1,n=t==null?0:t.length,i=0,s=[];++r-1}function dY(t,e){var r=this.__data__,n=lg(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}oi.prototype.clear=cY;oi.prototype.delete=lY;oi.prototype.get=fY;oi.prototype.has=hY;oi.prototype.set=dY;function to(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&s6?new og:void 0;for(s.set(t,e),s.set(e,t);++f-1&&t%1==0&&t-1&&t%1==0&&t<=o6}function T6(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}function ml(t){return t!=null&&typeof t=="object"}var C6=JR?HK(JR):OY;function jY(t){return GY(t)?TY(t):DY(t)}function QY(){return[]}function WY(){return!1}Wa.exports=kY});var P8=m(me=>{"use strict";c();Object.defineProperty(me,"__esModule",{value:!0});var no=Kn(),$Y=KO(),Al=f2(),Qe=qv(),ui=n1(),N6=(Qd(),ct(S2)),zY=(KD(),ct(zD)),ee=cl(),KY=(uA(),ct(aA)),We=ks(),YY=(MR(),ct(FR)),_r=(dl(),ct(Zt)),JY=($R(),ct(WR)),XY=x6();function Tg(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}function ZY(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 eJ=Tg(no),tJ=Tg($Y),hg=ZY(zY),rJ=Tg(JY),nJ=Tg(XY);function iJ(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,A=new Uint8Array(U);B!==W;){for(var I=E[B],N=0,_=U-1;(I!==0||N>>0,A[_]=I%a>>>0,I=I/a>>>0;if(I!==0)throw new Error("Non-zero carry");D=N,B++}for(var S=U-D;S!==U&&A[S]===0;)S++;for(var R=u.repeat(T);S>>0,U=new Uint8Array(W);E[T];){var A=r[E.charCodeAt(T)];if(A===255)return;for(var I=0,N=W-1;(A!==0||I>>0,U[N]=A%256>>>0,A=A/256>>>0;if(A!==0)throw new Error("Non-zero carry");B=I,T++}if(E[T]!==" "){for(var _=W-B;_!==W&&U[_]===0;)_++;for(var S=new Uint8Array(D+(W-_)),R=D;_!==W;)S[R++]=U[_++];return S}}}function w(E){var T=g(E);if(T)return T;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:g,decode:w}}var sJ=iJ,oJ=sJ,W6=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")},aJ=t=>new TextEncoder().encode(t),uJ=t=>new TextDecoder().decode(t),ub=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")}},cb=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 $6(this,e)}},lb=class{constructor(e){this.decoders=e}or(e){return $6(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`)}},$6=(t,e)=>new lb({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),fb=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new ub(e,r,n),this.decoder=new cb(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},Cg=({name:t,prefix:e,encode:r,decode:n})=>new fb(t,e,r,n),bl=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=oJ(r,e);return Cg({prefix:t,name:e,encode:n,decode:s=>W6(i(s))})},cJ=(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},lJ=(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<Cg({prefix:e,name:t,encode(i){return lJ(i,n,r)},decode(i){return cJ(i,n,r,t)}}),fJ=Cg({prefix:"\0",name:"identity",encode:t=>uJ(t),decode:t=>aJ(t)}),hJ=Object.freeze({__proto__:null,identity:fJ}),dJ=kt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),pJ=Object.freeze({__proto__:null,base2:dJ}),gJ=kt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),yJ=Object.freeze({__proto__:null,base8:gJ}),mJ=bl({prefix:"9",name:"base10",alphabet:"0123456789"}),wJ=Object.freeze({__proto__:null,base10:mJ}),EJ=kt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),vJ=kt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),AJ=Object.freeze({__proto__:null,base16:EJ,base16upper:vJ}),bJ=kt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),_J=kt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),IJ=kt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),SJ=kt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),TJ=kt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),CJ=kt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),xJ=kt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),NJ=kt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),OJ=kt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),DJ=Object.freeze({__proto__:null,base32:bJ,base32upper:_J,base32pad:IJ,base32padupper:SJ,base32hex:TJ,base32hexupper:CJ,base32hexpad:xJ,base32hexpadupper:NJ,base32z:OJ}),PJ=bl({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),RJ=bl({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),BJ=Object.freeze({__proto__:null,base36:PJ,base36upper:RJ}),LJ=bl({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),FJ=bl({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),MJ=Object.freeze({__proto__:null,base58btc:LJ,base58flickr:FJ}),UJ=kt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),qJ=kt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),VJ=kt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),HJ=kt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),GJ=Object.freeze({__proto__:null,base64:UJ,base64pad:qJ,base64url:VJ,base64urlpad:HJ}),z6=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}"),kJ=z6.reduce((t,e,r)=>(t[r]=e,t),[]),jJ=z6.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function QJ(t){return t.reduce((e,r)=>(e+=kJ[r],e),"")}function WJ(t){let e=[];for(let r of t){let n=jJ[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var $J=Cg({prefix:"\u{1F680}",name:"base256emoji",encode:QJ,decode:WJ}),zJ=Object.freeze({__proto__:null,base256emoji:$J}),KJ=K6,O6=128,YJ=127,JJ=~YJ,XJ=Math.pow(2,31);function K6(t,e,r){e=e||[],r=r||0;for(var n=r;t>=XJ;)e[r++]=t&255|O6,t/=128;for(;t&JJ;)e[r++]=t&255|O6,t>>>=7;return e[r]=t|0,K6.bytes=r-n+1,e}var ZJ=hb,eX=128,D6=127;function hb(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw hb.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&D6)<=eX);return hb.bytes=s-n,r}var tX=Math.pow(2,7),rX=Math.pow(2,14),nX=Math.pow(2,21),iX=Math.pow(2,28),sX=Math.pow(2,35),oX=Math.pow(2,42),aX=Math.pow(2,49),uX=Math.pow(2,56),cX=Math.pow(2,63),lX=function(t){return t(Y6.encode(t,e,r),e),R6=t=>Y6.encodingLength(t),db=(t,e)=>{let r=e.byteLength,n=R6(t),i=n+R6(r),s=new Uint8Array(i+r);return P6(t,s,0),P6(r,s,n),s.set(e,i),new pb(t,r,e,s)},pb=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}},J6=({name:t,code:e,encode:r})=>new gb(t,e,r),gb=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?db(this.code,r):r.then(n=>db(this.code,n))}else throw Error("Unknown type, must be binary type")}},X6=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),hX=J6({name:"sha2-256",code:18,encode:X6("SHA-256")}),dX=J6({name:"sha2-512",code:19,encode:X6("SHA-512")}),pX=Object.freeze({__proto__:null,sha256:hX,sha512:dX}),Z6=0,gX="identity",e8=W6,yX=t=>db(Z6,e8(t)),mX={code:Z6,name:gX,encode:e8,digest:yX},wX=Object.freeze({__proto__:null,identity:mX});new TextEncoder,new TextDecoder;var B6={...hJ,...pJ,...yJ,...wJ,...AJ,...DJ,...BJ,...MJ,...GJ,...zJ};({...pX,...wX});function t8(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function EX(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?t8(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function r8(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var L6=r8("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),ob=r8("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);let e=EX(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=Qe.generateChildLogger(r,this.name)}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,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)}}},yg=class{constructor(e,r,n){this.core=e,this.logger=r,this.name=o8,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=a8;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=N6.safeJsonStringify(s);if(ee.isTypeOneEnvelope(a)){let g=a.senderPublicKey,w=a.receiverPublicKey;i=await this.generateSharedKey(g,w)}let l=this.getSymKey(i),{type:f,senderPublicKey:d}=a;return ee.encrypt({type:f,symKey:l,message:u,senderPublicKey:d})},this.decode=async(i,s,o)=>{this.isInitialized();let a=ee.validateDecoding(s,o);if(ee.isTypeOneEnvelope(a)){let u=a.receiverPublicKey,l=a.senderPublicKey;i=await this.generateSharedKey(u,l)}try{let u=this.getSymKey(i),l=ee.decrypt({symKey:u,encoded:s});return N6.safeJsonParse(l)}catch(u){this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`),this.logger.error(u)}},this.getPayloadType=i=>{let s=ee.deserialize(i);return ee.decodeTypeByte(s.type)},this.getPayloadSenderPublicKey=i=>{let s=ee.deserialize(i);return s.senderPublicKey?KY.toString(s.senderPublicKey,ee.BASE16):void 0},this.core=e,this.logger=Qe.generateChildLogger(r,this.name),this.keychain=n||new gg(this.core,this.logger)}get context(){return Qe.getLoggerContext(this.logger)}async setPrivateKey(e,r){return await this.keychain.set(e,r),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(yb)}catch{e=ee.generateRandomBytes32(),await this.keychain.set(yb,e)}return AX(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)}}},mg=class extends ui.IMessageTracker{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=l8,this.version=f8,this.initialized=!1,this.storagePrefix=ai,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=Qe.generateChildLogger(e,this.name),this.core=r}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,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)}}},Eb=class extends ui.IPublisher{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new no.EventEmitter,this.name=d8,this.queue=new Map,this.publishTimeout=We.toMiliseconds(We.TEN_SECONDS),this.needsTransportRestart=!1,this.publish=async(n,i,s)=>{var o;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}});try{let a=s?.ttl||h8,u=ee.getRelayProtocolName(s),l=s?.prompt||!1,f=s?.tag||0,d=s?.id||_r.getBigIntRpcId().toString(),g={topic:n,message:i,opts:{ttl:a,relay:u,prompt:l,tag:f,id:d}},w=setTimeout(()=>this.queue.set(d,g),this.publishTimeout);try{await await ee.createExpiringPromise(this.rpcPublish(n,i,a,u,l,f,d),this.publishTimeout,"Failed to publish payload, please try again."),this.removeRequestFromQueue(d),this.relayer.events.emit(nr.publish,g)}catch(E){if(this.logger.debug("Publishing Payload stalled"),this.needsTransportRestart=!0,(o=s?.internal)!=null&&o.throwOnFailedPublish)throw this.removeRequestFromQueue(d),E;return}finally{clearTimeout(w)}this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}})}catch(a){throw this.logger.debug("Failed to Publish Payload"),this.logger.error(a),a}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.relayer=e,this.logger=Qe.generateChildLogger(r,this.name),this.registerEventListeners()}get context(){return Qe.getLoggerContext(this.logger)}rpcPublish(e,r,n,i,s,o,a){var u,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)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{let{topic:r,message:n,opts:i}=e;await this.publish(r,n,i)})}registerEventListeners(){this.relayer.core.heartbeat.on(Al.HEARTBEAT_EVENTS.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(nr.connection_stalled);return}this.checkQueue()}),this.relayer.on(nr.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}},vb=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())}},TX=Object.defineProperty,CX=Object.defineProperties,xX=Object.getOwnPropertyDescriptors,F6=Object.getOwnPropertySymbols,NX=Object.prototype.hasOwnProperty,OX=Object.prototype.propertyIsEnumerable,M6=(t,e,r)=>e in t?TX(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,El=(t,e)=>{for(var r in e||(e={}))NX.call(e,r)&&M6(t,r,e[r]);if(F6)for(var r of F6(e))OX.call(e,r)&&M6(t,r,e[r]);return t},ab=(t,e)=>CX(t,xX(e)),wg=class extends ui.ISubscriber{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new vb,this.events=new no.EventEmitter,this.name=_8,this.version=I8,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=ai,this.subscribeTimeout=1e4,this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId())},this.subscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}});try{let s=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 We.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)>=S8&&(clearInterval(a),o.stop(this.pendingSubscriptionWatchLabel),s(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=Qe.generateChildLogger(r,this.name),this.clientId=""}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,r){let n=!1;try{n=this.getSubscription(e).topic===r}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,r){let n=this.topicMap.get(e);await Promise.all(n.map(async i=>await this.unsubscribeById(e,i,r)))}async unsubscribeById(e,r,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}});try{let i=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(nr.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(nr.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,ab(El({},r),{id:e})),this.pending.delete(r.topic)}onBatchSubscribe(e){e.length&&e.forEach(r=>{this.setSubscription(r.id,El({},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,El({},r)),this.topicMap.set(r.topic,e),this.events.emit(Hr.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(Hr.deleted,ab(El({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Hr.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)=>ab(El({},e[i]),{id:n})))}async onConnect(){this.restartInProgress||(await this.restart(),this.onEnable())}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||this.relayer.transportExplicitlyClosed)return;let e=[];this.pending.forEach(r=>{e.push(r)}),await this.batchSubscribe(e)}registerEventListeners(){this.relayer.core.heartbeat.on(Al.HEARTBEAT_EVENTS.pulse,async()=>{await this.checkPending()}),this.relayer.on(nr.connect,async()=>{await this.onConnect()}),this.relayer.on(nr.disconnect,()=>{this.onDisconnect()}),this.events.on(Hr.created,async e=>{let r=Hr.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()}),this.events.on(Hr.deleted,async e=>{let r=Hr.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)})}},DX=Object.defineProperty,U6=Object.getOwnPropertySymbols,PX=Object.prototype.hasOwnProperty,RX=Object.prototype.propertyIsEnumerable,q6=(t,e,r)=>e in t?DX(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,BX=(t,e)=>{for(var r in e||(e={}))PX.call(e,r)&&q6(t,r,e[r]);if(U6)for(var r of U6(e))RX.call(e,r)&&q6(t,r,e[r]);return t},Eg=class extends ui.IRelayer{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new no.EventEmitter,this.name=y8,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","socket stalled"],this.hasExperiencedNetworkDisruption=!1,this.request=async r=>{this.logger.debug("Publishing Request Payload");try{return await this.toEstablishConnection(),await this.provider.request(r)}catch(n){throw this.logger.debug("Failed to Publish Request"),this.logger.error(n),n}},this.onPayloadHandler=r=>{this.onProviderPayload(r)},this.onConnectHandler=()=>{this.events.emit(nr.connect)},this.onDisconnectHandler=()=>{this.onProviderDisconnect()},this.onProviderErrorHandler=r=>{this.logger.error(r),this.events.emit(nr.error,r),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(Nn.payload,this.onPayloadHandler),this.provider.on(Nn.connect,this.onConnectHandler),this.provider.on(Nn.disconnect,this.onDisconnectHandler),this.provider.on(Nn.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?Qe.generateChildLogger(e.logger,this.name):Qe.pino(Qe.getDefaultLoggerOptions({level:e.logger||g8})),this.messages=new mg(this.logger,e.core),this.subscriber=new wg(this,this.logger),this.publisher=new Eb(this,this.logger),this.relayUrl=e?.relayUrl||bb,this.projectId=e.projectId,this.provider={}}async init(){this.logger.trace("Initialized"),this.registerEventListeners(),await this.createProvider(),await Promise.all([this.messages.init(),this.subscriber.init()]);try{await this.transportOpen()}catch{this.logger.warn(`Connection via ${this.relayUrl} failed, attempting to connect via failover domain ${mb}...`),await this.restartTransport(mb)}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)},v8)}get context(){return Qe.getLoggerContext(this.logger)}get connected(){return this.provider.connection.connected}get connecting(){return this.provider.connection.connecting}async publish(e,r,n){this.isInitialized(),await this.publisher.publish(e,r,n),await this.recordMessageEvent({topic:e,message:r,publishedAt:Date.now()})}async subscribe(e,r){var n;this.isInitialized();let i=((n=this.subscriber.topicMap.get(e))==null?void 0:n[0])||"";if(i)return i;let s,o=a=>{a.topic===e&&(this.subscriber.off(Hr.created,o),s())};return await Promise.all([new Promise(a=>{s=a,this.subscriber.on(Hr.created,o)}),new Promise(async a=>{i=await this.subscriber.subscribe(e,r),a()})]),i}async unsubscribe(e,r){this.isInitialized(),await this.subscriber.unsubscribe(e,r)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async transportClose(){this.transportExplicitlyClosed=!0,this.hasExperiencedNetworkDisruption&&this.connected?await ee.createExpiringPromise(this.provider.disconnect(),1e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.connected&&await this.provider.disconnect()}async transportOpen(e){if(this.transportExplicitlyClosed=!1,await this.confirmOnlineStateOrThrow(),!this.connectionAttemptInProgress){e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportClose(),await this.createProvider()),this.connectionAttemptInProgress=!0;try{await Promise.all([new Promise(r=>{if(!this.initialized)return r();this.subscriber.once(Hr.resubscribed,()=>{r()})}),new Promise(async(r,n)=>{try{await ee.createExpiringPromise(this.provider.connect(),1e4,`Socket stalled when trying to connect to ${this.relayUrl}`)}catch(i){n(i);return}r()})])}catch(r){this.logger.error(r);let n=r;if(!this.isConnectionStalled(n.message))throw r;this.provider.events.emit(Nn.disconnect)}finally{this.connectionAttemptInProgress=!1,this.hasExperiencedNetworkDisruption=!1}}}async restartTransport(e){await this.confirmOnlineStateOrThrow(),!this.connectionAttemptInProgress&&(this.relayUrl=e||this.relayUrl,await this.transportClose(),await this.createProvider(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await ee.isOnline())throw new Error("No internet connection detected. Please restart your network and try again.")}isConnectionStalled(e){return this.staleConnectionErrors.some(r=>e.includes(r))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();let e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new YY.JsonRpcProvider(new rJ.default(ee.formatRelayRpcUrl({sdkVersion:E8,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;if(!n||n.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isSubscribed(r))return this.logger.debug(`Ignoring message for non-subscribed topic ${r}`),!0;let i=this.messages.has(r,n);return i&&this.logger.debug(`Ignoring duplicate message: ${n}`),i}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),_r.isJsonRpcRequest(e)){if(!e.method.endsWith(m8))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(BX({type:"event",event:r.id},o)),this.events.emit(r.id,o),await this.acknowledgePayload(e),await this.onMessageEvent(o)}else _r.isJsonRpcResponse(e)&&this.events.emit(nr.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(nr.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){let r=_r.formatJsonRpcResult(e.id,!0);await this.provider.connection.send(r)}unregisterProviderListeners(){this.provider.off(Nn.payload,this.onPayloadHandler),this.provider.off(Nn.connect,this.onConnectHandler),this.provider.off(Nn.disconnect,this.onDisconnectHandler),this.provider.off(Nn.error,this.onProviderErrorHandler)}async registerEventListeners(){this.events.on(nr.connection_stalled,()=>{this.restartTransport().catch(r=>this.logger.error(r))});let e=await ee.isOnline();ee.subscribeToNetworkChange(async r=>{this.initialized&&e!==r&&(e=r,r?await this.restartTransport().catch(n=>this.logger.error(n)):(this.hasExperiencedNetworkDisruption=!0,await this.transportClose().catch(n=>this.logger.error(n))))})}onProviderDisconnect(){this.events.emit(nr.disconnect),this.attemptToReconnect()}attemptToReconnect(){this.transportExplicitlyClosed||(this.logger.info("attemptToReconnect called. Connecting..."),setTimeout(async()=>{await this.restartTransport().catch(e=>this.logger.error(e))},We.toMiliseconds(w8)))}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){if(await this.confirmOnlineStateOrThrow(),!this.connected){if(this.connectionAttemptInProgress)return await new Promise(e=>{let r=setInterval(()=>{this.connected&&(clearInterval(r),e())},this.connectionStatusPollingInterval)});await this.restartTransport()}}},LX=Object.defineProperty,V6=Object.getOwnPropertySymbols,FX=Object.prototype.hasOwnProperty,MX=Object.prototype.propertyIsEnumerable,H6=(t,e,r)=>e in t?LX(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,G6=(t,e)=>{for(var r in e||(e={}))FX.call(e,r)&&H6(t,r,e[r]);if(V6)for(var r of V6(e))MX.call(e,r)&&H6(t,r,e[r]);return t},vg=class extends ui.IStore{constructor(e,r,n,i=ai,s=void 0){super(e,r,n,i),this.core=e,this.logger=r,this.name=n,this.map=new Map,this.version=A8,this.cached=[],this.initialized=!1,this.storagePrefix=ai,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=>nJ.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=G6(G6({},this.getData(o)),a);this.map.set(o,u),await this.persist()},this.delete=async(o,a)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:a}),this.map.delete(o),await this.persist())},this.logger=Qe.generateChildLogger(r,this.name),this.storagePrefix=i,this.getKey=s}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){let r=this.map.get(e);if(!r){let{message:n}=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)}}},Ag=class{constructor(e,r){this.core=e,this.logger=r,this.name=T8,this.version=C8,this.events=new eJ.default,this.initialized=!1,this.storagePrefix=ai,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(We.FIVE_MINUTES),o={protocol:p8},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),a;if(this.pairings.keys.includes(i)&&(a=this.pairings.get(i),a.active))throw new Error(`Pairing already exists: ${i}. Please try again with a new connection URI.`);this.core.crypto.keychain.has(i)||(await this.core.crypto.setSymKey(s,i),await this.core.relayer.subscribe(i,{relay:o}));let u=ee.calcExpiry(We.FIVE_MINUTES),l={topic:i,relay:o,expiry:u,active:!1};return await this.pairings.set(i,l),this.core.expirer.set(i,u),n.activatePairing&&await this.activate({topic:i}),this.events.emit(vl.create,l),l},this.activate=async({topic:n})=>{this.isInitialized();let i=ee.calcExpiry(We.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=_r.formatJsonRpcRequest(i,s),a=await this.core.crypto.encode(n,o),u=za[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=_r.formatJsonRpcResult(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=za[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=_r.formatJsonRpcError(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=za[u.request.method]?za[u.request.method].res:za.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;switch(s.method){case"wc_pairingPing":return this.onPairingPingRequest(i,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(i,s);default:return this.onUnknownRpcMethodRequest(i,s)}},this.onRelayEventResponse=async n=>{let{topic:i,payload:s}=n,o=(await this.core.history.get(i,s.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(i,s);default:return this.onUnknownRpcMethodResponse(o)}},this.onPairingPingRequest=async(n,i)=>{let{id:s}=i;try{this.isValidPing({topic:n}),await this.sendResult(s,n,!0),this.events.emit(vl.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(()=>{_r.isJsonRpcResult(i)?this.events.emit(ee.engineEvent("pairing_ping",s),{}):_r.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(vl.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=Qe.generateChildLogger(r,this.name),this.pairings=new vg(this.core,this.logger,this.name,this.storagePrefix)}get context(){return Qe.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(nr.message,async e=>{let{topic:r,message:n}=e;if(!this.pairings.keys.includes(r)||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;let i=await this.core.crypto.decode(r,n);try{_r.isJsonRpcRequest(i)?(this.core.history.set(r,i),this.onRelayEventRequest({topic:r,payload:i})):_r.isJsonRpcResponse(i)&&(await this.core.history.resolve(i),await this.onRelayEventResponse({topic:r,payload:i}),this.core.history.delete(r,i.id))}catch(s){this.logger.error(s)}})}registerExpirerEvents(){this.core.expirer.on(Vr.expired,async e=>{let{topic:r}=ee.parseExpirerTarget(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit(vl.expire,{topic:r}))})}},bg=class extends ui.IJsonRpcHistory{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new no.EventEmitter,this.name=x8,this.version=N8,this.cached=[],this.initialized=!1,this.storagePrefix=ai,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(We.THIRTY_DAYS)};this.records.set(o.id,o),this.events.emit(Yr.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=_r.isJsonRpcError(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.events.emit(Yr.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(Yr.deleted,s)}})},this.exists=async(n,i)=>(this.isInitialized(),this.records.has(i)?(await this.getRecord(i)).topic===n:!1),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=Qe.generateChildLogger(r,this.name)}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){let e=[];return this.values.forEach(r=>{if(typeof r.response<"u")return;let n={topic:r.topic,request:_r.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(Yr.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(Yr.created,e=>{let r=Yr.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.events.on(Yr.updated,e=>{let r=Yr.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.events.on(Yr.deleted,e=>{let r=Yr.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.core.heartbeat.on(Al.HEARTBEAT_EVENTS.pulse,()=>{this.cleanup()})}cleanup(){try{this.records.forEach(e=>{We.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)}}},_g=class extends ui.IExpirer{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new no.EventEmitter,this.name=O8,this.version=D8,this.cached=[],this.initialized=!1,this.storagePrefix=ai,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(Vr.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(Vr.deleted,{target:i,expiration:s})}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=Qe.generateChildLogger(r,this.name)}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return 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(Vr.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;We.toMiliseconds(n)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(Vr.expired,{target:e,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(Al.HEARTBEAT_EVENTS.pulse,()=>this.checkExpirations()),this.events.on(Vr.created,e=>{let r=Vr.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Vr.expired,e=>{let r=Vr.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Vr.deleted,e=>{let r=Vr.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)}}},Ig=class extends ui.IVerify{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.name=dg,this.initialized=!1,this.queue=[],this.verifyDisabled=!1,this.init=async()=>{if(this.verifyDisabled||ee.isReactNative()||!ee.isBrowser())return;let n=pg;this.verifyUrl!==n&&this.removeIframe(),this.verifyUrl=n;try{await this.createIframe()}catch(i){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(i)}if(!this.initialized){this.removeIframe(),this.verifyUrl=wb;try{await this.createIframe()}catch(i){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(i),this.verifyDisabled=!0}}},this.register=async n=>{this.initialized?this.sendPost(n.attestationId):(this.addToQueue(n.attestationId),await this.init())},this.resolve=async n=>{if(this.isDevEnv)return"";let i=n?.verifyUrl||pg,s;try{s=await this.fetchAttestation(n.attestationId,i)}catch(o){this.logger.info(`failed to resolve attestation: ${n.attestationId} from url: ${i}`),this.logger.info(o),s=await this.fetchAttestation(n.attestationId,wb)}return s},this.fetchAttestation=async(n,i)=>{this.logger.info(`resolving attestation: ${n} from url: ${i}`);let s=this.startAbortTimer(We.ONE_SECOND*2),o=await fetch(`${i}/attestation/${n}`,{signal:this.abortController.signal});return clearTimeout(s),o.status===200?await o.json():void 0},this.addToQueue=n=>{this.queue.push(n)},this.processQueue=()=>{this.queue.length!==0&&(this.queue.forEach(n=>this.sendPost(n)),this.queue=[])},this.sendPost=n=>{var i;try{if(!this.iframe)return;(i=this.iframe.contentWindow)==null||i.postMessage(n,"*"),this.logger.info(`postMessage sent: ${n} ${this.verifyUrl}`)}catch{}},this.createIframe=async()=>{let n,i=s=>{s.data==="verify_ready"&&(this.initialized=!0,this.processQueue(),window.removeEventListener("message",i),n())};await Promise.race([new Promise(s=>{if(document.getElementById(dg))return s();window.addEventListener("message",i);let o=document.createElement("iframe");o.id=dg,o.src=`${this.verifyUrl}/${this.projectId}`,o.style.display="none",document.body.append(o),this.iframe=o,n=s}),new Promise((s,o)=>setTimeout(()=>{window.removeEventListener("message",i),o("verify iframe load timeout")},We.toMiliseconds(We.FIVE_SECONDS)))])},this.removeIframe=()=>{this.iframe&&(this.iframe.remove(),this.iframe=void 0,this.initialized=!1)},this.logger=Qe.generateChildLogger(r,this.name),this.verifyUrl=pg,this.abortController=new AbortController,this.isDevEnv=ee.isNode()&&p.default.env.IS_VITEST}get context(){return Qe.getLoggerContext(this.logger)}startAbortTimer(e){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),We.toMiliseconds(e))}},UX=Object.defineProperty,k6=Object.getOwnPropertySymbols,qX=Object.prototype.hasOwnProperty,VX=Object.prototype.propertyIsEnumerable,j6=(t,e,r)=>e in t?UX(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Q6=(t,e)=>{for(var r in e||(e={}))qX.call(e,r)&&j6(t,r,e[r]);if(k6)for(var r of k6(e))VX.call(e,r)&&j6(t,r,e[r]);return t},Sg=class t extends ui.ICore{constructor(e){super(e),this.protocol=Ab,this.version=n8,this.name=xg,this.events=new no.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||bb,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";let r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:Qe.pino(Qe.getDefaultLoggerOptions({level:e?.logger||i8.logger}));this.logger=Qe.generateChildLogger(r,this.name),this.heartbeat=new Al.HeartBeat,this.crypto=new yg(this,this.logger,e?.keychain),this.history=new bg(this,this.logger),this.expirer=new _g(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new tJ.default(Q6(Q6({},s8),e?.storageOptions)),this.relayer=new Eg({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new Ag(this,this.logger),this.verify=new Ig(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(b8,n),r}get context(){return Qe.getLoggerContext(this.logger)}async start(){this.initialized||await this.initialize()}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}},HX=Sg;me.CORE_CONTEXT=xg,me.CORE_DEFAULT=i8,me.CORE_PROTOCOL=Ab,me.CORE_STORAGE_OPTIONS=s8,me.CORE_STORAGE_PREFIX=ai,me.CORE_VERSION=n8,me.CRYPTO_CLIENT_SEED=yb,me.CRYPTO_CONTEXT=o8,me.CRYPTO_JWT_TTL=a8,me.Core=HX,me.Crypto=yg,me.EXPIRER_CONTEXT=O8,me.EXPIRER_DEFAULT_TTL=SX,me.EXPIRER_EVENTS=Vr,me.EXPIRER_STORAGE_VERSION=D8,me.Expirer=_g,me.HISTORY_CONTEXT=x8,me.HISTORY_EVENTS=Yr,me.HISTORY_STORAGE_VERSION=N8,me.JsonRpcHistory=bg,me.KEYCHAIN_CONTEXT=u8,me.KEYCHAIN_STORAGE_VERSION=c8,me.KeyChain=gg,me.MESSAGES_CONTEXT=l8,me.MESSAGES_STORAGE_VERSION=f8,me.MessageTracker=mg,me.PAIRING_CONTEXT=T8,me.PAIRING_DEFAULT_TTL=IX,me.PAIRING_EVENTS=vl,me.PAIRING_RPC_OPTS=za,me.PAIRING_STORAGE_VERSION=C8,me.PENDING_SUB_RESOLUTION_TIMEOUT=S8,me.PUBLISHER_CONTEXT=d8,me.PUBLISHER_DEFAULT_TTL=h8,me.Pairing=Ag,me.RELAYER_CONTEXT=y8,me.RELAYER_DEFAULT_LOGGER=g8,me.RELAYER_DEFAULT_PROTOCOL=p8,me.RELAYER_DEFAULT_RELAY_URL=bb,me.RELAYER_EVENTS=nr,me.RELAYER_FAILOVER_RELAY_URL=mb,me.RELAYER_PROVIDER_EVENTS=Nn,me.RELAYER_RECONNECT_TIMEOUT=w8,me.RELAYER_SDK_VERSION=E8,me.RELAYER_STORAGE_OPTIONS=bX,me.RELAYER_SUBSCRIBER_SUFFIX=m8,me.RELAYER_TRANSPORT_CUTOFF=v8,me.Relayer=Eg,me.STORE_STORAGE_VERSION=A8,me.SUBSCRIBER_CONTEXT=_8,me.SUBSCRIBER_DEFAULT_TTL=_X,me.SUBSCRIBER_EVENTS=Hr,me.SUBSCRIBER_STORAGE_VERSION=I8,me.Store=vg,me.Subscriber=wg,me.VERIFY_CONTEXT=dg,me.VERIFY_FALLBACK_SERVER=wb,me.VERIFY_SERVER=pg,me.Verify=Ig,me.WALLETCONNECT_CLIENT_ID=b8,me.default=Sg});var k8=m(Je=>{"use strict";c();Object.defineProperty(Je,"__esModule",{value:!0});var Dn=P8(),Ng=qv(),L8=n1(),j=cl(),F8=Kn(),Xe=ks(),yt=(dl(),ct(Zt));function GX(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var kX=GX(F8),xb="wc",Nb=2,Ob="client",Rg=`${xb}@${Nb}:${Ob}:`,Og={name:Ob,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},jX={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"},QX={database:":memory:"},_b="WALLETCONNECT_DEEPLINK_CHOICE",WX={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},$X="history",zX="0.3",M8="proposal",KX=Xe.THIRTY_DAYS,U8="Proposal expired",q8="session",Il=Xe.SEVEN_DAYS,V8="engine",Ka={wc_sessionPropose:{req:{ttl:Xe.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:Xe.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:Xe.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:Xe.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:Xe.ONE_DAY,prompt:!1,tag:1104},res:{ttl:Xe.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:Xe.ONE_DAY,prompt:!1,tag:1106},res:{ttl:Xe.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:Xe.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:Xe.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:Xe.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:Xe.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:Xe.ONE_DAY,prompt:!1,tag:1112},res:{ttl:Xe.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:Xe.THIRTY_SECONDS,prompt:!1,tag:1114},res:{ttl:Xe.THIRTY_SECONDS,prompt:!1,tag:1115}}},Dg={min:Xe.FIVE_MINUTES,max:Xe.SEVEN_DAYS},On={idle:"IDLE",active:"ACTIVE"},H8="request",G8=["wc_sessionPropose","wc_sessionRequest","wc_authRequest"],YX=Object.defineProperty,JX=Object.defineProperties,XX=Object.getOwnPropertyDescriptors,R8=Object.getOwnPropertySymbols,ZX=Object.prototype.hasOwnProperty,eZ=Object.prototype.propertyIsEnumerable,B8=(t,e,r)=>e in t?YX(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,gr=(t,e)=>{for(var r in e||(e={}))ZX.call(e,r)&&B8(t,r,e[r]);if(R8)for(var r of R8(e))eZ.call(e,r)&&B8(t,r,e[r]);return t},_l=(t,e)=>JX(t,XX(e)),Ib=class extends L8.IEngine{constructor(e){super(e),this.name=V8,this.events=new kX.default,this.initialized=!1,this.ignoredPayloadTypes=[j.TYPE_1],this.requestQueue={state:On.idle,queue:[]},this.sessionRequestQueue={state:On.idle,queue:[]},this.requestQueueDelay=Xe.ONE_SECOND,this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),this.client.core.pairing.register({methods:Object.keys(Ka)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},Xe.toMiliseconds(this.requestQueueDelay)))},this.connect=async r=>{await this.isInitialized();let n=_l(gr({},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:U,uri:A}=await this.client.core.pairing.create();l=U,f=A}let g=await this.client.core.crypto.generateKeyPair(),w=gr({requiredNamespaces:s,optionalNamespaces:o,relays:u??[{protocol:Dn.RELAYER_DEFAULT_PROTOCOL}],proposer:{publicKey:g,metadata:this.client.metadata}},a&&{sessionProperties:a}),{reject:E,resolve:T,done:D}=j.createDelayedPromise(Xe.FIVE_MINUTES,U8);if(this.events.once(j.engineEvent("session_connect"),async({error:U,session:A})=>{if(U)E(U);else if(A){A.self.publicKey=g;let I=_l(gr({},A),{requiredNamespaces:A.requiredNamespaces,optionalNamespaces:A.optionalNamespaces});await this.client.session.set(A.topic,I),await this.setExpiry(A.topic,A.expiry),l&&await this.client.core.pairing.updateMetadata({topic:l,metadata:A.peer.metadata}),T(I)}}),!l){let{message:U}=j.getInternalError("NO_MATCHING_KEY",`connect() pairing topic: ${l}`);throw new Error(U)}let B=await this.sendRequest({topic:l,method:"wc_sessionPropose",params:w}),W=j.calcExpiry(Xe.FIVE_MINUTES);return await this.setProposal(B,gr({id:B,expiry:W},w)),{uri:f,approval:D}},this.pair=async r=>(await this.isInitialized(),await this.client.core.pairing.pair(r)),this.approve=async r=>{await this.isInitialized(),await this.isValidApprove(r);let{id:n,relayProtocol:i,namespaces:s,sessionProperties:o}=r,a=this.client.proposal.get(n),{pairingTopic:u,proposer:l,requiredNamespaces:f,optionalNamespaces:d}=a;u=u||"",j.isValidObject(f)||(f=j.getRequiredNamespacesFromNamespaces(s,"approve()"));let g=await this.client.core.crypto.generateKeyPair(),w=l.publicKey,E=await this.client.core.crypto.generateSharedKey(g,w);u&&n&&(await this.client.core.pairing.updateMetadata({topic:u,metadata:l.metadata}),await this.sendResult({id:n,topic:u,result:{relay:{protocol:i??"irn"},responderPublicKey:g}}),await this.client.proposal.delete(n,j.getSdkError("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:u}));let T=gr({relay:{protocol:i??"irn"},namespaces:s,requiredNamespaces:f,optionalNamespaces:d,pairingTopic:u,controller:{publicKey:g,metadata:this.client.metadata},expiry:j.calcExpiry(Il)},o&&{sessionProperties:o});await this.client.core.relayer.subscribe(E),await this.sendRequest({topic:E,method:"wc_sessionSettle",params:T,throwOnFailedPublish:!0});let D=_l(gr({},T),{topic:E,pairingTopic:u,acknowledged:!1,self:T.controller,peer:{publicKey:l.publicKey,metadata:l.metadata},controller:g});return await this.client.session.set(E,D),await this.setExpiry(E,j.calcExpiry(Il)),{topic:E,acknowledged:()=>new Promise(B=>setTimeout(()=>B(this.client.session.get(E)),500))}},this.reject=async r=>{await this.isInitialized(),await this.isValidReject(r);let{id:n,reason:i}=r,{pairingTopic:s}=this.client.proposal.get(n);s&&(await this.sendError(n,s,i),await this.client.proposal.delete(n,j.getSdkError("USER_DISCONNECTED")))},this.update=async r=>{await this.isInitialized(),await this.isValidUpdate(r);let{topic:n,namespaces:i}=r,s=await this.sendRequest({topic:n,method:"wc_sessionUpdate",params:{namespaces:i}}),{done:o,resolve:a,reject:u}=j.createDelayedPromise();return this.events.once(j.engineEvent("session_update",s),({error:l})=>{l?u(l):a()}),await this.client.session.update(n,{namespaces:i}),{acknowledged:o}},this.extend=async r=>{await this.isInitialized(),await this.isValidExtend(r);let{topic:n}=r,i=await this.sendRequest({topic:n,method:"wc_sessionExtend",params:{}}),{done:s,resolve:o,reject:a}=j.createDelayedPromise();return this.events.once(j.engineEvent("session_extend",i),({error:u})=>{u?a(u):o()}),await this.setExpiry(n,j.calcExpiry(Il)),{acknowledged:s}},this.request=async r=>{await this.isInitialized(),await this.isValidRequest(r);let{chainId:n,request:i,topic:s,expiry:o}=r,a=yt.payloadId(),{done:u,resolve:l,reject:f}=j.createDelayedPromise(o,"Request expired. Please try again.");return this.events.once(j.engineEvent("session_request",a),({error:d,result:g})=>{d?f(d):l(g)}),await Promise.all([new Promise(async d=>{await this.sendRequest({clientRpcId:a,topic:s,method:"wc_sessionRequest",params:{request:i,chainId:n},expiry:o,throwOnFailedPublish:!0}).catch(g=>f(g)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:a}),d()}),new Promise(async d=>{let g=await this.client.core.storage.getItem(_b);j.handleDeeplinkRedirect({id:a,topic:s,wcDeepLink:g}),d()}),u()]).then(d=>d[2])},this.respond=async r=>{await this.isInitialized(),await this.isValidRespond(r);let{topic:n,response:i}=r,{id:s}=i;yt.isJsonRpcResult(i)?await this.sendResult({id:s,topic:n,result:i.result,throwOnFailedPublish:!0}):yt.isJsonRpcError(i)&&await this.sendError(s,n,i.error),this.cleanupAfterResponse(r)},this.ping=async r=>{await this.isInitialized(),await this.isValidPing(r);let{topic:n}=r;if(this.client.session.keys.includes(n)){let i=await this.sendRequest({topic:n,method:"wc_sessionPing",params:{}}),{done:s,resolve:o,reject:a}=j.createDelayedPromise();this.events.once(j.engineEvent("session_ping",i),({error:u})=>{u?a(u):o()}),await s()}else this.client.core.pairing.pairings.keys.includes(n)&&await this.client.core.pairing.ping({topic:n})},this.emit=async r=>{await this.isInitialized(),await this.isValidEmit(r);let{topic:n,event:i,chainId:s}=r;await this.sendRequest({topic:n,method:"wc_sessionEvent",params:{event:i,chainId:s}})},this.disconnect=async r=>{await this.isInitialized(),await this.isValidDisconnect(r);let{topic:n}=r;this.client.session.keys.includes(n)?(await this.sendRequest({topic:n,method:"wc_sessionDelete",params:j.getSdkError("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession(n)):await this.client.core.pairing.disconnect({topic:n})},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(n=>j.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,j.getSdkError("USER_DISCONNECTED")),this.client.core.crypto.keychain.has(i.publicKey)&&await this.client.core.crypto.deleteKeyPair(i.publicKey),this.client.core.crypto.keychain.has(r)&&await this.client.core.crypto.deleteSymKey(r),n||this.client.core.expirer.del(r),this.client.core.storage.removeItem(_b).catch(s=>this.client.logger.warn(s))},this.deleteProposal=async(r,n)=>{await Promise.all([this.client.proposal.delete(r,j.getSdkError("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(r)])},this.deletePendingSessionRequest=async(r,n,i=!1)=>{await Promise.all([this.client.pendingRequest.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)]),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==r),i&&(this.sessionRequestQueue.state=On.idle)},this.setExpiry=async(r,n)=>{this.client.session.keys.includes(r)&&await this.client.session.update(r,{expiry:n}),this.client.core.expirer.set(r,n)},this.setProposal=async(r,n)=>{await this.client.proposal.set(r,n),this.client.core.expirer.set(r,n.expiry)},this.setPendingSessionRequest=async r=>{let n=Ka.wc_sessionRequest.req.ttl,{id:i,topic:s,params:o,verifyContext:a}=r;await this.client.pendingRequest.set(i,{id:i,topic:s,params:o,verifyContext:a}),n&&this.client.core.expirer.set(i,j.calcExpiry(n))},this.sendRequest=async r=>{let{topic:n,method:i,params:s,expiry:o,relayRpcId:a,clientRpcId:u,throwOnFailedPublish:l}=r,f=yt.formatJsonRpcRequest(i,s,u);if(j.isBrowser()&&G8.includes(i)){let w=j.hashMessage(JSON.stringify(f));this.client.core.verify.register({attestationId:w})}let d=await this.client.core.crypto.encode(n,f),g=Ka[i].req;return o&&(g.ttl=o),a&&(g.id=a),this.client.core.history.set(n,f),l?(g.internal=_l(gr({},g.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,d,g)):this.client.core.relayer.publish(n,d,g).catch(w=>this.client.logger.error(w)),f.id},this.sendResult=async r=>{let{id:n,topic:i,result:s,throwOnFailedPublish:o}=r,a=yt.formatJsonRpcResult(n,s),u=await this.client.core.crypto.encode(i,a),l=await this.client.core.history.get(i,n),f=Ka[l.request.method].res;o?(f.internal=_l(gr({},f.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,u,f)):this.client.core.relayer.publish(i,u,f).catch(d=>this.client.logger.error(d)),await this.client.core.history.resolve(a)},this.sendError=async(r,n,i)=>{let s=yt.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=>{j.isExpired(i.expiry)&&r.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{j.isExpired(i.expiry)&&n.push(i.id)}),await Promise.all([...r.map(i=>this.deleteSession(i)),...n.map(i=>this.deleteProposal(i))])},this.onRelayEventRequest=async r=>{this.requestQueue.queue.push(r),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===On.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=On.active;let r=this.requestQueue.queue.shift();if(r)try{this.processRequest(r),await new Promise(n=>setTimeout(n,300))}catch(n){this.client.logger.warn(n)}}this.requestQueue.state=On.idle},this.processRequest=r=>{let{topic:n,payload:i}=r,s=i.method;switch(s){case"wc_sessionPropose":return this.onSessionProposeRequest(n,i);case"wc_sessionSettle":return this.onSessionSettleRequest(n,i);case"wc_sessionUpdate":return this.onSessionUpdateRequest(n,i);case"wc_sessionExtend":return this.onSessionExtendRequest(n,i);case"wc_sessionPing":return this.onSessionPingRequest(n,i);case"wc_sessionDelete":return this.onSessionDeleteRequest(n,i);case"wc_sessionRequest":return this.onSessionRequest(n,i);case"wc_sessionEvent":return this.onSessionEventRequest(n,i);default:return this.client.logger.info(`Unsupported request method ${s}`)}},this.onRelayEventResponse=async r=>{let{topic:n,payload:i}=r,s=(await this.client.core.history.get(n,i.id)).request.method;switch(s){case"wc_sessionPropose":return this.onSessionProposeResponse(n,i);case"wc_sessionSettle":return this.onSessionSettleResponse(n,i);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,i);case"wc_sessionExtend":return this.onSessionExtendResponse(n,i);case"wc_sessionPing":return this.onSessionPingResponse(n,i);case"wc_sessionRequest":return this.onSessionRequestResponse(n,i);default:return this.client.logger.info(`Unsupported response method ${s}`)}},this.onRelayEventUnknownPayload=r=>{let{topic:n}=r,{message:i}=j.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(gr({},n.params));let o=j.calcExpiry(Xe.FIVE_MINUTES),a=gr({id:s,pairingTopic:r,expiry:o},i);await this.setProposal(s,a);let u=j.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(yt.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 yt.isJsonRpcError(n)&&(await this.client.proposal.delete(i,j.getSdkError("USER_DISCONNECTED")),this.events.emit(j.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:w}=n.params,E=gr({topic:r,relay:o,expiry:u,namespaces:l,acknowledged:!0,pairingTopic:w,requiredNamespaces:f,optionalNamespaces:d,controller:a.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}},g&&{sessionProperties:g});await this.sendResult({id:n.id,topic:r,result:!0}),this.events.emit(j.engineEvent("session_connect"),{session:E}),this.cleanupDuplicatePairings(E)}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.onSessionSettleResponse=async(r,n)=>{let{id:i}=n;yt.isJsonRpcResult(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(j.engineEvent("session_approve",i),{})):yt.isJsonRpcError(n)&&(await this.client.session.delete(r,j.getSdkError("USER_DISCONNECTED")),this.events.emit(j.engineEvent("session_approve",i),{error:n.error}))},this.onSessionUpdateRequest=async(r,n)=>{let{params:i,id:s}=n;try{let o=`${r}_session_update`,a=j.MemoryStore.get(o);if(a&&this.isRequestOutOfSync(a,s)){this.client.logger.info(`Discarding out of sync request - ${s}`);return}this.isValidUpdate(gr({topic:r},i)),await this.client.session.update(r,{namespaces:i.namespaces}),await this.sendResult({id:s,topic:r,result:!0}),this.client.events.emit("session_update",{id:s,topic:r,params:i}),j.MemoryStore.set(o,s)}catch(o){await this.sendError(s,r,o),this.client.logger.error(o)}},this.isRequestOutOfSync=(r,n)=>parseInt(n.toString().slice(0,-3))<=parseInt(r.toString().slice(0,-3)),this.onSessionUpdateResponse=(r,n)=>{let{id:i}=n;yt.isJsonRpcResult(n)?this.events.emit(j.engineEvent("session_update",i),{}):yt.isJsonRpcError(n)&&this.events.emit(j.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,j.calcExpiry(Il)),await this.sendResult({id:i,topic:r,result:!0}),this.client.events.emit("session_extend",{id:i,topic:r})}catch(s){await this.sendError(i,r,s),this.client.logger.error(s)}},this.onSessionExtendResponse=(r,n)=>{let{id:i}=n;yt.isJsonRpcResult(n)?this.events.emit(j.engineEvent("session_extend",i),{}):yt.isJsonRpcError(n)&&this.events.emit(j.engineEvent("session_extend",i),{error:n.error})},this.onSessionPingRequest=async(r,n)=>{let{id:i}=n;try{this.isValidPing({topic:r}),await this.sendResult({id:i,topic:r,result:!0}),this.client.events.emit("session_ping",{id:i,topic:r})}catch(s){await this.sendError(i,r,s),this.client.logger.error(s)}},this.onSessionPingResponse=(r,n)=>{let{id:i}=n;setTimeout(()=>{yt.isJsonRpcResult(n)?this.events.emit(j.engineEvent("session_ping",i),{}):yt.isJsonRpcError(n)&&this.events.emit(j.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(Dn.RELAYER_EVENTS.publish,async()=>{s(await this.deleteSession(r))})}),this.sendResult({id:i,topic:r,result:!0})]),this.client.events.emit("session_delete",{id:i,topic:r})}catch(s){this.client.logger.error(s)}},this.onSessionRequest=async(r,n)=>{let{id:i,params:s}=n;try{this.isValidRequest(gr({topic:r},s));let o=j.hashMessage(JSON.stringify(yt.formatJsonRpcRequest("wc_sessionRequest",s,i))),a=this.client.session.get(r),u=await this.getVerifyContext(o,a.peer.metadata),l={id:i,topic:r,params:s,verifyContext:u};await this.setPendingSessionRequest(l),this.addSessionRequestToSessionRequestQueue(l),this.processSessionRequestQueue()}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.onSessionRequestResponse=(r,n)=>{let{id:i}=n;yt.isJsonRpcResult(n)?this.events.emit(j.engineEvent("session_request",i),{result:n.result}):yt.isJsonRpcError(n)&&this.events.emit(j.engineEvent("session_request",i),{error:n.error})},this.onSessionEventRequest=async(r,n)=>{let{id:i,params:s}=n;try{let o=`${r}_session_event_${s.event.name}`,a=j.MemoryStore.get(o);if(a&&this.isRequestOutOfSync(a,i)){this.client.logger.info(`Discarding out of sync request - ${i}`);return}this.isValidEmit(gr({topic:r},s)),this.client.events.emit("session_event",{id:i,topic:r,params:s}),j.MemoryStore.set(o,i)}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.addSessionRequestToSessionRequestQueue=r=>{this.sessionRequestQueue.queue.push(r)},this.cleanupAfterResponse=r=>{this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=On.idle,this.processSessionRequestQueue()},Xe.toMiliseconds(this.requestQueueDelay))},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===On.active){this.client.logger.info("session request queue is already active.");return}let r=this.sessionRequestQueue.queue[0];if(!r){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=On.active,this.client.events.emit("session_request",r)}catch(n){this.client.logger.error(n)}},this.onPairingCreated=r=>{if(r.active)return;let n=this.client.proposal.getAll().find(i=>i.pairingTopic===r.topic);n&&this.onSessionProposeRequest(r.topic,yt.formatJsonRpcRequest("wc_sessionPropose",{requiredNamespaces:n.requiredNamespaces,optionalNamespaces:n.optionalNamespaces,relays:n.relays,proposer:n.proposer},n.id))},this.isValidConnect=async r=>{if(!j.isValidParams(r)){let{message:u}=j.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(j.isUndefined(n)||await this.isValidPairingTopic(n),!j.isValidRelays(a,!0)){let{message:u}=j.getInternalError("MISSING_OR_INVALID",`connect() relays: ${a}`);throw new Error(u)}!j.isUndefined(i)&&j.isValidObject(i)!==0&&this.validateNamespaces(i,"requiredNamespaces"),!j.isUndefined(s)&&j.isValidObject(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),j.isUndefined(o)||this.validateSessionProps(o,"sessionProperties")},this.validateNamespaces=(r,n)=>{let i=j.isValidRequiredNamespaces(r,"connect()",n);if(i)throw new Error(i.message)},this.isValidApprove=async r=>{if(!j.isValidParams(r))throw new Error(j.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=j.isValidNamespaces(i,"approve()");if(u)throw new Error(u.message);let l=j.isConformingNamespaces(a.requiredNamespaces,i,"approve()");if(l)throw new Error(l.message);if(!j.isValidString(s,!0)){let{message:f}=j.getInternalError("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(f)}j.isUndefined(o)||this.validateSessionProps(o,"sessionProperties")},this.isValidReject=async r=>{if(!j.isValidParams(r)){let{message:s}=j.getInternalError("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(s)}let{id:n,reason:i}=r;if(await this.isValidProposalId(n),!j.isValidErrorReason(i)){let{message:s}=j.getInternalError("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidSessionSettleRequest=r=>{if(!j.isValidParams(r)){let{message:l}=j.getInternalError("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(l)}let{relay:n,controller:i,namespaces:s,expiry:o}=r;if(!j.isValidRelay(n)){let{message:l}=j.getInternalError("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(l)}let a=j.isValidController(i,"onSessionSettleRequest()");if(a)throw new Error(a.message);let u=j.isValidNamespaces(s,"onSessionSettleRequest()");if(u)throw new Error(u.message);if(j.isExpired(o)){let{message:l}=j.getInternalError("EXPIRED","onSessionSettleRequest()");throw new Error(l)}},this.isValidUpdate=async r=>{if(!j.isValidParams(r)){let{message:u}=j.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=j.isValidNamespaces(i,"update()");if(o)throw new Error(o.message);let a=j.isConformingNamespaces(s.requiredNamespaces,i,"update()");if(a)throw new Error(a.message)},this.isValidExtend=async r=>{if(!j.isValidParams(r)){let{message:i}=j.getInternalError("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionTopic(n)},this.isValidRequest=async r=>{if(!j.isValidParams(r)){let{message:u}=j.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(!j.isValidNamespacesChainId(a,s)){let{message:u}=j.getInternalError("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(u)}if(!j.isValidRequest(i)){let{message:u}=j.getInternalError("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(u)}if(!j.isValidNamespacesRequest(a,s,i.method)){let{message:u}=j.getInternalError("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(u)}if(o&&!j.isValidRequestExpiry(o,Dg)){let{message:u}=j.getInternalError("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${Dg.min} and ${Dg.max}`);throw new Error(u)}},this.isValidRespond=async r=>{if(!j.isValidParams(r)){let{message:s}=j.getInternalError("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(s)}let{topic:n,response:i}=r;if(await this.isValidSessionTopic(n),!j.isValidResponse(i)){let{message:s}=j.getInternalError("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidPing=async r=>{if(!j.isValidParams(r)){let{message:i}=j.getInternalError("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async r=>{if(!j.isValidParams(r)){let{message:a}=j.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(!j.isValidNamespacesChainId(o,s)){let{message:a}=j.getInternalError("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(a)}if(!j.isValidEvent(i)){let{message:a}=j.getInternalError("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}if(!j.isValidNamespacesEvent(o,s,i.name)){let{message:a}=j.getInternalError("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}},this.isValidDisconnect=async r=>{if(!j.isValidParams(r)){let{message:i}=j.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||Dn.VERIFY_SERVER,validation:"UNKNOWN",origin:n.url||""}};try{let s=await this.client.core.verify.resolve({attestationId:r,verifyUrl:n.verifyUrl});s&&(i.verified.origin=s.origin,i.verified.isScam=s.isScam,i.verified.validation=s.origin===new URL(n.url).origin?"VALID":"INVALID")}catch(s){this.client.logger.info(s)}return this.client.logger.info(`Verify context: ${JSON.stringify(i)}`),i},this.validateSessionProps=(r,n)=>{Object.values(r).forEach(i=>{if(!j.isValidString(i,!1)){let{message:s}=j.getInternalError("MISSING_OR_INVALID",`${n} must be in Record format. Received: ${JSON.stringify(i)}`);throw new Error(s)}})}}async isInitialized(){if(!this.initialized){let{message:e}=j.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(Dn.RELAYER_EVENTS.message,async e=>{let{topic:r,message:n}=e;if(this.ignoredPayloadTypes.includes(this.client.core.crypto.getPayloadType(n)))return;let i=await this.client.core.crypto.decode(r,n);try{yt.isJsonRpcRequest(i)?(this.client.core.history.set(r,i),this.onRelayEventRequest({topic:r,payload:i})):yt.isJsonRpcResponse(i)?(await this.client.core.history.resolve(i),await this.onRelayEventResponse({topic:r,payload:i}),this.client.core.history.delete(r,i.id)):this.onRelayEventUnknownPayload({topic:r,payload:i})}catch(s){this.client.logger.error(s)}})}registerExpirerEvents(){this.client.core.expirer.on(Dn.EXPIRER_EVENTS.expired,async e=>{let{topic:r,id:n}=j.parseExpirerTarget(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,j.getInternalError("EXPIRED"),!0);r?this.client.session.keys.includes(r)&&(await this.deleteSession(r,!0),this.client.events.emit("session_expire",{topic:r})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}registerPairingEvents(){this.client.core.pairing.events.on(Dn.PAIRING_EVENTS.create,e=>this.onPairingCreated(e))}isValidPairingTopic(e){if(!j.isValidString(e,!1)){let{message:r}=j.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}=j.getInternalError("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(j.isExpired(this.client.core.pairing.pairings.get(e).expiry)){let{message:r}=j.getInternalError("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!j.isValidString(e,!1)){let{message:r}=j.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}=j.getInternalError("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(j.isExpired(this.client.session.get(e).expiry)){await this.deleteSession(e);let{message:r}=j.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(j.isValidString(e,!1)){let{message:r}=j.getInternalError("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{let{message:r}=j.getInternalError("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!j.isValidId(e)){let{message:r}=j.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}=j.getInternalError("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(j.isExpired(this.client.proposal.get(e).expiry)){await this.deleteProposal(e);let{message:r}=j.getInternalError("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}},Sb=class extends Dn.Store{constructor(e,r){super(e,r,M8,Rg),this.core=e,this.logger=r}},Tb=class extends Dn.Store{constructor(e,r){super(e,r,q8,Rg),this.core=e,this.logger=r}},Cb=class extends Dn.Store{constructor(e,r){super(e,r,H8,Rg,n=>n.id),this.core=e,this.logger=r}},Pg=class t extends L8.ISignClient{constructor(e){super(e),this.protocol=xb,this.version=Nb,this.name=Og.name,this.events=new F8.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||Og.name,this.metadata=e?.metadata||j.getAppMetadata();let r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:Ng.pino(Ng.getDefaultLoggerOptions({level:e?.logger||Og.logger}));this.core=e?.core||new Dn.Core(e),this.logger=Ng.generateChildLogger(r,this.name),this.session=new Tb(this.core,this.logger),this.proposal=new Sb(this.core,this.logger),this.pendingRequest=new Cb(this.core,this.logger),this.engine=new Ib(this)}static async init(e){let r=new t(e);return await r.initialize(),r}get context(){return Ng.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}}},tZ=Pg;Je.ENGINE_CONTEXT=V8,Je.ENGINE_QUEUE_STATES=On,Je.ENGINE_RPC_OPTS=Ka,Je.HISTORY_CONTEXT=$X,Je.HISTORY_EVENTS=WX,Je.HISTORY_STORAGE_VERSION=zX,Je.METHODS_TO_VERIFY=G8,Je.PROPOSAL_CONTEXT=M8,Je.PROPOSAL_EXPIRY=KX,Je.PROPOSAL_EXPIRY_MESSAGE=U8,Je.REQUEST_CONTEXT=H8,Je.SESSION_CONTEXT=q8,Je.SESSION_EXPIRY=Il,Je.SESSION_REQUEST_EXPIRY_BOUNDARIES=Dg,Je.SIGN_CLIENT_CONTEXT=Ob,Je.SIGN_CLIENT_DEFAULT=Og,Je.SIGN_CLIENT_EVENTS=jX,Je.SIGN_CLIENT_PROTOCOL=xb,Je.SIGN_CLIENT_STORAGE_OPTIONS=QX,Je.SIGN_CLIENT_STORAGE_PREFIX=Rg,Je.SIGN_CLIENT_VERSION=Nb,Je.SignClient=tZ,Je.WALLETCONNECT_DEEPLINK_CHOICE=_b,Je.default=Pg});var Bg=m(Ji=>{"use strict";c();Object.defineProperty(Ji,"__esModule",{value:!0});Ji.OptionalOperation=Ji.Operation=void 0;var rZ;(function(t){t.SIGN_TRANSACTION="mvx_signTransaction",t.SIGN_TRANSACTIONS="mvx_signTransactions",t.SIGN_MESSAGE="mvx_signMessage"})(rZ=Ji.Operation||(Ji.Operation={}));var nZ;(function(t){t.SIGN_LOGIN_TOKEN="mvx_signLoginToken",t.SIGN_NATIVE_AUTH_TOKEN="mvx_signNativeAuthToken",t.CANCEL_ACTION="mvx_cancelAction"})(nZ=Ji.OptionalOperation||(Ji.OptionalOperation={}))});var Db=m(Pn=>{"use strict";c();Object.defineProperty(Pn,"__esModule",{value:!0});Pn.WALLETCONNECT_SIGN_LOGIN_DELAY=Pn.WALLETCONNECT_MULTIVERSX_OPTIONAL_METHODS=Pn.WALLETCONNECT_MULTIVERSX_METHODS=Pn.WALLETCONNECT_MULTIVERSX_NAMESPACE=void 0;var j8=Bg();Pn.WALLETCONNECT_MULTIVERSX_NAMESPACE="mvx";Pn.WALLETCONNECT_MULTIVERSX_METHODS=Object.values(j8.Operation);Pn.WALLETCONNECT_MULTIVERSX_OPTIONAL_METHODS=Object.values(j8.OptionalOperation);Pn.WALLETCONNECT_SIGN_LOGIN_DELAY=200});var Bb=m(Jr=>{"use strict";c();Object.defineProperty(Jr,"__esModule",{value:!0});Jr.WalletConnectV2ProviderErrorMessagesEnum=Jr.ErrBadAddress=Jr.ErrNotImplemented=Jr.Err=void 0;var Sl=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};Jr.Err=Sl;var Pb=class extends Sl{constructor(){super("Method not yet implemented")}};Jr.ErrNotImplemented=Pb;var Rb=class extends Sl{constructor(e,r){super(`Bad address: ${e}`,r)}};Jr.ErrBadAddress=Rb;var iZ;(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"})(iZ=Jr.WalletConnectV2ProviderErrorMessagesEnum||(Jr.WalletConnectV2ProviderErrorMessagesEnum={}))});var Fb=m(Lg=>{"use strict";c();Object.defineProperty(Lg,"__esModule",{value:!0});Lg.Logger=void 0;var Lb=class{static error(e){console.error(e)}static trace(e){console.trace(e)}};Lg.Logger=Lb});var Q8=m(()=>{"use strict";c();global.Buffer||(global.Buffer=Ps().Buffer)});var $8=m(W8=>{"use strict";c();Object.defineProperty(W8,"__esModule",{value:!0})});var K8=m(z8=>{"use strict";c();Object.defineProperty(z8,"__esModule",{value:!0})});var Y8=m(Ya=>{"use strict";c();var sZ=Ya&&Ya.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ya,"__esModule",{value:!0});Ya.RelayedTransactionV1Builder=void 0;var oZ=sZ(Gt()),Mb=ht(),aZ=Be(),uZ=wn(),cZ=jn(),Ub=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 aZ.ErrInvalidRelayedV1BuilderArguments;let e=this.prepareInnerTransaction(),r=`relayedTx@${h.Buffer.from(e).toString("hex")}`,n=new cZ.TransactionPayload(r),i=this.netConfig.MinGasLimit+this.netConfig.GasPerDataByte*n.length()+this.innerTransaction.getGasLimit().valueOf(),s=new uZ.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 Mb.Address(this.innerTransaction.getSender().bech32()).pubkey().toString("base64"),receiver:new Mb.Address(this.innerTransaction.getReceiver().bech32()).pubkey().toString("base64"),value:new oZ.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 Mb.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)}};Ya.RelayedTransactionV1Builder=Ub});var J8=m(Fg=>{"use strict";c();Object.defineProperty(Fg,"__esModule",{value:!0});Fg.Code=void 0;var qb=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")}};Fg.Code=qb});var Z8=m(X8=>{"use strict";c();Object.defineProperty(X8,"__esModule",{value:!0})});var nB=m(Xa=>{"use strict";c();Object.defineProperty(Xa,"__esModule",{value:!0});Xa.bech32m=Xa.bech32=void 0;var Mg="qpzry9x8gf2tvdw0s3jn54khce6mua7l",tB={};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 eB(t){let e=1;for(let r=0;r126)return"Invalid prefix ("+t+")";e=Ja(e)^n>>5}e=Ja(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=eB(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=Ja(l)^g,f+=Mg.charAt(g)}for(let d=0;d<6;++d)l=Ja(l);l^=e;for(let d=0;d<6;++d){let g=l>>(5-d)*5&31;f+=Mg.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 w=eB(d);if(typeof w=="string")return w;let E=[];for(let T=0;T=g.length)&&E.push(B)}return w!==e?"Invalid checksum for "+o:{prefix:d,words:E}}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:lZ,fromWordsUnsafe:fZ,fromWords:hZ}}Xa.bech32=rB("bech32");Xa.bech32m=rB("bech32m")});var sB=m(Gr=>{"use strict";c();Object.defineProperty(Gr,"__esModule",{value:!0});Gr.TokenTransferProperties=Gr.TransactionMetadataTransfer=Gr.TransactionMetadata=Gr.TransactionToDecode=Gr.TransactionDecoder=void 0;var iB=nB(),Hb=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 io;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 Ug;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 io;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 io;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 io;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=iB.bech32.toWords(r);return iB.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)}};Gr.TransactionDecoder=Hb;var Ug=class{constructor(){this.sender="",this.receiver="",this.data="",this.value="0"}};Gr.TransactionToDecode=Ug;var io=class{constructor(){this.sender="",this.receiver="",this.value=BigInt(0)}};Gr.TransactionMetadata=io;var Gb=class{constructor(){this.value=BigInt(0)}};Gr.TransactionMetadataTransfer=Gb;var kb=class{};Gr.TokenTransferProperties=kb});var jb=m(qg=>{"use strict";c();Object.defineProperty(qg,"__esModule",{value:!0});qg.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)}};qg.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 uB=m(Vg=>{"use strict";c();Object.defineProperty(Vg,"__esModule",{value:!0});Vg.ResultsParser=void 0;var dZ=sB(),oB=ht(),aB=Be(),Xi=na(),pZ=Wo(),Za=jb(),eu;(function(t){t.OnTransactionCompleted="completedTxEvent",t.OnSignalError="signalError",t.OnWriteLog="writeLog"})(eu||(eu={}));var Qb;(function(t){t.TooMuchGas="@too much gas provided for processing"})(Qb||(Qb={}));var gZ={argsSerializer:new pZ.ArgSerializer},Wb=class{constructor(e){e=Object.assign(Object.assign({},gZ),e),this.argsSerializer=e.argsSerializer}parseQueryResponse(e,r){let n=e.getReturnDataParts(),i=this.argsSerializer.buffersToValues(n,r.output);return{returnCode:new Za.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 Za.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 Xi.Logger.trace("parseUntypedOutcome(): on simple move balance"),r;if(r=this.createBundleOnInvalidTransaction(e),r)return Xi.Logger.trace("parseUntypedOutcome(): on invalid transaction"),r;if(r=this.createBundleOnEasilyFoundResultWithReturnData(e.contractResults),r)return Xi.Logger.trace("parseUntypedOutcome(): on easily found result with return data"),r;if(r=this.createBundleOnSignalError(e.logs),r)return Xi.Logger.trace("parseUntypedOutcome(): on signal error"),r;if(r=this.createBundleOnTooMuchGasWarning(e.logs),r)return Xi.Logger.trace("parseUntypedOutcome(): on 'too much gas' warning"),r;if(r=this.createBundleOnWriteLogWhereFirstTopicEqualsAddress(e.logs,e.sender),r)return Xi.Logger.trace("parseUntypedOutcome(): on writelog with topics[0] == tx.sender"),r;if(r=this.createBundleWithCustomHeuristics(e,n),r)return Xi.Logger.trace("parseUntypedOutcome(): with custom heuristics"),r;if(r=this.createBundleWithFallbackHeuristics(e,n),r)return Xi.Logger.trace("parseUntypedOutcome(): with fallback heuristics"),r;throw new aB.ErrCannotParseContractResults(`transaction ${e.hash.toString()}`)}parseTransactionMetadata(e){return new dZ.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:Za.ReturnCode.None,returnMessage:Za.ReturnCode.None.toString(),values:[]}:null}createBundleOnInvalidTransaction(e){return e.status.isInvalid()&&e.receipt.data?{returnCode:Za.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(eu.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(eu.OnWriteLog,a=>a.findFirstOrNoneTopic(u=>u.toString().startsWith(Qb.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 oB.Address(r.bech32()).hex(),i=e.findSingleOrNoneEvent(eu.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 oB.Address(r.receiver);for(let i of e.contractResults.items){let s=i.logs.findSingleOrNoneEvent(eu.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 aB.ErrCannotParseContractResults("no return code");return{returnCode:Za.ReturnCode.fromBuffer(i),returnDataParts:s}}};Vg.ResultsParser=Wb});var $b=m(At=>{"use strict";c();var yZ=At&&At.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ir=At&&At.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&yZ(e,t,r)};Object.defineProperty(At,"__esModule",{value:!0});ir(Wo(),At);ir(J8(),At);ir(pw(),At);ir(cE(),At);ir(wc(),At);ir(wE(),At);ir(dE(),At);ir(Z8(),At);ir(AE(),At);ir(Ec(),At);ir(uB(),At);ir(jb(),At);ir(fv(),At);ir(xE(),At);ir(St(),At)});var lB=m(Hg=>{"use strict";c();Object.defineProperty(Hg,"__esModule",{value:!0});Hg.RelayedTransactionV2Builder=void 0;var cB=Be(),Tl=$b(),mZ=wn(),wZ=jn(),zb=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 cB.ErrInvalidRelayedV2BuilderArguments;if(this.innerTransaction.getGasLimit()!=0)throw new cB.ErrGasLimitShouldBe0ForInnerTransaction;let{argumentsString:e}=new Tl.ArgSerializer().valuesToString([new Tl.AddressValue(this.innerTransaction.getReceiver()),new Tl.U64Value(this.innerTransaction.getNonce().valueOf()),new Tl.BytesValue(this.innerTransaction.getData().valueOf()),new Tl.BytesValue(this.innerTransaction.getSignature())]),r=`relayedTxV2@${e}`,n=new wZ.TransactionPayload(r),i=new mZ.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}};Hg.RelayedTransactionV2Builder=zb});var fB=m(so=>{"use strict";c();Object.defineProperty(so,"__esModule",{value:!0});so.SignableMessage=so.MESSAGE_PREFIX=void 0;var EZ=ht(),vZ=av();so.MESSAGE_PREFIX=`Elrond Signed Message: +`;var Kb=class{constructor(e){this.message=h.Buffer.from([]),this.signature=h.Buffer.from([]),this.version=1,this.signer="ErdJS",this.address=new EZ.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(so.MESSAGE_PREFIX),r]);return vZ("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}}};so.SignableMessage=Kb});var Jb=m(at=>{"use strict";c();var AZ=at&&at.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),bZ=at&&at.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hB=at&&at.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&AZ(e,t,r);return bZ(e,t),e},_Z=at&&at.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(at,"__esModule",{value:!0});at.addressToHex=at.bufferToHex=at.utf8ToHex=at.bigIntToHex=at.bigIntToBuffer=at.bufferToBigInt=at.stringToBuffer=void 0;var IZ=_Z(Gt()),SZ=ht(),Yb=hB(ac()),dB=hB(ph());function TZ(t){return h.Buffer.from(t)}at.stringToBuffer=TZ;function CZ(t){return t.length==0?new IZ.default(0):Yb.bufferToBigInt(t)}at.bufferToBigInt=CZ;function xZ(t){return t==0?h.Buffer.from([]):Yb.bigIntToBuffer(t)}at.bigIntToBuffer=xZ;function NZ(t){return t==0?"":Yb.getHexMagnitudeOfBigInt(t)}at.bigIntToHex=NZ;function OZ(t){let e=h.Buffer.from(t).toString("hex");return dB.zeroPadStringIfOddLength(e)}at.utf8ToHex=OZ;function DZ(t){let e=t.toString("hex");return dB.zeroPadStringIfOddLength(e)}at.bufferToHex=DZ;function PZ(t){return SZ.Address.fromBech32(t.toString()).pubkey().toString("hex")}at.addressToHex=PZ});var gB=m(Gg=>{"use strict";c();Object.defineProperty(Gg,"__esModule",{value:!0});Gg.TokenOperationsFactory=void 0;var Xb=bs(),RZ=na(),pB=cc(),BZ=wn(),LZ=jn(),ne=Jb(),Zb=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(){RZ.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 z6.TransactionVersion(qb.TRANSACTION_VERSION_DEFAULT),g=new z6.TransactionOptions(qb.TRANSACTION_OPTIONS_DEFAULT);return new rZ.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(qb.ARGUMENTS_SEPARATOR);return new nZ.TransactionPayload(r)}computeGasLimit(e,r){return this.config.minGasLimit.valueOf()+this.config.gasLimitPerByte.valueOf()*e.length()+r.valueOf()}};Pg.TokenOperationsFactory=Vb});var K6=m(Rg=>{"use strict";c();Object.defineProperty(Rg,"__esModule",{value:!0});Rg.TokenOperationsFactoryConfig=void 0;var iZ=ht(),Hb=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=iZ.Address.fromBech32("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u"),this.chainID=e}};Rg.TokenOperationsFactoryConfig=Hb});var J6=m(Bg=>{"use strict";c();Object.defineProperty(Bg,"__esModule",{value:!0});Bg.TokenOperationsOutcomeParser=void 0;var sZ=ht(),Gb=Be(),Y6=Ub(),jb=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 Gb.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 Gb.ErrCannotParseTransactionOutcome(e.hash,`cannot find event of type ${r}`);if(n.length>1)throw new Gb.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 Y6.bufferToBigInt((r=e.topics[1])===null||r===void 0?void 0:r.valueOf()).toFixed(0)}extractAmount(e){var r;return Y6.bufferToBigInt((r=e.topics[2])===null||r===void 0?void 0:r.valueOf()).toFixed(0)}extractAddress(e){var r;return sZ.Address.fromBuffer((r=e.topics[3])===null||r===void 0?void 0:r.valueOf()).toString()}};Bg.TokenOperationsOutcomeParser=jb});var X6=m(si=>{"use strict";c();var oZ=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]}),kb=si&&si.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&oZ(e,t,r)};Object.defineProperty(si,"__esModule",{value:!0});kb($6(),si);kb(K6(),si);kb(J6(),si)});var Z6=m(Ze=>{"use strict";c();var aZ=Ze&&Ze.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Tt=Ze&&Ze.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&aZ(e,t,r)};Object.defineProperty(Ze,"__esModule",{value:!0});I6();Tt(Yo(),Ze);Tt(ht(),Ze);Tt(Kw(),Ze);Tt(Be(),Ze);Tt(Qw(),Ze);Tt(T6(),Ze);Tt(x6(),Ze);Tt(Jo(),Ze);Tt(oc(),Ze);Tt(N6(),Ze);Tt(j6(),Ze);Tt(k6(),Ze);Tt(Bb(),Ze);Tt(X6(),Ze);Tt(um(),Ze);Tt(mn(),Ze);Tt(qn(),Ze);Tt(Wh(),Ze);Tt(jw(),Ze);Tt(gr(),Ze)});var sB=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 rB=Z6(),eB=Fh(),uZ=ol(),Lg=wb(),oi=Ab(),Qb=_b(),tB=Ig();function nB(t,e){if(!e)throw new Error(oi.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=e.find(iB(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 Qb.Logger.error(oi.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),new Error(oi.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected)}Xt.getCurrentSession=nB;function cZ(t,e){if(!e)throw new Error(oi.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=nB(t,e);if(!r?.topic)throw new Error(oi.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);return r.topic}Xt.getCurrentTopic=cZ;function iB(t,e){var r,n,i;let s=[...Lg.WALLETCONNECT_MULTIVERSX_METHODS,...(r=e?.methods)!==null&&r!==void 0?r:[]];!((n=e?.methods)===null||n===void 0)&&n.includes(tB.OptionalOperation.SIGN_LOGIN_TOKEN)||s.push(tB.OptionalOperation.SIGN_LOGIN_TOKEN);let o=[`${Lg.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${t}`],a=(i=e?.events)!==null&&i!==void 0?i:[];return{requiredNamespaces:{[Lg.WALLETCONNECT_MULTIVERSX_NAMESPACE]:{methods:s,chains:o,events:a}}}}Xt.getConnectionParams=iB;function lZ(t){try{return!rB.Address.fromBech32(t).isEmpty()}catch{return!1}}Xt.addressIsValid=lZ;function fZ(t){let e=t.namespaces[Lg.WALLETCONNECT_MULTIVERSX_NAMESPACE];if(e&&e.accounts){let r=e.accounts[0],[n,i,s]=r.split(":");return s}return""}Xt.getAddressFromSession=fZ;function hZ({transaction:t,response:e}){if(!e)throw Qb.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 Qb.Logger.error(oi.WalletConnectV2ProviderErrorMessagesEnum.invalidGuardian),new Error(oi.WalletConnectV2ProviderErrorMessagesEnum.invalidGuardian);return o&&t.setGuardian(rB.Address.fromBech32(o)),i&&t.setVersion(i),s!=null&&t.setOptions(s),t.applySignature(new eB.Signature(r)),n&&t.applyGuardianSignature(new eB.Signature(n)),t}Xt.applyTransactionSignature=hZ;function dZ(t){if(t)return Object.assign(Object.assign({},t),{url:uZ.getAppMetadata().url})}Xt.getMetadata=dZ});var bl=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())})},pZ=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 gZ=Fh(),yZ=pZ(b6()),Wb=ol(),Xa=wb(),ye=Ab();Object.defineProperty(dr,"WalletConnectV2ProviderErrorMessagesEnum",{enumerable:!0,get:function(){return ye.WalletConnectV2ProviderErrorMessagesEnum}});var Le=_b(),Ki=Ig();Object.defineProperty(dr,"Operation",{enumerable:!0,get:function(){return Ki.Operation}});Object.defineProperty(dr,"OptionalOperation",{enumerable:!0,get:function(){return Ki.OptionalOperation}});var Zt=sB(),zb=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 yZ.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[Xa.WALLETCONNECT_MULTIVERSX_NAMESPACE].methods.includes(Ki.OptionalOperation.SIGN_NATIVE_AUTH_TOKEN)?Ki.OptionalOperation.SIGN_NATIVE_AUTH_TOKEN:Ki.OptionalOperation.SIGN_LOGIN_TOKEN,{signature:a}=yield this.walletConnector.request({chainId:`${Xa.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:Wb.getSdkError("USER_DISCONNECTED")});else{let r=Zt.getCurrentTopic(this.chainId,this.walletConnector);this.processingTopic=r,yield this.walletConnector.disconnect({topic:r,reason:Wb.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:`${Xa.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:Zt.getCurrentTopic(this.chainId,this.walletConnector),request:{method:Ki.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 gZ.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:`${Xa.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:Zt.getCurrentTopic(this.chainId,this.walletConnector),request:{method:Ki.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:`${Xa.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:Zt.getCurrentTopic(this.chainId,this.walletConnector),request:{method:Ki.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:`${Xa.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(!Wb.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=zb});var aB=m((jge,oB)=>{"use strict";c();oB.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 lB=m((Qge,cB)=>{"use strict";c();var uB=typeof Symbol<"u"&&Symbol,mZ=aB();cB.exports=function(){return typeof uB!="function"||typeof Symbol!="function"||typeof uB("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:mZ()}});var dB=m((zge,hB)=>{"use strict";c();var fB={foo:{}},wZ=Object;hB.exports=function(){return{__proto__:fB}.foo===fB.foo&&!({__proto__:null}instanceof wZ)}});var gB=m((Kge,pB)=>{"use strict";c();var EZ="Function.prototype.bind called on incompatible ",$b=Array.prototype.slice,vZ=Object.prototype.toString,AZ="[object Function]";pB.exports=function(e){var r=this;if(typeof r!="function"||vZ.call(r)!==AZ)throw new TypeError(EZ+r);for(var n=$b.call(arguments,1),i,s=function(){if(this instanceof i){var f=r.apply(this,n.concat($b.call(arguments)));return Object(f)===f?f:this}else return r.apply(e,n.concat($b.call(arguments)))},o=Math.max(0,r.length-n.length),a=[],u=0;u{"use strict";c();var bZ=gB();yB.exports=Function.prototype.bind||bZ});var wB=m((Zge,mB)=>{"use strict";c();var _Z=Fg();mB.exports=_Z.call(Function.call,Object.prototype.hasOwnProperty)});var qg=m((tye,_B)=>{"use strict";c();var De,ru=SyntaxError,bB=Function,tu=TypeError,Kb=function(t){try{return bB('"use strict"; return ('+t+").constructor;")()}catch{}},Zs=Object.getOwnPropertyDescriptor;if(Zs)try{Zs({},"")}catch{Zs=null}var Yb=function(){throw new tu},IZ=Zs?function(){try{return arguments.callee,Yb}catch{try{return Zs(arguments,"callee").get}catch{return Yb}}}():Yb,Za=lB()(),SZ=dB()(),Mt=Object.getPrototypeOf||(SZ?function(t){return t.__proto__}:null),eu={},TZ=typeof Uint8Array>"u"||!Mt?De:Mt(Uint8Array),eo={"%AggregateError%":typeof AggregateError>"u"?De:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?De:ArrayBuffer,"%ArrayIteratorPrototype%":Za&&Mt?Mt([][Symbol.iterator]()):De,"%AsyncFromSyncIteratorPrototype%":De,"%AsyncFunction%":eu,"%AsyncGenerator%":eu,"%AsyncGeneratorFunction%":eu,"%AsyncIteratorPrototype%":eu,"%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%":bB,"%GeneratorFunction%":eu,"%Int8Array%":typeof Int8Array>"u"?De:Int8Array,"%Int16Array%":typeof Int16Array>"u"?De:Int16Array,"%Int32Array%":typeof Int32Array>"u"?De:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Za&&Mt?Mt(Mt([][Symbol.iterator]())):De,"%JSON%":typeof JSON=="object"?JSON:De,"%Map%":typeof Map>"u"?De:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Za||!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"||!Za||!Mt?De:Mt(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?De:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Za&&Mt?Mt(""[Symbol.iterator]()):De,"%Symbol%":Za?Symbol:De,"%SyntaxError%":ru,"%ThrowTypeError%":IZ,"%TypedArray%":TZ,"%TypeError%":tu,"%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){EB=Mt(Mt(t)),eo["%Error.prototype%"]=EB}var EB,CZ=function t(e){var r;if(e==="%AsyncFunction%")r=Kb("async function () {}");else if(e==="%GeneratorFunction%")r=Kb("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=Kb("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 eo[e]=r,r},vB={"%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"]},_l=Fg(),Mg=wB(),xZ=_l.call(Function.call,Array.prototype.concat),NZ=_l.call(Function.apply,Array.prototype.splice),AB=_l.call(Function.call,String.prototype.replace),Ug=_l.call(Function.call,String.prototype.slice),OZ=_l.call(Function.call,RegExp.prototype.exec),DZ=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,PZ=/\\(\\)?/g,RZ=function(e){var r=Ug(e,0,1),n=Ug(e,-1);if(r==="%"&&n!=="%")throw new ru("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new ru("invalid intrinsic syntax, expected opening `%`");var i=[];return AB(e,DZ,function(s,o,a,u){i[i.length]=a?AB(u,PZ,"$1"):o||s}),i},BZ=function(e,r){var n=e,i;if(Mg(vB,n)&&(i=vB[n],n="%"+i[0]+"%"),Mg(eo,n)){var s=eo[n];if(s===eu&&(s=CZ(n)),typeof s>"u"&&!r)throw new tu("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:s}}throw new ru("intrinsic "+e+" does not exist!")};_B.exports=function(e,r){if(typeof e!="string"||e.length===0)throw new tu("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new tu('"allowMissing" argument must be a boolean');if(OZ(/^%?[^%]*%?$/,e)===null)throw new ru("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=RZ(e),i=n.length>0?n[0]:"",s=BZ("%"+i+"%",r),o=s.name,a=s.value,u=!1,l=s.alias;l&&(i=l[0],NZ(n,xZ([0,1],l)));for(var f=1,d=!0;f=n.length){var x=Zs(a,g);d=!!x,d&&"get"in x&&!("originalValue"in x.get)?a=x.get:a=a[g]}else d=Mg(a,g),a=a[g];d&&!u&&(eo[o]=a)}}return a}});var NB=m((nye,Vg)=>{"use strict";c();var Jb=Fg(),nu=qg(),TB=nu("%Function.prototype.apply%"),CB=nu("%Function.prototype.call%"),xB=nu("%Reflect.apply%",!0)||Jb.call(CB,TB),IB=nu("%Object.getOwnPropertyDescriptor%",!0),to=nu("%Object.defineProperty%",!0),LZ=nu("%Math.max%");if(to)try{to({},"a",{value:1})}catch{to=null}Vg.exports=function(e){var r=xB(Jb,CB,arguments);if(IB&&to){var n=IB(r,"length");n.configurable&&to(r,"length",{value:1+LZ(0,e.length-(arguments.length-1))})}return r};var SB=function(){return xB(Jb,TB,arguments)};to?to(Vg.exports,"apply",{value:SB}):Vg.exports.apply=SB});var RB=m((sye,PB)=>{"use strict";c();var OB=qg(),DB=NB(),FZ=DB(OB("String.prototype.indexOf"));PB.exports=function(e,r){var n=OB(e,!!r);return typeof n=="function"&&FZ(e,".prototype.")>-1?DB(n):n}});var BB=m(()=>{c()});var eL=m((lye,ZB)=>{c();var a_=typeof Map=="function"&&Map.prototype,Xb=Object.getOwnPropertyDescriptor&&a_?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Gg=a_&&Xb&&typeof Xb.get=="function"?Xb.get:null,LB=a_&&Map.prototype.forEach,u_=typeof Set=="function"&&Set.prototype,Zb=Object.getOwnPropertyDescriptor&&u_?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,jg=u_&&Zb&&typeof Zb.get=="function"?Zb.get:null,FB=u_&&Set.prototype.forEach,MZ=typeof WeakMap=="function"&&WeakMap.prototype,Sl=MZ?WeakMap.prototype.has:null,UZ=typeof WeakSet=="function"&&WeakSet.prototype,Tl=UZ?WeakSet.prototype.has:null,qZ=typeof WeakRef=="function"&&WeakRef.prototype,MB=qZ?WeakRef.prototype.deref:null,VZ=Boolean.prototype.valueOf,HZ=Object.prototype.toString,GZ=Function.prototype.toString,jZ=String.prototype.match,c_=String.prototype.slice,Ji=String.prototype.replace,kZ=String.prototype.toUpperCase,UB=String.prototype.toLowerCase,zB=RegExp.prototype.test,qB=Array.prototype.concat,Nn=Array.prototype.join,QZ=Array.prototype.slice,VB=Math.floor,r_=typeof BigInt=="function"?BigInt.prototype.valueOf:null,e_=Object.getOwnPropertySymbols,n_=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,iu=typeof Symbol=="function"&&typeof Symbol.iterator=="object",er=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===iu||"symbol")?Symbol.toStringTag:null,$B=Object.prototype.propertyIsEnumerable,HB=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function GB(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||zB.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var n=t<0?-VB(-t):VB(t);if(n!==t){var i=String(n),s=c_.call(e,i.length+1);return Ji.call(i,r,"$&_")+"."+Ji.call(Ji.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Ji.call(e,r,"$&_")}var i_=BB(),jB=i_.custom,kB=YB(jB)?jB:null;ZB.exports=function t(e,r,n,i){var s=r||{};if(Yi(s,"quoteStyle")&&s.quoteStyle!=="single"&&s.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Yi(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=Yi(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(Yi(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(Yi(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 XB(e,s);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var u=String(e);return a?GB(e,u):u}if(typeof e=="bigint"){var l=String(e)+"n";return a?GB(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 s_(e)?"[Array]":"[Object]";var d=cee(s,n);if(typeof i>"u")i=[];else if(JB(i,e)>=0)return"[Circular]";function g(j,K,de){if(K&&(i=QZ.call(i),i.push(K)),de){var ue={depth:s.depth};return Yi(s,"quoteStyle")&&(ue.quoteStyle=s.quoteStyle),t(j,ue,n+1,i)}return t(j,s,n+1,i)}if(typeof e=="function"&&!QB(e)){var w=eee(e),E=Hg(e,g);return"[Function"+(w?": "+w:" (anonymous)")+"]"+(E.length>0?" { "+Nn.call(E,", ")+" }":"")}if(YB(e)){var x=iu?Ji.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):n_.call(e);return typeof e=="object"&&!iu?Il(x):x}if(oee(e)){for(var O="<"+UB.call(String(e.nodeName)),F=e.attributes||[],_=0;_",O}if(s_(e)){if(e.length===0)return"[]";var I=Hg(e,g);return d&&!uee(I)?"["+o_(I,d)+"]":"[ "+Nn.call(I,", ")+" ]"}if($Z(e)){var S=Hg(e,g);return!("cause"in Error.prototype)&&"cause"in e&&!$B.call(e,"cause")?"{ ["+String(e)+"] "+Nn.call(qB.call("[cause]: "+g(e.cause),S),", ")+" }":S.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+Nn.call(S,", ")+" }"}if(typeof e=="object"&&o){if(kB&&typeof e[kB]=="function"&&i_)return i_(e,{depth:f-n});if(o!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(tee(e)){var R=[];return LB&&LB.call(e,function(j,K){R.push(g(K,e,!0)+" => "+g(j,e))}),WB("Map",Gg.call(e),R,d)}if(iee(e)){var B=[];return FB&&FB.call(e,function(j){B.push(g(j,e))}),WB("Set",jg.call(e),B,d)}if(ree(e))return t_("WeakMap");if(see(e))return t_("WeakSet");if(nee(e))return t_("WeakRef");if(YZ(e))return Il(g(Number(e)));if(XZ(e))return Il(g(r_.call(e)));if(JZ(e))return Il(VZ.call(e));if(KZ(e))return Il(g(String(e)));if(!zZ(e)&&!QB(e)){var b=Hg(e,g),T=HB?HB(e)===Object.prototype:e instanceof Object||e.constructor===Object,L=e instanceof Object?"":"null prototype",X=!T&&er&&Object(e)===e&&er in e?c_.call(Xi(e),8,-1):L?"Object":"",W=T||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",G=W+(X||L?"["+Nn.call(qB.call([],X||[],L||[]),": ")+"] ":"");return b.length===0?G+"{}":d?G+"{"+o_(b,d)+"}":G+"{ "+Nn.call(b,", ")+" }"}return String(e)};function KB(t,e,r){var n=(r.quoteStyle||e)==="double"?'"':"'";return n+t+n}function WZ(t){return Ji.call(String(t),/"/g,""")}function s_(t){return Xi(t)==="[object Array]"&&(!er||!(typeof t=="object"&&er in t))}function zZ(t){return Xi(t)==="[object Date]"&&(!er||!(typeof t=="object"&&er in t))}function QB(t){return Xi(t)==="[object RegExp]"&&(!er||!(typeof t=="object"&&er in t))}function $Z(t){return Xi(t)==="[object Error]"&&(!er||!(typeof t=="object"&&er in t))}function KZ(t){return Xi(t)==="[object String]"&&(!er||!(typeof t=="object"&&er in t))}function YZ(t){return Xi(t)==="[object Number]"&&(!er||!(typeof t=="object"&&er in t))}function JZ(t){return Xi(t)==="[object Boolean]"&&(!er||!(typeof t=="object"&&er in t))}function YB(t){if(iu)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!n_)return!1;try{return n_.call(t),!0}catch{}return!1}function XZ(t){if(!t||typeof t!="object"||!r_)return!1;try{return r_.call(t),!0}catch{}return!1}var ZZ=Object.prototype.hasOwnProperty||function(t){return t in this};function Yi(t,e){return ZZ.call(t,e)}function Xi(t){return HZ.call(t)}function eee(t){if(t.name)return t.name;var e=jZ.call(GZ.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function JB(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 XB(c_.call(t,0,e.maxStringLength),e)+n}var i=Ji.call(Ji.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,aee);return KB(i,"single",e)}function aee(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":"")+kZ.call(e.toString(16))}function Il(t){return"Object("+t+")"}function t_(t){return t+" { ? }"}function WB(t,e,r,n){var i=n?o_(r,n):Nn.call(r,", ");return t+" ("+e+") {"+i+"}"}function uee(t){for(var e=0;e=0)return!1;return!0}function cee(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 o_(t,e){if(t.length===0)return"";var r=` -`+e.prev+e.base;return r+Nn.call(t,","+r)+` -`+e.prev}function Hg(t,e){var r=s_(t),n=[];if(r){n.length=t.length;for(var i=0;i{"use strict";c();var l_=qg(),su=RB(),lee=eL(),fee=l_("%TypeError%"),kg=l_("%WeakMap%",!0),Qg=l_("%Map%",!0),hee=su("WeakMap.prototype.get",!0),dee=su("WeakMap.prototype.set",!0),pee=su("WeakMap.prototype.has",!0),gee=su("Map.prototype.get",!0),yee=su("Map.prototype.set",!0),mee=su("Map.prototype.has",!0),f_=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},wee=function(t,e){var r=f_(t,e);return r&&r.value},Eee=function(t,e,r){var n=f_(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}},vee=function(t,e){return!!f_(t,e)};tL.exports=function(){var e,r,n,i={assert:function(s){if(!i.has(s))throw new fee("Side channel does not contain "+lee(s))},get:function(s){if(kg&&s&&(typeof s=="object"||typeof s=="function")){if(e)return hee(e,s)}else if(Qg){if(r)return gee(r,s)}else if(n)return wee(n,s)},has:function(s){if(kg&&s&&(typeof s=="object"||typeof s=="function")){if(e)return pee(e,s)}else if(Qg){if(r)return mee(r,s)}else if(n)return vee(n,s);return!1},set:function(s,o){kg&&s&&(typeof s=="object"||typeof s=="function")?(e||(e=new kg),dee(e,s,o)):Qg?(r||(r=new Qg),yee(r,s,o)):(n||(n={key:{},next:null}),Eee(n,s,o))}};return i}});var Wg=m((pye,nL)=>{"use strict";c();var Aee=String.prototype.replace,bee=/%20/g,h_={RFC1738:"RFC1738",RFC3986:"RFC3986"};nL.exports={default:h_.RFC3986,formatters:{RFC1738:function(t){return Aee.call(t,bee,"+")},RFC3986:function(t){return String(t)}},RFC1738:h_.RFC1738,RFC3986:h_.RFC3986}});var p_=m((yye,sL)=>{"use strict";c();var _ee=Wg(),d_=Object.prototype.hasOwnProperty,ro=Array.isArray,On=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),Iee=function(e){for(;e.length>1;){var r=e.pop(),n=r.obj[r.prop];if(ro(n)){for(var i=[],s=0;s=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122||s===_ee.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},Nee=function(e){for(var r=[{obj:{o:e},prop:"o"}],n=[],i=0;i{"use strict";c();var uL=rL(),y_=p_(),Cl=Wg(),Bee=Object.prototype.hasOwnProperty,oL={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,r){return e+"["+r+"]"},repeat:function(e){return e}},no=Array.isArray,Lee=String.prototype.split,Fee=Array.prototype.push,cL=function(t,e){Fee.apply(t,no(e)?e:[e])},Mee=Date.prototype.toISOString,aL=Cl.default,kt={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:y_.encode,encodeValuesOnly:!1,format:aL,formatter:Cl.formatters[aL],indices:!1,serializeDate:function(e){return Mee.call(e)},skipNulls:!1,strictNullHandling:!1},Uee=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},g_={},qee=function t(e,r,n,i,s,o,a,u,l,f,d,g,w,E,x){for(var O=e,F=x,_=0,I=!1;(F=F.get(g_))!==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(g_)>"u"&&(_=0)}if(typeof a=="function"?O=a(r,O):O instanceof Date?O=f(O):n==="comma"&&no(O)&&(O=y_.maybeMap(O,function(re){return re instanceof Date?f(re):re})),O===null){if(i)return o&&!w?o(r,kt.encoder,E,"key",d):r;O=""}if(Uee(O)||y_.isBuffer(O)){if(o){var R=w?r:o(r,kt.encoder,E,"key",d);if(n==="comma"&&w){for(var B=Lee.call(String(O),","),b="",T=0;T"u")return L;var X;if(n==="comma"&&no(O))X=[{value:O.length>0?O.join(",")||null:void 0}];else if(no(a))X=a;else{var W=Object.keys(O);X=u?W.sort(u):W}for(var G=0;G"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}};lL.exports=function(t,e){var r=t,n=Vee(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 oL?a=e.arrayFormat:e&&"indices"in e?a=e.indices?"indices":"repeat":a="indices";var u=oL[a];i||(i=Object.keys(r)),n.sort&&i.sort(n.sort);for(var l=uL(),f=0;f0?w+g:""}});var pL=m((vye,dL)=>{"use strict";c();var ou=p_(),m_=Object.prototype.hasOwnProperty,Hee=Array.isArray,Ut={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:ou.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},Gee=function(t){return t.replace(/&#(\d+);/g,function(e,r){return String.fromCharCode(parseInt(r,10))})},hL=function(t,e){return t&&typeof t=="string"&&e.comma&&t.indexOf(",")>-1?t.split(","):t},jee="utf8=%26%2310003%3B",kee="utf8=%E2%9C%93",Qee=function(e,r){var n={},i=r.ignoreQueryPrefix?e.replace(/^\?/,""):e,s=r.parameterLimit===1/0?void 0:r.parameterLimit,o=i.split(r.delimiter,s),a=-1,u,l=r.charset;if(r.charsetSentinel)for(u=0;u-1&&(E=Hee(E)?[E]:E),m_.call(n,w)?n[w]=ou.combine(n[w],E):n[w]=E}return n},Wee=function(t,e,r,n){for(var i=n?e:hL(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},zee=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&&m_.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"||ou.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}};dL.exports=function(t,e){var r=$ee(e);if(t===""||t===null||typeof t>"u")return r.plainObjects?Object.create(null):{};for(var n=typeof t=="string"?Qee(t,r):t,i=r.plainObjects?Object.create(null):{},s=Object.keys(n),o=0;o{"use strict";c();var Kee=fL(),Yee=pL(),Jee=Wg();gL.exports={formats:Jee,parse:Yee,stringify:Kee}});var w_=m(ut=>{"use strict";c();Object.defineProperty(ut,"__esModule",{value:!0});ut.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED=ut.WALLET_PROVIDER_CALLBACK_PARAM=ut.WALLET_PROVIDER_SIGN_MESSAGE_URL=ut.WALLET_PROVIDER_GUARD_TRANSACTION_URL=ut.WALLET_PROVIDER_SIGN_TRANSACTION_URL=ut.WALLET_PROVIDER_SEND_TRANSACTION_URL=ut.WALLET_PROVIDER_DISCONNECT_URL=ut.WALLET_PROVIDER_CONNECT_URL=ut.WALLET_PROVIDER_TESTNET=ut.WALLET_PROVIDER_DEVNET=ut.WALLET_PROVIDER_MAINNET=void 0;ut.WALLET_PROVIDER_MAINNET="https://wallet.multiversx.com/dapp/init";ut.WALLET_PROVIDER_DEVNET="https://devnet-wallet.multiversx.com/dapp/init";ut.WALLET_PROVIDER_TESTNET="https://testnet-wallet.multiversx.com/dapp/init";ut.WALLET_PROVIDER_CONNECT_URL="hook/login";ut.WALLET_PROVIDER_DISCONNECT_URL="hook/logout";ut.WALLET_PROVIDER_SEND_TRANSACTION_URL="hook/transaction";ut.WALLET_PROVIDER_SIGN_TRANSACTION_URL="hook/sign";ut.WALLET_PROVIDER_GUARD_TRANSACTION_URL="hook/2fa";ut.WALLET_PROVIDER_SIGN_MESSAGE_URL="hook/sign-message";ut.WALLET_PROVIDER_CALLBACK_PARAM="walletProviderStatus";ut.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED="transactionsSigned"});var mL=m(au=>{"use strict";c();Object.defineProperty(au,"__esModule",{value:!0});au.ErrCannotSignedMessage=au.ErrCannotGetSignedTransactions=void 0;var E_=class extends Error{constructor(){super("Cannot get signed transaction(s)")}};au.ErrCannotGetSignedTransactions=E_;var v_=class extends Error{constructor(){super("Cannot get signed message")}};au.ErrCannotSignedMessage=v_});var wL=m(zg=>{"use strict";c();Object.defineProperty(zg,"__esModule",{value:!0});zg.PlainSignedTransaction=void 0;var A_=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)}};zg.PlainSignedTransaction=A_});var xl=m(ts=>{"use strict";c();var Zi=ts&&ts.__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())})},Xee=ts&&ts.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ts,"__esModule",{value:!0});ts.WalletProvider=void 0;var b_=Xee(yL()),es=w_(),__=mL(),Zee=wL(),I_=class t{constructor(e){this.walletUrl=e}login(e){return Zi(this,void 0,void 0,function*(){let r=this.buildWalletUrl({endpoint:es.WALLET_PROVIDER_CONNECT_URL,callbackUrl:e?.callbackUrl,params:{token:e?.token}});return yield this.redirect(r,e?.redirectDelayMilliseconds),r})}redirect(e,r){return Zi(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 Zi(this,void 0,void 0,function*(){yield new Promise(n=>{setTimeout(()=>{window.location.href=e,n(!0)},r)})})}logout(e){return Zi(this,void 0,void 0,function*(){let r=this.buildWalletUrl({endpoint:es.WALLET_PROVIDER_DISCONNECT_URL,callbackUrl:e?.callbackUrl});return yield this.redirect(r,e?.redirectDelayMilliseconds),!0})}signMessage(e,r){return Zi(this,void 0,void 0,function*(){let n=this.buildWalletUrl({endpoint:es.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=b_.default.parse(n);if((((e=i.status)===null||e===void 0?void 0:e.toString())||"")!=="signed")throw new __.ErrCannotSignedMessage;return((r=i.signature)===null||r===void 0?void 0:r.toString())||""}guardTransactions(e,r){return Zi(this,void 0,void 0,function*(){this.redirectTransactionsToEndpoint(es.WALLET_PROVIDER_GUARD_TRANSACTION_URL,e,r)})}signTransactions(e,r){return Zi(this,void 0,void 0,function*(){this.redirectTransactionsToEndpoint(es.WALLET_PROVIDER_SIGN_TRANSACTION_URL,e,r)})}signTransaction(e,r){return Zi(this,void 0,void 0,function*(){yield this.signTransactions([e],r)})}getTransactionsFromWalletUrl(){let e=b_.default.parse(window.location.search.slice(1));return t.isTxSignReturnSuccess(e)?this.getTxSignReturnValue(e):[]}static isTxSignReturnSuccess(e){return e.hasOwnProperty(es.WALLET_PROVIDER_CALLBACK_PARAM)&&e[es.WALLET_PROVIDER_CALLBACK_PARAM]===es.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 __.ErrCannotGetSignedTransactions;let i=e.nonce.length;for(let o of n)if(e[o].length!==i)throw new __.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}};ts.WalletProvider=I_});var S_=m((Pye,EL)=>{"use strict";c();EL.exports=function(e,r){return function(){for(var i=new Array(arguments.length),s=0;s{"use strict";c();var ete=S_(),io=Object.prototype.toString;function x_(t){return io.call(t)==="[object Array]"}function T_(t){return typeof t>"u"}function tte(t){return t!==null&&!T_(t)&&t.constructor!==null&&!T_(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function rte(t){return io.call(t)==="[object ArrayBuffer]"}function nte(t){return typeof FormData<"u"&&t instanceof FormData}function ite(t){var e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&t.buffer instanceof ArrayBuffer,e}function ste(t){return typeof t=="string"}function ote(t){return typeof t=="number"}function vL(t){return t!==null&&typeof t=="object"}function $g(t){if(io.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function ate(t){return io.call(t)==="[object Date]"}function ute(t){return io.call(t)==="[object File]"}function cte(t){return io.call(t)==="[object Blob]"}function AL(t){return io.call(t)==="[object Function]"}function lte(t){return vL(t)&&AL(t.pipe)}function fte(t){return typeof URLSearchParams<"u"&&t instanceof URLSearchParams}function hte(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function dte(){return typeof navigator<"u"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window<"u"&&typeof document<"u"}function N_(t,e){if(!(t===null||typeof t>"u"))if(typeof t!="object"&&(t=[t]),x_(t))for(var r=0,n=t.length;r{"use strict";c();var uu=pr();function _L(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}IL.exports=function(e,r,n){if(!r)return e;var i;if(n)i=n(r);else if(uu.isURLSearchParams(r))i=r.toString();else{var s=[];uu.forEach(r,function(u,l){u===null||typeof u>"u"||(uu.isArray(u)?l=l+"[]":u=[u],uu.forEach(u,function(d){uu.isDate(d)?d=d.toISOString():uu.isObject(d)&&(d=JSON.stringify(d)),s.push(_L(l)+"="+_L(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 TL=m((Uye,SL)=>{"use strict";c();var yte=pr();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){yte.forEach(this.handlers,function(n){n!==null&&e(n)})};SL.exports=Kg});var xL=m((Vye,CL)=>{"use strict";c();var mte=pr();CL.exports=function(e,r){mte.forEach(e,function(i,s){s!==r&&s.toUpperCase()===r.toUpperCase()&&(e[r]=i,delete e[s])})}});var D_=m((Gye,NL)=>{"use strict";c();NL.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 P_=m((kye,OL)=>{"use strict";c();var wte=D_();OL.exports=function(e,r,n,i,s){var o=new Error(e);return wte(o,r,n,i,s)}});var PL=m((Wye,DL)=>{"use strict";c();var Ete=P_();DL.exports=function(e,r,n){var i=n.config.validateStatus;!n.status||!i||i(n.status)?e(n):r(Ete("Request failed with status code "+n.status,n.config,null,n.request,n))}});var BL=m(($ye,RL)=>{"use strict";c();var Yg=pr();RL.exports=Yg.isStandardBrowserEnv()?function(){return{write:function(r,n,i,s,o,a){var u=[];u.push(r+"="+encodeURIComponent(n)),Yg.isNumber(i)&&u.push("expires="+new Date(i).toGMTString()),Yg.isString(s)&&u.push("path="+s),Yg.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 FL=m((Yye,LL)=>{"use strict";c();LL.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}});var UL=m((Xye,ML)=>{"use strict";c();ML.exports=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e}});var VL=m((e0e,qL)=>{"use strict";c();var vte=FL(),Ate=UL();qL.exports=function(e,r){return e&&!vte(r)?Ate(e,r):r}});var GL=m((r0e,HL)=>{"use strict";c();var R_=pr(),bte=["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"];HL.exports=function(e){var r={},n,i,s;return e&&R_.forEach(e.split(` -`),function(a){if(s=a.indexOf(":"),n=R_.trim(a.substr(0,s)).toLowerCase(),i=R_.trim(a.substr(s+1)),n){if(r[n]&&bte.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 QL=m((i0e,kL)=>{"use strict";c();var jL=pr();kL.exports=jL.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=jL.isString(o)?i(o):o;return a.protocol===n.protocol&&a.host===n.host}}():function(){return function(){return!0}}()});var Nl=m((o0e,WL)=>{"use strict";c();function B_(t){this.message=t}B_.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};B_.prototype.__CANCEL__=!0;WL.exports=B_});var F_=m((u0e,zL)=>{"use strict";c();var Jg=pr(),_te=PL(),Ite=BL(),Ste=O_(),Tte=VL(),Cte=GL(),xte=QL(),L_=P_(),Nte=Ol(),Ote=Nl();zL.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)}Jg.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 w=Tte(e.baseURL,e.url);f.open(e.method.toUpperCase(),Ste(w,e.params,e.paramsSerializer),!0),f.timeout=e.timeout;function E(){if(f){var O="getAllResponseHeaders"in f?Cte(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};_te(function(S){n(S),l()},function(S){i(S),l()},_),f=null}}if("onloadend"in f?f.onloadend=E:f.onreadystatechange=function(){!f||f.readyState!==4||f.status===0&&!(f.responseURL&&f.responseURL.indexOf("file:")===0)||setTimeout(E)},f.onabort=function(){f&&(i(L_("Request aborted",e,"ECONNABORTED",f)),f=null)},f.onerror=function(){i(L_("Network Error",e,null,f)),f=null},f.ontimeout=function(){var F=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",_=e.transitional||Nte.transitional;e.timeoutErrorMessage&&(F=e.timeoutErrorMessage),i(L_(F,e,_.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",f)),f=null},Jg.isStandardBrowserEnv()){var x=(e.withCredentials||xte(w))&&e.xsrfCookieName?Ite.read(e.xsrfCookieName):void 0;x&&(o[e.xsrfHeaderName]=x)}"setRequestHeader"in f&&Jg.forEach(o,function(F,_){typeof s>"u"&&_.toLowerCase()==="content-type"?delete o[_]:f.setRequestHeader(_,F)}),Jg.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 Ote("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 Ol=m((l0e,YL)=>{"use strict";c();var Qt=pr(),$L=xL(),Dte=D_(),Pte={"Content-Type":"application/x-www-form-urlencoded"};function KL(t,e){!Qt.isUndefined(t)&&Qt.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function Rte(){var t;return typeof XMLHttpRequest<"u"?t=F_():typeof p.default<"u"&&Object.prototype.toString.call(p.default)==="[object process]"&&(t=F_()),t}function Bte(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 Xg={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:Rte(),transformRequest:[function(e,r){return $L(r,"Accept"),$L(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)?(KL(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):Qt.isObject(e)||r&&r["Content-Type"]==="application/json"?(KL(r,"application/json"),Bte(e)):e}],transformResponse:[function(e){var r=this.transitional||Xg.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"?Dte(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){Xg.headers[e]={}});Qt.forEach(["post","put","patch"],function(e){Xg.headers[e]=Qt.merge(Pte)});YL.exports=Xg});var XL=m((h0e,JL)=>{"use strict";c();var Lte=pr(),Fte=Ol();JL.exports=function(e,r,n){var i=this||Fte;return Lte.forEach(n,function(o){e=o.call(i,e,r)}),e}});var M_=m((p0e,ZL)=>{"use strict";c();ZL.exports=function(e){return!!(e&&e.__CANCEL__)}});var rF=m((y0e,tF)=>{"use strict";c();var eF=pr(),U_=XL(),Mte=M_(),Ute=Ol(),qte=Nl();function q_(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new qte("canceled")}tF.exports=function(e){q_(e),e.headers=e.headers||{},e.data=U_.call(e,e.data,e.headers,e.transformRequest),e.headers=eF.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),eF.forEach(["delete","get","head","post","put","patch","common"],function(i){delete e.headers[i]});var r=e.adapter||Ute.adapter;return r(e).then(function(i){return q_(e),i.data=U_.call(e,i.data,i.headers,e.transformResponse),i},function(i){return Mte(i)||(q_(e),i&&i.response&&(i.response.data=U_.call(e,i.response.data,i.response.headers,e.transformResponse))),Promise.reject(i)})}});var V_=m((w0e,nF)=>{"use strict";c();var Ar=pr();nF.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,w=g(d);Ar.isUndefined(w)&&g!==u||(n[d]=w)}),n}});var H_=m((v0e,iF)=>{c();iF.exports={version:"0.24.0"}});var aF=m((b0e,oF)=>{"use strict";c();var Vte=H_().version,G_={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){G_[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var sF={};G_.transitional=function(e,r,n){function i(s,o){return"[Axios v"+Vte+"] 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&&!sF[o]&&(sF[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 Hte(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)}}oF.exports={assertOptions:Hte,validators:G_}});var dF=m((I0e,hF)=>{"use strict";c();var lF=pr(),Gte=O_(),uF=TL(),cF=rF(),Zg=V_(),fF=aF(),cu=fF.validators;function Dl(t){this.defaults=t,this.interceptors={request:new uF,response:new uF}}Dl.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=Zg(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&&fF.assertOptions(r,{silentJSONParsing:cu.transitional(cu.boolean),forcedJSONParsing:cu.transitional(cu.boolean),clarifyTimeoutError:cu.transitional(cu.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=[cF,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=cF(u)}catch(d){return Promise.reject(d)}for(;s.length;)o=o.then(s.shift(),s.shift());return o};Dl.prototype.getUri=function(e){return e=Zg(this.defaults,e),Gte(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};lF.forEach(["delete","get","head","options"],function(e){Dl.prototype[e]=function(r,n){return this.request(Zg(n||{},{method:e,url:r,data:(n||{}).data}))}});lF.forEach(["post","put","patch"],function(e){Dl.prototype[e]=function(r,n,i){return this.request(Zg(i||{},{method:e,url:r,data:n}))}});hF.exports=Dl});var gF=m((T0e,pF)=>{"use strict";c();var jte=Nl();function lu(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();yF.exports=function(e){return function(n){return e.apply(null,n)}}});var EF=m((O0e,wF)=>{"use strict";c();wF.exports=function(e){return typeof e=="object"&&e.isAxiosError===!0}});var bF=m((P0e,j_)=>{"use strict";c();var vF=pr(),kte=S_(),ey=dF(),Qte=V_(),Wte=Ol();function AF(t){var e=new ey(t),r=kte(ey.prototype.request,e);return vF.extend(r,ey.prototype,e),vF.extend(r,e),r.create=function(i){return AF(Qte(t,i))},r}var Dn=AF(Wte);Dn.Axios=ey;Dn.Cancel=Nl();Dn.CancelToken=gF();Dn.isCancel=M_();Dn.VERSION=H_().version;Dn.all=function(e){return Promise.all(e)};Dn.spread=mF();Dn.isAxiosError=EF();j_.exports=Dn;j_.exports.default=Dn});var IF=m((B0e,_F)=>{c();_F.exports=bF()});var SF=m(ty=>{"use strict";c();Object.defineProperty(ty,"__esModule",{value:!0});ty.NativeAuthClientConfig=void 0;var k_=class{constructor(){this.origin=typeof window<"u"?window.location.hostname:"",this.apiUrl="https://api.multiversx.com",this.expirySeconds=60*60*24}};ty.NativeAuthClientConfig=k_});var W_=m(fu=>{"use strict";c();var so=fu&&fu.__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(fu,"__esModule",{value:!0});fu.NativeAuthClient=void 0;var zte=IF(),$te=SF(),Q_=class{constructor(e){this.config=Object.assign(new $te.NativeAuthClientConfig,e)}getToken(e,r,n){let i=this.encodeValue(e),s=this.encodeValue(r);return`${i}.${s}.${n}`}initialize(e={}){return so(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 so(this,void 0,void 0,function*(){return this.config.gatewayUrl?yield this.getCurrentBlockHashWithGateway():yield this.getCurrentBlockHashWithApi()})}getCurrentBlockHashWithGateway(){return so(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 so(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 so(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 so(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 so(this,void 0,void 0,function*(){return yield zte.default.get(e,{headers:this.config.extraRequestHeaders})})}};fu.NativeAuthClient=Q_});var OF=m(iy=>{"use strict";c();Object.defineProperty(iy,"__esModule",{value:!0});iy.TransactionStatus=void 0;var z_=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}};iy.TransactionStatus=z_});var pu=m(Vt=>{"use strict";c();var Kte=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]}),Yte=Vt&&Vt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Jte=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)&&Kte(e,t,r);return Yte(e,t),e};Object.defineProperty(Vt,"__esModule",{value:!0});Vt.zeroPadStringIfOddLength=Vt.isPaddedHex=Vt.numberToPaddedHex=Vt.Nonce=Vt.Address=void 0;var DF=Jte(bm()),Xte="erd",$_=class t{constructor(e){this.value=e}static fromPubkey(e){let r=DF.toWords(e),n=DF.encode(Xte,r);return new t(n)}bech32(){return this.value}toString(){return this.bech32()}};Vt.Address=$_;var K_=class{constructor(e){this.value=e}valueOf(){return this.value}hex(){return PF(this.value)}};Vt.Nonce=K_;function PF(t){let e=t.toString(16);return RF(e)}Vt.numberToPaddedHex=PF;function Zte(t){t=t||"";let e=h.Buffer.from(t,"hex").toString("hex");return t.toUpperCase()==e.toUpperCase()}Vt.isPaddedHex=Zte;function RF(t){return t=t||"",t.length%2==1?"0"+t:t}Vt.zeroPadStringIfOddLength=RF});var LF=m(sy=>{"use strict";c();Object.defineProperty(sy,"__esModule",{value:!0});sy.TransactionReceipt=void 0;var BF=pu(),Y_=class t{constructor(){this.value="",this.sender=new BF.Address(""),this.data="",this.hash=""}static fromHttpResponse(e){let r=new t;return r.value=(e.value||0).toString(),r.sender=new BF.Address(e.sender),r.data=e.data,r.hash=e.txHash,r}};sy.TransactionReceipt=Y_});var FF=m(Pn=>{"use strict";c();Object.defineProperty(Pn,"__esModule",{value:!0});Pn.ErrContractQuery=Pn.ErrNetworkProvider=Pn.ErrUnexpectedCondition=Pn.Err=void 0;var gu=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};Pn.Err=gu;var J_=class extends gu{constructor(e){super(`Unexpected condition: [${e}]`)}};Pn.ErrUnexpectedCondition=J_;var X_=class extends gu{constructor(e,r,n){let i=`Request error on url [${e}]: [${r}]`;super(i,n)}};Pn.ErrNetworkProvider=X_;var Z_=class extends gu{constructor(e){super(e.message.replace("executeQuery:",""))}};Pn.ErrContractQuery=Z_});var UF=m(is=>{"use strict";c();Object.defineProperty(is,"__esModule",{value:!0});is.TransactionEventTopic=is.TransactionEventData=is.TransactionEvent=void 0;var MF=pu(),eI=class t{constructor(e){this.address=new MF.Address(""),this.identifier="",this.topics=[],this.dataPayload=new Pl(h.Buffer.from("","utf8")),this.data="",Object.assign(this,e)}static fromHttpResponse(e){let r=new t;r.address=new MF.Address(e.address),r.identifier=e.identifier||"",r.topics=(e.topics||[]).map(i=>new oy(i));let n=h.Buffer.from(e.data||"","base64");return r.dataPayload=new Pl(n),r.data=n.toString(),r}findFirstOrNoneTopic(e){return this.topics.filter(r=>e(r))[0]}getLastTopic(){return this.topics[this.topics.length-1]}};is.TransactionEvent=eI;var Pl=class{constructor(e){this.raw=e}toString(){return this.raw.toString("utf8")}hex(){return this.raw.toString("hex")}valueOf(){return this.raw}};is.TransactionEventData=Pl;var oy=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}};is.TransactionEventTopic=oy});var rI=m(ay=>{"use strict";c();Object.defineProperty(ay,"__esModule",{value:!0});ay.TransactionLogs=void 0;var ere=FF(),qF=pu(),tre=UF(),tI=class t{constructor(e){this.address=new qF.Address(""),this.events=[],Object.assign(this,e)}static fromHttpResponse(e){let r=new t;return r.address=new qF.Address(e.address),r.events=(e.events||[]).map(n=>tre.TransactionEvent.fromHttpResponse(n)),r}findSingleOrNoneEvent(e,r){let n=this.findEvents(e,r);if(n.length>1)throw new ere.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}};ay.TransactionLogs=tI});var HF=m(yu=>{"use strict";c();Object.defineProperty(yu,"__esModule",{value:!0});yu.ContractResultItem=yu.ContractResults=void 0;var VF=rI(),uy=pu(),nI=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=>Rl.fromProxyHttpResponse(n));return new t(r)}static fromApiHttpResponse(e){let r=e.map(n=>Rl.fromApiHttpResponse(n));return new t(r)}};yu.ContractResults=nI;var Rl=class t{constructor(e){this.hash="",this.nonce=0,this.value="",this.receiver=new uy.Address(""),this.sender=new uy.Address(""),this.data="",this.previousHash="",this.originalHash="",this.gasLimit=0,this.gasPrice=0,this.callType=0,this.returnMessage="",this.logs=new VF.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 uy.Address(e.receiver),r.sender=new uy.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=VF.TransactionLogs.fromHttpResponse(e.logs||{}),r}};yu.ContractResultItem=Rl});var GF=m(ss=>{"use strict";c();var rre=ss&&ss.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ss,"__esModule",{value:!0});ss.EsdtContractAddress=ss.MaxUint64AsBigNumber=void 0;var nre=rre(Gt()),ire=pu();ss.MaxUint64AsBigNumber=new nre.default("18446744073709551615");ss.EsdtContractAddress=new ire.Address("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u")});var jF=m(mu=>{"use strict";c();var sre=mu&&mu.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(mu,"__esModule",{value:!0});mu.ContractQueryResponse=void 0;var ore=sre(Gt()),are=GF(),iI=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 ore.default(e.gasRemaining||e.GasRemaining||0),o=are.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()}}};mu.ContractQueryResponse=iI});var kF=m(cy=>{"use strict";c();Object.defineProperty(cy,"__esModule",{value:!0});cy.ContractQueryRequest=void 0;var sI=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}};cy.ContractQueryRequest=sI});var tM=m((zme,eM)=>{c();eM.exports=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}});var os=m(ao=>{c();var oI,ure=[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];ao.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};ao.getSymbolTotalCodewords=function(e){return ure[e]};ao.getBCHDigit=function(t){let e=0;for(;t!==0;)e++,t>>>=1;return e};ao.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');oI=e};ao.isKanjiModeEnabled=function(){return typeof oI<"u"};ao.toSJIS=function(e){return oI(e)}});var hy=m(Hr=>{c();Hr.L={bit:1};Hr.M={bit:0};Hr.Q={bit:3};Hr.H={bit:2};function cre(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return Hr.L;case"m":case"medium":return Hr.M;case"q":case"quartile":return Hr.Q;case"h":case"high":return Hr.H;default:throw new Error("Unknown EC Level: "+t)}}Hr.isValid=function(e){return e&&typeof e.bit<"u"&&e.bit>=0&&e.bit<4};Hr.from=function(e,r){if(Hr.isValid(e))return e;try{return cre(e)}catch{return r}}});var iM=m((Zme,nM)=>{c();function rM(){this.buffer=[],this.length=0}rM.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++}};nM.exports=rM});var oM=m((twe,sM)=>{c();function Bl(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)}Bl.prototype.set=function(t,e,r,n){let i=t*this.size+e;this.data[i]=r,n&&(this.reservedBit[i]=!0)};Bl.prototype.get=function(t,e){return this.data[t*this.size+e]};Bl.prototype.xor=function(t,e,r){this.data[t*this.size+e]^=r};Bl.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};sM.exports=Bl});var aM=m(dy=>{c();var lre=os().getSymbolSize;dy.getRowColCoords=function(e){if(e===1)return[];let r=Math.floor(e/7)+2,n=lre(e),i=n===145?26:Math.ceil((n-13)/(2*r-2))*2,s=[n-7];for(let o=1;o{c();var fre=os().getSymbolSize,uM=7;cM.getPositions=function(e){let r=fre(e);return[[0,0],[r-uM,0],[0,r-uM]]}});var fM=m(et=>{c();et.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var uo={N1:3,N2:3,N3:40,N4:10};et.isValid=function(e){return e!=null&&e!==""&&!isNaN(e)&&e>=0&&e<=7};et.from=function(e){return et.isValid(e)?parseInt(e,10):void 0};et.getPenaltyN1=function(e){let r=e.size,n=0,i=0,s=0,o=null,a=null;for(let u=0;u=5&&(n+=uo.N1+(i-5)),o=f,i=1),f=e.get(l,u),f===a?s++:(s>=5&&(n+=uo.N1+(s-5)),a=f,s=1)}i>=5&&(n+=uo.N1+(i-5)),s>=5&&(n+=uo.N1+(s-5))}return n};et.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*uo.N3};et.getPenaltyN4=function(e){let r=0,n=e.data.length;for(let s=0;s{c();var as=hy(),py=[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],gy=[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];aI.getBlocksCount=function(e,r){switch(r){case as.L:return py[(e-1)*4+0];case as.M:return py[(e-1)*4+1];case as.Q:return py[(e-1)*4+2];case as.H:return py[(e-1)*4+3];default:return}};aI.getTotalCodewordsCount=function(e,r){switch(r){case as.L:return gy[(e-1)*4+0];case as.M:return gy[(e-1)*4+1];case as.Q:return gy[(e-1)*4+2];case as.H:return gy[(e-1)*4+3];default:return}}});var hM=m(my=>{c();var Ll=new Uint8Array(512),yy=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)Ll[r]=e,yy[e]=r,e<<=1,e&256&&(e^=285);for(let r=255;r<512;r++)Ll[r]=Ll[r-255]})();my.log=function(e){if(e<1)throw new Error("log("+e+")");return yy[e]};my.exp=function(e){return Ll[e]};my.mul=function(e,r){return e===0||r===0?0:Ll[yy[e]+yy[r]]}});var dM=m(Fl=>{c();var cI=hM();Fl.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 pM=dM();function lI(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}lI.prototype.initialize=function(e){this.degree=e,this.genPoly=pM.generateECPolynomial(this.degree)};lI.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=pM.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};gM.exports=lI});var fI=m(mM=>{c();mM.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}});var hI=m(ai=>{c();var wM="[0-9]+",dre="[A-Z $%*+\\-./:]+",Ml="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";Ml=Ml.replace(/u/g,"\\u");var pre="(?:(?![A-Z0-9 $%*+\\-./:]|"+Ml+`)(?:.|[\r -]))+`;ai.KANJI=new RegExp(Ml,"g");ai.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");ai.BYTE=new RegExp(pre,"g");ai.NUMERIC=new RegExp(wM,"g");ai.ALPHANUMERIC=new RegExp(dre,"g");var gre=new RegExp("^"+Ml+"$"),yre=new RegExp("^"+wM+"$"),mre=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");ai.testKanji=function(e){return gre.test(e)};ai.testNumeric=function(e){return yre.test(e)};ai.testAlphanumeric=function(e){return mre.test(e)}});var us=m(Ct=>{c();var wre=fI(),dI=hI();Ct.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]};Ct.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]};Ct.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]};Ct.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]};Ct.MIXED={bit:-1};Ct.getCharCountIndicator=function(e,r){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!wre.isValid(r))throw new Error("Invalid version: "+r);return r>=1&&r<10?e.ccBits[0]:r<27?e.ccBits[1]:e.ccBits[2]};Ct.getBestModeForData=function(e){return dI.testNumeric(e)?Ct.NUMERIC:dI.testAlphanumeric(e)?Ct.ALPHANUMERIC:dI.testKanji(e)?Ct.KANJI:Ct.BYTE};Ct.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")};Ct.isValid=function(e){return e&&e.bit&&e.ccBits};function Ere(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return Ct.NUMERIC;case"alphanumeric":return Ct.ALPHANUMERIC;case"kanji":return Ct.KANJI;case"byte":return Ct.BYTE;default:throw new Error("Unknown mode: "+t)}}Ct.from=function(e,r){if(Ct.isValid(e))return e;try{return Ere(e)}catch{return r}}});var _M=m(co=>{c();var wy=os(),vre=uI(),EM=hy(),cs=us(),pI=fI(),AM=7973,vM=wy.getBCHDigit(AM);function Are(t,e,r){for(let n=1;n<=40;n++)if(e<=co.getCapacity(n,r,t))return n}function bM(t,e){return cs.getCharCountIndicator(t,e)+4}function bre(t,e){let r=0;return t.forEach(function(n){let i=bM(n.mode,e);r+=i+n.getBitsLength()}),r}function _re(t,e){for(let r=1;r<=40;r++)if(bre(t,r)<=co.getCapacity(r,e,cs.MIXED))return r}co.from=function(e,r){return pI.isValid(e)?parseInt(e,10):r};co.getCapacity=function(e,r,n){if(!pI.isValid(e))throw new Error("Invalid QR Code version");typeof n>"u"&&(n=cs.BYTE);let i=wy.getSymbolTotalCodewords(e),s=vre.getTotalCodewordsCount(e,r),o=(i-s)*8;if(n===cs.MIXED)return o;let a=o-bM(n,e);switch(n){case cs.NUMERIC:return Math.floor(a/10*3);case cs.ALPHANUMERIC:return Math.floor(a/11*2);case cs.KANJI:return Math.floor(a/13);case cs.BYTE:default:return Math.floor(a/8)}};co.getBestVersionForData=function(e,r){let n,i=EM.from(r,EM.M);if(Array.isArray(e)){if(e.length>1)return _re(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return Are(n.mode,n.getLength(),i)};co.getEncodedBits=function(e){if(!pI.isValid(e)||e<7)throw new Error("Invalid QR Code version");let r=e<<12;for(;wy.getBCHDigit(r)-vM>=0;)r^=AM<{c();var gI=os(),SM=1335,Ire=21522,IM=gI.getBCHDigit(SM);TM.getEncodedBits=function(e,r){let n=e.bit<<3|r,i=n<<10;for(;gI.getBCHDigit(i)-IM>=0;)i^=SM<{c();var Sre=us();function wu(t){this.mode=Sre.NUMERIC,this.data=t.toString()}wu.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)};wu.prototype.getLength=function(){return this.data.length};wu.prototype.getBitsLength=function(){return wu.getBitsLength(this.data.length)};wu.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))};xM.exports=wu});var DM=m((Nwe,OM)=>{c();var Tre=us(),yI=["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 Eu(t){this.mode=Tre.ALPHANUMERIC,this.data=t}Eu.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)};Eu.prototype.getLength=function(){return this.data.length};Eu.prototype.getBitsLength=function(){return Eu.getBitsLength(this.data.length)};Eu.prototype.write=function(e){let r;for(r=0;r+2<=this.data.length;r+=2){let n=yI.indexOf(this.data[r])*45;n+=yI.indexOf(this.data[r+1]),e.put(n,11)}this.data.length%2&&e.put(yI.indexOf(this.data[r]),6)};OM.exports=Eu});var RM=m((Dwe,PM)=>{"use strict";c();PM.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 LM=m((Rwe,BM)=>{c();var Cre=RM(),xre=us();function vu(t){this.mode=xre.BYTE,typeof t=="string"&&(t=Cre(t)),this.data=new Uint8Array(t)}vu.getBitsLength=function(e){return e*8};vu.prototype.getLength=function(){return this.data.length};vu.prototype.getBitsLength=function(){return vu.getBitsLength(this.data.length)};vu.prototype.write=function(t){for(let e=0,r=this.data.length;e{c();var Nre=us(),Ore=os();function Au(t){this.mode=Nre.KANJI,this.data=t}Au.getBitsLength=function(e){return e*13};Au.prototype.getLength=function(){return this.data.length};Au.prototype.getBitsLength=function(){return Au.getBitsLength(this.data.length)};Au.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)}};FM.exports=Au});var UM=m((Mwe,mI)=>{"use strict";c();var Ul={single_source_shortest_paths:function(t,e,r){var n={},i={};i[e]=0;var s=Ul.PriorityQueue.make();s.push(e,0);for(var o,a,u,l,f,d,g,w,E;!s.empty();){o=s.pop(),a=o.value,l=o.cost,f=t[a]||{};for(u in f)f.hasOwnProperty(u)&&(d=f[u],g=l+d,w=i[u],E=typeof i[u]>"u",(E||w>g)&&(i[u]=g,s.push(u,g),n[u]=a))}if(typeof r<"u"&&typeof i[r]>"u"){var x=["Could not find a path from ",e," to ",r,"."].join("");throw new Error(x)}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=Ul.single_source_shortest_paths(t,e,r);return Ul.extract_shortest_path_from_predecessor_list(n,r)},PriorityQueue:{make:function(t){var e=Ul.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 mI<"u"&&(mI.exports=Ul)});var WM=m(bu=>{c();var He=us(),HM=NM(),GM=DM(),jM=LM(),kM=MM(),ql=hI(),Ey=os(),Dre=UM();function qM(t){return unescape(encodeURIComponent(t)).length}function Vl(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 QM(t){let e=Vl(ql.NUMERIC,He.NUMERIC,t),r=Vl(ql.ALPHANUMERIC,He.ALPHANUMERIC,t),n,i;return Ey.isKanjiModeEnabled()?(n=Vl(ql.BYTE,He.BYTE,t),i=Vl(ql.KANJI,He.KANJI,t)):(n=Vl(ql.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 wI(t,e){switch(e){case He.NUMERIC:return HM.getBitsLength(t);case He.ALPHANUMERIC:return GM.getBitsLength(t);case He.KANJI:return kM.getBitsLength(t);case He.BYTE:return jM.getBitsLength(t)}}function Pre(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 Rre(t){let e=[];for(let r=0;r{c();var Ay=os(),EI=hy(),Lre=iM(),Fre=oM(),Mre=aM(),Ure=lM(),bI=fM(),_I=uI(),qre=yM(),vy=_M(),Vre=CM(),Hre=us(),vI=WM();function Gre(t,e){let r=t.size,n=Ure.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 jre(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 AI(t,e,r){let n=t.size,i=Vre.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 Wre(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 zre(t,e,r){let n=new Lre;r.forEach(function(u){n.put(u.mode.bit,4),n.put(u.getLength(),Hre.getCharCountIndicator(u.mode,t)),u.write(n)});let i=Ay.getSymbolTotalCodewords(t),s=_I.getTotalCodewordsCount(t,e),o=(i-s)*8;for(n.getLengthInBits()+4<=o&&n.put(0,4);n.getLengthInBits()%8!==0;)n.putBit(0);let a=(o-n.getLengthInBits())/8;for(let u=0;u{"use strict";c();Object.defineProperty(kg,"__esModule",{value:!0});kg.TokenOperationsFactoryConfig=void 0;var FZ=ht(),e_=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=FZ.Address.fromBech32("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u"),this.chainID=e}};kg.TokenOperationsFactoryConfig=e_});var wB=m(jg=>{"use strict";c();Object.defineProperty(jg,"__esModule",{value:!0});jg.TokenOperationsOutcomeParser=void 0;var MZ=ht(),t_=Be(),mB=Jb(),r_=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 t_.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 t_.ErrCannotParseTransactionOutcome(e.hash,`cannot find event of type ${r}`);if(n.length>1)throw new t_.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 mB.bufferToBigInt((r=e.topics[1])===null||r===void 0?void 0:r.valueOf()).toFixed(0)}extractAmount(e){var r;return mB.bufferToBigInt((r=e.topics[2])===null||r===void 0?void 0:r.valueOf()).toFixed(0)}extractAddress(e){var r;return MZ.Address.fromBuffer((r=e.topics[3])===null||r===void 0?void 0:r.valueOf()).toString()}};jg.TokenOperationsOutcomeParser=r_});var EB=m(ci=>{"use strict";c();var UZ=ci&&ci.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),n_=ci&&ci.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&UZ(e,t,r)};Object.defineProperty(ci,"__esModule",{value:!0});n_(gB(),ci);n_(yB(),ci);n_(wB(),ci)});var vB=m(Ze=>{"use strict";c();var qZ=Ze&&Ze.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.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=Ze&&Ze.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&qZ(e,t,r)};Object.defineProperty(Ze,"__esModule",{value:!0});Q8();Ct(ra(),Ze);Ct(ht(),Ze);Ct(sE(),Ze);Ct(Be(),Ze);Ct(tE(),Ze);Ct($8(),Ze);Ct(K8(),Ze);Ct(na(),Ze);Ct(cc(),Ze);Ct(Y8(),Ze);Ct(lB(),Ze);Ct(fB(),Ze);Ct($b(),Ze);Ct(EB(),Ze);Ct(Em(),Ze);Ct(wn(),Ze);Ct(jn(),Ze);Ct(ed(),Ze);Ct(Zw(),Ze);Ct(wr(),Ze)});var TB=m(xt=>{"use strict";c();var VZ=xt&&xt.__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(xt,"__esModule",{value:!0});xt.sleep=xt.getMetadata=xt.applyTransactionSignature=xt.getAddressFromSession=xt.addressIsValid=xt.getConnectionParams=xt.getCurrentTopic=xt.getCurrentSession=void 0;var _B=vB(),AB=jh(),HZ=cl(),Qg=Db(),li=Bb(),i_=Fb(),bB=Bg();function IB(t,e){if(!e)throw new Error(li.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=e.find(SB(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 i_.Logger.error(li.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),new Error(li.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected)}xt.getCurrentSession=IB;function GZ(t,e){if(!e)throw new Error(li.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=IB(t,e);if(!r?.topic)throw new Error(li.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);return r.topic}xt.getCurrentTopic=GZ;function SB(t,e){var r,n,i;let s=[...Qg.WALLETCONNECT_MULTIVERSX_METHODS,...(r=e?.methods)!==null&&r!==void 0?r:[]];!((n=e?.methods)===null||n===void 0)&&n.includes(bB.OptionalOperation.SIGN_LOGIN_TOKEN)||s.push(bB.OptionalOperation.SIGN_LOGIN_TOKEN);let o=[`${Qg.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${t}`],a=(i=e?.events)!==null&&i!==void 0?i:[];return{requiredNamespaces:{[Qg.WALLETCONNECT_MULTIVERSX_NAMESPACE]:{methods:s,chains:o,events:a}}}}xt.getConnectionParams=SB;function kZ(t){try{return!_B.Address.fromBech32(t).isEmpty()}catch{return!1}}xt.addressIsValid=kZ;function jZ(t){let e=t.namespaces[Qg.WALLETCONNECT_MULTIVERSX_NAMESPACE];if(e&&e.accounts){let r=e.accounts[0],[n,i,s]=r.split(":");return s}return""}xt.getAddressFromSession=jZ;function QZ({transaction:t,response:e}){if(!e)throw i_.Logger.error(li.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse),new Error(li.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse);let{signature:r,guardianSignature:n,version:i,options:s,guardian:o}=e,a=t.getGuardian().bech32();if(a&&a!==o)throw i_.Logger.error(li.WalletConnectV2ProviderErrorMessagesEnum.invalidGuardian),new Error(li.WalletConnectV2ProviderErrorMessagesEnum.invalidGuardian);return o&&t.setGuardian(_B.Address.fromBech32(o)),i&&t.setVersion(i),s!=null&&t.setOptions(s),t.applySignature(new AB.Signature(r)),n&&t.applyGuardianSignature(new AB.Signature(n)),t}xt.applyTransactionSignature=QZ;function WZ(t){if(t)return Object.assign(Object.assign({},t),{url:HZ.getAppMetadata().url})}xt.getMetadata=WZ;function $Z(t){return VZ(this,void 0,void 0,function*(){return yield new Promise(e=>setTimeout(()=>{e()},t))})}xt.sleep=$Z});var Cl=m(yr=>{"use strict";c();var bt=yr&&yr.__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())})},zZ=yr&&yr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(yr,"__esModule",{value:!0});yr.WalletConnectV2Provider=yr.OptionalOperation=yr.Operation=yr.WalletConnectV2ProviderErrorMessagesEnum=void 0;var KZ=jh(),YZ=zZ(k8()),s_=cl(),oo=Db(),ye=Bb();Object.defineProperty(yr,"WalletConnectV2ProviderErrorMessagesEnum",{enumerable:!0,get:function(){return ye.WalletConnectV2ProviderErrorMessagesEnum}});var Le=Fb(),Zi=Bg();Object.defineProperty(yr,"Operation",{enumerable:!0,get:function(){return Zi.Operation}});Object.defineProperty(yr,"OptionalOperation",{enumerable:!0,get:function(){return Zi.OptionalOperation}});var jt=TB(),o_=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 bt(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:jt.getMetadata((r=this.options)===null||r===void 0?void 0:r.metadata)}:{},i=yield YZ.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 bt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=jt.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 bt(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){yield jt.sleep(oo.WALLETCONNECT_SIGN_LOGIN_DELAY);let i=jt.getAddressFromSession(n),o=n.namespaces[oo.WALLETCONNECT_MULTIVERSX_NAMESPACE].methods.includes(Zi.OptionalOperation.SIGN_NATIVE_AUTH_TOKEN)?Zi.OptionalOperation.SIGN_NATIVE_AUTH_TOKEN:Zi.OptionalOperation.SIGN_LOGIN_TOKEN,{signature:a}=yield this.walletConnector.request({chainId:`${oo.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 bt(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||jt.getCurrentTopic(this.chainId,this.walletConnector)))return!0;if(e?.topic)this.processingTopic=e.topic,yield this.walletConnector.disconnect({topic:e.topic,reason:s_.getSdkError("USER_DISCONNECTED")});else{let r=jt.getCurrentTopic(this.chainId,this.walletConnector);this.processingTopic=r,yield this.walletConnector.disconnect({topic:r,reason:s_.getSdkError("USER_DISCONNECTED")}),this.reset(),yield this.cleanupPendingPairings({deletePairings:!0})}}catch{Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.alreadyLoggedOut)}finally{this.processingTopic=""}return!0})}getAddress(){return bt(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 bt(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 bt(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 bt(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:`${oo.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:jt.getCurrentTopic(this.chainId,this.walletConnector),request:{method:Zi.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 KZ.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 bt(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:`${oo.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:jt.getCurrentTopic(this.chainId,this.walletConnector),request:{method:Zi.Operation.SIGN_TRANSACTION,params:{transaction:r}}});return jt.applyTransactionSignature({transaction:e,response:n})}catch{throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.transactionError)}})}signTransactions(e){return bt(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:`${oo.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:jt.getCurrentTopic(this.chainId,this.walletConnector),request:{method:Zi.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];jt.applyTransactionSignature({transaction:s,response:o})}return e}catch{throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.transactionError)}})}sendCustomRequest(e){var r;return bt(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:`${oo.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:jt.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 bt(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=jt.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 bt(this,void 0,void 0,function*(){return e?jt.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 bt(this,void 0,void 0,function*(){if(!e)return"";this.session=e.session;let r=jt.getAddressFromSession(e.session);return r?(yield this.loginAccount({address:r,signature:e.signature}),r):""})}handleTopicUpdateEvent({topic:e}){return bt(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 bt(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&&jt.getCurrentTopic(this.chainId,this.walletConnector)===e){let s=i.data;this.onClientConnect.onClientEvent(s)}})}subscribeToEvents(e){var r,n,i,s;return bt(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})=>bt(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})=>bt(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 bt(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=jt.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 bt(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(!s_.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)}})}};yr.WalletConnectV2Provider=o_});var xB=m((Fye,CB)=>{"use strict";c();CB.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 DB=m((Uye,OB)=>{"use strict";c();var NB=typeof Symbol<"u"&&Symbol,JZ=xB();OB.exports=function(){return typeof NB!="function"||typeof Symbol!="function"||typeof NB("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:JZ()}});var BB=m((Vye,RB)=>{"use strict";c();var PB={foo:{}},XZ=Object;RB.exports=function(){return{__proto__:PB}.foo===PB.foo&&!({__proto__:null}instanceof XZ)}});var MB=m((Gye,FB)=>{"use strict";c();var ZZ="Function.prototype.bind called on incompatible ",eee=Object.prototype.toString,tee=Math.max,ree="[object Function]",LB=function(e,r){for(var n=[],i=0;i{"use strict";c();var see=MB();UB.exports=Function.prototype.bind||see});var VB=m((Wye,qB)=>{"use strict";c();var oee=Function.prototype.call,aee=Object.prototype.hasOwnProperty,uee=Wg();qB.exports=uee.call(oee,aee)});var es=m((zye,QB)=>{"use strict";c();var Pe,iu=SyntaxError,jB=Function,nu=TypeError,a_=function(t){try{return jB('"use strict"; return ('+t+").constructor;")()}catch{}},ao=Object.getOwnPropertyDescriptor;if(ao)try{ao({},"")}catch{ao=null}var u_=function(){throw new nu},cee=ao?function(){try{return arguments.callee,u_}catch{try{return ao(arguments,"callee").get}catch{return u_}}}():u_,tu=DB()(),lee=BB()(),Mt=Object.getPrototypeOf||(lee?function(t){return t.__proto__}:null),ru={},fee=typeof Uint8Array>"u"||!Mt?Pe:Mt(Uint8Array),uo={"%AggregateError%":typeof AggregateError>"u"?Pe:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Pe:ArrayBuffer,"%ArrayIteratorPrototype%":tu&&Mt?Mt([][Symbol.iterator]()):Pe,"%AsyncFromSyncIteratorPrototype%":Pe,"%AsyncFunction%":ru,"%AsyncGenerator%":ru,"%AsyncGeneratorFunction%":ru,"%AsyncIteratorPrototype%":ru,"%Atomics%":typeof Atomics>"u"?Pe:Atomics,"%BigInt%":typeof BigInt>"u"?Pe:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Pe:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Pe:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Pe:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?Pe:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Pe:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Pe:FinalizationRegistry,"%Function%":jB,"%GeneratorFunction%":ru,"%Int8Array%":typeof Int8Array>"u"?Pe:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Pe:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Pe:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":tu&&Mt?Mt(Mt([][Symbol.iterator]())):Pe,"%JSON%":typeof JSON=="object"?JSON:Pe,"%Map%":typeof Map>"u"?Pe:Map,"%MapIteratorPrototype%":typeof Map>"u"||!tu||!Mt?Pe:Mt(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Pe:Promise,"%Proxy%":typeof Proxy>"u"?Pe:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?Pe:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Pe:Set,"%SetIteratorPrototype%":typeof Set>"u"||!tu||!Mt?Pe:Mt(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Pe:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":tu&&Mt?Mt(""[Symbol.iterator]()):Pe,"%Symbol%":tu?Symbol:Pe,"%SyntaxError%":iu,"%ThrowTypeError%":cee,"%TypedArray%":fee,"%TypeError%":nu,"%Uint8Array%":typeof Uint8Array>"u"?Pe:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Pe:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Pe:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Pe:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?Pe:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Pe:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Pe:WeakSet};if(Mt)try{null.error}catch(t){HB=Mt(Mt(t)),uo["%Error.prototype%"]=HB}var HB,hee=function t(e){var r;if(e==="%AsyncFunction%")r=a_("async function () {}");else if(e==="%GeneratorFunction%")r=a_("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=a_("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 uo[e]=r,r},GB={"%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"]},xl=Wg(),$g=VB(),dee=xl.call(Function.call,Array.prototype.concat),pee=xl.call(Function.apply,Array.prototype.splice),kB=xl.call(Function.call,String.prototype.replace),zg=xl.call(Function.call,String.prototype.slice),gee=xl.call(Function.call,RegExp.prototype.exec),yee=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,mee=/\\(\\)?/g,wee=function(e){var r=zg(e,0,1),n=zg(e,-1);if(r==="%"&&n!=="%")throw new iu("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new iu("invalid intrinsic syntax, expected opening `%`");var i=[];return kB(e,yee,function(s,o,a,u){i[i.length]=a?kB(u,mee,"$1"):o||s}),i},Eee=function(e,r){var n=e,i;if($g(GB,n)&&(i=GB[n],n="%"+i[0]+"%"),$g(uo,n)){var s=uo[n];if(s===ru&&(s=hee(n)),typeof s>"u"&&!r)throw new nu("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:s}}throw new iu("intrinsic "+e+" does not exist!")};QB.exports=function(e,r){if(typeof e!="string"||e.length===0)throw new nu("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new nu('"allowMissing" argument must be a boolean');if(gee(/^%?[^%]*%?$/,e)===null)throw new iu("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=wee(e),i=n.length>0?n[0]:"",s=Eee("%"+i+"%",r),o=s.name,a=s.value,u=!1,l=s.alias;l&&(i=l[0],pee(n,dee([0,1],l)));for(var f=1,d=!0;f=n.length){var T=ao(a,g);d=!!T,d&&"get"in T&&!("originalValue"in T.get)?a=T.get:a=a[g]}else d=$g(a,g),a=a[g];d&&!u&&(uo[o]=a)}}return a}});var f_=m((Yye,WB)=>{"use strict";c();var vee=es(),c_=vee("%Object.defineProperty%",!0),l_=function(){if(c_)try{return c_({},"a",{value:1}),!0}catch{return!1}return!1};l_.hasArrayLengthDefineBug=function(){if(!l_())return null;try{return c_([],"length",{value:1}).length!==1}catch{return!0}};WB.exports=l_});var h_=m((Xye,$B)=>{"use strict";c();var Aee=es(),Kg=Aee("%Object.getOwnPropertyDescriptor%",!0);if(Kg)try{Kg([],"length")}catch{Kg=null}$B.exports=Kg});var YB=m((e0e,KB)=>{"use strict";c();var bee=f_()(),d_=es(),Nl=bee&&d_("%Object.defineProperty%",!0);if(Nl)try{Nl({},"a",{value:1})}catch{Nl=!1}var _ee=d_("%SyntaxError%"),su=d_("%TypeError%"),zB=h_();KB.exports=function(e,r,n){if(!e||typeof e!="object"&&typeof e!="function")throw new su("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new su("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new su("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new su("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new su("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new su("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,s=arguments.length>4?arguments[4]:null,o=arguments.length>5?arguments[5]:null,a=arguments.length>6?arguments[6]:!1,u=!!zB&&zB(e,r);if(Nl)Nl(e,r,{configurable:o===null&&u?u.configurable:!o,enumerable:i===null&&u?u.enumerable:!i,value:n,writable:s===null&&u?u.writable:!s});else if(a||!i&&!s&&!o)e[r]=n;else throw new _ee("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var rL=m((r0e,tL)=>{"use strict";c();var eL=es(),JB=YB(),Iee=f_()(),XB=h_(),ZB=eL("%TypeError%"),See=eL("%Math.floor%");tL.exports=function(e,r){if(typeof e!="function")throw new ZB("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||See(r)!==r)throw new ZB("`length` must be a positive 32-bit integer");var n=arguments.length>2&&!!arguments[2],i=!0,s=!0;if("length"in e&&XB){var o=XB(e,"length");o&&!o.configurable&&(i=!1),o&&!o.writable&&(s=!1)}return(i||s||!n)&&(Iee?JB(e,"length",r,!0,!0):JB(e,"length",r)),e}});var aL=m((i0e,Yg)=>{"use strict";c();var p_=Wg(),ou=es(),Tee=rL(),Cee=ou("%TypeError%"),iL=ou("%Function.prototype.apply%"),sL=ou("%Function.prototype.call%"),oL=ou("%Reflect.apply%",!0)||p_.call(sL,iL),Ol=ou("%Object.defineProperty%",!0),xee=ou("%Math.max%");if(Ol)try{Ol({},"a",{value:1})}catch{Ol=null}Yg.exports=function(e){if(typeof e!="function")throw new Cee("a function is required");var r=oL(p_,sL,arguments);return Tee(r,1+xee(0,e.length-(arguments.length-1)),!0)};var nL=function(){return oL(p_,iL,arguments)};Ol?Ol(Yg.exports,"apply",{value:nL}):Yg.exports.apply=nL});var fL=m((o0e,lL)=>{"use strict";c();var uL=es(),cL=aL(),Nee=cL(uL("String.prototype.indexOf"));lL.exports=function(e,r){var n=uL(e,!!r);return typeof n=="function"&&Nee(e,".prototype.")>-1?cL(n):n}});var hL=m(()=>{c()});var PL=m((f0e,DL)=>{c();var I_=typeof Map=="function"&&Map.prototype,g_=Object.getOwnPropertyDescriptor&&I_?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Xg=I_&&g_&&typeof g_.get=="function"?g_.get:null,dL=I_&&Map.prototype.forEach,S_=typeof Set=="function"&&Set.prototype,y_=Object.getOwnPropertyDescriptor&&S_?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Zg=S_&&y_&&typeof y_.get=="function"?y_.get:null,pL=S_&&Set.prototype.forEach,Oee=typeof WeakMap=="function"&&WeakMap.prototype,Pl=Oee?WeakMap.prototype.has:null,Dee=typeof WeakSet=="function"&&WeakSet.prototype,Rl=Dee?WeakSet.prototype.has:null,Pee=typeof WeakRef=="function"&&WeakRef.prototype,gL=Pee?WeakRef.prototype.deref:null,Ree=Boolean.prototype.valueOf,Bee=Object.prototype.toString,Lee=Function.prototype.toString,Fee=String.prototype.match,T_=String.prototype.slice,rs=String.prototype.replace,Mee=String.prototype.toUpperCase,yL=String.prototype.toLowerCase,SL=RegExp.prototype.test,mL=Array.prototype.concat,Rn=Array.prototype.join,Uee=Array.prototype.slice,wL=Math.floor,E_=typeof BigInt=="function"?BigInt.prototype.valueOf:null,m_=Object.getOwnPropertySymbols,v_=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,au=typeof Symbol=="function"&&typeof Symbol.iterator=="object",er=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===au||"symbol")?Symbol.toStringTag:null,TL=Object.prototype.propertyIsEnumerable,EL=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function vL(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||SL.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var n=t<0?-wL(-t):wL(t);if(n!==t){var i=String(n),s=T_.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 A_=hL(),AL=A_.custom,bL=xL(AL)?AL:null;DL.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 OL(e,s);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var u=String(e);return a?vL(e,u):u}if(typeof e=="bigint"){var l=String(e)+"n";return a?vL(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 b_(e)?"[Array]":"[Object]";var d=rte(s,n);if(typeof i>"u")i=[];else if(NL(i,e)>=0)return"[Circular]";function g(k,K,pe){if(K&&(i=Uee.call(i),i.push(K)),pe){var ue={depth:s.depth};return ts(s,"quoteStyle")&&(ue.quoteStyle=s.quoteStyle),t(k,ue,n+1,i)}return t(k,s,n+1,i)}if(typeof e=="function"&&!_L(e)){var w=$ee(e),E=Jg(e,g);return"[Function"+(w?": "+w:" (anonymous)")+"]"+(E.length>0?" { "+Rn.call(E,", ")+" }":"")}if(xL(e)){var T=au?rs.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):v_.call(e);return typeof e=="object"&&!au?Dl(T):T}if(Zee(e)){for(var D="<"+yL.call(String(e.nodeName)),B=e.attributes||[],W=0;W",D}if(b_(e)){if(e.length===0)return"[]";var U=Jg(e,g);return d&&!tte(U)?"["+__(U,d)+"]":"[ "+Rn.call(U,", ")+" ]"}if(Hee(e)){var A=Jg(e,g);return!("cause"in Error.prototype)&&"cause"in e&&!TL.call(e,"cause")?"{ ["+String(e)+"] "+Rn.call(mL.call("[cause]: "+g(e.cause),A),", ")+" }":A.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+Rn.call(A,", ")+" }"}if(typeof e=="object"&&o){if(bL&&typeof e[bL]=="function"&&A_)return A_(e,{depth:f-n});if(o!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(zee(e)){var I=[];return dL&&dL.call(e,function(k,K){I.push(g(K,e,!0)+" => "+g(k,e))}),IL("Map",Xg.call(e),I,d)}if(Jee(e)){var N=[];return pL&&pL.call(e,function(k){N.push(g(k,e))}),IL("Set",Zg.call(e),N,d)}if(Kee(e))return w_("WeakMap");if(Xee(e))return w_("WeakSet");if(Yee(e))return w_("WeakRef");if(kee(e))return Dl(g(Number(e)));if(Qee(e))return Dl(g(E_.call(e)));if(jee(e))return Dl(Ree.call(e));if(Gee(e))return Dl(g(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(e===global)return"{ [object globalThis] }";if(!Vee(e)&&!_L(e)){var _=Jg(e,g),S=EL?EL(e)===Object.prototype:e instanceof Object||e.constructor===Object,R=e instanceof Object?"":"null prototype",J=!S&&er&&Object(e)===e&&er in e?T_.call(ns(e),8,-1):R?"Object":"",Q=S||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",V=Q+(J||R?"["+Rn.call(mL.call([],J||[],R||[]),": ")+"] ":"");return _.length===0?V+"{}":d?V+"{"+__(_,d)+"}":V+"{ "+Rn.call(_,", ")+" }"}return String(e)};function CL(t,e,r){var n=(r.quoteStyle||e)==="double"?'"':"'";return n+t+n}function qee(t){return rs.call(String(t),/"/g,""")}function b_(t){return ns(t)==="[object Array]"&&(!er||!(typeof t=="object"&&er in t))}function Vee(t){return ns(t)==="[object Date]"&&(!er||!(typeof t=="object"&&er in t))}function _L(t){return ns(t)==="[object RegExp]"&&(!er||!(typeof t=="object"&&er in t))}function Hee(t){return ns(t)==="[object Error]"&&(!er||!(typeof t=="object"&&er in t))}function Gee(t){return ns(t)==="[object String]"&&(!er||!(typeof t=="object"&&er in t))}function kee(t){return ns(t)==="[object Number]"&&(!er||!(typeof t=="object"&&er in t))}function jee(t){return ns(t)==="[object Boolean]"&&(!er||!(typeof t=="object"&&er in t))}function xL(t){if(au)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!v_)return!1;try{return v_.call(t),!0}catch{}return!1}function Qee(t){if(!t||typeof t!="object"||!E_)return!1;try{return E_.call(t),!0}catch{}return!1}var Wee=Object.prototype.hasOwnProperty||function(t){return t in this};function ts(t,e){return Wee.call(t,e)}function ns(t){return Bee.call(t)}function $ee(t){if(t.name)return t.name;var e=Fee.call(Lee.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function NL(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 OL(T_.call(t,0,e.maxStringLength),e)+n}var i=rs.call(rs.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,ete);return CL(i,"single",e)}function ete(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":"")+Mee.call(e.toString(16))}function Dl(t){return"Object("+t+")"}function w_(t){return t+" { ? }"}function IL(t,e,r,n){var i=n?__(r,n):Rn.call(r,", ");return t+" ("+e+") {"+i+"}"}function tte(t){for(var e=0;e=0)return!1;return!0}function rte(t,e){var r;if(t.indent===" ")r=" ";else if(typeof t.indent=="number"&&t.indent>0)r=Rn.call(Array(t.indent+1)," ");else return null;return{base:r,prev:Rn.call(Array(e+1),r)}}function __(t,e){if(t.length===0)return"";var r=` +`+e.prev+e.base;return r+Rn.call(t,","+r)+` +`+e.prev}function Jg(t,e){var r=b_(t),n=[];if(r){n.length=t.length;for(var i=0;i{"use strict";c();var C_=es(),uu=fL(),nte=PL(),ite=C_("%TypeError%"),ey=C_("%WeakMap%",!0),ty=C_("%Map%",!0),ste=uu("WeakMap.prototype.get",!0),ote=uu("WeakMap.prototype.set",!0),ate=uu("WeakMap.prototype.has",!0),ute=uu("Map.prototype.get",!0),cte=uu("Map.prototype.set",!0),lte=uu("Map.prototype.has",!0),x_=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},fte=function(t,e){var r=x_(t,e);return r&&r.value},hte=function(t,e,r){var n=x_(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}},dte=function(t,e){return!!x_(t,e)};RL.exports=function(){var e,r,n,i={assert:function(s){if(!i.has(s))throw new ite("Side channel does not contain "+nte(s))},get:function(s){if(ey&&s&&(typeof s=="object"||typeof s=="function")){if(e)return ste(e,s)}else if(ty){if(r)return ute(r,s)}else if(n)return fte(n,s)},has:function(s){if(ey&&s&&(typeof s=="object"||typeof s=="function")){if(e)return ate(e,s)}else if(ty){if(r)return lte(r,s)}else if(n)return dte(n,s);return!1},set:function(s,o){ey&&s&&(typeof s=="object"||typeof s=="function")?(e||(e=new ey),ote(e,s,o)):ty?(r||(r=new ty),cte(r,s,o)):(n||(n={key:{},next:null}),hte(n,s,o))}};return i}});var ry=m((g0e,LL)=>{"use strict";c();var pte=String.prototype.replace,gte=/%20/g,N_={RFC1738:"RFC1738",RFC3986:"RFC3986"};LL.exports={default:N_.RFC3986,formatters:{RFC1738:function(t){return pte.call(t,gte,"+")},RFC3986:function(t){return String(t)}},RFC1738:N_.RFC1738,RFC3986:N_.RFC3986}});var D_=m((m0e,ML)=>{"use strict";c();var yte=ry(),O_=Object.prototype.hasOwnProperty,co=Array.isArray,Bn=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),mte=function(e){for(;e.length>1;){var r=e.pop(),n=r.obj[r.prop];if(co(n)){for(var i=[],s=0;s=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122||s===yte.RFC1738&&(l===40||l===41)){a+=o.charAt(u);continue}if(l<128){a=a+Bn[l];continue}if(l<2048){a=a+(Bn[192|l>>6]+Bn[128|l&63]);continue}if(l<55296||l>=57344){a=a+(Bn[224|l>>12]+Bn[128|l>>6&63]+Bn[128|l&63]);continue}u+=1,l=65536+((l&1023)<<10|o.charCodeAt(u)&1023),a+=Bn[240|l>>18]+Bn[128|l>>12&63]+Bn[128|l>>6&63]+Bn[128|l&63]}return a},bte=function(e){for(var r=[{obj:{o:e},prop:"o"}],n=[],i=0;i{"use strict";c();var VL=BL(),R_=D_(),Bl=ry(),Cte=Object.prototype.hasOwnProperty,UL={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,r){return e+"["+r+"]"},repeat:function(e){return e}},lo=Array.isArray,xte=String.prototype.split,Nte=Array.prototype.push,HL=function(t,e){Nte.apply(t,lo(e)?e:[e])},Ote=Date.prototype.toISOString,qL=Bl.default,Qt={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:R_.encode,encodeValuesOnly:!1,format:qL,formatter:Bl.formatters[qL],indices:!1,serializeDate:function(e){return Ote.call(e)},skipNulls:!1,strictNullHandling:!1},Dte=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},P_={},Pte=function t(e,r,n,i,s,o,a,u,l,f,d,g,w,E,T){for(var D=e,B=T,W=0,U=!1;(B=B.get(P_))!==void 0&&!U;){var A=B.get(e);if(W+=1,typeof A<"u"){if(A===W)throw new RangeError("Cyclic object value");U=!0}typeof B.get(P_)>"u"&&(W=0)}if(typeof a=="function"?D=a(r,D):D instanceof Date?D=f(D):n==="comma"&&lo(D)&&(D=R_.maybeMap(D,function(re){return re instanceof Date?f(re):re})),D===null){if(i)return o&&!w?o(r,Qt.encoder,E,"key",d):r;D=""}if(Dte(D)||R_.isBuffer(D)){if(o){var I=w?r:o(r,Qt.encoder,E,"key",d);if(n==="comma"&&w){for(var N=xte.call(String(D),","),_="",S=0;S"u")return R;var J;if(n==="comma"&&lo(D))J=[{value:D.length>0?D.join(",")||null:void 0}];else if(lo(a))J=a;else{var Q=Object.keys(D);J=u?Q.sort(u):Q}for(var V=0;V"u"?Qt.allowDots:!!e.allowDots,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Qt.charsetSentinel,delimiter:typeof e.delimiter>"u"?Qt.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:Qt.encode,encoder:typeof e.encoder=="function"?e.encoder:Qt.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:Qt.encodeValuesOnly,filter:s,format:n,formatter:i,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:Qt.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:Qt.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Qt.strictNullHandling}};GL.exports=function(t,e){var r=t,n=Rte(e),i,s;typeof n.filter=="function"?(s=n.filter,r=s("",r)):lo(n.filter)&&(s=n.filter,i=s);var o=[];if(typeof r!="object"||r===null)return"";var a;e&&e.arrayFormat in UL?a=e.arrayFormat:e&&"indices"in e?a=e.indices?"indices":"repeat":a="indices";var u=UL[a];i||(i=Object.keys(r)),n.sort&&i.sort(n.sort);for(var l=VL(),f=0;f0?w+g:""}});var WL=m((A0e,QL)=>{"use strict";c();var cu=D_(),B_=Object.prototype.hasOwnProperty,Bte=Array.isArray,Ut={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:cu.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},Lte=function(t){return t.replace(/&#(\d+);/g,function(e,r){return String.fromCharCode(parseInt(r,10))})},jL=function(t,e){return t&&typeof t=="string"&&e.comma&&t.indexOf(",")>-1?t.split(","):t},Fte="utf8=%26%2310003%3B",Mte="utf8=%E2%9C%93",Ute=function(e,r){var n={},i=r.ignoreQueryPrefix?e.replace(/^\?/,""):e,s=r.parameterLimit===1/0?void 0:r.parameterLimit,o=i.split(r.delimiter,s),a=-1,u,l=r.charset;if(r.charsetSentinel)for(u=0;u-1&&(E=Bte(E)?[E]:E),B_.call(n,w)?n[w]=cu.combine(n[w],E):n[w]=E}return n},qte=function(t,e,r,n){for(var i=n?e:jL(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},Vte=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&&B_.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"||cu.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}};QL.exports=function(t,e){var r=Hte(e);if(t===""||t===null||typeof t>"u")return r.plainObjects?Object.create(null):{};for(var n=typeof t=="string"?Ute(t,r):t,i=r.plainObjects?Object.create(null):{},s=Object.keys(n),o=0;o{"use strict";c();var Gte=kL(),kte=WL(),jte=ry();$L.exports={formats:jte,parse:kte,stringify:Gte}});var L_=m(ut=>{"use strict";c();Object.defineProperty(ut,"__esModule",{value:!0});ut.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED=ut.WALLET_PROVIDER_CALLBACK_PARAM=ut.WALLET_PROVIDER_SIGN_MESSAGE_URL=ut.WALLET_PROVIDER_GUARD_TRANSACTION_URL=ut.WALLET_PROVIDER_SIGN_TRANSACTION_URL=ut.WALLET_PROVIDER_SEND_TRANSACTION_URL=ut.WALLET_PROVIDER_DISCONNECT_URL=ut.WALLET_PROVIDER_CONNECT_URL=ut.WALLET_PROVIDER_TESTNET=ut.WALLET_PROVIDER_DEVNET=ut.WALLET_PROVIDER_MAINNET=void 0;ut.WALLET_PROVIDER_MAINNET="https://wallet.multiversx.com/dapp/init";ut.WALLET_PROVIDER_DEVNET="https://devnet-wallet.multiversx.com/dapp/init";ut.WALLET_PROVIDER_TESTNET="https://testnet-wallet.multiversx.com/dapp/init";ut.WALLET_PROVIDER_CONNECT_URL="hook/login";ut.WALLET_PROVIDER_DISCONNECT_URL="hook/logout";ut.WALLET_PROVIDER_SEND_TRANSACTION_URL="hook/transaction";ut.WALLET_PROVIDER_SIGN_TRANSACTION_URL="hook/sign";ut.WALLET_PROVIDER_GUARD_TRANSACTION_URL="hook/2fa";ut.WALLET_PROVIDER_SIGN_MESSAGE_URL="hook/sign-message";ut.WALLET_PROVIDER_CALLBACK_PARAM="walletProviderStatus";ut.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED="transactionsSigned"});var KL=m(lu=>{"use strict";c();Object.defineProperty(lu,"__esModule",{value:!0});lu.ErrCannotSignedMessage=lu.ErrCannotGetSignedTransactions=void 0;var F_=class extends Error{constructor(){super("Cannot get signed transaction(s)")}};lu.ErrCannotGetSignedTransactions=F_;var M_=class extends Error{constructor(){super("Cannot get signed message")}};lu.ErrCannotSignedMessage=M_});var YL=m(ny=>{"use strict";c();Object.defineProperty(ny,"__esModule",{value:!0});ny.PlainSignedTransaction=void 0;var U_=class{constructor(e){this.nonce=0,this.value="",this.receiver="",this.sender="",this.gasPrice=0,this.gasLimit=0,this.data="",this.chainID="",this.version=0,this.signature="",Object.assign(this,e)}};ny.PlainSignedTransaction=U_});var Ll=m(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())})},Qte=os&&os.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(os,"__esModule",{value:!0});os.WalletProvider=void 0;var q_=Qte(zL()),ss=L_(),V_=KL(),Wte=YL(),H_=class t{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=q_.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 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=q_.default.parse(window.location.search.slice(1));return t.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 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}};os.WalletProvider=H_});var G_=m((R0e,JL)=>{"use strict";c();JL.exports=function(e,r){return function(){for(var i=new Array(arguments.length),s=0;s{"use strict";c();var $te=G_(),fo=Object.prototype.toString;function Q_(t){return fo.call(t)==="[object Array]"}function k_(t){return typeof t>"u"}function zte(t){return t!==null&&!k_(t)&&t.constructor!==null&&!k_(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function Kte(t){return fo.call(t)==="[object ArrayBuffer]"}function Yte(t){return typeof FormData<"u"&&t instanceof FormData}function Jte(t){var e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&t.buffer instanceof ArrayBuffer,e}function Xte(t){return typeof t=="string"}function Zte(t){return typeof t=="number"}function XL(t){return t!==null&&typeof t=="object"}function iy(t){if(fo.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function ere(t){return fo.call(t)==="[object Date]"}function tre(t){return fo.call(t)==="[object File]"}function rre(t){return fo.call(t)==="[object Blob]"}function ZL(t){return fo.call(t)==="[object Function]"}function nre(t){return XL(t)&&ZL(t.pipe)}function ire(t){return typeof URLSearchParams<"u"&&t instanceof URLSearchParams}function sre(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function ore(){return typeof navigator<"u"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window<"u"&&typeof document<"u"}function W_(t,e){if(!(t===null||typeof t>"u"))if(typeof t!="object"&&(t=[t]),Q_(t))for(var r=0,n=t.length;r{"use strict";c();var fu=mr();function tF(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}rF.exports=function(e,r,n){if(!r)return e;var i;if(n)i=n(r);else if(fu.isURLSearchParams(r))i=r.toString();else{var s=[];fu.forEach(r,function(u,l){u===null||typeof u>"u"||(fu.isArray(u)?l=l+"[]":u=[u],fu.forEach(u,function(d){fu.isDate(d)?d=d.toISOString():fu.isObject(d)&&(d=JSON.stringify(d)),s.push(tF(l)+"="+tF(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 iF=m((q0e,nF)=>{"use strict";c();var cre=mr();function sy(){this.handlers=[]}sy.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};sy.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};sy.prototype.forEach=function(e){cre.forEach(this.handlers,function(n){n!==null&&e(n)})};nF.exports=sy});var oF=m((H0e,sF)=>{"use strict";c();var lre=mr();sF.exports=function(e,r){lre.forEach(e,function(i,s){s!==r&&s.toUpperCase()===r.toUpperCase()&&(e[r]=i,delete e[s])})}});var z_=m((k0e,aF)=>{"use strict";c();aF.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 K_=m((Q0e,uF)=>{"use strict";c();var fre=z_();uF.exports=function(e,r,n,i,s){var o=new Error(e);return fre(o,r,n,i,s)}});var lF=m(($0e,cF)=>{"use strict";c();var hre=K_();cF.exports=function(e,r,n){var i=n.config.validateStatus;!n.status||!i||i(n.status)?e(n):r(hre("Request failed with status code "+n.status,n.config,null,n.request,n))}});var hF=m((K0e,fF)=>{"use strict";c();var oy=mr();fF.exports=oy.isStandardBrowserEnv()?function(){return{write:function(r,n,i,s,o,a){var u=[];u.push(r+"="+encodeURIComponent(n)),oy.isNumber(i)&&u.push("expires="+new Date(i).toGMTString()),oy.isString(s)&&u.push("path="+s),oy.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 pF=m((J0e,dF)=>{"use strict";c();dF.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}});var yF=m((Z0e,gF)=>{"use strict";c();gF.exports=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e}});var wF=m((tme,mF)=>{"use strict";c();var dre=pF(),pre=yF();mF.exports=function(e,r){return e&&!dre(r)?pre(e,r):r}});var vF=m((nme,EF)=>{"use strict";c();var Y_=mr(),gre=["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"];EF.exports=function(e){var r={},n,i,s;return e&&Y_.forEach(e.split(` +`),function(a){if(s=a.indexOf(":"),n=Y_.trim(a.substr(0,s)).toLowerCase(),i=Y_.trim(a.substr(s+1)),n){if(r[n]&&gre.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 _F=m((sme,bF)=>{"use strict";c();var AF=mr();bF.exports=AF.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=AF.isString(o)?i(o):o;return a.protocol===n.protocol&&a.host===n.host}}():function(){return function(){return!0}}()});var Fl=m((ame,IF)=>{"use strict";c();function J_(t){this.message=t}J_.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};J_.prototype.__CANCEL__=!0;IF.exports=J_});var Z_=m((cme,SF)=>{"use strict";c();var ay=mr(),yre=lF(),mre=hF(),wre=$_(),Ere=wF(),vre=vF(),Are=_F(),X_=K_(),bre=Ml(),_re=Fl();SF.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)}ay.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 w=Ere(e.baseURL,e.url);f.open(e.method.toUpperCase(),wre(w,e.params,e.paramsSerializer),!0),f.timeout=e.timeout;function E(){if(f){var D="getAllResponseHeaders"in f?vre(f.getAllResponseHeaders()):null,B=!a||a==="text"||a==="json"?f.responseText:f.response,W={data:B,status:f.status,statusText:f.statusText,headers:D,config:e,request:f};yre(function(A){n(A),l()},function(A){i(A),l()},W),f=null}}if("onloadend"in f?f.onloadend=E:f.onreadystatechange=function(){!f||f.readyState!==4||f.status===0&&!(f.responseURL&&f.responseURL.indexOf("file:")===0)||setTimeout(E)},f.onabort=function(){f&&(i(X_("Request aborted",e,"ECONNABORTED",f)),f=null)},f.onerror=function(){i(X_("Network Error",e,null,f)),f=null},f.ontimeout=function(){var B=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",W=e.transitional||bre.transitional;e.timeoutErrorMessage&&(B=e.timeoutErrorMessage),i(X_(B,e,W.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",f)),f=null},ay.isStandardBrowserEnv()){var T=(e.withCredentials||Are(w))&&e.xsrfCookieName?mre.read(e.xsrfCookieName):void 0;T&&(o[e.xsrfHeaderName]=T)}"setRequestHeader"in f&&ay.forEach(o,function(B,W){typeof s>"u"&&W.toLowerCase()==="content-type"?delete o[W]:f.setRequestHeader(W,B)}),ay.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(D){f&&(i(!D||D&&D.type?new _re("canceled"):D),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 Ml=m((fme,xF)=>{"use strict";c();var Wt=mr(),TF=oF(),Ire=z_(),Sre={"Content-Type":"application/x-www-form-urlencoded"};function CF(t,e){!Wt.isUndefined(t)&&Wt.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function Tre(){var t;return typeof XMLHttpRequest<"u"?t=Z_():typeof p.default<"u"&&Object.prototype.toString.call(p.default)==="[object process]"&&(t=Z_()),t}function Cre(t,e,r){if(Wt.isString(t))try{return(e||JSON.parse)(t),Wt.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}var uy={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:Tre(),transformRequest:[function(e,r){return TF(r,"Accept"),TF(r,"Content-Type"),Wt.isFormData(e)||Wt.isArrayBuffer(e)||Wt.isBuffer(e)||Wt.isStream(e)||Wt.isFile(e)||Wt.isBlob(e)?e:Wt.isArrayBufferView(e)?e.buffer:Wt.isURLSearchParams(e)?(CF(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):Wt.isObject(e)||r&&r["Content-Type"]==="application/json"?(CF(r,"application/json"),Cre(e)):e}],transformResponse:[function(e){var r=this.transitional||uy.transitional,n=r&&r.silentJSONParsing,i=r&&r.forcedJSONParsing,s=!n&&this.responseType==="json";if(s||i&&Wt.isString(e)&&e.length)try{return JSON.parse(e)}catch(o){if(s)throw o.name==="SyntaxError"?Ire(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, */*"}}};Wt.forEach(["delete","get","head"],function(e){uy.headers[e]={}});Wt.forEach(["post","put","patch"],function(e){uy.headers[e]=Wt.merge(Sre)});xF.exports=uy});var OF=m((dme,NF)=>{"use strict";c();var xre=mr(),Nre=Ml();NF.exports=function(e,r,n){var i=this||Nre;return xre.forEach(n,function(o){e=o.call(i,e,r)}),e}});var eI=m((gme,DF)=>{"use strict";c();DF.exports=function(e){return!!(e&&e.__CANCEL__)}});var BF=m((mme,RF)=>{"use strict";c();var PF=mr(),tI=OF(),Ore=eI(),Dre=Ml(),Pre=Fl();function rI(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Pre("canceled")}RF.exports=function(e){rI(e),e.headers=e.headers||{},e.data=tI.call(e,e.data,e.headers,e.transformRequest),e.headers=PF.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),PF.forEach(["delete","get","head","post","put","patch","common"],function(i){delete e.headers[i]});var r=e.adapter||Dre.adapter;return r(e).then(function(i){return rI(e),i.data=tI.call(e,i.data,i.headers,e.transformResponse),i},function(i){return Ore(i)||(rI(e),i&&i.response&&(i.response.data=tI.call(e,i.response.data,i.response.headers,e.transformResponse))),Promise.reject(i)})}});var nI=m((Eme,LF)=>{"use strict";c();var Ir=mr();LF.exports=function(e,r){r=r||{};var n={};function i(f,d){return Ir.isPlainObject(f)&&Ir.isPlainObject(d)?Ir.merge(f,d):Ir.isPlainObject(d)?Ir.merge({},d):Ir.isArray(d)?d.slice():d}function s(f){if(Ir.isUndefined(r[f])){if(!Ir.isUndefined(e[f]))return i(void 0,e[f])}else return i(e[f],r[f])}function o(f){if(!Ir.isUndefined(r[f]))return i(void 0,r[f])}function a(f){if(Ir.isUndefined(r[f])){if(!Ir.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 Ir.forEach(Object.keys(e).concat(Object.keys(r)),function(d){var g=l[d]||s,w=g(d);Ir.isUndefined(w)&&g!==u||(n[d]=w)}),n}});var iI=m((Ame,FF)=>{c();FF.exports={version:"0.24.0"}});var qF=m((_me,UF)=>{"use strict";c();var Rre=iI().version,sI={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){sI[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var MF={};sI.transitional=function(e,r,n){function i(s,o){return"[Axios v"+Rre+"] 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&&!MF[o]&&(MF[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 Bre(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)}}UF.exports={assertOptions:Bre,validators:sI}});var QF=m((Sme,jF)=>{"use strict";c();var GF=mr(),Lre=$_(),VF=iF(),HF=BF(),cy=nI(),kF=qF(),hu=kF.validators;function Ul(t){this.defaults=t,this.interceptors={request:new VF,response:new VF}}Ul.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=cy(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&&kF.assertOptions(r,{silentJSONParsing:hu.transitional(hu.boolean),forcedJSONParsing:hu.transitional(hu.boolean),clarifyTimeoutError:hu.transitional(hu.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=[HF,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=HF(u)}catch(d){return Promise.reject(d)}for(;s.length;)o=o.then(s.shift(),s.shift());return o};Ul.prototype.getUri=function(e){return e=cy(this.defaults,e),Lre(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};GF.forEach(["delete","get","head","options"],function(e){Ul.prototype[e]=function(r,n){return this.request(cy(n||{},{method:e,url:r,data:(n||{}).data}))}});GF.forEach(["post","put","patch"],function(e){Ul.prototype[e]=function(r,n,i){return this.request(cy(i||{},{method:e,url:r,data:n}))}});jF.exports=Ul});var $F=m((Cme,WF)=>{"use strict";c();var Fre=Fl();function du(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();zF.exports=function(e){return function(n){return e.apply(null,n)}}});var JF=m((Dme,YF)=>{"use strict";c();YF.exports=function(e){return typeof e=="object"&&e.isAxiosError===!0}});var eM=m((Rme,oI)=>{"use strict";c();var XF=mr(),Mre=G_(),ly=QF(),Ure=nI(),qre=Ml();function ZF(t){var e=new ly(t),r=Mre(ly.prototype.request,e);return XF.extend(r,ly.prototype,e),XF.extend(r,e),r.create=function(i){return ZF(Ure(t,i))},r}var Ln=ZF(qre);Ln.Axios=ly;Ln.Cancel=Fl();Ln.CancelToken=$F();Ln.isCancel=eI();Ln.VERSION=iI().version;Ln.all=function(e){return Promise.all(e)};Ln.spread=KF();Ln.isAxiosError=JF();oI.exports=Ln;oI.exports.default=Ln});var rM=m((Lme,tM)=>{c();tM.exports=eM()});var nM=m(fy=>{"use strict";c();Object.defineProperty(fy,"__esModule",{value:!0});fy.NativeAuthClientConfig=void 0;var aI=class{constructor(){this.origin=typeof window<"u"&&typeof window.location<"u"?window.location.hostname:"",this.apiUrl="https://api.multiversx.com",this.expirySeconds=60*60*24}};fy.NativeAuthClientConfig=aI});var cI=m(pu=>{"use strict";c();var ho=pu&&pu.__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(pu,"__esModule",{value:!0});pu.NativeAuthClient=void 0;var Vre=rM(),Hre=nM(),uI=class{constructor(e){this.config=Object.assign(new Hre.NativeAuthClientConfig,e)}getToken(e,r,n){let i=this.encodeValue(e),s=this.encodeValue(r);return`${i}.${s}.${n}`}initialize(e={}){return ho(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 ho(this,void 0,void 0,function*(){return this.config.gatewayUrl?yield this.getCurrentBlockHashWithGateway():yield this.getCurrentBlockHashWithApi()})}getCurrentBlockHashWithGateway(){return ho(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 ho(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 ho(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 ho(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 ho(this,void 0,void 0,function*(){return yield Vre.default.get(e,{headers:this.config.extraRequestHeaders})})}};pu.NativeAuthClient=uI});var uM=m(py=>{"use strict";c();Object.defineProperty(py,"__esModule",{value:!0});py.TransactionStatus=void 0;var lI=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}};py.TransactionStatus=lI});var mu=m(Vt=>{"use strict";c();var Gre=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]}),kre=Vt&&Vt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jre=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)&&Gre(e,t,r);return kre(e,t),e};Object.defineProperty(Vt,"__esModule",{value:!0});Vt.zeroPadStringIfOddLength=Vt.isPaddedHex=Vt.numberToPaddedHex=Vt.Nonce=Vt.Address=void 0;var cM=jre(Rm()),Qre="erd",fI=class t{constructor(e){this.value=e}static fromPubkey(e){let r=cM.toWords(e),n=cM.encode(Qre,r);return new t(n)}bech32(){return this.value}toString(){return this.bech32()}};Vt.Address=fI;var hI=class{constructor(e){this.value=e}valueOf(){return this.value}hex(){return lM(this.value)}};Vt.Nonce=hI;function lM(t){let e=t.toString(16);return fM(e)}Vt.numberToPaddedHex=lM;function Wre(t){t=t||"";let e=h.Buffer.from(t,"hex").toString("hex");return t.toUpperCase()==e.toUpperCase()}Vt.isPaddedHex=Wre;function fM(t){return t=t||"",t.length%2==1?"0"+t:t}Vt.zeroPadStringIfOddLength=fM});var dM=m(gy=>{"use strict";c();Object.defineProperty(gy,"__esModule",{value:!0});gy.TransactionReceipt=void 0;var hM=mu(),dI=class t{constructor(){this.value="",this.sender=new hM.Address(""),this.data="",this.hash=""}static fromHttpResponse(e){let r=new t;return r.value=(e.value||0).toString(),r.sender=new hM.Address(e.sender),r.data=e.data,r.hash=e.txHash,r}};gy.TransactionReceipt=dI});var pM=m(Fn=>{"use strict";c();Object.defineProperty(Fn,"__esModule",{value:!0});Fn.ErrContractQuery=Fn.ErrNetworkProvider=Fn.ErrUnexpectedCondition=Fn.Err=void 0;var wu=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};Fn.Err=wu;var pI=class extends wu{constructor(e){super(`Unexpected condition: [${e}]`)}};Fn.ErrUnexpectedCondition=pI;var gI=class extends wu{constructor(e,r,n){let i=`Request error on url [${e}]: [${r}]`;super(i,n)}};Fn.ErrNetworkProvider=gI;var yI=class extends wu{constructor(e){super(e.message.replace("executeQuery:",""))}};Fn.ErrContractQuery=yI});var yM=m(cs=>{"use strict";c();Object.defineProperty(cs,"__esModule",{value:!0});cs.TransactionEventTopic=cs.TransactionEventData=cs.TransactionEvent=void 0;var gM=mu(),mI=class t{constructor(e){this.address=new gM.Address(""),this.identifier="",this.topics=[],this.dataPayload=new ql(h.Buffer.from("","utf8")),this.data="",Object.assign(this,e)}static fromHttpResponse(e){let r=new t;r.address=new gM.Address(e.address),r.identifier=e.identifier||"",r.topics=(e.topics||[]).map(i=>new yy(i));let n=h.Buffer.from(e.data||"","base64");return r.dataPayload=new ql(n),r.data=n.toString(),r}findFirstOrNoneTopic(e){return this.topics.filter(r=>e(r))[0]}getLastTopic(){return this.topics[this.topics.length-1]}};cs.TransactionEvent=mI;var ql=class{constructor(e){this.raw=e}toString(){return this.raw.toString("utf8")}hex(){return this.raw.toString("hex")}valueOf(){return this.raw}};cs.TransactionEventData=ql;var yy=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}};cs.TransactionEventTopic=yy});var EI=m(my=>{"use strict";c();Object.defineProperty(my,"__esModule",{value:!0});my.TransactionLogs=void 0;var $re=pM(),mM=mu(),zre=yM(),wI=class t{constructor(e){this.address=new mM.Address(""),this.events=[],Object.assign(this,e)}static fromHttpResponse(e){let r=new t;return r.address=new mM.Address(e.address),r.events=(e.events||[]).map(n=>zre.TransactionEvent.fromHttpResponse(n)),r}findSingleOrNoneEvent(e,r){let n=this.findEvents(e,r);if(n.length>1)throw new $re.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}};my.TransactionLogs=wI});var EM=m(Eu=>{"use strict";c();Object.defineProperty(Eu,"__esModule",{value:!0});Eu.ContractResultItem=Eu.ContractResults=void 0;var wM=EI(),wy=mu(),vI=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=>Vl.fromProxyHttpResponse(n));return new t(r)}static fromApiHttpResponse(e){let r=e.map(n=>Vl.fromApiHttpResponse(n));return new t(r)}};Eu.ContractResults=vI;var Vl=class t{constructor(e){this.hash="",this.nonce=0,this.value="",this.receiver=new wy.Address(""),this.sender=new wy.Address(""),this.data="",this.previousHash="",this.originalHash="",this.gasLimit=0,this.gasPrice=0,this.callType=0,this.returnMessage="",this.logs=new wM.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 wy.Address(e.receiver),r.sender=new wy.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=wM.TransactionLogs.fromHttpResponse(e.logs||{}),r}};Eu.ContractResultItem=Vl});var vM=m(ls=>{"use strict";c();var Kre=ls&&ls.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ls,"__esModule",{value:!0});ls.EsdtContractAddress=ls.MaxUint64AsBigNumber=void 0;var Yre=Kre(Gt()),Jre=mu();ls.MaxUint64AsBigNumber=new Yre.default("18446744073709551615");ls.EsdtContractAddress=new Jre.Address("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u")});var AM=m(vu=>{"use strict";c();var Xre=vu&&vu.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(vu,"__esModule",{value:!0});vu.ContractQueryResponse=void 0;var Zre=Xre(Gt()),ene=vM(),AI=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 Zre.default(e.gasRemaining||e.GasRemaining||0),o=ene.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()}}};vu.ContractQueryResponse=AI});var bM=m(Ey=>{"use strict";c();Object.defineProperty(Ey,"__esModule",{value:!0});Ey.ContractQueryRequest=void 0;var bI=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}};Ey.ContractQueryRequest=bI});var RM=m((zwe,PM)=>{c();PM.exports=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}});var fs=m(go=>{c();var _I,tne=[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];go.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};go.getSymbolTotalCodewords=function(e){return tne[e]};go.getBCHDigit=function(t){let e=0;for(;t!==0;)e++,t>>>=1;return e};go.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');_I=e};go.isKanjiModeEnabled=function(){return typeof _I<"u"};go.toSJIS=function(e){return _I(e)}});var by=m(kr=>{c();kr.L={bit:1};kr.M={bit:0};kr.Q={bit:3};kr.H={bit:2};function rne(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return kr.L;case"m":case"medium":return kr.M;case"q":case"quartile":return kr.Q;case"h":case"high":return kr.H;default:throw new Error("Unknown EC Level: "+t)}}kr.isValid=function(e){return e&&typeof e.bit<"u"&&e.bit>=0&&e.bit<4};kr.from=function(e,r){if(kr.isValid(e))return e;try{return rne(e)}catch{return r}}});var FM=m((eEe,LM)=>{c();function BM(){this.buffer=[],this.length=0}BM.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++}};LM.exports=BM});var UM=m((rEe,MM)=>{c();function Hl(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)}Hl.prototype.set=function(t,e,r,n){let i=t*this.size+e;this.data[i]=r,n&&(this.reservedBit[i]=!0)};Hl.prototype.get=function(t,e){return this.data[t*this.size+e]};Hl.prototype.xor=function(t,e,r){this.data[t*this.size+e]^=r};Hl.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};MM.exports=Hl});var qM=m(_y=>{c();var nne=fs().getSymbolSize;_y.getRowColCoords=function(e){if(e===1)return[];let r=Math.floor(e/7)+2,n=nne(e),i=n===145?26:Math.ceil((n-13)/(2*r-2))*2,s=[n-7];for(let o=1;o{c();var ine=fs().getSymbolSize,VM=7;HM.getPositions=function(e){let r=ine(e);return[[0,0],[r-VM,0],[0,r-VM]]}});var kM=m(et=>{c();et.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var yo={N1:3,N2:3,N3:40,N4:10};et.isValid=function(e){return e!=null&&e!==""&&!isNaN(e)&&e>=0&&e<=7};et.from=function(e){return et.isValid(e)?parseInt(e,10):void 0};et.getPenaltyN1=function(e){let r=e.size,n=0,i=0,s=0,o=null,a=null;for(let u=0;u=5&&(n+=yo.N1+(i-5)),o=f,i=1),f=e.get(l,u),f===a?s++:(s>=5&&(n+=yo.N1+(s-5)),a=f,s=1)}i>=5&&(n+=yo.N1+(i-5)),s>=5&&(n+=yo.N1+(s-5))}return n};et.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*yo.N3};et.getPenaltyN4=function(e){let r=0,n=e.data.length;for(let s=0;s{c();var hs=by(),Iy=[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],Sy=[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 hs.L:return Iy[(e-1)*4+0];case hs.M:return Iy[(e-1)*4+1];case hs.Q:return Iy[(e-1)*4+2];case hs.H:return Iy[(e-1)*4+3];default:return}};II.getTotalCodewordsCount=function(e,r){switch(r){case hs.L:return Sy[(e-1)*4+0];case hs.M:return Sy[(e-1)*4+1];case hs.Q:return Sy[(e-1)*4+2];case hs.H:return Sy[(e-1)*4+3];default:return}}});var jM=m(Cy=>{c();var Gl=new Uint8Array(512),Ty=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)Gl[r]=e,Ty[e]=r,e<<=1,e&256&&(e^=285);for(let r=255;r<512;r++)Gl[r]=Gl[r-255]})();Cy.log=function(e){if(e<1)throw new Error("log("+e+")");return Ty[e]};Cy.exp=function(e){return Gl[e]};Cy.mul=function(e,r){return e===0||r===0?0:Gl[Ty[e]+Ty[r]]}});var QM=m(kl=>{c();var TI=jM();kl.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 WM=QM();function CI(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}CI.prototype.initialize=function(e){this.degree=e,this.genPoly=WM.generateECPolynomial(this.degree)};CI.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=WM.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};$M.exports=CI});var xI=m(KM=>{c();KM.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}});var NI=m(fi=>{c();var YM="[0-9]+",one="[A-Z $%*+\\-./:]+",jl="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";jl=jl.replace(/u/g,"\\u");var ane="(?:(?![A-Z0-9 $%*+\\-./:]|"+jl+`)(?:.|[\r +]))+`;fi.KANJI=new RegExp(jl,"g");fi.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");fi.BYTE=new RegExp(ane,"g");fi.NUMERIC=new RegExp(YM,"g");fi.ALPHANUMERIC=new RegExp(one,"g");var une=new RegExp("^"+jl+"$"),cne=new RegExp("^"+YM+"$"),lne=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");fi.testKanji=function(e){return une.test(e)};fi.testNumeric=function(e){return cne.test(e)};fi.testAlphanumeric=function(e){return lne.test(e)}});var ds=m(Nt=>{c();var fne=xI(),OI=NI();Nt.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]};Nt.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]};Nt.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]};Nt.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]};Nt.MIXED={bit:-1};Nt.getCharCountIndicator=function(e,r){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!fne.isValid(r))throw new Error("Invalid version: "+r);return r>=1&&r<10?e.ccBits[0]:r<27?e.ccBits[1]:e.ccBits[2]};Nt.getBestModeForData=function(e){return OI.testNumeric(e)?Nt.NUMERIC:OI.testAlphanumeric(e)?Nt.ALPHANUMERIC:OI.testKanji(e)?Nt.KANJI:Nt.BYTE};Nt.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")};Nt.isValid=function(e){return e&&e.bit&&e.ccBits};function hne(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return Nt.NUMERIC;case"alphanumeric":return Nt.ALPHANUMERIC;case"kanji":return Nt.KANJI;case"byte":return Nt.BYTE;default:throw new Error("Unknown mode: "+t)}}Nt.from=function(e,r){if(Nt.isValid(e))return e;try{return hne(e)}catch{return r}}});var tU=m(mo=>{c();var xy=fs(),dne=SI(),JM=by(),ps=ds(),DI=xI(),ZM=7973,XM=xy.getBCHDigit(ZM);function pne(t,e,r){for(let n=1;n<=40;n++)if(e<=mo.getCapacity(n,r,t))return n}function eU(t,e){return ps.getCharCountIndicator(t,e)+4}function gne(t,e){let r=0;return t.forEach(function(n){let i=eU(n.mode,e);r+=i+n.getBitsLength()}),r}function yne(t,e){for(let r=1;r<=40;r++)if(gne(t,r)<=mo.getCapacity(r,e,ps.MIXED))return r}mo.from=function(e,r){return DI.isValid(e)?parseInt(e,10):r};mo.getCapacity=function(e,r,n){if(!DI.isValid(e))throw new Error("Invalid QR Code version");typeof n>"u"&&(n=ps.BYTE);let i=xy.getSymbolTotalCodewords(e),s=dne.getTotalCodewordsCount(e,r),o=(i-s)*8;if(n===ps.MIXED)return o;let a=o-eU(n,e);switch(n){case ps.NUMERIC:return Math.floor(a/10*3);case ps.ALPHANUMERIC:return Math.floor(a/11*2);case ps.KANJI:return Math.floor(a/13);case ps.BYTE:default:return Math.floor(a/8)}};mo.getBestVersionForData=function(e,r){let n,i=JM.from(r,JM.M);if(Array.isArray(e)){if(e.length>1)return yne(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return pne(n.mode,n.getLength(),i)};mo.getEncodedBits=function(e){if(!DI.isValid(e)||e<7)throw new Error("Invalid QR Code version");let r=e<<12;for(;xy.getBCHDigit(r)-XM>=0;)r^=ZM<{c();var PI=fs(),nU=1335,mne=21522,rU=PI.getBCHDigit(nU);iU.getEncodedBits=function(e,r){let n=e.bit<<3|r,i=n<<10;for(;PI.getBCHDigit(i)-rU>=0;)i^=nU<{c();var wne=ds();function Au(t){this.mode=wne.NUMERIC,this.data=t.toString()}Au.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)};Au.prototype.getLength=function(){return this.data.length};Au.prototype.getBitsLength=function(){return Au.getBitsLength(this.data.length)};Au.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))};oU.exports=Au});var cU=m((OEe,uU)=>{c();var Ene=ds(),RI=["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 bu(t){this.mode=Ene.ALPHANUMERIC,this.data=t}bu.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)};bu.prototype.getLength=function(){return this.data.length};bu.prototype.getBitsLength=function(){return bu.getBitsLength(this.data.length)};bu.prototype.write=function(e){let r;for(r=0;r+2<=this.data.length;r+=2){let n=RI.indexOf(this.data[r])*45;n+=RI.indexOf(this.data[r+1]),e.put(n,11)}this.data.length%2&&e.put(RI.indexOf(this.data[r]),6)};uU.exports=bu});var fU=m((PEe,lU)=>{"use strict";c();lU.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 dU=m((BEe,hU)=>{c();var vne=fU(),Ane=ds();function _u(t){this.mode=Ane.BYTE,typeof t=="string"&&(t=vne(t)),this.data=new Uint8Array(t)}_u.getBitsLength=function(e){return e*8};_u.prototype.getLength=function(){return this.data.length};_u.prototype.getBitsLength=function(){return _u.getBitsLength(this.data.length)};_u.prototype.write=function(t){for(let e=0,r=this.data.length;e{c();var bne=ds(),_ne=fs();function Iu(t){this.mode=bne.KANJI,this.data=t}Iu.getBitsLength=function(e){return e*13};Iu.prototype.getLength=function(){return this.data.length};Iu.prototype.getBitsLength=function(){return Iu.getBitsLength(this.data.length)};Iu.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)}};pU.exports=Iu});var yU=m((UEe,BI)=>{"use strict";c();var Ql={single_source_shortest_paths:function(t,e,r){var n={},i={};i[e]=0;var s=Ql.PriorityQueue.make();s.push(e,0);for(var o,a,u,l,f,d,g,w,E;!s.empty();){o=s.pop(),a=o.value,l=o.cost,f=t[a]||{};for(u in f)f.hasOwnProperty(u)&&(d=f[u],g=l+d,w=i[u],E=typeof i[u]>"u",(E||w>g)&&(i[u]=g,s.push(u,g),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=Ql.single_source_shortest_paths(t,e,r);return Ql.extract_shortest_path_from_predecessor_list(n,r)},PriorityQueue:{make:function(t){var e=Ql.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 BI<"u"&&(BI.exports=Ql)});var IU=m(Su=>{c();var He=ds(),EU=aU(),vU=cU(),AU=dU(),bU=gU(),Wl=NI(),Ny=fs(),Ine=yU();function mU(t){return unescape(encodeURIComponent(t)).length}function $l(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 _U(t){let e=$l(Wl.NUMERIC,He.NUMERIC,t),r=$l(Wl.ALPHANUMERIC,He.ALPHANUMERIC,t),n,i;return Ny.isKanjiModeEnabled()?(n=$l(Wl.BYTE,He.BYTE,t),i=$l(Wl.KANJI,He.KANJI,t)):(n=$l(Wl.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 LI(t,e){switch(e){case He.NUMERIC:return EU.getBitsLength(t);case He.ALPHANUMERIC:return vU.getBitsLength(t);case He.KANJI:return bU.getBitsLength(t);case He.BYTE:return AU.getBitsLength(t)}}function Sne(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 Tne(t){let e=[];for(let r=0;r{c();var Dy=fs(),FI=by(),xne=FM(),Nne=UM(),One=qM(),Dne=GM(),qI=kM(),VI=SI(),Pne=zM(),Oy=tU(),Rne=sU(),Bne=ds(),MI=IU();function Lne(t,e){let r=t.size,n=Dne.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 Fne(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 UI(t,e,r){let n=t.size,i=Rne.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 qne(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 Vne(t,e,r){let n=new xne;r.forEach(function(u){n.put(u.mode.bit,4),n.put(u.getLength(),Bne.getCharCountIndicator(u.mode,t)),u.write(n)});let i=Dy.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&&Qre(u,e),Wre(u,o),isNaN(n)&&(n=bI.getBestMask(u,AI.bind(null,u,r))),bI.applyMask(n,u),AI(u,r,n),{modules:u,version:e,errorCorrectionLevel:r,maskPattern:n,segments:i}}zM.create=function(e,r){if(typeof e>"u"||e==="")throw new Error("No input text");let n=EI.M,i,s;return typeof r<"u"&&(n=EI.from(r.errorCorrectionLevel,EI.M),i=vy.from(r.version),s=bI.from(r.maskPattern),r.toSJISFunc&&Ay.setToSJISFunction(r.toSJISFunc)),Kre(e,i,n,s)}});var II=m(lo=>{c();function KM(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("")}}lo.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:KM(e.color.dark||"#000000ff"),light:KM(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}};lo.getScale=function(e,r){return r.width&&r.width>=e+r.margin*2?r.width/(e+r.margin*2):r.scale};lo.getImageWidth=function(e,r){let n=lo.getScale(e,r);return Math.floor((e+r.margin*2)*n)};lo.qrToImageData=function(e,r,n){let i=r.modules.size,s=r.modules.data,o=lo.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 SI=II();function Yre(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 Jre(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}by.render=function(e,r,n){let i=n,s=r;typeof i>"u"&&(!r||!r.getContext)&&(i=r,r=void 0),r||(s=Jre()),i=SI.getOptions(i);let o=SI.getImageWidth(e.modules.size,i),a=s.getContext("2d"),u=a.createImageData(o,o);return SI.qrToImageData(u.data,e,i),Yre(a,s,o),a.putImageData(u,0,0),s};by.renderToDataURL=function(e,r,n){let i=n;typeof i>"u"&&(!r||!r.getContext)&&(i=r,r=void 0),i||(i={});let s=by.render(e,r,i),o=i.type||"image/png",a=i.rendererOpts||{};return s.toDataURL(o,a.quality)}});var ZM=m(XM=>{c();var Xre=II();function JM(t,e){let r=t.a/255,n=e+'="'+t.hex+'"';return r<1?n+" "+e+'-opacity="'+r.toFixed(2).slice(1)+'"':n}function TI(t,e,r){let n=t+e;return typeof r<"u"&&(n+=" "+r),n}function Zre(t,e,r){let n="",i=0,s=!1,o=0;for(let a=0;a0&&u>0&&t[a-1]||(n+=s?TI("M",u+r,.5+l+r):TI("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 tU=m(Hl=>{c();var ene=tM(),CI=$M(),eU=YM(),tne=ZM();function xI(t,e,r,n,i){let s=[].slice.call(arguments,1),o=s.length,a=typeof s[o-1]=="function";if(!a&&!ene())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=CI.create(r,n);u(t(f,e,n))}catch(f){l(f)}})}try{let u=CI.create(r,n);i(null,t(u,e,n))}catch(u){i(u)}}Hl.create=CI.create;Hl.toCanvas=xI.bind(null,eU.render);Hl.toDataURL=xI.bind(null,eU.renderToDataURL);Hl.toString=xI.bind(null,function(t,e,r){return tne.render(t,r)})});var OI=m(fs=>{"use strict";c();var dne=fs&&fs.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),dU=fs&&fs.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&dne(e,t,r)};Object.defineProperty(fs,"__esModule",{value:!0});dU(xl(),fs);dU(w_(),fs)});c();var gne=_e(um(),1),yne=_e(jw(),1),mne=_e(Qw(),1),wne=_e(ht(),1),Ene=_e(Yo(),1),vne=_e(mn(),1),Ane=_e(qn(),1),bne=_e(Wh(),1),_ne=_e(ev(),1),Ine=_e(gc(),1),TU=_e(di(),1),Rn=_e(Xu(),1),CU=_e(Bu(),1),xU=_e(Io(),1);c();c();var bO=_e(nv(),1);c();c();var wd="elvenjs_state",EO="https://devnet-api.multiversx.com";var Di="/dapp/init",Ed="devnet",vO="https://maiar.page.link/?apn=com.elrond.maiar.wallet&isi=1519405832&ibi=com.elrond.maiar.wallet&link=https://xportal.com/",AO=["wss://relay.walletconnect.com"],Fr={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(wd);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(wd,JSON.stringify(r))},clear(){localStorage.removeItem(wd)}};var vd=async()=>{let t=bO.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 bU=_e(nv(),1),_U=_e(bl(),1),IU=_e(xl(),1),SU=_e(W_(),1);c();var xF=_e(bl(),1);c();c();var Te=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 rs=(i=>(i.ledger="ledger",i.mobile="mobile",i.webWallet="web-wallet",i.browserExtension="browser-extension",i))(rs||{});var hu=async t=>{if(!t.dappProvider)throw new Error("Error: Logout failed: There is no active session!");Te.run("onLoginPending");let e=await t.dappProvider.logout();return e&&(Se.clear(),Te.run("onLogout")),e};c();var TF=_e(ht(),1),CF=_e(Yo(),1);c();var qt=t=>typeof t=="string"?t.toUpperCase():t instanceof Error?t.message:`Error: ${JSON.stringify(t)}`;c();var du=()=>new Date().setHours(new Date().getHours()+24),ry=t=>Date.now()>t;var ns=async t=>{let e=Se.get("address"),r=Se.get("expires");if(!(r&&ry(r))&&e&&t.networkProvider){let i=new TF.Address(e),s=new CF.Account(i);try{let o=await t.networkProvider.getAccount(i),a=await t.networkProvider.getGuardianData(i);Se.set("address",e),Se.set("activeGuardian",a.guarded&&a.activeGuardian?.address?a.activeGuardian.address:""),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 ny(t){return t[Math.floor(Math.random()*t.length)]}var NF=async t=>{if(!t.initOptions.walletConnectV2ProjectId||!t.initOptions.chainType)return;let e={onClientLogin:()=>{ns(t),Te.run("onLoggedIn")},onClientLogout:()=>hu(t),onClientEvent:i=>{console.log("wc2 session event: ",i)}},r=ny(t.initOptions.walletConnectV2RelayAddresses),n=new xF.WalletConnectV2Provider(e,Fr[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 QF=_e(Gt(),1),ly=_e(ht(),1),WF=_e(OF(),1),zF=_e(LF(),1),$F=_e(rI(),1),KF=_e(HF(),1),YF=_e(jF(),1),JF=_e(kF(),1),XF=_e(yc(),1);var fy=class{constructor({apiUrl:e,chainType:r,apiTimeout:n}){this.chainType=r||Ed,this.apiUrl=e||Fr[this.chainType]?.apiAddress,this.apiTimeout=n||Fr[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 ly.Address(r?.address||""),nonce:Number(r?.nonce||0),balance:new QF.default(r?.balance||0),code:r?.code||"",userName:r?.username||""}}async getGuardianData(e){let r=await this.apiGet(`address/${e.bech32()}/guardian-data`);return{guarded:r?.data?.guardianData?.guarded||!1,activeGuardian:r?.data?.guardianData?.activeGuardian,pendingGuardian:r?.data?.guardianData?.pendingGuardian}}async getTransaction(e){let r=await this.apiGet(`transactions/${e}`),n=new WF.TransactionStatus(r.status);return{hash:e,type:r.type||"",nonce:r.nonce||0,round:r.round,epoch:r.epoch||0,value:(r.value||0).toString(),sender:new ly.Address(r.sender),receiver:new ly.Address(r.receiver),gasPrice:r.gasPrice||0,gasLimit:r.gasLimit||0,data:h.Buffer.from(r.data||"","base64"),status:n,timestamp:r.timestamp||0,blockNonce:r.blockNonce||0,hyperblockNonce:r.hyperblockNonce||0,hyperblockHash:r.hyperblockHash||"",receipt:zF.TransactionReceipt.fromHttpResponse(r.receipt||{}),logs:$F.TransactionLogs.fromHttpResponse(r.logs||{}),contractResults:KF.ContractResults.fromApiHttpResponse(r.results||[]),isCompleted:!n.isPending()}}async queryContract({address:e,func:r,args:n,value:i,caller:s}){try{let o=new XF.Query({address:e,func:r,args:n,value:i,caller:s}),a=new JF.ContractQueryRequest(o).toHttpRequest(),u=await this.apiPost("query",a);return YF.ContractQueryResponse.fromHttpResponse(u)}catch(o){this.handleApiError(o,"query")}}};c();var ZF=async(t,e,r,n="/")=>{let i=await vd(),o={callbackUrl:encodeURIComponent(`${window.location.origin}${n}`),token:e};try{i&&(await i.login(o)?Te.run("onLoginPending"):Te.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",du()),await ns(t),Te.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}`),Te.run("onLogout")}};c();c();var rU=_e(tU(),1),nU=_e(bl(),1);var nne=t=>{let e=document.createElement("template");return e.innerHTML=t.trim(),e.content.firstChild?.cloneNode(!0)},ine=t=>{let e=`${vO}?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},sne=()=>{let t=document.createElement("div");return t.classList.add("elven-wc-pairings"),t},one=()=>{let t=document.createElement("div");return t.textContent="Existing WalletConnect pairings:",t.classList.add("elven-wc-pairings-header"),t},NI={},ane=(t,e)=>{let r=document.createElement("button");return r.classList.add("elven-wc-pairings-remove-btn"),r.textContent="\u2716",NI[t.topic]=new AbortController,r.addEventListener("click",n=>{n.stopImmediatePropagation(),e(t.topic)},{signal:NI[t.topic].signal}),r},_y={},une=(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=ane(t,e);return n.appendChild(s),_y[t.topic]=new AbortController,n.addEventListener("click",()=>r(t.topic),{signal:_y[t.topic].signal}),n},cne=()=>{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},lne=t=>{if(!t)return;document.getElementById(t)?.remove()},fne=()=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),hne=async t=>t?await rU.default.toString(t,{type:"svg"}):void 0,iU=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 hne(e),o;if(s&&(o=nne(s)),i&&o&&(i.replaceChildren(),i.appendChild(o),fne()&&i.appendChild(ine(e))),i&&r instanceof nU.WalletConnectV2Provider){let a=r.pairings,u=async f=>{try{f&&(await r.logout({topic:f}),lne(f))}catch(d){let g=qt(d);console.warn(`Something went wrong trying to remove the existing pairing: ${g}`)}finally{_y[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(cne()),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(_y))d?.abort();for(let d of Object.values(NI))d?.abort()}};if(a&&a.length>0){let f=sne();i.appendChild(f);let d=one();f.appendChild(d);for(let g of a){let w=une(g,u,l);f.appendChild(w)}}}return i};var Iy=_e(bl(),1);var sU=async(t,e,r,n)=>{if(!n)throw new Error("You haven't provided the QR code container DOM element id");let i=ny(t.initOptions.walletConnectV2RelayAddresses);if(!i||!t.networkProvider)throw new Error("Something wen't wrong with the initialization (ApiNetworkProvider or Wallet Connect Bridge address), plese try to refresh the page!");if(!t.initOptions.walletConnectV2ProjectId)throw new Error("Please provide your WalletConnect project id. You can get it here: https://cloud.walletconnect.com)");if(!t.initOptions.chainType)throw new Error("Please provide the chain type in ElvenJS.init function!");let s,o={onClientLogin:async()=>{if(t.dappProvider instanceof Iy.WalletConnectV2Provider){Te.run("onLoginPending");let u=await t.dappProvider.getAddress(),l=await t.dappProvider.getSignature();Se.set("address",u),Se.set("loginMethod","mobile"),Se.set("expires",du()),await ns(t),l&&Se.set("signature",l),Se.set("loginToken",e);let f=r.getToken(u,e,l);Se.set("accessToken",f),Te.run("onLoggedIn"),s?.replaceChildren()}},onClientLogout:async()=>{t.dappProvider instanceof Iy.WalletConnectV2Provider&&(await hu(t),Te.run("onLogout"))},onClientEvent:u=>{console.log("wc2 session event: ",u)}},a=new Iy.WalletConnectV2Provider(o,Fr[t.initOptions.chainType].shortId,i,t.initOptions.walletConnectV2ProjectId);try{if(a){t.dappProvider=a,Te.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 iU(n,f,a,e),Te.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}`),Te.run("onLogout")}};c();var oU=_e(xl(),1);var aU=async(t,e,r)=>{let n=new oU.WalletProvider(`${t}${Di}`),s={callbackUrl:typeof window<"u"?encodeURIComponent(`${window.location.origin}${r||"/"}`):"/",token:e};try{return Te.run("onLoginPending"),Se.set("loginMethod","web-wallet"),await n.login(s),Se.set("expires",du()),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",""),Te.run("onLogout")}};c();var ls=t=>{if(typeof window<"u"){let e=new URL(window.location.href);return new URLSearchParams(e.search).get(t)}};c();var uU=_e(xl(),1);var cU=_e(W_(),1),lU=async(t,e)=>{let r=ls("signature"),n=ls("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 uU.WalletProvider(`${t}${Di}`);if(r&&e&&n){let u=new cU.NativeAuthClient({apiUrl:e,origin:window.location.origin}).getToken(n,s,r);Se.set("accessToken",u)}return o}};c();var fU=_e(Yo(),1),hU=_e(Wh(),1);var Sy=async(t,e)=>{Te.run("onTxSent",t),await new hU.TransactionWatcher(e).awaitCompleted(t);let n=t.getSender(),i=new fU.Account(n),s=await e.getAccount(n);i.update(s),Se.set("address",i.address.bech32()),Se.set("balance",i.balance.toString()),Te.run("onTxFinalized",t)};c();var _u=_e(OI(),1),gU=_e(mn(),1);c();var pU=_e(Yo(),1);var Ty=t=>{let e=t.getSender(),r=new pU.Account(e),n=t.getNonce().valueOf();r.incrementNonce(),Se.set("nonce",n+1)};var yU=async(t,e,r,n)=>{if(ls(_u.WALLET_PROVIDER_CALLBACK_PARAM)===_u.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED&&t&&e){let s=Se.get("activeGuardian"),o=Se.get("loginMethod"),a=ls("hasWebWalletGuardianSign"),u;if("getTransactionsFromWalletUrl"in t){if(u=t.getTransactionsFromWalletUrl()?.[0],!u)return;u.data=h.Buffer.from(u.data).toString("base64")}else s&&o!=="web-wallet"&&a&&(u=new _u.WalletProvider(`${r}${Di}`).getTransactionsFromWalletUrl()?.[0]);if(u){let l=gU.Transaction.fromPlainObject(u);l.setNonce(n),Ty(l);try{Te.run("onTxStarted",l),await e.sendTransaction(l),await Sy(l,e)}catch(f){let d=qt(f);throw Te.run("onTxError",l,d),new Error(`Error: Transaction signing failed! ${d}`)}finally{window.history.replaceState(null,"",window.location.pathname)}}window.history.replaceState(null,"",window.location.pathname)}};c();var Cy=_e(oc(),1),mU=_e(ht(),1),wU=_e(OI(),1);var EU=t=>{let e=Se.get("activeGuardian");if(e){let r={guarded:!0};t.setVersion(Cy.TransactionVersion.withTxOptions()),t.setOptions(Cy.TransactionOptions.withOptions(r)),t.setGuardian(mU.Address.fromBech32(e))}return t},vU=async(t,e)=>{let r=new wU.WalletProvider(`${e}${Di}`),n=window?.location.href,i=new URL(n);i.searchParams.set("hasWebWalletGuardianSign","true"),await r.guardTransactions([t],{callbackUrl:encodeURIComponent(i.toString())})},AU=t=>{let e=Se.get("activeGuardian");return!(!Se.get("address")||!e||t.isGuardedTransaction())};var DI=class{static async init(e){let r=Se.get();if(r.expires&&ry(r.expires)){Se.clear(),this.dappProvider=void 0;return}this.initOptions={chainType:Ed,apiUrl:EO,apiTimeout:1e4,walletConnectV2ProjectId:"",walletConnectV2RelayAddresses:AO,...e},this.networkProvider=new fy(this.initOptions),this.initOptions.onLoginPending&&Te.set("onLoginPending",this.initOptions.onLoginPending),this.initOptions.onLoggedIn&&Te.set("onLoggedIn",this.initOptions.onLoggedIn),this.initOptions.onQrPending&&Te.set("onQrPending",this.initOptions.onQrPending),this.initOptions.onQrLoaded&&Te.set("onQrLoaded",this.initOptions.onQrLoaded),this.initOptions.onLogout&&Te.set("onLogout",this.initOptions.onLogout),this.initOptions.onTxStarted&&Te.set("onTxStarted",this.initOptions.onTxStarted),this.initOptions.onTxSent&&Te.set("onTxSent",this.initOptions.onTxSent),this.initOptions.onTxFinalized&&Te.set("onTxFinalized",this.initOptions.onTxFinalized),this.initOptions.onTxError&&Te.set("onTxError",this.initOptions.onTxError),(r?.address||r.loginMethod==="web-wallet"&&ls("address"))&&r?.loginMethod&&(Te.run("onLoginPending"),r.loginMethod==="browser-extension"&&(this.dappProvider=await vd()),r.loginMethod==="mobile"&&(this.dappProvider=await NF(this)),r.loginMethod==="web-wallet"&&this.initOptions.chainType&&(this.dappProvider=await lU(Fr[this.initOptions.chainType].walletAddress,this.initOptions.apiUrl)),await ns(this),Te.run("onLoggedIn"),this.initOptions?.chainType&&await yU(this.dappProvider,this.networkProvider,Fr[this.initOptions.chainType].walletAddress,r.nonce))}static async login(e,r){if(!Object.values(rs).includes(e))throw new Error("Error: Wrong login method!");if(!this.networkProvider)throw new Error("Error: Login failed: Use ElvenJs.init() first!");try{Te.run("onLoginPending");let i=new SU.NativeAuthClient({apiUrl:this.initOptions?.apiUrl,origin:window.location.origin}),s=await i.initialize();if(e==="browser-extension"){let o=await ZF(this,s,i,r?.callbackRoute);this.dappProvider=o}if(e==="mobile"){let o=await sU(this,s,i,r?.qrCodeContainer);this.dappProvider=o}if(e==="web-wallet"&&this.initOptions?.chainType){let o=await aU(Fr[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 hu(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!");let r=EU(e);try{Te.run("onTxStarted",e);let n=Se.get();if(e.setNonce(n.nonce),this.dappProvider instanceof bU.ExtensionProvider&&(r=await this.dappProvider.signTransaction(e)),this.dappProvider instanceof _U.WalletConnectV2Provider&&(r=await this.dappProvider.signTransaction(e)),this.dappProvider instanceof IU.WalletProvider&&await this.dappProvider.signTransaction(e),n.loginMethod!=="web-wallet"){let i=AU(r);if(i||Ty(r),i&&this.initOptions?.chainType){await vU(r,Fr[this.initOptions.chainType].walletAddress);return}await this.networkProvider.sendTransaction(r),await Sy(r,this.networkProvider)}}catch(n){let i=qt(n);throw Te.run("onTxError",r,i),new Error(`Error: Transaction signing failed! ${i}`)}return r}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,Te.clear()}}};var export_Account=Ene.Account;var export_Address=wne.Address;var export_AddressType=xU.AddressType;var export_AddressValue=xU.AddressValue;var export_BigUIntType=Rn.BigUIntType;var export_BigUIntValue=Rn.BigUIntValue;var export_BooleanType=CU.BooleanType;var export_BooleanValue=CU.BooleanValue;var export_BytesType=TU.BytesType;var export_BytesValue=TU.BytesValue;var export_ContractFunction=Ine.ContractFunction;var export_GasEstimator=mne.GasEstimator;var export_SmartContract=_ne.SmartContract;var export_TokenTransfer=gne.TokenTransfer;var export_Transaction=vne.Transaction;var export_TransactionPayload=Ane.TransactionPayload;var export_TransactionWatcher=bne.TransactionWatcher;var export_TransferTransactionsFactory=yne.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,DI as ElvenJS,export_GasEstimator as GasEstimator,rs 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=Vne(e,r,i),a=Dy.getSymbolSize(e),u=new Nne(a);return Lne(u,e),Fne(u),Mne(u,e),UI(u,r,0),e>=7&&Une(u,e),qne(u,o),isNaN(n)&&(n=qI.getBestMask(u,UI.bind(null,u,r))),qI.applyMask(n,u),UI(u,r,n),{modules:u,version:e,errorCorrectionLevel:r,maskPattern:n,segments:i}}SU.create=function(e,r){if(typeof e>"u"||e==="")throw new Error("No input text");let n=FI.M,i,s;return typeof r<"u"&&(n=FI.from(r.errorCorrectionLevel,FI.M),i=Oy.from(r.version),s=qI.from(r.maskPattern),r.toSJISFunc&&Dy.setToSJISFunction(r.toSJISFunc)),Gne(e,i,n,s)}});var HI=m(wo=>{c();function CU(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("")}}wo.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:CU(e.color.dark||"#000000ff"),light:CU(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}};wo.getScale=function(e,r){return r.width&&r.width>=e+r.margin*2?r.width/(e+r.margin*2):r.scale};wo.getImageWidth=function(e,r){let n=wo.getScale(e,r);return Math.floor((e+r.margin*2)*n)};wo.qrToImageData=function(e,r,n){let i=r.modules.size,s=r.modules.data,o=wo.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 GI=HI();function kne(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 jne(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}Py.render=function(e,r,n){let i=n,s=r;typeof i>"u"&&(!r||!r.getContext)&&(i=r,r=void 0),r||(s=jne()),i=GI.getOptions(i);let o=GI.getImageWidth(e.modules.size,i),a=s.getContext("2d"),u=a.createImageData(o,o);return GI.qrToImageData(u.data,e,i),kne(a,s,o),a.putImageData(u,0,0),s};Py.renderToDataURL=function(e,r,n){let i=n;typeof i>"u"&&(!r||!r.getContext)&&(i=r,r=void 0),i||(i={});let s=Py.render(e,r,i),o=i.type||"image/png",a=i.rendererOpts||{};return s.toDataURL(o,a.quality)}});var DU=m(OU=>{c();var Qne=HI();function NU(t,e){let r=t.a/255,n=e+'="'+t.hex+'"';return r<1?n+" "+e+'-opacity="'+r.toFixed(2).slice(1)+'"':n}function kI(t,e,r){let n=t+e;return typeof r<"u"&&(n+=" "+r),n}function Wne(t,e,r){let n="",i=0,s=!1,o=0;for(let a=0;a0&&u>0&&t[a-1]||(n+=s?kI("M",u+r,.5+l+r):kI("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 RU=m(zl=>{c();var $ne=RM(),jI=TU(),PU=xU(),zne=DU();function QI(t,e,r,n,i){let s=[].slice.call(arguments,1),o=s.length,a=typeof s[o-1]=="function";if(!a&&!$ne())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=jI.create(r,n);u(t(f,e,n))}catch(f){l(f)}})}try{let u=jI.create(r,n);i(null,t(u,e,n))}catch(u){i(u)}}zl.create=jI.create;zl.toCanvas=QI.bind(null,PU.render);zl.toDataURL=QI.bind(null,PU.renderToDataURL);zl.toString=QI.bind(null,function(t,e,r){return zne.render(t,r)})});var KI=m(ys=>{"use strict";c();var oie=ys&&ys.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),kU=ys&&ys.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&oie(e,t,r)};Object.defineProperty(ys,"__esModule",{value:!0});kU(Ll(),ys);kU(L_(),ys)});c();var uie=_e(Em(),1),cie=_e(Zw(),1),lie=_e(tE(),1),fie=_e(ht(),1),hie=_e(ra(),1),die=_e(wn(),1),pie=_e(jn(),1),gie=_e(ed(),1),yie=_e(fv(),1),mie=_e(wc(),1),r5=_e(mi(),1),Mn=_e(tc(),1),n5=_e(Mu(),1),i5=_e(Do(),1);c();c();var HO=_e(pv(),1);c();c();var Td="elvenjs_state",UO="https://devnet-api.multiversx.com";var Fi="/dapp/init",Cd="devnet",qO="https://maiar.page.link/?apn=com.elrond.maiar.wallet&isi=1519405832&ibi=com.elrond.maiar.wallet&link=https://xportal.com/",VO=["wss://relay.walletconnect.com"],Yt={devnet:{id:"devnet",shortId:"D",name:"Devnet",egldLabel:"xEGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://devnet-wallet.multiversx.com",xAliasAddress:"https://devnet.xalias.com",apiAddress:"https://devnet-api.multiversx.com",explorerAddress:"https://devnet-explorer.multiversx.com",apiTimeout:1e4},testnet:{id:"testnet",shortId:"T",name:"Testnet",egldLabel:"xEGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://testnet-wallet.multiversx.com",xAliasAddress:"https://testnet.xalias.com",apiAddress:"https://testnet-api.multiversx.com",explorerAddress:"https://testnet-explorer.multiversx.com",apiTimeout:1e4},mainnet:{id:"mainnet",shortId:"1",name:"Mainnet",egldLabel:"EGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://wallet.multiversx.com",xAliasAddress:"https://xalias.com",apiAddress:"https://api.multiversx.com",explorerAddress:"https://explorer.multiversx.com",apiTimeout:1e4}};var Se={get(t){let e=localStorage.getItem(Td);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(Td,JSON.stringify(r))},clear(){localStorage.removeItem(Td)}};var xd=async()=>{let t=HO.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 XU=_e(pv(),1),ZU=_e(Cl(),1),e5=_e(Ll(),1),t5=_e(cI(),1);c();var oM=_e(Cl(),1);c();c();var Te=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 as=(s=>(s.ledger="ledger",s.mobile="mobile",s.webWallet="web-wallet",s.browserExtension="browser-extension",s.xAlias="x-alias",s))(as||{});var gu=async t=>{if(!t.dappProvider)throw new Error("Error: Logout failed: There is no active session!");Te.run("onLoginPending");let e=await t.dappProvider.logout();return e&&(Se.clear(),Te.run("onLogout")),e};c();var iM=_e(ht(),1),sM=_e(ra(),1);c();var qt=t=>typeof t=="string"?t.toUpperCase():t instanceof Error?t.message:`Error: ${JSON.stringify(t)}`;c();var yu=()=>new Date().setHours(new Date().getHours()+24),hy=t=>Date.now()>t;var us=async t=>{let e=Se.get("address"),r=Se.get("expires");if(!(r&&hy(r))&&e&&t.networkProvider){let i=new iM.Address(e),s=new sM.Account(i);try{let o=await t.networkProvider.getAccount(i),a=await t.networkProvider.getGuardianData(i);Se.set("address",e),Se.set("activeGuardian",a.guarded&&a.activeGuardian?.address?a.activeGuardian.address:""),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 dy(t){return t[Math.floor(Math.random()*t.length)]}var aM=async t=>{if(!t.initOptions.walletConnectV2ProjectId||!t.initOptions.chainType)return;let e={onClientLogin:()=>{us(t),Te.run("onLoggedIn")},onClientLogout:()=>gu(t),onClientEvent:i=>{console.log("wc2 session event: ",i)}},r=dy(t.initOptions.walletConnectV2RelayAddresses),n=new oM.WalletConnectV2Provider(e,Yt[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 _M=_e(Gt(),1),vy=_e(ht(),1),IM=_e(uM(),1),SM=_e(dM(),1),TM=_e(EI(),1),CM=_e(EM(),1),xM=_e(AM(),1),NM=_e(bM(),1),OM=_e(Ec(),1);var Ay=class{constructor({apiUrl:e,chainType:r,apiTimeout:n}){this.chainType=r||Cd,this.apiUrl=e||Yt[this.chainType]?.apiAddress,this.apiTimeout=n||Yt[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 vy.Address(r?.address||""),nonce:Number(r?.nonce||0),balance:new _M.default(r?.balance||0),code:r?.code||"",userName:r?.username||""}}async getGuardianData(e){let r=await this.apiGet(`address/${e.bech32()}/guardian-data`);return{guarded:r?.data?.guardianData?.guarded||!1,activeGuardian:r?.data?.guardianData?.activeGuardian,pendingGuardian:r?.data?.guardianData?.pendingGuardian}}async getTransaction(e){let r=await this.apiGet(`transactions/${e}`),n=new IM.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 vy.Address(r.sender),receiver:new vy.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:SM.TransactionReceipt.fromHttpResponse(r.receipt||{}),logs:TM.TransactionLogs.fromHttpResponse(r.logs||{}),contractResults:CM.ContractResults.fromApiHttpResponse(r.results||[]),isCompleted:!n.isPending()}}async queryContract({address:e,func:r,args:n,value:i,caller:s}){try{let o=new OM.Query({address:e,func:r,args:n,value:i,caller:s}),a=new NM.ContractQueryRequest(o).toHttpRequest(),u=await this.apiPost("query",a);return xM.ContractQueryResponse.fromHttpResponse(u)}catch(o){this.handleApiError(o,"query")}}};c();var DM=async(t,e,r,n="/")=>{let i=await xd(),o={callbackUrl:encodeURIComponent(`${window.location.origin}${n}`),token:e};try{i&&(await i.login(o)?Te.run("onLoginPending"):Te.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",yu()),await us(t),Te.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}`),Te.run("onLogout")}};c();c();var BU=_e(RU(),1),LU=_e(Cl(),1);var Yne=t=>{let e=document.createElement("template");return e.innerHTML=t.trim(),e.content.firstChild?.cloneNode(!0)},Jne=t=>{let e=`${qO}?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},Xne=()=>{let t=document.createElement("div");return t.classList.add("elven-wc-pairings"),t},Zne=()=>{let t=document.createElement("div");return t.textContent="Existing WalletConnect pairings:",t.classList.add("elven-wc-pairings-header"),t},WI={},eie=(t,e)=>{let r=document.createElement("button");return r.classList.add("elven-wc-pairings-remove-btn"),r.textContent="\u2716",WI[t.topic]=new AbortController,r.addEventListener("click",n=>{n.stopImmediatePropagation(),e(t.topic)},{signal:WI[t.topic].signal}),r},Ry={},tie=(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=eie(t,e);return n.appendChild(s),Ry[t.topic]=new AbortController,n.addEventListener("click",()=>r(t.topic),{signal:Ry[t.topic].signal}),n},rie=()=>{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},nie=t=>{if(!t)return;document.getElementById(t)?.remove()},iie=()=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),sie=async t=>t?await BU.default.toString(t,{type:"svg"}):void 0,FU=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 sie(e),o;if(s&&(o=Yne(s)),i&&o&&(i.replaceChildren(),i.appendChild(o),iie()&&i.appendChild(Jne(e))),i&&r instanceof LU.WalletConnectV2Provider){let a=r.pairings,u=async f=>{try{f&&(await r.logout({topic:f}),nie(f))}catch(d){let g=qt(d);console.warn(`Something went wrong trying to remove the existing pairing: ${g}`)}finally{Ry[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(rie()),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(Ry))d?.abort();for(let d of Object.values(WI))d?.abort()}};if(a&&a.length>0){let f=Xne();i.appendChild(f);let d=Zne();f.appendChild(d);for(let g of a){let w=tie(g,u,l);f.appendChild(w)}}}return i};var By=_e(Cl(),1);var MU=async(t,e,r,n)=>{if(!n)throw new Error("You haven't provided the QR code container DOM element id");let i=dy(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){Te.run("onLoginPending");let u=await t.dappProvider.getAddress(),l=await t.dappProvider.getSignature();Se.set("address",u),Se.set("loginMethod","mobile"),Se.set("expires",yu()),await us(t),l&&Se.set("signature",l),Se.set("loginToken",e);let f=r.getToken(u,e,l);Se.set("accessToken",f),Te.run("onLoggedIn"),s?.replaceChildren()}},onClientLogout:async()=>{t.dappProvider instanceof By.WalletConnectV2Provider&&(await gu(t),Te.run("onLogout"))},onClientEvent:u=>{console.log("wc2 session event: ",u)}},a=new By.WalletConnectV2Provider(o,Yt[t.initOptions.chainType].shortId,i,t.initOptions.walletConnectV2ProjectId);try{if(a){t.dappProvider=a,Te.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 FU(n,f,a,e),Te.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}`),Te.run("onLogout")}};c();var UU=_e(Ll(),1);var $I=async(t,e,r,n)=>{let i=new UU.WalletProvider(`${t}${Fi}`),o={callbackUrl:typeof window<"u"?encodeURIComponent(`${window.location.origin}${n||"/"}`):"/",token:e};try{return Te.run("onLoginPending"),Se.set("loginMethod",Yt[r].xAliasAddress===t?"x-alias":"web-wallet"),await i.login(o),Se.set("expires",yu()),Se.set("loginToken",e),i}catch(a){let u=qt(a);console.warn(`Something went wrong trying to login the user: ${u}`),Se.set("loginMethod",""),Te.run("onLogout")}};c();var gs=t=>{if(typeof window<"u"){let e=new URL(window.location.href);return new URLSearchParams(e.search).get(t)}};c();var qU=_e(Ll(),1);var VU=_e(cI(),1),zI=async(t,e)=>{let r=gs("signature"),n=gs("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 qU.WalletProvider(`${t}${Fi}`);if(r&&e&&n){let u=new VU.NativeAuthClient({apiUrl:e,origin:window.location.origin}).getToken(n,s,r);Se.set("accessToken",u)}return o}};c();var HU=_e(ra(),1),GU=_e(ed(),1);var Ly=async(t,e)=>{Te.run("onTxSent",t),await new GU.TransactionWatcher(e).awaitCompleted(t);let n=t.getSender(),i=new HU.Account(n),s=await e.getAccount(n);i.update(s),Se.set("address",i.address.bech32()),Se.set("balance",i.balance.toString()),Te.run("onTxFinalized",t)};c();var Tu=_e(KI(),1),QU=_e(wn(),1);c();var jU=_e(ra(),1);var Fy=t=>{let e=t.getSender(),r=new jU.Account(e),n=t.getNonce().valueOf();r.incrementNonce(),Se.set("nonce",n+1)};var WU=async(t,e,r,n)=>{if(gs(Tu.WALLET_PROVIDER_CALLBACK_PARAM)===Tu.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED&&t&&e){let s=Se.get("activeGuardian"),o=Se.get("loginMethod"),a=gs("hasWebWalletGuardianSign"),u;if("getTransactionsFromWalletUrl"in t){if(u=t.getTransactionsFromWalletUrl()?.[0],!u)return;o==="web-wallet"&&(u.data=h.Buffer.from(u.data).toString("base64"))}else s&&o!=="web-wallet"&&o!=="x-alias"&&a&&(u=new Tu.WalletProvider(`${r}${Fi}`).getTransactionsFromWalletUrl()?.[0]);if(u){let l=QU.Transaction.fromPlainObject(u);l.setNonce(n),Fy(l);try{Te.run("onTxStarted",l),await e.sendTransaction(l),await Ly(l,e)}catch(f){let d=qt(f);throw Te.run("onTxError",l,d),new Error(`Error: Transaction signing failed! ${d}`)}finally{window.history.replaceState(null,"",window.location.pathname)}}window.history.replaceState(null,"",window.location.pathname)}};c();var My=_e(cc(),1),$U=_e(ht(),1),zU=_e(KI(),1);var KU=t=>{let e=Se.get("activeGuardian");if(e){let r={guarded:!0};t.setVersion(My.TransactionVersion.withTxOptions()),t.setOptions(My.TransactionOptions.withOptions(r)),t.setGuardian($U.Address.fromBech32(e))}return t},YU=async(t,e)=>{let r=new zU.WalletProvider(`${e}${Fi}`),n=window?.location.href,i=new URL(n);i.searchParams.set("hasWebWalletGuardianSign","true"),await r.guardTransactions([t],{callbackUrl:encodeURIComponent(i.toString())})},JU=t=>{let e=Se.get("activeGuardian");return!(!Se.get("address")||!e||t.isGuardedTransaction())};var YI=class{static async init(e){let r=Se.get();if(r.expires&&hy(r.expires)){Se.clear(),this.dappProvider=void 0;return}this.initOptions={chainType:Cd,apiUrl:UO,apiTimeout:1e4,walletConnectV2ProjectId:"",walletConnectV2RelayAddresses:VO,...e},this.networkProvider=new Ay(this.initOptions),this.initOptions.onLoginPending&&Te.set("onLoginPending",this.initOptions.onLoginPending),this.initOptions.onLoggedIn&&Te.set("onLoggedIn",this.initOptions.onLoggedIn),this.initOptions.onQrPending&&Te.set("onQrPending",this.initOptions.onQrPending),this.initOptions.onQrLoaded&&Te.set("onQrLoaded",this.initOptions.onQrLoaded),this.initOptions.onLogout&&Te.set("onLogout",this.initOptions.onLogout),this.initOptions.onTxStarted&&Te.set("onTxStarted",this.initOptions.onTxStarted),this.initOptions.onTxSent&&Te.set("onTxSent",this.initOptions.onTxSent),this.initOptions.onTxFinalized&&Te.set("onTxFinalized",this.initOptions.onTxFinalized),this.initOptions.onTxError&&Te.set("onTxError",this.initOptions.onTxError),(r?.address||(r.loginMethod==="web-wallet"||r.loginMethod==="x-alias")&&gs("address"))&&r?.loginMethod&&(Te.run("onLoginPending"),r.loginMethod==="browser-extension"&&(this.dappProvider=await xd()),r.loginMethod==="mobile"&&(this.dappProvider=await aM(this)),r.loginMethod==="web-wallet"&&this.initOptions.chainType&&(this.dappProvider=await zI(Yt[this.initOptions.chainType].walletAddress,this.initOptions.apiUrl)),r.loginMethod==="x-alias"&&this.initOptions.chainType&&(this.dappProvider=await zI(Yt[this.initOptions.chainType].xAliasAddress,this.initOptions.apiUrl)),await us(this),Te.run("onLoggedIn"),this.initOptions?.chainType&&await WU(this.dappProvider,this.networkProvider,Yt[this.initOptions.chainType][r.loginMethod==="x-alias"?"xAliasAddress":"walletAddress"],r.nonce))}static async login(e,r){if(!Object.values(as).includes(e))throw new Error("Error: Wrong login method!");if(!this.networkProvider)throw new Error("Error: Login failed: Use ElvenJs.init() first!");try{Te.run("onLoginPending");let i=new t5.NativeAuthClient({apiUrl:this.initOptions?.apiUrl,origin:window.location.origin}),s=await i.initialize();if(e==="browser-extension"){let o=await DM(this,s,i,r?.callbackRoute);this.dappProvider=o}if(e==="mobile"){let o=await MU(this,s,i,r?.qrCodeContainer);this.dappProvider=o}if(e==="web-wallet"&&this.initOptions?.chainType){let o=await $I(Yt[this.initOptions.chainType].walletAddress,s,this.initOptions?.chainType,r?.callbackRoute);this.dappProvider=o}if(e==="x-alias"&&this.initOptions?.chainType){let o=await $I(Yt[this.initOptions.chainType].xAliasAddress,s,this.initOptions?.chainType,r?.callbackRoute);this.dappProvider=o}}catch(i){let s=qt(i);throw new Error(`Error: ${s}`)}}static async logout(){try{let e=await gu(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!");let r=KU(e);try{Te.run("onTxStarted",e);let n=Se.get();if(e.setNonce(n.nonce),this.dappProvider instanceof XU.ExtensionProvider&&(r=await this.dappProvider.signTransaction(e)),this.dappProvider instanceof ZU.WalletConnectV2Provider&&(r=await this.dappProvider.signTransaction(e)),this.dappProvider instanceof e5.WalletProvider&&await this.dappProvider.signTransaction(e),n.loginMethod!=="web-wallet"&&n.loginMethod!=="x-alias"){let i=JU(r);if(i||Fy(r),i&&this.initOptions?.chainType){await YU(r,Yt[this.initOptions.chainType].walletAddress);return}await this.networkProvider.sendTransaction(r),await Ly(r,this.networkProvider)}}catch(n){let i=qt(n);throw Te.run("onTxError",r,i),new Error(`Error: Transaction signing failed! ${i}`)}return r}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,Te.clear()}}};var export_Account=hie.Account;var export_Address=fie.Address;var export_AddressType=i5.AddressType;var export_AddressValue=i5.AddressValue;var export_BigUIntType=Mn.BigUIntType;var export_BigUIntValue=Mn.BigUIntValue;var export_BooleanType=n5.BooleanType;var export_BooleanValue=n5.BooleanValue;var export_BytesType=r5.BytesType;var export_BytesValue=r5.BytesValue;var export_ContractFunction=mie.ContractFunction;var export_GasEstimator=lie.GasEstimator;var export_SmartContract=yie.SmartContract;var export_TokenTransfer=uie.TokenTransfer;var export_Transaction=die.Transaction;var export_TransactionPayload=pie.TransactionPayload;var export_TransactionWatcher=gie.TransactionWatcher;var export_TransferTransactionsFactory=cie.TransferTransactionsFactory;var export_U16Type=Mn.U16Type;var export_U16Value=Mn.U16Value;var export_U32Type=Mn.U32Type;var export_U32Value=Mn.U32Value;var export_U64Type=Mn.U64Type;var export_U64Value=Mn.U64Value;var export_U8Type=Mn.U8Type;var export_U8Value=Mn.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,YI as ElvenJS,export_GasEstimator as GasEstimator,as 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 2241498..cf20aa7 100644 --- a/example/index.html +++ b/example/index.html @@ -37,6 +37,8 @@ with xPortal + Other demos: } }); + document.getElementById('button-login-x-alias').addEventListener('click', async () => { + try { + clearQrCodeContainer(); + await ElvenJS.login('x-alias', { + callbackRoute: '/', + }); + } catch (e) { + console.log('Login: Something went wrong, try again!', e?.message); + } + }); + document.getElementById('button-logout').addEventListener('click', async () => { try { const isLoggedOut = await ElvenJS.logout(); @@ -237,9 +250,10 @@

Other demos:

const demoMessage = 'Transaction demo from Elven.js!'; const isGuardian = ElvenJS.storage.get('activeGuardian'); + const isXalias = ElvenJS.storage.get('loginMethod') === 'x-alias'; // Additional 50000 when there is an active guardian // See more about gas limit calculation here: https://docs.multiversx.com/developers/gas-and-fees/overview/ - const gasLimit = (isGuardian ? 100000 : 50000) + 1500 * demoMessage.length; + const gasLimit = ((isGuardian || isXalias) ? 100000 : 50000) + 1500 * demoMessage.length; const tx = new Transaction({ nonce: ElvenJS.storage.get('nonce'), diff --git a/package-lock.json b/package-lock.json index aa1051c..b36e678 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,26 +9,26 @@ "version": "0.12.0", "license": "MIT", "devDependencies": { - "@multiversx/sdk-core": "12.6.0", + "@multiversx/sdk-core": "12.11.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.3", - "@multiversx/sdk-web-wallet-provider": "3.0.0", - "@types/qrcode": "1.5.1", - "@types/serve-handler": "6.1.1", - "@typescript-eslint/eslint-plugin": "6.2.1", - "@typescript-eslint/parser": "6.2.1", - "esbuild": "0.18.17", - "eslint": "8.46.0", - "eslint-config-prettier": "8.10.0", - "eslint-plugin-prettier": "5.0.0", + "@multiversx/sdk-native-auth-client": "1.0.5", + "@multiversx/sdk-network-providers": "2.0.0", + "@multiversx/sdk-wallet-connect-provider": "4.0.4", + "@multiversx/sdk-web-wallet-provider": "3.1.0", + "@types/qrcode": "1.5.4", + "@types/serve-handler": "6.1.3", + "@typescript-eslint/eslint-plugin": "6.9.0", + "@typescript-eslint/parser": "6.9.0", + "esbuild": "0.19.5", + "eslint": "8.52.0", + "eslint-config-prettier": "9.0.0", + "eslint-plugin-prettier": "5.0.1", "node-stdlib-browser": "1.2.0", - "prettier": "3.0.1", + "prettier": "3.0.3", "qrcode": "1.5.3", - "rimraf": "5.0.1", + "rimraf": "5.0.5", "serve-handler": "6.1.5", - "typescript": "5.1.6" + "typescript": "5.2.2" } }, "node_modules/@aashutoshrathi/word-wrap": { @@ -41,9 +41,9 @@ } }, "node_modules/@esbuild/android-arm": { - "version": "0.18.17", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.18.17.tgz", - "integrity": "sha512-wHsmJG/dnL3OkpAcwbgoBTTMHVi4Uyou3F5mf58ZtmUyIKfcdA7TROav/6tCzET4A3QW2Q2FC+eFneMU+iyOxg==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.5.tgz", + "integrity": "sha512-bhvbzWFF3CwMs5tbjf3ObfGqbl/17ict2/uwOSfr3wmxDE6VdS2GqY/FuzIPe0q0bdhj65zQsvqfArI9MY6+AA==", "cpu": [ "arm" ], @@ -57,9 +57,9 @@ } }, "node_modules/@esbuild/android-arm64": { - "version": "0.18.17", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.18.17.tgz", - "integrity": "sha512-9np+YYdNDed5+Jgr1TdWBsozZ85U1Oa3xW0c7TWqH0y2aGghXtZsuT8nYRbzOMcl0bXZXjOGbksoTtVOlWrRZg==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.5.tgz", + "integrity": "sha512-5d1OkoJxnYQfmC+Zd8NBFjkhyCNYwM4n9ODrycTFY6Jk1IGiZ+tjVJDDSwDt77nK+tfpGP4T50iMtVi4dEGzhQ==", "cpu": [ "arm64" ], @@ -73,9 +73,9 @@ } }, "node_modules/@esbuild/android-x64": { - "version": "0.18.17", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.18.17.tgz", - "integrity": "sha512-O+FeWB/+xya0aLg23hHEM2E3hbfwZzjqumKMSIqcHbNvDa+dza2D0yLuymRBQQnC34CWrsJUXyH2MG5VnLd6uw==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.5.tgz", + "integrity": "sha512-9t+28jHGL7uBdkBjL90QFxe7DVA+KGqWlHCF8ChTKyaKO//VLuoBricQCgwhOjA1/qOczsw843Fy4cbs4H3DVA==", "cpu": [ "x64" ], @@ -89,9 +89,9 @@ } }, "node_modules/@esbuild/darwin-arm64": { - "version": "0.18.17", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.18.17.tgz", - "integrity": "sha512-M9uJ9VSB1oli2BE/dJs3zVr9kcCBBsE883prage1NWz6pBS++1oNn/7soPNS3+1DGj0FrkSvnED4Bmlu1VAE9g==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.5.tgz", + "integrity": "sha512-mvXGcKqqIqyKoxq26qEDPHJuBYUA5KizJncKOAf9eJQez+L9O+KfvNFu6nl7SCZ/gFb2QPaRqqmG0doSWlgkqw==", "cpu": [ "arm64" ], @@ -105,9 +105,9 @@ } }, "node_modules/@esbuild/darwin-x64": { - "version": "0.18.17", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.18.17.tgz", - "integrity": "sha512-XDre+J5YeIJDMfp3n0279DFNrGCXlxOuGsWIkRb1NThMZ0BsrWXoTg23Jer7fEXQ9Ye5QjrvXpxnhzl3bHtk0g==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.5.tgz", + "integrity": "sha512-Ly8cn6fGLNet19s0X4unjcniX24I0RqjPv+kurpXabZYSXGM4Pwpmf85WHJN3lAgB8GSth7s5A0r856S+4DyiA==", "cpu": [ "x64" ], @@ -121,9 +121,9 @@ } }, "node_modules/@esbuild/freebsd-arm64": { - "version": "0.18.17", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.18.17.tgz", - "integrity": "sha512-cjTzGa3QlNfERa0+ptykyxs5A6FEUQQF0MuilYXYBGdBxD3vxJcKnzDlhDCa1VAJCmAxed6mYhA2KaJIbtiNuQ==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.5.tgz", + "integrity": "sha512-GGDNnPWTmWE+DMchq1W8Sd0mUkL+APvJg3b11klSGUDvRXh70JqLAO56tubmq1s2cgpVCSKYywEiKBfju8JztQ==", "cpu": [ "arm64" ], @@ -137,9 +137,9 @@ } }, "node_modules/@esbuild/freebsd-x64": { - "version": "0.18.17", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.18.17.tgz", - "integrity": "sha512-sOxEvR8d7V7Kw8QqzxWc7bFfnWnGdaFBut1dRUYtu+EIRXefBc/eIsiUiShnW0hM3FmQ5Zf27suDuHsKgZ5QrA==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.5.tgz", + "integrity": "sha512-1CCwDHnSSoA0HNwdfoNY0jLfJpd7ygaLAp5EHFos3VWJCRX9DMwWODf96s9TSse39Br7oOTLryRVmBoFwXbuuQ==", "cpu": [ "x64" ], @@ -153,9 +153,9 @@ } }, "node_modules/@esbuild/linux-arm": { - "version": "0.18.17", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.18.17.tgz", - "integrity": "sha512-2d3Lw6wkwgSLC2fIvXKoMNGVaeY8qdN0IC3rfuVxJp89CRfA3e3VqWifGDfuakPmp90+ZirmTfye1n4ncjv2lg==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.5.tgz", + "integrity": "sha512-lrWXLY/vJBzCPC51QN0HM71uWgIEpGSjSZZADQhq7DKhPcI6NH1IdzjfHkDQws2oNpJKpR13kv7/pFHBbDQDwQ==", "cpu": [ "arm" ], @@ -169,9 +169,9 @@ } }, "node_modules/@esbuild/linux-arm64": { - "version": "0.18.17", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.18.17.tgz", - "integrity": "sha512-c9w3tE7qA3CYWjT+M3BMbwMt+0JYOp3vCMKgVBrCl1nwjAlOMYzEo+gG7QaZ9AtqZFj5MbUc885wuBBmu6aADQ==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.5.tgz", + "integrity": "sha512-o3vYippBmSrjjQUCEEiTZ2l+4yC0pVJD/Dl57WfPwwlvFkrxoSO7rmBZFii6kQB3Wrn/6GwJUPLU5t52eq2meA==", "cpu": [ "arm64" ], @@ -185,9 +185,9 @@ } }, "node_modules/@esbuild/linux-ia32": { - "version": "0.18.17", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.18.17.tgz", - "integrity": "sha512-1DS9F966pn5pPnqXYz16dQqWIB0dmDfAQZd6jSSpiT9eX1NzKh07J6VKR3AoXXXEk6CqZMojiVDSZi1SlmKVdg==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.5.tgz", + "integrity": "sha512-MkjHXS03AXAkNp1KKkhSKPOCYztRtK+KXDNkBa6P78F8Bw0ynknCSClO/ztGszILZtyO/lVKpa7MolbBZ6oJtQ==", "cpu": [ "ia32" ], @@ -201,9 +201,9 @@ } }, "node_modules/@esbuild/linux-loong64": { - "version": "0.18.17", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.18.17.tgz", - "integrity": "sha512-EvLsxCk6ZF0fpCB6w6eOI2Fc8KW5N6sHlIovNe8uOFObL2O+Mr0bflPHyHwLT6rwMg9r77WOAWb2FqCQrVnwFg==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.5.tgz", + "integrity": "sha512-42GwZMm5oYOD/JHqHska3Jg0r+XFb/fdZRX+WjADm3nLWLcIsN27YKtqxzQmGNJgu0AyXg4HtcSK9HuOk3v1Dw==", "cpu": [ "loong64" ], @@ -217,9 +217,9 @@ } }, "node_modules/@esbuild/linux-mips64el": { - "version": "0.18.17", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.18.17.tgz", - "integrity": "sha512-e0bIdHA5p6l+lwqTE36NAW5hHtw2tNRmHlGBygZC14QObsA3bD4C6sXLJjvnDIjSKhW1/0S3eDy+QmX/uZWEYQ==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.5.tgz", + "integrity": "sha512-kcjndCSMitUuPJobWCnwQ9lLjiLZUR3QLQmlgaBfMX23UEa7ZOrtufnRds+6WZtIS9HdTXqND4yH8NLoVVIkcg==", "cpu": [ "mips64el" ], @@ -233,9 +233,9 @@ } }, "node_modules/@esbuild/linux-ppc64": { - "version": "0.18.17", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.18.17.tgz", - "integrity": "sha512-BAAilJ0M5O2uMxHYGjFKn4nJKF6fNCdP1E0o5t5fvMYYzeIqy2JdAP88Az5LHt9qBoUa4tDaRpfWt21ep5/WqQ==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.5.tgz", + "integrity": "sha512-yJAxJfHVm0ZbsiljbtFFP1BQKLc8kUF6+17tjQ78QjqjAQDnhULWiTA6u0FCDmYT1oOKS9PzZ2z0aBI+Mcyj7Q==", "cpu": [ "ppc64" ], @@ -249,9 +249,9 @@ } }, "node_modules/@esbuild/linux-riscv64": { - "version": "0.18.17", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.18.17.tgz", - "integrity": "sha512-Wh/HW2MPnC3b8BqRSIme/9Zhab36PPH+3zam5pqGRH4pE+4xTrVLx2+XdGp6fVS3L2x+DrsIcsbMleex8fbE6g==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.5.tgz", + "integrity": "sha512-5u8cIR/t3gaD6ad3wNt1MNRstAZO+aNyBxu2We8X31bA8XUNyamTVQwLDA1SLoPCUehNCymhBhK3Qim1433Zag==", "cpu": [ "riscv64" ], @@ -265,9 +265,9 @@ } }, "node_modules/@esbuild/linux-s390x": { - "version": "0.18.17", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.18.17.tgz", - "integrity": "sha512-j/34jAl3ul3PNcK3pfI0NSlBANduT2UO5kZ7FCaK33XFv3chDhICLY8wJJWIhiQ+YNdQ9dxqQctRg2bvrMlYgg==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.5.tgz", + "integrity": "sha512-Z6JrMyEw/EmZBD/OFEFpb+gao9xJ59ATsoTNlj39jVBbXqoZm4Xntu6wVmGPB/OATi1uk/DB+yeDPv2E8PqZGw==", "cpu": [ "s390x" ], @@ -281,9 +281,9 @@ } }, "node_modules/@esbuild/linux-x64": { - "version": "0.18.17", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.18.17.tgz", - "integrity": "sha512-QM50vJ/y+8I60qEmFxMoxIx4de03pGo2HwxdBeFd4nMh364X6TIBZ6VQ5UQmPbQWUVWHWws5MmJXlHAXvJEmpQ==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.5.tgz", + "integrity": "sha512-psagl+2RlK1z8zWZOmVdImisMtrUxvwereIdyJTmtmHahJTKb64pAcqoPlx6CewPdvGvUKe2Jw+0Z/0qhSbG1A==", "cpu": [ "x64" ], @@ -297,9 +297,9 @@ } }, "node_modules/@esbuild/netbsd-x64": { - "version": "0.18.17", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.18.17.tgz", - "integrity": "sha512-/jGlhWR7Sj9JPZHzXyyMZ1RFMkNPjC6QIAan0sDOtIo2TYk3tZn5UDrkE0XgsTQCxWTTOcMPf9p6Rh2hXtl5TQ==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.5.tgz", + "integrity": "sha512-kL2l+xScnAy/E/3119OggX8SrWyBEcqAh8aOY1gr4gPvw76la2GlD4Ymf832UCVbmuWeTf2adkZDK+h0Z/fB4g==", "cpu": [ "x64" ], @@ -313,9 +313,9 @@ } }, "node_modules/@esbuild/openbsd-x64": { - "version": "0.18.17", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.18.17.tgz", - "integrity": "sha512-rSEeYaGgyGGf4qZM2NonMhMOP/5EHp4u9ehFiBrg7stH6BYEEjlkVREuDEcQ0LfIl53OXLxNbfuIj7mr5m29TA==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.5.tgz", + "integrity": "sha512-sPOfhtzFufQfTBgRnE1DIJjzsXukKSvZxloZbkJDG383q0awVAq600pc1nfqBcl0ice/WN9p4qLc39WhBShRTA==", "cpu": [ "x64" ], @@ -329,9 +329,9 @@ } }, "node_modules/@esbuild/sunos-x64": { - "version": "0.18.17", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.18.17.tgz", - "integrity": "sha512-Y7ZBbkLqlSgn4+zot4KUNYst0bFoO68tRgI6mY2FIM+b7ZbyNVtNbDP5y8qlu4/knZZ73fgJDlXID+ohY5zt5g==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.5.tgz", + "integrity": "sha512-dGZkBXaafuKLpDSjKcB0ax0FL36YXCvJNnztjKV+6CO82tTYVDSH2lifitJ29jxRMoUhgkg9a+VA/B03WK5lcg==", "cpu": [ "x64" ], @@ -345,9 +345,9 @@ } }, "node_modules/@esbuild/win32-arm64": { - "version": "0.18.17", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.18.17.tgz", - "integrity": "sha512-bwPmTJsEQcbZk26oYpc4c/8PvTY3J5/QK8jM19DVlEsAB41M39aWovWoHtNm78sd6ip6prilxeHosPADXtEJFw==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.5.tgz", + "integrity": "sha512-dWVjD9y03ilhdRQ6Xig1NWNgfLtf2o/STKTS+eZuF90fI2BhbwD6WlaiCGKptlqXlURVB5AUOxUj09LuwKGDTg==", "cpu": [ "arm64" ], @@ -361,9 +361,9 @@ } }, "node_modules/@esbuild/win32-ia32": { - "version": "0.18.17", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.18.17.tgz", - "integrity": "sha512-H/XaPtPKli2MhW+3CQueo6Ni3Avggi6hP/YvgkEe1aSaxw+AeO8MFjq8DlgfTd9Iz4Yih3QCZI6YLMoyccnPRg==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.5.tgz", + "integrity": "sha512-4liggWIA4oDgUxqpZwrDhmEfAH4d0iljanDOK7AnVU89T6CzHon/ony8C5LeOdfgx60x5cnQJFZwEydVlYx4iw==", "cpu": [ "ia32" ], @@ -377,9 +377,9 @@ } }, "node_modules/@esbuild/win32-x64": { - "version": "0.18.17", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.18.17.tgz", - "integrity": "sha512-fGEb8f2BSA3CW7riJVurug65ACLuQAzKq0SSqkY2b2yHHH0MzDfbLyKIGzHwOI/gkHcxM/leuSW6D5w/LMNitA==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.5.tgz", + "integrity": "sha512-czTrygUsB/jlM8qEW5MD8bgYU2Xg14lo6kBDXW6HdxKjh8M5PzETGiSHaz9MtbXBYDloHNUAUW2tMiKW4KM9Mw==", "cpu": [ "x64" ], @@ -408,18 +408,18 @@ } }, "node_modules/@eslint-community/regexpp": { - "version": "4.6.2", - "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.6.2.tgz", - "integrity": "sha512-pPTNuaAG3QMH+buKyBIGJs3g/S5y0caxw0ygM3YyE6yJFySwiGGSzA+mM3KJ8QQvzeLh3blwgSonkFjgQdxzMw==", + "version": "4.10.0", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.10.0.tgz", + "integrity": "sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA==", "dev": true, "engines": { "node": "^12.0.0 || ^14.0.0 || >=16.0.0" } }, "node_modules/@eslint/eslintrc": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.1.tgz", - "integrity": "sha512-9t7ZA7NGGK8ckelF0PQCfcxIUzs1Md5rrO6U/c+FIQNanea5UZC0wqKXH4vHBccmu4ZJgZ2idtPeW7+Q2npOEA==", + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.2.tgz", + "integrity": "sha512-+wvgpDsrB1YqAMdEUCcnTlpfVBH7Vqn6A/NT3D8WVXFIaKMlErPIZT3oCIAVCOtarRpMtelZLqJeU3t7WY6X6g==", "dev": true, "dependencies": { "ajv": "^6.12.4", @@ -440,21 +440,21 @@ } }, "node_modules/@eslint/js": { - "version": "8.46.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.46.0.tgz", - "integrity": "sha512-a8TLtmPi8xzPkCbp/OGFUo5yhRkHM2Ko9kOWP4znJr0WAhWyThaw3PnwX4vOTWOAMsV2uRt32PPDcEz63esSaA==", + "version": "8.52.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.52.0.tgz", + "integrity": "sha512-mjZVbpaeMZludF2fsWLD0Z9gCref1Tk4i9+wddjRvpUNqqcndPkBD09N/Mapey0b3jaXbLm2kICwFv2E64QinA==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, "node_modules/@humanwhocodes/config-array": { - "version": "0.11.10", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.10.tgz", - "integrity": "sha512-KVVjQmNUepDVGXNuoRRdmmEjruj0KfiGSbS8LVc12LMsWDQzRXJ0qdhN8L8uUigKpfEHRhlaQFY0ib1tnUbNeQ==", + "version": "0.11.13", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.13.tgz", + "integrity": "sha512-JSBDMiDKSzQVngfRjOdFXgFfklaXI4K9nLF49Auh21lmBWRLIK3+xTErTWD4KU54pb6coM6ESE7Awz/FNU3zgQ==", "dev": true, "dependencies": { - "@humanwhocodes/object-schema": "^1.2.1", + "@humanwhocodes/object-schema": "^2.0.1", "debug": "^4.1.1", "minimatch": "^3.0.5" }, @@ -476,9 +476,9 @@ } }, "node_modules/@humanwhocodes/object-schema": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", - "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.1.tgz", + "integrity": "sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw==", "dev": true }, "node_modules/@isaacs/cliui": { @@ -526,9 +526,9 @@ } }, "node_modules/@multiversx/sdk-core": { - "version": "12.6.0", - "resolved": "https://registry.npmjs.org/@multiversx/sdk-core/-/sdk-core-12.6.0.tgz", - "integrity": "sha512-aJjSn8EzaYXalUuvAuxOTPtv8GDbimJlSYNRLjCsToyfwGAyS9cRllmq2d1I2nlrR89YgAsOL9qp+sI5DA7yBw==", + "version": "12.11.0", + "resolved": "https://registry.npmjs.org/@multiversx/sdk-core/-/sdk-core-12.11.0.tgz", + "integrity": "sha512-rQRvjx6f1AE8TK5LObxthP7hCUCf6bc9QBAmiOJJ1Na5VS1iPhm5jDqnlCa7oieMb1HYdHQAEkoWNSsPKe/8vA==", "dev": true, "dependencies": { "@multiversx/sdk-transaction-decoder": "1.0.2", @@ -551,18 +551,18 @@ } }, "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==", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@multiversx/sdk-native-auth-client/-/sdk-native-auth-client-1.0.5.tgz", + "integrity": "sha512-MA9KCNy2K0Irw+RMn01mxXB3Z+EcpMuUFBqr6ZhVQyxmXjujK+CHvlXH5TSADIm5Yw2SfGjFGdiqRu64lNVvuA==", "dev": true, "dependencies": { "axios": "0.24.0" } }, "node_modules/@multiversx/sdk-network-providers": { - "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==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@multiversx/sdk-network-providers/-/sdk-network-providers-2.0.0.tgz", + "integrity": "sha512-87QlwC2kaNtywDv2IVX/cavRfR4D5N7XgqOvsZTyMXRVbfWOUlDocrRr5BdvmC1gDdSOQH++nFEDHiMfnKmRng==", "dev": true, "dependencies": { "axios": "0.24.0", @@ -588,13 +588,13 @@ "dev": true }, "node_modules/@multiversx/sdk-wallet-connect-provider": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/@multiversx/sdk-wallet-connect-provider/-/sdk-wallet-connect-provider-4.0.3.tgz", - "integrity": "sha512-j48gz0ZBuYAUbEKx3qN2AvwZssNHYASwfng/ek097wgmDEIH8cfeA1ujkN6FF0WMvh8T6bIHtOHKWH3diZ/Fdg==", + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@multiversx/sdk-wallet-connect-provider/-/sdk-wallet-connect-provider-4.0.4.tgz", + "integrity": "sha512-k+t/M0U1SnHsdLmcbXkoYgA5+R3KJA+h8N4uC026l1fRz8Vo7g3joQoqLi5qSanuc0S+uiInpDyIoq0fbFLUjA==", "dev": true, "dependencies": { - "@walletconnect/sign-client": "2.9.1", - "@walletconnect/utils": "2.9.1", + "@walletconnect/sign-client": "2.10.2", + "@walletconnect/utils": "2.10.2", "bech32": "1.1.4" }, "peerDependencies": { @@ -602,9 +602,9 @@ } }, "node_modules/@multiversx/sdk-web-wallet-provider": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@multiversx/sdk-web-wallet-provider/-/sdk-web-wallet-provider-3.0.0.tgz", - "integrity": "sha512-JzyOJJKx+vr1kMRHwVx6Y/SBSo/yUeWAHPeUJtvmjyRrTEhniYUhuKgy6U8lkD4djLKf8G/qpUOXwvfu4fbXuw==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@multiversx/sdk-web-wallet-provider/-/sdk-web-wallet-provider-3.1.0.tgz", + "integrity": "sha512-gIE7AudJl5Ax64AMAD0o6m0cVi+dI5LW2TSM5M9K7zKMWWCflhv27a2A61JkCIQ6CK5OTIkMXaFb61OzUqhplQ==", "dev": true, "dependencies": { "qs": "6.10.3" @@ -679,9 +679,9 @@ } }, "node_modules/@pkgr/utils/node_modules/tslib": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.1.tgz", - "integrity": "sha512-t0hLfiEKfMUoqhG+U1oid7Pva4bbDPHYfJNiB7BiIjRkj1pyC++4N3huJfqY6aRH6VTB0rvtzQwjM4K6qpfOig==", + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", "dev": true }, "node_modules/@protobufjs/aspromise": { @@ -913,57 +913,59 @@ } }, "node_modules/@types/json-schema": { - "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==", + "version": "7.0.14", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.14.tgz", + "integrity": "sha512-U3PUjAudAdJBeC2pgN8uTIKgxrb4nlDF3SF0++EldXQvQBGkpFZMSnwQiIoDU77tv45VgNkl/L4ouD+rEomujw==", "dev": true }, "node_modules/@types/node": { - "version": "20.4.7", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.7.tgz", - "integrity": "sha512-bUBrPjEry2QUTsnuEjzjbS7voGWCc30W0qzgMf90GPeDGFRakvrz47ju+oqDAKCXLUCe39u57/ORMl/O/04/9g==", - "dev": true + "version": "20.8.9", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.8.9.tgz", + "integrity": "sha512-UzykFsT3FhHb1h7yD4CA4YhBHq545JC0YnEz41xkipN88eKQtL6rSgocL5tbAP6Ola9Izm/Aw4Ora8He4x0BHg==", + "dev": true, + "dependencies": { + "undici-types": "~5.26.4" + } }, "node_modules/@types/qrcode": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/@types/qrcode/-/qrcode-1.5.1.tgz", - "integrity": "sha512-HpSN675K0PmxIDRpjMI3Mc2GiKo3dNu+X/F5SoItiaDS1lVfgC6Wac1c5lQDfKWbTJUSHWiHKzpJpBZG7k9gaA==", + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/@types/qrcode/-/qrcode-1.5.4.tgz", + "integrity": "sha512-ufYqUO7wUBq49hugJry+oIYKscvxIQerJSmXeny215aJKfrepN04DDZP8FCgxvV82kOqKPULCE4PIW3qUmZrRA==", "dev": true, "dependencies": { "@types/node": "*" } }, "node_modules/@types/semver": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.0.tgz", - "integrity": "sha512-G8hZ6XJiHnuhQKR7ZmysCeJWE08o8T0AXtk5darsCaTVsYZhhgUrq53jizaR2FvsoeCwJhlmwTjkXBY5Pn/ZHw==", + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-MMzuxN3GdFwskAnb6fz0orFvhfqi752yjaXylr0Rp4oDg5H0Zn1IuyRhDVvYOwAXoJirx2xuS16I3WjxnAIHiQ==", "dev": true }, "node_modules/@types/serve-handler": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/@types/serve-handler/-/serve-handler-6.1.1.tgz", - "integrity": "sha512-bIwSmD+OV8w0t2e7EWsuQYlGoS1o5aEdVktgkXaa43Zm0qVWi21xaSRb3DQA1UXD+DJ5bRq1Rgu14ZczB+CjIQ==", + "version": "6.1.3", + "resolved": "https://registry.npmjs.org/@types/serve-handler/-/serve-handler-6.1.3.tgz", + "integrity": "sha512-mvboyl5x5LsPPsjntm/BK/EZZqbOCITqNjOVOkl/bbB97yVmIUIyOP7+OjNj/9Iuh6hCH6RYuugPuO4avlPWcg==", "dev": true, "dependencies": { "@types/node": "*" } }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.2.1.tgz", - "integrity": "sha512-iZVM/ALid9kO0+I81pnp1xmYiFyqibAHzrqX4q5YvvVEyJqY+e6rfTXSCsc2jUxGNqJqTfFSSij/NFkZBiBzLw==", + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.9.0.tgz", + "integrity": "sha512-lgX7F0azQwRPB7t7WAyeHWVfW1YJ9NIgd9mvGhfQpRY56X6AVf8mwM8Wol+0z4liE7XX3QOt8MN1rUKCfSjRIA==", "dev": true, "dependencies": { "@eslint-community/regexpp": "^4.5.1", - "@typescript-eslint/scope-manager": "6.2.1", - "@typescript-eslint/type-utils": "6.2.1", - "@typescript-eslint/utils": "6.2.1", - "@typescript-eslint/visitor-keys": "6.2.1", + "@typescript-eslint/scope-manager": "6.9.0", + "@typescript-eslint/type-utils": "6.9.0", + "@typescript-eslint/utils": "6.9.0", + "@typescript-eslint/visitor-keys": "6.9.0", "debug": "^4.3.4", "graphemer": "^1.4.0", "ignore": "^5.2.4", "natural-compare": "^1.4.0", - "natural-compare-lite": "^1.4.0", "semver": "^7.5.4", "ts-api-utils": "^1.0.1" }, @@ -985,15 +987,15 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.2.1.tgz", - "integrity": "sha512-Ld+uL1kYFU8e6btqBFpsHkwQ35rw30IWpdQxgOqOh4NfxSDH6uCkah1ks8R/RgQqI5hHPXMaLy9fbFseIe+dIg==", + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.9.0.tgz", + "integrity": "sha512-GZmjMh4AJ/5gaH4XF2eXA8tMnHWP+Pm1mjQR2QN4Iz+j/zO04b9TOvJYOX2sCNIQHtRStKTxRY1FX7LhpJT4Gw==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "6.2.1", - "@typescript-eslint/types": "6.2.1", - "@typescript-eslint/typescript-estree": "6.2.1", - "@typescript-eslint/visitor-keys": "6.2.1", + "@typescript-eslint/scope-manager": "6.9.0", + "@typescript-eslint/types": "6.9.0", + "@typescript-eslint/typescript-estree": "6.9.0", + "@typescript-eslint/visitor-keys": "6.9.0", "debug": "^4.3.4" }, "engines": { @@ -1013,13 +1015,13 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.2.1.tgz", - "integrity": "sha512-UCqBF9WFqv64xNsIEPfBtenbfodPXsJ3nPAr55mGPkQIkiQvgoWNo+astj9ZUfJfVKiYgAZDMnM6dIpsxUMp3Q==", + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.9.0.tgz", + "integrity": "sha512-1R8A9Mc39n4pCCz9o79qRO31HGNDvC7UhPhv26TovDsWPBDx+Sg3rOZdCELIA3ZmNoWAuxaMOT7aWtGRSYkQxw==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.2.1", - "@typescript-eslint/visitor-keys": "6.2.1" + "@typescript-eslint/types": "6.9.0", + "@typescript-eslint/visitor-keys": "6.9.0" }, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -1030,13 +1032,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.2.1.tgz", - "integrity": "sha512-fTfCgomBMIgu2Dh2Or3gMYgoNAnQm3RLtRp+jP7A8fY+LJ2+9PNpi5p6QB5C4RSP+U3cjI0vDlI3mspAkpPVbQ==", + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.9.0.tgz", + "integrity": "sha512-XXeahmfbpuhVbhSOROIzJ+b13krFmgtc4GlEuu1WBT+RpyGPIA4Y/eGnXzjbDj5gZLzpAXO/sj+IF/x2GtTMjQ==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "6.2.1", - "@typescript-eslint/utils": "6.2.1", + "@typescript-eslint/typescript-estree": "6.9.0", + "@typescript-eslint/utils": "6.9.0", "debug": "^4.3.4", "ts-api-utils": "^1.0.1" }, @@ -1057,9 +1059,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.2.1.tgz", - "integrity": "sha512-528bGcoelrpw+sETlyM91k51Arl2ajbNT9L4JwoXE2dvRe1yd8Q64E4OL7vHYw31mlnVsf+BeeLyAZUEQtqahQ==", + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.9.0.tgz", + "integrity": "sha512-+KB0lbkpxBkBSiVCuQvduqMJy+I1FyDbdwSpM3IoBS7APl4Bu15lStPjgBIdykdRqQNYqYNMa8Kuidax6phaEw==", "dev": true, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -1070,13 +1072,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.2.1.tgz", - "integrity": "sha512-G+UJeQx9AKBHRQBpmvr8T/3K5bJa485eu+4tQBxFq0KoT22+jJyzo1B50JDT9QdC1DEmWQfdKsa8ybiNWYsi0Q==", + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.9.0.tgz", + "integrity": "sha512-NJM2BnJFZBEAbCfBP00zONKXvMqihZCrmwCaik0UhLr0vAgb6oguXxLX1k00oQyD+vZZ+CJn3kocvv2yxm4awQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.2.1", - "@typescript-eslint/visitor-keys": "6.2.1", + "@typescript-eslint/types": "6.9.0", + "@typescript-eslint/visitor-keys": "6.9.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -1097,17 +1099,17 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.2.1.tgz", - "integrity": "sha512-eBIXQeupYmxVB6S7x+B9SdBeB6qIdXKjgQBge2J+Ouv8h9Cxm5dHf/gfAZA6dkMaag+03HdbVInuXMmqFB/lKQ==", + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.9.0.tgz", + "integrity": "sha512-5Wf+Jsqya7WcCO8me504FBigeQKVLAMPmUzYgDbWchINNh1KJbxCgVya3EQ2MjvJMVeXl3pofRmprqX6mfQkjQ==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", "@types/json-schema": "^7.0.12", "@types/semver": "^7.5.0", - "@typescript-eslint/scope-manager": "6.2.1", - "@typescript-eslint/types": "6.2.1", - "@typescript-eslint/typescript-estree": "6.2.1", + "@typescript-eslint/scope-manager": "6.9.0", + "@typescript-eslint/types": "6.9.0", + "@typescript-eslint/typescript-estree": "6.9.0", "semver": "^7.5.4" }, "engines": { @@ -1122,12 +1124,12 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.2.1.tgz", - "integrity": "sha512-iTN6w3k2JEZ7cyVdZJTVJx2Lv7t6zFA8DCrJEHD2mwfc16AEvvBWVhbFh34XyG2NORCd0viIgQY1+u7kPI0WpA==", + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.9.0.tgz", + "integrity": "sha512-dGtAfqjV6RFOtIP8I0B4ZTBRrlTT8NHHlZZSchQx3qReaoDeXhYM++M4So2AgFK9ZB0emRPA6JI1HkafzA2Ibg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.2.1", + "@typescript-eslint/types": "6.9.0", "eslint-visitor-keys": "^3.4.1" }, "engines": { @@ -1138,10 +1140,16 @@ "url": "https://opencollective.com/typescript-eslint" } }, + "node_modules/@ungap/structured-clone": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz", + "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==", + "dev": true + }, "node_modules/@walletconnect/core": { - "version": "2.9.1", - "resolved": "https://registry.npmjs.org/@walletconnect/core/-/core-2.9.1.tgz", - "integrity": "sha512-xyWeP0eLhEEDQAVJSmqs4n/AClKUM+8os2ZFe7BTuw1tFYjeLNVDtKCHziVOSTh8wEChMsKSGKA4zerQoH8mAQ==", + "version": "2.10.2", + "resolved": "https://registry.npmjs.org/@walletconnect/core/-/core-2.10.2.tgz", + "integrity": "sha512-JQz/xp3SLEpTeRQctdck2ugSBVEpMxoSE+lFi2voJkZop1hv6P+uqr6E4PzjFluAjeAnKlT1xvra0aFWjPWVcw==", "dev": true, "dependencies": { "@walletconnect/heartbeat": "1.2.1", @@ -1155,8 +1163,8 @@ "@walletconnect/relay-auth": "^1.0.4", "@walletconnect/safe-json": "^1.0.2", "@walletconnect/time": "^1.0.2", - "@walletconnect/types": "2.9.1", - "@walletconnect/utils": "2.9.1", + "@walletconnect/types": "2.10.2", + "@walletconnect/utils": "2.10.2", "events": "^3.3.0", "lodash.isequal": "4.5.0", "uint8arrays": "^3.1.0" @@ -1303,19 +1311,19 @@ } }, "node_modules/@walletconnect/sign-client": { - "version": "2.9.1", - "resolved": "https://registry.npmjs.org/@walletconnect/sign-client/-/sign-client-2.9.1.tgz", - "integrity": "sha512-Z7tFRrJ9btA1vU427vsjUS6cPlHQVcTWdKH90khEc2lv3dB6mU8FNO0VJsw+I2D7CW7WaMWF3nnj6Z1FfotbDg==", + "version": "2.10.2", + "resolved": "https://registry.npmjs.org/@walletconnect/sign-client/-/sign-client-2.10.2.tgz", + "integrity": "sha512-vviSLV3f92I0bReX+OLr1HmbH0uIzYEQQFd1MzIfDk9PkfFT/LLAHhUnDaIAMkIdippqDcJia+5QEtT4JihL3Q==", "dev": true, "dependencies": { - "@walletconnect/core": "2.9.1", + "@walletconnect/core": "2.10.2", "@walletconnect/events": "^1.0.1", "@walletconnect/heartbeat": "1.2.1", "@walletconnect/jsonrpc-utils": "1.0.8", "@walletconnect/logger": "^2.0.1", "@walletconnect/time": "^1.0.2", - "@walletconnect/types": "2.9.1", - "@walletconnect/utils": "2.9.1", + "@walletconnect/types": "2.10.2", + "@walletconnect/utils": "2.10.2", "events": "^3.3.0" } }, @@ -1329,9 +1337,9 @@ } }, "node_modules/@walletconnect/types": { - "version": "2.9.1", - "resolved": "https://registry.npmjs.org/@walletconnect/types/-/types-2.9.1.tgz", - "integrity": "sha512-xbGgTPuD6xsb7YMvCESBIH55cjB86QAnnVL50a/ED42YkQzDsOdJ0VGTbrm0tG5cxUOF933rpxZQjxGdP+ovww==", + "version": "2.10.2", + "resolved": "https://registry.npmjs.org/@walletconnect/types/-/types-2.10.2.tgz", + "integrity": "sha512-luNV+07Wdla4STi9AejseCQY31tzWKQ5a7C3zZZaRK/di+rFaAAb7YW04OP4klE7tw/mJRGPTlekZElmHxO8kQ==", "dev": true, "dependencies": { "@walletconnect/events": "^1.0.1", @@ -1343,9 +1351,9 @@ } }, "node_modules/@walletconnect/utils": { - "version": "2.9.1", - "resolved": "https://registry.npmjs.org/@walletconnect/utils/-/utils-2.9.1.tgz", - "integrity": "sha512-tXeQVebF5oPBvhdmuUyVSkSIBYx/egIi4czav1QrnUpwrUS1LsrFhyWBxSbhN7TXY287ULWkEf6aFpWOHdp5EA==", + "version": "2.10.2", + "resolved": "https://registry.npmjs.org/@walletconnect/utils/-/utils-2.10.2.tgz", + "integrity": "sha512-syxXRpc2yhSknMu3IfiBGobxOY7fLfLTJuw+ppKaeO6WUdZpIit3wfuGOcc0Ms3ZPFCrGfyGOoZsCvgdXtptRg==", "dev": true, "dependencies": { "@stablelib/chacha20poly1305": "1.0.1", @@ -1356,7 +1364,7 @@ "@walletconnect/relay-api": "^1.0.9", "@walletconnect/safe-json": "^1.0.2", "@walletconnect/time": "^1.0.2", - "@walletconnect/types": "2.9.1", + "@walletconnect/types": "2.10.2", "@walletconnect/window-getters": "^1.0.1", "@walletconnect/window-metadata": "^1.0.1", "detect-browser": "5.3.0", @@ -1384,9 +1392,9 @@ } }, "node_modules/acorn": { - "version": "8.10.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", - "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==", + "version": "8.11.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.2.tgz", + "integrity": "sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==", "dev": true, "bin": { "acorn": "bin/acorn" @@ -1478,15 +1486,16 @@ "dev": true }, "node_modules/assert": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/assert/-/assert-2.0.0.tgz", - "integrity": "sha512-se5Cd+js9dXJnu6Ag2JFc00t+HmHOen+8Q+L7O9zI0PqQXr20uk2J0XQqMxZEeo5U50o8Nvmmx7dZrl+Ufr35A==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/assert/-/assert-2.1.0.tgz", + "integrity": "sha512-eLHpSK/Y4nhMJ07gDaAzoX/XAKS8PSaojml3M0DM4JpV1LAi5JOJ/p6H/XWrl8L+DzVEvVCW1z3vWAaB9oTsQw==", "dev": true, "dependencies": { - "es6-object-assign": "^1.1.0", - "is-nan": "^1.2.1", - "object-is": "^1.0.1", - "util": "^0.12.0" + "call-bind": "^1.0.2", + "is-nan": "^1.3.2", + "object-is": "^1.1.5", + "object.assign": "^4.1.4", + "util": "^0.12.5" } }, "node_modules/atomic-sleep": { @@ -1697,20 +1706,23 @@ } }, "node_modules/browserify-sign": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.2.1.tgz", - "integrity": "sha512-/vrA5fguVAKKAVTNJjgSm1tRQDHUU6DbwO9IROu/0WAzC8PKhucDSh18J0RMvVeHAn5puMd+QHC2erPRNf8lmg==", + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.2.2.tgz", + "integrity": "sha512-1rudGyeYY42Dk6texmv7c4VcQ0EsvVbLwZkA+AQB7SxvXxmcD93jcHie8bzecJ+ChDlmAm2Qyu0+Ccg5uhZXCg==", "dev": true, "dependencies": { - "bn.js": "^5.1.1", - "browserify-rsa": "^4.0.1", + "bn.js": "^5.2.1", + "browserify-rsa": "^4.1.0", "create-hash": "^1.2.0", "create-hmac": "^1.1.7", - "elliptic": "^6.5.3", + "elliptic": "^6.5.4", "inherits": "^2.0.4", - "parse-asn1": "^5.1.5", - "readable-stream": "^3.6.0", - "safe-buffer": "^5.2.0" + "parse-asn1": "^5.1.6", + "readable-stream": "^3.6.2", + "safe-buffer": "^5.2.1" + }, + "engines": { + "node": ">= 4" } }, "node_modules/browserify-zlib": { @@ -1783,13 +1795,14 @@ } }, "node_modules/call-bind": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", - "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.5.tgz", + "integrity": "sha512-C3nQxfFZxFRVoJoGKKI8y3MOEo129NQ+FgQ08iye+Mk4zNZZGdjfs06bVTr+DBSlA66Q2VEcMki/cUCP4SercQ==", "dev": true, "dependencies": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.1", + "set-function-length": "^1.1.1" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -2089,6 +2102,20 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/define-data-property": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.1.tgz", + "integrity": "sha512-E7uGkTzkk1d0ByLeSc6ZsFS79Axg+m1P/VsgYsxHgiuc3tFSj+MjMIwe90FC4lOAZzNBdY7kkO2P2wKdsQ1vgQ==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.2.1", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/define-lazy-prop": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-3.0.0.tgz", @@ -2102,11 +2129,12 @@ } }, "node_modules/define-properties": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.0.tgz", - "integrity": "sha512-xvqAVKGfT1+UAvPwKTVw/njhdQ8ZhXK4lI0bCIuCMrp2up9nPnaDftrLtmpTazqd1o+UY4zgzU+avtMbDP+ldA==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz", + "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==", "dev": true, "dependencies": { + "define-data-property": "^1.0.1", "has-property-descriptors": "^1.0.0", "object-keys": "^1.1.1" }, @@ -2252,16 +2280,10 @@ "once": "^1.4.0" } }, - "node_modules/es6-object-assign": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/es6-object-assign/-/es6-object-assign-1.1.0.tgz", - "integrity": "sha512-MEl9uirslVwqQU369iHNWZXsI8yaZYGg/D65aOgZkeyFJwHYSxilf7rQzXKI7DdDuBPrBXbfk3sl9hJhmd5AUw==", - "dev": true - }, "node_modules/esbuild": { - "version": "0.18.17", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.18.17.tgz", - "integrity": "sha512-1GJtYnUxsJreHYA0Y+iQz2UEykonY66HNWOb0yXYZi9/kNrORUEHVg87eQsCtqh59PEJ5YVZJO98JHznMJSWjg==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.5.tgz", + "integrity": "sha512-bUxalY7b1g8vNhQKdB24QDmHeY4V4tw/s6Ak5z+jJX9laP5MoQseTOMemAr0gxssjNcH0MCViG8ONI2kksvfFQ==", "dev": true, "hasInstallScript": true, "bin": { @@ -2271,28 +2293,28 @@ "node": ">=12" }, "optionalDependencies": { - "@esbuild/android-arm": "0.18.17", - "@esbuild/android-arm64": "0.18.17", - "@esbuild/android-x64": "0.18.17", - "@esbuild/darwin-arm64": "0.18.17", - "@esbuild/darwin-x64": "0.18.17", - "@esbuild/freebsd-arm64": "0.18.17", - "@esbuild/freebsd-x64": "0.18.17", - "@esbuild/linux-arm": "0.18.17", - "@esbuild/linux-arm64": "0.18.17", - "@esbuild/linux-ia32": "0.18.17", - "@esbuild/linux-loong64": "0.18.17", - "@esbuild/linux-mips64el": "0.18.17", - "@esbuild/linux-ppc64": "0.18.17", - "@esbuild/linux-riscv64": "0.18.17", - "@esbuild/linux-s390x": "0.18.17", - "@esbuild/linux-x64": "0.18.17", - "@esbuild/netbsd-x64": "0.18.17", - "@esbuild/openbsd-x64": "0.18.17", - "@esbuild/sunos-x64": "0.18.17", - "@esbuild/win32-arm64": "0.18.17", - "@esbuild/win32-ia32": "0.18.17", - "@esbuild/win32-x64": "0.18.17" + "@esbuild/android-arm": "0.19.5", + "@esbuild/android-arm64": "0.19.5", + "@esbuild/android-x64": "0.19.5", + "@esbuild/darwin-arm64": "0.19.5", + "@esbuild/darwin-x64": "0.19.5", + "@esbuild/freebsd-arm64": "0.19.5", + "@esbuild/freebsd-x64": "0.19.5", + "@esbuild/linux-arm": "0.19.5", + "@esbuild/linux-arm64": "0.19.5", + "@esbuild/linux-ia32": "0.19.5", + "@esbuild/linux-loong64": "0.19.5", + "@esbuild/linux-mips64el": "0.19.5", + "@esbuild/linux-ppc64": "0.19.5", + "@esbuild/linux-riscv64": "0.19.5", + "@esbuild/linux-s390x": "0.19.5", + "@esbuild/linux-x64": "0.19.5", + "@esbuild/netbsd-x64": "0.19.5", + "@esbuild/openbsd-x64": "0.19.5", + "@esbuild/sunos-x64": "0.19.5", + "@esbuild/win32-arm64": "0.19.5", + "@esbuild/win32-ia32": "0.19.5", + "@esbuild/win32-x64": "0.19.5" } }, "node_modules/escape-string-regexp": { @@ -2308,18 +2330,19 @@ } }, "node_modules/eslint": { - "version": "8.46.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.46.0.tgz", - "integrity": "sha512-cIO74PvbW0qU8e0mIvk5IV3ToWdCq5FYG6gWPHHkx6gNdjlbAYvtfHmlCMXxjcoVaIdwy/IAt3+mDkZkfvb2Dg==", + "version": "8.52.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.52.0.tgz", + "integrity": "sha512-zh/JHnaixqHZsolRB/w9/02akBk9EPrOs9JwcTP2ek7yL5bVvXuRariiaAjjoJ5DvuwQ1WAE/HsMz+w17YgBCg==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", - "@eslint/eslintrc": "^2.1.1", - "@eslint/js": "^8.46.0", - "@humanwhocodes/config-array": "^0.11.10", + "@eslint/eslintrc": "^2.1.2", + "@eslint/js": "8.52.0", + "@humanwhocodes/config-array": "^0.11.13", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", + "@ungap/structured-clone": "^1.2.0", "ajv": "^6.12.4", "chalk": "^4.0.0", "cross-spawn": "^7.0.2", @@ -2327,7 +2350,7 @@ "doctrine": "^3.0.0", "escape-string-regexp": "^4.0.0", "eslint-scope": "^7.2.2", - "eslint-visitor-keys": "^3.4.2", + "eslint-visitor-keys": "^3.4.3", "espree": "^9.6.1", "esquery": "^1.4.2", "esutils": "^2.0.2", @@ -2362,9 +2385,9 @@ } }, "node_modules/eslint-config-prettier": { - "version": "8.10.0", - "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.10.0.tgz", - "integrity": "sha512-SM8AMJdeQqRYT9O9zguiruQZaN7+z+E4eAP9oiLNGKMtomwaB1E9dcgUD6ZAn/eQAb52USbvezbiljfZUhbJcg==", + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.0.0.tgz", + "integrity": "sha512-IcJsTkJae2S35pRsRAwoCE+925rJJStOdkKnLVgtE+tEpqU0EVVM7OqrwxqgptKdX29NUwC82I5pXsGFIgSevw==", "dev": true, "bin": { "eslint-config-prettier": "bin/cli.js" @@ -2374,9 +2397,9 @@ } }, "node_modules/eslint-plugin-prettier": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.0.0.tgz", - "integrity": "sha512-AgaZCVuYDXHUGxj/ZGu1u8H8CYgDY3iG6w5kUFw4AzMVXzB7VvbKgYR4nATIN+OvUrghMbiDLeimVjVY5ilq3w==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.0.1.tgz", + "integrity": "sha512-m3u5RnR56asrwV/lDC4GHorlW75DsFfmUcjfCYylTUs85dBRnB7VM6xG8eCMJdeDRnppzmxZVf1GEPJvl1JmNg==", "dev": true, "dependencies": { "prettier-linter-helpers": "^1.0.0", @@ -2402,19 +2425,7 @@ } } }, - "node_modules/eslint-visitor-keys": { - "version": "3.4.2", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.2.tgz", - "integrity": "sha512-8drBzUEyZ2llkpCA67iYrgEssKDUu68V8ChqqOfFupIaG/LCVPUT+CoGJpT77zJprs4T/W7p07LP7zAIMuweVw==", - "dev": true, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/eslint/node_modules/eslint-scope": { + "node_modules/eslint-scope": { "version": "7.2.2", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", @@ -2430,13 +2441,16 @@ "url": "https://opencollective.com/eslint" } }, - "node_modules/eslint/node_modules/estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", "dev": true, "engines": { - "node": ">=4.0" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" } }, "node_modules/espree": { @@ -2468,15 +2482,6 @@ "node": ">=0.10" } }, - "node_modules/esquery/node_modules/estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "dev": true, - "engines": { - "node": ">=4.0" - } - }, "node_modules/esrecurse": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", @@ -2489,7 +2494,7 @@ "node": ">=4.0" } }, - "node_modules/esrecurse/node_modules/estraverse": { + "node_modules/estraverse": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", @@ -2684,16 +2689,17 @@ } }, "node_modules/flat-cache": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", - "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.1.1.tgz", + "integrity": "sha512-/qM2b3LUIaIgviBQovTLvijfyOQXPtSRnRK26ksj2J7rzPIecePUIpJsZ4T02Qg+xiAEKIs5K8dsHEd+VaKa/Q==", "dev": true, "dependencies": { - "flatted": "^3.1.0", + "flatted": "^3.2.9", + "keyv": "^4.5.3", "rimraf": "^3.0.2" }, "engines": { - "node": "^10.12.0 || >=12.0.0" + "node": ">=12.0.0" } }, "node_modules/flat-cache/node_modules/glob": { @@ -2732,15 +2738,15 @@ } }, "node_modules/flatted": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz", - "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==", + "version": "3.2.9", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.9.tgz", + "integrity": "sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==", "dev": true }, "node_modules/follow-redirects": { - "version": "1.15.2", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", - "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", + "version": "1.15.3", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.3.tgz", + "integrity": "sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==", "dev": true, "funding": [ { @@ -2789,10 +2795,13 @@ "dev": true }, "node_modules/function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", - "dev": true + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, "node_modules/get-caller-file": { "version": "2.0.5", @@ -2804,15 +2813,15 @@ } }, "node_modules/get-intrinsic": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz", - "integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==", + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.2.tgz", + "integrity": "sha512-0gSo4ml/0j98Y3lngkFEot/zhiCeWsbYIlZ+uZOVgzLyLaUw7wxUL+nCTP0XJvJg1AXulJRI3UJi8GsbDuxdGA==", "dev": true, "dependencies": { - "function-bind": "^1.1.1", - "has": "^1.0.3", + "function-bind": "^1.1.2", "has-proto": "^1.0.1", - "has-symbols": "^1.0.3" + "has-symbols": "^1.0.3", + "hasown": "^2.0.0" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -2831,19 +2840,19 @@ } }, "node_modules/glob": { - "version": "10.3.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.3.tgz", - "integrity": "sha512-92vPiMb/iqpmEgsOoIDvTjc50wf9CCCvMzsi6W0JLPeUKE8TWP1a73PgqSrqy7iAZxaSD1YdzU7QZR5LF51MJw==", + "version": "10.3.10", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.10.tgz", + "integrity": "sha512-fa46+tv1Ak0UPK1TOy/pZrIybNNt4HCv7SDzwyfiOZkvZLEbjsZkJBPtDHVshZjbecAoAGSC20MjLDG/qr679g==", "dev": true, "dependencies": { "foreground-child": "^3.1.0", - "jackspeak": "^2.0.3", + "jackspeak": "^2.3.5", "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" + "glob": "dist/esm/bin.mjs" }, "engines": { "node": ">=16 || 14 >=14.17" @@ -2889,9 +2898,9 @@ } }, "node_modules/globals": { - "version": "13.20.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.20.0.tgz", - "integrity": "sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ==", + "version": "13.23.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.23.0.tgz", + "integrity": "sha512-XAmF0RjlrjY23MA51q3HltdlGxUpXPvg0GioKiD9X6HD28iMjo2dKC8Vqwm7lne4GNr78+RHTfliktR6ZH09wA==", "dev": true, "dependencies": { "type-fest": "^0.20.2" @@ -2941,18 +2950,6 @@ "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", "dev": true }, - "node_modules/has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "dev": true, - "dependencies": { - "function-bind": "^1.1.1" - }, - "engines": { - "node": ">= 0.4.0" - } - }, "node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -2963,12 +2960,12 @@ } }, "node_modules/has-property-descriptors": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz", - "integrity": "sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.1.tgz", + "integrity": "sha512-VsX8eaIewvas0xnvinAe9bw4WfIeODpGYikiWYLH+dma0Jw6KHYqWiWfhQlgOVK8D6PvjubK5Uc4P0iIhIcNVg==", "dev": true, "dependencies": { - "get-intrinsic": "^1.1.1" + "get-intrinsic": "^1.2.2" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -3037,6 +3034,18 @@ "minimalistic-assert": "^1.0.1" } }, + "node_modules/hasown": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz", + "integrity": "sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/hmac-drbg": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", @@ -3162,12 +3171,12 @@ } }, "node_modules/is-core-module": { - "version": "2.12.1", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.12.1.tgz", - "integrity": "sha512-Q4ZuBAe2FUsKtyQJoQHlvP8OvBERxO3jEmy1I7hcRXcJBGGHFh/aJBswbXuS9sgrDH2QUO8ilkwNPHvHMd8clg==", + "version": "2.13.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", + "integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==", "dev": true, "dependencies": { - "has": "^1.0.3" + "hasown": "^2.0.0" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -3355,9 +3364,9 @@ } }, "node_modules/jackspeak": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-2.2.2.tgz", - "integrity": "sha512-mgNtVv4vUuaKA97yxUHoA3+FkuhtxkjdXEWOyB/N76fjy0FjezEt34oy3epBtvCvS+7DyKwqCFWx/oJLV5+kCg==", + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-2.3.6.tgz", + "integrity": "sha512-N3yCS/NegsOBokc8GAdM8UcmfsKiSS8cipheD/nivzr700H+nsMOxJjQnvwOcRYVuFkdH0wGUvW2WbXGmrZGbQ==", "dev": true, "dependencies": { "@isaacs/cliui": "^8.0.2" @@ -3393,6 +3402,12 @@ "bignumber.js": "^9.0.0" } }, + "node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true + }, "node_modules/json-duplicate-key-handle": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/json-duplicate-key-handle/-/json-duplicate-key-handle-1.0.0.tgz", @@ -3429,6 +3444,15 @@ "node": ">=10.0.0" } }, + "node_modules/keyv": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dev": true, + "dependencies": { + "json-buffer": "3.0.1" + } + }, "node_modules/keyvaluestorage-interface": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/keyvaluestorage-interface/-/keyvaluestorage-interface-1.0.0.tgz", @@ -3482,9 +3506,9 @@ "dev": true }, "node_modules/lru-cache": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.0.0.tgz", - "integrity": "sha512-svTf/fzsKHffP42sujkO/Rjs37BCIsQVRCeNYIm9WN8rgT7ffoUnRtZCqU+6BqcSBdv8gwJeTz8knJpgACeQMw==", + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.0.1.tgz", + "integrity": "sha512-IJ4uwUTi2qCccrioU6g9g/5rvvVl13bsdczUUcqbciD9iLr095yj8DQKdObriEvuNSx325N1rV1O0sJFszx75g==", "dev": true, "engines": { "node": "14 || >=16.14" @@ -3606,9 +3630,9 @@ } }, "node_modules/minipass": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.2.tgz", - "integrity": "sha512-eL79dXrE1q9dBbDCLg7xfn/vl7MS4F1gvJAgjJrQli/jbQWdUttuVawphqpffoIYfRdq78LHx6GP4bU/EQ2ATA==", + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.4.tgz", + "integrity": "sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==", "dev": true, "engines": { "node": ">=16 || 14 >=14.17" @@ -3638,12 +3662,6 @@ "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", "dev": true }, - "node_modules/natural-compare-lite": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz", - "integrity": "sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==", - "dev": true - }, "node_modules/node-addon-api": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.2.tgz", @@ -3651,9 +3669,9 @@ "dev": true }, "node_modules/node-gyp-build": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.6.0.tgz", - "integrity": "sha512-NTZVKn9IylLwUzaKjkas1e4u2DLNcV4rdYagA4PWdPwW87Bi7z+BznyKSRwS/761tV/lzCGXplWsiaMjLqP2zQ==", + "version": "4.6.1", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.6.1.tgz", + "integrity": "sha512-24vnklJmyRS8ViBNI8KbtK/r/DmXQMRiOMXTNz2nrTnAYUwjmEEbnnpB/+kt+yWRv73bPsSPRFddrcIbAxSiMQ==", "dev": true, "bin": { "node-gyp-build": "bin.js", @@ -3751,9 +3769,9 @@ } }, "node_modules/object-inspect": { - "version": "1.12.3", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", - "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==", + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz", + "integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==", "dev": true, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -3784,6 +3802,24 @@ "node": ">= 0.4" } }, + "node_modules/object.assign": { + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.4.tgz", + "integrity": "sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "has-symbols": "^1.0.3", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/on-exit-leak-free": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/on-exit-leak-free/-/on-exit-leak-free-0.2.0.tgz", @@ -4104,9 +4140,9 @@ } }, "node_modules/prettier": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.1.tgz", - "integrity": "sha512-fcOWSnnpCrovBsmFZIGIy9UqK2FaI7Hqax+DIO0A9UxeVoY4iweyaFjS5TavZN97Hfehph0nhsZnjlVKzEQSrQ==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.3.tgz", + "integrity": "sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==", "dev": true, "bin": { "prettier": "bin/prettier.cjs" @@ -4348,12 +4384,12 @@ "dev": true }, "node_modules/resolve": { - "version": "1.22.2", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz", - "integrity": "sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g==", + "version": "1.22.8", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", + "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", "dev": true, "dependencies": { - "is-core-module": "^2.11.0", + "is-core-module": "^2.13.0", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, @@ -4384,15 +4420,15 @@ } }, "node_modules/rimraf": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.1.tgz", - "integrity": "sha512-OfFZdwtd3lZ+XZzYP/6gTACubwFcHdLRqS9UX3UwpU2dnGQYkPFISRwvM3w9IiB2w7bW5qGo/uAwE4SmXXSKvg==", + "version": "5.0.5", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.5.tgz", + "integrity": "sha512-CqDakW+hMe/Bz202FPEymy68P+G50RfMQK+Qo5YUqc9SPipvbGjCGKd0RSKEelbsfQuw3g5NZDSrlZZAJurH1A==", "dev": true, "dependencies": { - "glob": "^10.2.5" + "glob": "^10.3.7" }, "bin": { - "rimraf": "dist/cjs/src/bin.js" + "rimraf": "dist/esm/bin.mjs" }, "engines": { "node": ">=14" @@ -4634,6 +4670,21 @@ "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==", "dev": true }, + "node_modules/set-function-length": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.1.1.tgz", + "integrity": "sha512-VoaqjbBJKiWtg4yRcKBQ7g7wnGnLV3M8oLvVWwOk2PdYY6PEFegR1vezXR0tw6fZGF9csVakIRjrJiy2veSBFQ==", + "dev": true, + "dependencies": { + "define-data-property": "^1.1.1", + "get-intrinsic": "^1.2.1", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/setimmediate": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", @@ -4937,9 +4988,9 @@ } }, "node_modules/synckit/node_modules/tslib": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.1.tgz", - "integrity": "sha512-t0hLfiEKfMUoqhG+U1oid7Pva4bbDPHYfJNiB7BiIjRkj1pyC++4N3huJfqY6aRH6VTB0rvtzQwjM4K6qpfOig==", + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", "dev": true }, "node_modules/text-table": { @@ -4994,9 +5045,9 @@ } }, "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==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.0.3.tgz", + "integrity": "sha512-wNMeqtMz5NtwpT/UZGY5alT+VoKdSsOOP/kqHFcUW1P/VRhH2wJ48+DN2WwUliNbQ976ETwDL0Ifd2VVvgonvg==", "dev": true, "engines": { "node": ">=16.13.0" @@ -5042,9 +5093,9 @@ } }, "node_modules/typescript": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz", - "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==", + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", + "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -5063,6 +5114,12 @@ "multiformats": "^9.4.2" } }, + "node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "dev": true + }, "node_modules/untildify": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/untildify/-/untildify-4.0.0.tgz", @@ -5091,13 +5148,13 @@ } }, "node_modules/url": { - "version": "0.11.1", - "resolved": "https://registry.npmjs.org/url/-/url-0.11.1.tgz", - "integrity": "sha512-rWS3H04/+mzzJkv0eZ7vEDGiQbgquI1fGfOad6zKvgYQi1SzMmhl7c/DdRGxhaWrVH6z0qWITo8rpnxK/RfEhA==", + "version": "0.11.3", + "resolved": "https://registry.npmjs.org/url/-/url-0.11.3.tgz", + "integrity": "sha512-6hxOLGfZASQK/cijlZnZJTq8OXAkt/3YGfQX45vvMYXpZoo8NdWZcY73K108Jf759lS1Bv/8wXnHDTSz17dSRw==", "dev": true, "dependencies": { "punycode": "^1.4.1", - "qs": "^6.11.0" + "qs": "^6.11.2" } }, "node_modules/url/node_modules/qs": { @@ -5162,13 +5219,13 @@ "dev": true }, "node_modules/which-typed-array": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.11.tgz", - "integrity": "sha512-qe9UWWpkeG5yzZ0tNYxDmd7vo58HDBc39mZ0xWWpolAGADdFOzkfamWLDxkOWcvHQKVmdTyQdLD4NOfjLWTKew==", + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.13.tgz", + "integrity": "sha512-P5Nra0qjSncduVPEAr7xhoF5guty49ArDTwzJ/yNuPIbZppyRxFQsRCWrocxIY+CnMVG+qfbU2FmDKyvSGClow==", "dev": true, "dependencies": { "available-typed-arrays": "^1.0.5", - "call-bind": "^1.0.2", + "call-bind": "^1.0.4", "for-each": "^0.3.3", "gopd": "^1.0.1", "has-tostringtag": "^1.0.0" @@ -5450,156 +5507,156 @@ "dev": true }, "@esbuild/android-arm": { - "version": "0.18.17", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.18.17.tgz", - "integrity": "sha512-wHsmJG/dnL3OkpAcwbgoBTTMHVi4Uyou3F5mf58ZtmUyIKfcdA7TROav/6tCzET4A3QW2Q2FC+eFneMU+iyOxg==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.5.tgz", + "integrity": "sha512-bhvbzWFF3CwMs5tbjf3ObfGqbl/17ict2/uwOSfr3wmxDE6VdS2GqY/FuzIPe0q0bdhj65zQsvqfArI9MY6+AA==", "dev": true, "optional": true }, "@esbuild/android-arm64": { - "version": "0.18.17", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.18.17.tgz", - "integrity": "sha512-9np+YYdNDed5+Jgr1TdWBsozZ85U1Oa3xW0c7TWqH0y2aGghXtZsuT8nYRbzOMcl0bXZXjOGbksoTtVOlWrRZg==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.5.tgz", + "integrity": "sha512-5d1OkoJxnYQfmC+Zd8NBFjkhyCNYwM4n9ODrycTFY6Jk1IGiZ+tjVJDDSwDt77nK+tfpGP4T50iMtVi4dEGzhQ==", "dev": true, "optional": true }, "@esbuild/android-x64": { - "version": "0.18.17", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.18.17.tgz", - "integrity": "sha512-O+FeWB/+xya0aLg23hHEM2E3hbfwZzjqumKMSIqcHbNvDa+dza2D0yLuymRBQQnC34CWrsJUXyH2MG5VnLd6uw==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.5.tgz", + "integrity": "sha512-9t+28jHGL7uBdkBjL90QFxe7DVA+KGqWlHCF8ChTKyaKO//VLuoBricQCgwhOjA1/qOczsw843Fy4cbs4H3DVA==", "dev": true, "optional": true }, "@esbuild/darwin-arm64": { - "version": "0.18.17", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.18.17.tgz", - "integrity": "sha512-M9uJ9VSB1oli2BE/dJs3zVr9kcCBBsE883prage1NWz6pBS++1oNn/7soPNS3+1DGj0FrkSvnED4Bmlu1VAE9g==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.5.tgz", + "integrity": "sha512-mvXGcKqqIqyKoxq26qEDPHJuBYUA5KizJncKOAf9eJQez+L9O+KfvNFu6nl7SCZ/gFb2QPaRqqmG0doSWlgkqw==", "dev": true, "optional": true }, "@esbuild/darwin-x64": { - "version": "0.18.17", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.18.17.tgz", - "integrity": "sha512-XDre+J5YeIJDMfp3n0279DFNrGCXlxOuGsWIkRb1NThMZ0BsrWXoTg23Jer7fEXQ9Ye5QjrvXpxnhzl3bHtk0g==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.5.tgz", + "integrity": "sha512-Ly8cn6fGLNet19s0X4unjcniX24I0RqjPv+kurpXabZYSXGM4Pwpmf85WHJN3lAgB8GSth7s5A0r856S+4DyiA==", "dev": true, "optional": true }, "@esbuild/freebsd-arm64": { - "version": "0.18.17", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.18.17.tgz", - "integrity": "sha512-cjTzGa3QlNfERa0+ptykyxs5A6FEUQQF0MuilYXYBGdBxD3vxJcKnzDlhDCa1VAJCmAxed6mYhA2KaJIbtiNuQ==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.5.tgz", + "integrity": "sha512-GGDNnPWTmWE+DMchq1W8Sd0mUkL+APvJg3b11klSGUDvRXh70JqLAO56tubmq1s2cgpVCSKYywEiKBfju8JztQ==", "dev": true, "optional": true }, "@esbuild/freebsd-x64": { - "version": "0.18.17", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.18.17.tgz", - "integrity": "sha512-sOxEvR8d7V7Kw8QqzxWc7bFfnWnGdaFBut1dRUYtu+EIRXefBc/eIsiUiShnW0hM3FmQ5Zf27suDuHsKgZ5QrA==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.5.tgz", + "integrity": "sha512-1CCwDHnSSoA0HNwdfoNY0jLfJpd7ygaLAp5EHFos3VWJCRX9DMwWODf96s9TSse39Br7oOTLryRVmBoFwXbuuQ==", "dev": true, "optional": true }, "@esbuild/linux-arm": { - "version": "0.18.17", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.18.17.tgz", - "integrity": "sha512-2d3Lw6wkwgSLC2fIvXKoMNGVaeY8qdN0IC3rfuVxJp89CRfA3e3VqWifGDfuakPmp90+ZirmTfye1n4ncjv2lg==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.5.tgz", + "integrity": "sha512-lrWXLY/vJBzCPC51QN0HM71uWgIEpGSjSZZADQhq7DKhPcI6NH1IdzjfHkDQws2oNpJKpR13kv7/pFHBbDQDwQ==", "dev": true, "optional": true }, "@esbuild/linux-arm64": { - "version": "0.18.17", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.18.17.tgz", - "integrity": "sha512-c9w3tE7qA3CYWjT+M3BMbwMt+0JYOp3vCMKgVBrCl1nwjAlOMYzEo+gG7QaZ9AtqZFj5MbUc885wuBBmu6aADQ==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.5.tgz", + "integrity": "sha512-o3vYippBmSrjjQUCEEiTZ2l+4yC0pVJD/Dl57WfPwwlvFkrxoSO7rmBZFii6kQB3Wrn/6GwJUPLU5t52eq2meA==", "dev": true, "optional": true }, "@esbuild/linux-ia32": { - "version": "0.18.17", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.18.17.tgz", - "integrity": "sha512-1DS9F966pn5pPnqXYz16dQqWIB0dmDfAQZd6jSSpiT9eX1NzKh07J6VKR3AoXXXEk6CqZMojiVDSZi1SlmKVdg==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.5.tgz", + "integrity": "sha512-MkjHXS03AXAkNp1KKkhSKPOCYztRtK+KXDNkBa6P78F8Bw0ynknCSClO/ztGszILZtyO/lVKpa7MolbBZ6oJtQ==", "dev": true, "optional": true }, "@esbuild/linux-loong64": { - "version": "0.18.17", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.18.17.tgz", - "integrity": "sha512-EvLsxCk6ZF0fpCB6w6eOI2Fc8KW5N6sHlIovNe8uOFObL2O+Mr0bflPHyHwLT6rwMg9r77WOAWb2FqCQrVnwFg==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.5.tgz", + "integrity": "sha512-42GwZMm5oYOD/JHqHska3Jg0r+XFb/fdZRX+WjADm3nLWLcIsN27YKtqxzQmGNJgu0AyXg4HtcSK9HuOk3v1Dw==", "dev": true, "optional": true }, "@esbuild/linux-mips64el": { - "version": "0.18.17", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.18.17.tgz", - "integrity": "sha512-e0bIdHA5p6l+lwqTE36NAW5hHtw2tNRmHlGBygZC14QObsA3bD4C6sXLJjvnDIjSKhW1/0S3eDy+QmX/uZWEYQ==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.5.tgz", + "integrity": "sha512-kcjndCSMitUuPJobWCnwQ9lLjiLZUR3QLQmlgaBfMX23UEa7ZOrtufnRds+6WZtIS9HdTXqND4yH8NLoVVIkcg==", "dev": true, "optional": true }, "@esbuild/linux-ppc64": { - "version": "0.18.17", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.18.17.tgz", - "integrity": "sha512-BAAilJ0M5O2uMxHYGjFKn4nJKF6fNCdP1E0o5t5fvMYYzeIqy2JdAP88Az5LHt9qBoUa4tDaRpfWt21ep5/WqQ==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.5.tgz", + "integrity": "sha512-yJAxJfHVm0ZbsiljbtFFP1BQKLc8kUF6+17tjQ78QjqjAQDnhULWiTA6u0FCDmYT1oOKS9PzZ2z0aBI+Mcyj7Q==", "dev": true, "optional": true }, "@esbuild/linux-riscv64": { - "version": "0.18.17", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.18.17.tgz", - "integrity": "sha512-Wh/HW2MPnC3b8BqRSIme/9Zhab36PPH+3zam5pqGRH4pE+4xTrVLx2+XdGp6fVS3L2x+DrsIcsbMleex8fbE6g==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.5.tgz", + "integrity": "sha512-5u8cIR/t3gaD6ad3wNt1MNRstAZO+aNyBxu2We8X31bA8XUNyamTVQwLDA1SLoPCUehNCymhBhK3Qim1433Zag==", "dev": true, "optional": true }, "@esbuild/linux-s390x": { - "version": "0.18.17", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.18.17.tgz", - "integrity": "sha512-j/34jAl3ul3PNcK3pfI0NSlBANduT2UO5kZ7FCaK33XFv3chDhICLY8wJJWIhiQ+YNdQ9dxqQctRg2bvrMlYgg==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.5.tgz", + "integrity": "sha512-Z6JrMyEw/EmZBD/OFEFpb+gao9xJ59ATsoTNlj39jVBbXqoZm4Xntu6wVmGPB/OATi1uk/DB+yeDPv2E8PqZGw==", "dev": true, "optional": true }, "@esbuild/linux-x64": { - "version": "0.18.17", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.18.17.tgz", - "integrity": "sha512-QM50vJ/y+8I60qEmFxMoxIx4de03pGo2HwxdBeFd4nMh364X6TIBZ6VQ5UQmPbQWUVWHWws5MmJXlHAXvJEmpQ==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.5.tgz", + "integrity": "sha512-psagl+2RlK1z8zWZOmVdImisMtrUxvwereIdyJTmtmHahJTKb64pAcqoPlx6CewPdvGvUKe2Jw+0Z/0qhSbG1A==", "dev": true, "optional": true }, "@esbuild/netbsd-x64": { - "version": "0.18.17", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.18.17.tgz", - "integrity": "sha512-/jGlhWR7Sj9JPZHzXyyMZ1RFMkNPjC6QIAan0sDOtIo2TYk3tZn5UDrkE0XgsTQCxWTTOcMPf9p6Rh2hXtl5TQ==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.5.tgz", + "integrity": "sha512-kL2l+xScnAy/E/3119OggX8SrWyBEcqAh8aOY1gr4gPvw76la2GlD4Ymf832UCVbmuWeTf2adkZDK+h0Z/fB4g==", "dev": true, "optional": true }, "@esbuild/openbsd-x64": { - "version": "0.18.17", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.18.17.tgz", - "integrity": "sha512-rSEeYaGgyGGf4qZM2NonMhMOP/5EHp4u9ehFiBrg7stH6BYEEjlkVREuDEcQ0LfIl53OXLxNbfuIj7mr5m29TA==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.5.tgz", + "integrity": "sha512-sPOfhtzFufQfTBgRnE1DIJjzsXukKSvZxloZbkJDG383q0awVAq600pc1nfqBcl0ice/WN9p4qLc39WhBShRTA==", "dev": true, "optional": true }, "@esbuild/sunos-x64": { - "version": "0.18.17", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.18.17.tgz", - "integrity": "sha512-Y7ZBbkLqlSgn4+zot4KUNYst0bFoO68tRgI6mY2FIM+b7ZbyNVtNbDP5y8qlu4/knZZ73fgJDlXID+ohY5zt5g==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.5.tgz", + "integrity": "sha512-dGZkBXaafuKLpDSjKcB0ax0FL36YXCvJNnztjKV+6CO82tTYVDSH2lifitJ29jxRMoUhgkg9a+VA/B03WK5lcg==", "dev": true, "optional": true }, "@esbuild/win32-arm64": { - "version": "0.18.17", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.18.17.tgz", - "integrity": "sha512-bwPmTJsEQcbZk26oYpc4c/8PvTY3J5/QK8jM19DVlEsAB41M39aWovWoHtNm78sd6ip6prilxeHosPADXtEJFw==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.5.tgz", + "integrity": "sha512-dWVjD9y03ilhdRQ6Xig1NWNgfLtf2o/STKTS+eZuF90fI2BhbwD6WlaiCGKptlqXlURVB5AUOxUj09LuwKGDTg==", "dev": true, "optional": true }, "@esbuild/win32-ia32": { - "version": "0.18.17", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.18.17.tgz", - "integrity": "sha512-H/XaPtPKli2MhW+3CQueo6Ni3Avggi6hP/YvgkEe1aSaxw+AeO8MFjq8DlgfTd9Iz4Yih3QCZI6YLMoyccnPRg==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.5.tgz", + "integrity": "sha512-4liggWIA4oDgUxqpZwrDhmEfAH4d0iljanDOK7AnVU89T6CzHon/ony8C5LeOdfgx60x5cnQJFZwEydVlYx4iw==", "dev": true, "optional": true }, "@esbuild/win32-x64": { - "version": "0.18.17", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.18.17.tgz", - "integrity": "sha512-fGEb8f2BSA3CW7riJVurug65ACLuQAzKq0SSqkY2b2yHHH0MzDfbLyKIGzHwOI/gkHcxM/leuSW6D5w/LMNitA==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.5.tgz", + "integrity": "sha512-czTrygUsB/jlM8qEW5MD8bgYU2Xg14lo6kBDXW6HdxKjh8M5PzETGiSHaz9MtbXBYDloHNUAUW2tMiKW4KM9Mw==", "dev": true, "optional": true }, @@ -5613,15 +5670,15 @@ } }, "@eslint-community/regexpp": { - "version": "4.6.2", - "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.6.2.tgz", - "integrity": "sha512-pPTNuaAG3QMH+buKyBIGJs3g/S5y0caxw0ygM3YyE6yJFySwiGGSzA+mM3KJ8QQvzeLh3blwgSonkFjgQdxzMw==", + "version": "4.10.0", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.10.0.tgz", + "integrity": "sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA==", "dev": true }, "@eslint/eslintrc": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.1.tgz", - "integrity": "sha512-9t7ZA7NGGK8ckelF0PQCfcxIUzs1Md5rrO6U/c+FIQNanea5UZC0wqKXH4vHBccmu4ZJgZ2idtPeW7+Q2npOEA==", + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.2.tgz", + "integrity": "sha512-+wvgpDsrB1YqAMdEUCcnTlpfVBH7Vqn6A/NT3D8WVXFIaKMlErPIZT3oCIAVCOtarRpMtelZLqJeU3t7WY6X6g==", "dev": true, "requires": { "ajv": "^6.12.4", @@ -5636,18 +5693,18 @@ } }, "@eslint/js": { - "version": "8.46.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.46.0.tgz", - "integrity": "sha512-a8TLtmPi8xzPkCbp/OGFUo5yhRkHM2Ko9kOWP4znJr0WAhWyThaw3PnwX4vOTWOAMsV2uRt32PPDcEz63esSaA==", + "version": "8.52.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.52.0.tgz", + "integrity": "sha512-mjZVbpaeMZludF2fsWLD0Z9gCref1Tk4i9+wddjRvpUNqqcndPkBD09N/Mapey0b3jaXbLm2kICwFv2E64QinA==", "dev": true }, "@humanwhocodes/config-array": { - "version": "0.11.10", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.10.tgz", - "integrity": "sha512-KVVjQmNUepDVGXNuoRRdmmEjruj0KfiGSbS8LVc12LMsWDQzRXJ0qdhN8L8uUigKpfEHRhlaQFY0ib1tnUbNeQ==", + "version": "0.11.13", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.13.tgz", + "integrity": "sha512-JSBDMiDKSzQVngfRjOdFXgFfklaXI4K9nLF49Auh21lmBWRLIK3+xTErTWD4KU54pb6coM6ESE7Awz/FNU3zgQ==", "dev": true, "requires": { - "@humanwhocodes/object-schema": "^1.2.1", + "@humanwhocodes/object-schema": "^2.0.1", "debug": "^4.1.1", "minimatch": "^3.0.5" } @@ -5659,9 +5716,9 @@ "dev": true }, "@humanwhocodes/object-schema": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", - "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.1.tgz", + "integrity": "sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw==", "dev": true }, "@isaacs/cliui": { @@ -5696,9 +5753,9 @@ } }, "@multiversx/sdk-core": { - "version": "12.6.0", - "resolved": "https://registry.npmjs.org/@multiversx/sdk-core/-/sdk-core-12.6.0.tgz", - "integrity": "sha512-aJjSn8EzaYXalUuvAuxOTPtv8GDbimJlSYNRLjCsToyfwGAyS9cRllmq2d1I2nlrR89YgAsOL9qp+sI5DA7yBw==", + "version": "12.11.0", + "resolved": "https://registry.npmjs.org/@multiversx/sdk-core/-/sdk-core-12.11.0.tgz", + "integrity": "sha512-rQRvjx6f1AE8TK5LObxthP7hCUCf6bc9QBAmiOJJ1Na5VS1iPhm5jDqnlCa7oieMb1HYdHQAEkoWNSsPKe/8vA==", "dev": true, "requires": { "@multiversx/sdk-transaction-decoder": "1.0.2", @@ -5719,18 +5776,18 @@ "requires": {} }, "@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==", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@multiversx/sdk-native-auth-client/-/sdk-native-auth-client-1.0.5.tgz", + "integrity": "sha512-MA9KCNy2K0Irw+RMn01mxXB3Z+EcpMuUFBqr6ZhVQyxmXjujK+CHvlXH5TSADIm5Yw2SfGjFGdiqRu64lNVvuA==", "dev": true, "requires": { "axios": "0.24.0" } }, "@multiversx/sdk-network-providers": { - "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==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@multiversx/sdk-network-providers/-/sdk-network-providers-2.0.0.tgz", + "integrity": "sha512-87QlwC2kaNtywDv2IVX/cavRfR4D5N7XgqOvsZTyMXRVbfWOUlDocrRr5BdvmC1gDdSOQH++nFEDHiMfnKmRng==", "dev": true, "requires": { "axios": "0.24.0", @@ -5758,20 +5815,20 @@ } }, "@multiversx/sdk-wallet-connect-provider": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/@multiversx/sdk-wallet-connect-provider/-/sdk-wallet-connect-provider-4.0.3.tgz", - "integrity": "sha512-j48gz0ZBuYAUbEKx3qN2AvwZssNHYASwfng/ek097wgmDEIH8cfeA1ujkN6FF0WMvh8T6bIHtOHKWH3diZ/Fdg==", + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@multiversx/sdk-wallet-connect-provider/-/sdk-wallet-connect-provider-4.0.4.tgz", + "integrity": "sha512-k+t/M0U1SnHsdLmcbXkoYgA5+R3KJA+h8N4uC026l1fRz8Vo7g3joQoqLi5qSanuc0S+uiInpDyIoq0fbFLUjA==", "dev": true, "requires": { - "@walletconnect/sign-client": "2.9.1", - "@walletconnect/utils": "2.9.1", + "@walletconnect/sign-client": "2.10.2", + "@walletconnect/utils": "2.10.2", "bech32": "1.1.4" } }, "@multiversx/sdk-web-wallet-provider": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@multiversx/sdk-web-wallet-provider/-/sdk-web-wallet-provider-3.0.0.tgz", - "integrity": "sha512-JzyOJJKx+vr1kMRHwVx6Y/SBSo/yUeWAHPeUJtvmjyRrTEhniYUhuKgy6U8lkD4djLKf8G/qpUOXwvfu4fbXuw==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@multiversx/sdk-web-wallet-provider/-/sdk-web-wallet-provider-3.1.0.tgz", + "integrity": "sha512-gIE7AudJl5Ax64AMAD0o6m0cVi+dI5LW2TSM5M9K7zKMWWCflhv27a2A61JkCIQ6CK5OTIkMXaFb61OzUqhplQ==", "dev": true, "requires": { "qs": "6.10.3" @@ -5825,9 +5882,9 @@ }, "dependencies": { "tslib": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.1.tgz", - "integrity": "sha512-t0hLfiEKfMUoqhG+U1oid7Pva4bbDPHYfJNiB7BiIjRkj1pyC++4N3huJfqY6aRH6VTB0rvtzQwjM4K6qpfOig==", + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", "dev": true } } @@ -6061,110 +6118,112 @@ } }, "@types/json-schema": { - "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==", + "version": "7.0.14", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.14.tgz", + "integrity": "sha512-U3PUjAudAdJBeC2pgN8uTIKgxrb4nlDF3SF0++EldXQvQBGkpFZMSnwQiIoDU77tv45VgNkl/L4ouD+rEomujw==", "dev": true }, "@types/node": { - "version": "20.4.7", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.7.tgz", - "integrity": "sha512-bUBrPjEry2QUTsnuEjzjbS7voGWCc30W0qzgMf90GPeDGFRakvrz47ju+oqDAKCXLUCe39u57/ORMl/O/04/9g==", - "dev": true + "version": "20.8.9", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.8.9.tgz", + "integrity": "sha512-UzykFsT3FhHb1h7yD4CA4YhBHq545JC0YnEz41xkipN88eKQtL6rSgocL5tbAP6Ola9Izm/Aw4Ora8He4x0BHg==", + "dev": true, + "requires": { + "undici-types": "~5.26.4" + } }, "@types/qrcode": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/@types/qrcode/-/qrcode-1.5.1.tgz", - "integrity": "sha512-HpSN675K0PmxIDRpjMI3Mc2GiKo3dNu+X/F5SoItiaDS1lVfgC6Wac1c5lQDfKWbTJUSHWiHKzpJpBZG7k9gaA==", + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/@types/qrcode/-/qrcode-1.5.4.tgz", + "integrity": "sha512-ufYqUO7wUBq49hugJry+oIYKscvxIQerJSmXeny215aJKfrepN04DDZP8FCgxvV82kOqKPULCE4PIW3qUmZrRA==", "dev": true, "requires": { "@types/node": "*" } }, "@types/semver": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.0.tgz", - "integrity": "sha512-G8hZ6XJiHnuhQKR7ZmysCeJWE08o8T0AXtk5darsCaTVsYZhhgUrq53jizaR2FvsoeCwJhlmwTjkXBY5Pn/ZHw==", + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-MMzuxN3GdFwskAnb6fz0orFvhfqi752yjaXylr0Rp4oDg5H0Zn1IuyRhDVvYOwAXoJirx2xuS16I3WjxnAIHiQ==", "dev": true }, "@types/serve-handler": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/@types/serve-handler/-/serve-handler-6.1.1.tgz", - "integrity": "sha512-bIwSmD+OV8w0t2e7EWsuQYlGoS1o5aEdVktgkXaa43Zm0qVWi21xaSRb3DQA1UXD+DJ5bRq1Rgu14ZczB+CjIQ==", + "version": "6.1.3", + "resolved": "https://registry.npmjs.org/@types/serve-handler/-/serve-handler-6.1.3.tgz", + "integrity": "sha512-mvboyl5x5LsPPsjntm/BK/EZZqbOCITqNjOVOkl/bbB97yVmIUIyOP7+OjNj/9Iuh6hCH6RYuugPuO4avlPWcg==", "dev": true, "requires": { "@types/node": "*" } }, "@typescript-eslint/eslint-plugin": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.2.1.tgz", - "integrity": "sha512-iZVM/ALid9kO0+I81pnp1xmYiFyqibAHzrqX4q5YvvVEyJqY+e6rfTXSCsc2jUxGNqJqTfFSSij/NFkZBiBzLw==", + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.9.0.tgz", + "integrity": "sha512-lgX7F0azQwRPB7t7WAyeHWVfW1YJ9NIgd9mvGhfQpRY56X6AVf8mwM8Wol+0z4liE7XX3QOt8MN1rUKCfSjRIA==", "dev": true, "requires": { "@eslint-community/regexpp": "^4.5.1", - "@typescript-eslint/scope-manager": "6.2.1", - "@typescript-eslint/type-utils": "6.2.1", - "@typescript-eslint/utils": "6.2.1", - "@typescript-eslint/visitor-keys": "6.2.1", + "@typescript-eslint/scope-manager": "6.9.0", + "@typescript-eslint/type-utils": "6.9.0", + "@typescript-eslint/utils": "6.9.0", + "@typescript-eslint/visitor-keys": "6.9.0", "debug": "^4.3.4", "graphemer": "^1.4.0", "ignore": "^5.2.4", "natural-compare": "^1.4.0", - "natural-compare-lite": "^1.4.0", "semver": "^7.5.4", "ts-api-utils": "^1.0.1" } }, "@typescript-eslint/parser": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.2.1.tgz", - "integrity": "sha512-Ld+uL1kYFU8e6btqBFpsHkwQ35rw30IWpdQxgOqOh4NfxSDH6uCkah1ks8R/RgQqI5hHPXMaLy9fbFseIe+dIg==", + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.9.0.tgz", + "integrity": "sha512-GZmjMh4AJ/5gaH4XF2eXA8tMnHWP+Pm1mjQR2QN4Iz+j/zO04b9TOvJYOX2sCNIQHtRStKTxRY1FX7LhpJT4Gw==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "6.2.1", - "@typescript-eslint/types": "6.2.1", - "@typescript-eslint/typescript-estree": "6.2.1", - "@typescript-eslint/visitor-keys": "6.2.1", + "@typescript-eslint/scope-manager": "6.9.0", + "@typescript-eslint/types": "6.9.0", + "@typescript-eslint/typescript-estree": "6.9.0", + "@typescript-eslint/visitor-keys": "6.9.0", "debug": "^4.3.4" } }, "@typescript-eslint/scope-manager": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.2.1.tgz", - "integrity": "sha512-UCqBF9WFqv64xNsIEPfBtenbfodPXsJ3nPAr55mGPkQIkiQvgoWNo+astj9ZUfJfVKiYgAZDMnM6dIpsxUMp3Q==", + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.9.0.tgz", + "integrity": "sha512-1R8A9Mc39n4pCCz9o79qRO31HGNDvC7UhPhv26TovDsWPBDx+Sg3rOZdCELIA3ZmNoWAuxaMOT7aWtGRSYkQxw==", "dev": true, "requires": { - "@typescript-eslint/types": "6.2.1", - "@typescript-eslint/visitor-keys": "6.2.1" + "@typescript-eslint/types": "6.9.0", + "@typescript-eslint/visitor-keys": "6.9.0" } }, "@typescript-eslint/type-utils": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.2.1.tgz", - "integrity": "sha512-fTfCgomBMIgu2Dh2Or3gMYgoNAnQm3RLtRp+jP7A8fY+LJ2+9PNpi5p6QB5C4RSP+U3cjI0vDlI3mspAkpPVbQ==", + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.9.0.tgz", + "integrity": "sha512-XXeahmfbpuhVbhSOROIzJ+b13krFmgtc4GlEuu1WBT+RpyGPIA4Y/eGnXzjbDj5gZLzpAXO/sj+IF/x2GtTMjQ==", "dev": true, "requires": { - "@typescript-eslint/typescript-estree": "6.2.1", - "@typescript-eslint/utils": "6.2.1", + "@typescript-eslint/typescript-estree": "6.9.0", + "@typescript-eslint/utils": "6.9.0", "debug": "^4.3.4", "ts-api-utils": "^1.0.1" } }, "@typescript-eslint/types": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.2.1.tgz", - "integrity": "sha512-528bGcoelrpw+sETlyM91k51Arl2ajbNT9L4JwoXE2dvRe1yd8Q64E4OL7vHYw31mlnVsf+BeeLyAZUEQtqahQ==", + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.9.0.tgz", + "integrity": "sha512-+KB0lbkpxBkBSiVCuQvduqMJy+I1FyDbdwSpM3IoBS7APl4Bu15lStPjgBIdykdRqQNYqYNMa8Kuidax6phaEw==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.2.1.tgz", - "integrity": "sha512-G+UJeQx9AKBHRQBpmvr8T/3K5bJa485eu+4tQBxFq0KoT22+jJyzo1B50JDT9QdC1DEmWQfdKsa8ybiNWYsi0Q==", + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.9.0.tgz", + "integrity": "sha512-NJM2BnJFZBEAbCfBP00zONKXvMqihZCrmwCaik0UhLr0vAgb6oguXxLX1k00oQyD+vZZ+CJn3kocvv2yxm4awQ==", "dev": true, "requires": { - "@typescript-eslint/types": "6.2.1", - "@typescript-eslint/visitor-keys": "6.2.1", + "@typescript-eslint/types": "6.9.0", + "@typescript-eslint/visitor-keys": "6.9.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -6173,34 +6232,40 @@ } }, "@typescript-eslint/utils": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.2.1.tgz", - "integrity": "sha512-eBIXQeupYmxVB6S7x+B9SdBeB6qIdXKjgQBge2J+Ouv8h9Cxm5dHf/gfAZA6dkMaag+03HdbVInuXMmqFB/lKQ==", + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.9.0.tgz", + "integrity": "sha512-5Wf+Jsqya7WcCO8me504FBigeQKVLAMPmUzYgDbWchINNh1KJbxCgVya3EQ2MjvJMVeXl3pofRmprqX6mfQkjQ==", "dev": true, "requires": { "@eslint-community/eslint-utils": "^4.4.0", "@types/json-schema": "^7.0.12", "@types/semver": "^7.5.0", - "@typescript-eslint/scope-manager": "6.2.1", - "@typescript-eslint/types": "6.2.1", - "@typescript-eslint/typescript-estree": "6.2.1", + "@typescript-eslint/scope-manager": "6.9.0", + "@typescript-eslint/types": "6.9.0", + "@typescript-eslint/typescript-estree": "6.9.0", "semver": "^7.5.4" } }, "@typescript-eslint/visitor-keys": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.2.1.tgz", - "integrity": "sha512-iTN6w3k2JEZ7cyVdZJTVJx2Lv7t6zFA8DCrJEHD2mwfc16AEvvBWVhbFh34XyG2NORCd0viIgQY1+u7kPI0WpA==", + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.9.0.tgz", + "integrity": "sha512-dGtAfqjV6RFOtIP8I0B4ZTBRrlTT8NHHlZZSchQx3qReaoDeXhYM++M4So2AgFK9ZB0emRPA6JI1HkafzA2Ibg==", "dev": true, "requires": { - "@typescript-eslint/types": "6.2.1", + "@typescript-eslint/types": "6.9.0", "eslint-visitor-keys": "^3.4.1" } }, + "@ungap/structured-clone": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz", + "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==", + "dev": true + }, "@walletconnect/core": { - "version": "2.9.1", - "resolved": "https://registry.npmjs.org/@walletconnect/core/-/core-2.9.1.tgz", - "integrity": "sha512-xyWeP0eLhEEDQAVJSmqs4n/AClKUM+8os2ZFe7BTuw1tFYjeLNVDtKCHziVOSTh8wEChMsKSGKA4zerQoH8mAQ==", + "version": "2.10.2", + "resolved": "https://registry.npmjs.org/@walletconnect/core/-/core-2.10.2.tgz", + "integrity": "sha512-JQz/xp3SLEpTeRQctdck2ugSBVEpMxoSE+lFi2voJkZop1hv6P+uqr6E4PzjFluAjeAnKlT1xvra0aFWjPWVcw==", "dev": true, "requires": { "@walletconnect/heartbeat": "1.2.1", @@ -6214,8 +6279,8 @@ "@walletconnect/relay-auth": "^1.0.4", "@walletconnect/safe-json": "^1.0.2", "@walletconnect/time": "^1.0.2", - "@walletconnect/types": "2.9.1", - "@walletconnect/utils": "2.9.1", + "@walletconnect/types": "2.10.2", + "@walletconnect/utils": "2.10.2", "events": "^3.3.0", "lodash.isequal": "4.5.0", "uint8arrays": "^3.1.0" @@ -6350,19 +6415,19 @@ } }, "@walletconnect/sign-client": { - "version": "2.9.1", - "resolved": "https://registry.npmjs.org/@walletconnect/sign-client/-/sign-client-2.9.1.tgz", - "integrity": "sha512-Z7tFRrJ9btA1vU427vsjUS6cPlHQVcTWdKH90khEc2lv3dB6mU8FNO0VJsw+I2D7CW7WaMWF3nnj6Z1FfotbDg==", + "version": "2.10.2", + "resolved": "https://registry.npmjs.org/@walletconnect/sign-client/-/sign-client-2.10.2.tgz", + "integrity": "sha512-vviSLV3f92I0bReX+OLr1HmbH0uIzYEQQFd1MzIfDk9PkfFT/LLAHhUnDaIAMkIdippqDcJia+5QEtT4JihL3Q==", "dev": true, "requires": { - "@walletconnect/core": "2.9.1", + "@walletconnect/core": "2.10.2", "@walletconnect/events": "^1.0.1", "@walletconnect/heartbeat": "1.2.1", "@walletconnect/jsonrpc-utils": "1.0.8", "@walletconnect/logger": "^2.0.1", "@walletconnect/time": "^1.0.2", - "@walletconnect/types": "2.9.1", - "@walletconnect/utils": "2.9.1", + "@walletconnect/types": "2.10.2", + "@walletconnect/utils": "2.10.2", "events": "^3.3.0" } }, @@ -6376,9 +6441,9 @@ } }, "@walletconnect/types": { - "version": "2.9.1", - "resolved": "https://registry.npmjs.org/@walletconnect/types/-/types-2.9.1.tgz", - "integrity": "sha512-xbGgTPuD6xsb7YMvCESBIH55cjB86QAnnVL50a/ED42YkQzDsOdJ0VGTbrm0tG5cxUOF933rpxZQjxGdP+ovww==", + "version": "2.10.2", + "resolved": "https://registry.npmjs.org/@walletconnect/types/-/types-2.10.2.tgz", + "integrity": "sha512-luNV+07Wdla4STi9AejseCQY31tzWKQ5a7C3zZZaRK/di+rFaAAb7YW04OP4klE7tw/mJRGPTlekZElmHxO8kQ==", "dev": true, "requires": { "@walletconnect/events": "^1.0.1", @@ -6390,9 +6455,9 @@ } }, "@walletconnect/utils": { - "version": "2.9.1", - "resolved": "https://registry.npmjs.org/@walletconnect/utils/-/utils-2.9.1.tgz", - "integrity": "sha512-tXeQVebF5oPBvhdmuUyVSkSIBYx/egIi4czav1QrnUpwrUS1LsrFhyWBxSbhN7TXY287ULWkEf6aFpWOHdp5EA==", + "version": "2.10.2", + "resolved": "https://registry.npmjs.org/@walletconnect/utils/-/utils-2.10.2.tgz", + "integrity": "sha512-syxXRpc2yhSknMu3IfiBGobxOY7fLfLTJuw+ppKaeO6WUdZpIit3wfuGOcc0Ms3ZPFCrGfyGOoZsCvgdXtptRg==", "dev": true, "requires": { "@stablelib/chacha20poly1305": "1.0.1", @@ -6403,7 +6468,7 @@ "@walletconnect/relay-api": "^1.0.9", "@walletconnect/safe-json": "^1.0.2", "@walletconnect/time": "^1.0.2", - "@walletconnect/types": "2.9.1", + "@walletconnect/types": "2.10.2", "@walletconnect/window-getters": "^1.0.1", "@walletconnect/window-metadata": "^1.0.1", "detect-browser": "5.3.0", @@ -6431,9 +6496,9 @@ } }, "acorn": { - "version": "8.10.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", - "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==", + "version": "8.11.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.2.tgz", + "integrity": "sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==", "dev": true }, "acorn-jsx": { @@ -6503,15 +6568,16 @@ } }, "assert": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/assert/-/assert-2.0.0.tgz", - "integrity": "sha512-se5Cd+js9dXJnu6Ag2JFc00t+HmHOen+8Q+L7O9zI0PqQXr20uk2J0XQqMxZEeo5U50o8Nvmmx7dZrl+Ufr35A==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/assert/-/assert-2.1.0.tgz", + "integrity": "sha512-eLHpSK/Y4nhMJ07gDaAzoX/XAKS8PSaojml3M0DM4JpV1LAi5JOJ/p6H/XWrl8L+DzVEvVCW1z3vWAaB9oTsQw==", "dev": true, "requires": { - "es6-object-assign": "^1.1.0", - "is-nan": "^1.2.1", - "object-is": "^1.0.1", - "util": "^0.12.0" + "call-bind": "^1.0.2", + "is-nan": "^1.3.2", + "object-is": "^1.1.5", + "object.assign": "^4.1.4", + "util": "^0.12.5" } }, "atomic-sleep": { @@ -6687,20 +6753,20 @@ } }, "browserify-sign": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.2.1.tgz", - "integrity": "sha512-/vrA5fguVAKKAVTNJjgSm1tRQDHUU6DbwO9IROu/0WAzC8PKhucDSh18J0RMvVeHAn5puMd+QHC2erPRNf8lmg==", + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.2.2.tgz", + "integrity": "sha512-1rudGyeYY42Dk6texmv7c4VcQ0EsvVbLwZkA+AQB7SxvXxmcD93jcHie8bzecJ+ChDlmAm2Qyu0+Ccg5uhZXCg==", "dev": true, "requires": { - "bn.js": "^5.1.1", - "browserify-rsa": "^4.0.1", + "bn.js": "^5.2.1", + "browserify-rsa": "^4.1.0", "create-hash": "^1.2.0", "create-hmac": "^1.1.7", - "elliptic": "^6.5.3", + "elliptic": "^6.5.4", "inherits": "^2.0.4", - "parse-asn1": "^5.1.5", - "readable-stream": "^3.6.0", - "safe-buffer": "^5.2.0" + "parse-asn1": "^5.1.6", + "readable-stream": "^3.6.2", + "safe-buffer": "^5.2.1" } }, "browserify-zlib": { @@ -6750,13 +6816,14 @@ "dev": true }, "call-bind": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", - "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.5.tgz", + "integrity": "sha512-C3nQxfFZxFRVoJoGKKI8y3MOEo129NQ+FgQ08iye+Mk4zNZZGdjfs06bVTr+DBSlA66Q2VEcMki/cUCP4SercQ==", "dev": true, "requires": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.1", + "set-function-length": "^1.1.1" } }, "callsites": { @@ -7001,6 +7068,17 @@ "untildify": "^4.0.0" } }, + "define-data-property": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.1.tgz", + "integrity": "sha512-E7uGkTzkk1d0ByLeSc6ZsFS79Axg+m1P/VsgYsxHgiuc3tFSj+MjMIwe90FC4lOAZzNBdY7kkO2P2wKdsQ1vgQ==", + "dev": true, + "requires": { + "get-intrinsic": "^1.2.1", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.0" + } + }, "define-lazy-prop": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-3.0.0.tgz", @@ -7008,11 +7086,12 @@ "dev": true }, "define-properties": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.0.tgz", - "integrity": "sha512-xvqAVKGfT1+UAvPwKTVw/njhdQ8ZhXK4lI0bCIuCMrp2up9nPnaDftrLtmpTazqd1o+UY4zgzU+avtMbDP+ldA==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz", + "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==", "dev": true, "requires": { + "define-data-property": "^1.0.1", "has-property-descriptors": "^1.0.0", "object-keys": "^1.1.1" } @@ -7144,40 +7223,34 @@ "once": "^1.4.0" } }, - "es6-object-assign": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/es6-object-assign/-/es6-object-assign-1.1.0.tgz", - "integrity": "sha512-MEl9uirslVwqQU369iHNWZXsI8yaZYGg/D65aOgZkeyFJwHYSxilf7rQzXKI7DdDuBPrBXbfk3sl9hJhmd5AUw==", - "dev": true - }, "esbuild": { - "version": "0.18.17", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.18.17.tgz", - "integrity": "sha512-1GJtYnUxsJreHYA0Y+iQz2UEykonY66HNWOb0yXYZi9/kNrORUEHVg87eQsCtqh59PEJ5YVZJO98JHznMJSWjg==", - "dev": true, - "requires": { - "@esbuild/android-arm": "0.18.17", - "@esbuild/android-arm64": "0.18.17", - "@esbuild/android-x64": "0.18.17", - "@esbuild/darwin-arm64": "0.18.17", - "@esbuild/darwin-x64": "0.18.17", - "@esbuild/freebsd-arm64": "0.18.17", - "@esbuild/freebsd-x64": "0.18.17", - "@esbuild/linux-arm": "0.18.17", - "@esbuild/linux-arm64": "0.18.17", - "@esbuild/linux-ia32": "0.18.17", - "@esbuild/linux-loong64": "0.18.17", - "@esbuild/linux-mips64el": "0.18.17", - "@esbuild/linux-ppc64": "0.18.17", - "@esbuild/linux-riscv64": "0.18.17", - "@esbuild/linux-s390x": "0.18.17", - "@esbuild/linux-x64": "0.18.17", - "@esbuild/netbsd-x64": "0.18.17", - "@esbuild/openbsd-x64": "0.18.17", - "@esbuild/sunos-x64": "0.18.17", - "@esbuild/win32-arm64": "0.18.17", - "@esbuild/win32-ia32": "0.18.17", - "@esbuild/win32-x64": "0.18.17" + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.5.tgz", + "integrity": "sha512-bUxalY7b1g8vNhQKdB24QDmHeY4V4tw/s6Ak5z+jJX9laP5MoQseTOMemAr0gxssjNcH0MCViG8ONI2kksvfFQ==", + "dev": true, + "requires": { + "@esbuild/android-arm": "0.19.5", + "@esbuild/android-arm64": "0.19.5", + "@esbuild/android-x64": "0.19.5", + "@esbuild/darwin-arm64": "0.19.5", + "@esbuild/darwin-x64": "0.19.5", + "@esbuild/freebsd-arm64": "0.19.5", + "@esbuild/freebsd-x64": "0.19.5", + "@esbuild/linux-arm": "0.19.5", + "@esbuild/linux-arm64": "0.19.5", + "@esbuild/linux-ia32": "0.19.5", + "@esbuild/linux-loong64": "0.19.5", + "@esbuild/linux-mips64el": "0.19.5", + "@esbuild/linux-ppc64": "0.19.5", + "@esbuild/linux-riscv64": "0.19.5", + "@esbuild/linux-s390x": "0.19.5", + "@esbuild/linux-x64": "0.19.5", + "@esbuild/netbsd-x64": "0.19.5", + "@esbuild/openbsd-x64": "0.19.5", + "@esbuild/sunos-x64": "0.19.5", + "@esbuild/win32-arm64": "0.19.5", + "@esbuild/win32-ia32": "0.19.5", + "@esbuild/win32-x64": "0.19.5" } }, "escape-string-regexp": { @@ -7187,18 +7260,19 @@ "dev": true }, "eslint": { - "version": "8.46.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.46.0.tgz", - "integrity": "sha512-cIO74PvbW0qU8e0mIvk5IV3ToWdCq5FYG6gWPHHkx6gNdjlbAYvtfHmlCMXxjcoVaIdwy/IAt3+mDkZkfvb2Dg==", + "version": "8.52.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.52.0.tgz", + "integrity": "sha512-zh/JHnaixqHZsolRB/w9/02akBk9EPrOs9JwcTP2ek7yL5bVvXuRariiaAjjoJ5DvuwQ1WAE/HsMz+w17YgBCg==", "dev": true, "requires": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", - "@eslint/eslintrc": "^2.1.1", - "@eslint/js": "^8.46.0", - "@humanwhocodes/config-array": "^0.11.10", + "@eslint/eslintrc": "^2.1.2", + "@eslint/js": "8.52.0", + "@humanwhocodes/config-array": "^0.11.13", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", + "@ungap/structured-clone": "^1.2.0", "ajv": "^6.12.4", "chalk": "^4.0.0", "cross-spawn": "^7.0.2", @@ -7206,7 +7280,7 @@ "doctrine": "^3.0.0", "escape-string-regexp": "^4.0.0", "eslint-scope": "^7.2.2", - "eslint-visitor-keys": "^3.4.2", + "eslint-visitor-keys": "^3.4.3", "espree": "^9.6.1", "esquery": "^1.4.2", "esutils": "^2.0.2", @@ -7229,47 +7303,39 @@ "optionator": "^0.9.3", "strip-ansi": "^6.0.1", "text-table": "^0.2.0" - }, - "dependencies": { - "eslint-scope": { - "version": "7.2.2", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", - "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", - "dev": true, - "requires": { - "esrecurse": "^4.3.0", - "estraverse": "^5.2.0" - } - }, - "estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "dev": true - } } }, "eslint-config-prettier": { - "version": "8.10.0", - "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.10.0.tgz", - "integrity": "sha512-SM8AMJdeQqRYT9O9zguiruQZaN7+z+E4eAP9oiLNGKMtomwaB1E9dcgUD6ZAn/eQAb52USbvezbiljfZUhbJcg==", + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.0.0.tgz", + "integrity": "sha512-IcJsTkJae2S35pRsRAwoCE+925rJJStOdkKnLVgtE+tEpqU0EVVM7OqrwxqgptKdX29NUwC82I5pXsGFIgSevw==", "dev": true, "requires": {} }, "eslint-plugin-prettier": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.0.0.tgz", - "integrity": "sha512-AgaZCVuYDXHUGxj/ZGu1u8H8CYgDY3iG6w5kUFw4AzMVXzB7VvbKgYR4nATIN+OvUrghMbiDLeimVjVY5ilq3w==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.0.1.tgz", + "integrity": "sha512-m3u5RnR56asrwV/lDC4GHorlW75DsFfmUcjfCYylTUs85dBRnB7VM6xG8eCMJdeDRnppzmxZVf1GEPJvl1JmNg==", "dev": true, "requires": { "prettier-linter-helpers": "^1.0.0", "synckit": "^0.8.5" } }, + "eslint-scope": { + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", + "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", + "dev": true, + "requires": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + } + }, "eslint-visitor-keys": { - "version": "3.4.2", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.2.tgz", - "integrity": "sha512-8drBzUEyZ2llkpCA67iYrgEssKDUu68V8ChqqOfFupIaG/LCVPUT+CoGJpT77zJprs4T/W7p07LP7zAIMuweVw==", + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", "dev": true }, "espree": { @@ -7290,14 +7356,6 @@ "dev": true, "requires": { "estraverse": "^5.1.0" - }, - "dependencies": { - "estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "dev": true - } } }, "esrecurse": { @@ -7307,16 +7365,14 @@ "dev": true, "requires": { "estraverse": "^5.2.0" - }, - "dependencies": { - "estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "dev": true - } } }, + "estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true + }, "esutils": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", @@ -7471,12 +7527,13 @@ } }, "flat-cache": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", - "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.1.1.tgz", + "integrity": "sha512-/qM2b3LUIaIgviBQovTLvijfyOQXPtSRnRK26ksj2J7rzPIecePUIpJsZ4T02Qg+xiAEKIs5K8dsHEd+VaKa/Q==", "dev": true, "requires": { - "flatted": "^3.1.0", + "flatted": "^3.2.9", + "keyv": "^4.5.3", "rimraf": "^3.0.2" }, "dependencies": { @@ -7506,15 +7563,15 @@ } }, "flatted": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz", - "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==", + "version": "3.2.9", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.9.tgz", + "integrity": "sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==", "dev": true }, "follow-redirects": { - "version": "1.15.2", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", - "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", + "version": "1.15.3", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.3.tgz", + "integrity": "sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==", "dev": true }, "for-each": { @@ -7543,9 +7600,9 @@ "dev": true }, "function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", "dev": true }, "get-caller-file": { @@ -7555,15 +7612,15 @@ "dev": true }, "get-intrinsic": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz", - "integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==", + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.2.tgz", + "integrity": "sha512-0gSo4ml/0j98Y3lngkFEot/zhiCeWsbYIlZ+uZOVgzLyLaUw7wxUL+nCTP0XJvJg1AXulJRI3UJi8GsbDuxdGA==", "dev": true, "requires": { - "function-bind": "^1.1.1", - "has": "^1.0.3", + "function-bind": "^1.1.2", "has-proto": "^1.0.1", - "has-symbols": "^1.0.3" + "has-symbols": "^1.0.3", + "hasown": "^2.0.0" } }, "get-stream": { @@ -7573,13 +7630,13 @@ "dev": true }, "glob": { - "version": "10.3.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.3.tgz", - "integrity": "sha512-92vPiMb/iqpmEgsOoIDvTjc50wf9CCCvMzsi6W0JLPeUKE8TWP1a73PgqSrqy7iAZxaSD1YdzU7QZR5LF51MJw==", + "version": "10.3.10", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.10.tgz", + "integrity": "sha512-fa46+tv1Ak0UPK1TOy/pZrIybNNt4HCv7SDzwyfiOZkvZLEbjsZkJBPtDHVshZjbecAoAGSC20MjLDG/qr679g==", "dev": true, "requires": { "foreground-child": "^3.1.0", - "jackspeak": "^2.0.3", + "jackspeak": "^2.3.5", "minimatch": "^9.0.1", "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0", "path-scurry": "^1.10.1" @@ -7615,9 +7672,9 @@ } }, "globals": { - "version": "13.20.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.20.0.tgz", - "integrity": "sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ==", + "version": "13.23.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.23.0.tgz", + "integrity": "sha512-XAmF0RjlrjY23MA51q3HltdlGxUpXPvg0GioKiD9X6HD28iMjo2dKC8Vqwm7lne4GNr78+RHTfliktR6ZH09wA==", "dev": true, "requires": { "type-fest": "^0.20.2" @@ -7652,15 +7709,6 @@ "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", "dev": true }, - "has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "dev": true, - "requires": { - "function-bind": "^1.1.1" - } - }, "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -7668,12 +7716,12 @@ "dev": true }, "has-property-descriptors": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz", - "integrity": "sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.1.tgz", + "integrity": "sha512-VsX8eaIewvas0xnvinAe9bw4WfIeODpGYikiWYLH+dma0Jw6KHYqWiWfhQlgOVK8D6PvjubK5Uc4P0iIhIcNVg==", "dev": true, "requires": { - "get-intrinsic": "^1.1.1" + "get-intrinsic": "^1.2.2" } }, "has-proto": { @@ -7718,6 +7766,15 @@ "minimalistic-assert": "^1.0.1" } }, + "hasown": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz", + "integrity": "sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==", + "dev": true, + "requires": { + "function-bind": "^1.1.2" + } + }, "hmac-drbg": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", @@ -7802,12 +7859,12 @@ "dev": true }, "is-core-module": { - "version": "2.12.1", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.12.1.tgz", - "integrity": "sha512-Q4ZuBAe2FUsKtyQJoQHlvP8OvBERxO3jEmy1I7hcRXcJBGGHFh/aJBswbXuS9sgrDH2QUO8ilkwNPHvHMd8clg==", + "version": "2.13.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", + "integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==", "dev": true, "requires": { - "has": "^1.0.3" + "hasown": "^2.0.0" } }, "is-docker": { @@ -7922,9 +7979,9 @@ "dev": true }, "jackspeak": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-2.2.2.tgz", - "integrity": "sha512-mgNtVv4vUuaKA97yxUHoA3+FkuhtxkjdXEWOyB/N76fjy0FjezEt34oy3epBtvCvS+7DyKwqCFWx/oJLV5+kCg==", + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-2.3.6.tgz", + "integrity": "sha512-N3yCS/NegsOBokc8GAdM8UcmfsKiSS8cipheD/nivzr700H+nsMOxJjQnvwOcRYVuFkdH0wGUvW2WbXGmrZGbQ==", "dev": true, "requires": { "@isaacs/cliui": "^8.0.2", @@ -7949,6 +8006,12 @@ "bignumber.js": "^9.0.0" } }, + "json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true + }, "json-duplicate-key-handle": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/json-duplicate-key-handle/-/json-duplicate-key-handle-1.0.0.tgz", @@ -7981,6 +8044,15 @@ "readable-stream": "^3.6.0" } }, + "keyv": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dev": true, + "requires": { + "json-buffer": "3.0.1" + } + }, "keyvaluestorage-interface": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/keyvaluestorage-interface/-/keyvaluestorage-interface-1.0.0.tgz", @@ -8025,9 +8097,9 @@ "dev": true }, "lru-cache": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.0.0.tgz", - "integrity": "sha512-svTf/fzsKHffP42sujkO/Rjs37BCIsQVRCeNYIm9WN8rgT7ffoUnRtZCqU+6BqcSBdv8gwJeTz8knJpgACeQMw==", + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.0.1.tgz", + "integrity": "sha512-IJ4uwUTi2qCccrioU6g9g/5rvvVl13bsdczUUcqbciD9iLr095yj8DQKdObriEvuNSx325N1rV1O0sJFszx75g==", "dev": true }, "md5.js": { @@ -8124,9 +8196,9 @@ } }, "minipass": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.2.tgz", - "integrity": "sha512-eL79dXrE1q9dBbDCLg7xfn/vl7MS4F1gvJAgjJrQli/jbQWdUttuVawphqpffoIYfRdq78LHx6GP4bU/EQ2ATA==", + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.4.tgz", + "integrity": "sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==", "dev": true }, "ms": { @@ -8153,12 +8225,6 @@ "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", "dev": true }, - "natural-compare-lite": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz", - "integrity": "sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==", - "dev": true - }, "node-addon-api": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.2.tgz", @@ -8166,9 +8232,9 @@ "dev": true }, "node-gyp-build": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.6.0.tgz", - "integrity": "sha512-NTZVKn9IylLwUzaKjkas1e4u2DLNcV4rdYagA4PWdPwW87Bi7z+BznyKSRwS/761tV/lzCGXplWsiaMjLqP2zQ==", + "version": "4.6.1", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.6.1.tgz", + "integrity": "sha512-24vnklJmyRS8ViBNI8KbtK/r/DmXQMRiOMXTNz2nrTnAYUwjmEEbnnpB/+kt+yWRv73bPsSPRFddrcIbAxSiMQ==", "dev": true }, "node-stdlib-browser": { @@ -8236,9 +8302,9 @@ } }, "object-inspect": { - "version": "1.12.3", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", - "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==", + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz", + "integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==", "dev": true }, "object-is": { @@ -8257,6 +8323,18 @@ "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", "dev": true }, + "object.assign": { + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.4.tgz", + "integrity": "sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "has-symbols": "^1.0.3", + "object-keys": "^1.1.1" + } + }, "on-exit-leak-free": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/on-exit-leak-free/-/on-exit-leak-free-0.2.0.tgz", @@ -8505,9 +8583,9 @@ "dev": true }, "prettier": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.1.tgz", - "integrity": "sha512-fcOWSnnpCrovBsmFZIGIy9UqK2FaI7Hqax+DIO0A9UxeVoY4iweyaFjS5TavZN97Hfehph0nhsZnjlVKzEQSrQ==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.3.tgz", + "integrity": "sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==", "dev": true }, "prettier-linter-helpers": { @@ -8685,12 +8763,12 @@ "dev": true }, "resolve": { - "version": "1.22.2", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz", - "integrity": "sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g==", + "version": "1.22.8", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", + "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", "dev": true, "requires": { - "is-core-module": "^2.11.0", + "is-core-module": "^2.13.0", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" } @@ -8708,12 +8786,12 @@ "dev": true }, "rimraf": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.1.tgz", - "integrity": "sha512-OfFZdwtd3lZ+XZzYP/6gTACubwFcHdLRqS9UX3UwpU2dnGQYkPFISRwvM3w9IiB2w7bW5qGo/uAwE4SmXXSKvg==", + "version": "5.0.5", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.5.tgz", + "integrity": "sha512-CqDakW+hMe/Bz202FPEymy68P+G50RfMQK+Qo5YUqc9SPipvbGjCGKd0RSKEelbsfQuw3g5NZDSrlZZAJurH1A==", "dev": true, "requires": { - "glob": "^10.2.5" + "glob": "^10.3.7" } }, "ripemd160": { @@ -8877,6 +8955,18 @@ "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==", "dev": true }, + "set-function-length": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.1.1.tgz", + "integrity": "sha512-VoaqjbBJKiWtg4yRcKBQ7g7wnGnLV3M8oLvVWwOk2PdYY6PEFegR1vezXR0tw6fZGF9csVakIRjrJiy2veSBFQ==", + "dev": true, + "requires": { + "define-data-property": "^1.1.1", + "get-intrinsic": "^1.2.1", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.0" + } + }, "setimmediate": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", @@ -9098,9 +9188,9 @@ }, "dependencies": { "tslib": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.1.tgz", - "integrity": "sha512-t0hLfiEKfMUoqhG+U1oid7Pva4bbDPHYfJNiB7BiIjRkj1pyC++4N3huJfqY6aRH6VTB0rvtzQwjM4K6qpfOig==", + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", "dev": true } } @@ -9145,9 +9235,9 @@ } }, "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==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.0.3.tgz", + "integrity": "sha512-wNMeqtMz5NtwpT/UZGY5alT+VoKdSsOOP/kqHFcUW1P/VRhH2wJ48+DN2WwUliNbQ976ETwDL0Ifd2VVvgonvg==", "dev": true, "requires": {} }, @@ -9179,9 +9269,9 @@ "dev": true }, "typescript": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz", - "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==", + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", + "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==", "dev": true }, "uint8arrays": { @@ -9193,6 +9283,12 @@ "multiformats": "^9.4.2" } }, + "undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "dev": true + }, "untildify": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/untildify/-/untildify-4.0.0.tgz", @@ -9217,13 +9313,13 @@ } }, "url": { - "version": "0.11.1", - "resolved": "https://registry.npmjs.org/url/-/url-0.11.1.tgz", - "integrity": "sha512-rWS3H04/+mzzJkv0eZ7vEDGiQbgquI1fGfOad6zKvgYQi1SzMmhl7c/DdRGxhaWrVH6z0qWITo8rpnxK/RfEhA==", + "version": "0.11.3", + "resolved": "https://registry.npmjs.org/url/-/url-0.11.3.tgz", + "integrity": "sha512-6hxOLGfZASQK/cijlZnZJTq8OXAkt/3YGfQX45vvMYXpZoo8NdWZcY73K108Jf759lS1Bv/8wXnHDTSz17dSRw==", "dev": true, "requires": { "punycode": "^1.4.1", - "qs": "^6.11.0" + "qs": "^6.11.2" }, "dependencies": { "qs": { @@ -9278,13 +9374,13 @@ "dev": true }, "which-typed-array": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.11.tgz", - "integrity": "sha512-qe9UWWpkeG5yzZ0tNYxDmd7vo58HDBc39mZ0xWWpolAGADdFOzkfamWLDxkOWcvHQKVmdTyQdLD4NOfjLWTKew==", + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.13.tgz", + "integrity": "sha512-P5Nra0qjSncduVPEAr7xhoF5guty49ArDTwzJ/yNuPIbZppyRxFQsRCWrocxIY+CnMVG+qfbU2FmDKyvSGClow==", "dev": true, "requires": { "available-typed-arrays": "^1.0.5", - "call-bind": "^1.0.2", + "call-bind": "^1.0.4", "for-each": "^0.3.3", "gopd": "^1.0.1", "has-tostringtag": "^1.0.0" diff --git a/package.json b/package.json index 6a026c3..243bbf4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "elven.js", - "version": "0.12.0", + "version": "0.13.0", "description": "Authenticate, sign and send transactions on the MultiversX blockchain in the browser.", "type": "module", "module": "build/elven.js", @@ -28,7 +28,8 @@ "blockchain", "sdk", "javascript", - "browser" + "browser", + "xalias" ], "scripts": { "build": "rimraf build && node ./esbuild.config.cjs && tsc && cp build/elven.js example/elven.js", @@ -39,25 +40,25 @@ "prepublishOnly": "npm run build" }, "devDependencies": { - "@multiversx/sdk-core": "12.6.0", + "@multiversx/sdk-core": "12.11.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.3", - "@multiversx/sdk-web-wallet-provider": "3.0.0", - "@types/qrcode": "1.5.1", - "@types/serve-handler": "6.1.1", - "@typescript-eslint/eslint-plugin": "6.2.1", - "@typescript-eslint/parser": "6.2.1", - "esbuild": "0.18.17", - "eslint": "8.46.0", - "eslint-config-prettier": "8.10.0", - "eslint-plugin-prettier": "5.0.0", + "@multiversx/sdk-native-auth-client": "1.0.5", + "@multiversx/sdk-network-providers": "2.0.0", + "@multiversx/sdk-wallet-connect-provider": "4.0.4", + "@multiversx/sdk-web-wallet-provider": "3.1.0", + "@types/qrcode": "1.5.4", + "@types/serve-handler": "6.1.3", + "@typescript-eslint/eslint-plugin": "6.9.0", + "@typescript-eslint/parser": "6.9.0", + "esbuild": "0.19.5", + "eslint": "8.52.0", + "eslint-config-prettier": "9.0.0", + "eslint-plugin-prettier": "5.0.1", "node-stdlib-browser": "1.2.0", - "prettier": "3.0.1", + "prettier": "3.0.3", "qrcode": "1.5.3", - "rimraf": "5.0.1", + "rimraf": "5.0.5", "serve-handler": "6.1.5", - "typescript": "5.1.6" + "typescript": "5.2.2" } } diff --git a/src/auth/account-sync.ts b/src/auth/account-sync.ts index cfc6179..3a47a20 100644 --- a/src/auth/account-sync.ts +++ b/src/auth/account-sync.ts @@ -14,13 +14,11 @@ export const accountSync = async (elven: any) => { const userAddressInstance = new Address(address); const userAccountInstance = new Account(userAddressInstance); try { - const userAccountOnNetwork = await elven.networkProvider.getAccount( - userAddressInstance - ); + const userAccountOnNetwork = + await elven.networkProvider.getAccount(userAddressInstance); - const userGuardianOnNetwork = await elven.networkProvider.getGuardianData( - userAddressInstance - ); + const userGuardianOnNetwork = + await elven.networkProvider.getGuardianData(userAddressInstance); ls.set('address', address); ls.set( diff --git a/src/auth/login-with-web-wallet.ts b/src/auth/login-with-web-wallet.ts index fcc2b2c..bcb4257 100644 --- a/src/auth/login-with-web-wallet.ts +++ b/src/auth/login-with-web-wallet.ts @@ -1,19 +1,18 @@ import { WalletProvider } from '@multiversx/sdk-web-wallet-provider/out/walletProvider'; import { EventStoreEvents, LoginMethodsEnum } from '../types'; -import { DAPP_INIT_ROUTE } from '../utils/constants'; +import { DAPP_INIT_ROUTE, networkConfig } from '../utils/constants'; import { errorParse } from '../utils/error-parse'; import { ls } from '../utils/ls-helpers'; import { getNewLoginExpiresTimestamp } from './expires-at'; import { EventsStore } from '../events-store'; export const loginWithWebWallet = async ( - webWalletAddress: string, + urlAddress: string, loginToken: string, + chainType: string, callbackRoute?: string ) => { - const dappProvider = new WalletProvider( - `${webWalletAddress}${DAPP_INIT_ROUTE}` - ); + const dappProvider = new WalletProvider(`${urlAddress}${DAPP_INIT_ROUTE}`); const callbackUrl: string = typeof window !== 'undefined' @@ -26,7 +25,12 @@ export const loginWithWebWallet = async ( try { EventsStore.run(EventStoreEvents.onLoginPending); - ls.set('loginMethod', LoginMethodsEnum.webWallet); + ls.set( + 'loginMethod', + networkConfig[chainType].xAliasAddress === urlAddress + ? LoginMethodsEnum.xAlias + : LoginMethodsEnum.webWallet + ); await dappProvider.login(providerLoginData); ls.set('expires', getNewLoginExpiresTimestamp()); ls.set('loginToken', loginToken); diff --git a/src/interaction/web-wallet-tx-finalize.ts b/src/interaction/web-wallet-tx-finalize.ts index f5b54b4..00ec6ba 100644 --- a/src/interaction/web-wallet-tx-finalize.ts +++ b/src/interaction/web-wallet-tx-finalize.ts @@ -23,7 +23,7 @@ import { preSendTx } from './pre-send-tx'; export const webWalletTxFinalize = async ( dappProvider: DappProvider, networkProvider: ApiNetworkProvider, - walletUrlAddress: string, + urlAddress: string, nonce: number ) => { const walletProviderStatus = getParamFromUrl(WALLET_PROVIDER_CALLBACK_PARAM); @@ -47,14 +47,22 @@ export const webWalletTxFinalize = async ( // For now it is prepared for handling one transaction at a time transactionObj = txs?.[0]; if (!transactionObj) return; - transactionObj.data = Buffer.from(transactionObj.data).toString('base64'); + // Something is broken here, the line below is required for web wallet but not for xAlias + // getTransactionsFromWalletUrl should return the same data for both cases + // and then it should be consumed in the same way on the web wallet and xAlias sides + if (loginMethod === LoginMethodsEnum.webWallet) { + transactionObj.data = Buffer.from(transactionObj.data).toString( + 'base64' + ); + } } else if ( guardian && loginMethod !== LoginMethodsEnum.webWallet && + loginMethod !== LoginMethodsEnum.xAlias && hasWebWalletGuardianSign ) { const webWalletProvider = new WalletProvider( - `${walletUrlAddress}${DAPP_INIT_ROUTE}` + `${urlAddress}${DAPP_INIT_ROUTE}` ); const txs = webWalletProvider.getTransactionsFromWalletUrl(); transactionObj = txs?.[0]; diff --git a/src/main.ts b/src/main.ts index 7b93eb9..e8e17e9 100644 --- a/src/main.ts +++ b/src/main.ts @@ -109,7 +109,8 @@ export class ElvenJS { const isAddress = state?.address || - (state.loginMethod === LoginMethodsEnum.webWallet && + ((state.loginMethod === LoginMethodsEnum.webWallet || + state.loginMethod === LoginMethodsEnum.xAlias) && getParamFromUrl('address')); if (isAddress && state?.loginMethod) { @@ -130,6 +131,15 @@ export class ElvenJS { this.initOptions.apiUrl ); } + if ( + state.loginMethod === LoginMethodsEnum.xAlias && + this.initOptions.chainType + ) { + this.dappProvider = await initWebWalletProvider( + networkConfig[this.initOptions.chainType].xAliasAddress, + this.initOptions.apiUrl + ); + } await accountSync(this); @@ -142,7 +152,11 @@ export class ElvenJS { await webWalletTxFinalize( this.dappProvider, this.networkProvider, - networkConfig[this.initOptions.chainType].walletAddress, + networkConfig[this.initOptions.chainType][ + state.loginMethod === LoginMethodsEnum.xAlias + ? 'xAliasAddress' + : 'walletAddress' + ], state.nonce ); } @@ -203,6 +217,22 @@ export class ElvenJS { const dappProvider = await loginWithWebWallet( networkConfig[this.initOptions.chainType].walletAddress, loginToken, + this.initOptions?.chainType, + options?.callbackRoute + ); + this.dappProvider = dappProvider; + } + + // Login with xAlias + if ( + loginMethod === LoginMethodsEnum.xAlias && + this.initOptions?.chainType + ) { + // Login with xAlias is almost the same as with the web wallet, only endpoints are different + const dappProvider = await loginWithWebWallet( + networkConfig[this.initOptions.chainType].xAliasAddress, + loginToken, + this.initOptions?.chainType, options?.callbackRoute ); this.dappProvider = dappProvider; @@ -261,7 +291,10 @@ export class ElvenJS { await this.dappProvider.signTransaction(transaction); } - if (currentState.loginMethod !== LoginMethodsEnum.webWallet) { + if ( + currentState.loginMethod !== LoginMethodsEnum.webWallet && + currentState.loginMethod !== LoginMethodsEnum.xAlias + ) { const needsGuardianSign = checkNeedsGuardianSigning(signedTx); if (!needsGuardianSign) { diff --git a/src/types.ts b/src/types.ts index b1c3ff7..7225a63 100644 --- a/src/types.ts +++ b/src/types.ts @@ -25,6 +25,7 @@ export enum LoginMethodsEnum { mobile = 'mobile', webWallet = 'web-wallet', browserExtension = 'browser-extension', + xAlias = 'x-alias', } export type DappProvider = diff --git a/src/utils/constants.ts b/src/utils/constants.ts index 0b339e2..66b09b7 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -7,6 +7,7 @@ interface NetworkType { decimals: string; gasPerDataByte: string; walletAddress: string; + xAliasAddress: string; apiAddress: string; explorerAddress: string; apiTimeout: number; @@ -40,6 +41,7 @@ export const networkConfig: Record = { decimals: '4', gasPerDataByte: '1500', walletAddress: 'https://devnet-wallet.multiversx.com', + xAliasAddress: 'https://devnet.xalias.com', apiAddress: 'https://devnet-api.multiversx.com', explorerAddress: 'https://devnet-explorer.multiversx.com', apiTimeout: 10000, @@ -53,6 +55,7 @@ export const networkConfig: Record = { decimals: '4', gasPerDataByte: '1500', walletAddress: 'https://testnet-wallet.multiversx.com', + xAliasAddress: 'https://testnet.xalias.com', apiAddress: 'https://testnet-api.multiversx.com', explorerAddress: 'https://testnet-explorer.multiversx.com', apiTimeout: 10000, @@ -66,6 +69,7 @@ export const networkConfig: Record = { decimals: '4', gasPerDataByte: '1500', walletAddress: 'https://wallet.multiversx.com', + xAliasAddress: 'https://xalias.com', apiAddress: 'https://api.multiversx.com', explorerAddress: 'https://explorer.multiversx.com', apiTimeout: 10000,