diff --git a/CHANGELOG.md b/CHANGELOG.md index e81f3fd..f81df36 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ -### [0.7.0](https://github.com/juliancwirko/elven.js/releases/tag/v0.7.0) (2022-10-19) +### [0.7.0](https://github.com/juliancwirko/elven.js/releases/tag/v0.7.0) (2022-11-...) - WalletConnect 2 integration through new version of `@elrondnetwork/erdjs-wallet-connect-provider` - let's you use 'Maiar Login 2.0'. No fallback for the old method. We'll see if it is needed. +### [0.6.1](https://github.com/juliancwirko/elven.js/releases/tag/v0.6.1) (2022-10-31) +- make the WalletConnect bridge addresses configurable. You can use `ElvenJS.init({ walletConnectBridgeAddresses: ['https://...'], })` to overwrite the default ones. + ### [0.6.0](https://github.com/juliancwirko/elven.js/releases/tag/v0.6.0) (2022-10-16) - Elrond Web Wallet support - new way of getting the last transaction status, you can now use a callback function defined when initializing the ElvenJS: `onTxFinalized: (tx) => { ... }`. Check for more info in the docs. You can still use the return value from `await ElvenJS.signAndSendTransaction(tx)`, but it won't work for the Web Wallet (because of its redirections and different flow). diff --git a/build/elven.js b/build/elven.js deleted file mode 100644 index b35d9d2..0000000 --- a/build/elven.js +++ /dev/null @@ -1,55 +0,0 @@ -var z8=Object.create;var ec=Object.defineProperty,$8=Object.defineProperties,k8=Object.getOwnPropertyDescriptor,W8=Object.getOwnPropertyDescriptors,Y8=Object.getOwnPropertyNames,BE=Object.getOwnPropertySymbols,J8=Object.getPrototypeOf,PE=Object.prototype.hasOwnProperty,X8=Object.prototype.propertyIsEnumerable;var ME=(r,e,t)=>e in r?ec(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ql=(r,e)=>{for(var t in e||={})PE.call(e,t)&&ME(r,t,e[t]);if(BE)for(var t of BE(e))X8.call(e,t)&&ME(r,t,e[t]);return r},LE=(r,e)=>$8(r,W8(e));var jl=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+r+'" is not supported')});var ye=(r,e)=>()=>(r&&(e=r(r=0)),e);var D=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),st=(r,e)=>{for(var t in e)ec(r,t,{get:e[t],enumerable:!0})},Hl=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Y8(e))!PE.call(r,n)&&n!==t&&ec(r,n,{get:()=>e[n],enumerable:!(i=k8(e,n))||i.enumerable});return r},Xt=(r,e,t)=>(Hl(r,e,"default"),t&&Hl(t,e,"default")),_e=(r,e,t)=>(t=r!=null?z8(J8(r)):{},Hl(e||!r||!r.__esModule?ec(t,"default",{value:r,enumerable:!0}):t,r)),ti=r=>Hl(ec({},"__esModule",{value:!0}),r);var Te=(r,e,t)=>new Promise((i,n)=>{var s=u=>{try{a(t.next(u))}catch(h){n(h)}},o=u=>{try{a(t.throw(u))}catch(h){n(h)}},a=u=>u.done?i(u.value):Promise.resolve(u.value).then(s,o);a((t=t.apply(r,e)).next())});var b0=D(Gl=>{"use strict";l();Gl.byteLength=eB;Gl.toByteArray=rB;Gl.fromByteArray=sB;var ri=[],Sr=[],Z8=typeof Uint8Array<"u"?Uint8Array:Array,I0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(gs=0,RE=I0.length;gs0)throw new Error("Invalid string. Length must be a multiple of 4");var t=r.indexOf("=");t===-1&&(t=e);var i=t===e?0:4-t%4;return[t,i]}function eB(r){var e=FE(r),t=e[0],i=e[1];return(t+i)*3/4-i}function tB(r,e,t){return(e+t)*3/4-t}function rB(r){var e,t=FE(r),i=t[0],n=t[1],s=new Z8(tB(r,i,n)),o=0,a=n>0?i-4:i,u;for(u=0;u>16&255,s[o++]=e>>8&255,s[o++]=e&255;return n===2&&(e=Sr[r.charCodeAt(u)]<<2|Sr[r.charCodeAt(u+1)]>>4,s[o++]=e&255),n===1&&(e=Sr[r.charCodeAt(u)]<<10|Sr[r.charCodeAt(u+1)]<<4|Sr[r.charCodeAt(u+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function iB(r){return ri[r>>18&63]+ri[r>>12&63]+ri[r>>6&63]+ri[r&63]}function nB(r,e,t){for(var i,n=[],s=e;sa?a:o+s));return i===1?(e=r[t-1],n.push(ri[e>>2]+ri[e<<4&63]+"==")):i===2&&(e=(r[t-2]<<8)+r[t-1],n.push(ri[e>>10]+ri[e>>4&63]+ri[e<<2&63]+"=")),n.join("")}});var S0=D(C0=>{l();C0.read=function(r,e,t,i,n){var s,o,a=n*8-i-1,u=(1<>1,p=-7,v=t?n-1:0,B=t?-1:1,R=r[e+v];for(v+=B,s=R&(1<<-p)-1,R>>=-p,p+=a;p>0;s=s*256+r[e+v],v+=B,p-=8);for(o=s&(1<<-p)-1,s>>=-p,p+=i;p>0;o=o*256+r[e+v],v+=B,p-=8);if(s===0)s=1-h;else{if(s===u)return o?NaN:(R?-1:1)*(1/0);o=o+Math.pow(2,i),s=s-h}return(R?-1:1)*o*Math.pow(2,s-i)};C0.write=function(r,e,t,i,n,s){var o,a,u,h=s*8-n-1,p=(1<>1,B=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,R=i?0:s-1,x=i?1:-1,V=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=p):(o=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-o))<1&&(o--,u*=2),o+v>=1?e+=B/u:e+=B*Math.pow(2,1-v),e*u>=2&&(o++,u/=2),o+v>=p?(a=0,o=p):o+v>=1?(a=(e*u-1)*Math.pow(2,n),o=o+v):(a=e*Math.pow(2,v-1)*Math.pow(2,n),o=0));n>=8;r[t+R]=a&255,R+=x,a/=256,n-=8);for(o=o<0;r[t+R]=o&255,R+=x,o/=256,h-=8);r[t+R-x]|=V*128}});var YE=D(Do=>{"use strict";l();var x0=b0(),No=S0(),UE=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Do.Buffer=se;Do.SlowBuffer=fB;Do.INSPECT_MAX_BYTES=50;var Kl=2147483647;Do.kMaxLength=Kl;se.TYPED_ARRAY_SUPPORT=oB();!se.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 oB(){try{var r=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(r,e),r.foo()===42}catch{return!1}}Object.defineProperty(se.prototype,"parent",{enumerable:!0,get:function(){if(!!se.isBuffer(this))return this.buffer}});Object.defineProperty(se.prototype,"offset",{enumerable:!0,get:function(){if(!!se.isBuffer(this))return this.byteOffset}});function Fi(r){if(r>Kl)throw new RangeError('The value "'+r+'" is invalid for option "size"');var e=new Uint8Array(r);return Object.setPrototypeOf(e,se.prototype),e}function se(r,e,t){if(typeof r=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return O0(r)}return HE(r,e,t)}se.poolSize=8192;function HE(r,e,t){if(typeof r=="string")return uB(r,e);if(ArrayBuffer.isView(r))return cB(r);if(r==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r);if(ii(r,ArrayBuffer)||r&&ii(r.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ii(r,SharedArrayBuffer)||r&&ii(r.buffer,SharedArrayBuffer)))return N0(r,e,t);if(typeof r=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var i=r.valueOf&&r.valueOf();if(i!=null&&i!==r)return se.from(i,e,t);var n=lB(r);if(n)return n;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return se.from(r[Symbol.toPrimitive]("string"),e,t);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r)}se.from=function(r,e,t){return HE(r,e,t)};Object.setPrototypeOf(se.prototype,Uint8Array.prototype);Object.setPrototypeOf(se,Uint8Array);function QE(r){if(typeof r!="number")throw new TypeError('"size" argument must be of type number');if(r<0)throw new RangeError('The value "'+r+'" is invalid for option "size"')}function aB(r,e,t){return QE(r),r<=0?Fi(r):e!==void 0?typeof t=="string"?Fi(r).fill(e,t):Fi(r).fill(e):Fi(r)}se.alloc=function(r,e,t){return aB(r,e,t)};function O0(r){return QE(r),Fi(r<0?0:B0(r)|0)}se.allocUnsafe=function(r){return O0(r)};se.allocUnsafeSlow=function(r){return O0(r)};function uB(r,e){if((typeof e!="string"||e==="")&&(e="utf8"),!se.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var t=jE(r,e)|0,i=Fi(t),n=i.write(r,e);return n!==t&&(i=i.slice(0,n)),i}function T0(r){for(var e=r.length<0?0:B0(r.length)|0,t=Fi(e),i=0;i=Kl)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Kl.toString(16)+" bytes");return r|0}function fB(r){return+r!=r&&(r=0),se.alloc(+r)}se.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==se.prototype};se.compare=function(e,t){if(ii(e,Uint8Array)&&(e=se.from(e,e.offset,e.byteLength)),ii(t,Uint8Array)&&(t=se.from(t,t.offset,t.byteLength)),!se.isBuffer(e)||!se.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var i=e.length,n=t.length,s=0,o=Math.min(i,n);sn.length?se.from(o).copy(n,s):Uint8Array.prototype.set.call(n,o,s);else if(se.isBuffer(o))o.copy(n,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return n};function jE(r,e){if(se.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||ii(r,ArrayBuffer))return r.byteLength;if(typeof r!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof r);var t=r.length,i=arguments.length>2&&arguments[2]===!0;if(!i&&t===0)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return D0(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return WE(r).length;default:if(n)return i?-1:D0(r).length;e=(""+e).toLowerCase(),n=!0}}se.byteLength=jE;function hB(r,e,t){var i=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0,e>>>=0,t<=e))return"";for(r||(r="utf8");;)switch(r){case"hex":return _B(this,e,t);case"utf8":case"utf-8":return KE(this,e,t);case"ascii":return EB(this,e,t);case"latin1":case"binary":return AB(this,e,t);case"base64":return vB(this,e,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return IB(this,e,t);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),i=!0}}se.prototype._isBuffer=!0;function ys(r,e,t){var i=r[e];r[e]=r[t],r[t]=i}se.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 t=0;tt&&(e+=" ... "),""};UE&&(se.prototype[UE]=se.prototype.inspect);se.prototype.compare=function(e,t,i,n,s){if(ii(e,Uint8Array)&&(e=se.from(e,e.offset,e.byteLength)),!se.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(t===void 0&&(t=0),i===void 0&&(i=e?e.length:0),n===void 0&&(n=0),s===void 0&&(s=this.length),t<0||i>e.length||n<0||s>this.length)throw new RangeError("out of range index");if(n>=s&&t>=i)return 0;if(n>=s)return-1;if(t>=i)return 1;if(t>>>=0,i>>>=0,n>>>=0,s>>>=0,this===e)return 0;for(var o=s-n,a=i-t,u=Math.min(o,a),h=this.slice(n,s),p=e.slice(t,i),v=0;v2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,M0(t)&&(t=n?0:r.length-1),t<0&&(t=r.length+t),t>=r.length){if(n)return-1;t=r.length-1}else if(t<0)if(n)t=0;else return-1;if(typeof e=="string"&&(e=se.from(e,i)),se.isBuffer(e))return e.length===0?-1:qE(r,e,t,i,n);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?n?Uint8Array.prototype.indexOf.call(r,e,t):Uint8Array.prototype.lastIndexOf.call(r,e,t):qE(r,[e],t,i,n);throw new TypeError("val must be string, number or Buffer")}function qE(r,e,t,i,n){var s=1,o=r.length,a=e.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(r.length<2||e.length<2)return-1;s=2,o/=2,a/=2,t/=2}function u(R,x){return s===1?R[x]:R.readUInt16BE(x*s)}var h;if(n){var p=-1;for(h=t;ho&&(t=o-a),h=t;h>=0;h--){for(var v=!0,B=0;Bn&&(i=n)):i=n;var s=e.length;i>s/2&&(i=s/2);for(var o=0;o>>0,isFinite(i)?(i=i>>>0,n===void 0&&(n="utf8")):(n=i,i=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var s=this.length-t;if((i===void 0||i>s)&&(i=s),e.length>0&&(i<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return dB(this,e,t,i);case"utf8":case"utf-8":return pB(this,e,t,i);case"ascii":case"latin1":case"binary":return gB(this,e,t,i);case"base64":return yB(this,e,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return mB(this,e,t,i);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}};se.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function vB(r,e,t){return e===0&&t===r.length?x0.fromByteArray(r):x0.fromByteArray(r.slice(e,t))}function KE(r,e,t){t=Math.min(r.length,t);for(var i=[],n=e;n239?4:s>223?3:s>191?2:1;if(n+a<=t){var u,h,p,v;switch(a){case 1:s<128&&(o=s);break;case 2:u=r[n+1],(u&192)===128&&(v=(s&31)<<6|u&63,v>127&&(o=v));break;case 3:u=r[n+1],h=r[n+2],(u&192)===128&&(h&192)===128&&(v=(s&15)<<12|(u&63)<<6|h&63,v>2047&&(v<55296||v>57343)&&(o=v));break;case 4:u=r[n+1],h=r[n+2],p=r[n+3],(u&192)===128&&(h&192)===128&&(p&192)===128&&(v=(s&15)<<18|(u&63)<<12|(h&63)<<6|p&63,v>65535&&v<1114112&&(o=v))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,i.push(o>>>10&1023|55296),o=56320|o&1023),i.push(o),n+=a}return wB(i)}var VE=4096;function wB(r){var e=r.length;if(e<=VE)return String.fromCharCode.apply(String,r);for(var t="",i=0;ii)&&(t=i);for(var n="",s=e;si&&(e=i),t<0?(t+=i,t<0&&(t=0)):t>i&&(t=i),tt)throw new RangeError("Trying to access beyond buffer length")}se.prototype.readUintLE=se.prototype.readUIntLE=function(e,t,i){e=e>>>0,t=t>>>0,i||Vt(e,t,this.length);for(var n=this[e],s=1,o=0;++o>>0,t=t>>>0,i||Vt(e,t,this.length);for(var n=this[e+--t],s=1;t>0&&(s*=256);)n+=this[e+--t]*s;return n};se.prototype.readUint8=se.prototype.readUInt8=function(e,t){return e=e>>>0,t||Vt(e,1,this.length),this[e]};se.prototype.readUint16LE=se.prototype.readUInt16LE=function(e,t){return e=e>>>0,t||Vt(e,2,this.length),this[e]|this[e+1]<<8};se.prototype.readUint16BE=se.prototype.readUInt16BE=function(e,t){return e=e>>>0,t||Vt(e,2,this.length),this[e]<<8|this[e+1]};se.prototype.readUint32LE=se.prototype.readUInt32LE=function(e,t){return e=e>>>0,t||Vt(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};se.prototype.readUint32BE=se.prototype.readUInt32BE=function(e,t){return e=e>>>0,t||Vt(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};se.prototype.readIntLE=function(e,t,i){e=e>>>0,t=t>>>0,i||Vt(e,t,this.length);for(var n=this[e],s=1,o=0;++o=s&&(n-=Math.pow(2,8*t)),n};se.prototype.readIntBE=function(e,t,i){e=e>>>0,t=t>>>0,i||Vt(e,t,this.length);for(var n=t,s=1,o=this[e+--n];n>0&&(s*=256);)o+=this[e+--n]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*t)),o};se.prototype.readInt8=function(e,t){return e=e>>>0,t||Vt(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};se.prototype.readInt16LE=function(e,t){e=e>>>0,t||Vt(e,2,this.length);var i=this[e]|this[e+1]<<8;return i&32768?i|4294901760:i};se.prototype.readInt16BE=function(e,t){e=e>>>0,t||Vt(e,2,this.length);var i=this[e+1]|this[e]<<8;return i&32768?i|4294901760:i};se.prototype.readInt32LE=function(e,t){return e=e>>>0,t||Vt(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};se.prototype.readInt32BE=function(e,t){return e=e>>>0,t||Vt(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};se.prototype.readFloatLE=function(e,t){return e=e>>>0,t||Vt(e,4,this.length),No.read(this,e,!0,23,4)};se.prototype.readFloatBE=function(e,t){return e=e>>>0,t||Vt(e,4,this.length),No.read(this,e,!1,23,4)};se.prototype.readDoubleLE=function(e,t){return e=e>>>0,t||Vt(e,8,this.length),No.read(this,e,!0,52,8)};se.prototype.readDoubleBE=function(e,t){return e=e>>>0,t||Vt(e,8,this.length),No.read(this,e,!1,52,8)};function hr(r,e,t,i,n,s){if(!se.isBuffer(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||er.length)throw new RangeError("Index out of range")}se.prototype.writeUintLE=se.prototype.writeUIntLE=function(e,t,i,n){if(e=+e,t=t>>>0,i=i>>>0,!n){var s=Math.pow(2,8*i)-1;hr(this,e,t,i,s,0)}var o=1,a=0;for(this[t]=e&255;++a>>0,i=i>>>0,!n){var s=Math.pow(2,8*i)-1;hr(this,e,t,i,s,0)}var o=i-1,a=1;for(this[t+o]=e&255;--o>=0&&(a*=256);)this[t+o]=e/a&255;return t+i};se.prototype.writeUint8=se.prototype.writeUInt8=function(e,t,i){return e=+e,t=t>>>0,i||hr(this,e,t,1,255,0),this[t]=e&255,t+1};se.prototype.writeUint16LE=se.prototype.writeUInt16LE=function(e,t,i){return e=+e,t=t>>>0,i||hr(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2};se.prototype.writeUint16BE=se.prototype.writeUInt16BE=function(e,t,i){return e=+e,t=t>>>0,i||hr(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2};se.prototype.writeUint32LE=se.prototype.writeUInt32LE=function(e,t,i){return e=+e,t=t>>>0,i||hr(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4};se.prototype.writeUint32BE=se.prototype.writeUInt32BE=function(e,t,i){return e=+e,t=t>>>0,i||hr(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};se.prototype.writeIntLE=function(e,t,i,n){if(e=+e,t=t>>>0,!n){var s=Math.pow(2,8*i-1);hr(this,e,t,i,s-1,-s)}var o=0,a=1,u=0;for(this[t]=e&255;++o>0)-u&255;return t+i};se.prototype.writeIntBE=function(e,t,i,n){if(e=+e,t=t>>>0,!n){var s=Math.pow(2,8*i-1);hr(this,e,t,i,s-1,-s)}var o=i-1,a=1,u=0;for(this[t+o]=e&255;--o>=0&&(a*=256);)e<0&&u===0&&this[t+o+1]!==0&&(u=1),this[t+o]=(e/a>>0)-u&255;return t+i};se.prototype.writeInt8=function(e,t,i){return e=+e,t=t>>>0,i||hr(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1};se.prototype.writeInt16LE=function(e,t,i){return e=+e,t=t>>>0,i||hr(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2};se.prototype.writeInt16BE=function(e,t,i){return e=+e,t=t>>>0,i||hr(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2};se.prototype.writeInt32LE=function(e,t,i){return e=+e,t=t>>>0,i||hr(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4};se.prototype.writeInt32BE=function(e,t,i){return e=+e,t=t>>>0,i||hr(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function zE(r,e,t,i,n,s){if(t+i>r.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function $E(r,e,t,i,n){return e=+e,t=t>>>0,n||zE(r,e,t,4,34028234663852886e22,-34028234663852886e22),No.write(r,e,t,i,23,4),t+4}se.prototype.writeFloatLE=function(e,t,i){return $E(this,e,t,!0,i)};se.prototype.writeFloatBE=function(e,t,i){return $E(this,e,t,!1,i)};function kE(r,e,t,i,n){return e=+e,t=t>>>0,n||zE(r,e,t,8,17976931348623157e292,-17976931348623157e292),No.write(r,e,t,i,52,8),t+8}se.prototype.writeDoubleLE=function(e,t,i){return kE(this,e,t,!0,i)};se.prototype.writeDoubleBE=function(e,t,i){return kE(this,e,t,!1,i)};se.prototype.copy=function(e,t,i,n){if(!se.isBuffer(e))throw new TypeError("argument should be a Buffer");if(i||(i=0),!n&&n!==0&&(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t>>0,i=i===void 0?this.length:i>>>0,e||(e=0);var o;if(typeof e=="number")for(o=t;o55295&&t<57344){if(!n){if(t>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===i){(e-=3)>-1&&s.push(239,191,189);continue}n=t;continue}if(t<56320){(e-=3)>-1&&s.push(239,191,189),n=t;continue}t=(n-55296<<10|t-56320)+65536}else n&&(e-=3)>-1&&s.push(239,191,189);if(n=null,t<128){if((e-=1)<0)break;s.push(t)}else if(t<2048){if((e-=2)<0)break;s.push(t>>6|192,t&63|128)}else if(t<65536){if((e-=3)<0)break;s.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((e-=4)<0)break;s.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return s}function SB(r){for(var e=[],t=0;t>8,n=t%256,s.push(n),s.push(i);return s}function WE(r){return x0.toByteArray(CB(r))}function zl(r,e,t,i){for(var n=0;n=e.length||n>=r.length);++n)e[n+t]=r[n];return n}function ii(r,e){return r instanceof e||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===e.name}function M0(r){return r!==r}var TB=function(){for(var r="0123456789abcdef",e=new Array(256),t=0;t<16;++t)for(var i=t*16,n=0;n<16;++n)e[i+n]=r[t]+r[n];return e}()});var tA=D((mz,eA)=>{l();var ot=eA.exports={},ni,si;function P0(){throw new Error("setTimeout has not been defined")}function L0(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?ni=setTimeout:ni=P0}catch{ni=P0}try{typeof clearTimeout=="function"?si=clearTimeout:si=L0}catch{si=L0}})();function JE(r){if(ni===setTimeout)return setTimeout(r,0);if((ni===P0||!ni)&&setTimeout)return ni=setTimeout,setTimeout(r,0);try{return ni(r,0)}catch{try{return ni.call(null,r,0)}catch{return ni.call(this,r,0)}}}function NB(r){if(si===clearTimeout)return clearTimeout(r);if((si===L0||!si)&&clearTimeout)return si=clearTimeout,clearTimeout(r);try{return si(r)}catch{try{return si.call(null,r)}catch{return si.call(this,r)}}}var Ui=[],Oo=!1,ms,$l=-1;function DB(){!Oo||!ms||(Oo=!1,ms.length?Ui=ms.concat(Ui):$l=-1,Ui.length&&XE())}function XE(){if(!Oo){var r=JE(DB);Oo=!0;for(var e=Ui.length;e;){for(ms=Ui,Ui=[];++$l1)for(var t=1;t{y=_e(YE()),I=_e(tA()),OB=function(r){function e(){var i=this||self;return delete r.prototype.__magic__,i}if(typeof globalThis=="object")return globalThis;if(this)return e();r.defineProperty(r.prototype,"__magic__",{configurable:!0,get:e});var t=__magic__;return t}(Object),global=OB});var Vr=D((rA,kl)=>{l();(function(r){"use strict";var e,t=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,i=Math.ceil,n=Math.floor,s="[BigNumber Error] ",o=s+"Number primitive has more than 15 significant digits: ",a=1e14,u=14,h=9007199254740991,p=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],v=1e7,B=1e9;function R(W){var G,P,F,$=f.prototype={constructor:f,toString:null,valueOf:null},ce=new f(1),Y=20,X=4,A=-7,c=21,d=-1e7,g=1e7,m=!1,w=1,S=0,N={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},_="0123456789abcdefghijklmnopqrstuvwxyz";function f(E,b){var T,L,O,U,q,M,j,z,Q=this;if(!(Q instanceof f))return new f(E,b);if(b==null){if(E&&E._isBigNumber===!0){Q.s=E.s,!E.c||E.e>g?Q.c=Q.e=null:E.e=10;q/=10,U++);U>g?Q.c=Q.e=null:(Q.e=U,Q.c=[E]);return}z=String(E)}else{if(!t.test(z=String(E)))return F(Q,z,M);Q.s=z.charCodeAt(0)==45?(z=z.slice(1),-1):1}(U=z.indexOf("."))>-1&&(z=z.replace(".","")),(q=z.search(/e/i))>0?(U<0&&(U=q),U+=+z.slice(q+1),z=z.substring(0,q)):U<0&&(U=z.length)}else{if(K(b,2,_.length,"Base"),b==10)return Q=new f(E),ee(Q,Y+Q.e+1,X);if(z=String(E),M=typeof E=="number"){if(E*0!=0)return F(Q,z,M,b);if(Q.s=1/E<0?(z=z.slice(1),-1):1,f.DEBUG&&z.replace(/^0\.0*|\./,"").length>15)throw Error(o+E)}else Q.s=z.charCodeAt(0)===45?(z=z.slice(1),-1):1;for(T=_.slice(0,b),U=q=0,j=z.length;qU){U=j;continue}}else if(!O&&(z==z.toUpperCase()&&(z=z.toLowerCase())||z==z.toLowerCase()&&(z=z.toUpperCase()))){O=!0,q=-1,U=0;continue}return F(Q,String(E),M,b)}M=!1,z=P(z,b,10,Q.s),(U=z.indexOf("."))>-1?z=z.replace(".",""):U=z.length}for(q=0;z.charCodeAt(q)===48;q++);for(j=z.length;z.charCodeAt(--j)===48;);if(z=z.slice(q,++j)){if(j-=q,M&&f.DEBUG&&j>15&&(E>h||E!==n(E)))throw Error(o+Q.s*E);if((U=U-q-1)>g)Q.c=Q.e=null;else if(U=-B&&O<=B&&O===n(O)){if(L[0]===0){if(O===0&&L.length===1)return!0;break e}if(b=(O+1)%u,b<1&&(b+=u),String(L[0]).length==b){for(b=0;b=a||T!==n(T))break e;if(T!==0)return!0}}}else if(L===null&&O===null&&(U===null||U===1||U===-1))return!0;throw Error(s+"Invalid BigNumber: "+E)},f.maximum=f.max=function(){return Z(arguments,$.lt)},f.minimum=f.min=function(){return Z(arguments,$.gt)},f.random=function(){var E=9007199254740992,b=Math.random()*E&2097151?function(){return n(Math.random()*E)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(T){var L,O,U,q,M,j=0,z=[],Q=new f(ce);if(T==null?T=Y:K(T,0,B),q=i(T/u),m)if(crypto.getRandomValues){for(L=crypto.getRandomValues(new Uint32Array(q*=2));j>>11),M>=9e15?(O=crypto.getRandomValues(new Uint32Array(2)),L[j]=O[0],L[j+1]=O[1]):(z.push(M%1e14),j+=2);j=q/2}else if(crypto.randomBytes){for(L=crypto.randomBytes(q*=7);j=9e15?crypto.randomBytes(7).copy(L,j):(z.push(M%1e14),j+=7);j=q/7}else throw m=!1,Error(s+"crypto unavailable");if(!m)for(;j=10;M/=10,j++);jO-1&&(M[q+1]==null&&(M[q+1]=0),M[q+1]+=M[q]/O|0,M[q]%=O)}return M.reverse()}return function(T,L,O,U,q){var M,j,z,Q,ue,he,de,Be,Ie=T.indexOf("."),Se=Y,Oe=X;for(Ie>=0&&(Q=S,S=0,T=T.replace(".",""),Be=new f(L),he=Be.pow(T.length-Ie),S=Q,Be.c=b(J(V(he.c),he.e,"0"),10,O,E),Be.e=Be.c.length),de=b(T,L,O,q?(M=_,E):(M=E,_)),z=Q=de.length;de[--Q]==0;de.pop());if(!de[0])return M.charAt(0);if(Ie<0?--z:(he.c=de,he.e=z,he.s=U,he=G(he,Be,Se,Oe,O),de=he.c,ue=he.r,z=he.e),j=z+Se+1,Ie=de[j],Q=O/2,ue=ue||j<0||de[j+1]!=null,ue=Oe<4?(Ie!=null||ue)&&(Oe==0||Oe==(he.s<0?3:2)):Ie>Q||Ie==Q&&(Oe==4||ue||Oe==6&&de[j-1]&1||Oe==(he.s<0?8:7)),j<1||!de[0])T=ue?J(M.charAt(1),-Se,M.charAt(0)):M.charAt(0);else{if(de.length=j,ue)for(--O;++de[--j]>O;)de[j]=0,j||(++z,de=[1].concat(de));for(Q=de.length;!de[--Q];);for(Ie=0,T="";Ie<=Q;T+=M.charAt(de[Ie++]));T=J(T,z,M.charAt(0))}return T}}(),G=function(){function E(L,O,U){var q,M,j,z,Q=0,ue=L.length,he=O%v,de=O/v|0;for(L=L.slice();ue--;)j=L[ue]%v,z=L[ue]/v|0,q=de*j+z*he,M=he*j+q%v*v+Q,Q=(M/U|0)+(q/v|0)+de*z,L[ue]=M%U;return Q&&(L=[Q].concat(L)),L}function b(L,O,U,q){var M,j;if(U!=q)j=U>q?1:-1;else for(M=j=0;MO[M]?1:-1;break}return j}function T(L,O,U,q){for(var M=0;U--;)L[U]-=M,M=L[U]1;L.splice(0,1));}return function(L,O,U,q,M){var j,z,Q,ue,he,de,Be,Ie,Se,Oe,Ae,De,ps,Je,Xe,_r,Ge,Le=L.s==O.s?1:-1,qt=L.c,be=O.c;if(!qt||!qt[0]||!be||!be[0])return new f(!L.s||!O.s||(qt?be&&qt[0]==be[0]:!be)?NaN:qt&&qt[0]==0||!be?Le*0:Le/0);for(Ie=new f(Le),Se=Ie.c=[],z=L.e-O.e,Le=U+z+1,M||(M=a,z=x(L.e/u)-x(O.e/u),Le=Le/u|0),Q=0;be[Q]==(qt[Q]||0);Q++);if(be[Q]>(qt[Q]||0)&&z--,Le<0)Se.push(1),ue=!0;else{for(Je=qt.length,_r=be.length,Q=0,Le+=2,he=n(M/(be[0]+1)),he>1&&(be=E(be,he,M),qt=E(qt,he,M),_r=be.length,Je=qt.length),ps=_r,Oe=qt.slice(0,_r),Ae=Oe.length;Ae<_r;Oe[Ae++]=0);Ge=be.slice(),Ge=[0].concat(Ge),Xe=be[0],be[1]>=M/2&&Xe++;do{if(he=0,j=b(be,Oe,_r,Ae),j<0){if(De=Oe[0],_r!=Ae&&(De=De*M+(Oe[1]||0)),he=n(De/Xe),he>1)for(he>=M&&(he=M-1),de=E(be,he,M),Be=de.length,Ae=Oe.length;b(de,Oe,Be,Ae)==1;)he--,T(de,_r=10;Le/=10,Q++);ee(Ie,U+(Ie.e=Q+z*u-1)+1,q,ue)}else Ie.e=z,Ie.r=+ue;return Ie}}();function C(E,b,T,L){var O,U,q,M,j;if(T==null?T=X:K(T,0,8),!E.c)return E.toString();if(O=E.c[0],q=E.e,b==null)j=V(E.c),j=L==1||L==2&&(q<=A||q>=c)?k(j,q):J(j,q,"0");else if(E=ee(new f(E),b,T),U=E.e,j=V(E.c),M=j.length,L==1||L==2&&(b<=U||U<=A)){for(;MM){if(--b>0)for(j+=".";b--;j+="0");}else if(b+=U-M,b>0)for(U+1==M&&(j+=".");b--;j+="0");return E.s<0&&O?"-"+j:j}function Z(E,b){for(var T,L=1,O=new f(E[0]);L=10;O/=10,L++);return(T=L+T*u-1)>g?E.c=E.e=null:T=10;M/=10,O++);if(U=b-O,U<0)U+=u,q=b,j=ue[z=0],Q=j/he[O-q-1]%10|0;else if(z=i((U+1)/u),z>=ue.length)if(L){for(;ue.length<=z;ue.push(0));j=Q=0,O=1,U%=u,q=U-u+1}else break e;else{for(j=M=ue[z],O=1;M>=10;M/=10,O++);U%=u,q=U-u+O,Q=q<0?0:j/he[O-q-1]%10|0}if(L=L||b<0||ue[z+1]!=null||(q<0?j:j%he[O-q-1]),L=T<4?(Q||L)&&(T==0||T==(E.s<0?3:2)):Q>5||Q==5&&(T==4||L||T==6&&(U>0?q>0?j/he[O-q]:0:ue[z-1])%10&1||T==(E.s<0?8:7)),b<1||!ue[0])return ue.length=0,L?(b-=E.e+1,ue[0]=he[(u-b%u)%u],E.e=-b||0):ue[0]=E.e=0,E;if(U==0?(ue.length=z,M=1,z--):(ue.length=z+1,M=he[u-U],ue[z]=q>0?n(j/he[O-q]%he[q])*M:0),L)for(;;)if(z==0){for(U=1,q=ue[0];q>=10;q/=10,U++);for(q=ue[0]+=M,M=1;q>=10;q/=10,M++);U!=M&&(E.e++,ue[0]==a&&(ue[0]=1));break}else{if(ue[z]+=M,ue[z]!=a)break;ue[z--]=0,M=1}for(U=ue.length;ue[--U]===0;ue.pop());}E.e>g?E.c=E.e=null:E.e=c?k(b,T):J(b,T,"0"),E.s<0?"-"+b:b)}return $.absoluteValue=$.abs=function(){var E=new f(this);return E.s<0&&(E.s=1),E},$.comparedTo=function(E,b){return H(this,new f(E,b))},$.decimalPlaces=$.dp=function(E,b){var T,L,O,U=this;if(E!=null)return K(E,0,B),b==null?b=X:K(b,0,8),ee(new f(U),E+U.e+1,b);if(!(T=U.c))return null;if(L=((O=T.length-1)-x(this.e/u))*u,O=T[O])for(;O%10==0;O/=10,L--);return L<0&&(L=0),L},$.dividedBy=$.div=function(E,b){return G(this,new f(E,b),Y,X)},$.dividedToIntegerBy=$.idiv=function(E,b){return G(this,new f(E,b),0,1)},$.exponentiatedBy=$.pow=function(E,b){var T,L,O,U,q,M,j,z,Q,ue=this;if(E=new f(E),E.c&&!E.isInteger())throw Error(s+"Exponent not an integer: "+ae(E));if(b!=null&&(b=new f(b)),M=E.e>14,!ue.c||!ue.c[0]||ue.c[0]==1&&!ue.e&&ue.c.length==1||!E.c||!E.c[0])return Q=new f(Math.pow(+ae(ue),M?2-ie(E):+ae(E))),b?Q.mod(b):Q;if(j=E.s<0,b){if(b.c?!b.c[0]:!b.s)return new f(NaN);L=!j&&ue.isInteger()&&b.isInteger(),L&&(ue=ue.mod(b))}else{if(E.e>9&&(ue.e>0||ue.e<-1||(ue.e==0?ue.c[0]>1||M&&ue.c[1]>=24e7:ue.c[0]<8e13||M&&ue.c[0]<=9999975e7)))return U=ue.s<0&&ie(E)?-0:0,ue.e>-1&&(U=1/U),new f(j?1/U:U);S&&(U=i(S/u+2))}for(M?(T=new f(.5),j&&(E.s=1),z=ie(E)):(O=Math.abs(+ae(E)),z=O%2),Q=new f(ce);;){if(z){if(Q=Q.times(ue),!Q.c)break;U?Q.c.length>U&&(Q.c.length=U):L&&(Q=Q.mod(b))}if(O){if(O=n(O/2),O===0)break;z=O%2}else if(E=E.times(T),ee(E,E.e+1,1),E.e>14)z=ie(E);else{if(O=+ae(E),O===0)break;z=O%2}ue=ue.times(ue),U?ue.c&&ue.c.length>U&&(ue.c.length=U):L&&(ue=ue.mod(b))}return L?Q:(j&&(Q=ce.div(Q)),b?Q.mod(b):U?ee(Q,S,X,q):Q)},$.integerValue=function(E){var b=new f(this);return E==null?E=X:K(E,0,8),ee(b,b.e+1,E)},$.isEqualTo=$.eq=function(E,b){return H(this,new f(E,b))===0},$.isFinite=function(){return!!this.c},$.isGreaterThan=$.gt=function(E,b){return H(this,new f(E,b))>0},$.isGreaterThanOrEqualTo=$.gte=function(E,b){return(b=H(this,new f(E,b)))===1||b===0},$.isInteger=function(){return!!this.c&&x(this.e/u)>this.c.length-2},$.isLessThan=$.lt=function(E,b){return H(this,new f(E,b))<0},$.isLessThanOrEqualTo=$.lte=function(E,b){return(b=H(this,new f(E,b)))===-1||b===0},$.isNaN=function(){return!this.s},$.isNegative=function(){return this.s<0},$.isPositive=function(){return this.s>0},$.isZero=function(){return!!this.c&&this.c[0]==0},$.minus=function(E,b){var T,L,O,U,q=this,M=q.s;if(E=new f(E,b),b=E.s,!M||!b)return new f(NaN);if(M!=b)return E.s=-b,q.plus(E);var j=q.e/u,z=E.e/u,Q=q.c,ue=E.c;if(!j||!z){if(!Q||!ue)return Q?(E.s=-b,E):new f(ue?q:NaN);if(!Q[0]||!ue[0])return ue[0]?(E.s=-b,E):new f(Q[0]?q:X==3?-0:0)}if(j=x(j),z=x(z),Q=Q.slice(),M=j-z){for((U=M<0)?(M=-M,O=Q):(z=j,O=ue),O.reverse(),b=M;b--;O.push(0));O.reverse()}else for(L=(U=(M=Q.length)<(b=ue.length))?M:b,M=b=0;b0)for(;b--;Q[T++]=0);for(b=a-1;L>M;){if(Q[--L]=0;){for(T=0,he=De[O]%Se,de=De[O]/Se|0,q=j,U=O+q;U>O;)z=Ae[--q]%Se,Q=Ae[q]/Se|0,M=de*z+Q*he,z=he*z+M%Se*Se+Be[U]+T,T=(z/Ie|0)+(M/Se|0)+de*Q,Be[U--]=z%Ie;Be[U]=T}return T?++L:Be.splice(0,1),te(E,Be,L)},$.negated=function(){var E=new f(this);return E.s=-E.s||null,E},$.plus=function(E,b){var T,L=this,O=L.s;if(E=new f(E,b),b=E.s,!O||!b)return new f(NaN);if(O!=b)return E.s=-b,L.minus(E);var U=L.e/u,q=E.e/u,M=L.c,j=E.c;if(!U||!q){if(!M||!j)return new f(O/0);if(!M[0]||!j[0])return j[0]?E:new f(M[0]?L:O*0)}if(U=x(U),q=x(q),M=M.slice(),O=U-q){for(O>0?(q=U,T=j):(O=-O,T=M),T.reverse();O--;T.push(0));T.reverse()}for(O=M.length,b=j.length,O-b<0&&(T=j,j=M,M=T,b=O),O=0;b;)O=(M[--b]=M[b]+j[b]+O)/a|0,M[b]=a===M[b]?0:M[b]%a;return O&&(M=[O].concat(M),++q),te(E,M,q)},$.precision=$.sd=function(E,b){var T,L,O,U=this;if(E!=null&&E!==!!E)return K(E,1,B),b==null?b=X:K(b,0,8),ee(new f(U),E,b);if(!(T=U.c))return null;if(O=T.length-1,L=O*u+1,O=T[O]){for(;O%10==0;O/=10,L--);for(O=T[0];O>=10;O/=10,L++);}return E&&U.e+1>L&&(L=U.e+1),L},$.shiftedBy=function(E){return K(E,-h,h),this.times("1e"+E)},$.squareRoot=$.sqrt=function(){var E,b,T,L,O,U=this,q=U.c,M=U.s,j=U.e,z=Y+4,Q=new f("0.5");if(M!==1||!q||!q[0])return new f(!M||M<0&&(!q||q[0])?NaN:q?U:1/0);if(M=Math.sqrt(+ae(U)),M==0||M==1/0?(b=V(q),(b.length+j)%2==0&&(b+="0"),M=Math.sqrt(+b),j=x((j+1)/2)-(j<0||j%2),M==1/0?b="5e"+j:(b=M.toExponential(),b=b.slice(0,b.indexOf("e")+1)+j),T=new f(b)):T=new f(M+""),T.c[0]){for(j=T.e,M=j+z,M<3&&(M=0);;)if(O=T,T=Q.times(O.plus(G(U,O,z,1))),V(O.c).slice(0,M)===(b=V(T.c)).slice(0,M))if(T.e0&&Be>0){for(U=Be%M||M,Q=de.substr(0,U);U0&&(Q+=z+de.slice(U)),he&&(Q="-"+Q)}L=ue?Q+(T.decimalSeparator||"")+((j=+T.fractionGroupSize)?ue.replace(new RegExp("\\d{"+j+"}\\B","g"),"$&"+(T.fractionGroupSeparator||"")):ue):Q}return(T.prefix||"")+L+(T.suffix||"")},$.toFraction=function(E){var b,T,L,O,U,q,M,j,z,Q,ue,he,de=this,Be=de.c;if(E!=null&&(M=new f(E),!M.isInteger()&&(M.c||M.s!==1)||M.lt(ce)))throw Error(s+"Argument "+(M.isInteger()?"out of range: ":"not an integer: ")+ae(M));if(!Be)return new f(de);for(b=new f(ce),z=T=new f(ce),L=j=new f(ce),he=V(Be),U=b.e=he.length-de.e-1,b.c[0]=p[(q=U%u)<0?u+q:q],E=!E||M.comparedTo(b)>0?U>0?b:z:M,q=g,g=1/0,M=new f(he),j.c[0]=0;Q=G(M,b,0,1),O=T.plus(Q.times(L)),O.comparedTo(E)!=1;)T=L,L=O,z=j.plus(Q.times(O=z)),j=O,b=M.minus(Q.times(O=b)),M=O;return O=G(E.minus(T),L,0,1),j=j.plus(O.times(z)),T=T.plus(O.times(L)),j.s=z.s=de.s,U=U*2,ue=G(z,L,U,X).minus(de).abs().comparedTo(G(j,T,U,X).minus(de).abs())<1?[z,L]:[j,T],g=q,ue},$.toNumber=function(){return+ae(this)},$.toPrecision=function(E,b){return E!=null&&K(E,1,B),C(this,E,b,2)},$.toString=function(E){var b,T=this,L=T.s,O=T.e;return O===null?L?(b="Infinity",L<0&&(b="-"+b)):b="NaN":(E==null?b=O<=A||O>=c?k(V(T.c),O):J(V(T.c),O,"0"):E===10?(T=ee(new f(T),Y+O+1,X),b=J(V(T.c),T.e,"0")):(K(E,2,_.length,"Base"),b=P(J(V(T.c),O,"0"),10,E,L,!0)),L<0&&T.c[0]&&(b="-"+b)),b},$.valueOf=$.toJSON=function(){return ae(this)},$._isBigNumber=!0,W!=null&&f.set(W),f}function x(W){var G=W|0;return W>0||W===G?G:G-1}function V(W){for(var G,P,F=1,$=W.length,ce=W[0]+"";F<$;){for(G=W[F++]+"",P=u-G.length;P--;G="0"+G);ce+=G}for($=ce.length;ce.charCodeAt(--$)===48;);return ce.slice(0,$+1||1)}function H(W,G){var P,F,$=W.c,ce=G.c,Y=W.s,X=G.s,A=W.e,c=G.e;if(!Y||!X)return null;if(P=$&&!$[0],F=ce&&!ce[0],P||F)return P?F?0:-X:Y;if(Y!=X)return Y;if(P=Y<0,F=A==c,!$||!ce)return F?0:!$^P?1:-1;if(!F)return A>c^P?1:-1;for(X=(A=$.length)<(c=ce.length)?A:c,Y=0;Yce[Y]^P?1:-1;return A==c?0:A>c^P?1:-1}function K(W,G,P,F){if(WP||W!==n(W))throw Error(s+(F||"Argument")+(typeof W=="number"?WP?" out of range: ":" not an integer: ":" not a primitive number: ")+String(W))}function ie(W){var G=W.c.length-1;return x(W.e/u)==G&&W.c[G]%2!=0}function k(W,G){return(W.length>1?W.charAt(0)+"."+W.slice(1):W)+(G<0?"e":"e+")+G}function J(W,G,P){var F,$;if(G<0){for($=P+".";++G;$+=P);W=$+W}else if(F=W.length,++G>F){for($=P,G-=F;--G;$+=P);W+=$}else G{"use strict";l();Object.defineProperty(ge,"__esModule",{value:!0});ge.ErrGasLimitShouldBe0ForInnerTransaction=ge.ErrInvalidRelayedV2BuilderArguments=ge.ErrInvalidRelayedV1BuilderArguments=ge.ErrNotImplemented=ge.ErrContractInteraction=ge.ErrCodec=ge.ErrCannotParseContractResults=ge.ErrMissingFieldOnEnum=ge.ErrMissingFieldOnStruct=ge.ErrTypeInferenceSystemRequiresRegularJavascriptObjects=ge.ErrTypingSystem=ge.ErrMock=ge.ErrContractHasNoAddress=ge.ErrContract=ge.ErrExpectedTransactionEventsNotFound=ge.ErrExpectedTransactionStatusNotReached=ge.ErrTransactionWatcherTimeout=ge.ErrAsyncTimerAborted=ge.ErrAsyncTimerAlreadyRunning=ge.ErrInvalidFunctionName=ge.ErrSignatureCannotCreate=ge.ErrTransactionOptionsInvalid=ge.ErrTransactionVersionInvalid=ge.ErrNonceInvalid=ge.ErrNotEnoughGas=ge.ErrAddressEmpty=ge.ErrAddressBadHrp=ge.ErrAddressCannotCreate=ge.ErrUnexpectedCondition=ge.ErrInvariantFailed=ge.ErrBadType=ge.ErrUnsupportedOperation=ge.ErrInvalidArgument=ge.Err=void 0;var Me=class extends Error{constructor(e,t){super(e),this.inner=void 0,this.inner=t}summary(){let e=[];e.push({name:this.name,message:this.message});let t=this.inner;for(;t;)e.push({name:t.name,message:t.message}),t=t.inner;return e}};ge.Err=Me;var R0=class extends Me{constructor(e,t){super(`Invalid argument: ${e}`,t)}};ge.ErrInvalidArgument=R0;var F0=class extends Me{constructor(e,t="not specified"){super(`Operation "${e}" not supported. Reason: ${t}`)}};ge.ErrUnsupportedOperation=F0;var U0=class extends Me{constructor(e,t,i){super(`Bad type of "${e}": ${i}. Expected type: ${t}`)}};ge.ErrBadType=U0;var q0=class extends Me{constructor(e){super(`Invariant failed: [${e}]`)}};ge.ErrInvariantFailed=q0;var V0=class extends Me{constructor(e){super(`Unexpected condition: [${e}]`)}};ge.ErrUnexpectedCondition=V0;var H0=class extends Me{constructor(e,t){let i=`Cannot create address from: ${e}`;super(i,t)}};ge.ErrAddressCannotCreate=H0;var Q0=class extends Me{constructor(e,t){super(`Wrong address HRP. Expected: ${e}, got ${t}`)}};ge.ErrAddressBadHrp=Q0;var j0=class extends Me{constructor(){super("Address is empty")}};ge.ErrAddressEmpty=j0;var G0=class extends Me{constructor(e){super(`Not enough gas provided: ${e}`)}};ge.ErrNotEnoughGas=G0;var K0=class extends Me{constructor(e){super(`Invalid nonce: ${e}`)}};ge.ErrNonceInvalid=K0;var z0=class extends Me{constructor(e){super(`Invalid transaction version: ${e}`)}};ge.ErrTransactionVersionInvalid=z0;var $0=class extends Me{constructor(e){super(`Invalid transaction options: ${e}`)}};ge.ErrTransactionOptionsInvalid=$0;var k0=class extends Me{constructor(e,t){let i=`Cannot create signature from: ${e}`;super(i,t)}};ge.ErrSignatureCannotCreate=k0;var W0=class extends Me{constructor(){super("Invalid function name")}};ge.ErrInvalidFunctionName=W0;var Y0=class extends Me{constructor(){super("Async timer already running")}};ge.ErrAsyncTimerAlreadyRunning=Y0;var J0=class extends Me{constructor(){super("Async timer aborted")}};ge.ErrAsyncTimerAborted=J0;var X0=class extends Me{constructor(){super("TransactionWatcher has timed out")}};ge.ErrTransactionWatcherTimeout=X0;var Z0=class extends Me{constructor(){super("Expected transaction status not reached")}};ge.ErrExpectedTransactionStatusNotReached=Z0;var eg=class extends Me{constructor(){super("Expected transaction events not found")}};ge.ErrExpectedTransactionEventsNotFound=eg;var Wl=class extends Me{constructor(e){super(e)}};ge.ErrContract=Wl;var tg=class extends Wl{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). -`)}};ge.ErrContractHasNoAddress=tg;var rg=class extends Me{constructor(e){super(e)}};ge.ErrMock=rg;var Yl=class extends Me{constructor(e){super(e)}};ge.ErrTypingSystem=Yl;var ig=class extends Yl{constructor(e){super(` -argument at position ${e} seems to be a TypedValue. The automatic type inference system requires regular javascript objects as input. -This error might occur when you pass a TypedValue to contract.methods.myFunction([...]). For passing TypedValues instead of regular javascript objects, and bypass the automatic type inference system, use contract.methodsExplicit.myFunction([...]) instead. -Also see https://github.com/ElrondNetwork/elrond-sdk-erdjs/pull/187. -`)}};ge.ErrTypeInferenceSystemRequiresRegularJavascriptObjects=ig;var ng=class extends Me{constructor(e,t){super(`field ${e} does not exist on struct ${t}`)}};ge.ErrMissingFieldOnStruct=ng;var sg=class extends Me{constructor(e,t){super(`field ${e} does not exist on enum ${t}`)}};ge.ErrMissingFieldOnEnum=sg;var og=class extends Me{constructor(e){super(`cannot parse contract results: ${e}`)}};ge.ErrCannotParseContractResults=og;var ag=class extends Me{constructor(e){super(e)}};ge.ErrCodec=ag;var ug=class extends Me{constructor(e){super(e)}};ge.ErrContractInteraction=ug;var cg=class extends Me{constructor(){super("Method not yet implemented")}};ge.ErrNotImplemented=cg;var lg=class extends Me{constructor(){super("invalid arguments for relayed v1 builder")}};ge.ErrInvalidRelayedV1BuilderArguments=lg;var fg=class extends Me{constructor(){super("invalid arguments for relayed v2 builder")}};ge.ErrInvalidRelayedV2BuilderArguments=fg;var hg=class extends Me{constructor(){super("gas limit must be 0 for the inner transaction for relayed v2")}};ge.ErrGasLimitShouldBe0ForInnerTransaction=hg});var dg=D(Bo=>{"use strict";l();var BB=Bo&&Bo.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Bo,"__esModule",{value:!0});Bo.TokenPayment=void 0;var tc=BB(Vr()),MB=ke(),iA="EGLD",nA=18;tc.default.set({ROUNDING_MODE:1});var Vi=class{constructor(e,t,i,n){let s=new tc.default(i);if(!s.isInteger()||s.isNegative())throw new MB.ErrInvalidArgument(`bad amountAsBigInteger: ${i}`);this.tokenIdentifier=e,this.nonce=t,this.amountAsBigInteger=s,this.numDecimals=n}static egldFromAmount(e){let t=new tc.default(e).shiftedBy(nA).decimalPlaces(0);return this.egldFromBigInteger(t)}static egldFromBigInteger(e){return new Vi(iA,0,e,nA)}static fungibleFromAmount(e,t,i){let n=new tc.default(t).shiftedBy(i).decimalPlaces(0);return this.fungibleFromBigInteger(e,n,i)}static fungibleFromBigInteger(e,t,i=0){return new Vi(e,0,t,i)}static nonFungible(e,t){return new Vi(e,t,1,0)}static semiFungible(e,t,i){return new Vi(e,t,i,0)}static metaEsdtFromAmount(e,t,i,n){let s=new tc.default(i).shiftedBy(n).decimalPlaces(0);return this.metaEsdtFromBigInteger(e,t,s,n)}static metaEsdtFromBigInteger(e,t,i,n=0){return new Vi(e,t,i,n)}toString(){return this.amountAsBigInteger.toFixed(0)}valueOf(){return this.amountAsBigInteger}toPrettyString(){return`${this.toRationalNumber()} ${this.tokenIdentifier}`}toRationalNumber(){return this.amountAsBigInteger.shiftedBy(-this.numDecimals).toFixed(this.numDecimals)}isEgld(){return this.tokenIdentifier==iA}isFungible(){return this.nonce==0}};Bo.TokenPayment=Vi});var ef=D((Cz,aA)=>{"use strict";l();var Xl="qpzry9x8gf2tvdw0s3jn54khce6mua7l",pg={};for(rc=0;rc>25;return(r&33554431)<<5^-(e>>0&1)&996825010^-(e>>1&1)&642813549^-(e>>2&1)&513874426^-(e>>3&1)&1027748829^-(e>>4&1)&705979059}function sA(r){for(var e=1,t=0;t126)return"Invalid prefix ("+r+")";e=Mo(e)^i>>5}for(e=Mo(e),t=0;tt)throw new TypeError("Exceeds length limit");r=r.toLowerCase();var i=sA(r);if(typeof i=="string")throw new Error(i);for(var n=r+"1",s=0;s>5!==0)throw new Error("Non 5-bit word");i=Mo(i)^o,n+=Xl.charAt(o)}for(s=0;s<6;++s)i=Mo(i);for(i^=1,s=0;s<6;++s){var a=i>>(5-s)*5&31;n+=Xl.charAt(a)}return n}function oA(r,e){if(e=e||90,r.length<8)return r+" too short";if(r.length>e)return"Exceeds length limit";var t=r.toLowerCase(),i=r.toUpperCase();if(r!==t&&r!==i)return"Mixed-case string "+r;r=t;var n=r.lastIndexOf("1");if(n===-1)return"No separator character for "+r;if(n===0)return"Missing prefix for "+r;var s=r.slice(0,n),o=r.slice(n+1);if(o.length<6)return"Data too short";var a=sA(s);if(typeof a=="string")return a;for(var u=[],h=0;h=o.length)&&u.push(v)}return a!==1?"Invalid checksum for "+r:{prefix:s,words:u}}function LB(){var r=oA.apply(null,arguments);if(typeof r=="object")return r}function RB(r){var e=oA.apply(null,arguments);if(typeof e=="object")return e;throw new Error(e)}function Zl(r,e,t,i){for(var n=0,s=0,o=(1<=t;)s-=t,a.push(n>>s&o);if(i)s>0&&a.push(n<=e)return"Excess padding";if(n<{"use strict";l();var HB=oi&&oi.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),QB=oi&&oi.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),uA=oi&&oi.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&HB(e,r,t);return QB(e,r),e};Object.defineProperty(oi,"__esModule",{value:!0});oi.Address=void 0;var tf=uA(ef()),Po=uA(ke()),gg="erd",yg=32,jB="0".repeat(16),Ht=class{constructor(e){if(this.valueHex="",!!e){if(e instanceof Ht)return Ht.fromAddress(e);if(e instanceof y.Buffer)return Ht.fromBuffer(e);if(typeof e=="string")return Ht.fromString(e);throw new Po.ErrAddressCannotCreate(e)}}static fromAddress(e){return Ht.fromValidHex(e.valueHex)}static fromValidHex(e){let t=new Ht;return t.valueHex=e,t}static fromBuffer(e){if(e.length!=yg)throw new Po.ErrAddressCannotCreate(e);return Ht.fromValidHex(e.toString("hex"))}static fromString(e){return Ht.isValidHex(e)?Ht.fromValidHex(e):Ht.fromBech32(e)}static isValidHex(e){return y.Buffer.from(e,"hex").length==yg}static fromHex(e){if(!Ht.isValidHex(e))throw new Po.ErrAddressCannotCreate(e);return Ht.fromValidHex(e)}static fromBech32(e){let t;try{t=tf.decode(e)}catch(s){throw new Po.ErrAddressCannotCreate(e,s)}let i=t.prefix;if(i!=gg)throw new Po.ErrAddressBadHrp(gg,i);let n=y.Buffer.from(tf.fromWords(t.words));if(n.length!=yg)throw new Po.ErrAddressCannotCreate(e);return Ht.fromValidHex(n.toString("hex"))}hex(){return this.isEmpty()?"":this.valueHex}bech32(){if(this.isEmpty())return"";let e=tf.toWords(this.pubkey());return tf.encode(gg,e)}pubkey(){return this.isEmpty()?y.Buffer.from([]):y.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 Ht("0".repeat(64))}isContractAddress(){return this.hex().startsWith(jB)}};oi.Address=Ht});var xr=D(Ze=>{"use strict";l();var GB=Ze&&Ze.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),KB=Ze&&Ze.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),zB=Ze&&Ze.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&GB(e,r,t);return KB(e,r),e};Object.defineProperty(Ze,"__esModule",{value:!0});Ze.isEmpty=Ze.guardEmpty=Ze.guardNotEmpty=Ze.guardLength=Ze.guardSameLength=Ze.guardValueIsSetWithMessage=Ze.guardValueIsSet=Ze.guardTrue=void 0;var Lo=zB(ke());function $B(r,e){if(!r)throw new Lo.ErrInvariantFailed(`[<${e}>] isn't true`)}Ze.guardTrue=$B;function kB(r,e){cA(`${r} isn't set (null or undefined)`,e)}Ze.guardValueIsSet=kB;function cA(r,e){if(e==null||e===void 0)throw new Lo.ErrInvariantFailed(r)}Ze.guardValueIsSetWithMessage=cA;function WB(r,e){if(r=r||[],e=e||[],r.length!=e.length)throw new Lo.ErrInvariantFailed("arrays do not have the same length")}Ze.guardSameLength=WB;function YB(r,e){let t=r.length||0;if(t!=e)throw new Lo.ErrInvariantFailed(`wrong length, expected: ${e}, actual: ${t}`)}Ze.guardLength=YB;function JB(r,e){if(mg(r))throw new Lo.ErrInvariantFailed(`${e} is empty`)}Ze.guardNotEmpty=JB;function XB(r,e){if(!mg(r))throw new Lo.ErrInvariantFailed(`${e} is not empty`)}Ze.guardEmpty=XB;function mg(r){return r.isEmpty?r.isEmpty():r.length===0}Ze.isEmpty=mg});var lA=D(rf=>{"use strict";l();Object.defineProperty(rf,"__esModule",{value:!0});rf.getJavascriptPrototypesInHierarchy=void 0;function ZB(r,e){let t=[],i=Object.getPrototypeOf(r);for(;i&&e(i);)t.push(i),i=Object.getPrototypeOf(i);return t}rf.getJavascriptPrototypesInHierarchy=ZB});var Dt=D(Nt=>{"use strict";l();Object.defineProperty(Nt,"__esModule",{value:!0});Nt.NullType=Nt.TypePlaceholder=Nt.isTyped=Nt.PrimitiveValue=Nt.TypedValue=Nt.CustomType=Nt.PrimitiveType=Nt.TypeCardinality=Nt.Type=void 0;var vg=lA(),fA=xr(),Ir=class{constructor(e,t=[],i=Hi.fixed(1)){fA.guardValueIsSet("name",e),this.name=e,this.typeParameters=t,this.cardinality=i}getName(){return this.name}getClassName(){return Ir.ClassName}getClassHierarchy(){return vg.getJavascriptPrototypesInHierarchy(this,i=>i.belongsToTypesystem).map(i=>i.getClassName()).reverse()}getFullyQualifiedName(){let e=this.getTypeParameters().map(t=>t.getFullyQualifiedName()).join(", ");return this.isGenericType()?`erdjs:types:${this.getName()}<${e}>`:`erdjs: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 fA.guardTrue(this.typeParameters.length>0,"type parameters length > 0"),this.typeParameters[0]}toString(){let e=this.getTypeParameters().map(i=>i.toString()).join(", "),t=e?`<${e}>`:"";return`${this.name}${t}`}equals(e){return Ir.equals(this,e)}static equals(e,t){return e.getFullyQualifiedName()==t.getFullyQualifiedName()}static equalsMany(e,t){return e.every((i,n)=>i.equals(t[n]))}static isAssignableFromMany(e,t){return e.every((i,n)=>i.isAssignableFrom(t[n]))}differs(e){return!this.equals(e)}valueOf(){return this.name}isAssignableFrom(e){if(!Ir.equalsMany(this.getTypeParameters(),e.getTypeParameters()))return!1;let i=this.getFullyQualifiedName();return Ir.getFullyQualifiedNamesInHierarchy(e).includes(i)?!0:e.hasClassOrSuperclass(this.getClassName())}static getFullyQualifiedNamesInHierarchy(e){return vg.getJavascriptPrototypesInHierarchy(e,n=>n.belongsToTypesystem).map(n=>n.getFullyQualifiedName.call(e))}getNamesOfDependencies(){let e=[];for(let t of this.typeParameters)e.push(t.getName()),e.push(...t.getNamesOfDependencies());return[...new Set(e)]}toJSON(){return{name:this.name,typeParameters:this.typeParameters.map(e=>e.toJSON())}}getCardinality(){return this.cardinality}belongsToTypesystem(){}};Nt.Type=Ir;Ir.ClassName="Type";var Hi=class{constructor(e,t){this.lowerBound=e,this.upperBound=t}static fixed(e){return new Hi(e,e)}static variable(e){return new Hi(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||Hi.MaxCardinality}};Nt.TypeCardinality=Hi;Hi.MaxCardinality=4096;var Ro=class extends Ir{constructor(e){super(e)}getClassName(){return Ro.ClassName}};Nt.PrimitiveType=Ro;Ro.ClassName="PrimitiveType";var Fo=class extends Ir{getClassName(){return Fo.ClassName}};Nt.CustomType=Fo;Fo.ClassName="CustomType";var vs=class{constructor(e){this.type=e}getClassName(){return vs.ClassName}getClassHierarchy(){return vg.getJavascriptPrototypesInHierarchy(this,i=>i.belongsToTypesystem).map(i=>i.getClassName()).reverse()}getType(){return this.type}hasExactClass(e){return this.getClassName()==e}hasClassOrSuperclass(e){return this.getClassHierarchy().includes(e)}belongsToTypesystem(){}};Nt.TypedValue=vs;vs.ClassName="TypedValue";var Uo=class extends vs{constructor(e){super(e)}getClassName(){return Uo.ClassName}};Nt.PrimitiveValue=Uo;Uo.ClassName="PrimitiveValue";function eM(r){return r.belongsToTypesystem!==void 0}Nt.isTyped=eM;var qo=class extends Ir{constructor(){super("...")}getClassName(){return qo.ClassName}};Nt.TypePlaceholder=qo;qo.ClassName="TypePlaceholder";var Vo=class extends Ir{constructor(){super("?")}getClassName(){return Vo.ClassName}};Nt.NullType=Vo;Vo.ClassName="NullType"});var hA=D((Ho,Qo)=>{l();(function(r){var e=typeof Ho=="object"&&Ho&&!Ho.nodeType&&Ho,t=typeof Qo=="object"&&Qo&&!Qo.nodeType&&Qo,i=typeof global=="object"&&global;(i.global===i||i.window===i||i.self===i)&&(r=i);var n,s=2147483647,o=36,a=1,u=26,h=38,p=700,v=72,B=128,R="-",x=/^xn--/,V=/[^\x20-\x7E]/,H=/[\x2E\u3002\uFF0E\uFF61]/g,K={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},ie=o-a,k=Math.floor,J=String.fromCharCode,W;function G(w){throw new RangeError(K[w])}function P(w,S){for(var N=w.length,_=[];N--;)_[N]=S(w[N]);return _}function F(w,S){var N=w.split("@"),_="";N.length>1&&(_=N[0]+"@",w=N[1]),w=w.replace(H,".");var f=w.split("."),C=P(f,S).join(".");return _+C}function $(w){for(var S=[],N=0,_=w.length,f,C;N<_;)f=w.charCodeAt(N++),f>=55296&&f<=56319&&N<_?(C=w.charCodeAt(N++),(C&64512)==56320?S.push(((f&1023)<<10)+(C&1023)+65536):(S.push(f),N--)):S.push(f);return S}function ce(w){return P(w,function(S){var N="";return S>65535&&(S-=65536,N+=J(S>>>10&1023|55296),S=56320|S&1023),N+=J(S),N}).join("")}function Y(w){return w-48<10?w-22:w-65<26?w-65:w-97<26?w-97:o}function X(w,S){return w+22+75*(w<26)-((S!=0)<<5)}function A(w,S,N){var _=0;for(w=N?k(w/p):w>>1,w+=k(w/S);w>ie*u>>1;_+=o)w=k(w/ie);return k(_+(ie+1)*w/(w+h))}function c(w){var S=[],N=w.length,_,f=0,C=B,Z=v,te,ee,ae,E,b,T,L,O,U;for(te=w.lastIndexOf(R),te<0&&(te=0),ee=0;ee=128&&G("not-basic"),S.push(w.charCodeAt(ee));for(ae=te>0?te+1:0;ae=N&&G("invalid-input"),L=Y(w.charCodeAt(ae++)),(L>=o||L>k((s-f)/b))&&G("overflow"),f+=L*b,O=T<=Z?a:T>=Z+u?u:T-Z,!(Lk(s/U)&&G("overflow"),b*=U;_=S.length+1,Z=A(f-E,_,E==0),k(f/_)>s-C&&G("overflow"),C+=k(f/_),f%=_,S.splice(f++,0,C)}return ce(S)}function d(w){var S,N,_,f,C,Z,te,ee,ae,E,b,T=[],L,O,U,q;for(w=$(w),L=w.length,S=B,N=0,C=v,Z=0;Z=S&&bk((s-N)/O)&&G("overflow"),N+=(te-S)*O,S=te,Z=0;Zs&&G("overflow"),b==S){for(ee=N,ae=o;E=ae<=C?a:ae>=C+u?u:ae-C,!(ee{"use strict";l();var pA=hA();function tM(r,e){this.__proto__=new Error(e),this.__proto__.name="BackslashError",this.offset=r}function wg(r){return r>="0"&&r<="7"}function rM(r){return r>="0"&&r<="9"||r>="a"&&r<="f"||r>="A"&&r<="F"}function dA(r){return r=parseInt(r,16),pA.ucs2.encode([r])}function gA(r,e,t){var i=!1,n=[];function s(u){var h=r[u];if(!rM(h))throw new tM(u,"Unexpected token ILLEGAL");return h}for(;e{l();var wA=yA();_A.exports={validate:iM,parse:nM};function iM(r,e){var t;if(e=e||!1,typeof r!="string")t="Input must be a string";else try{nf(r,0,e,!1)}catch(i){t=i.message}return t}function nM(r,e){if(typeof r!="string")throw new Error("Input must be a string");e=e||!1;var t=nf(r,0,e,!0);return t.value}function EA(r,e){for(var t=r.length,i=e,n,s=e;s-1&&r[t]==="\\";)i++,t--;return i%2===0}function uM(r,e,t,i){for(var n=e,s=",",o=[],a=e;ws(r[a]);)a++;if(r[a]==="]")return{start:e,end:a,value:o};for(;s===",";){var u=nf(r,n,t,i),h=EA(r,u.end);i&&o.push(u.value),n=h.end,s=h.value}return{start:e,end:n,value:o}}function cM(r,e){return r.substr(e,4)==="true"}function lM(r,e){return r.substr(e,5)==="false"}function fM(r,e){return r.substr(e,4)==="null"}var hM=new RegExp(/^\s$/);function ws(r){return hM.test(r)}var dM=new RegExp(/^\d$/);function mA(r){return dM.test(r)}function Qi(r,e,t){var i=10,n;r.length{"use strict";l();var pM=ai&&ai.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),gM=ai&&ai.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),yM=ai&&ai.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&pM(e,r,t);return gM(e,r),e};Object.defineProperty(ai,"__esModule",{value:!0});ai.TypeExpressionParser=void 0;var bA=yM(ke()),mM=Dt(),vM=IA(),Ag=class{parse(e){let t=this.doParse(e),i=Object.keys(t);if(i.length!=1)throw new bA.ErrTypingSystem(`bad type expression: ${e}`);let n=i[0];return this.nodeToType(n,t[n])}doParse(e){let t=this.getJsonedString(e);try{return vM.parse(t)}catch{throw new bA.ErrTypingSystem(`cannot parse type expression: ${e}. internal json: ${t}.`)}}getJsonedString(e){let t="";for(var i=0;i"?a!=">"?t+=": {} }":t+="}":o==","?u==">"||(a==">"?t+=",":t+=": {},"):t+=o}let n=/(:|\{|\}|,|\s)/,s=t.replace(/utf\-8\sstring/ig,"utf-8-string").split(n).filter(o=>o);return t=s.map(o=>n.test(o)?o:`"${o}"`).map(o=>o.replace(/utf\-8\-string/ig,"utf-8 string")).join(""),s.length==1?`{${t}: {}}`:`{${t}}`}nodeToType(e,t){e.charAt(e.length-1)==="1"&&(e=e.slice(0,-1));let i=Object.keys(t).map(n=>this.nodeToType(n,t[n]));return new mM.Type(e,i)}};ai.TypeExpressionParser=Ag});var jo=D(dr=>{"use strict";l();var wM=dr&&dr.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),EM=dr&&dr.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),AM=dr&&dr.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&wM(e,r,t);return EM(e,r),e};Object.defineProperty(dr,"__esModule",{value:!0});dr.Fields=dr.Field=dr.FieldDefinition=void 0;var _g=AM(ke()),_M=sf(),ic=class{constructor(e,t,i){this.name=e,this.description=t,this.type=i}static fromJSON(e){let t=new _M.TypeExpressionParser().parse(e.type);return new ic(e.name,e.description,t)}};dr.FieldDefinition=ic;var Ig=class{constructor(e,t=""){this.value=e,this.name=t}checkTyping(e){let t=this.value.getType();if(!t.equals(e.type))throw new _g.ErrTypingSystem(`check type of field "${e.name}; expected: ${e.type}, actual: ${t}"`);if(this.name!=e.name)throw new _g.ErrTypingSystem(`check name of field "${e.name}"`)}equals(e){return this.name==e.name&&this.value.equals(e.value)}};dr.Field=Ig;var bg=class{static checkTyping(e,t){if(e.length!=t.length)throw new _g.ErrTypingSystem("fields length vs. field definitions length");for(let i=0;i{"use strict";l();Object.defineProperty(Ko,"__esModule",{value:!0});Ko.Struct=Ko.StructType=void 0;var IM=ke(),of=jo(),CA=Dt(),Es=class extends CA.CustomType{constructor(e,t){super(e),this.fieldsDefinitions=[],this.fieldsDefinitions=t}getClassName(){return Es.ClassName}static fromJSON(e){let t=(e.fields||[]).map(i=>of.FieldDefinition.fromJSON(i));return new Es(e.name,t)}getFieldsDefinitions(){return this.fieldsDefinitions}getFieldDefinition(e){return this.fieldsDefinitions.find(t=>t.name==e)}getNamesOfDependencies(){return of.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};Ko.StructType=Es;Es.ClassName="StructType";var Go=class extends CA.TypedValue{constructor(e,t){super(e),this.fields=t,this.fieldsByName=new Map(t.map(i=>[i.name,i])),this.checkTyping()}getClassName(){return Go.ClassName}checkTyping(){let t=this.getType().getFieldsDefinitions();of.Fields.checkTyping(this.fields,t)}getFields(){return this.fields}getFieldValue(e){let t=this.fieldsByName.get(e);if(t)return t.value.valueOf();throw new IM.ErrMissingFieldOnStruct(e,this.getType().getName())}valueOf(){let e={};for(let t of this.fields)e[t.name]=t.value.valueOf();return e}equals(e){if(!this.getType().equals(e.getType()))return!1;let t=this.getFields(),i=e.getFields();return of.Fields.equals(t,i)}};Ko.Struct=Go;Go.ClassName="Struct"});var uf=D(dn=>{"use strict";l();Object.defineProperty(dn,"__esModule",{value:!0});dn.EndpointParameterDefinition=dn.EndpointModifiers=dn.EndpointDefinition=void 0;var bM=sf(),SA="?",CM="N / A",nc=class{constructor(e,t,i,n){this.input=[],this.output=[],this.name=e,this.input=t||[],this.output=i||[],this.modifiers=n}isConstructor(){return this.name=="constructor"}static fromJSON(e){e.name=e.name==null?SA:e.name,e.payableInTokens=e.payableInTokens||[],e.inputs=e.inputs||[],e.outputs=e.outputs||[];let t=e.inputs.map(s=>_s.fromJSON(s)),i=e.outputs.map(s=>_s.fromJSON(s)),n=new af(e.mutability,e.payableInTokens);return new nc(e.name,t,i,n)}};dn.EndpointDefinition=nc;var af=class{constructor(e,t){this.mutability=e||"",this.payableInTokens=t||[]}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"}};dn.EndpointModifiers=af;var _s=class{constructor(e,t,i){this.name=e,this.description=t,this.type=i}static fromJSON(e){let t=new bM.TypeExpressionParser().parse(e.type);return new _s(e.name||SA,e.description||CM,t)}};dn.EndpointParameterDefinition=_s});var Cg=D(cf=>{"use strict";l();Object.defineProperty(cf,"__esModule",{value:!0});cf.ContractInterface=void 0;var SM=xr(),xA=uf(),xM="?",sc=class{constructor(e,t,i){this.endpoints=[],this.name=e,this.constructorDefinition=t,this.endpoints=i}static fromJSON(e){e.name=e.name||xM,e.endpoints=e.endpoints||[];let t=TM(e),i=e.endpoints.map(n=>xA.EndpointDefinition.fromJSON(n));return new sc(e.name,t,i)}getConstructorDefinition(){return this.constructorDefinition}getEndpoint(e){let t=this.endpoints.find(i=>i.name==e);return SM.guardValueIsSetWithMessage(`endpoint [${e}] not found`,t),t}};cf.ContractInterface=sc;function TM(r){if(r.constructor.inputs===void 0||r.constructor.outputs===void 0)return null;let e=Object.assign({name:"constructor"},r.constructor);return xA.EndpointDefinition.fromJSON(e)}});var oc=D(gn=>{"use strict";l();Object.defineProperty(gn,"__esModule",{value:!0});gn.EnumValue=gn.EnumVariantDefinition=gn.EnumType=void 0;var NM=ke(),Sg=xr(),lf=jo(),NA=Dt(),TA=256,Is=class extends NA.CustomType{constructor(e,t){super(e),this.variants=[],this.variants=t}getClassName(){return Is.ClassName}static fromJSON(e){let t=(e.variants||[]).map(i=>zo.fromJSON(i));return new Is(e.name,t)}getVariantByDiscriminant(e){let t=this.variants.find(i=>i.discriminant==e);return Sg.guardValueIsSet(`variant by discriminant (${e})`,t),t}getVariantByName(e){let t=this.variants.find(i=>i.name==e);return Sg.guardValueIsSet(`variant by name (${e})`,t),t}getNamesOfDependencies(){let e=[];for(let t of this.variants)e.push(...t.getNamesOfDependencies());return[...new Set(e)]}};gn.EnumType=Is;Is.ClassName="EnumType";var zo=class{constructor(e,t,i=[]){this.fieldsDefinitions=[],Sg.guardTrue(tlf.FieldDefinition.fromJSON(i));return new zo(e.name,e.discriminant,t)}getFieldsDefinitions(){return this.fieldsDefinitions}getFieldDefinition(e){return this.fieldsDefinitions.find(t=>t.name==e)}getNamesOfDependencies(){return lf.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};gn.EnumVariantDefinition=zo;var pn=class extends NA.TypedValue{constructor(e,t,i){super(e),this.fields=[],this.name=t.name,this.discriminant=t.discriminant,this.fields=i,this.fieldsByName=new Map(i.map(s=>[s.name,s]));let n=t.getFieldsDefinitions();lf.Fields.checkTyping(this.fields,n)}getClassName(){return pn.ClassName}static fromName(e,t){let i=e.getVariantByName(t);return new pn(e,i,[])}static fromDiscriminant(e,t){let i=e.getVariantByDiscriminant(t);return new pn(e,i,[])}equals(e){if(!this.getType().equals(e.getType()))return!1;let t=this.getFields(),i=e.getFields(),n=this.name==e.name,s=this.discriminant==e.discriminant,o=lf.Fields.equals(t,i);return n&&s&&o}getFields(){return this.fields}getFieldValue(e){let t=this.fieldsByName.get(e);if(t)return t.value.valueOf();throw new NM.ErrMissingFieldOnEnum(e,this.getType().getName())}valueOf(){let e={name:this.name,fields:[]};return this.fields.forEach(t=>e.fields[t.name]=t.value.valueOf()),e}};gn.EnumValue=pn;pn.ClassName="EnumValue"});var Wo=D(ko=>{"use strict";l();Object.defineProperty(ko,"__esModule",{value:!0});ko.AddressValue=ko.AddressType=void 0;var DM=Hr(),DA=Dt(),bs=class extends DA.PrimitiveType{constructor(){super("Address")}getClassName(){return bs.ClassName}};ko.AddressType=bs;bs.ClassName="AddressType";var $o=class extends DA.PrimitiveValue{constructor(e){super(new bs),this.value=new DM.Address(e.bech32())}getClassName(){return $o.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};ko.AddressValue=$o;$o.ClassName="AddressValue"});var ac=D(Jo=>{"use strict";l();Object.defineProperty(Jo,"__esModule",{value:!0});Jo.BooleanValue=Jo.BooleanType=void 0;var OA=Dt(),Cs=class extends OA.PrimitiveType{constructor(){super("bool")}getClassName(){return Cs.ClassName}};Jo.BooleanType=Cs;Cs.ClassName="BooleanType";var Yo=class extends OA.PrimitiveValue{constructor(e){super(new Cs),this.value=e}getClassName(){return Yo.ClassName}equals(e){return this.value===e.value}isTrue(){return this.value===!0}isFalse(){return!this.isTrue()}valueOf(){return this.value}};Jo.BooleanValue=Yo;Yo.ClassName="BooleanValue"});var mn=D(Xo=>{"use strict";l();Object.defineProperty(Xo,"__esModule",{value:!0});Xo.BytesValue=Xo.BytesType=void 0;var BA=Dt(),Ss=class extends BA.PrimitiveType{constructor(){super("bytes")}getClassName(){return Ss.ClassName}};Xo.BytesType=Ss;Ss.ClassName="BytesType";var yn=class extends BA.PrimitiveValue{constructor(e){super(new Ss),this.value=e}getClassName(){return yn.ClassName}static fromUTF8(e){let t=y.Buffer.from(e,"utf-8");return new yn(t)}static fromHex(e){let t=y.Buffer.from(e,"hex");return new yn(t)}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()}};Xo.BytesValue=yn;yn.ClassName="BytesValue"});var ff=D(Zo=>{"use strict";l();Object.defineProperty(Zo,"__esModule",{value:!0});Zo.CompositeValue=Zo.CompositeType=void 0;var OM=xr(),xg=Dt(),xs=class extends xg.Type{constructor(...e){super("Composite",e,xg.TypeCardinality.variable(e.length))}getClassName(){return xs.ClassName}};Zo.CompositeType=xs;xs.ClassName="CompositeType";var Ts=class extends xg.TypedValue{constructor(e,t){super(e),OM.guardLength(t,e.getTypeParameters().length),this.items=t}getClassName(){return Ts.ClassName}static fromItems(...e){let t=e.map(n=>n.getType()),i=new xs(...t);return new Ts(i,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 t=0;t{"use strict";l();Object.defineProperty(hf,"__esModule",{value:!0});hf.CollectionOfTypedValues=void 0;var Tg=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 t=0;t{"use strict";l();Object.defineProperty(ui,"__esModule",{value:!0});ui.List=ui.OptionValue=ui.ListType=ui.OptionType=void 0;var BM=xr(),MM=Ng(),Ns=Dt(),ci=class extends Ns.Type{constructor(e){super("Option",[e])}getClassName(){return ci.ClassName}isAssignableFrom(e){if(!e.hasExactClass(ci.ClassName))return!1;let t=this.getFirstTypeParameter().equals(e.getFirstTypeParameter()),i=e.getFirstTypeParameter().hasExactClass(Ns.NullType.ClassName);return t||i}};ui.OptionType=ci;ci.ClassName="OptionType";var Ds=class extends Ns.Type{constructor(e){super("List",[e])}getClassName(){return Ds.ClassName}};ui.ListType=Ds;Ds.ClassName="ListType";var ji=class extends Ns.TypedValue{constructor(e,t=null){super(e),this.value=t}getClassName(){return ji.ClassName}static newMissing(){let e=new ci(new Ns.NullType);return new ji(e)}static newMissingTyped(e){return new ji(new ci(e))}static newProvided(e){let t=new ci(e.getType());return new ji(t,e)}isSet(){return!!this.value}getTypedValue(){return BM.guardValueIsSet("value",this.value),this.value}valueOf(){return this.value?this.value.valueOf():null}equals(e){var t;return((t=this.value)===null||t===void 0?void 0:t.equals(e.value))||!1}};ui.OptionValue=ji;ji.ClassName="OptionValue";var vn=class extends Ns.TypedValue{constructor(e,t){super(e),this.backingCollection=new MM.CollectionOfTypedValues(t)}getClassName(){return vn.ClassName}static fromItems(e){if(e.length==0)return new vn(new Ns.TypePlaceholder,[]);let t=e[0].getType(),i=new Ds(t);return new vn(i,e)}getLength(){return this.backingCollection.getLength()}getItems(){return this.backingCollection.getItems()}valueOf(){return this.backingCollection.valueOf()}equals(e){return this.backingCollection.equals(e.backingCollection)}};ui.List=vn;vn.ClassName="List"});var cc=D(ta=>{"use strict";l();Object.defineProperty(ta,"__esModule",{value:!0});ta.H256Value=ta.H256Type=void 0;var MA=Dt(),Os=class extends MA.PrimitiveType{constructor(){super("H256")}getClassName(){return Os.ClassName}};ta.H256Type=Os;Os.ClassName="H256Type";var ea=class extends MA.PrimitiveValue{constructor(e){super(new Os),this.value=e}getClassName(){return ea.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};ta.H256Value=ea;ea.ClassName="H256Value"});var lc=D(Ee=>{"use strict";l();var PM=Ee&&Ee.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),LM=Ee&&Ee.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),RM=Ee&&Ee.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&PM(e,r,t);return LM(e,r),e},FM=Ee&&Ee.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ee,"__esModule",{value:!0});Ee.BigIntValue=Ee.BigUIntValue=Ee.I64Value=Ee.U64Value=Ee.I32Value=Ee.U32Value=Ee.I16Value=Ee.U16Value=Ee.I8Value=Ee.U8Value=Ee.NumericalValue=Ee.BigIntType=Ee.BigUIntType=Ee.I64Type=Ee.U64Type=Ee.I32Type=Ee.U32Type=Ee.I16Type=Ee.U16Type=Ee.I8Type=Ee.U8Type=Ee.NumericalType=void 0;var PA=RM(ke()),LA=Dt(),Qs=FM(Vr()),er=class extends LA.PrimitiveType{constructor(e,t,i){super(e),this.sizeInBytes=t,this.withSign=i}getClassName(){return er.ClassName}hasFixedSize(){return!!this.sizeInBytes}hasArbitrarySize(){return!this.hasFixedSize()}};Ee.NumericalType=er;er.ClassName="NumericalType";var Bs=class extends er{constructor(){super("u8",1,!1)}getClassName(){return Bs.ClassName}};Ee.U8Type=Bs;Bs.ClassName="U8Type";var Ms=class extends er{constructor(){super("i8",1,!0)}getClassName(){return Ms.ClassName}};Ee.I8Type=Ms;Ms.ClassName="I8Type";var Ps=class extends er{constructor(){super("u16",2,!1)}getClassName(){return Ps.ClassName}};Ee.U16Type=Ps;Ps.ClassName="U16Type";var Ls=class extends er{constructor(){super("i16",2,!0)}getClassName(){return Ls.ClassName}};Ee.I16Type=Ls;Ls.ClassName="I16Type";var Rs=class extends er{constructor(){super("u32",4,!1)}getClassName(){return Rs.ClassName}};Ee.U32Type=Rs;Rs.ClassName="U32Type";var Fs=class extends er{constructor(){super("i32",4,!0)}getClassName(){return Fs.ClassName}};Ee.I32Type=Fs;Fs.ClassName="I32Type";var Us=class extends er{constructor(){super("u64",8,!1)}getClassName(){return Us.ClassName}};Ee.U64Type=Us;Us.ClassName="U64Type";var qs=class extends er{constructor(){super("i64",8,!0)}getClassName(){return qs.ClassName}};Ee.I64Type=qs;qs.ClassName="I64Type";var Vs=class extends er{constructor(){super("BigUint",0,!1)}getClassName(){return Vs.ClassName}};Ee.BigUIntType=Vs;Vs.ClassName="BigUIntType";var Hs=class extends er{constructor(){super("Bigint",0,!0)}getClassName(){return Hs.ClassName}};Ee.BigIntType=Hs;Hs.ClassName="BigIntType";var tr=class extends LA.PrimitiveValue{constructor(e,t){if(super(e),this.value=new Qs.default(t),this.sizeInBytes=e.sizeInBytes,this.withSign=e.withSign,this.value.isNaN())throw new PA.ErrInvalidArgument(`not a number: ${t}`);if(!this.withSign&&this.value.isNegative())throw new PA.ErrInvalidArgument(`negative, but type is unsigned: ${t}`)}getClassName(){return tr.ClassName}equals(e){return this.value.isEqualTo(e.value)}valueOf(){return this.value}toString(){return this.value.toString()}};Ee.NumericalValue=tr;tr.ClassName="NumericalValue";var ra=class extends tr{constructor(e){super(new Bs,new Qs.default(e))}getClassName(){return ra.ClassName}};Ee.U8Value=ra;ra.ClassName="U8Value";var ia=class extends tr{constructor(e){super(new Ms,new Qs.default(e))}getClassName(){return ia.ClassName}};Ee.I8Value=ia;ia.ClassName="I8Value";var na=class extends tr{constructor(e){super(new Ps,new Qs.default(e))}getClassName(){return na.ClassName}};Ee.U16Value=na;na.ClassName="U16Value";var sa=class extends tr{constructor(e){super(new Ls,new Qs.default(e))}getClassName(){return sa.ClassName}};Ee.I16Value=sa;sa.ClassName="I16Value";var oa=class extends tr{constructor(e){super(new Rs,new Qs.default(e))}getClassName(){return oa.ClassName}};Ee.U32Value=oa;oa.ClassName="U32Value";var aa=class extends tr{constructor(e){super(new Fs,new Qs.default(e))}getClassName(){return aa.ClassName}};Ee.I32Value=aa;aa.ClassName="I32Value";var ua=class extends tr{constructor(e){super(new Us,e)}getClassName(){return ua.ClassName}};Ee.U64Value=ua;ua.ClassName="U64Value";var ca=class extends tr{constructor(e){super(new qs,e)}getClassName(){return ca.ClassName}};Ee.I64Value=ca;ca.ClassName="I64Value";var la=class extends tr{constructor(e){super(new Vs,e)}getClassName(){return la.ClassName}};Ee.BigUIntValue=la;la.ClassName="BigUIntValue";var fa=class extends tr{constructor(e){super(new Hs,e)}getClassName(){return fa.ClassName}};Ee.BigIntValue=fa;fa.ClassName="BigIntValue"});var da=D(ha=>{"use strict";l();Object.defineProperty(ha,"__esModule",{value:!0});ha.TokenIdentifierValue=ha.TokenIdentifierType=void 0;var RA=Dt(),UM="EGLD",js=class extends RA.PrimitiveType{constructor(){super("TokenIdentifier")}getClassName(){return js.ClassName}};ha.TokenIdentifierType=js;js.ClassName="TokenIdentifierType";var wn=class extends RA.PrimitiveValue{constructor(e){super(new js),this.value=e}static egld(){return new wn(UM)}static esdtTokenIdentifier(e){return new wn(e)}getClassName(){return wn.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()}};ha.TokenIdentifierValue=wn;wn.ClassName="TokenIdentifierValue"});var pf=D(pa=>{"use strict";l();Object.defineProperty(pa,"__esModule",{value:!0});pa.VariadicValue=pa.VariadicType=void 0;var df=Dt(),An=class extends df.Type{constructor(e){super("Variadic",[e],df.TypeCardinality.variable())}getClassName(){return An.ClassName}};pa.VariadicType=An;An.ClassName="VariadicType";var En=class extends df.TypedValue{constructor(e,t){super(e),this.items=t}getClassName(){return En.ClassName}static fromItems(...e){if(e.length==0)return new En(new An(new df.TypePlaceholder),[]);let t=e[0].getType();return new En(new An(t),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 t=0;t{"use strict";l();Object.defineProperty(ga,"__esModule",{value:!0});ga.OptionalValue=ga.OptionalType=void 0;var qM=xr(),fc=Dt(),_n=class extends fc.Type{constructor(e){super("Optional",[e],fc.TypeCardinality.variable(1))}getClassName(){return _n.ClassName}isAssignableFrom(e){if(!e.hasExactClass(_n.ClassName))return!1;let t=this.getFirstTypeParameter().equals(e.getFirstTypeParameter()),i=e.getFirstTypeParameter().hasExactClass(fc.NullType.ClassName);return t||i}};ga.OptionalType=_n;_n.ClassName="OptionalType";var Gs=class extends fc.TypedValue{constructor(e,t=null){super(e),this.value=t}getClassName(){return Gs.ClassName}static newMissing(){let e=new _n(new fc.NullType);return new Gs(e)}isSet(){return!!this.value}getTypedValue(){return qM.guardValueIsSet("value",this.value),this.value}valueOf(){return this.value?this.value.valueOf():null}equals(e){var t;return((t=this.value)===null||t===void 0?void 0:t.equals(e.value))||!1}};ga.OptionalValue=Gs;Gs.ClassName="OptionalValue"});var yf=D(va=>{"use strict";l();Object.defineProperty(va,"__esModule",{value:!0});va.ArrayVec=va.ArrayVecType=void 0;var FA=xr(),VM=Ng(),UA=Dt(),ya=class extends UA.Type{constructor(e,t){super("Array",[t]),FA.guardTrue(e>0,"array length > 0"),this.length=e}getClassName(){return ya.ClassName}};va.ArrayVecType=ya;ya.ClassName="ArrayVecType";var ma=class extends UA.TypedValue{constructor(e,t){super(e),FA.guardLength(t,e.length),this.backingCollection=new VM.CollectionOfTypedValues(t)}getClassName(){return ma.ClassName}getLength(){return this.backingCollection.getLength()}getItems(){return this.backingCollection.getItems()}valueOf(){return this.backingCollection.valueOf()}equals(e){return this.backingCollection.equals(e.backingCollection)}};va.ArrayVec=ma;ma.ClassName="ArrayVec"});var mf=D(wa=>{"use strict";l();Object.defineProperty(wa,"__esModule",{value:!0});wa.StringValue=wa.StringType=void 0;var qA=Dt(),Ks=class extends qA.PrimitiveType{constructor(){super("utf-8 string")}getClassName(){return Ks.ClassName}};wa.StringType=Ks;Ks.ClassName="StringType";var In=class extends qA.PrimitiveValue{constructor(e){super(new Ks),this.value=e}getClassName(){return In.ClassName}static fromUTF8(e){return new In(e)}static fromHex(e){let t=y.Buffer.from(e,"hex").toString();return new In(t)}getLength(){return this.value.length}equals(e){return this.value===e.value}valueOf(){return this.value}};wa.StringValue=In;In.ClassName="StringValue"});var vf=D(Tr=>{"use strict";l();var HM=Tr&&Tr.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),QM=Tr&&Tr.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),jM=Tr&&Tr.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&HM(e,r,t);return QM(e,r),e};Object.defineProperty(Tr,"__esModule",{value:!0});Tr.Tuple=Tr.TupleType=void 0;var GM=jM(ke()),KM=As(),VA=jo(),zM=As(),Gi=class extends zM.StructType{constructor(...e){super(Gi.prepareName(e),Gi.prepareFieldDefinitions(e))}getClassName(){return Gi.ClassName}static prepareName(e){let t=e.map(n=>n.toString()).join(", ");return`tuple${t.length}<${t}>`}static prepareFieldDefinitions(e){return e.map((i,n)=>new VA.FieldDefinition(HA(n),"anonymous tuple field",i))}};Tr.TupleType=Gi;Gi.ClassName="TupleType";function HA(r){return`field${r}`}var zs=class extends KM.Struct{constructor(e,t){super(e,t)}getClassName(){return zs.ClassName}static fromItems(e){if(e.length<1)throw new GM.ErrTypingSystem("bad tuple items");let t=e.map(s=>s.getType()),i=new Gi(...t),n=e.map((s,o)=>new VA.Field(s,HA(o)));return new zs(i,n)}};Tr.Tuple=zs;zs.ClassName="Tuple"});var jA=D(Ea=>{"use strict";l();Object.defineProperty(Ea,"__esModule",{value:!0});Ea.CodeMetadataValue=Ea.CodeMetadataType=void 0;var QA=Dt(),wf=class extends QA.PrimitiveType{constructor(){super("CodeMetadata")}};Ea.CodeMetadataType=wf;var Dg=class extends QA.PrimitiveValue{constructor(e){super(new wf),this.value=e}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};Ea.CodeMetadataValue=Dg});var Ef=D(_a=>{"use strict";l();Object.defineProperty(_a,"__esModule",{value:!0});_a.NothingValue=_a.NothingType=void 0;var GA=Dt(),$s=class extends GA.PrimitiveType{constructor(){super("nothing")}getClassName(){return $s.ClassName}};_a.NothingType=$s;$s.ClassName="NothingType";var Aa=class extends GA.PrimitiveValue{constructor(){super(new $s)}getClassName(){return Aa.ClassName}equals(e){return!1}valueOf(){return{}}};_a.NothingValue=Aa;Aa.ClassName="NothingValue"});var Lg=D(li=>{"use strict";l();var $M=li&&li.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),kM=li&&li.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),WM=li&&li.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&$M(e,r,t);return kM(e,r),e};Object.defineProperty(li,"__esModule",{value:!0});li.TypeMapper=void 0;var KA=WM(ke()),YM=Wo(),JM=ac(),XM=mn(),Af=ff(),Og=oc(),zA=uc(),ZM=cc(),Nr=lc(),$A=As(),eP=jo(),kA=da(),Bg=pf(),Mg=gf(),_f=yf(),tP=mf(),bn=vf(),rP=jA(),WA=Ef(),Pg=class{constructor(e=[]){this.openTypesFactories=new Map([["Option",(...t)=>new zA.OptionType(t[0])],["List",(...t)=>new zA.ListType(t[0])],["VarArgs",(...t)=>new Bg.VariadicType(t[0])],["MultiResultVec",(...t)=>new Bg.VariadicType(t[0])],["variadic",(...t)=>new Bg.VariadicType(t[0])],["OptionalArg",(...t)=>new Mg.OptionalType(t[0])],["optional",(...t)=>new Mg.OptionalType(t[0])],["OptionalResult",(...t)=>new Mg.OptionalType(t[0])],["multi",(...t)=>new Af.CompositeType(...t)],["MultiArg",(...t)=>new Af.CompositeType(...t)],["MultiResult",(...t)=>new Af.CompositeType(...t)],["multi",(...t)=>new Af.CompositeType(...t)],["tuple",(...t)=>new bn.TupleType(...t)],["tuple2",(...t)=>new bn.TupleType(...t)],["tuple3",(...t)=>new bn.TupleType(...t)],["tuple4",(...t)=>new bn.TupleType(...t)],["tuple5",(...t)=>new bn.TupleType(...t)],["tuple6",(...t)=>new bn.TupleType(...t)],["tuple7",(...t)=>new bn.TupleType(...t)],["tuple8",(...t)=>new bn.TupleType(...t)],["array20",(...t)=>new _f.ArrayVecType(20,t[0])],["array32",(...t)=>new _f.ArrayVecType(32,t[0])],["array46",(...t)=>new _f.ArrayVecType(46,t[0])],["array64",(...t)=>new _f.ArrayVecType(64,t[0])]]),this.closedTypesMap=new Map([["u8",new Nr.U8Type],["u16",new Nr.U16Type],["u32",new Nr.U32Type],["u64",new Nr.U64Type],["U64",new Nr.U64Type],["BigUint",new Nr.BigUIntType],["i8",new Nr.I8Type],["i16",new Nr.I16Type],["i32",new Nr.I32Type],["i64",new Nr.I64Type],["Bigint",new Nr.BigIntType],["BigInt",new Nr.BigIntType],["bool",new JM.BooleanType],["bytes",new XM.BytesType],["Address",new YM.AddressType],["H256",new ZM.H256Type],["utf-8 string",new tP.StringType],["TokenIdentifier",new kA.TokenIdentifierType],["EgldOrEsdtTokenIdentifier",new kA.TokenIdentifierType],["CodeMetadata",new rP.CodeMetadataType],["nothing",new WA.NothingType],["AsyncCall",new WA.NothingType]]),this.learnedTypesMap=new Map;for(let t of e)this.learnedTypesMap.set(t.getName(),t)}mapType(e){let t=this.mapRecursiveType(e);if(t)return t.isGenericType()||this.learnType(t),t;throw new KA.ErrTypingSystem(`Cannot map the type "${e.getName()}" to a known type`)}mapRecursiveType(e){let t=e.isGenericType(),i=this.learnedTypesMap.get(e.getName());if(i)return i;let n=this.closedTypesMap.get(e.getName());return n||(e.hasExactClass(Og.EnumType.ClassName)?this.mapEnumType(e):e.hasExactClass($A.StructType.ClassName)?this.mapStructType(e):t?this.mapGenericType(e):null)}learnType(e){this.learnedTypesMap.delete(e.getName()),this.learnedTypesMap.set(e.getName(),e)}mapStructType(e){let t=this.mappedFields(e.getFieldsDefinitions());return new $A.StructType(e.getName(),t)}mapEnumType(e){let t=e.variants.map(n=>new Og.EnumVariantDefinition(n.name,n.discriminant,this.mappedFields(n.getFieldsDefinitions())));return new Og.EnumType(e.getName(),t)}mappedFields(e){return e.map(t=>new eP.FieldDefinition(t.name,t.description,this.mapType(t.type)))}mapGenericType(e){let i=e.getTypeParameters().map(s=>this.mapType(s)),n=this.openTypesFactories.get(e.getName());if(!n)throw new KA.ErrTypingSystem(`Cannot map the generic type "${e.getName()}" to a known type`);return n(...i)}};li.TypeMapper=Pg});var t_=D(fi=>{"use strict";l();var iP=fi&&fi.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),nP=fi&&fi.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),sP=fi&&fi.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&iP(e,r,t);return nP(e,r),e};Object.defineProperty(fi,"__esModule",{value:!0});fi.AbiRegistry=void 0;var oP=sP(ke()),Rg=xr(),YA=As(),JA=Cg(),XA=oc(),ZA=Lg(),Fg=uf(),Ia=class{constructor(){this.interfaces=[],this.customTypes=[]}static create(e){return new Ia().extend(e).remapToKnownTypes()}extend(e){e.types=e.types||{};let t=JA.ContractInterface.fromJSON(e);this.interfaces.push(t);for(let i in e.types){let n=e.types[i],s=n.type;n.name=i;let o=this.createCustomType(s,n);this.customTypes.push(o)}return this.sortCustomTypesByDependencies(),this}createCustomType(e,t){if(e=="struct")return YA.StructType.fromJSON(t);if(e=="enum")return XA.EnumType.fromJSON(t);throw new oP.ErrTypingSystem(`Unknown type discriminant: ${e}`)}sortCustomTypesByDependencies(){this.customTypes.sort((e,t)=>t.getNamesOfDependencies().indexOf(e.getName())>-1?-1:1)}getInterface(e){let t=this.interfaces.find(i=>i.name==e);return Rg.guardValueIsSetWithMessage(`interface [${e}] not found`,t),t}getInterfaces(e){return e.map(t=>this.getInterface(t))}getStruct(e){let t=this.customTypes.find(i=>i.getName()==e&&i.hasExactClass(YA.StructType.ClassName));return Rg.guardValueIsSetWithMessage(`struct [${e}] not found`,t),t}getStructs(e){return e.map(t=>this.getStruct(t))}getEnum(e){let t=this.customTypes.find(i=>i.getName()==e&&i.hasExactClass(XA.EnumType.ClassName));return Rg.guardValueIsSetWithMessage(`enum [${e}] not found`,t),t}getEnums(e){return e.map(t=>this.getEnum(t))}remapToKnownTypes(){let e=new ZA.TypeMapper([]),t=[],i=[];for(let s of this.customTypes){let o=e.mapType(s);t.push(o)}e=new ZA.TypeMapper(t);for(let s of this.interfaces){let o=[];for(let u of s.endpoints)o.push(e_(u,e));let a=s.constructorDefinition?e_(s.constructorDefinition,e):null;i.push(new JA.ContractInterface(s.name,a,o))}let n=new Ia;return n.customTypes.push(...t),n.interfaces.push(...i),n}};fi.AbiRegistry=Ia;function e_(r,e){let t=r.input.map(n=>new Fg.EndpointParameterDefinition(n.name,n.description,e.mapType(n.type))),i=r.output.map(n=>new Fg.EndpointParameterDefinition(n.name,n.description,e.mapType(n.type)));return new Fg.EndpointDefinition(r.name,t,i,r.modifiers)}});var i_=D(ba=>{"use strict";l();Object.defineProperty(ba,"__esModule",{value:!0});ba.createListOfTokenIdentifiers=ba.createListOfAddresses=void 0;var aP=Wo(),r_=uc(),uP=da();function cP(r){let e=r.map(i=>new aP.AddressValue(i));return r_.List.fromItems(e)}ba.createListOfAddresses=cP;function lP(r){let e=r.map(i=>new uP.TokenIdentifierValue(i));return r_.List.fromItems(e)}ba.createListOfTokenIdentifiers=lP});var m_=D(rr=>{"use strict";l();var fP=rr&&rr.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),hP=rr&&rr.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),dP=rr&&rr.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&fP(e,r,t);return hP(e,r),e};Object.defineProperty(rr,"__esModule",{value:!0});rr.onPrimitiveTypeSelect=rr.onPrimitiveValueSelect=rr.onTypedValueSelect=rr.onTypeSelect=void 0;var bf=dP(ke()),n_=Wo(),s_=ac(),o_=mn(),a_=oc(),If=uc(),u_=cc(),c_=lc(),l_=Ef(),f_=As(),h_=da(),d_=vf(),p_=Dt(),g_=yf(),y_=mf();function pP(r,e){if(r.hasExactClass(If.OptionType.ClassName))return e.onOption();if(r.hasExactClass(If.ListType.ClassName))return e.onList();if(r.hasExactClass(g_.ArrayVecType.ClassName))return e.onArray();if(r.hasClassOrSuperclass(p_.PrimitiveType.ClassName))return e.onPrimitive();if(r.hasExactClass(f_.StructType.ClassName))return e.onStruct();if(r.hasExactClass(d_.TupleType.ClassName))return e.onTuple();if(r.hasExactClass(a_.EnumType.ClassName))return e.onEnum();if(e.onOther)return e.onOther();throw new bf.ErrTypingSystem(`type isn't known: ${r}`)}rr.onTypeSelect=pP;function gP(r,e){if(r.hasClassOrSuperclass(p_.PrimitiveValue.ClassName))return e.onPrimitive();if(r.hasExactClass(If.OptionValue.ClassName))return e.onOption();if(r.hasExactClass(If.List.ClassName))return e.onList();if(r.hasExactClass(g_.ArrayVec.ClassName))return e.onArray();if(r.hasExactClass(f_.Struct.ClassName))return e.onStruct();if(r.hasExactClass(d_.Tuple.ClassName))return e.onTuple();if(r.hasExactClass(a_.EnumValue.ClassName))return e.onEnum();if(e.onOther)return e.onOther();throw new bf.ErrTypingSystem(`value isn't typed: ${r}`)}rr.onTypedValueSelect=gP;function yP(r,e){if(r.hasExactClass(s_.BooleanValue.ClassName))return e.onBoolean();if(r.hasClassOrSuperclass(c_.NumericalValue.ClassName))return e.onNumerical();if(r.hasExactClass(n_.AddressValue.ClassName))return e.onAddress();if(r.hasExactClass(o_.BytesValue.ClassName))return e.onBytes();if(r.hasExactClass(y_.StringValue.ClassName))return e.onString();if(r.hasExactClass(u_.H256Value.ClassName))return e.onH256();if(r.hasExactClass(h_.TokenIdentifierValue.ClassName))return e.onTypeIdentifier();if(r.hasExactClass(l_.NothingValue.ClassName))return e.onNothing();if(e.onOther)return e.onOther();throw new bf.ErrTypingSystem(`value isn't a primitive: ${r.getType()}`)}rr.onPrimitiveValueSelect=yP;function mP(r,e){if(r.hasExactClass(s_.BooleanType.ClassName))return e.onBoolean();if(r.hasClassOrSuperclass(c_.NumericalType.ClassName))return e.onNumerical();if(r.hasExactClass(n_.AddressType.ClassName))return e.onAddress();if(r.hasExactClass(o_.BytesType.ClassName))return e.onBytes();if(r.hasExactClass(y_.StringType.ClassName))return e.onString();if(r.hasExactClass(u_.H256Type.ClassName))return e.onH256();if(r.hasExactClass(h_.TokenIdentifierType.ClassName))return e.onTokenIndetifier();if(r.hasExactClass(l_.NothingType.ClassName))return e.onNothing();if(e.onOther)return e.onOther();throw new bf.ErrTypingSystem(`type isn't a known primitive: ${r}`)}rr.onPrimitiveTypeSelect=mP});var ir=D(Ue=>{"use strict";l();var vP=Ue&&Ue.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),We=Ue&&Ue.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&vP(e,r,t)};Object.defineProperty(Ue,"__esModule",{value:!0});We(t_(),Ue);We(Wo(),Ue);We(gf(),Ue);We(ac(),Ue);We(mn(),Ue);We(ff(),Ue);We(Cg(),Ue);We(uf(),Ue);We(oc(),Ue);We(i_(),Ue);We(jo(),Ue);We(uc(),Ue);We(yf(),Ue);We(cc(),Ue);We(m_(),Ue);We(Ef(),Ue);We(lc(),Ue);We(mf(),Ue);We(As(),Ue);We(vf(),Ue);We(da(),Ue);We(sf(),Ue);We(Lg(),Ue);We(Dt(),Ue);We(pf(),Ue)});var w_=D(hi=>{"use strict";l();var wP=hi&&hi.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),EP=hi&&hi.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),AP=hi&&hi.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&wP(e,r,t);return EP(e,r),e};Object.defineProperty(hi,"__esModule",{value:!0});hi.OptionValueBinaryCodec=void 0;var v_=AP(ke()),Cf=ir(),Ug=class{constructor(e){this.binaryCodec=e}decodeNested(e,t){if(e[0]==0)return[Cf.OptionValue.newMissingTyped(t),1];if(e[0]!=1)throw new v_.ErrCodec("invalid buffer for optional value");let[i,n]=this.binaryCodec.decodeNested(e.slice(1),t);return[Cf.OptionValue.newProvided(i),n+1]}decodeTopLevel(e,t){if(e.length==0)return new Cf.OptionValue(t);if(e[0]!=1)throw new v_.ErrCodec("invalid buffer for optional value");let[i,n]=this.binaryCodec.decodeNested(e.slice(1),t);return new Cf.OptionValue(t,i)}encodeNested(e){return e.isSet()?y.Buffer.concat([y.Buffer.from([1]),this.binaryCodec.encodeNested(e.getTypedValue())]):y.Buffer.from([0])}encodeTopLevel(e){return e.isSet()?y.Buffer.concat([y.Buffer.from([1]),this.binaryCodec.encodeNested(e.getTypedValue())]):y.Buffer.from([])}};hi.OptionValueBinaryCodec=Ug});var E_=D(Sf=>{"use strict";l();Object.defineProperty(Sf,"__esModule",{value:!0});Sf.AddressBinaryCodec=void 0;var _P=Hr(),IP=ir(),qg=class{decodeNested(e){let t=e.slice(0,32),i=new _P.Address(t);return[new IP.AddressValue(i),32]}decodeTopLevel(e){let[t,i]=this.decodeNested(e);return t}encodeNested(e){return e.valueOf().pubkey()}encodeTopLevel(e){return e.valueOf().pubkey()}};Sf.AddressBinaryCodec=qg});var __=D(di=>{"use strict";l();var bP=di&&di.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),CP=di&&di.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),SP=di&&di.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&bP(e,r,t);return CP(e,r),e};Object.defineProperty(di,"__esModule",{value:!0});di.BooleanBinaryCodec=void 0;var xP=SP(ke()),A_=ir(),Qr=class{decodeNested(e){let t=e.readUInt8(0);return[new A_.BooleanValue(t==Qr.TRUE),1]}decodeTopLevel(e){if(e.length>1)throw new xP.ErrInvalidArgument("buffer should be of size <= 1");let t=e[0];return new A_.BooleanValue(t==Qr.TRUE)}encodeNested(e){return e.isTrue()?y.Buffer.from([Qr.TRUE]):y.Buffer.from([Qr.FALSE])}encodeTopLevel(e){return e.isTrue()?y.Buffer.from([Qr.TRUE]):y.Buffer.from([])}};di.BooleanBinaryCodec=Qr;Qr.TRUE=1;Qr.FALSE=0});var b_=D(pi=>{"use strict";l();var TP=pi&&pi.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(pi,"__esModule",{value:!0});pi.zeroPadStringIfOddLength=pi.isPaddedHex=pi.numberToPaddedHex=void 0;var NP=TP(Vr());function DP(r){let e=new NP.default(r).toString(16);return I_(e)}pi.numberToPaddedHex=DP;function OP(r){r=r||"";let e=y.Buffer.from(r,"hex").toString("hex");return r.toUpperCase()==e.toUpperCase()}pi.isPaddedHex=OP;function I_(r){return r=r||"",r.length%2==1?"0"+r:r}pi.zeroPadStringIfOddLength=I_});var Vg=D(Ot=>{"use strict";l();var BP=Ot&&Ot.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ot,"__esModule",{value:!0});Ot.prependByteToBuffer=Ot.flipBufferBitsInPlace=Ot.getHexMagnitudeOfBigInt=Ot.bigIntToBuffer=Ot.bufferToBigInt=Ot.cloneBuffer=Ot.isMsbZero=Ot.isMsbOne=void 0;var C_=BP(Vr()),MP=b_();function S_(r,e=0){return r[e]>>7==1}Ot.isMsbOne=S_;function PP(r,e=0){return!S_(r,e)}Ot.isMsbZero=PP;function LP(r){let e=y.Buffer.alloc(r.length);return r.copy(e),e}Ot.cloneBuffer=LP;function RP(r){let e=r.toString("hex");return new C_.default(`0x${e}`,16)}Ot.bufferToBigInt=RP;function FP(r){let e=x_(r);return y.Buffer.from(e,"hex")}Ot.bigIntToBuffer=FP;function x_(r){return r?(r.isNegative()&&(r=r.multipliedBy(new C_.default(-1))),MP.numberToPaddedHex(r)):""}Ot.getHexMagnitudeOfBigInt=x_;function UP(r){for(let e=0;e{"use strict";l();Object.defineProperty(xf,"__esModule",{value:!0});xf.SizeOfU32=void 0;xf.SizeOfU32=4});var N_=D(Ca=>{"use strict";l();var VP=Ca&&Ca.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ca,"__esModule",{value:!0});Ca.NumericalBinaryCodec=void 0;var Hg=ir(),at=Vg(),hc=VP(Vr()),T_=Tf(),Qg=class{decodeNested(e,t){let i=0,n=t.sizeInBytes;n||(i=T_.SizeOfU32,n=e.readUInt32BE(0));let s=e.slice(i,i+n),o=this.decodeTopLevel(s,t),a=n+i;return[o,a]}decodeTopLevel(e,t){let i=at.cloneBuffer(e);if(e.length==0)return new Hg.NumericalValue(t,new hc.default(0));if(!t.withSign||at.isMsbZero(i)){let h=at.bufferToBigInt(i);return new Hg.NumericalValue(t,h)}at.flipBufferBitsInPlace(i);let u=at.bufferToBigInt(i).multipliedBy(new hc.default(-1)).minus(new hc.default(1));return new Hg.NumericalValue(t,u)}encodeNested(e){if(e.sizeInBytes)return this.encodeNestedFixedSize(e,e.sizeInBytes);let t=this.encodeTopLevel(e),i=y.Buffer.alloc(T_.SizeOfU32);return i.writeUInt32BE(t.length),y.Buffer.concat([i,t])}encodeNestedFixedSize(e,t){if(e.value.isZero())return y.Buffer.alloc(t,0);if(!e.withSign){let o=at.bigIntToBuffer(e.value),a=y.Buffer.alloc(t-o.length,0);return y.Buffer.concat([a,o])}if(e.value.isPositive()){let o=at.bigIntToBuffer(e.value);at.isMsbOne(o)&&(o=at.prependByteToBuffer(o,0));let a=y.Buffer.alloc(t-o.length,0);return y.Buffer.concat([a,o])}let i=e.value.plus(new hc.default(1)),n=at.bigIntToBuffer(i);at.flipBufferBitsInPlace(n),at.isMsbZero(n)&&(n=at.prependByteToBuffer(n,255));let s=y.Buffer.alloc(t-n.length,255);return y.Buffer.concat([s,n])}encodeTopLevel(e){let t=e.withSign;return e.value.isZero()?y.Buffer.alloc(0):t?this.encodePrimitive(e):at.bigIntToBuffer(e.value)}encodePrimitive(e){if(e.value.isPositive()){let n=at.bigIntToBuffer(e.value);return at.isMsbOne(n)&&(n=at.prependByteToBuffer(n,0)),n}let t=e.value.plus(new hc.default(1)),i=at.bigIntToBuffer(t);return at.flipBufferBitsInPlace(i),at.isMsbZero(i)&&(i=at.prependByteToBuffer(i,255)),i}};Ca.NumericalBinaryCodec=Qg});var D_=D(Nf=>{"use strict";l();Object.defineProperty(Nf,"__esModule",{value:!0});Nf.H256BinaryCodec=void 0;var HP=cc(),jg=class{decodeNested(e){let t=e.slice(0,32);return[new HP.H256Value(t),32]}decodeTopLevel(e){let[t,i]=this.decodeNested(e);return t}encodeNested(e){return e.valueOf()}encodeTopLevel(e){return e.valueOf()}};Nf.H256BinaryCodec=jg});var Bf=D(Of=>{"use strict";l();Object.defineProperty(Of,"__esModule",{value:!0});Of.BytesBinaryCodec=void 0;var O_=mn(),Df=Tf(),Gg=class{decodeNested(e){let t=e.readUInt32BE(0),i=e.slice(Df.SizeOfU32,Df.SizeOfU32+t);return[new O_.BytesValue(i),Df.SizeOfU32+t]}decodeTopLevel(e){return new O_.BytesValue(e)}encodeNested(e){let t=y.Buffer.alloc(Df.SizeOfU32);return t.writeUInt32BE(e.getLength()),y.Buffer.concat([t,e.valueOf()])}encodeTopLevel(e){return e.valueOf()}};Of.BytesBinaryCodec=Gg});var M_=D(Mf=>{"use strict";l();Object.defineProperty(Mf,"__esModule",{value:!0});Mf.TokenIdentifierCodec=void 0;var QP=mn(),B_=da(),jP=Bf(),Kg=class{constructor(){this.bytesCodec=new jP.BytesBinaryCodec}decodeNested(e){let[t,i]=this.bytesCodec.decodeNested(e);return[new B_.TokenIdentifierValue(t.toString()),i]}decodeTopLevel(e){let t=this.bytesCodec.decodeTopLevel(e);return new B_.TokenIdentifierValue(t.toString())}encodeNested(e){let t=QP.BytesValue.fromUTF8(e.valueOf());return this.bytesCodec.encodeNested(t)}encodeTopLevel(e){return y.Buffer.from(e.valueOf())}};Mf.TokenIdentifierCodec=Kg});var L_=D(Pf=>{"use strict";l();Object.defineProperty(Pf,"__esModule",{value:!0});Pf.NothingCodec=void 0;var P_=ir(),zg=class{decodeNested(){return[new P_.NothingValue,0]}decodeTopLevel(){return new P_.NothingValue}encodeNested(){return y.Buffer.from([])}encodeTopLevel(){return y.Buffer.from([])}};Pf.NothingCodec=zg});var F_=D(Lf=>{"use strict";l();Object.defineProperty(Lf,"__esModule",{value:!0});Lf.StringBinaryCodec=void 0;var R_=ir(),GP=mn(),KP=Bf(),$g=class{constructor(){this.bytesBinaryCodec=new KP.BytesBinaryCodec}decodeNested(e){let[t,i]=this.bytesBinaryCodec.decodeNested(e);return[new R_.StringValue(t.valueOf().toString()),i]}decodeTopLevel(e){return new R_.StringValue(e.toString())}encodeNested(e){let t=GP.BytesValue.fromUTF8(e.valueOf());return this.bytesBinaryCodec.encodeNested(t)}encodeTopLevel(e){return y.Buffer.from(e.valueOf())}};Lf.StringBinaryCodec=$g});var U_=D(Ff=>{"use strict";l();Object.defineProperty(Ff,"__esModule",{value:!0});Ff.PrimitiveBinaryCodec=void 0;var Rf=ir(),zP=E_(),$P=__(),kP=N_(),WP=D_(),YP=Bf(),JP=M_(),XP=L_(),ZP=F_(),kg=class{constructor(e){this.binaryCodec=e,this.booleanCodec=new $P.BooleanBinaryCodec,this.numericalCodec=new kP.NumericalBinaryCodec,this.addressCodec=new zP.AddressBinaryCodec,this.h256Codec=new WP.H256BinaryCodec,this.bytesCodec=new YP.BytesBinaryCodec,this.stringCodec=new ZP.StringBinaryCodec,this.tokenIdentifierCodec=new JP.TokenIdentifierCodec,this.nothingCodec=new XP.NothingCodec}decodeNested(e,t){return Rf.onPrimitiveTypeSelect(t,{onBoolean:()=>this.booleanCodec.decodeNested(e),onNumerical:()=>this.numericalCodec.decodeNested(e,t),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,t){return Rf.onPrimitiveTypeSelect(t,{onBoolean:()=>this.booleanCodec.decodeTopLevel(e),onNumerical:()=>this.numericalCodec.decodeTopLevel(e,t),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 Rf.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 Rf.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()})}};Ff.PrimitiveBinaryCodec=kg});var H_=D(Uf=>{"use strict";l();Object.defineProperty(Uf,"__esModule",{value:!0});Uf.ListBinaryCodec=void 0;var q_=ir(),V_=Tf(),Wg=class{constructor(e){this.binaryCodec=e}decodeNested(e,t){let i=t.getFirstTypeParameter(),n=[],s=e.readUInt32BE(0);this.binaryCodec.constraints.checkListLength(s);let o=e,a=V_.SizeOfU32;e=o.slice(a);for(let u=0;u0;){let[a,u]=this.binaryCodec.decodeNested(e,i);n.push(a),o+=u,e=s.slice(o),this.binaryCodec.constraints.checkListLength(n.length)}return new q_.List(t,n)}encodeNested(e){this.binaryCodec.constraints.checkListLength(e.getLength());let t=y.Buffer.alloc(V_.SizeOfU32);t.writeUInt32BE(e.getLength());let i=[];for(let s of e.getItems()){let o=this.binaryCodec.encodeNested(s);i.push(o)}return y.Buffer.concat([t,...i])}encodeTopLevel(e){this.binaryCodec.constraints.checkListLength(e.getLength());let t=[];for(let n of e.getItems()){let s=this.binaryCodec.encodeNested(n);t.push(s)}return y.Buffer.concat(t)}};Uf.ListBinaryCodec=Wg});var Jg=D(qf=>{"use strict";l();Object.defineProperty(qf,"__esModule",{value:!0});qf.FieldsBinaryCodec=void 0;var e5=ir(),Yg=class{constructor(e){this.binaryCodec=e}decodeNested(e,t){let i=[],n=0;for(let s of t){let[o,a]=this.binaryCodec.decodeNested(e,s.type);e=e.slice(a),n+=a;let u=new e5.Field(o,s.name);i.push(u)}return[i,n]}encodeNested(e){let t=[];for(let i of e){let n=this.binaryCodec.encodeNested(i.value);t.push(n)}return y.Buffer.concat(t)}};qf.FieldsBinaryCodec=Yg});var Zg=D(Vf=>{"use strict";l();Object.defineProperty(Vf,"__esModule",{value:!0});Vf.StructBinaryCodec=void 0;var t5=ir(),r5=Jg(),Xg=class{constructor(e){this.fieldsCodec=new r5.FieldsBinaryCodec(e)}decodeTopLevel(e,t){let[i]=this.decodeNested(e,t);return i}decodeNested(e,t){let i=t.getFieldsDefinitions(),[n,s]=this.fieldsCodec.decodeNested(e,i);return[new t5.Struct(t,n),s]}encodeNested(e){let t=e.getFields();return this.fieldsCodec.encodeNested(t)}encodeTopLevel(e){return this.encodeNested(e)}};Vf.StructBinaryCodec=Xg});var Q_=D(Qf=>{"use strict";l();Object.defineProperty(Qf,"__esModule",{value:!0});Qf.EnumBinaryCodec=void 0;var Hf=ir(),i5=Jg(),ey=class{constructor(e){this.binaryCodec=e,this.fieldsCodec=new i5.FieldsBinaryCodec(e)}decodeTopLevel(e,t){let[i]=this.decodeNested(e,t);return i}decodeNested(e,t){let[i,n]=this.readDiscriminant(e);e=e.slice(n);let s=t.getVariantByDiscriminant(i),o=s.getFieldsDefinitions(),[a,u]=this.fieldsCodec.decodeNested(e,o);return[new Hf.EnumValue(t,s,a),n+u]}readDiscriminant(e){let[t,i]=this.binaryCodec.decodeNested(e,new Hf.U8Type);return[t.valueOf(),i]}encodeNested(e){let t=new Hf.U8Value(e.discriminant),i=this.binaryCodec.encodeNested(t),n=e.getFields(),s=this.fieldsCodec.encodeNested(n);return y.Buffer.concat([i,s])}encodeTopLevel(e){let t=e.getFields(),i=t.length>0,n=this.fieldsCodec.encodeNested(t),s=new Hf.U8Value(e.discriminant),o=i?this.binaryCodec.encodeNested(s):this.binaryCodec.encodeTopLevel(s);return y.Buffer.concat([o,n])}};Qf.EnumBinaryCodec=ey});var j_=D(jf=>{"use strict";l();Object.defineProperty(jf,"__esModule",{value:!0});jf.TupleBinaryCodec=void 0;var n5=Zg(),ty=class{constructor(e){this.structCodec=new n5.StructBinaryCodec(e)}decodeTopLevel(e,t){return this.structCodec.decodeTopLevel(e,t)}decodeNested(e,t){return this.structCodec.decodeNested(e,t)}encodeNested(e){return this.structCodec.encodeNested(e)}encodeTopLevel(e){return this.structCodec.encodeTopLevel(e)}};jf.TupleBinaryCodec=ty});var G_=D(Gf=>{"use strict";l();Object.defineProperty(Gf,"__esModule",{value:!0});Gf.ArrayVecBinaryCodec=void 0;var s5=ir(),ry=class{constructor(e){this.binaryCodec=e}decodeNested(e,t){let i=t.length,n=t.getFirstTypeParameter(),s=[],o=0;for(let a=0;a{"use strict";l();var o5=Dr&&Dr.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),a5=Dr&&Dr.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),u5=Dr&&Dr.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&o5(e,r,t);return a5(e,r),e};Object.defineProperty(Dr,"__esModule",{value:!0});Dr.BinaryCodecConstraints=Dr.BinaryCodec=void 0;var K_=u5(ke()),Kf=ir(),z_=xr(),c5=w_(),l5=U_(),f5=H_(),h5=Zg(),d5=Q_(),p5=j_(),g5=G_(),iy=class{constructor(e=null){this.constraints=e||new zf,this.optionCodec=new c5.OptionValueBinaryCodec(this),this.listCodec=new f5.ListBinaryCodec(this),this.arrayCodec=new g5.ArrayVecBinaryCodec(this),this.primitiveCodec=new l5.PrimitiveBinaryCodec(this),this.structCodec=new h5.StructBinaryCodec(this),this.tupleCodec=new p5.TupleBinaryCodec(this),this.enumCodec=new d5.EnumBinaryCodec(this)}decodeTopLevel(e,t){return this.constraints.checkBufferLength(e),Kf.onTypeSelect(t,{onOption:()=>this.optionCodec.decodeTopLevel(e,t.getFirstTypeParameter()),onList:()=>this.listCodec.decodeTopLevel(e,t),onArray:()=>this.arrayCodec.decodeTopLevel(e,t),onPrimitive:()=>this.primitiveCodec.decodeTopLevel(e,t),onStruct:()=>this.structCodec.decodeTopLevel(e,t),onTuple:()=>this.tupleCodec.decodeTopLevel(e,t),onEnum:()=>this.enumCodec.decodeTopLevel(e,t)})}decodeNested(e,t){this.constraints.checkBufferLength(e);let[i,n]=Kf.onTypeSelect(t,{onOption:()=>this.optionCodec.decodeNested(e,t.getFirstTypeParameter()),onList:()=>this.listCodec.decodeNested(e,t),onArray:()=>this.arrayCodec.decodeNested(e,t),onPrimitive:()=>this.primitiveCodec.decodeNested(e,t),onStruct:()=>this.structCodec.decodeNested(e,t),onTuple:()=>this.tupleCodec.decodeNested(e,t),onEnum:()=>this.enumCodec.decodeNested(e,t)});return[i,n]}encodeNested(e){return z_.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),Kf.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 z_.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),Kf.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)})}};Dr.BinaryCodec=iy;var zf=class{constructor(e){this.maxBufferLength=e?.maxBufferLength||4096,this.maxListLength=e?.maxListLength||1024}checkBufferLength(e){if(e.length>this.maxBufferLength)throw new K_.ErrCodec(`Buffer too large: ${e.length} > ${this.maxBufferLength}`)}checkListLength(e){if(e>this.maxListLength)throw new K_.ErrCodec(`List too large: ${e} > ${this.maxListLength}`)}};Dr.BinaryCodecConstraints=zf});var $_=D(Or=>{"use strict";l();var y5=Or&&Or.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Or,"__esModule",{value:!0});Or.decodeBigNumber=Or.decodeString=Or.decodeBool=Or.decodeUnsignedNumber=void 0;var m5=y5(Vr()),$f=ir(),v5=ny(),kf=new v5.BinaryCodec;function w5(r){let e=kf.decodeTopLevel(r,new $f.BigUIntType);return Number(e.valueOf())}Or.decodeUnsignedNumber=w5;function E5(r){let e=kf.decodeTopLevel(r,new $f.BooleanType);return Boolean(e.valueOf())}Or.decodeBool=E5;function A5(r){let e=kf.decodeTopLevel(r,new $f.BytesType);return String(e.valueOf())}Or.decodeString=A5;function _5(r){let e=kf.decodeTopLevel(r,new $f.BigUIntType);return new m5.default(e.valueOf())}Or.decodeBigNumber=_5});var W_=D(Cn=>{"use strict";l();var I5=Cn&&Cn.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),k_=Cn&&Cn.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&I5(e,r,t)};Object.defineProperty(Cn,"__esModule",{value:!0});k_(ny(),Cn);k_($_(),Cn)});var Wf=D(Sn=>{"use strict";l();Object.defineProperty(Sn,"__esModule",{value:!0});Sn.ArgSerializer=Sn.ArgumentsSeparator=void 0;var b5=W_(),sy=ff(),oy=pf(),ay=gf();Sn.ArgumentsSeparator="@";var Y_=new b5.BinaryCodec,uy=class{stringToValues(e,t){let i=this.stringToBuffers(e);return this.buffersToValues(i,t)}stringToBuffers(e){return e.split(Sn.ArgumentsSeparator).map(t=>y.Buffer.from(t,"hex"))}buffersToValues(e,t){e=e||[];let i=[],n=0,s=e.length;for(let h=0;h=s}return i}valuesToString(e){let t=this.valuesToStrings(e),i=t.join(Sn.ArgumentsSeparator),n=t.length;return{argumentsString:i,count:n}}valuesToStrings(e){return this.valuesToBuffers(e).map(n=>n.toString("hex"))}valuesToBuffers(e){let t=[];for(let n of e)i(n);function i(n){if(n.hasExactClass(ay.OptionalValue.ClassName)){let s=n;s.isSet()&&i(s.getTypedValue())}else if(n.hasExactClass(oy.VariadicValue.ClassName)){let s=n;for(let o of s.getItems())i(o)}else if(n.hasExactClass(sy.CompositeValue.ClassName)){let s=n;for(let o of s.getItems())i(o)}else{let s=Y_.encodeTopLevel(n);t.push(s)}}return t}};Sn.ArgSerializer=uy});var gy=D(jr=>{"use strict";l();Object.defineProperty(jr,"__esModule",{value:!0});jr.ContractCallPayloadBuilder=jr.ContractUpgradePayloadBuilder=jr.ContractDeployPayloadBuilder=jr.ArwenVirtualMachine=void 0;var hy=dc(),dy=xr(),C5=Wf();jr.ArwenVirtualMachine="0500";var cy=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(){dy.guardValueIsSet("code",this.code);let e=this.code.toString(),t=this.codeMetadata.toString(),i=`${e}@${jr.ArwenVirtualMachine}@${t}`;return i=py(i,this.arguments),new hy.TransactionPayload(i)}};jr.ContractDeployPayloadBuilder=cy;var ly=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(){dy.guardValueIsSet("code",this.code);let e=this.code.toString(),t=this.codeMetadata.toString(),i=`upgradeContract@${e}@${t}`;return i=py(i,this.arguments),new hy.TransactionPayload(i)}};jr.ContractUpgradePayloadBuilder=ly;var fy=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(){dy.guardValueIsSet("calledFunction",this.contractFunction);let e=this.contractFunction.name;return e=py(e,this.arguments),new hy.TransactionPayload(e)}};jr.ContractCallPayloadBuilder=fy;function py(r,e){let{argumentsString:t,count:i}=new C5.ArgSerializer().valuesToString(e);return i==0?r:`${r}@${t}`}});var dc=D(Yf=>{"use strict";l();Object.defineProperty(Yf,"__esModule",{value:!0});Yf.TransactionPayload=void 0;var yy=gy(),Sa=class{constructor(e){this.data=y.Buffer.from(e||[])}static fromEncoded(e){if(!e)return new Sa("");let t=y.Buffer.from(e,"base64").toString();return new Sa(t)}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=>y.Buffer.from(e,"hex"))}length(){return y.Buffer.from(this.data).length}static contractDeploy(){return new yy.ContractDeployPayloadBuilder}static contractUpgrade(){return new yy.ContractUpgradePayloadBuilder}static contractCall(){return new yy.ContractCallPayloadBuilder}};Yf.TransactionPayload=Sa});var Z_=D(xn=>{"use strict";l();Object.defineProperty(xn,"__esModule",{value:!0});xn.MultiESDTNFTTransferPayloadBuilder=xn.ESDTNFTTransferPayloadBuilder=xn.ESDTTransferPayloadBuilder=void 0;var J_=Hr(),Ey=Wf(),Gr=ir(),X_=dg(),Ay=dc(),my=class{constructor(){this.payment=X_.TokenPayment.fungibleFromAmount("","0",0)}setPayment(e){return this.payment=e,this}build(){let e=[Gr.BytesValue.fromUTF8(this.payment.tokenIdentifier),new Gr.BigUIntValue(this.payment.valueOf())],{argumentsString:t}=new Ey.ArgSerializer().valuesToString(e),i=`ESDTTransfer@${t}`;return new Ay.TransactionPayload(i)}};xn.ESDTTransferPayloadBuilder=my;var vy=class{constructor(){this.payment=X_.TokenPayment.nonFungible("",0),this.destination=new J_.Address("")}setPayment(e){return this.payment=e,this}setDestination(e){return this.destination=e,this}build(){let e=[Gr.BytesValue.fromUTF8(this.payment.tokenIdentifier),new Gr.U64Value(this.payment.nonce),new Gr.BigUIntValue(this.payment.valueOf()),new Gr.AddressValue(this.destination)],{argumentsString:t}=new Ey.ArgSerializer().valuesToString(e),i=`ESDTNFTTransfer@${t}`;return new Ay.TransactionPayload(i)}};xn.ESDTNFTTransferPayloadBuilder=vy;var wy=class{constructor(){this.payments=[],this.destination=new J_.Address("")}setPayments(e){return this.payments=e,this}setDestination(e){return this.destination=e,this}build(){let e=[new Gr.AddressValue(this.destination),new Gr.U16Value(this.payments.length)];for(let n of this.payments)e.push(Gr.BytesValue.fromUTF8(n.tokenIdentifier),new Gr.U64Value(n.nonce),new Gr.BigUIntValue(n.valueOf()));let{argumentsString:t}=new Ey.ArgSerializer().valuesToString(e),i=`MultiESDTNFTTransfer@${t}`;return new Ay.TransactionPayload(i)}};xn.MultiESDTNFTTransferPayloadBuilder=wy});var Xf=D(Jf=>{"use strict";l();Object.defineProperty(Jf,"__esModule",{value:!0});Jf.Account=void 0;var S5=Hr(),_y=class{constructor(e){this.address=new S5.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()}}};Jf.Account=_y});var Zf=D(it=>{"use strict";l();Object.defineProperty(it,"__esModule",{value:!0});it.ESDT_TRANSFER_VALUE=it.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME=it.ESDTNFT_TRANSFER_FUNCTION_NAME=it.ESDT_TRANSFER_FUNCTION_NAME=it.ESDT_TRANSFER_GAS_LIMIT=it.TRANSACTION_VERSION_TX_HASH_SIGN=it.TRANSACTION_VERSION_DEFAULT=it.TRANSACTION_OPTIONS_TX_HASH_SIGN=it.TRANSACTION_OPTIONS_DEFAULT=it.TRANSACTION_MIN_GAS_PRICE=void 0;it.TRANSACTION_MIN_GAS_PRICE=1e9;it.TRANSACTION_OPTIONS_DEFAULT=0;it.TRANSACTION_OPTIONS_TX_HASH_SIGN=1;it.TRANSACTION_VERSION_DEFAULT=1;it.TRANSACTION_VERSION_TX_HASH_SIGN=2;it.ESDT_TRANSFER_GAS_LIMIT=5e5;it.ESDT_TRANSFER_FUNCTION_NAME="ESDTTransfer";it.ESDTNFT_TRANSFER_FUNCTION_NAME="ESDTNFTTransfer";it.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME="MultiESDTNFTTransfer";it.ESDT_TRANSFER_VALUE="0"});var tI=D(Br=>{"use strict";l();var x5=Br&&Br.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),T5=Br&&Br.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),N5=Br&&Br.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&x5(e,r,t);return T5(e,r),e};Object.defineProperty(Br,"__esModule",{value:!0});Br.TransactionOptions=Br.TransactionVersion=void 0;var eI=N5(ke()),eh=Zf(),xa=class{constructor(e){if(e=Number(e),e<1)throw new eI.ErrTransactionVersionInvalid(e);this.value=e}static withDefaultVersion(){return new xa(eh.TRANSACTION_VERSION_DEFAULT)}static withTxHashSignVersion(){return new xa(eh.TRANSACTION_VERSION_TX_HASH_SIGN)}valueOf(){return this.value}};Br.TransactionVersion=xa;var Ta=class{constructor(e){if(e=Number(e),e<0)throw new eI.ErrTransactionOptionsInvalid(e);this.value=e}static withDefaultOptions(){return new Ta(eh.TRANSACTION_OPTIONS_DEFAULT)}static withTxHashSignOptions(){return new Ta(eh.TRANSACTION_OPTIONS_TX_HASH_SIGN)}valueOf(){return this.value}};Br.TransactionOptions=Ta});var nI=D(gi=>{"use strict";l();var D5=gi&&gi.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),O5=gi&&gi.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),B5=gi&&gi.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&D5(e,r,t);return O5(e,r),e};Object.defineProperty(gi,"__esModule",{value:!0});gi.Signature=void 0;var rI=B5(ke()),iI=64,Kr=class{constructor(e){if(this.valueHex="",!!e){if(typeof e=="string")return Kr.fromHex(e);if(e instanceof y.Buffer)return Kr.fromBuffer(e)}}static empty(){return new Kr}static fromHex(e){if(e.startsWith("0x")&&(e=e.slice(2)),!Kr.isValidHex(e))throw new rI.ErrSignatureCannotCreate(e);return Kr.fromValidHex(e)}static isValidHex(e){return y.Buffer.from(e,"hex").length==iI}static fromValidHex(e){let t=new Kr;return t.valueHex=e,t}static fromBuffer(e){if(e.length!=iI)throw new rI.ErrSignatureCannotCreate(e);return Kr.fromValidHex(e.toString("hex"))}hex(){return this.valueHex}};gi.Signature=Kr});var oI=D((zk,sI)=>{"use strict";l();sI.exports=M5;function M5(r,e){for(var t=new Array(arguments.length-1),i=0,n=2,s=!0;n{"use strict";l();var th=cI;th.length=function(e){var t=e.length;if(!t)return 0;for(var i=0;--t%4>1&&e.charAt(t)==="=";)++i;return Math.ceil(e.length*3)/4-i};var Na=new Array(64),uI=new Array(123);for(zr=0;zr<64;)uI[Na[zr]=zr<26?zr+65:zr<52?zr+71:zr<62?zr-4:zr-59|43]=zr++;var zr;th.encode=function(e,t,i){for(var n=null,s=[],o=0,a=0,u;t>2],u=(h&3)<<4,a=1;break;case 1:s[o++]=Na[u|h>>4],u=(h&15)<<2,a=2;break;case 2:s[o++]=Na[u|h>>6],s[o++]=Na[h&63],a=0;break}o>8191&&((n||(n=[])).push(String.fromCharCode.apply(String,s)),o=0)}return a&&(s[o++]=Na[u],s[o++]=61,a===1&&(s[o++]=61)),n?(o&&n.push(String.fromCharCode.apply(String,s.slice(0,o))),n.join("")):String.fromCharCode.apply(String,s.slice(0,o))};var aI="invalid encoding";th.decode=function(e,t,i){for(var n=i,s=0,o,a=0;a1)break;if((u=uI[u])===void 0)throw Error(aI);switch(s){case 0:o=u,s=1;break;case 1:t[i++]=o<<2|(u&48)>>4,o=u,s=2;break;case 2:t[i++]=(o&15)<<4|(u&60)>>2,o=u,s=3;break;case 3:t[i++]=(o&3)<<6|u,s=0;break}}if(s===1)throw Error(aI);return i-n};th.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var hI=D((Yk,fI)=>{"use strict";l();fI.exports=rh;function rh(){this._listeners={}}rh.prototype.on=function(e,t,i){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:i||this}),this};rh.prototype.off=function(e,t){if(e===void 0)this._listeners={};else if(t===void 0)this._listeners[e]=[];else for(var i=this._listeners[e],n=0;n{"use strict";l();vI.exports=dI(dI);function dI(r){return typeof Float32Array<"u"?function(){var e=new Float32Array([-0]),t=new Uint8Array(e.buffer),i=t[3]===128;function n(u,h,p){e[0]=u,h[p]=t[0],h[p+1]=t[1],h[p+2]=t[2],h[p+3]=t[3]}function s(u,h,p){e[0]=u,h[p]=t[3],h[p+1]=t[2],h[p+2]=t[1],h[p+3]=t[0]}r.writeFloatLE=i?n:s,r.writeFloatBE=i?s:n;function o(u,h){return t[0]=u[h],t[1]=u[h+1],t[2]=u[h+2],t[3]=u[h+3],e[0]}function a(u,h){return t[3]=u[h],t[2]=u[h+1],t[1]=u[h+2],t[0]=u[h+3],e[0]}r.readFloatLE=i?o:a,r.readFloatBE=i?a:o}():function(){function e(i,n,s,o){var a=n<0?1:0;if(a&&(n=-n),n===0)i(1/n>0?0:2147483648,s,o);else if(isNaN(n))i(2143289344,s,o);else if(n>34028234663852886e22)i((a<<31|2139095040)>>>0,s,o);else if(n<11754943508222875e-54)i((a<<31|Math.round(n/1401298464324817e-60))>>>0,s,o);else{var u=Math.floor(Math.log(n)/Math.LN2),h=Math.round(n*Math.pow(2,-u)*8388608)&8388607;i((a<<31|u+127<<23|h)>>>0,s,o)}}r.writeFloatLE=e.bind(null,pI),r.writeFloatBE=e.bind(null,gI);function t(i,n,s){var o=i(n,s),a=(o>>31)*2+1,u=o>>>23&255,h=o&8388607;return u===255?h?NaN:a*(1/0):u===0?a*1401298464324817e-60*h:a*Math.pow(2,u-150)*(h+8388608)}r.readFloatLE=t.bind(null,yI),r.readFloatBE=t.bind(null,mI)}(),typeof Float64Array<"u"?function(){var e=new Float64Array([-0]),t=new Uint8Array(e.buffer),i=t[7]===128;function n(u,h,p){e[0]=u,h[p]=t[0],h[p+1]=t[1],h[p+2]=t[2],h[p+3]=t[3],h[p+4]=t[4],h[p+5]=t[5],h[p+6]=t[6],h[p+7]=t[7]}function s(u,h,p){e[0]=u,h[p]=t[7],h[p+1]=t[6],h[p+2]=t[5],h[p+3]=t[4],h[p+4]=t[3],h[p+5]=t[2],h[p+6]=t[1],h[p+7]=t[0]}r.writeDoubleLE=i?n:s,r.writeDoubleBE=i?s:n;function o(u,h){return t[0]=u[h],t[1]=u[h+1],t[2]=u[h+2],t[3]=u[h+3],t[4]=u[h+4],t[5]=u[h+5],t[6]=u[h+6],t[7]=u[h+7],e[0]}function a(u,h){return t[7]=u[h],t[6]=u[h+1],t[5]=u[h+2],t[4]=u[h+3],t[3]=u[h+4],t[2]=u[h+5],t[1]=u[h+6],t[0]=u[h+7],e[0]}r.readDoubleLE=i?o:a,r.readDoubleBE=i?a:o}():function(){function e(i,n,s,o,a,u){var h=o<0?1:0;if(h&&(o=-o),o===0)i(0,a,u+n),i(1/o>0?0:2147483648,a,u+s);else if(isNaN(o))i(0,a,u+n),i(2146959360,a,u+s);else if(o>17976931348623157e292)i(0,a,u+n),i((h<<31|2146435072)>>>0,a,u+s);else{var p;if(o<22250738585072014e-324)p=o/5e-324,i(p>>>0,a,u+n),i((h<<31|p/4294967296)>>>0,a,u+s);else{var v=Math.floor(Math.log(o)/Math.LN2);v===1024&&(v=1023),p=o*Math.pow(2,-v),i(p*4503599627370496>>>0,a,u+n),i((h<<31|v+1023<<20|p*1048576&1048575)>>>0,a,u+s)}}}r.writeDoubleLE=e.bind(null,pI,0,4),r.writeDoubleBE=e.bind(null,gI,4,0);function t(i,n,s,o,a){var u=i(o,a+n),h=i(o,a+s),p=(h>>31)*2+1,v=h>>>20&2047,B=4294967296*(h&1048575)+u;return v===2047?B?NaN:p*(1/0):v===0?p*5e-324*B:p*Math.pow(2,v-1075)*(B+4503599627370496)}r.readDoubleLE=t.bind(null,yI,0,4),r.readDoubleBE=t.bind(null,mI,4,0)}(),r}function pI(r,e,t){e[t]=r&255,e[t+1]=r>>>8&255,e[t+2]=r>>>16&255,e[t+3]=r>>>24}function gI(r,e,t){e[t]=r>>>24,e[t+1]=r>>>16&255,e[t+2]=r>>>8&255,e[t+3]=r&255}function yI(r,e){return(r[e]|r[e+1]<<8|r[e+2]<<16|r[e+3]<<24)>>>0}function mI(r,e){return(r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3])>>>0}});var EI=D((exports,module)=>{"use strict";l();module.exports=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(r){}return null}});var _I=D(AI=>{"use strict";l();var Iy=AI;Iy.length=function(e){for(var t=0,i=0,n=0;n191&&u<224?o[a++]=(u&31)<<6|e[t++]&63:u>239&&u<365?(u=((u&7)<<18|(e[t++]&63)<<12|(e[t++]&63)<<6|e[t++]&63)-65536,o[a++]=55296+(u>>10),o[a++]=56320+(u&1023)):o[a++]=(u&15)<<12|(e[t++]&63)<<6|e[t++]&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))};Iy.write=function(e,t,i){for(var n=i,s,o,a=0;a>6|192,t[i++]=s&63|128):(s&64512)===55296&&((o=e.charCodeAt(a+1))&64512)===56320?(s=65536+((s&1023)<<10)+(o&1023),++a,t[i++]=s>>18|240,t[i++]=s>>12&63|128,t[i++]=s>>6&63|128,t[i++]=s&63|128):(t[i++]=s>>12|224,t[i++]=s>>6&63|128,t[i++]=s&63|128);return i-n}});var bI=D((iW,II)=>{"use strict";l();II.exports=P5;function P5(r,e,t){var i=t||8192,n=i>>>1,s=null,o=i;return function(u){if(u<1||u>n)return r(u);o+u>i&&(s=r(i),o=0);var h=e.call(s,o,o+=u);return o&7&&(o=(o|7)+1),h}}});var SI=D((sW,CI)=>{"use strict";l();CI.exports=Qt;var pc=Nn();function Qt(r,e){this.lo=r>>>0,this.hi=e>>>0}var ks=Qt.zero=new Qt(0,0);ks.toNumber=function(){return 0};ks.zzEncode=ks.zzDecode=function(){return this};ks.length=function(){return 1};var L5=Qt.zeroHash="\0\0\0\0\0\0\0\0";Qt.fromNumber=function(e){if(e===0)return ks;var t=e<0;t&&(e=-e);var i=e>>>0,n=(e-i)/4294967296>>>0;return t&&(n=~n>>>0,i=~i>>>0,++i>4294967295&&(i=0,++n>4294967295&&(n=0))),new Qt(i,n)};Qt.from=function(e){if(typeof e=="number")return Qt.fromNumber(e);if(pc.isString(e))if(pc.Long)e=pc.Long.fromString(e);else return Qt.fromNumber(parseInt(e,10));return e.low||e.high?new Qt(e.low>>>0,e.high>>>0):ks};Qt.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=~this.lo+1>>>0,i=~this.hi>>>0;return t||(i=i+1>>>0),-(t+i*4294967296)}return this.lo+this.hi*4294967296};Qt.prototype.toLong=function(e){return pc.Long?new pc.Long(this.lo|0,this.hi|0,Boolean(e)):{low:this.lo|0,high:this.hi|0,unsigned:Boolean(e)}};var Tn=String.prototype.charCodeAt;Qt.fromHash=function(e){return e===L5?ks:new Qt((Tn.call(e,0)|Tn.call(e,1)<<8|Tn.call(e,2)<<16|Tn.call(e,3)<<24)>>>0,(Tn.call(e,4)|Tn.call(e,5)<<8|Tn.call(e,6)<<16|Tn.call(e,7)<<24)>>>0)};Qt.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)};Qt.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this};Qt.prototype.zzDecode=function(){var e=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this};Qt.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,i=this.hi>>>24;return i===0?t===0?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:i<128?9:10}});var Nn=D(by=>{"use strict";l();var me=by;me.asPromise=oI();me.base64=lI();me.EventEmitter=hI();me.float=wI();me.inquire=EI();me.utf8=_I();me.pool=bI();me.LongBits=SI();me.isNode=Boolean(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);me.global=me.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||by;me.emptyArray=Object.freeze?Object.freeze([]):[];me.emptyObject=Object.freeze?Object.freeze({}):{};me.isInteger=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};me.isString=function(e){return typeof e=="string"||e instanceof String};me.isObject=function(e){return e&&typeof e=="object"};me.isset=me.isSet=function(e,t){var i=e[t];return i!=null&&e.hasOwnProperty(t)?typeof i!="object"||(Array.isArray(i)?i.length:Object.keys(i).length)>0:!1};me.Buffer=function(){try{var r=me.inquire("buffer").Buffer;return r.prototype.utf8Write?r:null}catch{return null}}();me._Buffer_from=null;me._Buffer_allocUnsafe=null;me.newBuffer=function(e){return typeof e=="number"?me.Buffer?me._Buffer_allocUnsafe(e):new me.Array(e):me.Buffer?me._Buffer_from(e):typeof Uint8Array>"u"?e:new Uint8Array(e)};me.Array=typeof Uint8Array<"u"?Uint8Array:Array;me.Long=me.global.dcodeIO&&me.global.dcodeIO.Long||me.global.Long||me.inquire("long");me.key2Re=/^true|false|0|1$/;me.key32Re=/^-?(?:0|[1-9][0-9]*)$/;me.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;me.longToHash=function(e){return e?me.LongBits.from(e).toHash():me.LongBits.zeroHash};me.longFromHash=function(e,t){var i=me.LongBits.fromHash(e);return me.Long?me.Long.fromBits(i.lo,i.hi,t):i.toNumber(Boolean(t))};function xI(r,e,t){for(var i=Object.keys(e),n=0;n-1;--s)if(t[n[s]]===1&&this[n[s]]!==void 0&&this[n[s]]!==null)return n[s]}};me.oneOfSetter=function(e){return function(t){for(var i=0;i{"use strict";l();BI.exports=Re;var Mr=Nn(),Cy,ih=Mr.LongBits,NI=Mr.base64,DI=Mr.utf8;function gc(r,e,t){this.fn=r,this.len=e,this.next=void 0,this.val=t}function xy(){}function R5(r){this.head=r.head,this.tail=r.tail,this.len=r.len,this.next=r.states}function Re(){this.len=0,this.head=new gc(xy,0,0),this.tail=this.head,this.states=null}var OI=function(){return Mr.Buffer?function(){return(Re.create=function(){return new Cy})()}:function(){return new Re}};Re.create=OI();Re.alloc=function(e){return new Mr.Array(e)};Mr.Array!==Array&&(Re.alloc=Mr.pool(Re.alloc,Mr.Array.prototype.subarray));Re.prototype._push=function(e,t,i){return this.tail=this.tail.next=new gc(e,t,i),this.len+=t,this};function Ty(r,e,t){e[t]=r&255}function F5(r,e,t){for(;r>127;)e[t++]=r&127|128,r>>>=7;e[t]=r}function Ny(r,e){this.len=r,this.next=void 0,this.val=e}Ny.prototype=Object.create(gc.prototype);Ny.prototype.fn=F5;Re.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new Ny((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this};Re.prototype.int32=function(e){return e<0?this._push(Dy,10,ih.fromNumber(e)):this.uint32(e)};Re.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function Dy(r,e,t){for(;r.hi;)e[t++]=r.lo&127|128,r.lo=(r.lo>>>7|r.hi<<25)>>>0,r.hi>>>=7;for(;r.lo>127;)e[t++]=r.lo&127|128,r.lo=r.lo>>>7;e[t++]=r.lo}Re.prototype.uint64=function(e){var t=ih.from(e);return this._push(Dy,t.length(),t)};Re.prototype.int64=Re.prototype.uint64;Re.prototype.sint64=function(e){var t=ih.from(e).zzEncode();return this._push(Dy,t.length(),t)};Re.prototype.bool=function(e){return this._push(Ty,1,e?1:0)};function Sy(r,e,t){e[t]=r&255,e[t+1]=r>>>8&255,e[t+2]=r>>>16&255,e[t+3]=r>>>24}Re.prototype.fixed32=function(e){return this._push(Sy,4,e>>>0)};Re.prototype.sfixed32=Re.prototype.fixed32;Re.prototype.fixed64=function(e){var t=ih.from(e);return this._push(Sy,4,t.lo)._push(Sy,4,t.hi)};Re.prototype.sfixed64=Re.prototype.fixed64;Re.prototype.float=function(e){return this._push(Mr.float.writeFloatLE,4,e)};Re.prototype.double=function(e){return this._push(Mr.float.writeDoubleLE,8,e)};var U5=Mr.Array.prototype.set?function(e,t,i){t.set(e,i)}:function(e,t,i){for(var n=0;n>>0;if(!t)return this._push(Ty,1,0);if(Mr.isString(e)){var i=Re.alloc(t=NI.length(e));NI.decode(e,i,0),e=i}return this.uint32(t)._push(U5,t,e)};Re.prototype.string=function(e){var t=DI.length(e);return t?this.uint32(t)._push(DI.write,t,e):this._push(Ty,1,0)};Re.prototype.fork=function(){return this.states=new R5(this),this.head=this.tail=new gc(xy,0,0),this.len=0,this};Re.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 gc(xy,0,0),this.len=0),this};Re.prototype.ldelim=function(){var e=this.head,t=this.tail,i=this.len;return this.reset().uint32(i),i&&(this.tail.next=e.next,this.tail=t,this.len+=i),this};Re.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),i=0;e;)e.fn(e.val,t,i),i+=e.len,e=e.next;return t};Re._configure=function(r){Cy=r,Re.create=OI(),Cy._configure()}});var LI=D((fW,PI)=>{"use strict";l();PI.exports=yi;var MI=Oy();(yi.prototype=Object.create(MI.prototype)).constructor=yi;var Dn=Nn();function yi(){MI.call(this)}yi._configure=function(){yi.alloc=Dn._Buffer_allocUnsafe,yi.writeBytesBuffer=Dn.Buffer&&Dn.Buffer.prototype instanceof Uint8Array&&Dn.Buffer.prototype.set.name==="set"?function(e,t,i){t.set(e,i)}:function(e,t,i){if(e.copy)e.copy(t,i,0,e.length);else for(var n=0;n>>0;return this.uint32(t),t&&this._push(yi.writeBytesBuffer,t,e),this};function q5(r,e,t){r.length<40?Dn.utf8.write(r,e,t):e.utf8Write?e.utf8Write(r,t):e.write(r,t)}yi.prototype.string=function(e){var t=Dn.Buffer.byteLength(e);return this.uint32(t),t&&this._push(q5,t,e),this};yi._configure()});var Py=D((dW,VI)=>{"use strict";l();VI.exports=ut;var mi=Nn(),My,UI=mi.LongBits,V5=mi.utf8;function $r(r,e){return RangeError("index out of range: "+r.pos+" + "+(e||1)+" > "+r.len)}function ut(r){this.buf=r,this.pos=0,this.len=r.length}var RI=typeof Uint8Array<"u"?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new ut(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new ut(e);throw Error("illegal buffer")},qI=function(){return mi.Buffer?function(t){return(ut.create=function(n){return mi.Buffer.isBuffer(n)?new My(n):RI(n)})(t)}:RI};ut.create=qI();ut.prototype._slice=mi.Array.prototype.subarray||mi.Array.prototype.slice;ut.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,$r(this,10);return e}}();ut.prototype.int32=function(){return this.uint32()|0};ut.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(e&1)|0};function By(){var r=new UI(0,0),e=0;if(this.len-this.pos>4){for(;e<4;++e)if(r.lo=(r.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return r;if(r.lo=(r.lo|(this.buf[this.pos]&127)<<28)>>>0,r.hi=(r.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return r;e=0}else{for(;e<3;++e){if(this.pos>=this.len)throw $r(this);if(r.lo=(r.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return r}return r.lo=(r.lo|(this.buf[this.pos++]&127)<>>0,r}if(this.len-this.pos>4){for(;e<5;++e)if(r.hi=(r.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return r}else for(;e<5;++e){if(this.pos>=this.len)throw $r(this);if(r.hi=(r.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return r}throw Error("invalid varint encoding")}ut.prototype.bool=function(){return this.uint32()!==0};function nh(r,e){return(r[e-4]|r[e-3]<<8|r[e-2]<<16|r[e-1]<<24)>>>0}ut.prototype.fixed32=function(){if(this.pos+4>this.len)throw $r(this,4);return nh(this.buf,this.pos+=4)};ut.prototype.sfixed32=function(){if(this.pos+4>this.len)throw $r(this,4);return nh(this.buf,this.pos+=4)|0};function FI(){if(this.pos+8>this.len)throw $r(this,8);return new UI(nh(this.buf,this.pos+=4),nh(this.buf,this.pos+=4))}ut.prototype.float=function(){if(this.pos+4>this.len)throw $r(this,4);var e=mi.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};ut.prototype.double=function(){if(this.pos+8>this.len)throw $r(this,4);var e=mi.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e};ut.prototype.bytes=function(){var e=this.uint32(),t=this.pos,i=this.pos+e;if(i>this.len)throw $r(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,i):t===i?new this.buf.constructor(0):this._slice.call(this.buf,t,i)};ut.prototype.string=function(){var e=this.bytes();return V5.read(e,0,e.length)};ut.prototype.skip=function(e){if(typeof e=="number"){if(this.pos+e>this.len)throw $r(this,e);this.pos+=e}else do if(this.pos>=this.len)throw $r(this);while(this.buf[this.pos++]&128);return this};ut.prototype.skipType=function(r){switch(r){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(r=this.uint32()&7)!==4;)this.skipType(r);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+r+" at offset "+this.pos)}return this};ut._configure=function(r){My=r,ut.create=qI(),My._configure();var e=mi.Long?"toLong":"toNumber";mi.merge(ut.prototype,{int64:function(){return By.call(this)[e](!1)},uint64:function(){return By.call(this)[e](!0)},sint64:function(){return By.call(this).zzDecode()[e](!1)},fixed64:function(){return FI.call(this)[e](!0)},sfixed64:function(){return FI.call(this)[e](!1)}})}});var GI=D((gW,jI)=>{"use strict";l();jI.exports=Ws;var QI=Py();(Ws.prototype=Object.create(QI.prototype)).constructor=Ws;var HI=Nn();function Ws(r){QI.call(this,r)}Ws._configure=function(){HI.Buffer&&(Ws.prototype._slice=HI.Buffer.prototype.slice)};Ws.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))};Ws._configure()});var zI=D((mW,KI)=>{"use strict";l();KI.exports=yc;var Ly=Nn();(yc.prototype=Object.create(Ly.EventEmitter.prototype)).constructor=yc;function yc(r,e,t){if(typeof r!="function")throw TypeError("rpcImpl must be a function");Ly.EventEmitter.call(this),this.rpcImpl=r,this.requestDelimited=Boolean(e),this.responseDelimited=Boolean(t)}yc.prototype.rpcCall=function r(e,t,i,n,s){if(!n)throw TypeError("request must be specified");var o=this;if(!s)return Ly.asPromise(r,o,e,t,i,n);if(!o.rpcImpl){setTimeout(function(){s(Error("already ended"))},0);return}try{return o.rpcImpl(e,t[o.requestDelimited?"encodeDelimited":"encode"](n).finish(),function(u,h){if(u)return o.emit("error",u,e),s(u);if(h===null){o.end(!0);return}if(!(h instanceof i))try{h=i[o.responseDelimited?"decodeDelimited":"decode"](h)}catch(p){return o.emit("error",p,e),s(p)}return o.emit("data",h,e),s(null,h)})}catch(a){o.emit("error",a,e),setTimeout(function(){s(a)},0);return}};yc.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var kI=D($I=>{"use strict";l();var H5=$I;H5.Service=zI()});var YI=D((AW,WI)=>{"use strict";l();WI.exports={}});var ZI=D(XI=>{"use strict";l();var pr=XI;pr.build="minimal";pr.Writer=Oy();pr.BufferWriter=LI();pr.Reader=Py();pr.BufferReader=GI();pr.util=Nn();pr.rpc=kI();pr.roots=YI();pr.configure=JI;function JI(){pr.util._configure(),pr.Writer._configure(pr.BufferWriter),pr.Reader._configure(pr.BufferReader)}JI()});var tb=D((CW,eb)=>{"use strict";l();eb.exports=ZI()});var ib=D((xW,rb)=>{"use strict";l();var Da=tb(),sh=Da.Reader,Q5=Da.Writer,le=Da.util,mc=Da.roots.default||(Da.roots.default={});mc.proto=function(){var r={};return r.Transaction=function(){function e(t){if(t)for(var i=Object.keys(t),n=0;n>>3){case 1:o.Nonce=i.uint64();break;case 2:o.Value=i.bytes();break;case 3:o.RcvAddr=i.bytes();break;case 4:o.RcvUserName=i.bytes();break;case 5:o.SndAddr=i.bytes();break;case 6:o.SndUserName=i.bytes();break;case 7:o.GasPrice=i.uint64();break;case 8:o.GasLimit=i.uint64();break;case 9:o.Data=i.bytes();break;case 10:o.ChainID=i.bytes();break;case 11:o.Version=i.uint32();break;case 12:o.Signature=i.bytes();break;case 13:o.Options=i.uint32();break;default:i.skipType(a&7);break}}return o},e.decodeDelimited=function(i){return i instanceof sh||(i=new sh(i)),this.decode(i,i.uint32())},e.verify=function(i){return typeof i!="object"||i===null?"object expected":i.Nonce!=null&&i.hasOwnProperty("Nonce")&&!le.isInteger(i.Nonce)&&!(i.Nonce&&le.isInteger(i.Nonce.low)&&le.isInteger(i.Nonce.high))?"Nonce: integer|Long expected":i.Value!=null&&i.hasOwnProperty("Value")&&!(i.Value&&typeof i.Value.length=="number"||le.isString(i.Value))?"Value: buffer expected":i.RcvAddr!=null&&i.hasOwnProperty("RcvAddr")&&!(i.RcvAddr&&typeof i.RcvAddr.length=="number"||le.isString(i.RcvAddr))?"RcvAddr: buffer expected":i.RcvUserName!=null&&i.hasOwnProperty("RcvUserName")&&!(i.RcvUserName&&typeof i.RcvUserName.length=="number"||le.isString(i.RcvUserName))?"RcvUserName: buffer expected":i.SndAddr!=null&&i.hasOwnProperty("SndAddr")&&!(i.SndAddr&&typeof i.SndAddr.length=="number"||le.isString(i.SndAddr))?"SndAddr: buffer expected":i.SndUserName!=null&&i.hasOwnProperty("SndUserName")&&!(i.SndUserName&&typeof i.SndUserName.length=="number"||le.isString(i.SndUserName))?"SndUserName: buffer expected":i.GasPrice!=null&&i.hasOwnProperty("GasPrice")&&!le.isInteger(i.GasPrice)&&!(i.GasPrice&&le.isInteger(i.GasPrice.low)&&le.isInteger(i.GasPrice.high))?"GasPrice: integer|Long expected":i.GasLimit!=null&&i.hasOwnProperty("GasLimit")&&!le.isInteger(i.GasLimit)&&!(i.GasLimit&&le.isInteger(i.GasLimit.low)&&le.isInteger(i.GasLimit.high))?"GasLimit: integer|Long expected":i.Data!=null&&i.hasOwnProperty("Data")&&!(i.Data&&typeof i.Data.length=="number"||le.isString(i.Data))?"Data: buffer expected":i.ChainID!=null&&i.hasOwnProperty("ChainID")&&!(i.ChainID&&typeof i.ChainID.length=="number"||le.isString(i.ChainID))?"ChainID: buffer expected":i.Version!=null&&i.hasOwnProperty("Version")&&!le.isInteger(i.Version)?"Version: integer expected":i.Signature!=null&&i.hasOwnProperty("Signature")&&!(i.Signature&&typeof i.Signature.length=="number"||le.isString(i.Signature))?"Signature: buffer expected":i.Options!=null&&i.hasOwnProperty("Options")&&!le.isInteger(i.Options)?"Options: integer expected":null},e.fromObject=function(i){if(i instanceof mc.proto.Transaction)return i;var n=new mc.proto.Transaction;return i.Nonce!=null&&(le.Long?(n.Nonce=le.Long.fromValue(i.Nonce)).unsigned=!0:typeof i.Nonce=="string"?n.Nonce=parseInt(i.Nonce,10):typeof i.Nonce=="number"?n.Nonce=i.Nonce:typeof i.Nonce=="object"&&(n.Nonce=new le.LongBits(i.Nonce.low>>>0,i.Nonce.high>>>0).toNumber(!0))),i.Value!=null&&(typeof i.Value=="string"?le.base64.decode(i.Value,n.Value=le.newBuffer(le.base64.length(i.Value)),0):i.Value.length&&(n.Value=i.Value)),i.RcvAddr!=null&&(typeof i.RcvAddr=="string"?le.base64.decode(i.RcvAddr,n.RcvAddr=le.newBuffer(le.base64.length(i.RcvAddr)),0):i.RcvAddr.length&&(n.RcvAddr=i.RcvAddr)),i.RcvUserName!=null&&(typeof i.RcvUserName=="string"?le.base64.decode(i.RcvUserName,n.RcvUserName=le.newBuffer(le.base64.length(i.RcvUserName)),0):i.RcvUserName.length&&(n.RcvUserName=i.RcvUserName)),i.SndAddr!=null&&(typeof i.SndAddr=="string"?le.base64.decode(i.SndAddr,n.SndAddr=le.newBuffer(le.base64.length(i.SndAddr)),0):i.SndAddr.length&&(n.SndAddr=i.SndAddr)),i.SndUserName!=null&&(typeof i.SndUserName=="string"?le.base64.decode(i.SndUserName,n.SndUserName=le.newBuffer(le.base64.length(i.SndUserName)),0):i.SndUserName.length&&(n.SndUserName=i.SndUserName)),i.GasPrice!=null&&(le.Long?(n.GasPrice=le.Long.fromValue(i.GasPrice)).unsigned=!0:typeof i.GasPrice=="string"?n.GasPrice=parseInt(i.GasPrice,10):typeof i.GasPrice=="number"?n.GasPrice=i.GasPrice:typeof i.GasPrice=="object"&&(n.GasPrice=new le.LongBits(i.GasPrice.low>>>0,i.GasPrice.high>>>0).toNumber(!0))),i.GasLimit!=null&&(le.Long?(n.GasLimit=le.Long.fromValue(i.GasLimit)).unsigned=!0:typeof i.GasLimit=="string"?n.GasLimit=parseInt(i.GasLimit,10):typeof i.GasLimit=="number"?n.GasLimit=i.GasLimit:typeof i.GasLimit=="object"&&(n.GasLimit=new le.LongBits(i.GasLimit.low>>>0,i.GasLimit.high>>>0).toNumber(!0))),i.Data!=null&&(typeof i.Data=="string"?le.base64.decode(i.Data,n.Data=le.newBuffer(le.base64.length(i.Data)),0):i.Data.length&&(n.Data=i.Data)),i.ChainID!=null&&(typeof i.ChainID=="string"?le.base64.decode(i.ChainID,n.ChainID=le.newBuffer(le.base64.length(i.ChainID)),0):i.ChainID.length&&(n.ChainID=i.ChainID)),i.Version!=null&&(n.Version=i.Version>>>0),i.Signature!=null&&(typeof i.Signature=="string"?le.base64.decode(i.Signature,n.Signature=le.newBuffer(le.base64.length(i.Signature)),0):i.Signature.length&&(n.Signature=i.Signature)),i.Options!=null&&(n.Options=i.Options>>>0),n},e.toObject=function(i,n){n||(n={});var s={};if(n.defaults){if(le.Long){var o=new le.Long(0,0,!0);s.Nonce=n.longs===String?o.toString():n.longs===Number?o.toNumber():o}else s.Nonce=n.longs===String?"0":0;if(n.bytes===String?s.Value="":(s.Value=[],n.bytes!==Array&&(s.Value=le.newBuffer(s.Value))),n.bytes===String?s.RcvAddr="":(s.RcvAddr=[],n.bytes!==Array&&(s.RcvAddr=le.newBuffer(s.RcvAddr))),n.bytes===String?s.RcvUserName="":(s.RcvUserName=[],n.bytes!==Array&&(s.RcvUserName=le.newBuffer(s.RcvUserName))),n.bytes===String?s.SndAddr="":(s.SndAddr=[],n.bytes!==Array&&(s.SndAddr=le.newBuffer(s.SndAddr))),n.bytes===String?s.SndUserName="":(s.SndUserName=[],n.bytes!==Array&&(s.SndUserName=le.newBuffer(s.SndUserName))),le.Long){var o=new le.Long(0,0,!0);s.GasPrice=n.longs===String?o.toString():n.longs===Number?o.toNumber():o}else s.GasPrice=n.longs===String?"0":0;if(le.Long){var o=new le.Long(0,0,!0);s.GasLimit=n.longs===String?o.toString():n.longs===Number?o.toNumber():o}else s.GasLimit=n.longs===String?"0":0;n.bytes===String?s.Data="":(s.Data=[],n.bytes!==Array&&(s.Data=le.newBuffer(s.Data))),n.bytes===String?s.ChainID="":(s.ChainID=[],n.bytes!==Array&&(s.ChainID=le.newBuffer(s.ChainID))),s.Version=0,n.bytes===String?s.Signature="":(s.Signature=[],n.bytes!==Array&&(s.Signature=le.newBuffer(s.Signature))),s.Options=0}return i.Nonce!=null&&i.hasOwnProperty("Nonce")&&(typeof i.Nonce=="number"?s.Nonce=n.longs===String?String(i.Nonce):i.Nonce:s.Nonce=n.longs===String?le.Long.prototype.toString.call(i.Nonce):n.longs===Number?new le.LongBits(i.Nonce.low>>>0,i.Nonce.high>>>0).toNumber(!0):i.Nonce),i.Value!=null&&i.hasOwnProperty("Value")&&(s.Value=n.bytes===String?le.base64.encode(i.Value,0,i.Value.length):n.bytes===Array?Array.prototype.slice.call(i.Value):i.Value),i.RcvAddr!=null&&i.hasOwnProperty("RcvAddr")&&(s.RcvAddr=n.bytes===String?le.base64.encode(i.RcvAddr,0,i.RcvAddr.length):n.bytes===Array?Array.prototype.slice.call(i.RcvAddr):i.RcvAddr),i.RcvUserName!=null&&i.hasOwnProperty("RcvUserName")&&(s.RcvUserName=n.bytes===String?le.base64.encode(i.RcvUserName,0,i.RcvUserName.length):n.bytes===Array?Array.prototype.slice.call(i.RcvUserName):i.RcvUserName),i.SndAddr!=null&&i.hasOwnProperty("SndAddr")&&(s.SndAddr=n.bytes===String?le.base64.encode(i.SndAddr,0,i.SndAddr.length):n.bytes===Array?Array.prototype.slice.call(i.SndAddr):i.SndAddr),i.SndUserName!=null&&i.hasOwnProperty("SndUserName")&&(s.SndUserName=n.bytes===String?le.base64.encode(i.SndUserName,0,i.SndUserName.length):n.bytes===Array?Array.prototype.slice.call(i.SndUserName):i.SndUserName),i.GasPrice!=null&&i.hasOwnProperty("GasPrice")&&(typeof i.GasPrice=="number"?s.GasPrice=n.longs===String?String(i.GasPrice):i.GasPrice:s.GasPrice=n.longs===String?le.Long.prototype.toString.call(i.GasPrice):n.longs===Number?new le.LongBits(i.GasPrice.low>>>0,i.GasPrice.high>>>0).toNumber(!0):i.GasPrice),i.GasLimit!=null&&i.hasOwnProperty("GasLimit")&&(typeof i.GasLimit=="number"?s.GasLimit=n.longs===String?String(i.GasLimit):i.GasLimit:s.GasLimit=n.longs===String?le.Long.prototype.toString.call(i.GasLimit):n.longs===Number?new le.LongBits(i.GasLimit.low>>>0,i.GasLimit.high>>>0).toNumber(!0):i.GasLimit),i.Data!=null&&i.hasOwnProperty("Data")&&(s.Data=n.bytes===String?le.base64.encode(i.Data,0,i.Data.length):n.bytes===Array?Array.prototype.slice.call(i.Data):i.Data),i.ChainID!=null&&i.hasOwnProperty("ChainID")&&(s.ChainID=n.bytes===String?le.base64.encode(i.ChainID,0,i.ChainID.length):n.bytes===Array?Array.prototype.slice.call(i.ChainID):i.ChainID),i.Version!=null&&i.hasOwnProperty("Version")&&(s.Version=i.Version),i.Signature!=null&&i.hasOwnProperty("Signature")&&(s.Signature=n.bytes===String?le.base64.encode(i.Signature,0,i.Signature.length):n.bytes===Array?Array.prototype.slice.call(i.Signature):i.Signature),i.Options!=null&&i.hasOwnProperty("Options")&&(s.Options=i.Options),s},e.prototype.toJSON=function(){return this.constructor.toObject(this,Da.util.toJSONOptions)},e}(),r}();rb.exports=mc});var ob=D(Pr=>{"use strict";l();var j5=Pr&&Pr.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),G5=Pr&&Pr.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),K5=Pr&&Pr.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&j5(e,r,t);return G5(e,r),e},z5=Pr&&Pr.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Pr,"__esModule",{value:!0});Pr.ProtoSerializer=void 0;var $5=K5(ke()),k5=Vg(),nb=ib(),W5=Zf(),sb=Hr(),Y5=z5(Vr()),Ry=class{serializeTransaction(e){let t=new sb.Address(e.getReceiver().bech32()).pubkey(),i=new sb.Address(e.getSender().bech32()).pubkey(),n=new nb.proto.Transaction({Nonce:e.getNonce().valueOf()?e.getNonce().valueOf():void 0,Value:this.serializeTransactionValue(e.getValue()),RcvAddr:t,RcvUserName:null,SndAddr:i,SndUserName:null,GasPrice:e.getGasPrice().valueOf(),GasLimit:e.getGasLimit().valueOf(),Data:e.getData().length()==0?null:e.getData().valueOf(),ChainID:y.Buffer.from(e.getChainID().valueOf()),Version:e.getVersion().valueOf(),Signature:y.Buffer.from(e.getSignature().hex(),"hex")});e.getOptions().valueOf()!==W5.TRANSACTION_OPTIONS_DEFAULT&&(n.Options=e.getOptions().valueOf());let s=nb.proto.Transaction.encode(n).finish();return y.Buffer.from(s)}serializeTransactionValue(e){let t=new Y5.default(e.toString());if(t.isZero())return y.Buffer.from([0,0]);let i=k5.bigIntToBuffer(t);return i=y.Buffer.concat([y.Buffer.from([0]),i]),i}deserializeTransaction(e){throw new $5.ErrUnsupportedOperation("deserializeTransaction")}};Pr.ProtoSerializer=Ry});var ab=D(Ys=>{"use strict";l();var J5=Ys&&Ys.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),X5=Ys&&Ys.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&J5(e,r,t)};Object.defineProperty(Ys,"__esModule",{value:!0});X5(ob(),Ys)});var ub=D(vi=>{"use strict";l();var Z5=vi&&vi.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),eL=vi&&vi.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),tL=vi&&vi.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&Z5(e,r,t);return eL(e,r),e};Object.defineProperty(vi,"__esModule",{value:!0});vi.Hash=void 0;var rL=tL(ke()),vc=class{constructor(e){if(!e)this.hash=y.Buffer.from([]);else if(e instanceof y.Buffer)this.hash=e;else if(typeof e=="string")this.hash=y.Buffer.from(e,"hex");else throw new rL.ErrBadType("hash","buffer | string",e)}static empty(){return new vc(y.Buffer.from([]))}isEmpty(){return this.hash.length==0}toString(){return this.hex()}hex(){return this.hash.toString("hex")}valueOf(){return this.hash}};vi.Hash=vc});var Fy=D((LW,cb)=>{l();Ki.notEqual=nL;Ki.notOk=sL;Ki.equal=iL;Ki.ok=Ki;cb.exports=Ki;function iL(r,e,t){Ki(r==e,t)}function nL(r,e,t){Ki(r!=e,t)}function sL(r,e){Ki(!r,e)}function Ki(r,e){if(!r)throw new Error(e||"AssertionError")}});var Sb=D(Pa=>{"use strict";l();var Uy=b0(),Ba=S0(),lb=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Pa.Buffer=re;Pa.SlowBuffer=fL;Pa.INSPECT_MAX_BYTES=50;var oh=2147483647;Pa.kMaxLength=oh;re.TYPED_ARRAY_SUPPORT=oL();!re.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 oL(){try{let r=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(r,e),r.foo()===42}catch{return!1}}Object.defineProperty(re.prototype,"parent",{enumerable:!0,get:function(){if(!!re.isBuffer(this))return this.buffer}});Object.defineProperty(re.prototype,"offset",{enumerable:!0,get:function(){if(!!re.isBuffer(this))return this.byteOffset}});function zi(r){if(r>oh)throw new RangeError('The value "'+r+'" is invalid for option "size"');let e=new Uint8Array(r);return Object.setPrototypeOf(e,re.prototype),e}function re(r,e,t){if(typeof r=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return Qy(r)}return pb(r,e,t)}re.poolSize=8192;function pb(r,e,t){if(typeof r=="string")return uL(r,e);if(ArrayBuffer.isView(r))return cL(r);if(r==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r);if(wi(r,ArrayBuffer)||r&&wi(r.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(wi(r,SharedArrayBuffer)||r&&wi(r.buffer,SharedArrayBuffer)))return Vy(r,e,t);if(typeof r=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let i=r.valueOf&&r.valueOf();if(i!=null&&i!==r)return re.from(i,e,t);let n=lL(r);if(n)return n;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return re.from(r[Symbol.toPrimitive]("string"),e,t);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r)}re.from=function(r,e,t){return pb(r,e,t)};Object.setPrototypeOf(re.prototype,Uint8Array.prototype);Object.setPrototypeOf(re,Uint8Array);function gb(r){if(typeof r!="number")throw new TypeError('"size" argument must be of type number');if(r<0)throw new RangeError('The value "'+r+'" is invalid for option "size"')}function aL(r,e,t){return gb(r),r<=0?zi(r):e!==void 0?typeof t=="string"?zi(r).fill(e,t):zi(r).fill(e):zi(r)}re.alloc=function(r,e,t){return aL(r,e,t)};function Qy(r){return gb(r),zi(r<0?0:jy(r)|0)}re.allocUnsafe=function(r){return Qy(r)};re.allocUnsafeSlow=function(r){return Qy(r)};function uL(r,e){if((typeof e!="string"||e==="")&&(e="utf8"),!re.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let t=yb(r,e)|0,i=zi(t),n=i.write(r,e);return n!==t&&(i=i.slice(0,n)),i}function qy(r){let e=r.length<0?0:jy(r.length)|0,t=zi(e);for(let i=0;i=oh)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+oh.toString(16)+" bytes");return r|0}function fL(r){return+r!=r&&(r=0),re.alloc(+r)}re.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==re.prototype};re.compare=function(e,t){if(wi(e,Uint8Array)&&(e=re.from(e,e.offset,e.byteLength)),wi(t,Uint8Array)&&(t=re.from(t,t.offset,t.byteLength)),!re.isBuffer(e)||!re.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let i=e.length,n=t.length;for(let s=0,o=Math.min(i,n);sn.length?(re.isBuffer(o)||(o=re.from(o)),o.copy(n,s)):Uint8Array.prototype.set.call(n,o,s);else if(re.isBuffer(o))o.copy(n,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return n};function yb(r,e){if(re.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||wi(r,ArrayBuffer))return r.byteLength;if(typeof r!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof r);let t=r.length,i=arguments.length>2&&arguments[2]===!0;if(!i&&t===0)return 0;let n=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return Hy(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return Cb(r).length;default:if(n)return i?-1:Hy(r).length;e=(""+e).toLowerCase(),n=!0}}re.byteLength=yb;function hL(r,e,t){let i=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0,e>>>=0,t<=e))return"";for(r||(r="utf8");;)switch(r){case"hex":return _L(this,e,t);case"utf8":case"utf-8":return vb(this,e,t);case"ascii":return EL(this,e,t);case"latin1":case"binary":return AL(this,e,t);case"base64":return vL(this,e,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return IL(this,e,t);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),i=!0}}re.prototype._isBuffer=!0;function Js(r,e,t){let i=r[e];r[e]=r[t],r[t]=i}re.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 t=0;tt&&(e+=" ... "),""};lb&&(re.prototype[lb]=re.prototype.inspect);re.prototype.compare=function(e,t,i,n,s){if(wi(e,Uint8Array)&&(e=re.from(e,e.offset,e.byteLength)),!re.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(t===void 0&&(t=0),i===void 0&&(i=e?e.length:0),n===void 0&&(n=0),s===void 0&&(s=this.length),t<0||i>e.length||n<0||s>this.length)throw new RangeError("out of range index");if(n>=s&&t>=i)return 0;if(n>=s)return-1;if(t>=i)return 1;if(t>>>=0,i>>>=0,n>>>=0,s>>>=0,this===e)return 0;let o=s-n,a=i-t,u=Math.min(o,a),h=this.slice(n,s),p=e.slice(t,i);for(let v=0;v2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,Ky(t)&&(t=n?0:r.length-1),t<0&&(t=r.length+t),t>=r.length){if(n)return-1;t=r.length-1}else if(t<0)if(n)t=0;else return-1;if(typeof e=="string"&&(e=re.from(e,i)),re.isBuffer(e))return e.length===0?-1:fb(r,e,t,i,n);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?n?Uint8Array.prototype.indexOf.call(r,e,t):Uint8Array.prototype.lastIndexOf.call(r,e,t):fb(r,[e],t,i,n);throw new TypeError("val must be string, number or Buffer")}function fb(r,e,t,i,n){let s=1,o=r.length,a=e.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(r.length<2||e.length<2)return-1;s=2,o/=2,a/=2,t/=2}function u(p,v){return s===1?p[v]:p.readUInt16BE(v*s)}let h;if(n){let p=-1;for(h=t;ho&&(t=o-a),h=t;h>=0;h--){let p=!0;for(let v=0;vn&&(i=n)):i=n;let s=e.length;i>s/2&&(i=s/2);let o;for(o=0;o>>0,isFinite(i)?(i=i>>>0,n===void 0&&(n="utf8")):(n=i,i=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let s=this.length-t;if((i===void 0||i>s)&&(i=s),e.length>0&&(i<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=!1;for(;;)switch(n){case"hex":return dL(this,e,t,i);case"utf8":case"utf-8":return pL(this,e,t,i);case"ascii":case"latin1":case"binary":return gL(this,e,t,i);case"base64":return yL(this,e,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return mL(this,e,t,i);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}};re.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function vL(r,e,t){return e===0&&t===r.length?Uy.fromByteArray(r):Uy.fromByteArray(r.slice(e,t))}function vb(r,e,t){t=Math.min(r.length,t);let i=[],n=e;for(;n239?4:s>223?3:s>191?2:1;if(n+a<=t){let u,h,p,v;switch(a){case 1:s<128&&(o=s);break;case 2:u=r[n+1],(u&192)===128&&(v=(s&31)<<6|u&63,v>127&&(o=v));break;case 3:u=r[n+1],h=r[n+2],(u&192)===128&&(h&192)===128&&(v=(s&15)<<12|(u&63)<<6|h&63,v>2047&&(v<55296||v>57343)&&(o=v));break;case 4:u=r[n+1],h=r[n+2],p=r[n+3],(u&192)===128&&(h&192)===128&&(p&192)===128&&(v=(s&15)<<18|(u&63)<<12|(h&63)<<6|p&63,v>65535&&v<1114112&&(o=v))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,i.push(o>>>10&1023|55296),o=56320|o&1023),i.push(o),n+=a}return wL(i)}var hb=4096;function wL(r){let e=r.length;if(e<=hb)return String.fromCharCode.apply(String,r);let t="",i=0;for(;ii)&&(t=i);let n="";for(let s=e;si&&(e=i),t<0?(t+=i,t<0&&(t=0)):t>i&&(t=i),tt)throw new RangeError("Trying to access beyond buffer length")}re.prototype.readUintLE=re.prototype.readUIntLE=function(e,t,i){e=e>>>0,t=t>>>0,i||jt(e,t,this.length);let n=this[e],s=1,o=0;for(;++o>>0,t=t>>>0,i||jt(e,t,this.length);let n=this[e+--t],s=1;for(;t>0&&(s*=256);)n+=this[e+--t]*s;return n};re.prototype.readUint8=re.prototype.readUInt8=function(e,t){return e=e>>>0,t||jt(e,1,this.length),this[e]};re.prototype.readUint16LE=re.prototype.readUInt16LE=function(e,t){return e=e>>>0,t||jt(e,2,this.length),this[e]|this[e+1]<<8};re.prototype.readUint16BE=re.prototype.readUInt16BE=function(e,t){return e=e>>>0,t||jt(e,2,this.length),this[e]<<8|this[e+1]};re.prototype.readUint32LE=re.prototype.readUInt32LE=function(e,t){return e=e>>>0,t||jt(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};re.prototype.readUint32BE=re.prototype.readUInt32BE=function(e,t){return e=e>>>0,t||jt(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};re.prototype.readBigUInt64LE=On(function(e){e=e>>>0,Ma(e,"offset");let t=this[e],i=this[e+7];(t===void 0||i===void 0)&&wc(e,this.length-8);let n=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,s=this[++e]+this[++e]*2**8+this[++e]*2**16+i*2**24;return BigInt(n)+(BigInt(s)<>>0,Ma(e,"offset");let t=this[e],i=this[e+7];(t===void 0||i===void 0)&&wc(e,this.length-8);let n=t*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+i;return(BigInt(n)<>>0,t=t>>>0,i||jt(e,t,this.length);let n=this[e],s=1,o=0;for(;++o=s&&(n-=Math.pow(2,8*t)),n};re.prototype.readIntBE=function(e,t,i){e=e>>>0,t=t>>>0,i||jt(e,t,this.length);let n=t,s=1,o=this[e+--n];for(;n>0&&(s*=256);)o+=this[e+--n]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*t)),o};re.prototype.readInt8=function(e,t){return e=e>>>0,t||jt(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};re.prototype.readInt16LE=function(e,t){e=e>>>0,t||jt(e,2,this.length);let i=this[e]|this[e+1]<<8;return i&32768?i|4294901760:i};re.prototype.readInt16BE=function(e,t){e=e>>>0,t||jt(e,2,this.length);let i=this[e+1]|this[e]<<8;return i&32768?i|4294901760:i};re.prototype.readInt32LE=function(e,t){return e=e>>>0,t||jt(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};re.prototype.readInt32BE=function(e,t){return e=e>>>0,t||jt(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};re.prototype.readBigInt64LE=On(function(e){e=e>>>0,Ma(e,"offset");let t=this[e],i=this[e+7];(t===void 0||i===void 0)&&wc(e,this.length-8);let n=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(i<<24);return(BigInt(n)<>>0,Ma(e,"offset");let t=this[e],i=this[e+7];(t===void 0||i===void 0)&&wc(e,this.length-8);let n=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(n)<>>0,t||jt(e,4,this.length),Ba.read(this,e,!0,23,4)};re.prototype.readFloatBE=function(e,t){return e=e>>>0,t||jt(e,4,this.length),Ba.read(this,e,!1,23,4)};re.prototype.readDoubleLE=function(e,t){return e=e>>>0,t||jt(e,8,this.length),Ba.read(this,e,!0,52,8)};re.prototype.readDoubleBE=function(e,t){return e=e>>>0,t||jt(e,8,this.length),Ba.read(this,e,!1,52,8)};function gr(r,e,t,i,n,s){if(!re.isBuffer(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||er.length)throw new RangeError("Index out of range")}re.prototype.writeUintLE=re.prototype.writeUIntLE=function(e,t,i,n){if(e=+e,t=t>>>0,i=i>>>0,!n){let a=Math.pow(2,8*i)-1;gr(this,e,t,i,a,0)}let s=1,o=0;for(this[t]=e&255;++o>>0,i=i>>>0,!n){let a=Math.pow(2,8*i)-1;gr(this,e,t,i,a,0)}let s=i-1,o=1;for(this[t+s]=e&255;--s>=0&&(o*=256);)this[t+s]=e/o&255;return t+i};re.prototype.writeUint8=re.prototype.writeUInt8=function(e,t,i){return e=+e,t=t>>>0,i||gr(this,e,t,1,255,0),this[t]=e&255,t+1};re.prototype.writeUint16LE=re.prototype.writeUInt16LE=function(e,t,i){return e=+e,t=t>>>0,i||gr(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2};re.prototype.writeUint16BE=re.prototype.writeUInt16BE=function(e,t,i){return e=+e,t=t>>>0,i||gr(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2};re.prototype.writeUint32LE=re.prototype.writeUInt32LE=function(e,t,i){return e=+e,t=t>>>0,i||gr(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4};re.prototype.writeUint32BE=re.prototype.writeUInt32BE=function(e,t,i){return e=+e,t=t>>>0,i||gr(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function wb(r,e,t,i,n){bb(e,i,n,r,t,7);let s=Number(e&BigInt(4294967295));r[t++]=s,s=s>>8,r[t++]=s,s=s>>8,r[t++]=s,s=s>>8,r[t++]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return r[t++]=o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o,t}function Eb(r,e,t,i,n){bb(e,i,n,r,t,7);let s=Number(e&BigInt(4294967295));r[t+7]=s,s=s>>8,r[t+6]=s,s=s>>8,r[t+5]=s,s=s>>8,r[t+4]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return r[t+3]=o,o=o>>8,r[t+2]=o,o=o>>8,r[t+1]=o,o=o>>8,r[t]=o,t+8}re.prototype.writeBigUInt64LE=On(function(e,t=0){return wb(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))});re.prototype.writeBigUInt64BE=On(function(e,t=0){return Eb(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))});re.prototype.writeIntLE=function(e,t,i,n){if(e=+e,t=t>>>0,!n){let u=Math.pow(2,8*i-1);gr(this,e,t,i,u-1,-u)}let s=0,o=1,a=0;for(this[t]=e&255;++s>0)-a&255;return t+i};re.prototype.writeIntBE=function(e,t,i,n){if(e=+e,t=t>>>0,!n){let u=Math.pow(2,8*i-1);gr(this,e,t,i,u-1,-u)}let s=i-1,o=1,a=0;for(this[t+s]=e&255;--s>=0&&(o*=256);)e<0&&a===0&&this[t+s+1]!==0&&(a=1),this[t+s]=(e/o>>0)-a&255;return t+i};re.prototype.writeInt8=function(e,t,i){return e=+e,t=t>>>0,i||gr(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1};re.prototype.writeInt16LE=function(e,t,i){return e=+e,t=t>>>0,i||gr(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2};re.prototype.writeInt16BE=function(e,t,i){return e=+e,t=t>>>0,i||gr(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2};re.prototype.writeInt32LE=function(e,t,i){return e=+e,t=t>>>0,i||gr(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4};re.prototype.writeInt32BE=function(e,t,i){return e=+e,t=t>>>0,i||gr(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};re.prototype.writeBigInt64LE=On(function(e,t=0){return wb(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});re.prototype.writeBigInt64BE=On(function(e,t=0){return Eb(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Ab(r,e,t,i,n,s){if(t+i>r.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function _b(r,e,t,i,n){return e=+e,t=t>>>0,n||Ab(r,e,t,4,34028234663852886e22,-34028234663852886e22),Ba.write(r,e,t,i,23,4),t+4}re.prototype.writeFloatLE=function(e,t,i){return _b(this,e,t,!0,i)};re.prototype.writeFloatBE=function(e,t,i){return _b(this,e,t,!1,i)};function Ib(r,e,t,i,n){return e=+e,t=t>>>0,n||Ab(r,e,t,8,17976931348623157e292,-17976931348623157e292),Ba.write(r,e,t,i,52,8),t+8}re.prototype.writeDoubleLE=function(e,t,i){return Ib(this,e,t,!0,i)};re.prototype.writeDoubleBE=function(e,t,i){return Ib(this,e,t,!1,i)};re.prototype.copy=function(e,t,i,n){if(!re.isBuffer(e))throw new TypeError("argument should be a Buffer");if(i||(i=0),!n&&n!==0&&(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t>>0,i=i===void 0?this.length:i>>>0,e||(e=0);let s;if(typeof e=="number")for(s=t;s2**32?n=db(String(t)):typeof t=="bigint"&&(n=String(t),(t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(n=db(n)),n+="n"),i+=` It must be ${e}. Received ${n}`,i},RangeError);function db(r){let e="",t=r.length,i=r[0]==="-"?1:0;for(;t>=i+4;t-=3)e=`_${r.slice(t-3,t)}${e}`;return`${r.slice(0,t)}${e}`}function bL(r,e,t){Ma(e,"offset"),(r[e]===void 0||r[e+t]===void 0)&&wc(e,r.length-(t+1))}function bb(r,e,t,i,n,s){if(r>t||r3?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 <= ${t}${o}`,new Oa.ERR_OUT_OF_RANGE("value",a,r)}bL(i,n,s)}function Ma(r,e){if(typeof r!="number")throw new Oa.ERR_INVALID_ARG_TYPE(e,"number",r)}function wc(r,e,t){throw Math.floor(r)!==r?(Ma(r,t),new Oa.ERR_OUT_OF_RANGE(t||"offset","an integer",r)):e<0?new Oa.ERR_BUFFER_OUT_OF_BOUNDS:new Oa.ERR_OUT_OF_RANGE(t||"offset",`>= ${t?1:0} and <= ${e}`,r)}var CL=/[^+/0-9A-Za-z-_]/g;function SL(r){if(r=r.split("=")[0],r=r.trim().replace(CL,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function Hy(r,e){e=e||1/0;let t,i=r.length,n=null,s=[];for(let o=0;o55295&&t<57344){if(!n){if(t>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===i){(e-=3)>-1&&s.push(239,191,189);continue}n=t;continue}if(t<56320){(e-=3)>-1&&s.push(239,191,189),n=t;continue}t=(n-55296<<10|t-56320)+65536}else n&&(e-=3)>-1&&s.push(239,191,189);if(n=null,t<128){if((e-=1)<0)break;s.push(t)}else if(t<2048){if((e-=2)<0)break;s.push(t>>6|192,t&63|128)}else if(t<65536){if((e-=3)<0)break;s.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((e-=4)<0)break;s.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return s}function xL(r){let e=[];for(let t=0;t>8,n=t%256,s.push(n),s.push(i);return s}function Cb(r){return Uy.toByteArray(SL(r))}function ah(r,e,t,i){let n;for(n=0;n=e.length||n>=r.length);++n)e[n+t]=r[n];return n}function wi(r,e){return r instanceof e||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===e.name}function Ky(r){return r!==r}var NL=function(){let r="0123456789abcdef",e=new Array(256);for(let t=0;t<16;++t){let i=t*16;for(let n=0;n<16;++n)e[i+n]=r[t]+r[n]}return e}();function On(r){return typeof BigInt>"u"?DL:r}function DL(){throw new Error("BigInt not supported")}});var Tb=D((VW,xb)=>{l();xb.exports=zy;zy.supported=typeof WebAssembly<"u";function zy(r){if(!zy.supported)return null;var e=r&&r.imports,t=OL("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"),i=null,n={buffer:t,memory:null,exports:null,realloc:s,onload:o};return o(function(){}),n;function s(u){n.exports.memory.grow(Math.ceil(Math.abs(u-n.memory.length)/65536)),n.memory=new Uint8Array(n.exports.memory.buffer)}function o(u){if(n.exports)return u();if(i){i.then(u.bind(null,null)).catch(u);return}try{if(r&&r.async)throw new Error("async");a({instance:new WebAssembly.Instance(new WebAssembly.Module(t),e)})}catch{i=WebAssembly.instantiate(t,e).then(a)}o(u)}function a(u){n.exports=u.instance.exports,n.memory=n.exports.memory&&n.exports.memory.buffer&&new Uint8Array(n.exports.memory.buffer)}}function OL(r){return typeof atob=="function"?new Uint8Array(atob(r).split("").map(BL)):new(Sb()).Buffer(r,"base64")}function BL(r){return r.charCodeAt(0)}});var Lb=D((GW,Ai)=>{l();var Ei=Fy(),Ke=Tb()(),$i=64,uh=[];Ai.exports=Lr;var Nb=Ai.exports.BYTES_MIN=16,Db=Ai.exports.BYTES_MAX=64,QW=Ai.exports.BYTES=32,Ob=Ai.exports.KEYBYTES_MIN=16,Bb=Ai.exports.KEYBYTES_MAX=64,jW=Ai.exports.KEYBYTES=32,Mb=Ai.exports.SALTBYTES=16,Pb=Ai.exports.PERSONALBYTES=16;function Lr(r,e,t,i,n){if(!(this instanceof Lr))return new Lr(r,e,t,i,n);if(!(Ke&&Ke.exports))throw new Error("WASM not loaded. Wait for Blake2b.ready(cb)");r||(r=32),n!==!0&&(Ei(r>=Nb,"digestLength must be at least "+Nb+", was given "+r),Ei(r<=Db,"digestLength must be at most "+Db+", was given "+r),e!=null&&Ei(e.length>=Ob,"key must be at least "+Ob+", was given "+e.length),e!=null&&Ei(e.length<=Bb,"key must be at least "+Bb+", was given "+e.length),t!=null&&Ei(t.length===Mb,"salt must be exactly "+Mb+", was given "+t.length),i!=null&&Ei(i.length===Pb,"personal must be exactly "+Pb+", was given "+i.length)),uh.length||(uh.push($i),$i+=216),this.digestLength=r,this.finalized=!1,this.pointer=uh.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,t&&Ke.memory.set(t,32),i&&Ke.memory.set(i,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,$i,$i+e.length),Ke.memory[this.pointer+200]=128)}Lr.prototype.update=function(r){return Ei(this.finalized===!1,"Hash instance finalized"),Ei(r,"input must be TypedArray or Buffer"),$i+r.length>Ke.memory.length&&Ke.realloc($i+r.length),Ke.memory.set(r,$i),Ke.exports.blake2b_update(this.pointer,$i,$i+r.length),this};Lr.prototype.digest=function(r){if(Ei(this.finalized===!1,"Hash instance finalized"),this.finalized=!0,uh.push(this.pointer),Ke.exports.blake2b_final(this.pointer),!r||r==="binary")return Ke.memory.slice(this.pointer+128,this.pointer+128+this.digestLength);if(r==="hex")return PL(Ke.memory,this.pointer+128,this.digestLength);Ei(r.length>=this.digestLength,"input must be TypedArray or Buffer");for(var e=0;e{l();var Pn=Fy(),Ac=Lb();function ch(r,e,t){var i=r[e]+r[t],n=r[e+1]+r[t+1];i>=4294967296&&n++,r[e]=i,r[e+1]=n}function Rb(r,e,t,i){var n=r[e]+t;t<0&&(n+=4294967296);var s=r[e+1]+i;n>=4294967296&&s++,r[e]=n,r[e+1]=s}function jb(r,e){return r[e]^r[e+1]<<8^r[e+2]<<16^r[e+3]<<24}function Bn(r,e,t,i,n,s){var o=Ec[n],a=Ec[n+1],u=Ec[s],h=Ec[s+1];ch(Ce,r,e),Rb(Ce,r,o,a);var p=Ce[i]^Ce[r],v=Ce[i+1]^Ce[r+1];Ce[i]=v,Ce[i+1]=p,ch(Ce,t,i),p=Ce[e]^Ce[t],v=Ce[e+1]^Ce[t+1],Ce[e]=p>>>24^v<<8,Ce[e+1]=v>>>24^p<<8,ch(Ce,r,e),Rb(Ce,r,u,h),p=Ce[i]^Ce[r],v=Ce[i+1]^Ce[r+1],Ce[i]=p>>>16^v<<16,Ce[i+1]=v>>>16^p<<16,ch(Ce,t,i),p=Ce[e]^Ce[t],v=Ce[e+1]^Ce[t+1],Ce[e]=v>>>31^p<<1,Ce[e+1]=p>>>31^v<<1}var Gb=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),RL=[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],nr=new Uint8Array(RL.map(function(r){return r*2})),Ce=new Uint32Array(32),Ec=new Uint32Array(32);function Kb(r,e){var t=0;for(t=0;t<16;t++)Ce[t]=r.h[t],Ce[t+16]=Gb[t];for(Ce[24]=Ce[24]^r.t,Ce[25]=Ce[25]^r.t/4294967296,e&&(Ce[28]=~Ce[28],Ce[29]=~Ce[29]),t=0;t<32;t++)Ec[t]=jb(r.b,4*t);for(t=0;t<12;t++)Bn(0,8,16,24,nr[t*16+0],nr[t*16+1]),Bn(2,10,18,26,nr[t*16+2],nr[t*16+3]),Bn(4,12,20,28,nr[t*16+4],nr[t*16+5]),Bn(6,14,22,30,nr[t*16+6],nr[t*16+7]),Bn(0,10,20,30,nr[t*16+8],nr[t*16+9]),Bn(2,12,22,24,nr[t*16+10],nr[t*16+11]),Bn(4,14,16,26,nr[t*16+12],nr[t*16+13]),Bn(6,8,18,28,nr[t*16+14],nr[t*16+15]);for(t=0;t<16;t++)r.h[t]=r.h[t]^Ce[t]^Ce[t+16]}var Mn=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);function La(r,e,t,i){Mn.fill(0),this.b=new Uint8Array(128),this.h=new Uint32Array(16),this.t=0,this.c=0,this.outlen=r,Mn[0]=r,e&&(Mn[1]=e.length),Mn[2]=1,Mn[3]=1,t&&Mn.set(t,32),i&&Mn.set(i,48);for(var n=0;n<16;n++)this.h[n]=Gb[n]^jb(Mn,n*4);e&&(zb(this,e),this.c=128)}La.prototype.update=function(r){return Pn(r!=null,"input must be Uint8Array or Buffer"),zb(this,r),this};La.prototype.digest=function(r){var e=!r||r==="binary"||r==="hex"?new Uint8Array(this.outlen):r;return Pn(e.length>=this.outlen,"out must have at least outlen bytes of space"),FL(this,e),r==="hex"?UL(e):e};La.prototype.final=La.prototype.digest;La.ready=function(r){Ac.ready(function(){r()})};function zb(r,e){for(var t=0;t>2]>>8*(t&3);return e}function UL(r){for(var e="",t=0;t=Fb,"outlen must be at least "+Fb+", was given "+e),Pn(e<=Ub,"outlen must be at most "+Ub+", was given "+e),t!=null&&Pn(t.length>=qb,"key must be at least "+qb+", was given "+t.length),t!=null&&Pn(t.length<=Vb,"key must be at most "+Vb+", was given "+t.length),i!=null&&Pn(i.length===Hb,"salt must be exactly "+Hb+", was given "+i.length),n!=null&&Pn(n.length===Qb,"personal must be exactly "+Qb+", was given "+n.length)),new $b(e,t,i,n)};yr.exports.ready=function(r){Ac.ready(function(){r()})};yr.exports.WASM_SUPPORTED=Ac.SUPPORTED;yr.exports.WASM_LOADED=!1;var Fb=yr.exports.BYTES_MIN=16,Ub=yr.exports.BYTES_MAX=64,zW=yr.exports.BYTES=32,qb=yr.exports.KEYBYTES_MIN=16,Vb=yr.exports.KEYBYTES_MAX=64,$W=yr.exports.KEYBYTES=32,Hb=yr.exports.SALTBYTES=16,Qb=yr.exports.PERSONALBYTES=16;Ac.ready(function(r){r||(yr.exports.WASM_LOADED=!0,$b=Ac)})});var Wy=D(Rr=>{"use strict";l();var VL=Rr&&Rr.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),HL=Rr&&Rr.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),QL=Rr&&Rr.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&VL(e,r,t);return HL(e,r),e};Object.defineProperty(Rr,"__esModule",{value:!0});Rr.TransactionHash=Rr.Transaction=void 0;var _c=Vr(),$y=Hr(),ky=tI(),Wb=nI(),jL=xr(),Yb=dc(),GL=QL(ke()),KL=ab(),zL=ub(),$L=Zf(),kL=kb(),WL=32,Ic=class{constructor({nonce:e,value:t,receiver:i,sender:n,gasPrice:s,gasLimit:o,data:a,chainID:u,version:h,options:p}){this.nonce=e||0,this.value=t||0,this.sender=n,this.receiver=i,this.gasPrice=s||$L.TRANSACTION_MIN_GAS_PRICE,this.gasLimit=o,this.data=a||new Yb.TransactionPayload,this.chainID=u,this.version=h||ky.TransactionVersion.withDefaultVersion(),this.options=p||ky.TransactionOptions.withDefaultOptions(),this.signature=Wb.Signature.empty(),this.hash=Xs.empty()}getNonce(){return this.nonce}setNonce(e){this.nonce=e}getValue(){return this.value}setValue(e){this.value=e}getSender(){return this.sender}getReceiver(){return this.receiver}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}getOptions(){return this.options}getSignature(){return this.signature}getHash(){return jL.guardNotEmpty(this.hash,"hash"),this.hash}serializeForSigning(e){let t=this.toPlainObject(e);t.signature&&delete t.signature;let i=JSON.stringify(t);return y.Buffer.from(i)}toPlainObject(e){return{nonce:this.nonce.valueOf(),value:this.value.toString(),receiver:this.receiver.bech32(),sender:e?e.bech32():this.sender.bech32(),gasPrice:this.gasPrice.valueOf(),gasLimit:this.gasLimit.valueOf(),data:this.data.length()==0?void 0:this.data.encoded(),chainID:this.chainID.valueOf(),version:this.version.valueOf(),options:this.options.valueOf()==0?void 0:this.options.valueOf(),signature:this.signature.hex()?this.signature.hex():void 0}}static fromPlainObject(e){let t=new Ic({nonce:Number(e.nonce),value:new _c.BigNumber(e.value),receiver:$y.Address.fromString(e.receiver),sender:$y.Address.fromString(e.sender),gasPrice:Number(e.gasPrice),gasLimit:Number(e.gasLimit),data:new Yb.TransactionPayload(y.Buffer.from(e.data||"","base64")),chainID:String(e.chainID),version:new ky.TransactionVersion(e.version)});return e.signature&&t.applySignature(new Wb.Signature(e.signature),$y.Address.fromString(e.sender)),t}applySignature(e,t){this.signature=e,this.sender=t,this.hash=Xs.compute(this)}toSendable(){return this.toPlainObject()}computeFee(e){let t=e.MinGasLimit.valueOf()+this.data.length()*e.GasPerDataByte.valueOf();if(t>this.gasLimit.valueOf())throw new GL.ErrNotEnoughGas(this.gasLimit.valueOf());let i=new _c.BigNumber(this.gasPrice.valueOf()),n=new _c.BigNumber(t).multipliedBy(i);if(t===this.gasLimit.valueOf())return n;let s=new _c.BigNumber(this.gasLimit.valueOf()-t),o=i.multipliedBy(new _c.BigNumber(e.GasPriceModifier.valueOf())),a=s.multipliedBy(o);return n.plus(a)}};Rr.Transaction=Ic;var Xs=class extends zL.Hash{constructor(e){super(e)}static compute(e){let i=new KL.ProtoSerializer().serializeTransaction(e),n=kL(WL).update(i).digest("hex");return new Xs(n)}};Rr.TransactionHash=Xs});var Yy=D(eo=>{"use strict";l();Object.defineProperty(eo,"__esModule",{value:!0});eo.Logger=eo.LogLevel=void 0;var Zs;(function(r){r[r.Trace=0]="Trace",r[r.Debug=1]="Debug",r[r.Info=2]="Info",r[r.Warn=3]="Warn",r[r.Error=4]="Error",r[r.None=5]="None"})(Zs=eo.LogLevel||(eo.LogLevel={}));var kr=class{static setLevel(e){kr.logLevel=e}static trace(e,...t){kr.logLevel>=Zs.Debug||console.debug(e,t)}static debug(e,...t){kr.logLevel>=Zs.Debug||console.debug(e,t)}static info(e,...t){kr.logLevel>=Zs.Info||console.log(e,t)}static warn(e,...t){kr.logLevel>=Zs.Warn||console.warn(e,t)}static error(e,...t){kr.logLevel>=Zs.Error||console.error(e,t)}};eo.Logger=kr;kr.logLevel=Zs.Debug});var Jb=D(_i=>{"use strict";l();var YL=_i&&_i.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),JL=_i&&_i.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),XL=_i&&_i.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&YL(e,r,t);return JL(e,r),e};Object.defineProperty(_i,"__esModule",{value:!0});_i.AsyncTimer=void 0;var ZL=XL(ke()),eR=ke(),Jy=Yy(),Xy=class{constructor(e){this.timeoutHandle=null,this.rejectionFunc=null,this.name=e,this.correlationTag=0}start(e){if(this.timeoutHandle)throw new ZL.ErrAsyncTimerAlreadyRunning;return this.correlationTag++,Jy.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].start()`),new Promise((t,i)=>{this.rejectionFunc=i;let n=()=>{this.rejectionFunc=null,this.stop(),t()};this.timeoutHandle=setTimeout(n,e)})}abort(){Jy.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].abort()`),this.rejectionFunc&&(this.rejectionFunc(new eR.ErrAsyncTimerAborted),this.rejectionFunc=null),this.stop()}stop(){this.isStopped()||(Jy.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].stop()`),this.timeoutHandle&&(clearTimeout(this.timeoutHandle),this.timeoutHandle=null))}isStopped(){return!this.timeoutHandle}};_i.AsyncTimer=Xy});var em=D(Fa=>{"use strict";l();var Fr=Fa&&Fa.__awaiter||function(r,e,t,i){function n(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(p){try{h(i.next(p))}catch(v){o(v)}}function u(p){try{h(i.throw(p))}catch(v){o(v)}}function h(p){p.done?s(p.value):n(p.value).then(a,u)}h((i=i.apply(r,e||[])).next())})};Object.defineProperty(Fa,"__esModule",{value:!0});Fa.TransactionWatcher=void 0;var Xb=Jb(),Zb=Yy(),Ra=ke(),Ii=class{constructor(e,t=Ii.DefaultPollingInterval,i=Ii.DefaultTimeout){this.fetcher=new Zy(e),this.pollingInterval=t,this.timeout=i}awaitPending(e){return Fr(this,void 0,void 0,function*(){let t=s=>s.status.isPending(),i=()=>Fr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),n=()=>new Ra.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(t,i,n)})}awaitCompleted(e){return Fr(this,void 0,void 0,function*(){let t=s=>s.isCompleted,i=()=>Fr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),n=()=>new Ra.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(t,i,n)})}awaitAllEvents(e,t){return Fr(this,void 0,void 0,function*(){let i=o=>{let a=this.getAllTransactionEvents(o).map(h=>h.identifier);return t.every(h=>a.includes(h))},n=()=>Fr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),s=()=>new Ra.ErrExpectedTransactionEventsNotFound;return this.awaitConditionally(i,n,s)})}awaitAnyEvent(e,t){return Fr(this,void 0,void 0,function*(){let i=o=>{let a=this.getAllTransactionEvents(o).map(h=>h.identifier);return t.find(h=>a.includes(h))!=null},n=()=>Fr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),s=()=>new Ra.ErrExpectedTransactionEventsNotFound;return this.awaitConditionally(i,n,s)})}awaitOnCondition(e,t){return Fr(this,void 0,void 0,function*(){let i=()=>Fr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),n=()=>new Ra.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(t,i,n)})}awaitConditionally(e,t,i){return Fr(this,void 0,void 0,function*(){let n=new Xb.AsyncTimer("watcher:periodic"),s=new Xb.AsyncTimer("watcher:timeout"),o=!1,a,u=!1;for(s.start(this.timeout).finally(()=>{s.stop(),o=!0});!o;){yield n.start(this.pollingInterval);try{if(a=yield t(),u=e(a),u||o)break}catch(h){if(Zb.Logger.debug("TransactionWatcher.awaitConditionally(): cannot (yet) fetch data."),!(h instanceof Ra.Err))throw h}}if(s.isStopped()||s.stop(),!a||!u)throw i();return a})}getAllTransactionEvents(e){let t=[...e.logs.events];for(let i of e.contractResults.items)t.push(...i.logs.events);return t}};Fa.TransactionWatcher=Ii;Ii.DefaultPollingInterval=6e3;Ii.DefaultTimeout=Ii.DefaultPollingInterval*15;Ii.NoopOnStatusReceived=r=>{};var Zy=class{constructor(e){this.fetcher=e}getTransaction(e){return Fr(this,void 0,void 0,function*(){return Zb.Logger.debug(`transactionWatcher, getTransaction(${e})`),yield this.fetcher.getTransaction(e)})}}});var eC=D(bi=>{"use strict";l();var tR=bi&&bi.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),rR=bi&&bi.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),iR=bi&&bi.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&tR(e,r,t);return rR(e,r),e};Object.defineProperty(bi,"__esModule",{value:!0});bi.ContractFunction=void 0;var nR=iR(ke()),bc=class{constructor(e){if(this.name=e,e==null)throw new nR.ErrInvalidFunctionName}static none(){return new bc("untitled")}toString(){return this.name}valueOf(){return this.name}equals(e){return e?this.name==e.name:!1}};bi.ContractFunction=bc});var tC=D(Ua=>{"use strict";l();Object.defineProperty(Ua,"__esModule",{value:!0});Ua.Signature=Ua.Address=void 0;var tm=class{constructor(e){this.value=e}bech32(){return this.value}};Ua.Address=tm;var rm=class{constructor(e){this.value=e}hex(){return this.value}};Ua.Signature=rm});var rC=D(Cc=>{"use strict";l();Object.defineProperty(Cc,"__esModule",{value:!0});Cc.Operation=void 0;var sR;(function(r){r.Connect="connect",r.Logout="logout",r.SignTransactions="signTransactions",r.SignMessage="signMessage",r.CancelAction="cancelAction"})(sR=Cc.Operation||(Cc.Operation={}))});var iC=D(Ln=>{"use strict";l();Object.defineProperty(Ln,"__esModule",{value:!0});Ln.ErrAccountNotConnected=Ln.ErrCannotSignSingleTransaction=Ln.Err=void 0;var Sc=class extends Error{constructor(e,t){super(e),this.inner=void 0,this.inner=t}};Ln.Err=Sc;var im=class extends Sc{constructor(){super("Cannot sign single transaction.")}};Ln.ErrCannotSignSingleTransaction=im;var nm=class extends Sc{constructor(){super("Account is not connected.")}};Ln.ErrAccountNotConnected=nm});var sm=D(qa=>{"use strict";l();var Rn=qa&&qa.__awaiter||function(r,e,t,i){function n(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(p){try{h(i.next(p))}catch(v){o(v)}}function u(p){try{h(i.throw(p))}catch(v){o(v)}}function h(p){p.done?s(p.value):n(p.value).then(a,u)}h((i=i.apply(r,e||[])).next())})};Object.defineProperty(qa,"__esModule",{value:!0});qa.ExtensionProvider=void 0;var lh=tC(),xc=rC(),nC=iC(),Ci=class{constructor(){if(this.account={address:""},this.initialized=!1,Ci._instance)throw new Error("Error: Instantiation failed: Use ExtensionProvider.getInstance() instead of new.");Ci._instance=this}static getInstance(){return Ci._instance}setAddress(e){return this.account.address=e,Ci._instance}init(){return Rn(this,void 0,void 0,function*(){return window&&window.elrondWallet&&(this.initialized=!0),this.initialized})}login(e={}){return Rn(this,void 0,void 0,function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");let{token:t}=e,i=t||"";return yield this.startBgrMsgChannel(xc.Operation.Connect,i),this.account.address})}logout(){return Rn(this,void 0,void 0,function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");try{yield this.startBgrMsgChannel(xc.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 Rn(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 Rn(this,void 0,void 0,function*(){return Boolean(this.account.address)})}signTransaction(e){return Rn(this,void 0,void 0,function*(){this.ensureConnected();let t=yield this.signTransactions([e]);if(t.length!=1)throw new nC.ErrCannotSignSingleTransaction;return t[0]})}ensureConnected(){if(!this.account.address)throw new nC.ErrAccountNotConnected}signTransactions(e){return Rn(this,void 0,void 0,function*(){this.ensureConnected();let t=yield this.startBgrMsgChannel(xc.Operation.SignTransactions,{from:this.account.address,transactions:e.map(i=>i.toPlainObject())});try{for(let i=0;i{window.postMessage({target:"erdw-inpage",type:e,data:t},window.origin);let n=s=>{s.isTrusted&&s.data.target==="erdw-contentScript"&&(s.data.type==="connectResponse"?(s.data.data&&Boolean(s.data.data.address)&&(this.account=s.data.data),window.removeEventListener("message",n),i(s.data.data)):(window.removeEventListener("message",n),i(s.data.data)))};window.addEventListener("message",n,!1)})}};qa.ExtensionProvider=Ci;Ci._instance=new Ci});var cC=D((IY,uC)=>{"use strict";l();function oR(r){try{return JSON.stringify(r)}catch{return'"[Circular]"'}}uC.exports=aR;function aR(r,e,t){var i=t&&t.stringify||oR,n=1;if(typeof r=="object"&&r!==null){var s=e.length+n;if(s===1)return r;var o=new Array(s);o[0]=i(r);for(var a=1;a-1?v:0,r.charCodeAt(R+1)){case 100:case 102:if(p>=u||e[p]==null)break;v=u||e[p]==null)break;v=u||e[p]===void 0)break;v",v=R+2,R++;break}h+=i(e[p]),v=R+2,R++;break;case 115:if(p>=u)break;v{"use strict";l();var lC=cC();dC.exports=xi;var Tc=yR().console||{},uR={mapHttpRequest:yh,mapHttpResponse:yh,wrapRequestSerializer:om,wrapResponseSerializer:om,wrapErrorSerializer:om,req:yh,res:yh,err:hR};function xi(r){r=r||{},r.browser=r.browser||{};var e=r.browser.transmit;if(e&&typeof e.send!="function")throw Error("pino: transmit option must have a send function");var t=r.browser.write||Tc;r.browser.write&&(r.browser.asObject=!0);var i=r.serializers||{},n=Array.isArray(r.browser.serialize)?r.browser.serialize.filter(function(x){return x!=="!stdSerializers.err"}):r.browser.serialize===!0?Object.keys(i):!1,s=r.browser.serialize;Array.isArray(r.browser.serialize)&&r.browser.serialize.indexOf("!stdSerializers.err")>-1&&(s=!1);var o=["error","fatal","warn","info","debug","trace"];typeof t=="function"&&(t.error=t.fatal=t.warn=t.info=t.debug=t.trace=t),r.enabled===!1&&(r.level="silent");var a=r.level||"info",u=Object.create(t);u.log||(u.log=Nc),Object.defineProperty(u,"levelVal",{get:p}),Object.defineProperty(u,"level",{get:v,set:B});var h={transmit:e,serialize:n,asObject:r.browser.asObject,levels:o,timestamp:dR(r)};u.levels=xi.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=Nc,u.serializers=i,u._serialize=n,u._stdErrSerialize=s,u.child=R,e&&(u._logEvent=am());function p(){return this.level==="silent"?1/0:this.levels.values[this.level]}function v(){return this._level}function B(x){if(x!=="silent"&&!this.levels.values[x])throw Error("unknown level "+x);this._level=x,Va(h,u,"error","log"),Va(h,u,"fatal","error"),Va(h,u,"warn","error"),Va(h,u,"info","log"),Va(h,u,"debug","log"),Va(h,u,"trace","log")}function R(x){if(!x)throw new Error("missing bindings for child Pino");var V=x.serializers;if(n&&V){var H=Object.assign({},i,V),K=r.browser.serialize===!0?Object.keys(H):n;delete x.serializers,mh([x],K,H,this._stdErrSerialize)}function ie(k){this._childLevel=(k._childLevel|0)+1,this.error=Ha(k,x,"error"),this.fatal=Ha(k,x,"fatal"),this.warn=Ha(k,x,"warn"),this.info=Ha(k,x,"info"),this.debug=Ha(k,x,"debug"),this.trace=Ha(k,x,"trace"),H&&(this.serializers=H,this._serialize=K),e&&(this._logEvent=am([].concat(k._logEvent.bindings,x)))}return ie.prototype=this,new ie(this)}return u}xi.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"}};xi.stdSerializers=uR;xi.stdTimeFunctions=Object.assign({},{nullTime:fC,epochTime:hC,unixTime:pR,isoTime:gR});function Va(r,e,t,i){var n=Object.getPrototypeOf(e);e[t]=e.levelVal>e.levels.values[t]?Nc:n[t]?n[t]:Tc[t]||Tc[i]||Nc,cR(r,e,t)}function cR(r,e,t){!r.transmit&&e[t]===Nc||(e[t]=function(i){return function(){for(var s=r.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Tc?Tc:this,u=0;u-1&&s in t&&(r[n][s]=t[s](r[n][s]))}function Ha(r,e,t){return function(){var i=new Array(1+arguments.length);i[0]=e;for(var n=1;n{l();var pC,gC,yC,mC,vC,wC,EC,AC,_C,vh,cm,IC,bC,Qa,CC,SC,xC,TC,NC,DC,OC,BC,MC;(function(r){var e=typeof global=="object"?global:typeof self=="object"?self:typeof this=="object"?this:{};typeof define=="function"&&define.amd?define("tslib",["exports"],function(i){r(t(e,t(i)))}):typeof wh=="object"&&typeof wh.exports=="object"?r(t(e,t(wh.exports))):r(t(e));function t(i,n){return i!==e&&(typeof Object.create=="function"?Object.defineProperty(i,"__esModule",{value:!0}):i.__esModule=!0),function(s,o){return i[s]=n?n(s,o):o}}})(function(r){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])};pC=function(t,i){e(t,i);function n(){this.constructor=t}t.prototype=i===null?Object.create(i):(n.prototype=i.prototype,new n)},gC=Object.assign||function(t){for(var i,n=1,s=arguments.length;n=0;h--)(u=t[h])&&(a=(o<3?u(a):o>3?u(i,n,a):u(i,n))||a);return o>3&&a&&Object.defineProperty(i,n,a),a},vC=function(t,i){return function(n,s){i(n,s,t)}},wC=function(t,i){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,i)},EC=function(t,i,n,s){function o(a){return a instanceof n?a:new n(function(u){u(a)})}return new(n||(n=Promise))(function(a,u){function h(B){try{v(s.next(B))}catch(R){u(R)}}function p(B){try{v(s.throw(B))}catch(R){u(R)}}function v(B){B.done?a(B.value):o(B.value).then(h,p)}v((s=s.apply(t,i||[])).next())})},AC=function(t,i){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},s,o,a,u;return u={next:h(0),throw:h(1),return:h(2)},typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function h(v){return function(B){return p([v,B])}}function p(v){if(s)throw new TypeError("Generator is already executing.");for(;n;)try{if(s=1,o&&(a=v[0]&2?o.return:v[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,v[1])).done)return a;switch(o=0,a&&(v=[v[0]&2,a.value]),v[0]){case 0:case 1:a=v;break;case 4:return n.label++,{value:v[1],done:!1};case 5:n.label++,o=v[1],v=[0];continue;case 7:v=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(v[0]===6||v[0]===2)){n=0;continue}if(v[0]===3&&(!a||v[1]>a[0]&&v[1]=t.length&&(t=void 0),{value:t&&t[s++],done:!t}}};throw new TypeError(i?"Object is not iterable.":"Symbol.iterator is not defined.")},cm=function(t,i){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var s=n.call(t),o,a=[],u;try{for(;(i===void 0||i-- >0)&&!(o=s.next()).done;)a.push(o.value)}catch(h){u={error:h}}finally{try{o&&!o.done&&(n=s.return)&&n.call(s)}finally{if(u)throw u.error}}return a},IC=function(){for(var t=[],i=0;i1||h(x,V)})})}function h(x,V){try{p(s[x](V))}catch(H){R(a[0][3],H)}}function p(x){x.value instanceof Qa?Promise.resolve(x.value.v).then(v,B):R(a[0][2],x)}function v(x){h("next",x)}function B(x){h("throw",x)}function R(x,V){x(V),a.shift(),a.length&&h(a[0][0],a[0][1])}},SC=function(t){var i,n;return i={},s("next"),s("throw",function(o){throw o}),s("return"),i[Symbol.iterator]=function(){return this},i;function s(o,a){i[o]=t[o]?function(u){return(n=!n)?{value:Qa(t[o](u)),done:o==="return"}:a?a(u):u}:a}},xC=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=t[Symbol.asyncIterator],n;return i?i.call(t):(t=typeof vh=="function"?vh(t):t[Symbol.iterator](),n={},s("next"),s("throw"),s("return"),n[Symbol.asyncIterator]=function(){return this},n);function s(a){n[a]=t[a]&&function(u){return new Promise(function(h,p){u=t[a](u),o(h,p,u.done,u.value)})}}function o(a,u,h,p){Promise.resolve(p).then(function(v){a({value:v,done:h})},u)}},TC=function(t,i){return Object.defineProperty?Object.defineProperty(t,"raw",{value:i}):t.raw=i,t},NC=function(t){if(t&&t.__esModule)return t;var i={};if(t!=null)for(var n in t)Object.hasOwnProperty.call(t,n)&&(i[n]=t[n]);return i.default=t,i},DC=function(t){return t&&t.__esModule?t:{default:t}},OC=function(t,i){if(!i.has(t))throw new TypeError("attempted to get private field on non-instance");return i.get(t)},BC=function(t,i,n){if(!i.has(t))throw new TypeError("attempted to set private field on non-instance");return i.set(t,n),n},r("__extends",pC),r("__assign",gC),r("__rest",yC),r("__decorate",mC),r("__param",vC),r("__metadata",wC),r("__awaiter",EC),r("__generator",AC),r("__exportStar",_C),r("__createBinding",MC),r("__values",vh),r("__read",cm),r("__spread",IC),r("__spreadArrays",bC),r("__await",Qa),r("__asyncGenerator",CC),r("__asyncDelegator",SC),r("__asyncValues",xC),r("__makeTemplateObject",TC),r("__importStar",NC),r("__importDefault",DC),r("__classPrivateFieldGet",OC),r("__classPrivateFieldSet",BC)})});var PC=D((NY,lm)=>{l();(function(){"use strict";var r;function e(){}r=e,r.prototype.getItem=function(t){return this.hasOwnProperty(t)?String(this[t]):null},r.prototype.setItem=function(t,i){this[t]=String(i)},r.prototype.removeItem=function(t){delete this[t]},r.prototype.clear=function(){var t=this;Object.keys(t).forEach(function(i){t[i]=void 0,delete t[i]})},r.prototype.key=function(t){return t=t||0,Object.keys(this)[t]},r.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),global.localStorage?lm.exports=localStorage:lm.exports=new e})()});var fm=D(Ah=>{"use strict";l();Object.defineProperty(Ah,"__esModule",{value:!0});function mR(r){if(typeof r!="string")throw new Error(`Cannot safe json parse value of type ${typeof r}`);try{return JSON.parse(r)}catch{return r}}Ah.safeJsonParse=mR;function vR(r){return typeof r=="string"?r:JSON.stringify(r,(e,t)=>typeof t>"u"?null:t)}Ah.safeJsonStringify=vR});var LC=D(_h=>{"use strict";l();Object.defineProperty(_h,"__esModule",{value:!0});_h.IKeyValueStorage=void 0;var hm=class{};_h.IKeyValueStorage=hm});var RC=D(Ih=>{"use strict";l();Object.defineProperty(Ih,"__esModule",{value:!0});Ih.parseEntry=void 0;var wR=fm();function ER(r){var e;return[r[0],wR.safeJsonParse((e=r[1])!==null&&e!==void 0?e:"")]}Ih.parseEntry=ER});var UC=D(bh=>{"use strict";l();Object.defineProperty(bh,"__esModule",{value:!0});var FC=Eh();FC.__exportStar(LC(),bh);FC.__exportStar(RC(),bh)});var VC=D(Dc=>{"use strict";l();Object.defineProperty(Dc,"__esModule",{value:!0});Dc.KeyValueStorage=void 0;var ja=Eh(),AR=ja.__importDefault(PC()),qC=fm(),_R=UC(),Ch=class{constructor(){this.localStorage=AR.default}getKeys(){return ja.__awaiter(this,void 0,void 0,function*(){return Object.keys(this.localStorage)})}getEntries(){return ja.__awaiter(this,void 0,void 0,function*(){return Object.entries(this.localStorage).map(_R.parseEntry)})}getItem(e){return ja.__awaiter(this,void 0,void 0,function*(){let t=this.localStorage.getItem(e);if(t!==null)return qC.safeJsonParse(t)})}setItem(e,t){return ja.__awaiter(this,void 0,void 0,function*(){this.localStorage.setItem(e,qC.safeJsonStringify(t))})}removeItem(e){return ja.__awaiter(this,void 0,void 0,function*(){this.localStorage.removeItem(e)})}};Dc.KeyValueStorage=Ch;Dc.default=Ch});var Th=D((HY,dm)=>{"use strict";l();var Ga=typeof Reflect=="object"?Reflect:null,HC=Ga&&typeof Ga.apply=="function"?Ga.apply:function(e,t,i){return Function.prototype.apply.call(e,t,i)},Sh;Ga&&typeof Ga.ownKeys=="function"?Sh=Ga.ownKeys:Object.getOwnPropertySymbols?Sh=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Sh=function(e){return Object.getOwnPropertyNames(e)};function IR(r){console&&console.warn&&console.warn(r)}var jC=Number.isNaN||function(e){return e!==e};function He(){He.init.call(this)}dm.exports=He;dm.exports.once=xR;He.EventEmitter=He;He.prototype._events=void 0;He.prototype._eventsCount=0;He.prototype._maxListeners=void 0;var QC=10;function xh(r){if(typeof r!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof r)}Object.defineProperty(He,"defaultMaxListeners",{enumerable:!0,get:function(){return QC},set:function(r){if(typeof r!="number"||r<0||jC(r))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+r+".");QC=r}});He.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};He.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||jC(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 GC(r){return r._maxListeners===void 0?He.defaultMaxListeners:r._maxListeners}He.prototype.getMaxListeners=function(){return GC(this)};He.prototype.emit=function(e){for(var t=[],i=1;i0&&(o=t[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")HC(u,this,t);else for(var h=u.length,p=WC(u,h),i=0;i0&&o.length>n&&!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=r,a.type=e,a.count=o.length,IR(a)}return r}He.prototype.addListener=function(e,t){return KC(this,e,t,!1)};He.prototype.on=He.prototype.addListener;He.prototype.prependListener=function(e,t){return KC(this,e,t,!0)};function bR(){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 zC(r,e,t){var i={fired:!1,wrapFn:void 0,target:r,type:e,listener:t},n=bR.bind(i);return n.listener=t,i.wrapFn=n,n}He.prototype.once=function(e,t){return xh(t),this.on(e,zC(this,e,t)),this};He.prototype.prependOnceListener=function(e,t){return xh(t),this.prependListener(e,zC(this,e,t)),this};He.prototype.removeListener=function(e,t){var i,n,s,o,a;if(xh(t),n=this._events,n===void 0)return this;if(i=n[e],i===void 0)return this;if(i===t||i.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,i.listener||t));else if(typeof i!="function"){for(s=-1,o=i.length-1;o>=0;o--)if(i[o]===t||i[o].listener===t){a=i[o].listener,s=o;break}if(s<0)return this;s===0?i.shift():CR(i,s),i.length===1&&(n[e]=i[0]),n.removeListener!==void 0&&this.emit("removeListener",e,a||t)}return this};He.prototype.off=He.prototype.removeListener;He.prototype.removeAllListeners=function(e){var t,i,n;if(i=this._events,i===void 0)return this;if(i.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):i[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete i[e]),this;if(arguments.length===0){var s=Object.keys(i),o;for(n=0;n=0;n--)this.removeListener(e,t[n]);return this};function $C(r,e,t){var i=r._events;if(i===void 0)return[];var n=i[e];return n===void 0?[]:typeof n=="function"?t?[n.listener||n]:[n]:t?SR(n):WC(n,n.length)}He.prototype.listeners=function(e){return $C(this,e,!0)};He.prototype.rawListeners=function(e){return $C(this,e,!1)};He.listenerCount=function(r,e){return typeof r.listenerCount=="function"?r.listenerCount(e):kC.call(r,e)};He.prototype.listenerCount=kC;function kC(r){var e=this._events;if(e!==void 0){var t=e[r];if(typeof t=="function")return 1;if(t!==void 0)return t.length}return 0}He.prototype.eventNames=function(){return this._eventsCount>0?Sh(this._events):[]};function WC(r,e){for(var t=new Array(e),i=0;i{"use strict";l();Object.defineProperty(Nh,"__esModule",{value:!0});Nh.delay=void 0;function NR(r){return new Promise(e=>{setTimeout(()=>{e(!0)},r)})}Nh.delay=NR});var XC=D(Ka=>{"use strict";l();Object.defineProperty(Ka,"__esModule",{value:!0});Ka.ONE_THOUSAND=Ka.ONE_HUNDRED=void 0;Ka.ONE_HUNDRED=100;Ka.ONE_THOUSAND=1e3});var ZC=D(pe=>{"use strict";l();Object.defineProperty(pe,"__esModule",{value:!0});pe.ONE_YEAR=pe.FOUR_WEEKS=pe.THREE_WEEKS=pe.TWO_WEEKS=pe.ONE_WEEK=pe.THIRTY_DAYS=pe.SEVEN_DAYS=pe.FIVE_DAYS=pe.THREE_DAYS=pe.ONE_DAY=pe.TWENTY_FOUR_HOURS=pe.TWELVE_HOURS=pe.SIX_HOURS=pe.THREE_HOURS=pe.ONE_HOUR=pe.SIXTY_MINUTES=pe.THIRTY_MINUTES=pe.TEN_MINUTES=pe.FIVE_MINUTES=pe.ONE_MINUTE=pe.SIXTY_SECONDS=pe.THIRTY_SECONDS=pe.TEN_SECONDS=pe.FIVE_SECONDS=pe.ONE_SECOND=void 0;pe.ONE_SECOND=1;pe.FIVE_SECONDS=5;pe.TEN_SECONDS=10;pe.THIRTY_SECONDS=30;pe.SIXTY_SECONDS=60;pe.ONE_MINUTE=pe.SIXTY_SECONDS;pe.FIVE_MINUTES=pe.ONE_MINUTE*5;pe.TEN_MINUTES=pe.ONE_MINUTE*10;pe.THIRTY_MINUTES=pe.ONE_MINUTE*30;pe.SIXTY_MINUTES=pe.ONE_MINUTE*60;pe.ONE_HOUR=pe.SIXTY_MINUTES;pe.THREE_HOURS=pe.ONE_HOUR*3;pe.SIX_HOURS=pe.ONE_HOUR*6;pe.TWELVE_HOURS=pe.ONE_HOUR*12;pe.TWENTY_FOUR_HOURS=pe.ONE_HOUR*24;pe.ONE_DAY=pe.TWENTY_FOUR_HOURS;pe.THREE_DAYS=pe.ONE_DAY*3;pe.FIVE_DAYS=pe.ONE_DAY*5;pe.SEVEN_DAYS=pe.ONE_DAY*7;pe.THIRTY_DAYS=pe.ONE_DAY*30;pe.ONE_WEEK=pe.SEVEN_DAYS;pe.TWO_WEEKS=pe.ONE_WEEK*2;pe.THREE_WEEKS=pe.ONE_WEEK*3;pe.FOUR_WEEKS=pe.ONE_WEEK*4;pe.ONE_YEAR=pe.ONE_DAY*365});var pm=D(Fn=>{"use strict";l();var DR=Fn&&Fn.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),eS=Fn&&Fn.__exportStar||function(r,e){for(var t in r)t!=="default"&&!e.hasOwnProperty(t)&&DR(e,r,t)};Object.defineProperty(Fn,"__esModule",{value:!0});eS(XC(),Fn);eS(ZC(),Fn)});var rS=D(za=>{"use strict";l();Object.defineProperty(za,"__esModule",{value:!0});za.fromMiliseconds=za.toMiliseconds=void 0;var tS=pm();function OR(r){return r*tS.ONE_THOUSAND}za.toMiliseconds=OR;function BR(r){return Math.floor(r/tS.ONE_THOUSAND)}za.fromMiliseconds=BR});var nS=D(Un=>{"use strict";l();var MR=Un&&Un.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),iS=Un&&Un.__exportStar||function(r,e){for(var t in r)t!=="default"&&!e.hasOwnProperty(t)&&MR(e,r,t)};Object.defineProperty(Un,"__esModule",{value:!0});iS(JC(),Un);iS(rS(),Un)});var sS=D(Oc=>{"use strict";l();Object.defineProperty(Oc,"__esModule",{value:!0});Oc.Watch=void 0;var Dh=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 t=this.get(e);if(typeof t.elapsed<"u")throw new Error(`Watch already stopped for label: ${e}`);let i=Date.now()-t.started;this.timestamps.set(e,{started:t.started,elapsed:i})}get(e){let t=this.timestamps.get(e);if(typeof t>"u")throw new Error(`No timestamp found for label: ${e}`);return t}elapsed(e){let t=this.get(e);return t.elapsed||Date.now()-t.started}};Oc.Watch=Dh;Oc.default=Dh});var oS=D(Oh=>{"use strict";l();Object.defineProperty(Oh,"__esModule",{value:!0});Oh.IWatch=void 0;var gm=class{};Oh.IWatch=gm});var aS=D(to=>{"use strict";l();var PR=to&&to.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),LR=to&&to.__exportStar||function(r,e){for(var t in r)t!=="default"&&!e.hasOwnProperty(t)&&PR(e,r,t)};Object.defineProperty(to,"__esModule",{value:!0});LR(oS(),to)});var ro=D(Ti=>{"use strict";l();var RR=Ti&&Ti.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),Bh=Ti&&Ti.__exportStar||function(r,e){for(var t in r)t!=="default"&&!e.hasOwnProperty(t)&&RR(e,r,t)};Object.defineProperty(Ti,"__esModule",{value:!0});Bh(nS(),Ti);Bh(sS(),Ti);Bh(aS(),Ti);Bh(pm(),Ti)});var ym,uS=ye(()=>{l();ym=class{}});var mm={};st(mm,{IEvents:()=>ym});var vm=ye(()=>{l();uS()});var cS=D(Mh=>{"use strict";l();Object.defineProperty(Mh,"__esModule",{value:!0});Mh.IHeartBeat=void 0;var FR=(vm(),ti(mm)),wm=class extends FR.IEvents{constructor(e){super()}};Mh.IHeartBeat=wm});var Em=D(io=>{"use strict";l();var UR=io&&io.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),qR=io&&io.__exportStar||function(r,e){for(var t in r)t!=="default"&&!e.hasOwnProperty(t)&&UR(e,r,t)};Object.defineProperty(io,"__esModule",{value:!0});qR(cS(),io)});var lS=D($a=>{"use strict";l();Object.defineProperty($a,"__esModule",{value:!0});$a.HEARTBEAT_EVENTS=$a.HEARTBEAT_INTERVAL=void 0;var VR=ro();$a.HEARTBEAT_INTERVAL=VR.FIVE_SECONDS;$a.HEARTBEAT_EVENTS={pulse:"heartbeat_pulse"}});var Am=D(no=>{"use strict";l();var HR=no&&no.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),QR=no&&no.__exportStar||function(r,e){for(var t in r)t!=="default"&&!e.hasOwnProperty(t)&&HR(e,r,t)};Object.defineProperty(no,"__esModule",{value:!0});QR(lS(),no)});var fS=D(ka=>{"use strict";l();var _m=ka&&ka.__awaiter||function(r,e,t,i){function n(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(p){try{h(i.next(p))}catch(v){o(v)}}function u(p){try{h(i.throw(p))}catch(v){o(v)}}function h(p){p.done?s(p.value):n(p.value).then(a,u)}h((i=i.apply(r,e||[])).next())})};Object.defineProperty(ka,"__esModule",{value:!0});ka.HeartBeat=void 0;var jR=Th(),GR=ro(),KR=Em(),Im=Am(),Bc=class extends KR.IHeartBeat{constructor(e){super(e),this.events=new jR.EventEmitter,this.interval=Im.HEARTBEAT_INTERVAL,this.interval=e?.interval||Im.HEARTBEAT_INTERVAL}static init(e){return _m(this,void 0,void 0,function*(){let t=new Bc(e);return yield t.init(),t})}init(){return _m(this,void 0,void 0,function*(){yield this.initialize()})}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}initialize(){return _m(this,void 0,void 0,function*(){setInterval(()=>this.pulse(),GR.toMiliseconds(this.interval))})}pulse(){this.events.emit(Im.HEARTBEAT_EVENTS.pulse)}};ka.HeartBeat=Bc});var hS=D(ki=>{"use strict";l();var zR=ki&&ki.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),bm=ki&&ki.__exportStar||function(r,e){for(var t in r)t!=="default"&&!e.hasOwnProperty(t)&&zR(e,r,t)};Object.defineProperty(ki,"__esModule",{value:!0});bm(fS(),ki);bm(Em(),ki);bm(Am(),ki)});var Cm=D(Wa=>{"use strict";l();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 mS=D(mr=>{"use strict";l();Object.defineProperty(mr,"__esModule",{value:!0});mr.generateChildLogger=mr.formatChildLoggerContext=mr.getLoggerContext=mr.setBrowserLoggerContext=mr.getBrowserLoggerContext=mr.getDefaultLoggerOptions=void 0;var Ya=Cm();function $R(r){return Object.assign(Object.assign({},r),{level:r?.level||Ya.PINO_LOGGER_DEFAULTS.level})}mr.getDefaultLoggerOptions=$R;function dS(r,e=Ya.PINO_CUSTOM_CONTEXT_KEY){return r[e]||""}mr.getBrowserLoggerContext=dS;function pS(r,e,t=Ya.PINO_CUSTOM_CONTEXT_KEY){return r[t]=e,r}mr.setBrowserLoggerContext=pS;function gS(r,e=Ya.PINO_CUSTOM_CONTEXT_KEY){let t="";return typeof r.bindings>"u"?t=dS(r,e):t=r.bindings().context||"",t}mr.getLoggerContext=gS;function yS(r,e,t=Ya.PINO_CUSTOM_CONTEXT_KEY){let i=gS(r,t);return i.trim()?`${i}/${e}`:e}mr.formatChildLoggerContext=yS;function kR(r,e,t=Ya.PINO_CUSTOM_CONTEXT_KEY){let i=yS(r,e,t),n=r.child({context:i});return pS(n,i,t)}mr.generateChildLogger=kR});var Sm=D(Ph=>{"use strict";l();Object.defineProperty(Ph,"__esModule",{value:!0});var vS=Eh();vS.__exportStar(Cm(),Ph);vS.__exportStar(mS(),Ph)});var jm=D(Kt=>{"use strict";l();Object.defineProperty(Kt,"__esModule",{value:!0});var Ja=(vm(),ti(mm)),xm=class extends Ja.IEvents{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},Tm=class{constructor(e,t,i){this.core=e,this.logger=t}},Nm=class extends Ja.IEvents{constructor(e,t){super(),this.core=e,this.logger=t,this.records=new Map}},Dm=class{constructor(e,t){this.logger=e,this.core=t}},Om=class extends Ja.IEvents{constructor(e,t){super(),this.relayer=e,this.logger=t}},Bm=class extends Ja.IEvents{constructor(e){super()}},Mm=class{constructor(e,t,i,n){this.core=e,this.logger=t,this.name=i}},Pm=class{constructor(){this.map=new Map}},Lm=class extends Ja.IEvents{constructor(e,t){super(),this.relayer=e,this.logger=t}},Rm=class{constructor(e,t){this.core=e,this.logger=t}},Fm=class extends Ja.IEvents{constructor(e,t){super(),this.core=e,this.logger=t}},Um=class{constructor(e,t){this.logger=e,this.core=t}};function Gt(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}var ES=Gt;Gt.EventEmitter=Gt,Gt.prototype._events=void 0,Gt.prototype._maxListeners=void 0,Gt.defaultMaxListeners=10,Gt.prototype.setMaxListeners=function(r){if(!WR(r)||r<0||isNaN(r))throw TypeError("n must be a positive number");return this._maxListeners=r,this},Gt.prototype.emit=function(r){var e,t,i,n,s,o;if(this._events||(this._events={}),r==="error"&&(!this._events.error||Mc(this._events.error)&&!this._events.error.length)){if(e=arguments[1],e instanceof Error)throw e;var a=new Error('Uncaught, unspecified "error" event. ('+e+")");throw a.context=e,a}if(t=this._events[r],wS(t))return!1;if(Wi(t))switch(arguments.length){case 1:t.call(this);break;case 2:t.call(this,arguments[1]);break;case 3:t.call(this,arguments[1],arguments[2]);break;default:n=Array.prototype.slice.call(arguments,1),t.apply(this,n)}else if(Mc(t))for(n=Array.prototype.slice.call(arguments,1),o=t.slice(),i=o.length,s=0;s0&&this._events[r].length>t&&(this._events[r].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[r].length),typeof console.trace=="function"&&console.trace())),this},Gt.prototype.on=Gt.prototype.addListener,Gt.prototype.once=function(r,e){if(!Wi(e))throw TypeError("listener must be a function");var t=!1;function i(){this.removeListener(r,i),t||(t=!0,e.apply(this,arguments))}return i.listener=e,this.on(r,i),this},Gt.prototype.removeListener=function(r,e){var t,i,n,s;if(!Wi(e))throw TypeError("listener must be a function");if(!this._events||!this._events[r])return this;if(t=this._events[r],n=t.length,i=-1,t===e||Wi(t.listener)&&t.listener===e)delete this._events[r],this._events.removeListener&&this.emit("removeListener",r,e);else if(Mc(t)){for(s=n;s-- >0;)if(t[s]===e||t[s].listener&&t[s].listener===e){i=s;break}if(i<0)return this;t.length===1?(t.length=0,delete this._events[r]):t.splice(i,1),this._events.removeListener&&this.emit("removeListener",r,e)}return this},Gt.prototype.removeAllListeners=function(r){var e,t;if(!this._events)return this;if(!this._events.removeListener)return arguments.length===0?this._events={}:this._events[r]&&delete this._events[r],this;if(arguments.length===0){for(e in this._events)e!=="removeListener"&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(t=this._events[r],Wi(t))this.removeListener(r,t);else if(t)for(;t.length;)this.removeListener(r,t[t.length-1]);return delete this._events[r],this},Gt.prototype.listeners=function(r){var e;return!this._events||!this._events[r]?e=[]:Wi(this._events[r])?e=[this._events[r]]:e=this._events[r].slice(),e},Gt.prototype.listenerCount=function(r){if(this._events){var e=this._events[r];if(Wi(e))return 1;if(e)return e.length}return 0},Gt.listenerCount=function(r,e){return r.listenerCount(e)};function Wi(r){return typeof r=="function"}function WR(r){return typeof r=="number"}function Mc(r){return typeof r=="object"&&r!==null}function wS(r){return r===void 0}var qm=class extends ES{constructor(){super()}},Vm=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},Hm=class extends ES.EventEmitter{constructor(){super()}},Qm=class{constructor(e){this.client=e}};Kt.ICore=xm,Kt.ICrypto=Tm,Kt.IEngine=Qm,Kt.IEngineEvents=Hm,Kt.IExpirer=Fm,Kt.IJsonRpcHistory=Nm,Kt.IKeyChain=Rm,Kt.IMessageTracker=Dm,Kt.IPairing=Um,Kt.IPublisher=Om,Kt.IRelayer=Bm,Kt.ISignClient=Vm,Kt.ISignClientEvents=qm,Kt.IStore=Mm,Kt.ISubscriber=Lm,Kt.ISubscriberTopicMap=Pm});var AS={};st(AS,{safeJsonParse:()=>Pc,safeJsonStringify:()=>Lc});function Pc(r){if(typeof r!="string")throw new Error(`Cannot safe json parse value of type ${typeof r}`);try{return JSON.parse(r)}catch{return r}}function Lc(r){return typeof r=="string"?r:JSON.stringify(r)}var Lh=ye(()=>{l()});var IS=D(Rh=>{"use strict";l();Object.defineProperty(Rh,"__esModule",{value:!0});Rh.BrowserRandomSource=void 0;var _S=65536,Gm=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 t=new Uint8Array(e);for(let i=0;i{"use strict";l();Object.defineProperty(Km,"__esModule",{value:!0});function YR(r){for(var e=0;e{l()});var bS=D(Fh=>{"use strict";l();Object.defineProperty(Fh,"__esModule",{value:!0});Fh.NodeRandomSource=void 0;var JR=vr(),$m=class{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof jl<"u"){let e=zm();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 t=this._crypto.randomBytes(e);if(t.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");let i=new Uint8Array(e);for(let n=0;n{"use strict";l();Object.defineProperty(Uh,"__esModule",{value:!0});Uh.SystemRandomSource=void 0;var XR=IS(),ZR=bS(),km=class{constructor(){if(this.isAvailable=!1,this.name="",this._source=new XR.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new ZR.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)}};Uh.SystemRandomSource=km});var SS=D(br=>{"use strict";l();Object.defineProperty(br,"__esModule",{value:!0});function eF(r,e){var t=r>>>16&65535,i=r&65535,n=e>>>16&65535,s=e&65535;return i*s+(t*s+i*n<<16>>>0)|0}br.mul=Math.imul||eF;function tF(r,e){return r+e|0}br.add=tF;function rF(r,e){return r-e|0}br.sub=rF;function iF(r,e){return r<>>32-e}br.rotl=iF;function nF(r,e){return r<<32-e|r>>>e}br.rotr=nF;function sF(r){return typeof r=="number"&&isFinite(r)&&Math.floor(r)===r}br.isInteger=Number.isInteger||sF;br.MAX_SAFE_INTEGER=9007199254740991;br.isSafeInteger=function(r){return br.isInteger(r)&&r>=-br.MAX_SAFE_INTEGER&&r<=br.MAX_SAFE_INTEGER}});var so=D(Ne=>{"use strict";l();Object.defineProperty(Ne,"__esModule",{value:!0});var xS=SS();function oF(r,e){return e===void 0&&(e=0),(r[e+0]<<8|r[e+1])<<16>>16}Ne.readInt16BE=oF;function aF(r,e){return e===void 0&&(e=0),(r[e+0]<<8|r[e+1])>>>0}Ne.readUint16BE=aF;function uF(r,e){return e===void 0&&(e=0),(r[e+1]<<8|r[e])<<16>>16}Ne.readInt16LE=uF;function cF(r,e){return e===void 0&&(e=0),(r[e+1]<<8|r[e])>>>0}Ne.readUint16LE=cF;function TS(r,e,t){return e===void 0&&(e=new Uint8Array(2)),t===void 0&&(t=0),e[t+0]=r>>>8,e[t+1]=r>>>0,e}Ne.writeUint16BE=TS;Ne.writeInt16BE=TS;function NS(r,e,t){return e===void 0&&(e=new Uint8Array(2)),t===void 0&&(t=0),e[t+0]=r>>>0,e[t+1]=r>>>8,e}Ne.writeUint16LE=NS;Ne.writeInt16LE=NS;function Wm(r,e){return e===void 0&&(e=0),r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3]}Ne.readInt32BE=Wm;function Ym(r,e){return e===void 0&&(e=0),(r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3])>>>0}Ne.readUint32BE=Ym;function Jm(r,e){return e===void 0&&(e=0),r[e+3]<<24|r[e+2]<<16|r[e+1]<<8|r[e]}Ne.readInt32LE=Jm;function Xm(r,e){return e===void 0&&(e=0),(r[e+3]<<24|r[e+2]<<16|r[e+1]<<8|r[e])>>>0}Ne.readUint32LE=Xm;function qh(r,e,t){return e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0),e[t+0]=r>>>24,e[t+1]=r>>>16,e[t+2]=r>>>8,e[t+3]=r>>>0,e}Ne.writeUint32BE=qh;Ne.writeInt32BE=qh;function Vh(r,e,t){return e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0),e[t+0]=r>>>0,e[t+1]=r>>>8,e[t+2]=r>>>16,e[t+3]=r>>>24,e}Ne.writeUint32LE=Vh;Ne.writeInt32LE=Vh;function lF(r,e){e===void 0&&(e=0);var t=Wm(r,e),i=Wm(r,e+4);return t*4294967296+i-(i>>31)*4294967296}Ne.readInt64BE=lF;function fF(r,e){e===void 0&&(e=0);var t=Ym(r,e),i=Ym(r,e+4);return t*4294967296+i}Ne.readUint64BE=fF;function hF(r,e){e===void 0&&(e=0);var t=Jm(r,e),i=Jm(r,e+4);return i*4294967296+t-(t>>31)*4294967296}Ne.readInt64LE=hF;function dF(r,e){e===void 0&&(e=0);var t=Xm(r,e),i=Xm(r,e+4);return i*4294967296+t}Ne.readUint64LE=dF;function DS(r,e,t){return e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0),qh(r/4294967296>>>0,e,t),qh(r>>>0,e,t+4),e}Ne.writeUint64BE=DS;Ne.writeInt64BE=DS;function OS(r,e,t){return e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0),Vh(r>>>0,e,t),Vh(r/4294967296>>>0,e,t+4),e}Ne.writeUint64LE=OS;Ne.writeInt64LE=OS;function pF(r,e,t){if(t===void 0&&(t=0),r%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(r/8>e.length-t)throw new Error("readUintBE: array is too short for the given bitLength");for(var i=0,n=1,s=r/8+t-1;s>=t;s--)i+=e[s]*n,n*=256;return i}Ne.readUintBE=pF;function gF(r,e,t){if(t===void 0&&(t=0),r%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(r/8>e.length-t)throw new Error("readUintLE: array is too short for the given bitLength");for(var i=0,n=1,s=t;s=i;s--)t[s]=e/n&255,n*=256;return t}Ne.writeUintBE=yF;function mF(r,e,t,i){if(t===void 0&&(t=new Uint8Array(r/8)),i===void 0&&(i=0),r%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!xS.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var n=1,s=i;s{"use strict";l();Object.defineProperty(sr,"__esModule",{value:!0});sr.randomStringForEntropy=sr.randomString=sr.randomUint32=sr.randomBytes=sr.defaultRandomSource=void 0;var SF=CS(),xF=so(),BS=vr();sr.defaultRandomSource=new SF.SystemRandomSource;function Zm(r,e=sr.defaultRandomSource){return e.randomBytes(r)}sr.randomBytes=Zm;function TF(r=sr.defaultRandomSource){let e=Zm(4,r),t=(0,xF.readUint32LE)(e);return(0,BS.wipe)(e),t}sr.randomUint32=TF;var MS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function PS(r,e=MS,t=sr.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 i="",n=e.length,s=256-256%n;for(;r>0;){let o=Zm(Math.ceil(r*256/s),t);for(let a=0;a0;a++){let u=o[a];u{"use strict";l();Object.defineProperty(Yi,"__esModule",{value:!0});var Za=so(),Xa=vr();Yi.DIGEST_LENGTH=64;Yi.BLOCK_SIZE=128;var FS=function(){function r(){this.digestLength=Yi.DIGEST_LENGTH,this.blockSize=Yi.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 r.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},r.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},r.prototype.clean=function(){Xa.wipe(this._buffer),Xa.wipe(this._tempHi),Xa.wipe(this._tempLo),this.reset()},r.prototype.update=function(e,t){if(t===void 0&&(t=e.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var i=0;if(this._bytesHashed+=t,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=e[i++],t--;this._bufferLength===this.blockSize&&(ev(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(t>=this.blockSize&&(i=ev(this._tempHi,this._tempLo,this._stateHi,this._stateLo,e,i,t),t%=this.blockSize);t>0;)this._buffer[this._bufferLength++]=e[i++],t--;return this},r.prototype.finish=function(e){if(!this._finished){var t=this._bytesHashed,i=this._bufferLength,n=t/536870912|0,s=t<<3,o=t%128<112?128:256;this._buffer[i]=128;for(var a=i+1;a0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},r.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},r.prototype.cleanSavedState=function(e){Xa.wipe(e.stateHi),Xa.wipe(e.stateLo),e.buffer&&Xa.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},r}();Yi.SHA512=FS;var RS=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 ev(r,e,t,i,n,s,o){for(var a=t[0],u=t[1],h=t[2],p=t[3],v=t[4],B=t[5],R=t[6],x=t[7],V=i[0],H=i[1],K=i[2],ie=i[3],k=i[4],J=i[5],W=i[6],G=i[7],P,F,$,ce,Y,X,A,c;o>=128;){for(var d=0;d<16;d++){var g=8*d+s;r[d]=Za.readUint32BE(n,g),e[d]=Za.readUint32BE(n,g+4)}for(var d=0;d<80;d++){var m=a,w=u,S=h,N=p,_=v,f=B,C=R,Z=x,te=V,ee=H,ae=K,E=ie,b=k,T=J,L=W,O=G;if(P=x,F=G,Y=F&65535,X=F>>>16,A=P&65535,c=P>>>16,P=(v>>>14|k<<32-14)^(v>>>18|k<<32-18)^(k>>>41-32|v<<32-(41-32)),F=(k>>>14|v<<32-14)^(k>>>18|v<<32-18)^(v>>>41-32|k<<32-(41-32)),Y+=F&65535,X+=F>>>16,A+=P&65535,c+=P>>>16,P=v&B^~v&R,F=k&J^~k&W,Y+=F&65535,X+=F>>>16,A+=P&65535,c+=P>>>16,P=RS[d*2],F=RS[d*2+1],Y+=F&65535,X+=F>>>16,A+=P&65535,c+=P>>>16,P=r[d%16],F=e[d%16],Y+=F&65535,X+=F>>>16,A+=P&65535,c+=P>>>16,X+=Y>>>16,A+=X>>>16,c+=A>>>16,$=A&65535|c<<16,ce=Y&65535|X<<16,P=$,F=ce,Y=F&65535,X=F>>>16,A=P&65535,c=P>>>16,P=(a>>>28|V<<32-28)^(V>>>34-32|a<<32-(34-32))^(V>>>39-32|a<<32-(39-32)),F=(V>>>28|a<<32-28)^(a>>>34-32|V<<32-(34-32))^(a>>>39-32|V<<32-(39-32)),Y+=F&65535,X+=F>>>16,A+=P&65535,c+=P>>>16,P=a&u^a&h^u&h,F=V&H^V&K^H&K,Y+=F&65535,X+=F>>>16,A+=P&65535,c+=P>>>16,X+=Y>>>16,A+=X>>>16,c+=A>>>16,Z=A&65535|c<<16,O=Y&65535|X<<16,P=N,F=E,Y=F&65535,X=F>>>16,A=P&65535,c=P>>>16,P=$,F=ce,Y+=F&65535,X+=F>>>16,A+=P&65535,c+=P>>>16,X+=Y>>>16,A+=X>>>16,c+=A>>>16,N=A&65535|c<<16,E=Y&65535|X<<16,u=m,h=w,p=S,v=N,B=_,R=f,x=C,a=Z,H=te,K=ee,ie=ae,k=E,J=b,W=T,G=L,V=O,d%16===15)for(var g=0;g<16;g++)P=r[g],F=e[g],Y=F&65535,X=F>>>16,A=P&65535,c=P>>>16,P=r[(g+9)%16],F=e[(g+9)%16],Y+=F&65535,X+=F>>>16,A+=P&65535,c+=P>>>16,$=r[(g+1)%16],ce=e[(g+1)%16],P=($>>>1|ce<<32-1)^($>>>8|ce<<32-8)^$>>>7,F=(ce>>>1|$<<32-1)^(ce>>>8|$<<32-8)^(ce>>>7|$<<32-7),Y+=F&65535,X+=F>>>16,A+=P&65535,c+=P>>>16,$=r[(g+14)%16],ce=e[(g+14)%16],P=($>>>19|ce<<32-19)^(ce>>>61-32|$<<32-(61-32))^$>>>6,F=(ce>>>19|$<<32-19)^($>>>61-32|ce<<32-(61-32))^(ce>>>6|$<<32-6),Y+=F&65535,X+=F>>>16,A+=P&65535,c+=P>>>16,X+=Y>>>16,A+=X>>>16,c+=A>>>16,r[g]=A&65535|c<<16,e[g]=Y&65535|X<<16}P=a,F=V,Y=F&65535,X=F>>>16,A=P&65535,c=P>>>16,P=t[0],F=i[0],Y+=F&65535,X+=F>>>16,A+=P&65535,c+=P>>>16,X+=Y>>>16,A+=X>>>16,c+=A>>>16,t[0]=a=A&65535|c<<16,i[0]=V=Y&65535|X<<16,P=u,F=H,Y=F&65535,X=F>>>16,A=P&65535,c=P>>>16,P=t[1],F=i[1],Y+=F&65535,X+=F>>>16,A+=P&65535,c+=P>>>16,X+=Y>>>16,A+=X>>>16,c+=A>>>16,t[1]=u=A&65535|c<<16,i[1]=H=Y&65535|X<<16,P=h,F=K,Y=F&65535,X=F>>>16,A=P&65535,c=P>>>16,P=t[2],F=i[2],Y+=F&65535,X+=F>>>16,A+=P&65535,c+=P>>>16,X+=Y>>>16,A+=X>>>16,c+=A>>>16,t[2]=h=A&65535|c<<16,i[2]=K=Y&65535|X<<16,P=p,F=ie,Y=F&65535,X=F>>>16,A=P&65535,c=P>>>16,P=t[3],F=i[3],Y+=F&65535,X+=F>>>16,A+=P&65535,c+=P>>>16,X+=Y>>>16,A+=X>>>16,c+=A>>>16,t[3]=p=A&65535|c<<16,i[3]=ie=Y&65535|X<<16,P=v,F=k,Y=F&65535,X=F>>>16,A=P&65535,c=P>>>16,P=t[4],F=i[4],Y+=F&65535,X+=F>>>16,A+=P&65535,c+=P>>>16,X+=Y>>>16,A+=X>>>16,c+=A>>>16,t[4]=v=A&65535|c<<16,i[4]=k=Y&65535|X<<16,P=B,F=J,Y=F&65535,X=F>>>16,A=P&65535,c=P>>>16,P=t[5],F=i[5],Y+=F&65535,X+=F>>>16,A+=P&65535,c+=P>>>16,X+=Y>>>16,A+=X>>>16,c+=A>>>16,t[5]=B=A&65535|c<<16,i[5]=J=Y&65535|X<<16,P=R,F=W,Y=F&65535,X=F>>>16,A=P&65535,c=P>>>16,P=t[6],F=i[6],Y+=F&65535,X+=F>>>16,A+=P&65535,c+=P>>>16,X+=Y>>>16,A+=X>>>16,c+=A>>>16,t[6]=R=A&65535|c<<16,i[6]=W=Y&65535|X<<16,P=x,F=G,Y=F&65535,X=F>>>16,A=P&65535,c=P>>>16,P=t[7],F=i[7],Y+=F&65535,X+=F>>>16,A+=P&65535,c+=P>>>16,X+=Y>>>16,A+=X>>>16,c+=A>>>16,t[7]=x=A&65535|c<<16,i[7]=G=Y&65535|X<<16,s+=128,o-=128}return s}function DF(r){var e=new FS;e.update(r);var t=e.digest();return e.clean(),t}Yi.hash=DF});var XS=D(qe=>{"use strict";l();Object.defineProperty(qe,"__esModule",{value:!0});qe.convertSecretKeyToX25519=qe.convertPublicKeyToX25519=qe.verify=qe.sign=qe.extractPublicKeyFromSecretKey=qe.generateKeyPair=qe.generateKeyPairFromSeed=qe.SEED_LENGTH=qe.SECRET_KEY_LENGTH=qe.PUBLIC_KEY_LENGTH=qe.SIGNATURE_LENGTH=void 0;var OF=LS(),Rc=US(),jS=vr();qe.SIGNATURE_LENGTH=64;qe.PUBLIC_KEY_LENGTH=32;qe.SECRET_KEY_LENGTH=64;qe.SEED_LENGTH=32;function ve(r){let e=new Float64Array(16);if(r)for(let t=0;t>16&1),t[o-1]&=65535;t[15]=i[15]-32767-(t[14]>>16&1);let s=t[15]>>16&1;t[14]&=65535,GS(i,t,1-s)}for(let n=0;n<16;n++)r[2*n]=i[n]&255,r[2*n+1]=i[n]>>8}function KS(r,e){let t=0;for(let i=0;i<32;i++)t|=r[i]^e[i];return(1&t-1>>>8)-1}function HS(r,e){let t=new Uint8Array(32),i=new Uint8Array(32);return Fc(t,r),Fc(i,e),KS(t,i)}function zS(r){let e=new Uint8Array(32);return Fc(e,r),e[0]&1}function RF(r,e){for(let t=0;t<16;t++)r[t]=e[2*t]+(e[2*t+1]<<8);r[15]&=32767}function oo(r,e,t){for(let i=0;i<16;i++)r[i]=e[i]+t[i]}function uo(r,e,t){for(let i=0;i<16;i++)r[i]=e[i]-t[i]}function Qe(r,e,t){let i,n,s=0,o=0,a=0,u=0,h=0,p=0,v=0,B=0,R=0,x=0,V=0,H=0,K=0,ie=0,k=0,J=0,W=0,G=0,P=0,F=0,$=0,ce=0,Y=0,X=0,A=0,c=0,d=0,g=0,m=0,w=0,S=0,N=t[0],_=t[1],f=t[2],C=t[3],Z=t[4],te=t[5],ee=t[6],ae=t[7],E=t[8],b=t[9],T=t[10],L=t[11],O=t[12],U=t[13],q=t[14],M=t[15];i=e[0],s+=i*N,o+=i*_,a+=i*f,u+=i*C,h+=i*Z,p+=i*te,v+=i*ee,B+=i*ae,R+=i*E,x+=i*b,V+=i*T,H+=i*L,K+=i*O,ie+=i*U,k+=i*q,J+=i*M,i=e[1],o+=i*N,a+=i*_,u+=i*f,h+=i*C,p+=i*Z,v+=i*te,B+=i*ee,R+=i*ae,x+=i*E,V+=i*b,H+=i*T,K+=i*L,ie+=i*O,k+=i*U,J+=i*q,W+=i*M,i=e[2],a+=i*N,u+=i*_,h+=i*f,p+=i*C,v+=i*Z,B+=i*te,R+=i*ee,x+=i*ae,V+=i*E,H+=i*b,K+=i*T,ie+=i*L,k+=i*O,J+=i*U,W+=i*q,G+=i*M,i=e[3],u+=i*N,h+=i*_,p+=i*f,v+=i*C,B+=i*Z,R+=i*te,x+=i*ee,V+=i*ae,H+=i*E,K+=i*b,ie+=i*T,k+=i*L,J+=i*O,W+=i*U,G+=i*q,P+=i*M,i=e[4],h+=i*N,p+=i*_,v+=i*f,B+=i*C,R+=i*Z,x+=i*te,V+=i*ee,H+=i*ae,K+=i*E,ie+=i*b,k+=i*T,J+=i*L,W+=i*O,G+=i*U,P+=i*q,F+=i*M,i=e[5],p+=i*N,v+=i*_,B+=i*f,R+=i*C,x+=i*Z,V+=i*te,H+=i*ee,K+=i*ae,ie+=i*E,k+=i*b,J+=i*T,W+=i*L,G+=i*O,P+=i*U,F+=i*q,$+=i*M,i=e[6],v+=i*N,B+=i*_,R+=i*f,x+=i*C,V+=i*Z,H+=i*te,K+=i*ee,ie+=i*ae,k+=i*E,J+=i*b,W+=i*T,G+=i*L,P+=i*O,F+=i*U,$+=i*q,ce+=i*M,i=e[7],B+=i*N,R+=i*_,x+=i*f,V+=i*C,H+=i*Z,K+=i*te,ie+=i*ee,k+=i*ae,J+=i*E,W+=i*b,G+=i*T,P+=i*L,F+=i*O,$+=i*U,ce+=i*q,Y+=i*M,i=e[8],R+=i*N,x+=i*_,V+=i*f,H+=i*C,K+=i*Z,ie+=i*te,k+=i*ee,J+=i*ae,W+=i*E,G+=i*b,P+=i*T,F+=i*L,$+=i*O,ce+=i*U,Y+=i*q,X+=i*M,i=e[9],x+=i*N,V+=i*_,H+=i*f,K+=i*C,ie+=i*Z,k+=i*te,J+=i*ee,W+=i*ae,G+=i*E,P+=i*b,F+=i*T,$+=i*L,ce+=i*O,Y+=i*U,X+=i*q,A+=i*M,i=e[10],V+=i*N,H+=i*_,K+=i*f,ie+=i*C,k+=i*Z,J+=i*te,W+=i*ee,G+=i*ae,P+=i*E,F+=i*b,$+=i*T,ce+=i*L,Y+=i*O,X+=i*U,A+=i*q,c+=i*M,i=e[11],H+=i*N,K+=i*_,ie+=i*f,k+=i*C,J+=i*Z,W+=i*te,G+=i*ee,P+=i*ae,F+=i*E,$+=i*b,ce+=i*T,Y+=i*L,X+=i*O,A+=i*U,c+=i*q,d+=i*M,i=e[12],K+=i*N,ie+=i*_,k+=i*f,J+=i*C,W+=i*Z,G+=i*te,P+=i*ee,F+=i*ae,$+=i*E,ce+=i*b,Y+=i*T,X+=i*L,A+=i*O,c+=i*U,d+=i*q,g+=i*M,i=e[13],ie+=i*N,k+=i*_,J+=i*f,W+=i*C,G+=i*Z,P+=i*te,F+=i*ee,$+=i*ae,ce+=i*E,Y+=i*b,X+=i*T,A+=i*L,c+=i*O,d+=i*U,g+=i*q,m+=i*M,i=e[14],k+=i*N,J+=i*_,W+=i*f,G+=i*C,P+=i*Z,F+=i*te,$+=i*ee,ce+=i*ae,Y+=i*E,X+=i*b,A+=i*T,c+=i*L,d+=i*O,g+=i*U,m+=i*q,w+=i*M,i=e[15],J+=i*N,W+=i*_,G+=i*f,P+=i*C,F+=i*Z,$+=i*te,ce+=i*ee,Y+=i*ae,X+=i*E,A+=i*b,c+=i*T,d+=i*L,g+=i*O,m+=i*U,w+=i*q,S+=i*M,s+=38*W,o+=38*G,a+=38*P,u+=38*F,h+=38*$,p+=38*ce,v+=38*Y,B+=38*X,R+=38*A,x+=38*c,V+=38*d,H+=38*g,K+=38*m,ie+=38*w,k+=38*S,n=1,i=s+n+65535,n=Math.floor(i/65536),s=i-n*65536,i=o+n+65535,n=Math.floor(i/65536),o=i-n*65536,i=a+n+65535,n=Math.floor(i/65536),a=i-n*65536,i=u+n+65535,n=Math.floor(i/65536),u=i-n*65536,i=h+n+65535,n=Math.floor(i/65536),h=i-n*65536,i=p+n+65535,n=Math.floor(i/65536),p=i-n*65536,i=v+n+65535,n=Math.floor(i/65536),v=i-n*65536,i=B+n+65535,n=Math.floor(i/65536),B=i-n*65536,i=R+n+65535,n=Math.floor(i/65536),R=i-n*65536,i=x+n+65535,n=Math.floor(i/65536),x=i-n*65536,i=V+n+65535,n=Math.floor(i/65536),V=i-n*65536,i=H+n+65535,n=Math.floor(i/65536),H=i-n*65536,i=K+n+65535,n=Math.floor(i/65536),K=i-n*65536,i=ie+n+65535,n=Math.floor(i/65536),ie=i-n*65536,i=k+n+65535,n=Math.floor(i/65536),k=i-n*65536,i=J+n+65535,n=Math.floor(i/65536),J=i-n*65536,s+=n-1+37*(n-1),n=1,i=s+n+65535,n=Math.floor(i/65536),s=i-n*65536,i=o+n+65535,n=Math.floor(i/65536),o=i-n*65536,i=a+n+65535,n=Math.floor(i/65536),a=i-n*65536,i=u+n+65535,n=Math.floor(i/65536),u=i-n*65536,i=h+n+65535,n=Math.floor(i/65536),h=i-n*65536,i=p+n+65535,n=Math.floor(i/65536),p=i-n*65536,i=v+n+65535,n=Math.floor(i/65536),v=i-n*65536,i=B+n+65535,n=Math.floor(i/65536),B=i-n*65536,i=R+n+65535,n=Math.floor(i/65536),R=i-n*65536,i=x+n+65535,n=Math.floor(i/65536),x=i-n*65536,i=V+n+65535,n=Math.floor(i/65536),V=i-n*65536,i=H+n+65535,n=Math.floor(i/65536),H=i-n*65536,i=K+n+65535,n=Math.floor(i/65536),K=i-n*65536,i=ie+n+65535,n=Math.floor(i/65536),ie=i-n*65536,i=k+n+65535,n=Math.floor(i/65536),k=i-n*65536,i=J+n+65535,n=Math.floor(i/65536),J=i-n*65536,s+=n-1+37*(n-1),r[0]=s,r[1]=o,r[2]=a,r[3]=u,r[4]=h,r[5]=p,r[6]=v,r[7]=B,r[8]=R,r[9]=x,r[10]=V,r[11]=H,r[12]=K,r[13]=ie,r[14]=k,r[15]=J}function ao(r,e){Qe(r,e,e)}function $S(r,e){let t=ve(),i;for(i=0;i<16;i++)t[i]=e[i];for(i=253;i>=0;i--)ao(t,t),i!==2&&i!==4&&Qe(t,t,e);for(i=0;i<16;i++)r[i]=t[i]}function FF(r,e){let t=ve(),i;for(i=0;i<16;i++)t[i]=e[i];for(i=250;i>=0;i--)ao(t,t),i!==1&&Qe(t,t,e);for(i=0;i<16;i++)r[i]=t[i]}function nv(r,e){let t=ve(),i=ve(),n=ve(),s=ve(),o=ve(),a=ve(),u=ve(),h=ve(),p=ve();uo(t,r[1],r[0]),uo(p,e[1],e[0]),Qe(t,t,p),oo(i,r[0],r[1]),oo(p,e[0],e[1]),Qe(i,i,p),Qe(n,r[3],e[3]),Qe(n,n,PF),Qe(s,r[2],e[2]),oo(s,s,s),uo(o,i,t),uo(a,s,n),oo(u,s,n),oo(h,i,t),Qe(r[0],o,a),Qe(r[1],h,u),Qe(r[2],u,a),Qe(r[3],o,h)}function QS(r,e,t){for(let i=0;i<4;i++)GS(r[i],e[i],t)}function ov(r,e){let t=ve(),i=ve(),n=ve();$S(n,e[2]),Qe(t,e[0],n),Qe(i,e[1],n),Fc(r,i),r[31]^=zS(t)<<7}function kS(r,e,t){qn(r[0],iv),qn(r[1],eu),qn(r[2],eu),qn(r[3],iv);for(let i=255;i>=0;--i){let n=t[i/8|0]>>(i&7)&1;QS(r,e,n),nv(e,r),nv(r,r),QS(r,e,n)}}function av(r,e){let t=[ve(),ve(),ve(),ve()];qn(t[0],qS),qn(t[1],VS),qn(t[2],eu),Qe(t[3],qS,VS),kS(r,t,e)}function WS(r){if(r.length!==qe.SEED_LENGTH)throw new Error(`ed25519: seed must be ${qe.SEED_LENGTH} bytes`);let e=(0,Rc.hash)(r);e[0]&=248,e[31]&=127,e[31]|=64;let t=new Uint8Array(32),i=[ve(),ve(),ve(),ve()];av(i,e),ov(t,i);let n=new Uint8Array(64);return n.set(r),n.set(t,32),{publicKey:t,secretKey:n}}qe.generateKeyPairFromSeed=WS;function UF(r){let e=(0,OF.randomBytes)(32,r),t=WS(e);return(0,jS.wipe)(e),t}qe.generateKeyPair=UF;function qF(r){if(r.length!==qe.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${qe.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(r.subarray(32))}qe.extractPublicKeyFromSecretKey=qF;var rv=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 YS(r,e){let t,i,n,s;for(i=63;i>=32;--i){for(t=0,n=i-32,s=i-12;n>4)*rv[n],t=e[n]>>8,e[n]&=255;for(n=0;n<32;n++)e[n]-=t*rv[n];for(i=0;i<32;i++)e[i+1]+=e[i]>>8,r[i]=e[i]&255}function sv(r){let e=new Float64Array(64);for(let t=0;t<64;t++)e[t]=r[t];for(let t=0;t<64;t++)r[t]=0;YS(r,e)}function VF(r,e){let t=new Float64Array(64),i=[ve(),ve(),ve(),ve()],n=(0,Rc.hash)(r.subarray(0,32));n[0]&=248,n[31]&=127,n[31]|=64;let s=new Uint8Array(64);s.set(n.subarray(32),32);let o=new Rc.SHA512;o.update(s.subarray(32)),o.update(e);let a=o.digest();o.clean(),sv(a),av(i,a),ov(s,i),o.reset(),o.update(s.subarray(0,32)),o.update(r.subarray(32)),o.update(e);let u=o.digest();sv(u);for(let h=0;h<32;h++)t[h]=a[h];for(let h=0;h<32;h++)for(let p=0;p<32;p++)t[h+p]+=u[h]*n[p];return YS(s.subarray(32),t),s}qe.sign=VF;function JS(r,e){let t=ve(),i=ve(),n=ve(),s=ve(),o=ve(),a=ve(),u=ve();return qn(r[2],eu),RF(r[1],e),ao(n,r[1]),Qe(s,n,MF),uo(n,n,r[2]),oo(s,r[2],s),ao(o,s),ao(a,o),Qe(u,a,o),Qe(t,u,n),Qe(t,t,s),FF(t,t),Qe(t,t,n),Qe(t,t,s),Qe(t,t,s),Qe(r[0],t,s),ao(i,r[0]),Qe(i,i,s),HS(i,n)&&Qe(r[0],r[0],LF),ao(i,r[0]),Qe(i,i,s),HS(i,n)?-1:(zS(r[0])===e[31]>>7&&uo(r[0],iv,r[0]),Qe(r[3],r[0],r[1]),0)}function HF(r,e,t){let i=new Uint8Array(32),n=[ve(),ve(),ve(),ve()],s=[ve(),ve(),ve(),ve()];if(t.length!==qe.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${qe.SIGNATURE_LENGTH} bytes`);if(JS(s,r))return!1;let o=new Rc.SHA512;o.update(t.subarray(0,32)),o.update(r),o.update(e);let a=o.digest();return sv(a),kS(n,s,a),av(s,t.subarray(32)),nv(n,s),ov(i,n),!KS(t,i)}qe.verify=HF;function QF(r){let e=[ve(),ve(),ve(),ve()];if(JS(e,r))throw new Error("Ed25519: invalid public key");let t=ve(),i=ve(),n=e[1];oo(t,eu,n),uo(i,eu,n),$S(i,i),Qe(t,t,i);let s=new Uint8Array(32);return Fc(s,t),s}qe.convertPublicKeyToX25519=QF;function jF(r){let e=(0,Rc.hash)(r.subarray(0,32));e[0]&=248,e[31]&=127,e[31]|=64;let t=new Uint8Array(e.subarray(0,32));return(0,jS.wipe)(e),t}qe.convertSecretKeyToX25519=jF});var ex=D(uv=>{"use strict";l();Object.defineProperty(uv,"__esModule",{value:!0});var ZS=65536,GF=function(){function r(){this.isAvailable=!1,this.isInstantiated=!1;var e=typeof self<"u"?self.crypto||self.msCrypto:null;e&&e.getRandomValues&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}return r.prototype.randomBytes=function(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");for(var t=new Uint8Array(e),i=0;i{"use strict";l();Object.defineProperty(cv,"__esModule",{value:!0});var KF=vr(),zF=function(){function r(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof jl<"u"){var e=zm();e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}}return r.prototype.randomBytes=function(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");var t=this._crypto.randomBytes(e);if(t.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");for(var i=new Uint8Array(e),n=0;n{"use strict";l();Object.defineProperty(lv,"__esModule",{value:!0});var $F=ex(),kF=tx(),WF=function(){function r(){if(this.isAvailable=!1,this.name="",this._source=new $F.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new kF.NodeRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Node";return}}return r.prototype.randomBytes=function(e){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(e)},r}();lv.SystemRandomSource=WF});var Hh=D(Wr=>{"use strict";l();Object.defineProperty(Wr,"__esModule",{value:!0});var YF=rx(),JF=so(),ix=vr();Wr.defaultRandomSource=new YF.SystemRandomSource;function fv(r,e){return e===void 0&&(e=Wr.defaultRandomSource),e.randomBytes(r)}Wr.randomBytes=fv;function XF(r){r===void 0&&(r=Wr.defaultRandomSource);var e=fv(4,r),t=JF.readUint32LE(e);return ix.wipe(e),t}Wr.randomUint32=XF;var nx="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function sx(r,e,t){if(e===void 0&&(e=nx),t===void 0&&(t=Wr.defaultRandomSource),e.length<2)throw new Error("randomString charset is too short");if(e.length>256)throw new Error("randomString charset is too long");for(var i="",n=e.length,s=256-256%n;r>0;){for(var o=fv(Math.ceil(r*256/s),t),a=0;a0;a++){var u=o[a];u{l();Qh="EdDSA",jh="JWT",tu=".",ru="base64url",Gh="utf8",Kh="utf8",zh=":",$h="did",kh="key",iu="base58btc",Wh="z",Yh="K36",ox=32,ax=32});function nu(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(r):new Uint8Array(r)}var Xh=ye(()=>{l()});function Zh(r,e){e||(e=r.reduce((n,s)=>n+s.length,0));let t=nu(e),i=0;for(let n of r)t.set(n,i),i+=n.length;return t}var hv=ye(()=>{l();Xh()});function e4(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),i=0;i>>0,J=new Uint8Array(k);K!==ie;){for(var W=x[K],G=0,P=k-1;(W!==0||G>>0,J[P]=W%a>>>0,W=W/a>>>0;if(W!==0)throw new Error("Non-zero carry");H=G,K++}for(var F=k-H;F!==k&&J[F]===0;)F++;for(var $=u.repeat(V);F>>0,k=new Uint8Array(ie);x[V];){var J=t[x.charCodeAt(V)];if(J===255)return;for(var W=0,G=ie-1;(J!==0||W>>0,k[G]=J%256>>>0,J=J/256>>>0;if(J!==0)throw new Error("Non-zero carry");K=W,V++}if(x[V]!==" "){for(var P=ie-K;P!==ie&&k[P]===0;)P++;for(var F=new Uint8Array(H+(ie-P)),$=H;P!==ie;)F[$++]=k[P++];return F}}}function R(x){var V=B(x);if(V)return V;throw new Error(`Non-${e} character`)}return{encode:v,decodeUnsafe:B,decode:R}}var t4,r4,ux,cx=ye(()=>{l();t4=e4,r4=t4,ux=r4});var EX,lx,Ji,fx,hx,Vn=ye(()=>{l();EX=new Uint8Array(0),lx=(r,e)=>{if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},fx=r=>new TextEncoder().encode(r),hx=r=>new TextDecoder().decode(r)});var dv,pv,gv,px,yv,su,Hn,i4,n4,nt,Yr=ye(()=>{l();cx();Vn();dv=class{constructor(e,t,i){this.name=e,this.prefix=t,this.baseEncode=i}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},pv=class{constructor(e,t,i){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=i}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 px(this,e)}},gv=class{constructor(e){this.decoders=e}or(e){return px(this,e)}decode(e){let t=e[0],i=this.decoders[t];if(i)return i.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},px=(r,e)=>new gv({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}}),yv=class{constructor(e,t,i,n){this.name=e,this.prefix=t,this.baseEncode=i,this.baseDecode=n,this.encoder=new dv(e,t,i),this.decoder=new pv(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},su=({name:r,prefix:e,encode:t,decode:i})=>new yv(r,e,t,i),Hn=({prefix:r,name:e,alphabet:t})=>{let{encode:i,decode:n}=ux(t,e);return su({prefix:r,name:e,encode:i,decode:s=>Ji(n(s))})},i4=(r,e,t,i)=>{let n={};for(let p=0;p=8&&(a-=8,o[h++]=255&u>>a)}if(a>=t||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},n4=(r,e,t)=>{let i=e[e.length-1]==="=",n=(1<t;)o-=t,s+=e[n&a>>o];if(o&&(s+=e[n&a<su({prefix:e,name:r,encode(n){return n4(n,i,t)},decode(n){return i4(n,i,t,r)}})});var mv={};st(mv,{identity:()=>s4});var s4,gx=ye(()=>{l();Yr();Vn();s4=su({prefix:"\0",name:"identity",encode:r=>hx(r),decode:r=>fx(r)})});var vv={};st(vv,{base2:()=>o4});var o4,yx=ye(()=>{l();Yr();o4=nt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1})});var wv={};st(wv,{base8:()=>a4});var a4,mx=ye(()=>{l();Yr();a4=nt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3})});var Ev={};st(Ev,{base10:()=>u4});var u4,vx=ye(()=>{l();Yr();u4=Hn({prefix:"9",name:"base10",alphabet:"0123456789"})});var Av={};st(Av,{base16:()=>c4,base16upper:()=>l4});var c4,l4,wx=ye(()=>{l();Yr();c4=nt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),l4=nt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})});var _v={};st(_v,{base32:()=>ou,base32hex:()=>p4,base32hexpad:()=>y4,base32hexpadupper:()=>m4,base32hexupper:()=>g4,base32pad:()=>h4,base32padupper:()=>d4,base32upper:()=>f4,base32z:()=>v4});var ou,f4,h4,d4,p4,g4,y4,m4,v4,Iv=ye(()=>{l();Yr();ou=nt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),f4=nt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),h4=nt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),d4=nt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),p4=nt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),g4=nt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),y4=nt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),m4=nt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),v4=nt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})});var bv={};st(bv,{base36:()=>w4,base36upper:()=>E4});var w4,E4,Ex=ye(()=>{l();Yr();w4=Hn({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),E4=Hn({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})});var Cv={};st(Cv,{base58btc:()=>Ni,base58flickr:()=>A4});var Ni,A4,Sv=ye(()=>{l();Yr();Ni=Hn({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),A4=Hn({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})});var xv={};st(xv,{base64:()=>_4,base64pad:()=>I4,base64url:()=>b4,base64urlpad:()=>C4});var _4,I4,b4,C4,Ax=ye(()=>{l();Yr();_4=nt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),I4=nt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),b4=nt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),C4=nt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})});var Tv={};st(Tv,{base256emoji:()=>D4});function T4(r){return r.reduce((e,t)=>(e+=S4[t],e),"")}function N4(r){let e=[];for(let t of r){let i=x4[t.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(i)}return new Uint8Array(e)}var _x,S4,x4,D4,Ix=ye(()=>{l();Yr();_x=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}"),S4=_x.reduce((r,e,t)=>(r[t]=e,r),[]),x4=_x.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);D4=su({prefix:"\u{1F680}",name:"base256emoji",encode:T4,decode:N4})});function Sx(r,e,t){e=e||[],t=t||0;for(var i=t;r>=P4;)e[t++]=r&255|bx,r/=128;for(;r&M4;)e[t++]=r&255|bx,r>>>=7;return e[t]=r|0,Sx.bytes=t-i+1,e}function Nv(r,i){var t=0,i=i||0,n=0,s=i,o,a=r.length;do{if(s>=a)throw Nv.bytes=0,new RangeError("Could not decode varint");o=r[s++],t+=n<28?(o&Cx)<=R4);return Nv.bytes=s-i,t}var O4,bx,B4,M4,P4,L4,R4,Cx,F4,U4,q4,V4,H4,Q4,j4,G4,K4,z4,$4,k4,Uc,xx=ye(()=>{l();O4=Sx,bx=128,B4=127,M4=~B4,P4=Math.pow(2,31);L4=Nv,R4=128,Cx=127;F4=Math.pow(2,7),U4=Math.pow(2,14),q4=Math.pow(2,21),V4=Math.pow(2,28),H4=Math.pow(2,35),Q4=Math.pow(2,42),j4=Math.pow(2,49),G4=Math.pow(2,56),K4=Math.pow(2,63),z4=function(r){return r{l();xx();qc=(r,e=0)=>[Uc.decode(r,e),Uc.decode.bytes],au=(r,e,t=0)=>(Uc.encode(r,e,t),e),uu=r=>Uc.encodingLength(r)});var co,Tx,Nx,cu,Hc=ye(()=>{l();Vn();td();co=(r,e)=>{let t=e.byteLength,i=uu(r),n=i+uu(t),s=new Uint8Array(n+t);return au(r,s,0),au(t,s,i),s.set(e,n),new cu(r,t,e,s)},Tx=r=>{let e=Ji(r),[t,i]=qc(e),[n,s]=qc(e.subarray(i)),o=e.subarray(i+s);if(o.byteLength!==n)throw new Error("Incorrect length");return new cu(t,n,o,e)},Nx=(r,e)=>r===e?!0:r.code===e.code&&r.size===e.size&&lx(r.bytes,e.bytes),cu=class{constructor(e,t,i,n){this.code=e,this.size=t,this.digest=i,this.bytes=n}}});var Ov,Dv,Bv=ye(()=>{l();Hc();Ov=({name:r,code:e,encode:t})=>new Dv(r,e,t),Dv=class{constructor(e,t,i){this.name=e,this.code=t,this.encode=i}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?co(this.code,t):t.then(i=>co(this.code,i))}else throw Error("Unknown type, must be binary type")}}});var Mv={};st(Mv,{sha256:()=>W4,sha512:()=>Y4});var Ox,W4,Y4,Bx=ye(()=>{l();Bv();Ox=r=>async e=>new Uint8Array(await crypto.subtle.digest(r,e)),W4=Ov({name:"sha2-256",code:18,encode:Ox("SHA-256")}),Y4=Ov({name:"sha2-512",code:19,encode:Ox("SHA-512")})});var Pv={};st(Pv,{identity:()=>Z4});var Mx,J4,Px,X4,Z4,Lx=ye(()=>{l();Vn();Hc();Mx=0,J4="identity",Px=Ji,X4=r=>co(Mx,Px(r)),Z4={code:Mx,name:J4,encode:Px,digest:X4}});var Rx=ye(()=>{l();Vn()});var oZ,aZ,Fx=ye(()=>{l();oZ=new TextEncoder,aZ=new TextDecoder});var Rt,rU,iU,nU,Qc,sU,Ux,qx,rd,id,oU,aU,uU,Vx=ye(()=>{l();td();Hc();Sv();Iv();Vn();Rt=class{constructor(e,t,i,n){this.code=t,this.version=e,this.multihash=i,this.bytes=n,this.byteOffset=n.byteOffset,this.byteLength=n.byteLength,this.asCID=this,this._baseCache=new Map,Object.defineProperties(this,{byteOffset:id,byteLength:id,code:rd,version:rd,multihash:rd,bytes:rd,_baseCache:id,asCID:id})}toV0(){switch(this.version){case 0:return this;default:{let{code:e,multihash:t}=this;if(e!==Qc)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==sU)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return Rt.createV0(t)}}}toV1(){switch(this.version){case 0:{let{code:e,digest:t}=this.multihash,i=co(e,t);return Rt.createV1(this.code,i)}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&&Nx(this.multihash,e.multihash)}toString(e){let{bytes:t,version:i,_baseCache:n}=this;switch(i){case 0:return iU(t,n,e||Ni.encoder);default:return nU(t,n,e||ou.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 aU(/^0\.0/,uU),!!(e&&(e[qx]||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 Rt)return e;if(e!=null&&e.asCID===e){let{version:t,code:i,multihash:n,bytes:s}=e;return new Rt(t,i,n,s||Ux(t,i,n.bytes))}else if(e!=null&&e[qx]===!0){let{version:t,multihash:i,code:n}=e,s=Tx(i);return Rt.create(t,n,s)}else return null}static create(e,t,i){if(typeof t!="number")throw new Error("String codecs are no longer supported");switch(e){case 0:{if(t!==Qc)throw new Error(`Version 0 CID must use dag-pb (code: ${Qc}) block encoding`);return new Rt(e,t,i,i.bytes)}case 1:{let n=Ux(e,t,i.bytes);return new Rt(e,t,i,n)}default:throw new Error("Invalid version")}}static createV0(e){return Rt.create(0,Qc,e)}static createV1(e,t){return Rt.create(1,e,t)}static decode(e){let[t,i]=Rt.decodeFirst(e);if(i.length)throw new Error("Incorrect length");return t}static decodeFirst(e){let t=Rt.inspectBytes(e),i=t.size-t.multihashSize,n=Ji(e.subarray(i,i+t.multihashSize));if(n.byteLength!==t.multihashSize)throw new Error("Incorrect length");let s=n.subarray(t.multihashSize-t.digestSize),o=new cu(t.multihashCode,t.digestSize,s,n);return[t.version===0?Rt.createV0(o):Rt.createV1(t.codec,o),e.subarray(t.size)]}static inspectBytes(e){let t=0,i=()=>{let[v,B]=qc(e.subarray(t));return t+=B,v},n=i(),s=Qc;if(n===18?(n=0,t=0):n===1&&(s=i()),n!==0&&n!==1)throw new RangeError(`Invalid CID version ${n}`);let o=t,a=i(),u=i(),h=t+u,p=h-o;return{version:n,codec:s,multihashCode:a,digestSize:u,multihashSize:p,size:h}}static parse(e,t){let[i,n]=rU(e,t),s=Rt.decode(n);return s._baseCache.set(i,e),s}},rU=(r,e)=>{switch(r[0]){case"Q":{let t=e||Ni;return[Ni.prefix,t.decode(`${Ni.prefix}${r}`)]}case Ni.prefix:{let t=e||Ni;return[Ni.prefix,t.decode(r)]}case ou.prefix:{let t=e||ou;return[ou.prefix,t.decode(r)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],e.decode(r)]}}},iU=(r,e,t)=>{let{prefix:i}=t;if(i!==Ni.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let n=e.get(i);if(n==null){let s=t.encode(r).slice(1);return e.set(i,s),s}else return n},nU=(r,e,t)=>{let{prefix:i}=t,n=e.get(i);if(n==null){let s=t.encode(r);return e.set(i,s),s}else return n},Qc=112,sU=18,Ux=(r,e,t)=>{let i=uu(r),n=i+uu(e),s=new Uint8Array(n+t.byteLength);return au(r,s,0),au(e,s,i),s.set(t,n),s},qx=Symbol.for("@ipld/js-cid/CID"),rd={writable:!1,configurable:!1,enumerable:!0},id={writable:!1,enumerable:!1,configurable:!1},oU="0.0.0-dev",aU=(r,e)=>{if(r.test(oU))console.warn(e);else throw new Error(e)},uU=`CID.isCID(v) is deprecated and will be removed in the next major release. -Following code pattern: - -if (CID.isCID(value)) { - doSomethingWithCID(value) -} - -Is replaced with: - -const cid = CID.asCID(value) -if (cid) { - // Make sure to use cid instead of value - doSomethingWithCID(cid) -} -`});var Hx=ye(()=>{l();Vx();td();Vn();Bv();Hc()});var Lv,vZ,Qx=ye(()=>{l();gx();yx();mx();vx();wx();Iv();Ex();Sv();Ax();Ix();Bx();Lx();Rx();Fx();Hx();Lv={...mv,...vv,...wv,...Ev,...Av,..._v,...bv,...Cv,...xv,...Tv},vZ={...Mv,...Pv}});function Gx(r,e,t,i){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:i}}}var jx,Rv,cU,nd,Fv=ye(()=>{l();Qx();Xh();jx=Gx("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Rv=Gx("ascii","a",r=>{let e="a";for(let t=0;t{r=r.substring(1);let e=nu(r.length);for(let t=0;t{l();Fv()});function Zi(r,e="utf8"){let t=nd[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r,"utf8"):t.decoder.decode(`${t.prefix}${r}`)}var qv=ye(()=>{l();Fv()});function jc(r){return Pc(Xi(Zi(r,ru),Gh))}function Gc(r){return Xi(Zi(Lc(r),Gh),ru)}function Vv(r){let e=Zi(Yh,iu),t=Wh+Xi(Zh([e,r]),iu);return[$h,kh,t].join(zh)}function Hv(r){let[e,t,i]=r.split(zh);if(e!==$h||t!==kh)throw new Error('Issuer must be a DID with method "key"');if(i.slice(0,1)!==Wh)throw new Error("Issuer must be a key in mulicodec format");let s=Zi(i.slice(1),iu);if(Xi(s.slice(0,2),iu)!==Yh)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 Kx(r){return Xi(r,ru)}function zx(r){return Zi(r,ru)}function sd(r){return Zi([Gc(r.header),Gc(r.payload)].join(tu),Kh)}function lU(r){let e=Xi(r,Kh).split(tu),t=jc(e[0]),i=jc(e[1]);return{header:t,payload:i}}function Qv(r){return[Gc(r.header),Gc(r.payload),Kx(r.signature)].join(tu)}function jv(r){let e=r.split(tu),t=jc(e[0]),i=jc(e[1]),n=zx(e[2]);return{header:t,payload:i,signature:n}}var Gv=ye(()=>{l();hv();Uv();qv();Lh();Jh()});function fU(r=(0,$x.randomBytes)(32)){return lu.generateKeyPairFromSeed(r)}async function hU(r,e,t,i,n=(0,kx.fromMiliseconds)(Date.now())){let s={alg:Qh,typ:jh},o=Vv(i.publicKey),a=n+t,u={iss:o,sub:r,aud:e,iat:n,exp:a},h=sd({header:s,payload:u}),p=lu.sign(i.secretKey,h);return Qv({header:s,payload:u,signature:p})}async function dU(r){let{header:e,payload:t,signature:i}=jv(r);if(e.alg!==Qh||e.typ!==jh)throw new Error("JWT must use EdDSA algorithm");let n=Hv(t.iss),s=sd({header:e,payload:t});return lu.verify(n,s,i)}var lu,$x,kx,Wx=ye(()=>{l();lu=_e(XS()),$x=_e(Hh()),kx=_e(ro());Jh();Gv()});var Yx=ye(()=>{l()});var Jx={};st(Jx,{DATA_ENCODING:()=>Kh,DID_DELIMITER:()=>zh,DID_METHOD:()=>kh,DID_PREFIX:()=>$h,JSON_ENCODING:()=>Gh,JWT_DELIMITER:()=>tu,JWT_ENCODING:()=>ru,JWT_IRIDIUM_ALG:()=>Qh,JWT_IRIDIUM_TYP:()=>jh,KEY_PAIR_SEED_LENGTH:()=>ax,MULTICODEC_ED25519_BASE:()=>Wh,MULTICODEC_ED25519_ENCODING:()=>iu,MULTICODEC_ED25519_HEADER:()=>Yh,MULTICODEC_ED25519_LENGTH:()=>ox,decodeData:()=>lU,decodeIss:()=>Hv,decodeJSON:()=>jc,decodeJWT:()=>jv,decodeSig:()=>zx,encodeData:()=>sd,encodeIss:()=>Vv,encodeJSON:()=>Gc,encodeJWT:()=>Qv,encodeSig:()=>Kx,generateKeyPair:()=>fU,signJWT:()=>hU,verifyJWT:()=>dU});var Xx=ye(()=>{l();Wx();Jh();Yx();Gv()});var e2=D(od=>{"use strict";l();Object.defineProperty(od,"__esModule",{value:!0});var or=so(),Kv=vr(),pU=20;function gU(r,e,t){for(var i=1634760805,n=857760878,s=2036477234,o=1797285236,a=t[3]<<24|t[2]<<16|t[1]<<8|t[0],u=t[7]<<24|t[6]<<16|t[5]<<8|t[4],h=t[11]<<24|t[10]<<16|t[9]<<8|t[8],p=t[15]<<24|t[14]<<16|t[13]<<8|t[12],v=t[19]<<24|t[18]<<16|t[17]<<8|t[16],B=t[23]<<24|t[22]<<16|t[21]<<8|t[20],R=t[27]<<24|t[26]<<16|t[25]<<8|t[24],x=t[31]<<24|t[30]<<16|t[29]<<8|t[28],V=e[3]<<24|e[2]<<16|e[1]<<8|e[0],H=e[7]<<24|e[6]<<16|e[5]<<8|e[4],K=e[11]<<24|e[10]<<16|e[9]<<8|e[8],ie=e[15]<<24|e[14]<<16|e[13]<<8|e[12],k=i,J=n,W=s,G=o,P=a,F=u,$=h,ce=p,Y=v,X=B,A=R,c=x,d=V,g=H,m=K,w=ie,S=0;S>>32-16|d<<16,Y=Y+d|0,P^=Y,P=P>>>32-12|P<<12,J=J+F|0,g^=J,g=g>>>32-16|g<<16,X=X+g|0,F^=X,F=F>>>32-12|F<<12,W=W+$|0,m^=W,m=m>>>32-16|m<<16,A=A+m|0,$^=A,$=$>>>32-12|$<<12,G=G+ce|0,w^=G,w=w>>>32-16|w<<16,c=c+w|0,ce^=c,ce=ce>>>32-12|ce<<12,W=W+$|0,m^=W,m=m>>>32-8|m<<8,A=A+m|0,$^=A,$=$>>>32-7|$<<7,G=G+ce|0,w^=G,w=w>>>32-8|w<<8,c=c+w|0,ce^=c,ce=ce>>>32-7|ce<<7,J=J+F|0,g^=J,g=g>>>32-8|g<<8,X=X+g|0,F^=X,F=F>>>32-7|F<<7,k=k+P|0,d^=k,d=d>>>32-8|d<<8,Y=Y+d|0,P^=Y,P=P>>>32-7|P<<7,k=k+F|0,w^=k,w=w>>>32-16|w<<16,A=A+w|0,F^=A,F=F>>>32-12|F<<12,J=J+$|0,d^=J,d=d>>>32-16|d<<16,c=c+d|0,$^=c,$=$>>>32-12|$<<12,W=W+ce|0,g^=W,g=g>>>32-16|g<<16,Y=Y+g|0,ce^=Y,ce=ce>>>32-12|ce<<12,G=G+P|0,m^=G,m=m>>>32-16|m<<16,X=X+m|0,P^=X,P=P>>>32-12|P<<12,W=W+ce|0,g^=W,g=g>>>32-8|g<<8,Y=Y+g|0,ce^=Y,ce=ce>>>32-7|ce<<7,G=G+P|0,m^=G,m=m>>>32-8|m<<8,X=X+m|0,P^=X,P=P>>>32-7|P<<7,J=J+$|0,d^=J,d=d>>>32-8|d<<8,c=c+d|0,$^=c,$=$>>>32-7|$<<7,k=k+F|0,w^=k,w=w>>>32-8|w<<8,A=A+w|0,F^=A,F=F>>>32-7|F<<7;or.writeUint32LE(k+i|0,r,0),or.writeUint32LE(J+n|0,r,4),or.writeUint32LE(W+s|0,r,8),or.writeUint32LE(G+o|0,r,12),or.writeUint32LE(P+a|0,r,16),or.writeUint32LE(F+u|0,r,20),or.writeUint32LE($+h|0,r,24),or.writeUint32LE(ce+p|0,r,28),or.writeUint32LE(Y+v|0,r,32),or.writeUint32LE(X+B|0,r,36),or.writeUint32LE(A+R|0,r,40),or.writeUint32LE(c+x|0,r,44),or.writeUint32LE(d+V|0,r,48),or.writeUint32LE(g+H|0,r,52),or.writeUint32LE(m+K|0,r,56),or.writeUint32LE(w+ie|0,r,60)}function Zx(r,e,t,i,n){if(n===void 0&&(n=0),r.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(i.length>>=8,e++;if(i>0)throw new Error("ChaCha: counter overflow")}});var ad=D(fu=>{"use strict";l();Object.defineProperty(fu,"__esModule",{value:!0});function vU(r,e,t){return~(r-1)&e|r-1&t}fu.select=vU;function wU(r,e){return(r|0)-(e|0)-1>>>31&1}fu.lessOrEqual=wU;function t2(r,e){if(r.length!==e.length)return 0;for(var t=0,i=0;i>>8}fu.compare=t2;function EU(r,e){return r.length===0||e.length===0?!1:t2(r,e)!==0}fu.equal=EU});var i2=D(en=>{"use strict";l();Object.defineProperty(en,"__esModule",{value:!0});var AU=ad(),ud=vr();en.DIGEST_LENGTH=16;var r2=function(){function r(e){this.digestLength=en.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 t=e[0]|e[1]<<8;this._r[0]=t&8191;var i=e[2]|e[3]<<8;this._r[1]=(t>>>13|i<<3)&8191;var n=e[4]|e[5]<<8;this._r[2]=(i>>>10|n<<6)&7939;var s=e[6]|e[7]<<8;this._r[3]=(n>>>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 h=e[14]|e[15]<<8;this._r[8]=(u>>>8|h<<8)&8191,this._r[9]=h>>>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 r.prototype._blocks=function(e,t,i){for(var n=this._fin?0:2048,s=this._h[0],o=this._h[1],a=this._h[2],u=this._h[3],h=this._h[4],p=this._h[5],v=this._h[6],B=this._h[7],R=this._h[8],x=this._h[9],V=this._r[0],H=this._r[1],K=this._r[2],ie=this._r[3],k=this._r[4],J=this._r[5],W=this._r[6],G=this._r[7],P=this._r[8],F=this._r[9];i>=16;){var $=e[t+0]|e[t+1]<<8;s+=$&8191;var ce=e[t+2]|e[t+3]<<8;o+=($>>>13|ce<<3)&8191;var Y=e[t+4]|e[t+5]<<8;a+=(ce>>>10|Y<<6)&8191;var X=e[t+6]|e[t+7]<<8;u+=(Y>>>7|X<<9)&8191;var A=e[t+8]|e[t+9]<<8;h+=(X>>>4|A<<12)&8191,p+=A>>>1&8191;var c=e[t+10]|e[t+11]<<8;v+=(A>>>14|c<<2)&8191;var d=e[t+12]|e[t+13]<<8;B+=(c>>>11|d<<5)&8191;var g=e[t+14]|e[t+15]<<8;R+=(d>>>8|g<<8)&8191,x+=g>>>5|n;var m=0,w=m;w+=s*V,w+=o*(5*F),w+=a*(5*P),w+=u*(5*G),w+=h*(5*W),m=w>>>13,w&=8191,w+=p*(5*J),w+=v*(5*k),w+=B*(5*ie),w+=R*(5*K),w+=x*(5*H),m+=w>>>13,w&=8191;var S=m;S+=s*H,S+=o*V,S+=a*(5*F),S+=u*(5*P),S+=h*(5*G),m=S>>>13,S&=8191,S+=p*(5*W),S+=v*(5*J),S+=B*(5*k),S+=R*(5*ie),S+=x*(5*K),m+=S>>>13,S&=8191;var N=m;N+=s*K,N+=o*H,N+=a*V,N+=u*(5*F),N+=h*(5*P),m=N>>>13,N&=8191,N+=p*(5*G),N+=v*(5*W),N+=B*(5*J),N+=R*(5*k),N+=x*(5*ie),m+=N>>>13,N&=8191;var _=m;_+=s*ie,_+=o*K,_+=a*H,_+=u*V,_+=h*(5*F),m=_>>>13,_&=8191,_+=p*(5*P),_+=v*(5*G),_+=B*(5*W),_+=R*(5*J),_+=x*(5*k),m+=_>>>13,_&=8191;var f=m;f+=s*k,f+=o*ie,f+=a*K,f+=u*H,f+=h*V,m=f>>>13,f&=8191,f+=p*(5*F),f+=v*(5*P),f+=B*(5*G),f+=R*(5*W),f+=x*(5*J),m+=f>>>13,f&=8191;var C=m;C+=s*J,C+=o*k,C+=a*ie,C+=u*K,C+=h*H,m=C>>>13,C&=8191,C+=p*V,C+=v*(5*F),C+=B*(5*P),C+=R*(5*G),C+=x*(5*W),m+=C>>>13,C&=8191;var Z=m;Z+=s*W,Z+=o*J,Z+=a*k,Z+=u*ie,Z+=h*K,m=Z>>>13,Z&=8191,Z+=p*H,Z+=v*V,Z+=B*(5*F),Z+=R*(5*P),Z+=x*(5*G),m+=Z>>>13,Z&=8191;var te=m;te+=s*G,te+=o*W,te+=a*J,te+=u*k,te+=h*ie,m=te>>>13,te&=8191,te+=p*K,te+=v*H,te+=B*V,te+=R*(5*F),te+=x*(5*P),m+=te>>>13,te&=8191;var ee=m;ee+=s*P,ee+=o*G,ee+=a*W,ee+=u*J,ee+=h*k,m=ee>>>13,ee&=8191,ee+=p*ie,ee+=v*K,ee+=B*H,ee+=R*V,ee+=x*(5*F),m+=ee>>>13,ee&=8191;var ae=m;ae+=s*F,ae+=o*P,ae+=a*G,ae+=u*W,ae+=h*J,m=ae>>>13,ae&=8191,ae+=p*k,ae+=v*ie,ae+=B*K,ae+=R*H,ae+=x*V,m+=ae>>>13,ae&=8191,m=(m<<2)+m|0,m=m+w|0,w=m&8191,m=m>>>13,S+=m,s=w,o=S,a=N,u=_,h=f,p=C,v=Z,B=te,R=ee,x=ae,t+=16,i-=16}this._h[0]=s,this._h[1]=o,this._h[2]=a,this._h[3]=u,this._h[4]=h,this._h[5]=p,this._h[6]=v,this._h[7]=B,this._h[8]=R,this._h[9]=x},r.prototype.finish=function(e,t){t===void 0&&(t=0);var i=new Uint16Array(10),n,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(n=this._h[1]>>>13,this._h[1]&=8191,a=2;a<10;a++)this._h[a]+=n,n=this._h[a]>>>13,this._h[a]&=8191;for(this._h[0]+=n*5,n=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=n,n=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=n,i[0]=this._h[0]+5,n=i[0]>>>13,i[0]&=8191,a=1;a<10;a++)i[a]=this._h[a]+n,n=i[a]>>>13,i[a]&=8191;for(i[9]-=1<<13,s=(n^1)-1,a=0;a<10;a++)i[a]&=s;for(s=~s,a=0;a<10;a++)this._h[a]=this._h[a]&s|i[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[t+0]=this._h[0]>>>0,e[t+1]=this._h[0]>>>8,e[t+2]=this._h[1]>>>0,e[t+3]=this._h[1]>>>8,e[t+4]=this._h[2]>>>0,e[t+5]=this._h[2]>>>8,e[t+6]=this._h[3]>>>0,e[t+7]=this._h[3]>>>8,e[t+8]=this._h[4]>>>0,e[t+9]=this._h[4]>>>8,e[t+10]=this._h[5]>>>0,e[t+11]=this._h[5]>>>8,e[t+12]=this._h[6]>>>0,e[t+13]=this._h[6]>>>8,e[t+14]=this._h[7]>>>0,e[t+15]=this._h[7]>>>8,this._finished=!0,this},r.prototype.update=function(e){var t=0,i=e.length,n;if(this._leftover){n=16-this._leftover,n>i&&(n=i);for(var s=0;s=16&&(n=i-i%16,this._blocks(e,t,n),t+=n,i-=n),i){for(var s=0;s{"use strict";l();Object.defineProperty(tn,"__esModule",{value:!0});var cd=e2(),bU=i2(),Kc=vr(),n2=so(),CU=ad();tn.KEY_LENGTH=32;tn.NONCE_LENGTH=12;tn.TAG_LENGTH=16;var s2=new Uint8Array(16),SU=function(){function r(e){if(this.nonceLength=tn.NONCE_LENGTH,this.tagLength=tn.TAG_LENGTH,e.length!==tn.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(e)}return r.prototype.seal=function(e,t,i,n){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);cd.stream(this._key,s,o,4);var a=t.length+this.tagLength,u;if(n){if(n.length!==a)throw new Error("ChaCha20Poly1305: incorrect destination length");u=n}else u=new Uint8Array(a);return cd.streamXOR(this._key,s,t,u,4),this._authenticate(u.subarray(u.length-this.tagLength,u.length),o,u.subarray(0,u.length-this.tagLength),i),Kc.wipe(s),u},r.prototype.open=function(e,t,i,n){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(t.length0&&s.update(s2.subarray(n.length%16))),s.update(i),i.length%16>0&&s.update(s2.subarray(i.length%16));var o=new Uint8Array(8);n&&n2.writeUint64LE(n.length,o),s.update(o),n2.writeUint64LE(i.length,o),s.update(o);for(var a=s.digest(),u=0;u{"use strict";l();Object.defineProperty(zv,"__esModule",{value:!0});function xU(r){return typeof r.saveState<"u"&&typeof r.restoreState<"u"&&typeof r.cleanSavedState<"u"}zv.isSerializableHash=xU});var c2=D(zc=>{"use strict";l();Object.defineProperty(zc,"__esModule",{value:!0});var Di=a2(),TU=ad(),NU=vr(),u2=function(){function r(e,t){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var i=new Uint8Array(this.blockSize);t.length>this.blockSize?this._inner.update(t).finish(i).clean():i.set(t);for(var n=0;n{"use strict";l();Object.defineProperty($v,"__esModule",{value:!0});var l2=c2(),f2=vr(),OU=function(){function r(e,t,i,n){i===void 0&&(i=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=n;var s=l2.hmac(this._hash,i,t);this._hmac=new l2.HMAC(e,s),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return r.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},r.prototype.expand=function(e){for(var t=new Uint8Array(e),i=0;i{"use strict";l();Object.defineProperty(Qn,"__esModule",{value:!0});var fd=so(),ld=vr();Qn.DIGEST_LENGTH=32;Qn.BLOCK_SIZE=64;var d2=function(){function r(){this.digestLength=Qn.DIGEST_LENGTH,this.blockSize=Qn.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 r.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},r.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},r.prototype.clean=function(){ld.wipe(this._buffer),ld.wipe(this._temp),this.reset()},r.prototype.update=function(e,t){if(t===void 0&&(t=e.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var i=0;if(this._bytesHashed+=t,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=e[i++],t--;this._bufferLength===this.blockSize&&(kv(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(t>=this.blockSize&&(i=kv(this._temp,this._state,e,i,t),t%=this.blockSize);t>0;)this._buffer[this._bufferLength++]=e[i++],t--;return this},r.prototype.finish=function(e){if(!this._finished){var t=this._bytesHashed,i=this._bufferLength,n=t/536870912|0,s=t<<3,o=t%64<56?64:128;this._buffer[i]=128;for(var a=i+1;a0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},r.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},r.prototype.cleanSavedState=function(e){ld.wipe(e.state),e.buffer&&ld.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},r}();Qn.SHA256=d2;var BU=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 kv(r,e,t,i,n){for(;n>=64;){for(var s=e[0],o=e[1],a=e[2],u=e[3],h=e[4],p=e[5],v=e[6],B=e[7],R=0;R<16;R++){var x=i+R*4;r[R]=fd.readUint32BE(t,x)}for(var R=16;R<64;R++){var V=r[R-2],H=(V>>>17|V<<32-17)^(V>>>19|V<<32-19)^V>>>10;V=r[R-15];var K=(V>>>7|V<<32-7)^(V>>>18|V<<32-18)^V>>>3;r[R]=(H+r[R-7]|0)+(K+r[R-16]|0)}for(var R=0;R<64;R++){var H=(((h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7))+(h&p^~h&v)|0)+(B+(BU[R]+r[R]|0)|0)|0,K=((s>>>2|s<<32-2)^(s>>>13|s<<32-13)^(s>>>22|s<<32-22))+(s&o^s&a^o&a)|0;B=v,v=p,p=h,h=u+H|0,u=a,a=o,o=s,s=H+K|0}e[0]+=s,e[1]+=o,e[2]+=a,e[3]+=u,e[4]+=h,e[5]+=p,e[6]+=v,e[7]+=B,i+=64,n-=64}return i}function MU(r){var e=new d2;e.update(r);var t=e.digest();return e.clean(),t}Qn.hash=MU});var v2=D(wr=>{"use strict";l();Object.defineProperty(wr,"__esModule",{value:!0});var PU=Hh(),LU=vr();wr.PUBLIC_KEY_LENGTH=32;wr.SECRET_KEY_LENGTH=32;wr.SHARED_KEY_LENGTH=32;function Oi(r){var e=new Float64Array(16);if(r)for(var t=0;t>16&1),t[n-1]&=65535;t[15]=i[15]-32767-(t[14]>>16&1);var o=t[15]>>16&1;t[14]&=65535,$c(i,t,1-o)}for(var n=0;n<16;n++)r[2*n]=i[n]&255,r[2*n+1]=i[n]>>8}function UU(r,e){for(var t=0;t<16;t++)r[t]=e[2*t]+(e[2*t+1]<<8);r[15]&=32767}function hd(r,e,t){for(var i=0;i<16;i++)r[i]=e[i]+t[i]}function dd(r,e,t){for(var i=0;i<16;i++)r[i]=e[i]-t[i]}function rn(r,e,t){var i,n,s=0,o=0,a=0,u=0,h=0,p=0,v=0,B=0,R=0,x=0,V=0,H=0,K=0,ie=0,k=0,J=0,W=0,G=0,P=0,F=0,$=0,ce=0,Y=0,X=0,A=0,c=0,d=0,g=0,m=0,w=0,S=0,N=t[0],_=t[1],f=t[2],C=t[3],Z=t[4],te=t[5],ee=t[6],ae=t[7],E=t[8],b=t[9],T=t[10],L=t[11],O=t[12],U=t[13],q=t[14],M=t[15];i=e[0],s+=i*N,o+=i*_,a+=i*f,u+=i*C,h+=i*Z,p+=i*te,v+=i*ee,B+=i*ae,R+=i*E,x+=i*b,V+=i*T,H+=i*L,K+=i*O,ie+=i*U,k+=i*q,J+=i*M,i=e[1],o+=i*N,a+=i*_,u+=i*f,h+=i*C,p+=i*Z,v+=i*te,B+=i*ee,R+=i*ae,x+=i*E,V+=i*b,H+=i*T,K+=i*L,ie+=i*O,k+=i*U,J+=i*q,W+=i*M,i=e[2],a+=i*N,u+=i*_,h+=i*f,p+=i*C,v+=i*Z,B+=i*te,R+=i*ee,x+=i*ae,V+=i*E,H+=i*b,K+=i*T,ie+=i*L,k+=i*O,J+=i*U,W+=i*q,G+=i*M,i=e[3],u+=i*N,h+=i*_,p+=i*f,v+=i*C,B+=i*Z,R+=i*te,x+=i*ee,V+=i*ae,H+=i*E,K+=i*b,ie+=i*T,k+=i*L,J+=i*O,W+=i*U,G+=i*q,P+=i*M,i=e[4],h+=i*N,p+=i*_,v+=i*f,B+=i*C,R+=i*Z,x+=i*te,V+=i*ee,H+=i*ae,K+=i*E,ie+=i*b,k+=i*T,J+=i*L,W+=i*O,G+=i*U,P+=i*q,F+=i*M,i=e[5],p+=i*N,v+=i*_,B+=i*f,R+=i*C,x+=i*Z,V+=i*te,H+=i*ee,K+=i*ae,ie+=i*E,k+=i*b,J+=i*T,W+=i*L,G+=i*O,P+=i*U,F+=i*q,$+=i*M,i=e[6],v+=i*N,B+=i*_,R+=i*f,x+=i*C,V+=i*Z,H+=i*te,K+=i*ee,ie+=i*ae,k+=i*E,J+=i*b,W+=i*T,G+=i*L,P+=i*O,F+=i*U,$+=i*q,ce+=i*M,i=e[7],B+=i*N,R+=i*_,x+=i*f,V+=i*C,H+=i*Z,K+=i*te,ie+=i*ee,k+=i*ae,J+=i*E,W+=i*b,G+=i*T,P+=i*L,F+=i*O,$+=i*U,ce+=i*q,Y+=i*M,i=e[8],R+=i*N,x+=i*_,V+=i*f,H+=i*C,K+=i*Z,ie+=i*te,k+=i*ee,J+=i*ae,W+=i*E,G+=i*b,P+=i*T,F+=i*L,$+=i*O,ce+=i*U,Y+=i*q,X+=i*M,i=e[9],x+=i*N,V+=i*_,H+=i*f,K+=i*C,ie+=i*Z,k+=i*te,J+=i*ee,W+=i*ae,G+=i*E,P+=i*b,F+=i*T,$+=i*L,ce+=i*O,Y+=i*U,X+=i*q,A+=i*M,i=e[10],V+=i*N,H+=i*_,K+=i*f,ie+=i*C,k+=i*Z,J+=i*te,W+=i*ee,G+=i*ae,P+=i*E,F+=i*b,$+=i*T,ce+=i*L,Y+=i*O,X+=i*U,A+=i*q,c+=i*M,i=e[11],H+=i*N,K+=i*_,ie+=i*f,k+=i*C,J+=i*Z,W+=i*te,G+=i*ee,P+=i*ae,F+=i*E,$+=i*b,ce+=i*T,Y+=i*L,X+=i*O,A+=i*U,c+=i*q,d+=i*M,i=e[12],K+=i*N,ie+=i*_,k+=i*f,J+=i*C,W+=i*Z,G+=i*te,P+=i*ee,F+=i*ae,$+=i*E,ce+=i*b,Y+=i*T,X+=i*L,A+=i*O,c+=i*U,d+=i*q,g+=i*M,i=e[13],ie+=i*N,k+=i*_,J+=i*f,W+=i*C,G+=i*Z,P+=i*te,F+=i*ee,$+=i*ae,ce+=i*E,Y+=i*b,X+=i*T,A+=i*L,c+=i*O,d+=i*U,g+=i*q,m+=i*M,i=e[14],k+=i*N,J+=i*_,W+=i*f,G+=i*C,P+=i*Z,F+=i*te,$+=i*ee,ce+=i*ae,Y+=i*E,X+=i*b,A+=i*T,c+=i*L,d+=i*O,g+=i*U,m+=i*q,w+=i*M,i=e[15],J+=i*N,W+=i*_,G+=i*f,P+=i*C,F+=i*Z,$+=i*te,ce+=i*ee,Y+=i*ae,X+=i*E,A+=i*b,c+=i*T,d+=i*L,g+=i*O,m+=i*U,w+=i*q,S+=i*M,s+=38*W,o+=38*G,a+=38*P,u+=38*F,h+=38*$,p+=38*ce,v+=38*Y,B+=38*X,R+=38*A,x+=38*c,V+=38*d,H+=38*g,K+=38*m,ie+=38*w,k+=38*S,n=1,i=s+n+65535,n=Math.floor(i/65536),s=i-n*65536,i=o+n+65535,n=Math.floor(i/65536),o=i-n*65536,i=a+n+65535,n=Math.floor(i/65536),a=i-n*65536,i=u+n+65535,n=Math.floor(i/65536),u=i-n*65536,i=h+n+65535,n=Math.floor(i/65536),h=i-n*65536,i=p+n+65535,n=Math.floor(i/65536),p=i-n*65536,i=v+n+65535,n=Math.floor(i/65536),v=i-n*65536,i=B+n+65535,n=Math.floor(i/65536),B=i-n*65536,i=R+n+65535,n=Math.floor(i/65536),R=i-n*65536,i=x+n+65535,n=Math.floor(i/65536),x=i-n*65536,i=V+n+65535,n=Math.floor(i/65536),V=i-n*65536,i=H+n+65535,n=Math.floor(i/65536),H=i-n*65536,i=K+n+65535,n=Math.floor(i/65536),K=i-n*65536,i=ie+n+65535,n=Math.floor(i/65536),ie=i-n*65536,i=k+n+65535,n=Math.floor(i/65536),k=i-n*65536,i=J+n+65535,n=Math.floor(i/65536),J=i-n*65536,s+=n-1+37*(n-1),n=1,i=s+n+65535,n=Math.floor(i/65536),s=i-n*65536,i=o+n+65535,n=Math.floor(i/65536),o=i-n*65536,i=a+n+65535,n=Math.floor(i/65536),a=i-n*65536,i=u+n+65535,n=Math.floor(i/65536),u=i-n*65536,i=h+n+65535,n=Math.floor(i/65536),h=i-n*65536,i=p+n+65535,n=Math.floor(i/65536),p=i-n*65536,i=v+n+65535,n=Math.floor(i/65536),v=i-n*65536,i=B+n+65535,n=Math.floor(i/65536),B=i-n*65536,i=R+n+65535,n=Math.floor(i/65536),R=i-n*65536,i=x+n+65535,n=Math.floor(i/65536),x=i-n*65536,i=V+n+65535,n=Math.floor(i/65536),V=i-n*65536,i=H+n+65535,n=Math.floor(i/65536),H=i-n*65536,i=K+n+65535,n=Math.floor(i/65536),K=i-n*65536,i=ie+n+65535,n=Math.floor(i/65536),ie=i-n*65536,i=k+n+65535,n=Math.floor(i/65536),k=i-n*65536,i=J+n+65535,n=Math.floor(i/65536),J=i-n*65536,s+=n-1+37*(n-1),r[0]=s,r[1]=o,r[2]=a,r[3]=u,r[4]=h,r[5]=p,r[6]=v,r[7]=B,r[8]=R,r[9]=x,r[10]=V,r[11]=H,r[12]=K,r[13]=ie,r[14]=k,r[15]=J}function kc(r,e){rn(r,e,e)}function qU(r,e){for(var t=Oi(),i=0;i<16;i++)t[i]=e[i];for(var i=253;i>=0;i--)kc(t,t),i!==2&&i!==4&&rn(t,t,e);for(var i=0;i<16;i++)r[i]=t[i]}function Yv(r,e){for(var t=new Uint8Array(32),i=new Float64Array(80),n=Oi(),s=Oi(),o=Oi(),a=Oi(),u=Oi(),h=Oi(),p=0;p<31;p++)t[p]=r[p];t[31]=r[31]&127|64,t[0]&=248,UU(i,e);for(var p=0;p<16;p++)s[p]=i[p];n[0]=a[0]=1;for(var p=254;p>=0;--p){var v=t[p>>>3]>>>(p&7)&1;$c(n,s,v),$c(o,a,v),hd(u,n,o),dd(n,n,o),hd(o,s,a),dd(s,s,a),kc(a,u),kc(h,n),rn(n,o,n),rn(o,s,u),hd(u,n,o),dd(n,n,o),kc(s,n),dd(o,a,h),rn(n,o,RU),hd(n,n,a),rn(o,o,n),rn(n,a,h),rn(a,s,i),kc(s,u),$c(n,s,v),$c(o,a,v)}for(var p=0;p<16;p++)i[p+16]=n[p],i[p+32]=o[p],i[p+48]=s[p],i[p+64]=a[p];var B=i.subarray(32),R=i.subarray(16);qU(B,B),rn(R,R,B);var x=new Uint8Array(32);return FU(x,R),x}wr.scalarMult=Yv;function y2(r){return Yv(r,g2)}wr.scalarMultBase=y2;function m2(r){if(r.length!==wr.SECRET_KEY_LENGTH)throw new Error("x25519: seed must be "+wr.SECRET_KEY_LENGTH+" bytes");var e=new Uint8Array(r),t=y2(e);return{publicKey:t,secretKey:e}}wr.generateKeyPairFromSeed=m2;function VU(r){var e=PU.randomBytes(32,r),t=m2(e);return LU.wipe(e),t}wr.generateKeyPair=VU;function HU(r,e,t){if(t===void 0&&(t=!1),r.length!==wr.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(e.length!==wr.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");var i=Yv(r,e);if(t){for(var n=0,s=0;se[t])return 1}return r.byteLength>e.byteLength?1:r.byteLength{l()});function A2(r,e){if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t{l()});function I2(r,e){if(r.length!==e.length)throw new Error("Inputs should have the same length");let t=nu(r.length);for(let i=0;i{l();Xh()});var C2={};st(C2,{compare:()=>w2,concat:()=>Zh,equals:()=>A2,fromString:()=>Zi,toString:()=>Xi,xor:()=>I2});var S2=ye(()=>{l();E2();hv();_2();qv();Uv();b2()});var U2=D(et=>{"use strict";l();var x2=et&&et.__spreadArray||function(r,e,t){if(t||arguments.length===2)for(var i=0,n=e.length,s;i"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new P2:typeof navigator<"u"?Jv(navigator.userAgent):F2()}et.detect=KU;function L2(r){return r!==""&&GU.reduce(function(e,t){var i=t[0],n=t[1];if(e)return e;var s=n.exec(r);return!!s&&[i,s]},!1)}function zU(r){var e=L2(r);return e?e[0]:null}et.browserName=zU;function Jv(r){var e=L2(r);if(!e)return null;var t=e[0],i=e[1];if(t==="searchbot")return new M2;var n=i[1]&&i[1].split(".").join("_").split("_").slice(0,3);n?n.length{"use strict";l();Object.defineProperty(ze,"__esModule",{value:!0});ze.getLocalStorage=ze.getLocalStorageOrThrow=ze.getCrypto=ze.getCryptoOrThrow=ze.getLocation=ze.getLocationOrThrow=ze.getNavigator=ze.getNavigatorOrThrow=ze.getDocument=ze.getDocumentOrThrow=ze.getFromWindowOrThrow=ze.getFromWindow=void 0;function lo(r){let e;return typeof window<"u"&&typeof window[r]<"u"&&(e=window[r]),e}ze.getFromWindow=lo;function hu(r){let e=lo(r);if(!e)throw new Error(`${r} is not defined in Window`);return e}ze.getFromWindowOrThrow=hu;function kU(){return hu("document")}ze.getDocumentOrThrow=kU;function WU(){return lo("document")}ze.getDocument=WU;function YU(){return hu("navigator")}ze.getNavigatorOrThrow=YU;function JU(){return lo("navigator")}ze.getNavigator=JU;function XU(){return hu("location")}ze.getLocationOrThrow=XU;function ZU(){return lo("location")}ze.getLocation=ZU;function eq(){return hu("crypto")}ze.getCryptoOrThrow=eq;function tq(){return lo("crypto")}ze.getCrypto=tq;function rq(){return hu("localStorage")}ze.getLocalStorageOrThrow=rq;function iq(){return lo("localStorage")}ze.getLocalStorage=iq});var V2=D(pd=>{"use strict";l();Object.defineProperty(pd,"__esModule",{value:!0});pd.getWindowMetadata=void 0;var q2=Xv();function nq(){let r,e;try{r=q2.getDocumentOrThrow(),e=q2.getLocationOrThrow()}catch{return null}function t(){let v=r.getElementsByTagName("link"),B=[];for(let R=0;R-1){let H=x.getAttribute("href");if(H)if(H.toLowerCase().indexOf("https:")===-1&&H.toLowerCase().indexOf("http:")===-1&&H.indexOf("//")!==0){let K=e.protocol+"//"+e.host;if(H.indexOf("/")===0)K+=H;else{let ie=e.pathname.split("/");ie.pop();let k=ie.join("/");K+=k+"/"+H}B.push(K)}else if(H.indexOf("//")===0){let K=e.protocol+H;B.push(K)}else B.push(H)}}return B}function i(...v){let B=r.getElementsByTagName("meta");for(let R=0;Rx.getAttribute(H)).filter(H=>H?v.includes(H):!1);if(V.length&&V){let H=x.getAttribute("content");if(H)return H}}return""}function n(){let v=i("name","og:site_name","og:title","twitter:title");return v||(v=r.title),v}function s(){return i("description","og:description","twitter:description","keywords")}let o=n(),a=s(),u=e.origin,h=t();return{description:a,url:u,icons:h,name:o}}pd.getWindowMetadata=nq});var Q2=D((Bee,H2)=>{"use strict";l();H2.exports=r=>encodeURIComponent(r).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)});var $2=D((Pee,z2)=>{"use strict";l();var K2="%[a-f0-9]{2}",j2=new RegExp(K2,"gi"),G2=new RegExp("("+K2+")+","gi");function Zv(r,e){try{return decodeURIComponent(r.join(""))}catch{}if(r.length===1)return r;e=e||1;var t=r.slice(0,e),i=r.slice(e);return Array.prototype.concat.call([],Zv(t),Zv(i))}function sq(r){try{return decodeURIComponent(r)}catch{for(var e=r.match(j2),t=1;t{"use strict";l();k2.exports=(r,e)=>{if(!(typeof r=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[r];let t=r.indexOf(e);return t===-1?[r]:[r.slice(0,t),r.slice(t+e.length)]}});var J2=D((Uee,Y2)=>{"use strict";l();Y2.exports=function(r,e){for(var t={},i=Object.keys(r),n=Array.isArray(e),s=0;s{"use strict";l();var aq=Q2(),uq=$2(),Z2=W2(),cq=J2(),lq=r=>r==null,e1=Symbol("encodeFragmentIdentifier");function fq(r){switch(r.arrayFormat){case"index":return e=>(t,i)=>{let n=t.length;return i===void 0||r.skipNull&&i===null||r.skipEmptyString&&i===""?t:i===null?[...t,[ct(e,r),"[",n,"]"].join("")]:[...t,[ct(e,r),"[",ct(n,r),"]=",ct(i,r)].join("")]};case"bracket":return e=>(t,i)=>i===void 0||r.skipNull&&i===null||r.skipEmptyString&&i===""?t:i===null?[...t,[ct(e,r),"[]"].join("")]:[...t,[ct(e,r),"[]=",ct(i,r)].join("")];case"colon-list-separator":return e=>(t,i)=>i===void 0||r.skipNull&&i===null||r.skipEmptyString&&i===""?t:i===null?[...t,[ct(e,r),":list="].join("")]:[...t,[ct(e,r),":list=",ct(i,r)].join("")];case"comma":case"separator":case"bracket-separator":{let e=r.arrayFormat==="bracket-separator"?"[]=":"=";return t=>(i,n)=>n===void 0||r.skipNull&&n===null||r.skipEmptyString&&n===""?i:(n=n===null?"":n,i.length===0?[[ct(t,r),e,ct(n,r)].join("")]:[[i,ct(n,r)].join(r.arrayFormatSeparator)])}default:return e=>(t,i)=>i===void 0||r.skipNull&&i===null||r.skipEmptyString&&i===""?t:i===null?[...t,ct(e,r)]:[...t,[ct(e,r),"=",ct(i,r)].join("")]}}function hq(r){let e;switch(r.arrayFormat){case"index":return(t,i,n)=>{if(e=/\[(\d*)\]$/.exec(t),t=t.replace(/\[\d*\]$/,""),!e){n[t]=i;return}n[t]===void 0&&(n[t]={}),n[t][e[1]]=i};case"bracket":return(t,i,n)=>{if(e=/(\[\])$/.exec(t),t=t.replace(/\[\]$/,""),!e){n[t]=i;return}if(n[t]===void 0){n[t]=[i];return}n[t]=[].concat(n[t],i)};case"colon-list-separator":return(t,i,n)=>{if(e=/(:list)$/.exec(t),t=t.replace(/:list$/,""),!e){n[t]=i;return}if(n[t]===void 0){n[t]=[i];return}n[t]=[].concat(n[t],i)};case"comma":case"separator":return(t,i,n)=>{let s=typeof i=="string"&&i.includes(r.arrayFormatSeparator),o=typeof i=="string"&&!s&&nn(i,r).includes(r.arrayFormatSeparator);i=o?nn(i,r):i;let a=s||o?i.split(r.arrayFormatSeparator).map(u=>nn(u,r)):i===null?i:nn(i,r);n[t]=a};case"bracket-separator":return(t,i,n)=>{let s=/(\[\])$/.test(t);if(t=t.replace(/\[\]$/,""),!s){n[t]=i&&nn(i,r);return}let o=i===null?[]:i.split(r.arrayFormatSeparator).map(a=>nn(a,r));if(n[t]===void 0){n[t]=o;return}n[t]=[].concat(n[t],o)};default:return(t,i,n)=>{if(n[t]===void 0){n[t]=i;return}n[t]=[].concat(n[t],i)}}}function e3(r){if(typeof r!="string"||r.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function ct(r,e){return e.encode?e.strict?aq(r):encodeURIComponent(r):r}function nn(r,e){return e.decode?uq(r):r}function t3(r){return Array.isArray(r)?r.sort():typeof r=="object"?t3(Object.keys(r)).sort((e,t)=>Number(e)-Number(t)).map(e=>r[e]):r}function r3(r){let e=r.indexOf("#");return e!==-1&&(r=r.slice(0,e)),r}function dq(r){let e="",t=r.indexOf("#");return t!==-1&&(e=r.slice(t)),e}function i3(r){r=r3(r);let e=r.indexOf("?");return e===-1?"":r.slice(e+1)}function X2(r,e){return e.parseNumbers&&!Number.isNaN(Number(r))&&typeof r=="string"&&r.trim()!==""?r=Number(r):e.parseBooleans&&r!==null&&(r.toLowerCase()==="true"||r.toLowerCase()==="false")&&(r=r.toLowerCase()==="true"),r}function n3(r,e){e=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},e),e3(e.arrayFormatSeparator);let t=hq(e),i=Object.create(null);if(typeof r!="string"||(r=r.trim().replace(/^[?#&]/,""),!r))return i;for(let n of r.split("&")){if(n==="")continue;let[s,o]=Z2(e.decode?n.replace(/\+/g," "):n,"=");o=o===void 0?null:["comma","separator","bracket-separator"].includes(e.arrayFormat)?o:nn(o,e),t(nn(s,e),o,i)}for(let n of Object.keys(i)){let s=i[n];if(typeof s=="object"&&s!==null)for(let o of Object.keys(s))s[o]=X2(s[o],e);else i[n]=X2(s,e)}return e.sort===!1?i:(e.sort===!0?Object.keys(i).sort():Object.keys(i).sort(e.sort)).reduce((n,s)=>{let o=i[s];return Boolean(o)&&typeof o=="object"&&!Array.isArray(o)?n[s]=t3(o):n[s]=o,n},Object.create(null))}Er.extract=i3;Er.parse=n3;Er.stringify=(r,e)=>{if(!r)return"";e=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},e),e3(e.arrayFormatSeparator);let t=o=>e.skipNull&&lq(r[o])||e.skipEmptyString&&r[o]==="",i=fq(e),n={};for(let o of Object.keys(r))t(o)||(n[o]=r[o]);let s=Object.keys(n);return e.sort!==!1&&s.sort(e.sort),s.map(o=>{let a=r[o];return a===void 0?"":a===null?ct(o,e):Array.isArray(a)?a.length===0&&e.arrayFormat==="bracket-separator"?ct(o,e)+"[]":a.reduce(i(o),[]).join("&"):ct(o,e)+"="+ct(a,e)}).filter(o=>o.length>0).join("&")};Er.parseUrl=(r,e)=>{e=Object.assign({decode:!0},e);let[t,i]=Z2(r,"#");return Object.assign({url:t.split("?")[0]||"",query:n3(i3(r),e)},e&&e.parseFragmentIdentifier&&i?{fragmentIdentifier:nn(i,e)}:{})};Er.stringifyUrl=(r,e)=>{e=Object.assign({encode:!0,strict:!0,[e1]:!0},e);let t=r3(r.url).split("?")[0]||"",i=Er.extract(r.url),n=Er.parse(i,{sort:!1}),s=Object.assign(n,r.query),o=Er.stringify(s,e);o&&(o=`?${o}`);let a=dq(r.url);return r.fragmentIdentifier&&(a=`#${e[e1]?ct(r.fragmentIdentifier,e):r.fragmentIdentifier}`),`${t}${o}${a}`};Er.pick=(r,e,t)=>{t=Object.assign({parseFragmentIdentifier:!0,[e1]:!1},t);let{url:i,query:n,fragmentIdentifier:s}=Er.parseUrl(r,t);return Er.stringifyUrl({url:i,query:cq(n,e),fragmentIdentifier:s},t)};Er.exclude=(r,e,t)=>{let i=Array.isArray(e)?n=>!e.includes(n):(n,s)=>!e(n,s);return Er.pick(r,i,t)}});var o3=ye(()=>{l()});function jn(r,e,t="string"){if(!r[e]||typeof r[e]!==t)throw new Error(`Missing or invalid "${e}" param`)}function pq(r,e){let t=!0;return e.forEach(i=>{i in r||(t=!1)}),t}function gq(r,e){return Array.isArray(r)?r.length===e:Object.keys(r).length===e}function yq(r,e){return Array.isArray(r)?r.length>=e:Object.keys(r).length>=e}function Wc(r,e,t){return(!t.length?gq(r,e.length):yq(r,e.length))?pq(r,e):!1}function Yc(r,e,t="_"){let i=r.split(t);return i[i.length-1].trim().toLowerCase()===e.trim().toLowerCase()}var t1=ye(()=>{l()});function mq(r){return gd(r.method)&&yd(r.params)}function gd(r){return Yc(r,"subscribe")}function yd(r){return Wc(r,["topic"],[])}function vq(r){return md(r.method)&&vd(r.params)}function md(r){return Yc(r,"publish")}function vd(r){return Wc(r,["message","topic","ttl"],["prompt","tag"])}function wq(r){return wd(r.method)&&Ed(r.params)}function wd(r){return Yc(r,"unsubscribe")}function Ed(r){return Wc(r,["id","topic"],[])}function Eq(r){return Ad(r.method)&&_d(r.params)}function Ad(r){return Yc(r,"subscription")}function _d(r){return Wc(r,["id","data"],[])}var r1=ye(()=>{l();t1()});function Aq(r){if(!gd(r.method))throw new Error("JSON-RPC Request has invalid subscribe method");if(!yd(r.params))throw new Error("JSON-RPC Request has invalid subscribe params");let e=r.params;return jn(e,"topic"),e}function _q(r){if(!md(r.method))throw new Error("JSON-RPC Request has invalid publish method");if(!vd(r.params))throw new Error("JSON-RPC Request has invalid publish params");let e=r.params;return jn(e,"topic"),jn(e,"message"),jn(e,"ttl","number"),e}function Iq(r){if(!wd(r.method))throw new Error("JSON-RPC Request has invalid unsubscribe method");if(!Ed(r.params))throw new Error("JSON-RPC Request has invalid unsubscribe params");let e=r.params;return jn(e,"id"),e}function bq(r){if(!Ad(r.method))throw new Error("JSON-RPC Request has invalid subscription method");if(!_d(r.params))throw new Error("JSON-RPC Request has invalid subscription params");let e=r.params;return jn(e,"id"),jn(e,"data"),e}var a3=ye(()=>{l();t1();r1()});var Cq,u3=ye(()=>{l();Cq={waku:{publish:"waku_publish",subscribe:"waku_subscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe"},irn:{publish:"irn_publish",subscribe:"irn_subscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe"},iridium:{publish:"iridium_publish",subscribe:"iridium_subscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe"}}});var c3={};st(c3,{RELAY_JSONRPC:()=>Cq,isPublishMethod:()=>md,isPublishParams:()=>vd,isPublishRequest:()=>vq,isSubscribeMethod:()=>gd,isSubscribeParams:()=>yd,isSubscribeRequest:()=>mq,isSubscriptionMethod:()=>Ad,isSubscriptionParams:()=>_d,isSubscriptionRequest:()=>Eq,isUnsubscribeMethod:()=>wd,isUnsubscribeParams:()=>Ed,isUnsubscribeRequest:()=>wq,parsePublishRequest:()=>_q,parseSubscribeRequest:()=>Aq,parseSubscriptionRequest:()=>bq,parseUnsubscribeRequest:()=>Iq});var l3=ye(()=>{l();o3();a3();u3();r1()});var Dd=D(ne=>{"use strict";l();Object.defineProperty(ne,"__esModule",{value:!0});var m3=o2(),Sq=h2(),v3=Hh(),u1=p2(),xq=v2(),tt=(S2(),ti(C2)),Tq=U2(),pu=ro(),Jc=Xv(),Nq=V2(),Dq=s3(),Oq=(l3(),ti(c3));function w3(r){if(r&&r.__esModule)return r;var e=Object.create(null);return r&&Object.keys(r).forEach(function(t){if(t!=="default"){var i=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:function(){return r[t]}})}}),e.default=r,Object.freeze(e)}var E3=w3(xq),Id=w3(Dq),Sd=":";function A3(r){let[e,t]=r.split(Sd);return{namespace:e,reference:t}}function _3(r){let{namespace:e,reference:t}=r;return[e,t].join(Sd)}function c1(r){let[e,t,i]=r.split(Sd);return{namespace:e,reference:t,address:i}}function I3(r){let{namespace:e,reference:t,address:i}=r;return[e,t,i].join(Sd)}function l1(r,e){let t=[];return r.forEach(i=>{let n=e(i);t.includes(n)||t.push(n)}),t}function b3(r){let{address:e}=c1(r);return e}function C3(r){let{namespace:e,reference:t}=c1(r);return _3({namespace:e,reference:t})}function Bq(r,e){let{namespace:t,reference:i}=A3(e);return I3({namespace:t,reference:i,address:r})}function Mq(r){return l1(r,b3)}function S3(r){return l1(r,C3)}function Pq(r,e=[]){let t=[];return Object.keys(r).forEach(i=>{if(e.length&&!e.includes(i))return;let n=r[i];t.push(...n.accounts)}),t}function Lq(r,e=[]){let t=[];return Object.keys(r).forEach(i=>{if(e.length&&!e.includes(i))return;let n=r[i];t.push(...S3(n.accounts))}),t}function Rq(r,e=[]){let t=[];return Object.keys(r).forEach(i=>{if(e.length&&!e.includes(i))return;let n=r[i];t.push(...n.chains)}),t}var f1="base10",fr="base16",bd="base64pad",xd="utf8",h1=0,gu=1,Fq=0,f3=1,i1=12,d1=32;function Uq(){let r=E3.generateKeyPair();return{privateKey:tt.toString(r.secretKey,fr),publicKey:tt.toString(r.publicKey,fr)}}function qq(){let r=v3.randomBytes(d1);return tt.toString(r,fr)}function Vq(r,e){let t=E3.sharedKey(tt.fromString(r,fr),tt.fromString(e,fr)),i=new Sq.HKDF(u1.SHA256,t).expand(d1);return tt.toString(i,fr)}function Hq(r){let e=u1.hash(tt.fromString(r,fr));return tt.toString(e,fr)}function Qq(r){let e=u1.hash(tt.fromString(r,xd));return tt.toString(e,fr)}function x3(r){return tt.fromString(`${r}`,f1)}function Xc(r){return Number(tt.toString(r,f1))}function jq(r){let e=x3(typeof r.type<"u"?r.type:h1);if(Xc(e)===gu&&typeof r.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");let t=typeof r.senderPublicKey<"u"?tt.fromString(r.senderPublicKey,fr):void 0,i=typeof r.iv<"u"?tt.fromString(r.iv,fr):v3.randomBytes(i1),n=new m3.ChaCha20Poly1305(tt.fromString(r.symKey,fr)).seal(i,tt.fromString(r.message,xd));return T3({type:e,sealed:n,iv:i,senderPublicKey:t})}function Gq(r){let e=new m3.ChaCha20Poly1305(tt.fromString(r.symKey,fr)),{sealed:t,iv:i}=p1(r.encoded),n=e.open(i,t);if(n===null)throw new Error("Failed to decrypt");return tt.toString(n,xd)}function T3(r){if(Xc(r.type)===gu){if(typeof r.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return tt.toString(tt.concat([r.type,r.senderPublicKey,r.iv,r.sealed]),bd)}return tt.toString(tt.concat([r.type,r.iv,r.sealed]),bd)}function p1(r){let e=tt.fromString(r,bd),t=e.slice(Fq,f3),i=f3;if(Xc(t)===gu){let a=i+d1,u=a+i1,h=e.slice(i,a),p=e.slice(a,u),v=e.slice(u);return{type:t,sealed:v,iv:p,senderPublicKey:h}}let n=i+i1,s=e.slice(i,n),o=e.slice(n);return{type:t,sealed:o,iv:s}}function Kq(r,e){let t=p1(r);return N3({type:Xc(t.type),senderPublicKey:typeof t.senderPublicKey<"u"?tt.toString(t.senderPublicKey,fr):void 0,receiverPublicKey:e?.receiverPublicKey})}function N3(r){let e=r?.type||h1;if(e===gu){if(typeof r?.senderPublicKey>"u")throw new Error("missing sender public key");if(typeof r?.receiverPublicKey>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:r?.senderPublicKey,receiverPublicKey:r?.receiverPublicKey}}function zq(r){return r.type===gu&&typeof r.senderPublicKey=="string"&&typeof r.receiverPublicKey=="string"}var $q=Object.defineProperty,h3=Object.getOwnPropertySymbols,kq=Object.prototype.hasOwnProperty,Wq=Object.prototype.propertyIsEnumerable,d3=(r,e,t)=>e in r?$q(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,p3=(r,e)=>{for(var t in e||(e={}))kq.call(e,t)&&d3(r,t,e[t]);if(h3)for(var t of h3(e))Wq.call(e,t)&&d3(r,t,e[t]);return r},D3="ReactNative",du={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},Cd=" ",Yq=":",O3="/",g1=2,Jq=1e3,B3="js";function y1(){return typeof I.default<"u"&&typeof I.default.versions<"u"&&typeof I.default.versions.node<"u"}function M3(){return!Jc.getDocument()&&!!Jc.getNavigator()&&navigator.product===D3}function P3(){return!y1()&&!!Jc.getNavigator()}function m1(){return M3()?du.reactNative:y1()?du.node:P3()?du.browser:du.unknown}function L3(r,e){let t=Id.parse(r);return t=p3(p3({},t),e),r=Id.stringify(t),r}function Xq(){return Nq.getWindowMetadata()||{name:"",description:"",url:"",icons:[""]}}function Zq(r,e){var t;let i=m1(),n={protocol:r,version:e,env:i};return i==="browser"&&(n.host=((t=Jc.getLocation())==null?void 0:t.host)||"unknown"),n}function R3(){let r=Tq.detect();if(r===null)return"unknown";let e=r.os?r.os.replace(" ","").toLowerCase():"unknown";return r.type==="browser"?[e,r.name,r.version].join("-"):[e,r.version].join("-")}function F3(){var r;let e=m1();return e===du.browser?[e,((r=Jc.getLocation())==null?void 0:r.host)||"unknown"].join(":"):e}function U3(r,e,t){let i=R3(),n=F3();return[[r,e].join("-"),[B3,t].join("-"),i,n].join("/")}function eV({protocol:r,version:e,relayUrl:t,sdkVersion:i,auth:n,projectId:s}){let o=t.split("?"),a=U3(r,e,i),u={auth:n,ua:a,projectId:s},h=L3(o[1]||"",u);return o[0]+"?"+h}function tV(r){let e=(r.match(/^[^:]+(?=:\/\/)/gi)||[])[0],t=typeof e<"u"?r.split("://")[1]:r;return e=e==="wss"?"https":"http",[e,t].join("://")}function rV(r,e,t){if(!r[e]||typeof r[e]!==t)throw new Error(`Missing or invalid "${e}" param`)}function q3(r,e=g1){return V3(r.split(O3),e)}function iV(r){return q3(r).join(Cd)}function lr(r,e){return r.filter(t=>e.includes(t)).length===r.length}function V3(r,e=g1){return r.slice(Math.max(r.length-e,0))}function nV(r){return Object.fromEntries(r.entries())}function sV(r){return new Map(Object.entries(r))}function oV(r,e){let t={};return Object.keys(r).forEach(i=>{t[i]=e(r[i])}),t}var aV=r=>r;function H3(r){return r.trim().replace(/^\w/,e=>e.toUpperCase())}function uV(r){return r.split(Cd).map(e=>H3(e)).join(Cd)}function cV(r,e){return pu.fromMiliseconds((e||Date.now())+pu.toMiliseconds(r))}function lV(r){return pu.fromMiliseconds(Date.now())>=pu.toMiliseconds(r)}function fV(){let r=pu.toMiliseconds(pu.FIVE_MINUTES),e,t,i;return{resolve:n=>{i&&e&&(clearTimeout(i),e(n))},reject:n=>{i&&t&&(clearTimeout(i),t(n))},done:()=>new Promise((n,s)=>{i=setTimeout(s,r),e=n,t=s})}}function v1(r,e){if(typeof e=="string"&&e.startsWith(`${r}:`))return e;if(r.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(r.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: ${r}`)}function hV(r){return v1("topic",r)}function dV(r){return v1("id",r)}function pV(r){let[e,t]=r.split(":"),i={id:void 0,topic:void 0};if(e==="topic"&&typeof t=="string")i.topic=t;else if(e==="id"&&Number.isInteger(Number(t)))i.id=Number(t);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${t}`);return i}function gV(r,e){return`${r}${e?`:${e}`:""}`}var Q3="irn";function yV(r){return r?.relay||{protocol:Q3}}function mV(r){let e=Oq.RELAY_JSONRPC[r];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${r}`);return e}var vV=Object.defineProperty,g3=Object.getOwnPropertySymbols,wV=Object.prototype.hasOwnProperty,EV=Object.prototype.propertyIsEnumerable,y3=(r,e,t)=>e in r?vV(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,AV=(r,e)=>{for(var t in e||(e={}))wV.call(e,t)&&y3(r,t,e[t]);if(g3)for(var t of g3(e))EV.call(e,t)&&y3(r,t,e[t]);return r};function j3(r,e="-"){let t={},i="relay"+e;return Object.keys(r).forEach(n=>{if(n.startsWith(i)){let s=n.replace(i,""),o=r[n];t[s]=o}}),t}function _V(r){let e=r.indexOf(":"),t=r.indexOf("?")!==-1?r.indexOf("?"):void 0,i=r.substring(0,e),n=r.substring(e+1,t).split("@"),s=typeof t<"u"?r.substring(t):"",o=Id.parse(s);return{protocol:i,topic:n[0],version:parseInt(n[1],10),symKey:o.symKey,relay:j3(o)}}function G3(r,e="-"){let t="relay",i={};return Object.keys(r).forEach(n=>{let s=t+e+n;r[n]&&(i[s]=r[n])}),i}function IV(r){return`${r.protocol}:${r.topic}@${r.version}?`+Id.stringify(AV({symKey:r.symKey},G3(r.relay)))}function Xr(r){let e=[];return r.forEach(t=>{let[i,n]=t.split(":");e.push(`${i}:${n}`)}),e}function K3(r){let e=[];return Object.values(r).forEach(t=>{e.push(...Xr(t.accounts)),t.extension&&t.extension.forEach(i=>{e.push(...Xr(i.accounts))})}),e}function z3(r,e){let t=[];return Object.values(r).forEach(i=>{Xr(i.accounts).includes(e)&&t.push(...i.methods),i.extension&&i.extension.forEach(n=>{Xr(n.accounts).includes(e)&&t.push(...n.methods)})}),t}function $3(r,e){let t=[];return Object.values(r).forEach(i=>{Xr(i.accounts).includes(e)&&t.push(...i.events),i.extension&&i.extension.forEach(n=>{Xr(n.accounts).includes(e)&&t.push(...n.events)})}),t}var bV={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}},CV={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 Jr(r,e){let{message:t,code:i}=CV[r];return{message:e?`${t} ${e}`:t,code:i}}function fo(r,e){let{message:t,code:i}=bV[r];return{message:e?`${t} ${e}`:t,code:i}}function yu(r,e){return Array.isArray(r)?typeof e<"u"&&r.length?r.every(e):!0:!1}function w1(r){return Object.getPrototypeOf(r)===Object.prototype&&Object.keys(r).length}function sn(r){return typeof r>"u"}function Cr(r,e){return e&&sn(r)?!0:typeof r=="string"&&Boolean(r.trim().length)}function E1(r,e){return e&&sn(r)?!0:typeof r=="number"&&!isNaN(r)}function SV(r,e){let{requiredNamespaces:t}=e,i=Object.keys(r.namespaces),n=Object.keys(t),s=!0;return lr(n,i)?(i.forEach(o=>{let{accounts:a,methods:u,events:h,extension:p}=r.namespaces[o],v=Xr(a),B=t[o];(!lr(B.chains,v)||!lr(B.methods,u)||!lr(B.events,h))&&(s=!1),s&&p&&p.forEach(R=>{var x;let{accounts:V,methods:H,events:K}=R,ie=Xr(V);(x=B.extension)!=null&&x.find(k=>lr(k.chains,ie)&&lr(k.methods,H)&&lr(k.events,K))||(s=!1)})}),s):!1}function Td(r){return Cr(r,!1)&&r.includes(":")?r.split(":").length===2:!1}function k3(r){if(Cr(r,!1)&&r.includes(":")){let e=r.split(":");if(e.length===3){let t=e[0]+":"+e[1];return!!e[2]&&Td(t)}}return!1}function xV(r){if(Cr(r,!1))try{return typeof new URL(r)<"u"}catch{return!1}return!1}function TV(r){var e;return(e=r?.proposer)==null?void 0:e.publicKey}function NV(r){return r?.topic}function DV(r,e){let t=null;return Cr(r?.publicKey,!1)||(t=Jr("MISSING_OR_INVALID",`${e} controller public key should be a string`)),t}function Nd(r,e){let t=null;return sn(r?.extension)||(!yu(r.extension)||!r.extension.length)&&(t=Jr("MISSING_OR_INVALID",`${e} extension should be an array of namespaces, or omitted`)),t}function n1(r){let e=!0;return yu(r)?r.length&&(e=r.every(t=>Cr(t,!1))):e=!1,e}function s1(r,e,t){let i=null;return yu(e)?e.forEach(n=>{i||(!Td(n)||!n.includes(r))&&(i=fo("UNSUPPORTED_CHAINS",`${t}, chain ${n} should be a string and conform to "namespace:chainId" format`))}):i=fo("UNSUPPORTED_CHAINS",`${t}, chains ${e} should be an array of strings conforming to "namespace:chainId" format`),i}function W3(r,e){let t=null;return Object.entries(r).forEach(([i,n])=>{if(t)return;let s=s1(i,n?.chains,`${e} requiredNamespace`),o=Nd(n,e);s?t=s:o?t=o:n.extension&&n.extension.forEach(a=>{if(t)return;let u=s1(i,a.chains,`${e} extension`);u&&(t=u)})}),t}function o1(r,e){let t=null;return yu(r)?r.forEach(i=>{t||k3(i)||(t=fo("UNSUPPORTED_ACCOUNTS",`${e}, account ${i} should be a string and conform to "namespace:chainId:address" format`))}):t=fo("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),t}function Y3(r,e){let t=null;return Object.values(r).forEach(i=>{if(t)return;let n=o1(i?.accounts,`${e} namespace`),s=Nd(i,e);n?t=n:s?t=s:i.extension&&i.extension.forEach(o=>{if(t)return;let a=o1(o.accounts,`${e} extension`);a&&(t=a)})}),t}function a1(r,e){let t=null;return n1(r?.methods)?n1(r?.events)||(t=fo("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):t=fo("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),t}function A1(r,e){let t=null;return Object.values(r).forEach(i=>{if(t)return;let n=a1(i,`${e}, namespace`),s=Nd(i,e);n?t=n:s?t=s:i.extension&&i.extension.forEach(o=>{if(t)return;let a=a1(o,`${e}, extension`);a&&(t=a)})}),t}function OV(r,e){let t=null;if(r&&w1(r)){let i=A1(r,e);i&&(t=i);let n=W3(r,e);n&&(t=n)}else t=Jr("MISSING_OR_INVALID",`${e}, requiredNamespaces should be an object with data`);return t}function BV(r,e){let t=null;if(r&&w1(r)){let i=A1(r,e);i&&(t=i);let n=Y3(r,e);n&&(t=n)}else t=Jr("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return t}function J3(r){return Cr(r.protocol,!0)}function MV(r,e){let t=!1;return e&&!r?t=!0:r&&yu(r)&&r.length&&r.forEach(i=>{t=J3(i)}),t}function PV(r){return typeof r=="number"}function LV(r){return typeof r<"u"&&typeof r!==null}function RV(r){return!(!r||typeof r!="object"||!r.code||!E1(r.code,!1)||!r.message||!Cr(r.message,!1))}function FV(r){return!(sn(r)||!Cr(r.method,!1))}function UV(r){return!(sn(r)||sn(r.result)&&sn(r.error)||!E1(r.id,!1)||!Cr(r.jsonrpc,!1))}function qV(r){return!(sn(r)||!Cr(r.name,!1))}function VV(r,e){return!(!Td(e)||!K3(r).includes(e))}function HV(r,e,t){return Cr(t,!1)?z3(r,e).includes(t):!1}function QV(r,e,t){return Cr(t,!1)?$3(r,e).includes(t):!1}function jV(r,e,t){let i=null,n=Object.keys(r),s=Object.keys(e);return lr(n,s)?n.forEach(o=>{var a;if(i)return;let u=r[o].chains,h=Xr(e[o].accounts);lr(u,h)?lr(r[o].methods,e[o].methods)?lr(r[o].events,e[o].events)?r[o].extension&&!e[o].extension?i=Jr("NON_CONFORMING_NAMESPACES",`${t} namespaces extension doesn't satisfy requiredNamespaces extension for ${o}`):r[o].extension&&e[o].extension&&((a=r[o].extension)==null||a.forEach(({methods:p,events:v,chains:B})=>{var R;i||(R=e[o].extension)!=null&&R.find(x=>{let V=Xr(x.accounts);return lr(B,V)&&lr(v,x.events)&&lr(p,x.methods)})||(i=Jr("NON_CONFORMING_NAMESPACES",`${t} namespaces extension doesn't satisfy requiredNamespaces extension for ${o}`))})):i=Jr("NON_CONFORMING_NAMESPACES",`${t} namespaces events don't satisfy requiredNamespaces events for ${o}`):i=Jr("NON_CONFORMING_NAMESPACES",`${t} namespaces methods don't satisfy requiredNamespaces methods for ${o}`):i=Jr("NON_CONFORMING_NAMESPACES",`${t} namespaces accounts don't satisfy requiredNamespaces chains for ${o}`)}):i=Jr("NON_CONFORMING_NAMESPACES",`${t} namespaces keys don't satisfy requiredNamespaces`),i}ne.BASE10=f1,ne.BASE16=fr,ne.BASE64=bd,ne.COLON=Yq,ne.DEFAULT_DEPTH=g1,ne.EMPTY_SPACE=Cd,ne.ENV_MAP=du,ne.ONE_THOUSAND=Jq,ne.REACT_NATIVE_PRODUCT=D3,ne.RELAYER_DEFAULT_PROTOCOL=Q3,ne.SDK_TYPE=B3,ne.SLASH=O3,ne.TYPE_0=h1,ne.TYPE_1=gu,ne.UTF8=xd,ne.appendToQueryString=L3,ne.assertType=rV,ne.calcExpiry=cV,ne.capitalize=uV,ne.capitalizeWord=H3,ne.createDelayedPromise=fV,ne.decodeTypeByte=Xc,ne.decrypt=Gq,ne.deriveSymKey=Vq,ne.deserialize=p1,ne.encodeTypeByte=x3,ne.encrypt=jq,ne.engineEvent=gV,ne.enumify=aV,ne.formatAccountId=I3,ne.formatAccountWithChain=Bq,ne.formatChainId=_3,ne.formatExpirerTarget=v1,ne.formatIdTarget=dV,ne.formatMessageContext=iV,ne.formatRelayParams=G3,ne.formatRelayRpcUrl=eV,ne.formatTopicTarget=hV,ne.formatUA=U3,ne.formatUri=IV,ne.generateKeyPair=Uq,ne.generateRandomBytes32=qq,ne.getAccountsChains=Xr,ne.getAccountsFromNamespaces=Pq,ne.getAddressFromAccount=b3,ne.getAddressesFromAccounts=Mq,ne.getAppMetadata=Xq,ne.getChainFromAccount=C3,ne.getChainsFromAccounts=S3,ne.getChainsFromNamespaces=Lq,ne.getChainsFromRequiredNamespaces=Rq,ne.getEnvironment=m1,ne.getHttpUrl=tV,ne.getInternalError=Jr,ne.getJavascriptID=F3,ne.getJavascriptOS=R3,ne.getLastItems=V3,ne.getNamespacesChains=K3,ne.getNamespacesEventsForChainId=$3,ne.getNamespacesMethodsForChainId=z3,ne.getRelayClientMetadata=Zq,ne.getRelayProtocolApi=mV,ne.getRelayProtocolName=yV,ne.getSdkError=fo,ne.getUniqueValues=l1,ne.hasOverlap=lr,ne.hashKey=Hq,ne.hashMessage=Qq,ne.isBrowser=P3,ne.isConformingNamespaces=jV,ne.isExpired=lV,ne.isNode=y1,ne.isProposalStruct=TV,ne.isReactNative=M3,ne.isSessionCompatible=SV,ne.isSessionStruct=NV,ne.isTypeOneEnvelope=zq,ne.isUndefined=sn,ne.isValidAccountId=k3,ne.isValidAccounts=o1,ne.isValidActions=a1,ne.isValidArray=yu,ne.isValidChainId=Td,ne.isValidChains=s1,ne.isValidController=DV,ne.isValidErrorReason=RV,ne.isValidEvent=qV,ne.isValidExtension=Nd,ne.isValidId=PV,ne.isValidNamespaceAccounts=Y3,ne.isValidNamespaceActions=A1,ne.isValidNamespaceChains=W3,ne.isValidNamespaceMethodsOrEvents=n1,ne.isValidNamespaces=BV,ne.isValidNamespacesChainId=VV,ne.isValidNamespacesEvent=QV,ne.isValidNamespacesRequest=HV,ne.isValidNumber=E1,ne.isValidObject=w1,ne.isValidParams=LV,ne.isValidRelay=J3,ne.isValidRelays=MV,ne.isValidRequest=FV,ne.isValidRequiredNamespaces=OV,ne.isValidResponse=UV,ne.isValidString=Cr,ne.isValidUrl=xV,ne.mapEntries=oV,ne.mapToObj=nV,ne.objToMap=sV,ne.parseAccountId=c1,ne.parseChainId=A3,ne.parseContextNames=q3,ne.parseExpirerTarget=pV,ne.parseRelayParams=j3,ne.parseUri=_V,ne.serialize=T3,ne.validateDecoding=Kq,ne.validateEncoding=N3});var X3,Z3,eT,tT,Od,Zc,_1,Bd,Gn,el,Md=ye(()=>{l();X3="PARSE_ERROR",Z3="INVALID_REQUEST",eT="METHOD_NOT_FOUND",tT="INVALID_PARAMS",Od="INTERNAL_ERROR",Zc="SERVER_ERROR",_1=[-32700,-32600,-32601,-32602,-32603],Bd=[-32e3,-32099],Gn={[X3]:{code:-32700,message:"Parse error"},[Z3]:{code:-32600,message:"Invalid Request"},[eT]:{code:-32601,message:"Method not found"},[tT]:{code:-32602,message:"Invalid params"},[Od]:{code:-32603,message:"Internal error"},[Zc]:{code:-32e3,message:"Server error"}},el=Zc});function GV(r){return r<=Bd[0]&&r>=Bd[1]}function Pd(r){return _1.includes(r)}function rT(r){return typeof r=="number"}function Ld(r){return Object.keys(Gn).includes(r)?Gn[r]:Gn[el]}function Rd(r){let e=Object.values(Gn).find(t=>t.code===r);return e||Gn[el]}function KV(r){if(typeof r.error.code>"u")return{valid:!1,error:"Missing code for JSON-RPC error"};if(typeof r.error.message>"u")return{valid:!1,error:"Missing message for JSON-RPC error"};if(!rT(r.error.code))return{valid:!1,error:`Invalid error code type for JSON-RPC: ${r.error.code}`};if(Pd(r.error.code)){let e=Rd(r.error.code);if(e.message!==Gn[el].message&&r.error.message===e.message)return{valid:!1,error:`Invalid error code message for JSON-RPC: ${r.error.code}`}}return{valid:!0}}function I1(r,e,t){return r.message.includes("getaddrinfo ENOTFOUND")||r.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${t} RPC url at ${e}`):r}var b1=ye(()=>{l();Md()});var nT=D(Kn=>{"use strict";l();Object.defineProperty(Kn,"__esModule",{value:!0});Kn.isBrowserCryptoAvailable=Kn.getSubtleCrypto=Kn.getBrowerCrypto=void 0;function C1(){return(global===null||global===void 0?void 0:global.crypto)||(global===null||global===void 0?void 0:global.msCrypto)||{}}Kn.getBrowerCrypto=C1;function iT(){let r=C1();return r.subtle||r.webkitSubtle}Kn.getSubtleCrypto=iT;function zV(){return!!C1()&&!!iT()}Kn.isBrowserCryptoAvailable=zV});var aT=D(zn=>{"use strict";l();Object.defineProperty(zn,"__esModule",{value:!0});zn.isBrowser=zn.isNode=zn.isReactNative=void 0;function sT(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}zn.isReactNative=sT;function oT(){return typeof I.default<"u"&&typeof I.default.versions<"u"&&typeof I.default.versions.node<"u"}zn.isNode=oT;function $V(){return!sT()&&!oT()}zn.isBrowser=$V});var S1=D($n=>{"use strict";l();var kV=$n&&$n.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),uT=$n&&$n.__exportStar||function(r,e){for(var t in r)t!=="default"&&!e.hasOwnProperty(t)&&kV(e,r,t)};Object.defineProperty($n,"__esModule",{value:!0});uT(nT(),$n);uT(aT(),$n)});var zt={};st(zt,{isNodeJs:()=>lT});var cT,lT,fT=ye(()=>{l();cT=_e(S1());Xt(zt,_e(S1()));lT=cT.isNode});function hT(){let r=Date.now()*Math.pow(10,3),e=Math.floor(Math.random()*Math.pow(10,3));return r+e}function x1(r,e,t){return{id:t||hT(),jsonrpc:"2.0",method:r,params:e}}function WV(r,e){return{id:r,jsonrpc:"2.0",result:e}}function T1(r,e,t){return{id:r,jsonrpc:"2.0",error:dT(e,t)}}function dT(r,e){return typeof r>"u"?Ld(Od):(typeof r=="string"&&(r=Object.assign(Object.assign({},Ld(Zc)),{message:r})),typeof e<"u"&&(r.data=e),Pd(r.code)&&(r=Rd(r.code)),r)}var pT=ye(()=>{l();b1();Md()});function YV(r){return r.includes("*")?Ud(r):!/\W/g.test(r)}function Fd(r){return r==="*"}function Ud(r){return Fd(r)?!0:!(!r.includes("*")||r.split("*").length!==2||r.split("*").filter(e=>e.trim()==="").length!==1)}function JV(r){return!Fd(r)&&Ud(r)&&!r.split("*")[0].trim()}function XV(r){return!Fd(r)&&Ud(r)&&!r.split("*")[1].trim()}var gT=ye(()=>{l()});var yT=ye(()=>{l()});var mu,N1=ye(()=>{l();mu=class{}});var D1,qd,tl,mT=ye(()=>{l();N1();D1=class extends mu{constructor(e){super()}},qd=class extends mu{constructor(){super()}},tl=class extends qd{constructor(e){super()}}});var vT=ye(()=>{l()});var wT=ye(()=>{l();yT();N1();mT();vT()});var ET=ye(()=>{l();wT()});function t7(r){let e=r.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function AT(r,e){let t=t7(r);return typeof t>"u"?!1:new RegExp(e).test(t)}function r7(r){return AT(r,ZV)}function Vd(r){return AT(r,e7)}function O1(r){return new RegExp("wss?://localhost(:d{2,5})?").test(r)}var ZV,e7,_T=ye(()=>{l();ZV="^https?:",e7="^wss?:"});function B1(r){return typeof r=="object"&&"id"in r&&"jsonrpc"in r&&r.jsonrpc==="2.0"}function i7(r){return B1(r)&&"method"in r}function M1(r){return B1(r)&&(IT(r)||Hd(r))}function IT(r){return"result"in r}function Hd(r){return"error"in r}function n7(r){return"error"in r&&r.valid===!1}var bT=ye(()=>{l()});var ar={};st(ar,{DEFAULT_ERROR:()=>el,IBaseJsonRpcProvider:()=>qd,IEvents:()=>mu,IJsonRpcConnection:()=>D1,IJsonRpcProvider:()=>tl,INTERNAL_ERROR:()=>Od,INVALID_PARAMS:()=>tT,INVALID_REQUEST:()=>Z3,METHOD_NOT_FOUND:()=>eT,PARSE_ERROR:()=>X3,RESERVED_ERROR_CODES:()=>_1,SERVER_ERROR:()=>Zc,SERVER_ERROR_CODE_RANGE:()=>Bd,STANDARD_ERROR_MAP:()=>Gn,formatErrorMessage:()=>dT,formatJsonRpcError:()=>T1,formatJsonRpcRequest:()=>x1,formatJsonRpcResult:()=>WV,getError:()=>Ld,getErrorByCode:()=>Rd,isHttpUrl:()=>r7,isJsonRpcError:()=>Hd,isJsonRpcPayload:()=>B1,isJsonRpcRequest:()=>i7,isJsonRpcResponse:()=>M1,isJsonRpcResult:()=>IT,isJsonRpcValidationInvalid:()=>n7,isLocalhostUrl:()=>O1,isNodeJs:()=>lT,isReservedErrorCode:()=>Pd,isServerErrorCode:()=>GV,isValidDefaultRoute:()=>Fd,isValidErrorCode:()=>rT,isValidLeadingWildcardRoute:()=>JV,isValidRoute:()=>YV,isValidTrailingWildcardRoute:()=>XV,isValidWildcardRoute:()=>Ud,isWsUrl:()=>Vd,parseConnectionError:()=>I1,payloadId:()=>hT,validateJsonRpcError:()=>KV});var rl=ye(()=>{l();Md();b1();fT();Xt(ar,zt);pT();gT();ET();_T();bT()});var CT,Qd,ST,P1=ye(()=>{l();CT=_e(Th());rl();Qd=class extends tl{constructor(e){super(e),this.events=new CT.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,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async request(e,t){return this.requestStrict(x1(e.method,e.params||[]),t)}async requestStrict(e,t){return new Promise(async(i,n)=>{if(!this.connection.connected)try{await this.open()}catch(s){n(s)}this.events.on(`${e.id}`,s=>{Hd(s)?n(s.error):i(s.result)});try{await this.connection.send(e,t)}catch(s){n(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),M1(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}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",()=>this.events.emit("disconnect")),this.connection.on("error",e=>this.events.emit("error",e)),this.hasRegisteredEventListeners=!0)}},ST=Qd});var xT={};st(xT,{JsonRpcProvider:()=>Qd,default:()=>s7});var s7,TT=ye(()=>{l();P1();P1();s7=ST});var DT=D((are,NT)=>{"use strict";l();NT.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}});var BT,OT,o7,jd,MT,L1=ye(()=>{l();BT=_e(Th());Lh();rl();OT=10,o7=typeof global.WebSocket<"u"?global.WebSocket:DT(),jd=class{constructor(e){if(this.url=e,this.events=new BT.EventEmitter,this.registering=!1,!Vd(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,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(e=this.url){await this.register(e)}async close(){if(typeof this.socket>"u")throw new Error("Connection already closed");this.socket.close(),this.onClose()}async send(e,t){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(Lc(e))}catch(i){this.onError(e.id,i)}}register(e=this.url){if(!Vd(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){let t=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=t||this.events.listenerCount("open")>=t)&&this.events.setMaxListeners(t+1),new Promise((i,n)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),n(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return n(new Error("WebSocket connection is missing or invalid"));i(this.socket)})})}return this.url=e,this.registering=!0,new Promise((t,i)=>{let n=(0,ar.isReactNative)()?void 0:{rejectUnauthorized:!O1(e)},s=new o7(e,[],n);s.onopen=()=>{this.onOpen(s),t(s)},s.onerror=o=>{let a=this.parseError(o.error);this.events.emit("register_error",a),this.onClose(),i(a)}})}onOpen(e){e.onmessage=t=>this.onPayload(t),e.onclose=()=>this.onClose(),e.onerror=t=>{let i=this.parseError(t.error);this.events.emit("error",i)},this.socket=e,this.registering=!1,this.events.emit("open")}onClose(){this.socket=void 0,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;let t=typeof e.data=="string"?Pc(e.data):e.data;this.events.emit("payload",t)}onError(e,t){let i=this.parseError(t),n=i.message||i.toString(),s=T1(e,n);this.events.emit("payload",s)}parseError(e,t=this.url){return I1(e,t,"WS")}resetMaxListeners(){this.events.getMaxListeners()>OT&&this.events.setMaxListeners(OT)}},MT=jd});var PT={};st(PT,{WsConnection:()=>jd,default:()=>a7});var a7,LT=ye(()=>{l();L1();L1();a7=MT});var yN=D((il,wu)=>{l();var u7=200,z1="__lodash_hash_undefined__",Jd=1,$T=2,kT=9007199254740991,Gd="[object Arguments]",q1="[object Array]",c7="[object AsyncFunction]",WT="[object Boolean]",YT="[object Date]",JT="[object Error]",XT="[object Function]",l7="[object GeneratorFunction]",Kd="[object Map]",ZT="[object Number]",f7="[object Null]",vu="[object Object]",RT="[object Promise]",h7="[object Proxy]",eN="[object RegExp]",zd="[object Set]",tN="[object String]",d7="[object Symbol]",p7="[object Undefined]",V1="[object WeakMap]",rN="[object ArrayBuffer]",$d="[object DataView]",g7="[object Float32Array]",y7="[object Float64Array]",m7="[object Int8Array]",v7="[object Int16Array]",w7="[object Int32Array]",E7="[object Uint8Array]",A7="[object Uint8ClampedArray]",_7="[object Uint16Array]",I7="[object Uint32Array]",b7=/[\\^$.*+?()[\]{}|]/g,C7=/^\[object .+?Constructor\]$/,S7=/^(?:0|[1-9]\d*)$/,Ye={};Ye[g7]=Ye[y7]=Ye[m7]=Ye[v7]=Ye[w7]=Ye[E7]=Ye[A7]=Ye[_7]=Ye[I7]=!0;Ye[Gd]=Ye[q1]=Ye[rN]=Ye[WT]=Ye[$d]=Ye[YT]=Ye[JT]=Ye[XT]=Ye[Kd]=Ye[ZT]=Ye[vu]=Ye[eN]=Ye[zd]=Ye[tN]=Ye[V1]=!1;var iN=typeof global=="object"&&global&&global.Object===Object&&global,x7=typeof self=="object"&&self&&self.Object===Object&&self,on=iN||x7||Function("return this")(),nN=typeof il=="object"&&il&&!il.nodeType&&il,FT=nN&&typeof wu=="object"&&wu&&!wu.nodeType&&wu,sN=FT&&FT.exports===nN,R1=sN&&iN.process,UT=function(){try{return R1&&R1.binding&&R1.binding("util")}catch{}}(),qT=UT&&UT.isTypedArray;function T7(r,e){for(var t=-1,i=r==null?0:r.length,n=0,s=[];++t-1}function nH(r,e){var t=this.__data__,i=Zd(t,r);return i<0?(++this.size,t.push([r,e])):t[i][1]=e,this}an.prototype.clear=eH;an.prototype.delete=tH;an.prototype.get=rH;an.prototype.has=iH;an.prototype.set=nH;function go(r){var e=-1,t=r==null?0:r.length;for(this.clear();++ea))return!1;var h=s.get(r);if(h&&s.get(e))return h==e;var p=-1,v=!0,B=t&$T?new Wd:void 0;for(s.set(r,e),s.set(e,r);++p-1&&r%1==0&&r-1&&r%1==0&&r<=kT}function pN(r){var e=typeof r;return r!=null&&(e=="object"||e=="function")}function ol(r){return r!=null&&typeof r=="object"}var gN=qT?B7(qT):AH;function LH(r){return MH(r)?mH(r):_H(r)}function RH(){return[]}function FH(){return!1}wu.exports=PH});var E6=D(we=>{"use strict";l();Object.defineProperty(we,"__esModule",{value:!0});var UH=um(),qH=VC(),hp=hS(),rt=Sm(),Jn=jm(),mN=(Lh(),ti(AS)),VH=(Xx(),ti(Jx)),fe=Dd(),Ft=ro(),HH=(TT(),ti(xT)),ei=(rl(),ti(ar)),QH=(LT(),ti(PT)),jH=yN();function dp(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}function GH(r){if(r&&r.__esModule)return r;var e=Object.create(null);return r&&Object.keys(r).forEach(function(t){if(t!=="default"){var i=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:function(){return r[t]}})}}),e.default=r,Object.freeze(e)}var LN=dp(UH),KH=dp(qH),tp=GH(VH),zH=dp(QH),$H=dp(jH);function $t(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}var vo=$t;$t.EventEmitter=$t,$t.prototype._events=void 0,$t.prototype._maxListeners=void 0,$t.defaultMaxListeners=10,$t.prototype.setMaxListeners=function(r){if(!kH(r)||r<0||isNaN(r))throw TypeError("n must be a positive number");return this._maxListeners=r,this},$t.prototype.emit=function(r){var e,t,i,n,s,o;if(this._events||(this._events={}),r==="error"&&(!this._events.error||ul(this._events.error)&&!this._events.error.length)){if(e=arguments[1],e instanceof Error)throw e;var a=new Error('Uncaught, unspecified "error" event. ('+e+")");throw a.context=e,a}if(t=this._events[r],vN(t))return!1;if(un(t))switch(arguments.length){case 1:t.call(this);break;case 2:t.call(this,arguments[1]);break;case 3:t.call(this,arguments[1],arguments[2]);break;default:n=Array.prototype.slice.call(arguments,1),t.apply(this,n)}else if(ul(t))for(n=Array.prototype.slice.call(arguments,1),o=t.slice(),i=o.length,s=0;s0&&this._events[r].length>t&&(this._events[r].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[r].length),typeof console.trace=="function"&&console.trace())),this},$t.prototype.on=$t.prototype.addListener,$t.prototype.once=function(r,e){if(!un(e))throw TypeError("listener must be a function");var t=!1;function i(){this.removeListener(r,i),t||(t=!0,e.apply(this,arguments))}return i.listener=e,this.on(r,i),this},$t.prototype.removeListener=function(r,e){var t,i,n,s;if(!un(e))throw TypeError("listener must be a function");if(!this._events||!this._events[r])return this;if(t=this._events[r],n=t.length,i=-1,t===e||un(t.listener)&&t.listener===e)delete this._events[r],this._events.removeListener&&this.emit("removeListener",r,e);else if(ul(t)){for(s=n;s-- >0;)if(t[s]===e||t[s].listener&&t[s].listener===e){i=s;break}if(i<0)return this;t.length===1?(t.length=0,delete this._events[r]):t.splice(i,1),this._events.removeListener&&this.emit("removeListener",r,e)}return this},$t.prototype.removeAllListeners=function(r){var e,t;if(!this._events)return this;if(!this._events.removeListener)return arguments.length===0?this._events={}:this._events[r]&&delete this._events[r],this;if(arguments.length===0){for(e in this._events)e!=="removeListener"&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(t=this._events[r],un(t))this.removeListener(r,t);else if(t)for(;t.length;)this.removeListener(r,t[t.length-1]);return delete this._events[r],this},$t.prototype.listeners=function(r){var e;return!this._events||!this._events[r]?e=[]:un(this._events[r])?e=[this._events[r]]:e=this._events[r].slice(),e},$t.prototype.listenerCount=function(r){if(this._events){var e=this._events[r];if(un(e))return 1;if(e)return e.length}return 0},$t.listenerCount=function(r,e){return r.listenerCount(e)};function un(r){return typeof r=="function"}function kH(r){return typeof r=="number"}function ul(r){return typeof r=="object"&&r!==null}function vN(r){return r===void 0}function WH(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),i=0;i>>0,J=new Uint8Array(k);K!==ie;){for(var W=x[K],G=0,P=k-1;(W!==0||G>>0,J[P]=W%a>>>0,W=W/a>>>0;if(W!==0)throw new Error("Non-zero carry");H=G,K++}for(var F=k-H;F!==k&&J[F]===0;)F++;for(var $=u.repeat(V);F>>0,k=new Uint8Array(ie);x[V];){var J=t[x.charCodeAt(V)];if(J===255)return;for(var W=0,G=ie-1;(J!==0||W>>0,k[G]=J%256>>>0,J=J/256>>>0;if(J!==0)throw new Error("Non-zero carry");K=W,V++}if(x[V]!==" "){for(var P=ie-K;P!==ie&&k[P]===0;)P++;for(var F=new Uint8Array(H+(ie-P)),$=H;P!==ie;)F[$++]=k[P++];return F}}}function R(x){var V=B(x);if(V)return V;throw new Error(`Non-${e} character`)}return{encode:v,decodeUnsafe:B,decode:R}}var YH=WH,JH=YH,RN=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},XH=r=>new TextEncoder().encode(r),ZH=r=>new TextDecoder().decode(r),W1=class{constructor(e,t,i){this.name=e,this.prefix=t,this.baseEncode=i}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},Y1=class{constructor(e,t,i){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=i}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 FN(this,e)}},J1=class{constructor(e){this.decoders=e}or(e){return FN(this,e)}decode(e){let t=e[0],i=this.decoders[t];if(i)return i.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},FN=(r,e)=>new J1({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}}),X1=class{constructor(e,t,i,n){this.name=e,this.prefix=t,this.baseEncode=i,this.baseDecode=n,this.encoder=new W1(e,t,i),this.decoder=new Y1(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},pp=({name:r,prefix:e,encode:t,decode:i})=>new X1(r,e,t,i),cl=({prefix:r,name:e,alphabet:t})=>{let{encode:i,decode:n}=JH(t,e);return pp({prefix:r,name:e,encode:i,decode:s=>RN(n(s))})},eQ=(r,e,t,i)=>{let n={};for(let p=0;p=8&&(a-=8,o[h++]=255&u>>a)}if(a>=t||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},tQ=(r,e,t)=>{let i=e[e.length-1]==="=",n=(1<t;)o-=t,s+=e[n&a>>o];if(o&&(s+=e[n&a<pp({prefix:e,name:r,encode(n){return tQ(n,i,t)},decode(n){return eQ(n,i,t,r)}}),rQ=pp({prefix:"\0",name:"identity",encode:r=>ZH(r),decode:r=>XH(r)}),iQ=Object.freeze({__proto__:null,identity:rQ}),nQ=Zt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),sQ=Object.freeze({__proto__:null,base2:nQ}),oQ=Zt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),aQ=Object.freeze({__proto__:null,base8:oQ}),uQ=cl({prefix:"9",name:"base10",alphabet:"0123456789"}),cQ=Object.freeze({__proto__:null,base10:uQ}),lQ=Zt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),fQ=Zt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),hQ=Object.freeze({__proto__:null,base16:lQ,base16upper:fQ}),dQ=Zt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),pQ=Zt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),gQ=Zt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),yQ=Zt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),mQ=Zt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),vQ=Zt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),wQ=Zt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),EQ=Zt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),AQ=Zt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),_Q=Object.freeze({__proto__:null,base32:dQ,base32upper:pQ,base32pad:gQ,base32padupper:yQ,base32hex:mQ,base32hexupper:vQ,base32hexpad:wQ,base32hexpadupper:EQ,base32z:AQ}),IQ=cl({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),bQ=cl({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),CQ=Object.freeze({__proto__:null,base36:IQ,base36upper:bQ}),SQ=cl({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),xQ=cl({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),TQ=Object.freeze({__proto__:null,base58btc:SQ,base58flickr:xQ}),NQ=Zt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),DQ=Zt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),OQ=Zt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),BQ=Zt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),MQ=Object.freeze({__proto__:null,base64:NQ,base64pad:DQ,base64url:OQ,base64urlpad:BQ}),UN=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}"),PQ=UN.reduce((r,e,t)=>(r[t]=e,r),[]),LQ=UN.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function RQ(r){return r.reduce((e,t)=>(e+=PQ[t],e),"")}function FQ(r){let e=[];for(let t of r){let i=LQ[t.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(i)}return new Uint8Array(e)}var UQ=pp({prefix:"\u{1F680}",name:"base256emoji",encode:RQ,decode:FQ}),qQ=Object.freeze({__proto__:null,base256emoji:UQ}),VQ=qN,wN=128,HQ=127,QQ=~HQ,jQ=Math.pow(2,31);function qN(r,e,t){e=e||[],t=t||0;for(var i=t;r>=jQ;)e[t++]=r&255|wN,r/=128;for(;r&QQ;)e[t++]=r&255|wN,r>>>=7;return e[t]=r|0,qN.bytes=t-i+1,e}var GQ=Z1,KQ=128,EN=127;function Z1(r,i){var t=0,i=i||0,n=0,s=i,o,a=r.length;do{if(s>=a)throw Z1.bytes=0,new RangeError("Could not decode varint");o=r[s++],t+=n<28?(o&EN)<=KQ);return Z1.bytes=s-i,t}var zQ=Math.pow(2,7),$Q=Math.pow(2,14),kQ=Math.pow(2,21),WQ=Math.pow(2,28),YQ=Math.pow(2,35),JQ=Math.pow(2,42),XQ=Math.pow(2,49),ZQ=Math.pow(2,56),e9=Math.pow(2,63),t9=function(r){return r(VN.encode(r,e,t),e),_N=r=>VN.encodingLength(r),ew=(r,e)=>{let t=e.byteLength,i=_N(r),n=i+_N(t),s=new Uint8Array(n+t);return AN(r,s,0),AN(t,s,i),s.set(e,n),new tw(r,t,e,s)},tw=class{constructor(e,t,i,n){this.code=e,this.size=t,this.digest=i,this.bytes=n}},HN=({name:r,code:e,encode:t})=>new rw(r,e,t),rw=class{constructor(e,t,i){this.name=e,this.code=t,this.encode=i}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?ew(this.code,t):t.then(i=>ew(this.code,i))}else throw Error("Unknown type, must be binary type")}},QN=r=>async e=>new Uint8Array(await crypto.subtle.digest(r,e)),i9=HN({name:"sha2-256",code:18,encode:QN("SHA-256")}),n9=HN({name:"sha2-512",code:19,encode:QN("SHA-512")}),s9=Object.freeze({__proto__:null,sha256:i9,sha512:n9}),jN=0,o9="identity",GN=RN,a9=r=>ew(jN,GN(r)),u9={code:jN,name:o9,encode:GN,digest:a9},c9=Object.freeze({__proto__:null,identity:u9});new TextEncoder,new TextDecoder;var IN={...iQ,...sQ,...aQ,...cQ,...hQ,..._Q,...CQ,...TQ,...MQ,...qQ};({...s9,...c9});function l9(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(r):new Uint8Array(r)}function KN(r,e,t,i){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:i}}}var bN=KN("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),$1=KN("ascii","a",r=>{let e="a";for(let t=0;t{r=r.substring(1);let e=l9(r.length);for(let t=0;t{if(!this.initialized){let i=await this.getKeyChain();typeof i<"u"&&(this.keychain=i),this.initialized=!0}},this.has=i=>(this.isInitialized(),this.keychain.has(i)),this.set=async(i,n)=>{this.isInitialized(),this.keychain.set(i,n),await this.persist()},this.get=i=>{this.isInitialized();let n=this.keychain.get(i);if(typeof n>"u"){let{message:s}=fe.getInternalError("NO_MATCHING_KEY",`${this.name}: ${i}`);throw new Error(s)}return n},this.del=async i=>{this.isInitialized(),this.keychain.delete(i),await this.persist()},this.core=e,this.logger=rt.generateChildLogger(t,this.name)}get context(){return rt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,fe.mapToObj(e))}async getKeyChain(){let e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?fe.objToMap(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){let{message:e}=fe.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},np=class{constructor(e,t,i){this.core=e,this.logger=t,this.name=WN,this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=n=>(this.isInitialized(),this.keychain.has(n)),this.getClientId=async()=>{this.isInitialized();let n=await this.getClientSeed(),s=tp.generateKeyPair(n);return tp.encodeIss(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();let n=fe.generateKeyPair();return this.setPrivateKey(n.publicKey,n.privateKey)},this.signJWT=async n=>{this.isInitialized();let s=await this.getClientSeed(),o=tp.generateKeyPair(s),a=fe.generateRandomBytes32(),u=YN;return await tp.signJWT(a,n,u,o)},this.generateSharedKey=(n,s,o)=>{this.isInitialized();let a=this.getPrivateKey(n),u=fe.deriveSymKey(a,s);return this.setSymKey(u,o)},this.setSymKey=async(n,s)=>{this.isInitialized();let o=s||fe.hashKey(n);return await this.keychain.set(o,n),o},this.deleteKeyPair=async n=>{this.isInitialized(),await this.keychain.del(n)},this.deleteSymKey=async n=>{this.isInitialized(),await this.keychain.del(n)},this.encode=async(n,s,o)=>{this.isInitialized();let a=fe.validateEncoding(o),u=mN.safeJsonStringify(s);if(fe.isTypeOneEnvelope(a)){let B=a.senderPublicKey,R=a.receiverPublicKey;n=await this.generateSharedKey(B,R)}let h=this.getSymKey(n),{type:p,senderPublicKey:v}=a;return fe.encrypt({type:p,symKey:h,message:u,senderPublicKey:v})},this.decode=async(n,s,o)=>{this.isInitialized();let a=fe.validateDecoding(s,o);if(fe.isTypeOneEnvelope(a)){let p=a.receiverPublicKey,v=a.senderPublicKey;n=await this.generateSharedKey(p,v)}let u=this.getSymKey(n),h=fe.decrypt({symKey:u,encoded:s});return mN.safeJsonParse(h)},this.core=e,this.logger=rt.generateChildLogger(t,this.name),this.keychain=i||new ip(this.core,this.logger)}get context(){return rt.getLoggerContext(this.logger)}getPayloadType(e){let t=fe.deserialize(e);return fe.decodeTypeByte(t.type)}async setPrivateKey(e,t){return await this.keychain.set(e,t),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(iw)}catch{e=fe.generateRandomBytes32(),await this.keychain.set(iw,e)}return h9(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){let{message:e}=fe.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},sp=class extends Jn.IMessageTracker{constructor(e,t){super(e,t),this.logger=e,this.core=t,this.messages=new Map,this.name=ZN,this.version=e6,this.initialized=!1,this.storagePrefix=cn,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{let i=await this.getRelayerMessages();typeof i<"u"&&(this.messages=i),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(i){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(i)}finally{this.initialized=!0}}},this.set=async(i,n)=>{this.isInitialized();let s=fe.hashMessage(n),o=this.messages.get(i);return typeof o>"u"&&(o={}),typeof o[s]<"u"||(o[s]=n,this.messages.set(i,o),await this.persist()),s},this.get=i=>{this.isInitialized();let n=this.messages.get(i);return typeof n>"u"&&(n={}),n},this.has=(i,n)=>{this.isInitialized();let s=this.get(i),o=fe.hashMessage(n);return typeof s[o]<"u"},this.del=async i=>{this.isInitialized(),this.messages.delete(i),await this.persist()},this.logger=rt.generateChildLogger(e,this.name),this.core=t}get context(){return rt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,fe.mapToObj(e))}async getRelayerMessages(){let e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?fe.objToMap(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){let{message:e}=fe.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},nw=class extends Jn.IPublisher{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.events=new vo.EventEmitter,this.name=r6,this.queue=new Map,this.publish=async(i,n,s)=>{this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:i,message:n,opts:s}});try{let o=s?.ttl||t6,a=fe.getRelayProtocolName(s),u=s?.prompt||!1,h=s?.tag||0,p={topic:i,message:n,opts:{ttl:o,relay:a,prompt:u,tag:h}},v=fe.hashMessage(n);this.queue.set(v,p),await this.rpcPublish(i,n,o,a,u,h),this.onPublish(v,p),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:i,message:n,opts:s}})}catch(o){throw this.logger.debug("Failed to Publish Payload"),this.logger.error(o),o}},this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.relayer=e,this.logger=rt.generateChildLogger(t,this.name),this.registerEventListeners()}get context(){return rt.getLoggerContext(this.logger)}rpcPublish(e,t,i,n,s,o){var a,u,h,p;let v={method:fe.getRelayProtocolApi(n.protocol).publish,params:{topic:e,message:t,ttl:i,prompt:s,tag:o}};return fe.isUndefined((a=v.params)==null?void 0:a.prompt)&&((u=v.params)==null||delete u.prompt),fe.isUndefined((h=v.params)==null?void 0:h.tag)&&((p=v.params)==null||delete p.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:v}),this.relayer.provider.request(v)}onPublish(e,t){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{let{topic:t,message:i,opts:{ttl:n,relay:s,prompt:o,tag:a}}=e,u=fe.hashMessage(i);await this.rpcPublish(t,i,n,s,o,a),this.onPublish(u,e)})}registerEventListeners(){this.relayer.core.heartbeat.on(hp.HEARTBEAT_EVENTS.pulse,()=>{this.checkQueue()})}},sw=class{constructor(){this.map=new Map,this.set=(e,t)=>{let i=this.get(e);this.exists(e,t)||this.map.set(e,[...i,t])},this.get=e=>this.map.get(e)||[],this.exists=(e,t)=>this.get(e).includes(t),this.delete=(e,t)=>{if(typeof t>"u"){this.map.delete(e);return}if(!this.map.has(e))return;let i=this.get(e);if(!this.exists(e,t))return;let n=i.filter(s=>s!==t);if(!n.length){this.map.delete(e);return}this.map.set(e,n)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}},m9=Object.defineProperty,v9=Object.defineProperties,w9=Object.getOwnPropertyDescriptors,CN=Object.getOwnPropertySymbols,E9=Object.prototype.hasOwnProperty,A9=Object.prototype.propertyIsEnumerable,SN=(r,e,t)=>e in r?m9(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,rp=(r,e)=>{for(var t in e||(e={}))E9.call(e,t)&&SN(r,t,e[t]);if(CN)for(var t of CN(e))A9.call(e,t)&&SN(r,t,e[t]);return r},k1=(r,e)=>v9(r,w9(e)),op=class extends Jn.ISubscriber{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.subscriptions=new Map,this.topicMap=new sw,this.events=new vo.EventEmitter,this.name=f6,this.version=h6,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pendingSubInterval=20,this.storagePrefix=cn,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),await this.reset(),this.registerEventListeners(),this.onEnable())},this.subscribe=async(i,n)=>{this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:i,opts:n}});try{let s=fe.getRelayProtocolName(n),o={topic:i,relay:s};this.pending.set(i,o);let a=await this.rpcSubscribe(i,s);return this.onSubscribe(a,o),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:i,opts:n}}),a}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}},this.unsubscribe=async(i,n)=>{this.isInitialized(),typeof n?.id<"u"?await this.unsubscribeById(i,n.id,n):await this.unsubscribeByTopic(i,n)},this.isSubscribed=async i=>this.topics.includes(i)?!0:await new Promise((n,s)=>{let o=new Ft.Watch;o.start(this.pendingSubscriptionWatchLabel);let a=setInterval(()=>{!this.pending.has(i)&&this.topics.includes(i)&&(clearInterval(a),o.stop(this.pendingSubscriptionWatchLabel),n(!0)),o.elapsed(this.pendingSubscriptionWatchLabel)>=d6&&(clearInterval(a),o.stop(this.pendingSubscriptionWatchLabel),s(!1))},this.pendingSubInterval)}),this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.relayer=e,this.logger=rt.generateChildLogger(t,this.name)}get context(){return rt.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,t){let i=!1;try{i=this.getSubscription(e).topic===t}catch{}return i}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear(),this.initialized=!1}async unsubscribeByTopic(e,t){let i=this.topicMap.get(e);await Promise.all(i.map(async n=>await this.unsubscribeById(e,n,t)))}async unsubscribeById(e,t,i){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:i}});try{let n=fe.getRelayProtocolName(i);await this.rpcUnsubscribe(e,t,n);let s=fe.getSdkError("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,t,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:i}})}catch(n){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(n),n}}async rpcSubscribe(e,t){let i={method:fe.getRelayProtocolApi(t.protocol).subscribe,params:{topic:e}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),await this.relayer.provider.request(i)}rpcUnsubscribe(e,t,i){let n={method:fe.getRelayProtocolApi(i.protocol).unsubscribe,params:{topic:e,id:t}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n}),this.relayer.provider.request(n)}onSubscribe(e,t){this.setSubscription(e,k1(rp({},t),{id:e})),this.pending.delete(t.topic)}onResubscribe(e,t){this.addSubscription(e,k1(rp({},t),{id:e})),this.pending.delete(t.topic)}async onUnsubscribe(e,t,i){this.events.removeAllListeners(t),this.hasSubscription(t,e)&&this.deleteSubscription(t,i),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,t){this.subscriptions.has(e)||(this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:t}),this.addSubscription(e,t))}addSubscription(e,t){this.subscriptions.set(e,rp({},t)),this.topicMap.set(t.topic,e),this.events.emit(Yn.created,t)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});let t=this.subscriptions.get(e);if(!t){let{message:i}=fe.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(i)}return t}deleteSubscription(e,t){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:t});let i=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(i.topic,e),this.events.emit(Yn.deleted,k1(rp({},i),{reason:t}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Yn.sync)}async reset(){!this.cached.length||await Promise.all(this.cached.map(async e=>await this.resubscribe(e)))}async restore(){try{let e=await this.getRelayerSubscriptions();if(typeof e>"u"||!e.length)return;if(this.subscriptions.size){let{message:t}=fe.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}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 resubscribe(e){if(!this.ids.includes(e.id)){let{topic:t,relay:i}=e,n={topic:t,relay:i};this.pending.set(n.topic,n);let s=await this.rpcSubscribe(n.topic,n.relay);this.onResubscribe(s,n)}}async onConnect(){await this.reset(),this.onEnable()}onDisconnect(){this.onDisable()}checkPending(){this.pending.forEach(async e=>{let t=await this.rpcSubscribe(e.topic,e.relay);this.onSubscribe(t,e)})}registerEventListeners(){this.relayer.core.heartbeat.on(hp.HEARTBEAT_EVENTS.pulse,()=>{this.checkPending()}),this.relayer.provider.on(mo.connect,async()=>{await this.onConnect()}),this.relayer.provider.on(mo.disconnect,()=>{this.onDisconnect()}),this.events.on(Yn.created,async e=>{let t=Yn.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()}),this.events.on(Yn.deleted,async e=>{let t=Yn.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=fe.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},_9=Object.defineProperty,xN=Object.getOwnPropertySymbols,I9=Object.prototype.hasOwnProperty,b9=Object.prototype.propertyIsEnumerable,TN=(r,e,t)=>e in r?_9(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,C9=(r,e)=>{for(var t in e||(e={}))I9.call(e,t)&&TN(r,t,e[t]);if(xN)for(var t of xN(e))b9.call(e,t)&&TN(r,t,e[t]);return r},ap=class extends Jn.IRelayer{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new vo.EventEmitter,this.name=o6,this.initialized=!1,this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?rt.generateChildLogger(e.logger,this.name):LN.default(rt.getDefaultLoggerOptions({level:e.logger||n6})),this.messages=new sp(this.logger,e.core),this.subscriber=new op(this,this.logger),this.publisher=new nw(this,this.logger),this.relayUrl=e?.relayUrl||s6,this.projectId=e.projectId,this.provider={}}async init(){this.logger.trace("Initialized");let e=await this.core.crypto.signJWT(this.relayUrl);this.provider=this.createProvider(e),await Promise.all([this.messages.init(),this.provider.connect(),this.subscriber.init()]),this.registerEventListeners(),this.initialized=!0}get context(){return rt.getLoggerContext(this.logger)}get connected(){return this.provider.connection.connected}get connecting(){return this.provider.connection.connecting}async publish(e,t,i){this.isInitialized(),await this.publisher.publish(e,t,i),await this.recordMessageEvent({topic:e,message:t})}async subscribe(e,t){return this.isInitialized(),await this.subscriber.subscribe(e,t)}async unsubscribe(e,t){this.isInitialized(),await this.subscriber.unsubscribe(e,t)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}createProvider(e){return new HH.JsonRpcProvider(new zH.default(fe.formatRelayRpcUrl({sdkVersion:c6,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e})))}async recordMessageEvent(e){let{topic:t,message:i}=e;await this.messages.set(t,i)}async shouldIgnoreMessageEvent(e){let{topic:t,message:i}=e;return await this.subscriber.isSubscribed(t)?this.messages.has(t,i):!0}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),ei.isJsonRpcRequest(e)){if(!e.method.endsWith(a6))return;let t=e.params,{topic:i,message:n}=t.data,s={topic:i,message:n};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(C9({type:"event",event:t.id},s)),this.events.emit(t.id,s),await this.acknowledgePayload(e),await this.onMessageEvent(s)}}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(_u.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){let t=ei.formatJsonRpcResult(e.id,!0);await this.provider.connection.send(t)}registerEventListeners(){this.provider.on(mo.payload,e=>this.onProviderPayload(e)),this.provider.on(mo.connect,()=>{this.events.emit(_u.connect)}),this.provider.on(mo.disconnect,()=>{this.events.emit(_u.disconnect),setTimeout(()=>{this.provider.connect()},Ft.toMiliseconds(u6))}),this.provider.on(mo.error,e=>this.events.emit(_u.error,e))}isInitialized(){if(!this.initialized){let{message:e}=fe.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},S9=Object.defineProperty,NN=Object.getOwnPropertySymbols,x9=Object.prototype.hasOwnProperty,T9=Object.prototype.propertyIsEnumerable,DN=(r,e,t)=>e in r?S9(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ON=(r,e)=>{for(var t in e||(e={}))x9.call(e,t)&&DN(r,t,e[t]);if(NN)for(var t of NN(e))T9.call(e,t)&&DN(r,t,e[t]);return r},up=class extends Jn.IStore{constructor(e,t,i,n=cn,s=void 0){super(e,t,i,n),this.core=e,this.logger=t,this.name=i,this.map=new Map,this.version=l6,this.cached=[],this.initialized=!1,this.storagePrefix=cn,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{fe.isProposalStruct(o)?this.map.set(o.id,o):fe.isSessionStruct(o)?this.map.set(o.topic,o):this.getKey&&o!==null&&!fe.isUndefined(o)&&this.map.set(this.getKey(o),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=>$H.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=ON(ON({},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=rt.generateChildLogger(t,this.name),this.storagePrefix=n,this.getKey=s}get context(){return rt.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 t=this.map.get(e);if(!t){let{message:i}=fe.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}return t}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:t}=fe.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}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}=fe.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},cp=class{constructor(e,t){this.core=e,this.logger=t,this.name=p6,this.version=g6,this.events=new vo,this.initialized=!1,this.storagePrefix=cn,this.ignoredPayloadTypes=[fe.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:i})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...i])]},this.create=async()=>{this.isInitialized();let i=fe.generateRandomBytes32(),n=await this.core.crypto.setSymKey(i),s=fe.calcExpiry(Ft.FIVE_MINUTES),o={protocol:i6},a={topic:n,expiry:s,relay:o,active:!1},u=fe.formatUri({protocol:this.core.protocol,version:this.core.version,topic:n,symKey:i,relay:o});return await this.pairings.set(n,a),await this.core.relayer.subscribe(n),this.core.expirer.set(n,s),{topic:n,uri:u}},this.pair=async i=>{this.isInitialized(),this.isValidPair(i);let{topic:n,symKey:s,relay:o}=fe.parseUri(i.uri),a=fe.calcExpiry(Ft.FIVE_MINUTES),u={topic:n,relay:o,expiry:a,active:!1};return await this.pairings.set(n,u),await this.core.crypto.setSymKey(s,n),await this.core.relayer.subscribe(n,{relay:o}),this.core.expirer.set(n,a),i.activatePairing&&await this.activate({topic:n}),u},this.activate=async({topic:i})=>{this.isInitialized();let n=fe.calcExpiry(Ft.THIRTY_DAYS);await this.pairings.update(i,{active:!0,expiry:n}),this.core.expirer.set(i,n)},this.ping=async i=>{this.isInitialized(),await this.isValidPing(i);let{topic:n}=i;if(this.pairings.keys.includes(n)){let s=await this.sendRequest(n,"wc_pairingPing",{}),{done:o,resolve:a,reject:u}=fe.createDelayedPromise();this.events.once(fe.engineEvent("pairing_ping",s),({error:h})=>{h?u(h):a()}),await o()}},this.updateExpiry=async({topic:i,expiry:n})=>{this.isInitialized(),await this.pairings.update(i,{expiry:n})},this.updateMetadata=async({topic:i,metadata:n})=>{this.isInitialized(),await this.pairings.update(i,{peerMetadata:n})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async i=>{this.isInitialized(),await this.isValidDisconnect(i);let{topic:n}=i;this.pairings.keys.includes(n)&&(await this.sendRequest(n,"wc_pairingDelete",fe.getSdkError("USER_DISCONNECTED")),await this.deletePairing(n))},this.sendRequest=async(i,n,s)=>{let o=ei.formatJsonRpcRequest(n,s),a=await this.core.crypto.encode(i,o),u=Au[n].req;return this.core.history.set(i,o),await this.core.relayer.publish(i,a,u),o.id},this.sendResult=async(i,n,s)=>{let o=ei.formatJsonRpcResult(i,s),a=await this.core.crypto.encode(n,o),u=await this.core.history.get(n,i),h=Au[u.request.method].res;await this.core.relayer.publish(n,a,h),await this.core.history.resolve(o)},this.sendError=async(i,n,s)=>{let o=ei.formatJsonRpcError(i,s),a=await this.core.crypto.encode(n,o),u=await this.core.history.get(n,i),h=Au[u.request.method]?Au[u.request.method].res:Au.unregistered_method.res;await this.core.relayer.publish(n,a,h),await this.core.history.resolve(o)},this.deletePairing=async(i,n)=>{await this.core.relayer.unsubscribe(i),await Promise.all([this.pairings.delete(i,fe.getSdkError("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(i),n?Promise.resolve():this.core.expirer.del(i)])},this.cleanup=async()=>{let i=this.pairings.getAll().filter(n=>fe.isExpired(n.expiry));await Promise.all(i.map(n=>this.deletePairing(n.topic)))},this.onRelayEventRequest=i=>{let{topic:n,payload:s}=i;switch(s.method){case"wc_pairingPing":return this.onPairingPingRequest(n,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(n,s);default:return this.onUnknownRpcMethodRequest(n,s)}},this.onRelayEventResponse=async i=>{let{topic:n,payload:s}=i,o=(await this.core.history.get(n,s.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(n,s);default:return this.onUnknownRpcMethodResponse(o)}},this.onPairingPingRequest=async(i,n)=>{let{id:s}=n;try{this.isValidPing({topic:i}),await this.sendResult(s,i,!0),this.events.emit("pairing_ping",{id:s,topic:i})}catch(o){await this.sendError(s,i,o),this.logger.error(o)}},this.onPairingPingResponse=(i,n)=>{let{id:s}=n;setTimeout(()=>{ei.isJsonRpcResult(n)?this.events.emit(fe.engineEvent("pairing_ping",s),{}):ei.isJsonRpcError(n)&&this.events.emit(fe.engineEvent("pairing_ping",s),{error:n.error})},500)},this.onPairingDeleteRequest=async(i,n)=>{let{id:s}=n;try{this.isValidDisconnect({topic:i}),await this.sendResult(s,i,!0),await this.deletePairing(i),this.events.emit("pairing_delete",{id:s,topic:i})}catch(o){await this.sendError(s,i,o),this.logger.error(o)}},this.onUnknownRpcMethodRequest=async(i,n)=>{let{id:s,method:o}=n;try{if(this.registeredMethods.includes(o))return;let a=fe.getSdkError("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,i,a),this.logger.error(a)}catch(a){await this.sendError(s,i,a),this.logger.error(a)}},this.onUnknownRpcMethodResponse=i=>{this.registeredMethods.includes(i)||this.logger.error(fe.getSdkError("WC_METHOD_UNSUPPORTED",i))},this.isValidPair=i=>{if(!fe.isValidParams(i)){let{message:n}=fe.getInternalError("MISSING_OR_INVALID",`pair() params: ${i}`);throw new Error(n)}if(!fe.isValidUrl(i.uri)){let{message:n}=fe.getInternalError("MISSING_OR_INVALID",`pair() uri: ${i.uri}`);throw new Error(n)}},this.isValidPing=async i=>{if(!fe.isValidParams(i)){let{message:s}=fe.getInternalError("MISSING_OR_INVALID",`ping() params: ${i}`);throw new Error(s)}let{topic:n}=i;await this.isValidPairingTopic(n)},this.isValidDisconnect=async i=>{if(!fe.isValidParams(i)){let{message:s}=fe.getInternalError("MISSING_OR_INVALID",`disconnect() params: ${i}`);throw new Error(s)}let{topic:n}=i;await this.isValidPairingTopic(n)},this.isValidPairingTopic=async i=>{if(!fe.isValidString(i,!1)){let{message:n}=fe.getInternalError("MISSING_OR_INVALID",`pairing topic should be a string: ${i}`);throw new Error(n)}if(!this.pairings.keys.includes(i)){let{message:n}=fe.getInternalError("NO_MATCHING_KEY",`pairing topic doesn't exist: ${i}`);throw new Error(n)}if(fe.isExpired(this.pairings.get(i).expiry)){await this.deletePairing(i);let{message:n}=fe.getInternalError("EXPIRED",`pairing topic: ${i}`);throw new Error(n)}},this.core=e,this.logger=rt.generateChildLogger(t,this.name),this.pairings=new up(this.core,this.logger,this.name,this.storagePrefix)}get context(){return rt.getLoggerContext(this.logger)}isInitialized(){if(!this.initialized){let{message:e}=fe.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(_u.message,async e=>{let{topic:t,message:i}=e;if(this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(i)))return;let n=await this.core.crypto.decode(t,i);ei.isJsonRpcRequest(n)?(this.core.history.set(t,n),this.onRelayEventRequest({topic:t,payload:n})):ei.isJsonRpcResponse(n)&&(await this.core.history.resolve(n),this.onRelayEventResponse({topic:t,payload:n}))})}registerExpirerEvents(){this.core.expirer.on(Ur.expired,async e=>{let{topic:t}=fe.parseExpirerTarget(e.target);t&&this.pairings.keys.includes(t)&&(await this.deletePairing(t,!0),this.events.emit("pairing_expire",{topic:t}))})}},lp=class extends Jn.IJsonRpcHistory{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.records=new Map,this.events=new vo.EventEmitter,this.name=y6,this.version=m6,this.cached=[],this.initialized=!1,this.storagePrefix=cn,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(i=>this.records.set(i.id,i)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(i,n,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:i,request:n,chainId:s}),this.records.has(n.id))return;let o={id:n.id,topic:i,request:{method:n.method,params:n.params||null},chainId:s};this.records.set(o.id,o),this.events.emit(Zr.created,o)},this.resolve=async i=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:i}),!this.records.has(i.id))return;let n=await this.getRecord(i.id);typeof n.response>"u"&&(n.response=ei.isJsonRpcError(i)?{error:i.error}:{result:i.result},this.records.set(n.id,n),this.events.emit(Zr.updated,n))},this.get=async(i,n)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:i,id:n}),await this.getRecord(n)),this.delete=(i,n)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:n}),this.values.forEach(s=>{if(s.topic===i){if(typeof n<"u"&&s.id!==n)return;this.records.delete(s.id),this.events.emit(Zr.deleted,s)}})},this.exists=async(i,n)=>(this.isInitialized(),this.records.has(n)?(await this.getRecord(n)).topic===i:!1),this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.logger=rt.generateChildLogger(t,this.name)}get context(){return rt.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(t=>{if(typeof t.response<"u")return;let i={topic:t.topic,request:ei.formatJsonRpcRequest(t.request.method,t.request.params,t.id),chainId:t.chainId};return e.push(i)}),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 t=this.records.get(e);if(!t){let{message:i}=fe.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(i)}return t}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(Zr.sync)}async restore(){try{let e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){let{message:t}=fe.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(Zr.created,e=>{let t=Zr.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e}),this.persist()}),this.events.on(Zr.updated,e=>{let t=Zr.updated;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e}),this.persist()}),this.events.on(Zr.deleted,e=>{let t=Zr.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e}),this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=fe.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},fp=class extends Jn.IExpirer{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.expirations=new Map,this.events=new vo.EventEmitter,this.name=v6,this.version=w6,this.cached=[],this.initialized=!1,this.storagePrefix=cn,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(i=>this.expirations.set(i.target,i)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=i=>{try{let n=this.formatTarget(i);return typeof this.getExpiration(n)<"u"}catch{return!1}},this.set=(i,n)=>{this.isInitialized();let s=this.formatTarget(i),o={target:s,expiry:n};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(Ur.created,{target:s,expiration:o})},this.get=i=>{this.isInitialized();let n=this.formatTarget(i);return this.getExpiration(n)},this.del=i=>{this.isInitialized();let n=this.formatTarget(i);if(this.has(n)){let s=this.getExpiration(n);this.expirations.delete(n),this.events.emit(Ur.deleted,{target:n,expiration:s})}},this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.logger=rt.generateChildLogger(t,this.name)}get context(){return rt.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 fe.formatTopicTarget(e);if(typeof e=="number")return fe.formatIdTarget(e);let{message:t}=fe.getInternalError("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(t)}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:t}=fe.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}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 t=this.expirations.get(e);if(!t){let{message:i}=fe.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}return t}checkExpiry(e,t){let{expiry:i}=t;Ft.toMiliseconds(i)-Date.now()<=0&&this.expire(e,t)}expire(e,t){this.expirations.delete(e),this.events.emit(Ur.expired,{target:e,expiration:t})}checkExpirations(){this.expirations.forEach((e,t)=>this.checkExpiry(t,e))}registerEventListeners(){this.core.heartbeat.on(hp.HEARTBEAT_EVENTS.pulse,()=>this.checkExpirations()),this.events.on(Ur.created,e=>{let t=Ur.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(Ur.expired,e=>{let t=Ur.expired;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(Ur.deleted,e=>{let t=Ur.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=fe.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},N9=Object.defineProperty,BN=Object.getOwnPropertySymbols,D9=Object.prototype.hasOwnProperty,O9=Object.prototype.propertyIsEnumerable,MN=(r,e,t)=>e in r?N9(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,PN=(r,e)=>{for(var t in e||(e={}))D9.call(e,t)&&MN(r,t,e[t]);if(BN)for(var t of BN(e))O9.call(e,t)&&MN(r,t,e[t]);return r},Iu=class extends Jn.ICore{constructor(e){super(e),this.protocol=ow,this.version=zN,this.name=gp,this.events=new vo.EventEmitter,this.initialized=!1,this.on=(i,n)=>this.events.on(i,n),this.once=(i,n)=>this.events.once(i,n),this.off=(i,n)=>this.events.off(i,n),this.removeListener=(i,n)=>this.events.removeListener(i,n),this.projectId=e?.projectId;let t=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:LN.default(rt.getDefaultLoggerOptions({level:e?.logger||$N.logger}));this.logger=rt.generateChildLogger(t,this.name),this.heartbeat=new hp.HeartBeat,this.crypto=new np(this,this.logger,e?.keychain),this.history=new lp(this,this.logger),this.expirer=new fp(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new KH.default(PN(PN({},kN),e?.storageOptions)),this.relayer=new ap({core:this,logger:this.logger,relayUrl:e?.relayUrl,projectId:this.projectId}),this.pairing=new cp(this,this.logger)}static async init(e){let t=new Iu(e);return await t.initialize(),t}get context(){return rt.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 Initilization Success")}catch(e){throw this.logger.warn(`Core Initilization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}},B9=Iu;we.CORE_CONTEXT=gp,we.CORE_DEFAULT=$N,we.CORE_PROTOCOL=ow,we.CORE_STORAGE_OPTIONS=kN,we.CORE_STORAGE_PREFIX=cn,we.CORE_VERSION=zN,we.CRYPTO_CLIENT_SEED=iw,we.CRYPTO_CONTEXT=WN,we.CRYPTO_JWT_TTL=YN,we.Core=B9,we.Crypto=np,we.EXPIRER_CONTEXT=v6,we.EXPIRER_DEFAULT_TTL=y9,we.EXPIRER_EVENTS=Ur,we.EXPIRER_STORAGE_VERSION=w6,we.Expirer=fp,we.HISTORY_CONTEXT=y6,we.HISTORY_EVENTS=Zr,we.HISTORY_STORAGE_VERSION=m6,we.JsonRpcHistory=lp,we.KEYCHAIN_CONTEXT=JN,we.KEYCHAIN_STORAGE_VERSION=XN,we.KeyChain=ip,we.MESSAGES_CONTEXT=ZN,we.MESSAGES_STORAGE_VERSION=e6,we.MessageTracker=sp,we.PAIRING_CONTEXT=p6,we.PAIRING_DEFAULT_TTL=g9,we.PAIRING_RPC_OPTS=Au,we.PAIRING_STORAGE_VERSION=g6,we.PENDING_SUB_RESOLUTION_TIMEOUT=d6,we.PUBLISHER_CONTEXT=r6,we.PUBLISHER_DEFAULT_TTL=t6,we.Pairing=cp,we.RELAYER_CONTEXT=o6,we.RELAYER_DEFAULT_LOGGER=n6,we.RELAYER_DEFAULT_PROTOCOL=i6,we.RELAYER_DEFAULT_RELAY_URL=s6,we.RELAYER_EVENTS=_u,we.RELAYER_PROVIDER_EVENTS=mo,we.RELAYER_RECONNECT_TIMEOUT=u6,we.RELAYER_SDK_VERSION=c6,we.RELAYER_STORAGE_OPTIONS=d9,we.RELAYER_SUBSCRIBER_SUFFIX=a6,we.Relayer=ap,we.STORE_STORAGE_VERSION=l6,we.SUBSCRIBER_CONTEXT=f6,we.SUBSCRIBER_DEFAULT_TTL=p9,we.SUBSCRIBER_EVENTS=Yn,we.SUBSCRIBER_STORAGE_VERSION=h6,we.Store=up,we.Subscriber=op,we.default=Iu});var D6=D(Bt=>{"use strict";l();Object.defineProperty(Bt,"__esModule",{value:!0});var bu=E6(),aw=Sm(),C6=jm(),oe=Dd(),M9=um(),Mt=ro(),Ut=(rl(),ti(ar));function P9(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}var L9=P9(M9);function kt(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}var S6=kt;kt.EventEmitter=kt,kt.prototype._events=void 0,kt.prototype._maxListeners=void 0,kt.defaultMaxListeners=10,kt.prototype.setMaxListeners=function(r){if(!R9(r)||r<0||isNaN(r))throw TypeError("n must be a positive number");return this._maxListeners=r,this},kt.prototype.emit=function(r){var e,t,i,n,s,o;if(this._events||(this._events={}),r==="error"&&(!this._events.error||ll(this._events.error)&&!this._events.error.length)){if(e=arguments[1],e instanceof Error)throw e;var a=new Error('Uncaught, unspecified "error" event. ('+e+")");throw a.context=e,a}if(t=this._events[r],A6(t))return!1;if(ln(t))switch(arguments.length){case 1:t.call(this);break;case 2:t.call(this,arguments[1]);break;case 3:t.call(this,arguments[1],arguments[2]);break;default:n=Array.prototype.slice.call(arguments,1),t.apply(this,n)}else if(ll(t))for(n=Array.prototype.slice.call(arguments,1),o=t.slice(),i=o.length,s=0;s0&&this._events[r].length>t&&(this._events[r].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[r].length),typeof console.trace=="function"&&console.trace())),this},kt.prototype.on=kt.prototype.addListener,kt.prototype.once=function(r,e){if(!ln(e))throw TypeError("listener must be a function");var t=!1;function i(){this.removeListener(r,i),t||(t=!0,e.apply(this,arguments))}return i.listener=e,this.on(r,i),this},kt.prototype.removeListener=function(r,e){var t,i,n,s;if(!ln(e))throw TypeError("listener must be a function");if(!this._events||!this._events[r])return this;if(t=this._events[r],n=t.length,i=-1,t===e||ln(t.listener)&&t.listener===e)delete this._events[r],this._events.removeListener&&this.emit("removeListener",r,e);else if(ll(t)){for(s=n;s-- >0;)if(t[s]===e||t[s].listener&&t[s].listener===e){i=s;break}if(i<0)return this;t.length===1?(t.length=0,delete this._events[r]):t.splice(i,1),this._events.removeListener&&this.emit("removeListener",r,e)}return this},kt.prototype.removeAllListeners=function(r){var e,t;if(!this._events)return this;if(!this._events.removeListener)return arguments.length===0?this._events={}:this._events[r]&&delete this._events[r],this;if(arguments.length===0){for(e in this._events)e!=="removeListener"&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(t=this._events[r],ln(t))this.removeListener(r,t);else if(t)for(;t.length;)this.removeListener(r,t[t.length-1]);return delete this._events[r],this},kt.prototype.listeners=function(r){var e;return!this._events||!this._events[r]?e=[]:ln(this._events[r])?e=[this._events[r]]:e=this._events[r].slice(),e},kt.prototype.listenerCount=function(r){if(this._events){var e=this._events[r];if(ln(e))return 1;if(e)return e.length}return 0},kt.listenerCount=function(r,e){return r.listenerCount(e)};function ln(r){return typeof r=="function"}function R9(r){return typeof r=="number"}function ll(r){return typeof r=="object"&&r!==null}function A6(r){return r===void 0}var fw="wc",hw=2,dw="client",pw=`${fw}@${hw}:${dw}:`,yp={name:dw,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},F9={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_event:"session_event",proposal_expire:"proposal_expire"},U9={database:":memory:"},q9={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},V9="history",H9="0.3",x6="proposal",Q9=Mt.THIRTY_DAYS,T6="session",fl=Mt.SEVEN_DAYS,N6="engine",hl={wc_sessionPropose:{req:{ttl:Mt.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:Mt.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:Mt.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:Mt.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:Mt.ONE_DAY,prompt:!1,tag:1104},res:{ttl:Mt.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:Mt.ONE_DAY,prompt:!1,tag:1106},res:{ttl:Mt.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:Mt.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:Mt.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:Mt.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:Mt.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:Mt.ONE_DAY,prompt:!1,tag:1112},res:{ttl:Mt.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:Mt.THIRTY_SECONDS,prompt:!1,tag:1114},res:{ttl:Mt.THIRTY_SECONDS,prompt:!1,tag:1115}}},j9=Object.defineProperty,G9=Object.defineProperties,K9=Object.getOwnPropertyDescriptors,_6=Object.getOwnPropertySymbols,z9=Object.prototype.hasOwnProperty,$9=Object.prototype.propertyIsEnumerable,I6=(r,e,t)=>e in r?j9(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Xn=(r,e)=>{for(var t in e||(e={}))z9.call(e,t)&&I6(r,t,e[t]);if(_6)for(var t of _6(e))$9.call(e,t)&&I6(r,t,e[t]);return r},b6=(r,e)=>G9(r,K9(e)),uw=class extends C6.IEngine{constructor(e){super(e),this.name=N6,this.events=new S6,this.initialized=!1,this.ignoredPayloadTypes=[oe.TYPE_1],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.client.core.pairing.register({methods:Object.keys(hl)}),this.initialized=!0)},this.connect=async t=>{this.isInitialized(),await this.isValidConnect(t);let{pairingTopic:i,requiredNamespaces:n,relays:s}=t,o=i,a,u=!1;if(o&&(u=this.client.core.pairing.pairings.get(o).active),!o||!u){let{topic:H,uri:K}=await this.client.core.pairing.create();o=H,a=K}let h=await this.client.core.crypto.generateKeyPair(),p={requiredNamespaces:n,relays:s??[{protocol:bu.RELAYER_DEFAULT_PROTOCOL}],proposer:{publicKey:h,metadata:this.client.metadata}},{reject:v,resolve:B,done:R}=oe.createDelayedPromise();if(this.events.once(oe.engineEvent("session_connect"),async({error:H,session:K})=>{if(H)v(H);else if(K){K.self.publicKey=h;let ie=b6(Xn({},K),{requiredNamespaces:n});await this.client.session.set(K.topic,ie),await this.setExpiry(K.topic,K.expiry),o&&await this.client.core.pairing.updateMetadata({topic:o,metadata:K.peer.metadata}),B(ie)}}),!o){let{message:H}=oe.getInternalError("NO_MATCHING_KEY",`connect() pairing topic: ${o}`);throw new Error(H)}let x=await this.sendRequest(o,"wc_sessionPropose",p),V=oe.calcExpiry(Mt.FIVE_MINUTES);return await this.setProposal(x,Xn({id:x,expiry:V},p)),{uri:a,approval:R}},this.pair=async t=>(this.isInitialized(),await this.client.core.pairing.pair(t)),this.approve=async t=>{this.isInitialized(),await this.isValidApprove(t);let{id:i,relayProtocol:n,namespaces:s}=t,{pairingTopic:o,proposer:a,requiredNamespaces:u}=this.client.proposal.get(i),h=await this.client.core.crypto.generateKeyPair(),p=a.publicKey,v=await this.client.core.crypto.generateSharedKey(h,p),B={relay:{protocol:n??"irn"},namespaces:s,requiredNamespaces:u,controller:{publicKey:h,metadata:this.client.metadata},expiry:oe.calcExpiry(fl)};await this.client.core.relayer.subscribe(v);let R=await this.sendRequest(v,"wc_sessionSettle",B),{done:x,resolve:V,reject:H}=oe.createDelayedPromise();this.events.once(oe.engineEvent("session_approve",R),({error:ie})=>{ie?H(ie):V(this.client.session.get(v))});let K=b6(Xn({},B),{topic:v,acknowledged:!1,self:B.controller,peer:{publicKey:a.publicKey,metadata:a.metadata},controller:h});return await this.client.session.set(v,K),await this.setExpiry(v,oe.calcExpiry(fl)),o&&await this.client.core.pairing.updateMetadata({topic:o,metadata:K.peer.metadata}),o&&i&&(await this.sendResult(i,o,{relay:{protocol:n??"irn"},responderPublicKey:h}),await this.client.proposal.delete(i,oe.getSdkError("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:o})),{topic:v,acknowledged:x}},this.reject=async t=>{this.isInitialized(),await this.isValidReject(t);let{id:i,reason:n}=t,{pairingTopic:s}=this.client.proposal.get(i);s&&(await this.sendError(i,s,n),await this.client.proposal.delete(i,oe.getSdkError("USER_DISCONNECTED")))},this.update=async t=>{this.isInitialized(),await this.isValidUpdate(t);let{topic:i,namespaces:n}=t,s=await this.sendRequest(i,"wc_sessionUpdate",{namespaces:n}),{done:o,resolve:a,reject:u}=oe.createDelayedPromise();return this.events.once(oe.engineEvent("session_update",s),({error:h})=>{h?u(h):a()}),await this.client.session.update(i,{namespaces:n}),{acknowledged:o}},this.extend=async t=>{this.isInitialized(),await this.isValidExtend(t);let{topic:i}=t,n=await this.sendRequest(i,"wc_sessionExtend",{}),{done:s,resolve:o,reject:a}=oe.createDelayedPromise();return this.events.once(oe.engineEvent("session_extend",n),({error:u})=>{u?a(u):o()}),await this.setExpiry(i,oe.calcExpiry(fl)),{acknowledged:s}},this.request=async t=>{this.isInitialized(),await this.isValidRequest(t);let{chainId:i,request:n,topic:s}=t,o=await this.sendRequest(s,"wc_sessionRequest",{request:n,chainId:i}),{done:a,resolve:u,reject:h}=oe.createDelayedPromise();return this.events.once(oe.engineEvent("session_request",o),({error:p,result:v})=>{p?h(p):u(v)}),await a()},this.respond=async t=>{this.isInitialized(),await this.isValidRespond(t);let{topic:i,response:n}=t,{id:s}=n;Ut.isJsonRpcResult(n)?await this.sendResult(s,i,n.result):Ut.isJsonRpcError(n)&&await this.sendError(s,i,n.error)},this.ping=async t=>{this.isInitialized(),await this.isValidPing(t);let{topic:i}=t;if(this.client.session.keys.includes(i)){let n=await this.sendRequest(i,"wc_sessionPing",{}),{done:s,resolve:o,reject:a}=oe.createDelayedPromise();this.events.once(oe.engineEvent("session_ping",n),({error:u})=>{u?a(u):o()}),await s()}else this.client.core.pairing.pairings.keys.includes(i)&&await this.client.core.pairing.ping({topic:i})},this.emit=async t=>{this.isInitialized(),await this.isValidEmit(t);let{topic:i,event:n,chainId:s}=t;await this.sendRequest(i,"wc_sessionEvent",{event:n,chainId:s})},this.disconnect=async t=>{this.isInitialized(),await this.isValidDisconnect(t);let{topic:i}=t;this.client.session.keys.includes(i)?(await this.sendRequest(i,"wc_sessionDelete",oe.getSdkError("USER_DISCONNECTED")),await this.deleteSession(i)):await this.client.core.pairing.disconnect({topic:i})},this.find=t=>(this.isInitialized(),this.client.session.getAll().filter(i=>oe.isSessionCompatible(i,t))),this.deleteSession=async(t,i)=>{let{self:n}=this.client.session.get(t);await this.client.core.relayer.unsubscribe(t),await Promise.all([this.client.session.delete(t,oe.getSdkError("USER_DISCONNECTED")),this.client.core.crypto.deleteKeyPair(n.publicKey),this.client.core.crypto.deleteSymKey(t),i?Promise.resolve():this.client.core.expirer.del(t)])},this.deleteProposal=async(t,i)=>{await Promise.all([this.client.proposal.delete(t,oe.getSdkError("USER_DISCONNECTED")),i?Promise.resolve():this.client.core.expirer.del(t)])},this.setExpiry=async(t,i)=>{this.client.session.keys.includes(t)&&await this.client.session.update(t,{expiry:i}),this.client.core.expirer.set(t,i)},this.setProposal=async(t,i)=>{await this.client.proposal.set(t,i),this.client.core.expirer.set(t,i.expiry)},this.sendRequest=async(t,i,n)=>{let s=Ut.formatJsonRpcRequest(i,n),o=await this.client.core.crypto.encode(t,s),a=hl[i].req;return this.client.core.history.set(t,s),this.client.core.relayer.publish(t,o,a),s.id},this.sendResult=async(t,i,n)=>{let s=Ut.formatJsonRpcResult(t,n),o=await this.client.core.crypto.encode(i,s),a=await this.client.core.history.get(i,t),u=hl[a.request.method].res;await this.client.core.relayer.publish(i,o,u),await this.client.core.history.resolve(s)},this.sendError=async(t,i,n)=>{let s=Ut.formatJsonRpcError(t,n),o=await this.client.core.crypto.encode(i,s),a=await this.client.core.history.get(i,t),u=hl[a.request.method].res;await this.client.core.relayer.publish(i,o,u),await this.client.core.history.resolve(s)},this.cleanup=async()=>{let t=[],i=[];this.client.session.getAll().forEach(n=>{oe.isExpired(n.expiry)&&t.push(n.topic)}),this.client.proposal.getAll().forEach(n=>{oe.isExpired(n.expiry)&&i.push(n.id)}),await Promise.all([...t.map(n=>this.deleteSession(n)),...i.map(n=>this.deleteProposal(n))])},this.onRelayEventRequest=t=>{let{topic:i,payload:n}=t,s=n.method;switch(s){case"wc_sessionPropose":return this.onSessionProposeRequest(i,n);case"wc_sessionSettle":return this.onSessionSettleRequest(i,n);case"wc_sessionUpdate":return this.onSessionUpdateRequest(i,n);case"wc_sessionExtend":return this.onSessionExtendRequest(i,n);case"wc_sessionPing":return this.onSessionPingRequest(i,n);case"wc_sessionDelete":return this.onSessionDeleteRequest(i,n);case"wc_sessionRequest":return this.onSessionRequest(i,n);case"wc_sessionEvent":return this.onSessionEventRequest(i,n);default:return this.client.logger.info(`Unsupported request method ${s}`)}},this.onRelayEventResponse=async t=>{let{topic:i,payload:n}=t,s=(await this.client.core.history.get(i,n.id)).request.method;switch(s){case"wc_sessionPropose":return this.onSessionProposeResponse(i,n);case"wc_sessionSettle":return this.onSessionSettleResponse(i,n);case"wc_sessionUpdate":return this.onSessionUpdateResponse(i,n);case"wc_sessionExtend":return this.onSessionExtendResponse(i,n);case"wc_sessionPing":return this.onSessionPingResponse(i,n);case"wc_sessionRequest":return this.onSessionRequestResponse(i,n);default:return this.client.logger.info(`Unsupported response method ${s}`)}},this.onSessionProposeRequest=async(t,i)=>{let{params:n,id:s}=i;try{this.isValidConnect(Xn({},i.params));let o=oe.calcExpiry(Mt.FIVE_MINUTES),a=Xn({id:s,pairingTopic:t,expiry:o},n);await this.setProposal(s,a),this.client.events.emit("session_proposal",{id:s,params:a})}catch(o){await this.sendError(s,t,o),this.client.logger.error(o)}},this.onSessionProposeResponse=async(t,i)=>{let{id:n}=i;if(Ut.isJsonRpcResult(i)){let{result:s}=i;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:s});let o=this.client.proposal.get(n);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 h=await this.client.core.crypto.generateSharedKey(a,u);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:h});let p=await this.client.core.relayer.subscribe(h);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:p}),await this.client.core.pairing.activate({topic:t})}else Ut.isJsonRpcError(i)&&(await this.client.proposal.delete(n,oe.getSdkError("USER_DISCONNECTED")),this.events.emit(oe.engineEvent("session_connect"),{error:i.error}))},this.onSessionSettleRequest=async(t,i)=>{let{id:n,params:s}=i;try{this.isValidSessionSettleRequest(s);let{relay:o,controller:a,expiry:u,namespaces:h}=i.params,p={topic:t,relay:o,expiry:u,namespaces:h,acknowledged:!0,controller:a.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}};await this.sendResult(i.id,t,!0),this.events.emit(oe.engineEvent("session_connect"),{session:p})}catch(o){await this.sendError(n,t,o),this.client.logger.error(o)}},this.onSessionSettleResponse=async(t,i)=>{let{id:n}=i;Ut.isJsonRpcResult(i)?(await this.client.session.update(t,{acknowledged:!0}),this.events.emit(oe.engineEvent("session_approve",n),{})):Ut.isJsonRpcError(i)&&(await this.client.session.delete(t,oe.getSdkError("USER_DISCONNECTED")),this.events.emit(oe.engineEvent("session_approve",n),{error:i.error}))},this.onSessionUpdateRequest=async(t,i)=>{let{params:n,id:s}=i;try{this.isValidUpdate(Xn({topic:t},n)),await this.client.session.update(t,{namespaces:n.namespaces}),await this.sendResult(s,t,!0),this.client.events.emit("session_update",{id:s,topic:t,params:n})}catch(o){await this.sendError(s,t,o),this.client.logger.error(o)}},this.onSessionUpdateResponse=(t,i)=>{let{id:n}=i;Ut.isJsonRpcResult(i)?this.events.emit(oe.engineEvent("session_update",n),{}):Ut.isJsonRpcError(i)&&this.events.emit(oe.engineEvent("session_update",n),{error:i.error})},this.onSessionExtendRequest=async(t,i)=>{let{id:n}=i;try{this.isValidExtend({topic:t}),await this.setExpiry(t,oe.calcExpiry(fl)),await this.sendResult(n,t,!0),this.client.events.emit("session_extend",{id:n,topic:t})}catch(s){await this.sendError(n,t,s),this.client.logger.error(s)}},this.onSessionExtendResponse=(t,i)=>{let{id:n}=i;Ut.isJsonRpcResult(i)?this.events.emit(oe.engineEvent("session_extend",n),{}):Ut.isJsonRpcError(i)&&this.events.emit(oe.engineEvent("session_extend",n),{error:i.error})},this.onSessionPingRequest=async(t,i)=>{let{id:n}=i;try{this.isValidPing({topic:t}),await this.sendResult(n,t,!0),this.client.events.emit("session_ping",{id:n,topic:t})}catch(s){await this.sendError(n,t,s),this.client.logger.error(s)}},this.onSessionPingResponse=(t,i)=>{let{id:n}=i;setTimeout(()=>{Ut.isJsonRpcResult(i)?this.events.emit(oe.engineEvent("session_ping",n),{}):Ut.isJsonRpcError(i)&&this.events.emit(oe.engineEvent("session_ping",n),{error:i.error})},500)},this.onSessionDeleteRequest=async(t,i)=>{let{id:n}=i;try{this.isValidDisconnect({topic:t,reason:i.params}),await this.sendResult(n,t,!0),await this.deleteSession(t),this.client.events.emit("session_delete",{id:n,topic:t})}catch(s){await this.sendError(n,t,s),this.client.logger.error(s)}},this.onSessionRequest=async(t,i)=>{let{id:n,params:s}=i;try{this.isValidRequest(Xn({topic:t},s)),this.client.events.emit("session_request",{id:n,topic:t,params:s})}catch(o){await this.sendError(n,t,o),this.client.logger.error(o)}},this.onSessionRequestResponse=(t,i)=>{let{id:n}=i;Ut.isJsonRpcResult(i)?this.events.emit(oe.engineEvent("session_request",n),{result:i.result}):Ut.isJsonRpcError(i)&&this.events.emit(oe.engineEvent("session_request",n),{error:i.error})},this.onSessionEventRequest=async(t,i)=>{let{id:n,params:s}=i;try{this.isValidEmit(Xn({topic:t},s)),this.client.events.emit("session_event",{id:n,topic:t,params:s})}catch(o){await this.sendError(n,t,o),this.client.logger.error(o)}},this.isValidConnect=async t=>{if(!oe.isValidParams(t)){let{message:a}=oe.getInternalError("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(t)}`);throw new Error(a)}let{pairingTopic:i,requiredNamespaces:n,relays:s}=t;oe.isUndefined(i)||await this.isValidPairingTopic(i);let o=oe.isValidRequiredNamespaces(n,"connect()");if(o)throw new Error(o.message);if(!oe.isValidRelays(s,!0)){let{message:a}=oe.getInternalError("MISSING_OR_INVALID",`connect() relays: ${s}`);throw new Error(a)}},this.isValidApprove=async t=>{if(!oe.isValidParams(t))throw new Error(oe.getInternalError("MISSING_OR_INVALID",`approve() params: ${t}`).message);let{id:i,namespaces:n,relayProtocol:s}=t;await this.isValidProposalId(i);let o=this.client.proposal.get(i),a=oe.isValidNamespaces(n,"approve()");if(a)throw new Error(a.message);let u=oe.isConformingNamespaces(o.requiredNamespaces,n,"update()");if(u)throw new Error(u.message);if(!oe.isValidString(s,!0)){let{message:h}=oe.getInternalError("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(h)}},this.isValidReject=async t=>{if(!oe.isValidParams(t)){let{message:s}=oe.getInternalError("MISSING_OR_INVALID",`reject() params: ${t}`);throw new Error(s)}let{id:i,reason:n}=t;if(await this.isValidProposalId(i),!oe.isValidErrorReason(n)){let{message:s}=oe.getInternalError("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(n)}`);throw new Error(s)}},this.isValidSessionSettleRequest=t=>{if(!oe.isValidParams(t)){let{message:h}=oe.getInternalError("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${t}`);throw new Error(h)}let{relay:i,controller:n,namespaces:s,expiry:o}=t;if(!oe.isValidRelay(i)){let{message:h}=oe.getInternalError("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(h)}let a=oe.isValidController(n,"onSessionSettleRequest()");if(a)throw new Error(a.message);let u=oe.isValidNamespaces(s,"onSessionSettleRequest()");if(u)throw new Error(u.message);if(oe.isExpired(o)){let{message:h}=oe.getInternalError("EXPIRED","onSessionSettleRequest()");throw new Error(h)}},this.isValidUpdate=async t=>{if(!oe.isValidParams(t)){let{message:u}=oe.getInternalError("MISSING_OR_INVALID",`update() params: ${t}`);throw new Error(u)}let{topic:i,namespaces:n}=t;await this.isValidSessionTopic(i);let s=this.client.session.get(i),o=oe.isValidNamespaces(n,"update()");if(o)throw new Error(o.message);let a=oe.isConformingNamespaces(s.requiredNamespaces,n,"update()");if(a)throw new Error(a.message)},this.isValidExtend=async t=>{if(!oe.isValidParams(t)){let{message:n}=oe.getInternalError("MISSING_OR_INVALID",`extend() params: ${t}`);throw new Error(n)}let{topic:i}=t;await this.isValidSessionTopic(i)},this.isValidRequest=async t=>{if(!oe.isValidParams(t)){let{message:a}=oe.getInternalError("MISSING_OR_INVALID",`request() params: ${t}`);throw new Error(a)}let{topic:i,request:n,chainId:s}=t;await this.isValidSessionTopic(i);let{namespaces:o}=this.client.session.get(i);if(!oe.isValidNamespacesChainId(o,s)){let{message:a}=oe.getInternalError("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(a)}if(!oe.isValidRequest(n)){let{message:a}=oe.getInternalError("MISSING_OR_INVALID",`request() ${JSON.stringify(n)}`);throw new Error(a)}if(!oe.isValidNamespacesRequest(o,s,n.method)){let{message:a}=oe.getInternalError("MISSING_OR_INVALID",`request() method: ${n.method}`);throw new Error(a)}},this.isValidRespond=async t=>{if(!oe.isValidParams(t)){let{message:s}=oe.getInternalError("MISSING_OR_INVALID",`respond() params: ${t}`);throw new Error(s)}let{topic:i,response:n}=t;if(await this.isValidSessionTopic(i),!oe.isValidResponse(n)){let{message:s}=oe.getInternalError("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(n)}`);throw new Error(s)}},this.isValidPing=async t=>{if(!oe.isValidParams(t)){let{message:n}=oe.getInternalError("MISSING_OR_INVALID",`ping() params: ${t}`);throw new Error(n)}let{topic:i}=t;await this.isValidSessionOrPairingTopic(i)},this.isValidEmit=async t=>{if(!oe.isValidParams(t)){let{message:a}=oe.getInternalError("MISSING_OR_INVALID",`emit() params: ${t}`);throw new Error(a)}let{topic:i,event:n,chainId:s}=t;await this.isValidSessionTopic(i);let{namespaces:o}=this.client.session.get(i);if(!oe.isValidNamespacesChainId(o,s)){let{message:a}=oe.getInternalError("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(a)}if(!oe.isValidEvent(n)){let{message:a}=oe.getInternalError("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(n)}`);throw new Error(a)}if(!oe.isValidNamespacesEvent(o,s,n.name)){let{message:a}=oe.getInternalError("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(n)}`);throw new Error(a)}},this.isValidDisconnect=async t=>{if(!oe.isValidParams(t)){let{message:n}=oe.getInternalError("MISSING_OR_INVALID",`disconnect() params: ${t}`);throw new Error(n)}let{topic:i}=t;await this.isValidSessionOrPairingTopic(i)}}isInitialized(){if(!this.initialized){let{message:e}=oe.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.client.core.relayer.on(bu.RELAYER_EVENTS.message,async e=>{let{topic:t,message:i}=e;if(this.ignoredPayloadTypes.includes(this.client.core.crypto.getPayloadType(i)))return;let n=await this.client.core.crypto.decode(t,i);Ut.isJsonRpcRequest(n)?(this.client.core.history.set(t,n),this.onRelayEventRequest({topic:t,payload:n})):Ut.isJsonRpcResponse(n)&&(await this.client.core.history.resolve(n),this.onRelayEventResponse({topic:t,payload:n}))})}registerExpirerEvents(){this.client.core.expirer.on(bu.EXPIRER_EVENTS.expired,async e=>{let{topic:t,id:i}=oe.parseExpirerTarget(e.target);t?this.client.session.keys.includes(t)&&(await this.deleteSession(t,!0),this.client.events.emit("session_expire",{topic:t})):i&&await this.deleteProposal(i,!0)})}isValidPairingTopic(e){if(!oe.isValidString(e,!1)){let{message:t}=oe.getInternalError("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(t)}if(!this.client.core.pairing.pairings.keys.includes(e)){let{message:t}=oe.getInternalError("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(t)}if(oe.isExpired(this.client.core.pairing.pairings.get(e).expiry)){let{message:t}=oe.getInternalError("EXPIRED",`pairing topic: ${e}`);throw new Error(t)}}async isValidSessionTopic(e){if(!oe.isValidString(e,!1)){let{message:t}=oe.getInternalError("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(t)}if(!this.client.session.keys.includes(e)){let{message:t}=oe.getInternalError("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(t)}if(oe.isExpired(this.client.session.get(e).expiry)){await this.deleteSession(e);let{message:t}=oe.getInternalError("EXPIRED",`session topic: ${e}`);throw new Error(t)}}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(oe.isValidString(e,!1)){let{message:t}=oe.getInternalError("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(t)}else{let{message:t}=oe.getInternalError("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(t)}}async isValidProposalId(e){if(!oe.isValidId(e)){let{message:t}=oe.getInternalError("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(t)}if(!this.client.proposal.keys.includes(e)){let{message:t}=oe.getInternalError("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(t)}if(oe.isExpired(this.client.proposal.get(e).expiry)){await this.deleteProposal(e);let{message:t}=oe.getInternalError("EXPIRED",`proposal id: ${e}`);throw new Error(t)}}},cw=class extends bu.Store{constructor(e,t){super(e,t,x6,pw),this.core=e,this.logger=t}},lw=class extends bu.Store{constructor(e,t){super(e,t,T6,pw),this.core=e,this.logger=t}},Cu=class extends C6.ISignClient{constructor(e){super(e),this.protocol=fw,this.version=hw,this.name=yp.name,this.events=new S6.EventEmitter,this.on=(i,n)=>this.events.on(i,n),this.once=(i,n)=>this.events.once(i,n),this.off=(i,n)=>this.events.off(i,n),this.removeListener=(i,n)=>this.events.removeListener(i,n),this.connect=async i=>{try{return await this.engine.connect(i)}catch(n){throw this.logger.error(n.message),n}},this.pair=async i=>{try{return await this.engine.pair(i)}catch(n){throw this.logger.error(n.message),n}},this.approve=async i=>{try{return await this.engine.approve(i)}catch(n){throw this.logger.error(n.message),n}},this.reject=async i=>{try{return await this.engine.reject(i)}catch(n){throw this.logger.error(n.message),n}},this.update=async i=>{try{return await this.engine.update(i)}catch(n){throw this.logger.error(n.message),n}},this.extend=async i=>{try{return await this.engine.extend(i)}catch(n){throw this.logger.error(n.message),n}},this.request=async i=>{try{return await this.engine.request(i)}catch(n){throw this.logger.error(n.message),n}},this.respond=async i=>{try{return await this.engine.respond(i)}catch(n){throw this.logger.error(n.message),n}},this.ping=async i=>{try{return await this.engine.ping(i)}catch(n){throw this.logger.error(n.message),n}},this.emit=async i=>{try{return await this.engine.emit(i)}catch(n){throw this.logger.error(n.message),n}},this.disconnect=async i=>{try{return await this.engine.disconnect(i)}catch(n){throw this.logger.error(n.message),n}},this.find=i=>{try{return this.engine.find(i)}catch(n){throw this.logger.error(n.message),n}},this.name=e?.name||yp.name,this.metadata=e?.metadata||oe.getAppMetadata();let t=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:L9.default(aw.getDefaultLoggerOptions({level:e?.logger||yp.logger}));this.core=e?.core||new bu.Core(e),this.logger=aw.generateChildLogger(t,this.name),this.session=new lw(this.core,this.logger),this.proposal=new cw(this.core,this.logger),this.engine=new uw(this)}static async init(e){let t=new Cu(e);return await t.initialize(),t}get context(){return aw.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.engine.init(),this.logger.info("SignClient Initilization Success")}catch(e){throw this.logger.info("SignClient Initilization Failure"),this.logger.error(e.message),e}}},k9=Cu;Bt.ENGINE_CONTEXT=N6,Bt.ENGINE_RPC_OPTS=hl,Bt.HISTORY_CONTEXT=V9,Bt.HISTORY_EVENTS=q9,Bt.HISTORY_STORAGE_VERSION=H9,Bt.PROPOSAL_CONTEXT=x6,Bt.PROPOSAL_EXPIRY=Q9,Bt.SESSION_CONTEXT=T6,Bt.SESSION_EXPIRY=fl,Bt.SIGN_CLIENT_CONTEXT=dw,Bt.SIGN_CLIENT_DEFAULT=yp,Bt.SIGN_CLIENT_EVENTS=F9,Bt.SIGN_CLIENT_PROTOCOL=fw,Bt.SIGN_CLIENT_STORAGE_OPTIONS=U9,Bt.SIGN_CLIENT_STORAGE_PREFIX=pw,Bt.SIGN_CLIENT_VERSION=hw,Bt.SignClient=k9,Bt.default=Cu});var O6=D(Su=>{"use strict";l();Object.defineProperty(Su,"__esModule",{value:!0});Su.WALLETCONNECT_ELROND_NAMESPACE=Su.WALLETCONNECT_ELROND_CHAIN_ID=void 0;Su.WALLETCONNECT_ELROND_CHAIN_ID=508;Su.WALLETCONNECT_ELROND_NAMESPACE="elrond"});var B6=D(dl=>{"use strict";l();Object.defineProperty(dl,"__esModule",{value:!0});dl.Operation=void 0;var W9;(function(r){r.SIGN_TRANSACTION="erd_signTransaction",r.SIGN_TRANSACTIONS="erd_signTransactions",r.SIGN_MESSAGE="erd_signMessage",r.SIGN_LOGIN_TOKEN="erd_signLoginToken"})(W9=dl.Operation||(dl.Operation={}))});var M6=D(mp=>{"use strict";l();Object.defineProperty(mp,"__esModule",{value:!0});mp.Logger=void 0;var gw=class{static error(e){console.error(e)}static trace(e){console.trace(e)}};mp.Logger=gw});var P6=D(xu=>{"use strict";l();Object.defineProperty(xu,"__esModule",{value:!0});xu.Signature=xu.Address=void 0;var yw=class{constructor(e){this.value=e}bech32(){return this.value}};xu.Address=yw;var pl=class{constructor(e){this.buffer=e}static fromHex(e){return new pl(y.Buffer.from(e,"hex"))}hex(){return this.buffer.toString("hex")}};xu.Signature=pl});var L6=D(Zn=>{"use strict";l();Object.defineProperty(Zn,"__esModule",{value:!0});Zn.ErrBadAddress=Zn.ErrNotImplemented=Zn.Err=void 0;var gl=class extends Error{constructor(e,t){super(e),this.inner=void 0,this.inner=t}};Zn.Err=gl;var mw=class extends gl{constructor(){super("Method not yet implemented")}};Zn.ErrNotImplemented=mw;var vw=class extends gl{constructor(e,t){super(`Bad address: ${e}`,t)}};Zn.ErrBadAddress=vw});var F6=D(Mi=>{"use strict";l();var Y9=Mi&&Mi.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),J9=Mi&&Mi.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),X9=Mi&&Mi.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&Y9(e,r,t);return J9(e,r),e};Object.defineProperty(Mi,"__esModule",{value:!0});Mi.UserAddress=void 0;var Z9=X9(ef()),R6=L6(),ej="erd",yl=class{constructor(e){this.value=e}static fromBech32(e){let t;try{t=Z9.decode(e)}catch(i){throw new R6.ErrBadAddress(e,i)}if(t.prefix!=ej)throw new R6.ErrBadAddress(e);return new yl(e)}bech32(){return this.value}};Mi.UserAddress=yl});var wp=D(ts=>{"use strict";l();var Wt=ts&&ts.__awaiter||function(r,e,t,i){function n(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(p){try{h(i.next(p))}catch(v){o(v)}}function u(p){try{h(i.throw(p))}catch(v){o(v)}}function h(p){p.done?s(p.value):n(p.value).then(a,u)}h((i=i.apply(r,e||[])).next())})},tj=ts&&ts.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(ts,"__esModule",{value:!0});ts.WalletConnectV2Provider=void 0;var rj=tj(D6()),U6=Dd(),es=O6(),ml=B6(),je=M6(),vl=P6(),vp=F6(),ww=class{constructor(e,t,i,n){this.chainId="",this.address="",this.signature="",this.isInitializing=!1,this.events=[],this.methods=[],this.onClientConnect=e,this.chainId=t,this.walletConnectV2Relay=i,this.walletConnectV2ProjectId=n}init(){return Wt(this,void 0,void 0,function*(){try{let e=yield rj.default.init({relayUrl:this.walletConnectV2Relay,projectId:this.walletConnectV2ProjectId});this.walletConnector=e,yield this.subscribeToEvents(e),yield this.checkPersistedState(e)}catch{throw new Error("connect: WalletConnect is unable to init")}finally{this.isInitializing=!1}return!0})}isInitialized(){return!!this.walletConnector}isConnected(){return new Promise((e,t)=>e(Boolean(this.isInitialized()&&typeof this.session<"u")))}connect(e){var t,i;return Wt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u"&&(yield this.init()),typeof this.walletConnector>"u")throw new Error("WalletConnect is not initialized");let n=[...Object.values(ml.Operation),...(t=e?.methods)!==null&&t!==void 0?t:[]],s=[`${es.WALLETCONNECT_ELROND_NAMESPACE}:${this.chainId}`],o=(i=e?.events)!==null&&i!==void 0?i:[];try{let a=yield this.walletConnector.connect({pairingTopic:e?.topic,requiredNamespaces:{[es.WALLETCONNECT_ELROND_NAMESPACE]:{methods:n,chains:s,events:o}}});return this.events=o,this.methods=n,a}catch{throw e?.topic?(yield this.logout({topic:e.topic}),je.Logger.error("connect: WalletConnect is unable to connect to existing pairing"),new Error("connect: WalletConnect is unable to connect to existing pairing")):(je.Logger.error("connect: WalletConnect is unable to connect"),new Error("connect: WalletConnect is unable to connect"))}})}login(e){return Wt(this,void 0,void 0,function*(){if(this.isInitializing=!0,typeof this.walletConnector>"u"&&(yield this.connect()),typeof this.walletConnector>"u")throw new Error("WalletConnect is not initialized");typeof this.session<"u"&&(yield this.logout());try{if(e&&e.approval){let t=yield e.approval();if(e.token){let i=this.getAddressFromSession(t),{signature:n}=yield this.walletConnector.request({chainId:`${es.WALLETCONNECT_ELROND_NAMESPACE}:${this.chainId}`,topic:t.topic,request:{method:ml.Operation.SIGN_LOGIN_TOKEN,params:{token:e.token,address:i}}});if(!n)throw je.Logger.error("login: WalletConnect could not sign login token"),new Error("WalletConnect could not sign login token");return yield this.onSessionConnected({session:t,signature:n})}return yield this.onSessionConnected({session:t,signature:""})}}catch{throw je.Logger.error("login: WalletConnect is unable to login"),new Error("login: WalletConnect is unable to login")}finally{this.isInitializing=!1}return""})}logout(e){var t,i;return Wt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw je.Logger.error("logout: WalletConnect not initialised, call init() first"),new Error("WalletConnect not initialised, call init() first");try{let n=(t=e?.topic)!==null&&t!==void 0?t:(i=this.session)===null||i===void 0?void 0:i.topic;if(n){yield this.walletConnector.disconnect({topic:n,reason:U6.getSdkError("USER_DISCONNECTED")});let s=this.walletConnector.pairing.getAll({active:!0}).filter(o=>o.topic!==n);this.pairings=s}}catch{je.Logger.error("logout: WalletConnect was unable to logout")}return this.session=void 0,!0})}getAddress(){return Wt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw je.Logger.error("getAddress: WalletConnect not initialised, call init() first"),new Error("WalletConnect not initialised, call init() first");return this.address})}getSignature(){return Wt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw je.Logger.error("getSignature: WalletConnect not initialised, call init() first"),new Error("WalletConnect not initialised, call init() first");return this.signature})}getPairings(){var e;return Wt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw je.Logger.error("getPairings: WalletConnect not initialised, call init() first"),new Error("WalletConnect not initialised, call init() first");return(e=this.pairings)!==null&&e!==void 0?e:this.walletConnector.pairing.getAll({active:!0})})}signMessage(e){return Wt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw je.Logger.error("signMessage: WalletConnect not initialised, call init() first"),new Error("WalletConnect not initialised, call init() first");if(typeof this.session>"u")throw je.Logger.error("signMessage: Session is not connected"),new Error("Session is not connected");let t=yield this.getAddress(),{signature:i}=yield this.walletConnector.request({chainId:`${es.WALLETCONNECT_ELROND_NAMESPACE}:${this.chainId}`,topic:this.session.topic,request:{method:ml.Operation.SIGN_MESSAGE,params:{address:t,message:e.message.toString()}}});if(!i)throw je.Logger.error("signMessage: WalletConnect could not sign the message"),new Error("WalletConnect could not sign the message");return e.applySignature(new vl.Signature(i),vp.UserAddress.fromBech32(t)),e})}signTransaction(e){return Wt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw je.Logger.error("signTransaction: WalletConnect not initialised, call init() first"),new Error("WalletConnect not initialised, call init() first");if(typeof this.session>"u")throw je.Logger.error("signTransaction: Session is not connected"),new Error("Session is not connected");let t=yield this.getAddress(),i=new vl.Address(t),n=e.toPlainObject(i);if(this.chainId!==e.getChainID().valueOf())throw je.Logger.error("signTransaction: Transaction Chain Id different than Connection Chain Id"),new Error("Transaction Chain Id different than Connection Chain Id");let{signature:s}=yield this.walletConnector.request({chainId:`${es.WALLETCONNECT_ELROND_NAMESPACE}:${this.chainId}`,topic:this.session.topic,request:{method:ml.Operation.SIGN_TRANSACTION,params:{transaction:n}}});if(!s)throw je.Logger.error("signTransaction: WalletConnect could not sign the transaction"),new Error("WalletConnect could not sign the transaction");return e.applySignature(vl.Signature.fromHex(s),vp.UserAddress.fromBech32(t)),e})}signTransactions(e){return Wt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw je.Logger.error("signTransactions: WalletConnect not initialised, call init() first"),new Error("WalletConnect not initialised, call init() first");if(typeof this.session>"u")throw je.Logger.error("signTransactions: Session is not connected"),new Error("Session is not connected");let t=yield this.getAddress(),i=new vl.Address(t),n=e.map(o=>{if(this.chainId!==o.getChainID().valueOf())throw je.Logger.error("signTransactions: Transaction Chain Id different than Connection Chain Id"),new Error("Transactions Chain Id different than Connection Chain Id");return o.toPlainObject(i)}),{signatures:s}=yield this.walletConnector.request({chainId:`${es.WALLETCONNECT_ELROND_NAMESPACE}:${this.chainId}`,topic:this.session.topic,request:{method:ml.Operation.SIGN_TRANSACTIONS,params:{transactions:n}}});if(!s||!Array.isArray(s))throw je.Logger.error("signTransactions: WalletConnect could not sign the transactions"),new Error("WalletConnect could not sign the transactions");if(e.length!==s.length)throw je.Logger.error("signTransactions: WalletConnect could not sign the transactions. Invalid signatures."),new Error("WalletConnect could not sign the transactions. Invalid signatures.");for(let[o,a]of e.entries())a.applySignature(vl.Signature.fromHex(s[o].signature),vp.UserAddress.fromBech32(t));return e})}sendCustomRequest(e){return Wt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw je.Logger.error("sendCustomRequest: WalletConnect not initialised, call init() first"),new Error("WalletConnect not initialised, call init() first");if(typeof this.session>"u")throw je.Logger.error("sendCustomRequest: Session is not connected"),new Error("Session is not connected");if(e?.request){let{response:t}=yield this.walletConnector.request({chainId:`${es.WALLETCONNECT_ELROND_NAMESPACE}:${this.chainId}`,topic:this.session.topic,request:e.request});if(!t)throw je.Logger.error("sendCustomRequest: WalletConnect could not send the custom request"),new Error("WalletConnect could not send the custom request");return t}})}ping(){return Wt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw je.Logger.error("ping: WalletConnect not initialised, call init() first"),new Error("WalletConnect not initialised, call init() first");if(typeof this.session>"u")throw je.Logger.error("ping: Session is not connected"),new Error("Session is not connected");try{return yield this.walletConnector.ping({topic:this.session.topic}),!0}catch{return je.Logger.error("ping: Ping failed"),!1}})}loginAccount(e){var t;return Wt(this,void 0,void 0,function*(){if(!!e){if(this.addressIsValid(e.address)){this.address=e.address,e.signature&&(this.signature=e.signature),this.onClientConnect.onClientLogin();return}if(je.Logger.error(`WalletConnect invalid address ${e.address}`),((t=this.session)===null||t===void 0?void 0:t.topic)&&this.walletConnector){yield this.walletConnector.disconnect({topic:this.session.topic,reason:U6.getSdkError("USER_DISCONNECTED")});let i=this.walletConnector.pairing.getAll({active:!0});this.pairings=i}}})}onSessionConnected(e){return Wt(this,void 0,void 0,function*(){if(!e)return"";this.session=e.session;let t=this.getAddressFromSession(e.session);return t&&(yield this.loginAccount({address:t,signature:e.signature})),""})}handleTopicUpdateEvent({topic:e}){var t;return Wt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw new Error("WalletConnect is not initialized");this.pairings=this.walletConnector.pairing.getAll({active:!0}),this.address&&!this.isInitializing&&(((t=this===null||this===void 0?void 0:this.session)===null||t===void 0?void 0:t.topic)===e||this.pairings.length===0)&&this.onClientConnect.onClientLogout()})}handleSessionEvents({topic:e,params:t}){var i;return Wt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw new Error("WalletConnect is not initialized");let{event:n}=t;if(n?.name&&((i=this.session)===null||i===void 0?void 0:i.topic)===e){let s=n.data;this.onClientConnect.onClientEvent(s)}})}subscribeToEvents(e){return Wt(this,void 0,void 0,function*(){if(typeof e>"u")throw new Error("WalletConnect is not initialized");e.on("session_update",({topic:t,params:i})=>{let{namespaces:n}=i,s=e.session.get(t),o=Object.assign(Object.assign({},s),{namespaces:n});this.onSessionConnected({session:o})}),e.on("session_event",this.handleSessionEvents.bind(this)),e.on("session_delete",this.handleTopicUpdateEvent.bind(this)),e.on("session_expire",this.handleTopicUpdateEvent.bind(this))})}checkPersistedState(e){return Wt(this,void 0,void 0,function*(){if(typeof e>"u")throw new Error("WalletConnect is not initialized");if(this.pairings=e.pairing.getAll({active:!0}),!(typeof this.session<"u")&&e.session.length&&!this.address&&!this.isInitializing){let t=e.session.keys.length-1,i=e.session.get(e.session.keys[t]);return yield this.onSessionConnected({session:i}),i}})}addressIsValid(e){try{return!!vp.UserAddress.fromBech32(e)}catch{return!1}}getAddressFromSession(e){let t=e.namespaces[es.WALLETCONNECT_ELROND_NAMESPACE];if(t&&t.accounts){let i=t.accounts[0],[n,s,o]=i.split(":");return o}return""}};ts.WalletConnectV2Provider=ww});var V6=D((Lre,q6)=>{"use strict";l();q6.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},t=Symbol("test"),i=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[object Symbol]")return!1;var n=42;e[t]=n;for(t 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]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var o=Object.getOwnPropertyDescriptor(e,t);if(o.value!==n||o.enumerable!==!0)return!1}return!0}});var j6=D((Fre,Q6)=>{"use strict";l();var H6=typeof Symbol<"u"&&Symbol,ij=V6();Q6.exports=function(){return typeof H6!="function"||typeof Symbol!="function"||typeof H6("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:ij()}});var K6=D((qre,G6)=>{"use strict";l();var nj="Function.prototype.bind called on incompatible ",Ew=Array.prototype.slice,sj=Object.prototype.toString,oj="[object Function]";G6.exports=function(e){var t=this;if(typeof t!="function"||sj.call(t)!==oj)throw new TypeError(nj+t);for(var i=Ew.call(arguments,1),n,s=function(){if(this instanceof n){var p=t.apply(this,i.concat(Ew.call(arguments)));return Object(p)===p?p:this}else return t.apply(e,i.concat(Ew.call(arguments)))},o=Math.max(0,t.length-i.length),a=[],u=0;u{"use strict";l();var aj=K6();z6.exports=Function.prototype.bind||aj});var k6=D((jre,$6)=>{"use strict";l();var uj=Ep();$6.exports=uj.call(Function.call,Object.prototype.hasOwnProperty)});var Ip=D((Kre,X6)=>{"use strict";l();var Pe,Bu=SyntaxError,J6=Function,Du=TypeError,Aw=function(r){try{return J6('"use strict"; return ('+r+").constructor;")()}catch{}},wo=Object.getOwnPropertyDescriptor;if(wo)try{wo({},"")}catch{wo=null}var _w=function(){throw new Du},cj=wo?function(){try{return arguments.callee,_w}catch{try{return wo(arguments,"callee").get}catch{return _w}}}():_w,Tu=j6()(),rs=Object.getPrototypeOf||function(r){return r.__proto__},Nu={},lj=typeof Uint8Array>"u"?Pe:rs(Uint8Array),Ou={"%AggregateError%":typeof AggregateError>"u"?Pe:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Pe:ArrayBuffer,"%ArrayIteratorPrototype%":Tu?rs([][Symbol.iterator]()):Pe,"%AsyncFromSyncIteratorPrototype%":Pe,"%AsyncFunction%":Nu,"%AsyncGenerator%":Nu,"%AsyncGeneratorFunction%":Nu,"%AsyncIteratorPrototype%":Nu,"%Atomics%":typeof Atomics>"u"?Pe:Atomics,"%BigInt%":typeof BigInt>"u"?Pe:BigInt,"%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%":J6,"%GeneratorFunction%":Nu,"%Int8Array%":typeof Int8Array>"u"?Pe:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Pe:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Pe:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Tu?rs(rs([][Symbol.iterator]())):Pe,"%JSON%":typeof JSON=="object"?JSON:Pe,"%Map%":typeof Map>"u"?Pe:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Tu?Pe:rs(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?Pe:rs(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Pe:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Tu?rs(""[Symbol.iterator]()):Pe,"%Symbol%":Tu?Symbol:Pe,"%SyntaxError%":Bu,"%ThrowTypeError%":cj,"%TypedArray%":lj,"%TypeError%":Du,"%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},fj=function r(e){var t;if(e==="%AsyncFunction%")t=Aw("async function () {}");else if(e==="%GeneratorFunction%")t=Aw("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=Aw("async function* () {}");else if(e==="%AsyncGenerator%"){var i=r("%AsyncGeneratorFunction%");i&&(t=i.prototype)}else if(e==="%AsyncIteratorPrototype%"){var n=r("%AsyncGenerator%");n&&(t=rs(n.prototype))}return Ou[e]=t,t},W6={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},wl=Ep(),Ap=k6(),hj=wl.call(Function.call,Array.prototype.concat),dj=wl.call(Function.apply,Array.prototype.splice),Y6=wl.call(Function.call,String.prototype.replace),_p=wl.call(Function.call,String.prototype.slice),pj=wl.call(Function.call,RegExp.prototype.exec),gj=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,yj=/\\(\\)?/g,mj=function(e){var t=_p(e,0,1),i=_p(e,-1);if(t==="%"&&i!=="%")throw new Bu("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&t!=="%")throw new Bu("invalid intrinsic syntax, expected opening `%`");var n=[];return Y6(e,gj,function(s,o,a,u){n[n.length]=a?Y6(u,yj,"$1"):o||s}),n},vj=function(e,t){var i=e,n;if(Ap(W6,i)&&(n=W6[i],i="%"+n[0]+"%"),Ap(Ou,i)){var s=Ou[i];if(s===Nu&&(s=fj(i)),typeof s>"u"&&!t)throw new Du("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:n,name:i,value:s}}throw new Bu("intrinsic "+e+" does not exist!")};X6.exports=function(e,t){if(typeof e!="string"||e.length===0)throw new Du("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new Du('"allowMissing" argument must be a boolean');if(pj(/^%?[^%]*%?$/,e)===null)throw new Bu("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=mj(e),n=i.length>0?i[0]:"",s=vj("%"+n+"%",t),o=s.name,a=s.value,u=!1,h=s.alias;h&&(n=h[0],dj(i,hj([0,1],h)));for(var p=1,v=!0;p=i.length){var V=wo(a,B);v=!!V,v&&"get"in V&&!("originalValue"in V.get)?a=V.get:a=a[B]}else v=Ap(a,B),a=a[B];v&&!u&&(Ou[o]=a)}}return a}});var nD=D(($re,bp)=>{"use strict";l();var Iw=Ep(),Mu=Ip(),tD=Mu("%Function.prototype.apply%"),rD=Mu("%Function.prototype.call%"),iD=Mu("%Reflect.apply%",!0)||Iw.call(rD,tD),Z6=Mu("%Object.getOwnPropertyDescriptor%",!0),Eo=Mu("%Object.defineProperty%",!0),wj=Mu("%Math.max%");if(Eo)try{Eo({},"a",{value:1})}catch{Eo=null}bp.exports=function(e){var t=iD(Iw,rD,arguments);if(Z6&&Eo){var i=Z6(t,"length");i.configurable&&Eo(t,"length",{value:1+wj(0,e.length-(arguments.length-1))})}return t};var eD=function(){return iD(Iw,tD,arguments)};Eo?Eo(bp.exports,"apply",{value:eD}):bp.exports.apply=eD});var uD=D((Wre,aD)=>{"use strict";l();var sD=Ip(),oD=nD(),Ej=oD(sD("String.prototype.indexOf"));aD.exports=function(e,t){var i=sD(e,!!t);return typeof i=="function"&&Ej(e,".prototype.")>-1?oD(i):i}});var cD=D(()=>{l()});var xD=D((eie,SD)=>{l();var Mw=typeof Map=="function"&&Map.prototype,bw=Object.getOwnPropertyDescriptor&&Mw?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Sp=Mw&&bw&&typeof bw.get=="function"?bw.get:null,Aj=Mw&&Map.prototype.forEach,Pw=typeof Set=="function"&&Set.prototype,Cw=Object.getOwnPropertyDescriptor&&Pw?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,xp=Pw&&Cw&&typeof Cw.get=="function"?Cw.get:null,_j=Pw&&Set.prototype.forEach,Ij=typeof WeakMap=="function"&&WeakMap.prototype,Al=Ij?WeakMap.prototype.has:null,bj=typeof WeakSet=="function"&&WeakSet.prototype,_l=bj?WeakSet.prototype.has:null,Cj=typeof WeakRef=="function"&&WeakRef.prototype,lD=Cj?WeakRef.prototype.deref:null,Sj=Boolean.prototype.valueOf,xj=Object.prototype.toString,Tj=Function.prototype.toString,Nj=String.prototype.match,Lw=String.prototype.slice,ns=String.prototype.replace,Dj=String.prototype.toUpperCase,fD=String.prototype.toLowerCase,ED=RegExp.prototype.test,hD=Array.prototype.concat,Pi=Array.prototype.join,Oj=Array.prototype.slice,dD=Math.floor,Tw=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Sw=Object.getOwnPropertySymbols,Nw=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Pu=typeof Symbol=="function"&&typeof Symbol.iterator=="object",ur=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Pu?"object":"symbol")?Symbol.toStringTag:null,AD=Object.prototype.propertyIsEnumerable,pD=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function gD(r,e){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||ED.call(/e/,e))return e;var t=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var i=r<0?-dD(-r):dD(r);if(i!==r){var n=String(i),s=Lw.call(e,n.length+1);return ns.call(n,t,"$&_")+"."+ns.call(ns.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return ns.call(e,t,"$&_")}var Dw=cD(),yD=Dw.custom,mD=ID(yD)?yD:null;SD.exports=function r(e,t,i,n){var s=t||{};if(is(s,"quoteStyle")&&s.quoteStyle!=="single"&&s.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(is(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=is(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(is(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(is(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 CD(e,s);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var u=String(e);return a?gD(e,u):u}if(typeof e=="bigint"){var h=String(e)+"n";return a?gD(e,h):h}var p=typeof s.depth>"u"?5:s.depth;if(typeof i>"u"&&(i=0),i>=p&&p>0&&typeof e=="object")return Ow(e)?"[Array]":"[Object]";var v=Wj(s,i);if(typeof n>"u")n=[];else if(bD(n,e)>=0)return"[Circular]";function B(A,c,d){if(c&&(n=Oj.call(n),n.push(c)),d){var g={depth:s.depth};return is(s,"quoteStyle")&&(g.quoteStyle=s.quoteStyle),r(A,g,i+1,n)}return r(A,s,i+1,n)}if(typeof e=="function"&&!vD(e)){var R=Vj(e),x=Cp(e,B);return"[Function"+(R?": "+R:" (anonymous)")+"]"+(x.length>0?" { "+Pi.call(x,", ")+" }":"")}if(ID(e)){var V=Pu?ns.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):Nw.call(e);return typeof e=="object"&&!Pu?El(V):V}if(zj(e)){for(var H="<"+fD.call(String(e.nodeName)),K=e.attributes||[],ie=0;ie",H}if(Ow(e)){if(e.length===0)return"[]";var k=Cp(e,B);return v&&!kj(k)?"["+Bw(k,v)+"]":"[ "+Pi.call(k,", ")+" ]"}if(Pj(e)){var J=Cp(e,B);return!("cause"in Error.prototype)&&"cause"in e&&!AD.call(e,"cause")?"{ ["+String(e)+"] "+Pi.call(hD.call("[cause]: "+B(e.cause),J),", ")+" }":J.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+Pi.call(J,", ")+" }"}if(typeof e=="object"&&o){if(mD&&typeof e[mD]=="function"&&Dw)return Dw(e,{depth:p-i});if(o!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(Hj(e)){var W=[];return Aj.call(e,function(A,c){W.push(B(c,e,!0)+" => "+B(A,e))}),wD("Map",Sp.call(e),W,v)}if(Gj(e)){var G=[];return _j.call(e,function(A){G.push(B(A,e))}),wD("Set",xp.call(e),G,v)}if(Qj(e))return xw("WeakMap");if(Kj(e))return xw("WeakSet");if(jj(e))return xw("WeakRef");if(Rj(e))return El(B(Number(e)));if(Uj(e))return El(B(Tw.call(e)));if(Fj(e))return El(Sj.call(e));if(Lj(e))return El(B(String(e)));if(!Mj(e)&&!vD(e)){var P=Cp(e,B),F=pD?pD(e)===Object.prototype:e instanceof Object||e.constructor===Object,$=e instanceof Object?"":"null prototype",ce=!F&&ur&&Object(e)===e&&ur in e?Lw.call(ss(e),8,-1):$?"Object":"",Y=F||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",X=Y+(ce||$?"["+Pi.call(hD.call([],ce||[],$||[]),": ")+"] ":"");return P.length===0?X+"{}":v?X+"{"+Bw(P,v)+"}":X+"{ "+Pi.call(P,", ")+" }"}return String(e)};function _D(r,e,t){var i=(t.quoteStyle||e)==="double"?'"':"'";return i+r+i}function Bj(r){return ns.call(String(r),/"/g,""")}function Ow(r){return ss(r)==="[object Array]"&&(!ur||!(typeof r=="object"&&ur in r))}function Mj(r){return ss(r)==="[object Date]"&&(!ur||!(typeof r=="object"&&ur in r))}function vD(r){return ss(r)==="[object RegExp]"&&(!ur||!(typeof r=="object"&&ur in r))}function Pj(r){return ss(r)==="[object Error]"&&(!ur||!(typeof r=="object"&&ur in r))}function Lj(r){return ss(r)==="[object String]"&&(!ur||!(typeof r=="object"&&ur in r))}function Rj(r){return ss(r)==="[object Number]"&&(!ur||!(typeof r=="object"&&ur in r))}function Fj(r){return ss(r)==="[object Boolean]"&&(!ur||!(typeof r=="object"&&ur in r))}function ID(r){if(Pu)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!Nw)return!1;try{return Nw.call(r),!0}catch{}return!1}function Uj(r){if(!r||typeof r!="object"||!Tw)return!1;try{return Tw.call(r),!0}catch{}return!1}var qj=Object.prototype.hasOwnProperty||function(r){return r in this};function is(r,e){return qj.call(r,e)}function ss(r){return xj.call(r)}function Vj(r){if(r.name)return r.name;var e=Nj.call(Tj.call(r),/^function\s*([\w$]+)/);return e?e[1]:null}function bD(r,e){if(r.indexOf)return r.indexOf(e);for(var t=0,i=r.length;te.maxStringLength){var t=r.length-e.maxStringLength,i="... "+t+" more character"+(t>1?"s":"");return CD(Lw.call(r,0,e.maxStringLength),e)+i}var n=ns.call(ns.call(r,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,$j);return _D(n,"single",e)}function $j(r){var e=r.charCodeAt(0),t={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return t?"\\"+t:"\\x"+(e<16?"0":"")+Dj.call(e.toString(16))}function El(r){return"Object("+r+")"}function xw(r){return r+" { ? }"}function wD(r,e,t,i){var n=i?Bw(t,i):Pi.call(t,", ");return r+" ("+e+") {"+n+"}"}function kj(r){for(var e=0;e=0)return!1;return!0}function Wj(r,e){var t;if(r.indent===" ")t=" ";else if(typeof r.indent=="number"&&r.indent>0)t=Pi.call(Array(r.indent+1)," ");else return null;return{base:t,prev:Pi.call(Array(e+1),t)}}function Bw(r,e){if(r.length===0)return"";var t=` -`+e.prev+e.base;return t+Pi.call(r,","+t)+` -`+e.prev}function Cp(r,e){var t=Ow(r),i=[];if(t){i.length=r.length;for(var n=0;n{"use strict";l();var Rw=Ip(),Lu=uD(),Yj=xD(),Jj=Rw("%TypeError%"),Tp=Rw("%WeakMap%",!0),Np=Rw("%Map%",!0),Xj=Lu("WeakMap.prototype.get",!0),Zj=Lu("WeakMap.prototype.set",!0),eG=Lu("WeakMap.prototype.has",!0),tG=Lu("Map.prototype.get",!0),rG=Lu("Map.prototype.set",!0),iG=Lu("Map.prototype.has",!0),Fw=function(r,e){for(var t=r,i;(i=t.next)!==null;t=i)if(i.key===e)return t.next=i.next,i.next=r.next,r.next=i,i},nG=function(r,e){var t=Fw(r,e);return t&&t.value},sG=function(r,e,t){var i=Fw(r,e);i?i.value=t:r.next={key:e,next:r.next,value:t}},oG=function(r,e){return!!Fw(r,e)};TD.exports=function(){var e,t,i,n={assert:function(s){if(!n.has(s))throw new Jj("Side channel does not contain "+Yj(s))},get:function(s){if(Tp&&s&&(typeof s=="object"||typeof s=="function")){if(e)return Xj(e,s)}else if(Np){if(t)return tG(t,s)}else if(i)return nG(i,s)},has:function(s){if(Tp&&s&&(typeof s=="object"||typeof s=="function")){if(e)return eG(e,s)}else if(Np){if(t)return iG(t,s)}else if(i)return oG(i,s);return!1},set:function(s,o){Tp&&s&&(typeof s=="object"||typeof s=="function")?(e||(e=new Tp),Zj(e,s,o)):Np?(t||(t=new Np),rG(t,s,o)):(i||(i={key:{},next:null}),sG(i,s,o))}};return n}});var Dp=D((nie,DD)=>{"use strict";l();var aG=String.prototype.replace,uG=/%20/g,Uw={RFC1738:"RFC1738",RFC3986:"RFC3986"};DD.exports={default:Uw.RFC3986,formatters:{RFC1738:function(r){return aG.call(r,uG,"+")},RFC3986:function(r){return String(r)}},RFC1738:Uw.RFC1738,RFC3986:Uw.RFC3986}});var Vw=D((oie,BD)=>{"use strict";l();var cG=Dp(),qw=Object.prototype.hasOwnProperty,Ao=Array.isArray,Li=function(){for(var r=[],e=0;e<256;++e)r.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return r}(),lG=function(e){for(;e.length>1;){var t=e.pop(),i=t.obj[t.prop];if(Ao(i)){for(var n=[],s=0;s=48&&h<=57||h>=65&&h<=90||h>=97&&h<=122||s===cG.RFC1738&&(h===40||h===41)){a+=o.charAt(u);continue}if(h<128){a=a+Li[h];continue}if(h<2048){a=a+(Li[192|h>>6]+Li[128|h&63]);continue}if(h<55296||h>=57344){a=a+(Li[224|h>>12]+Li[128|h>>6&63]+Li[128|h&63]);continue}u+=1,h=65536+((h&1023)<<10|o.charCodeAt(u)&1023),a+=Li[240|h>>18]+Li[128|h>>12&63]+Li[128|h>>6&63]+Li[128|h&63]}return a},gG=function(e){for(var t=[{obj:{o:e},prop:"o"}],i=[],n=0;n{"use strict";l();var LD=ND(),Hw=Vw(),Il=Dp(),EG=Object.prototype.hasOwnProperty,MD={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},_o=Array.isArray,AG=Array.prototype.push,RD=function(r,e){AG.apply(r,_o(e)?e:[e])},_G=Date.prototype.toISOString,PD=Il.default,cr={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:Hw.encode,encodeValuesOnly:!1,format:PD,formatter:Il.formatters[PD],indices:!1,serializeDate:function(e){return _G.call(e)},skipNulls:!1,strictNullHandling:!1},IG=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},bG=function r(e,t,i,n,s,o,a,u,h,p,v,B,R,x,V){var H=e;if(V.has(e))throw new RangeError("Cyclic object value");if(typeof a=="function"?H=a(t,H):H instanceof Date?H=p(H):i==="comma"&&_o(H)&&(H=Hw.maybeMap(H,function(ce){return ce instanceof Date?p(ce):ce})),H===null){if(n)return o&&!R?o(t,cr.encoder,x,"key",v):t;H=""}if(IG(H)||Hw.isBuffer(H)){if(o){var K=R?t:o(t,cr.encoder,x,"key",v);return[B(K)+"="+B(o(H,cr.encoder,x,"value",v))]}return[B(t)+"="+B(String(H))]}var ie=[];if(typeof H>"u")return ie;var k;if(i==="comma"&&_o(H))k=[{value:H.length>0?H.join(",")||null:void 0}];else if(_o(a))k=a;else{var J=Object.keys(H);k=u?J.sort(u):J}for(var W=0;W"u"?cr.allowDots:!!e.allowDots,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:cr.charsetSentinel,delimiter:typeof e.delimiter>"u"?cr.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:cr.encode,encoder:typeof e.encoder=="function"?e.encoder:cr.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:cr.encodeValuesOnly,filter:s,format:i,formatter:n,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:cr.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:cr.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:cr.strictNullHandling}};FD.exports=function(r,e){var t=r,i=CG(e),n,s;typeof i.filter=="function"?(s=i.filter,t=s("",t)):_o(i.filter)&&(s=i.filter,n=s);var o=[];if(typeof t!="object"||t===null)return"";var a;e&&e.arrayFormat in MD?a=e.arrayFormat:e&&"indices"in e?a=e.indices?"indices":"repeat":a="indices";var u=MD[a];n||(n=Object.keys(t)),i.sort&&n.sort(i.sort);for(var h=LD(),p=0;p0?R+B:""}});var HD=D((lie,VD)=>{"use strict";l();var Ru=Vw(),Qw=Object.prototype.hasOwnProperty,SG=Array.isArray,Yt={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:Ru.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},xG=function(r){return r.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},qD=function(r,e){return r&&typeof r=="string"&&e.comma&&r.indexOf(",")>-1?r.split(","):r},TG="utf8=%26%2310003%3B",NG="utf8=%E2%9C%93",DG=function(e,t){var i={},n=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,s=t.parameterLimit===1/0?void 0:t.parameterLimit,o=n.split(t.delimiter,s),a=-1,u,h=t.charset;if(t.charsetSentinel)for(u=0;u-1&&(x=SG(x)?[x]:x),Qw.call(i,R)?i[R]=Ru.combine(i[R],x):i[R]=x}return i},OG=function(r,e,t,i){for(var n=i?e:qD(e,t),s=r.length-1;s>=0;--s){var o,a=r[s];if(a==="[]"&&t.parseArrays)o=[].concat(n);else{o=t.plainObjects?Object.create(null):{};var u=a.charAt(0)==="["&&a.charAt(a.length-1)==="]"?a.slice(1,-1):a,h=parseInt(u,10);!t.parseArrays&&u===""?o={0:n}:!isNaN(h)&&a!==u&&String(h)===u&&h>=0&&t.parseArrays&&h<=t.arrayLimit?(o=[],o[h]=n):o[u]=n}n=o}return n},BG=function(e,t,i,n){if(!!e){var s=i.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,o=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,u=i.depth>0&&o.exec(s),h=u?s.slice(0,u.index):s,p=[];if(h){if(!i.plainObjects&&Qw.call(Object.prototype,h)&&!i.allowPrototypes)return;p.push(h)}for(var v=0;i.depth>0&&(u=a.exec(s))!==null&&v"u"?Yt.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?Yt.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:Yt.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:Yt.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:Yt.arrayLimit,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Yt.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:Yt.comma,decoder:typeof e.decoder=="function"?e.decoder:Yt.decoder,delimiter:typeof e.delimiter=="string"||Ru.isRegExp(e.delimiter)?e.delimiter:Yt.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:Yt.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:Yt.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:Yt.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:Yt.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Yt.strictNullHandling}};VD.exports=function(r,e){var t=MG(e);if(r===""||r===null||typeof r>"u")return t.plainObjects?Object.create(null):{};for(var i=typeof r=="string"?DG(r,t):r,n=t.plainObjects?Object.create(null):{},s=Object.keys(i),o=0;o{"use strict";l();var PG=UD(),LG=HD(),RG=Dp();QD.exports={formats:RG,parse:LG,stringify:PG}});var jw=D(Pt=>{"use strict";l();Object.defineProperty(Pt,"__esModule",{value:!0});Pt.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED=Pt.WALLET_PROVIDER_CALLBACK_PARAM=Pt.WALLET_PROVIDER_SIGN_TRANSACTION_URL=Pt.WALLET_PROVIDER_SEND_TRANSACTION_URL=Pt.WALLET_PROVIDER_DISCONNECT_URL=Pt.WALLET_PROVIDER_CONNECT_URL=Pt.WALLET_PROVIDER_TESTNET=Pt.WALLET_PROVIDER_DEVNET=Pt.WALLET_PROVIDER_MAINNET=void 0;Pt.WALLET_PROVIDER_MAINNET="https://wallet.elrond.com/dapp/init";Pt.WALLET_PROVIDER_DEVNET="https://devnet-wallet.elrond.com/dapp/init";Pt.WALLET_PROVIDER_TESTNET="https://testnet-wallet.elrond.com/dapp/init";Pt.WALLET_PROVIDER_CONNECT_URL="hook/login";Pt.WALLET_PROVIDER_DISCONNECT_URL="hook/logout";Pt.WALLET_PROVIDER_SEND_TRANSACTION_URL="hook/transaction";Pt.WALLET_PROVIDER_SIGN_TRANSACTION_URL="hook/sign";Pt.WALLET_PROVIDER_CALLBACK_PARAM="walletProviderStatus";Pt.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED="transactionsSigned"});var GD=D(Fu=>{"use strict";l();Object.defineProperty(Fu,"__esModule",{value:!0});Fu.ErrInvalidTxSignReturnValue=Fu.Err=void 0;var Op=class extends Error{constructor(e,t){super(e),this.inner=void 0,this.inner=t}};Fu.Err=Op;var Gw=class extends Op{constructor(){super("Invalid response in transaction sign return url")}};Fu.ErrInvalidTxSignReturnValue=Gw});var KD=D(Bp=>{"use strict";l();Object.defineProperty(Bp,"__esModule",{value:!0});Bp.PlainSignedTransaction=void 0;var Kw=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)}};Bp.PlainSignedTransaction=Kw});var bl=D(os=>{"use strict";l();var Uu=os&&os.__awaiter||function(r,e,t,i){function n(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(p){try{h(i.next(p))}catch(v){o(v)}}function u(p){try{h(i.throw(p))}catch(v){o(v)}}function h(p){p.done?s(p.value):n(p.value).then(a,u)}h((i=i.apply(r,e||[])).next())})},FG=os&&os.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(os,"__esModule",{value:!0});os.WalletProvider=void 0;var zD=FG(jD()),qu=jw(),$D=GD(),UG=KD(),Vu=class{constructor(e){this.walletUrl=e}login(e){return Uu(this,void 0,void 0,function*(){let t=this.buildWalletUrl({endpoint:qu.WALLET_PROVIDER_CONNECT_URL,callbackUrl:e?.callbackUrl,params:{token:e?.token}});return yield this.redirect(t,e?.redirectDelayMilliseconds),t})}redirect(e,t){return Uu(this,void 0,void 0,function*(){t?yield this.redirectLater(e,t):this.redirectImmediately(e)})}redirectImmediately(e){window.location.href=e}redirectLater(e,t){return Uu(this,void 0,void 0,function*(){yield new Promise(i=>{setTimeout(()=>{window.location.href=e,i(!0)},t)})})}logout(e){return Uu(this,void 0,void 0,function*(){let t=this.buildWalletUrl({endpoint:qu.WALLET_PROVIDER_DISCONNECT_URL,callbackUrl:e?.callbackUrl});return yield this.redirect(t,e?.redirectDelayMilliseconds),!0})}signTransactions(e,t){return Uu(this,void 0,void 0,function*(){let i={};e.map(s=>{let o=Vu.prepareWalletTransaction(s);for(let a in o)o.hasOwnProperty(a)&&!i.hasOwnProperty(a)&&(i[a]=[]),i[a].push(o[a])});let n=this.buildWalletUrl({endpoint:qu.WALLET_PROVIDER_SIGN_TRANSACTION_URL,callbackUrl:t?.callbackUrl,params:i});window.location.href=n})}signTransaction(e,t){return Uu(this,void 0,void 0,function*(){yield this.signTransactions([e],t)})}getTransactionsFromWalletUrl(){let e=zD.default.parse(window.location.search.slice(1));return Vu.isTxSignReturnSuccess(e)?this.getTxSignReturnValue(e):[]}static isTxSignReturnSuccess(e){return e.hasOwnProperty(qu.WALLET_PROVIDER_CALLBACK_PARAM)&&e[qu.WALLET_PROVIDER_CALLBACK_PARAM]===qu.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED}getTxSignReturnValue(e){let t=["nonce","value","receiver","sender","gasPrice","gasLimit","data","chainID","version","signature"];for(let s of t)if(!e[s]||!Array.isArray(e[s]))throw new $D.ErrInvalidTxSignReturnValue;let i=e.nonce.length;for(let s of t)if(e[s].length!==i)throw new $D.ErrInvalidTxSignReturnValue;let n=[];for(let s=0;s{l()});var eO=D((ZD,zw)=>{l();(function(r,e){"use strict";function t(A,c){if(!A)throw new Error(c||"Assertion failed")}function i(A,c){A.super_=c;var d=function(){};d.prototype=c.prototype,A.prototype=new d,A.prototype.constructor=A}function n(A,c,d){if(n.isBN(A))return A;this.negative=0,this.words=null,this.length=0,this.red=null,A!==null&&((c==="le"||c==="be")&&(d=c,c=10),this._init(A||0,c||10,d||"be"))}typeof r=="object"?r.exports=n:e.BN=n,n.BN=n,n.wordSize=26;var s;try{typeof window<"u"&&typeof window.Buffer<"u"?s=window.Buffer:s=XD().Buffer}catch{}n.isBN=function(c){return c instanceof n?!0:c!==null&&typeof c=="object"&&c.constructor.wordSize===n.wordSize&&Array.isArray(c.words)},n.max=function(c,d){return c.cmp(d)>0?c:d},n.min=function(c,d){return c.cmp(d)<0?c:d},n.prototype._init=function(c,d,g){if(typeof c=="number")return this._initNumber(c,d,g);if(typeof c=="object")return this._initArray(c,d,g);d==="hex"&&(d=16),t(d===(d|0)&&d>=2&&d<=36),c=c.toString().replace(/\s+/g,"");var m=0;c[0]==="-"&&(m++,this.negative=1),m=0;m-=3)S=c[m]|c[m-1]<<8|c[m-2]<<16,this.words[w]|=S<>>26-N&67108863,N+=24,N>=26&&(N-=26,w++);else if(g==="le")for(m=0,w=0;m>>26-N&67108863,N+=24,N>=26&&(N-=26,w++);return this._strip()};function o(A,c){var d=A.charCodeAt(c);if(d>=48&&d<=57)return d-48;if(d>=65&&d<=70)return d-55;if(d>=97&&d<=102)return d-87;t(!1,"Invalid character in "+A)}function a(A,c,d){var g=o(A,d);return d-1>=c&&(g|=o(A,d-1)<<4),g}n.prototype._parseHex=function(c,d,g){this.length=Math.ceil((c.length-d)/6),this.words=new Array(this.length);for(var m=0;m=d;m-=2)N=a(c,d,m)<=18?(w-=18,S+=1,this.words[S]|=N>>>26):w+=8;else{var _=c.length-d;for(m=_%2===0?d+1:d;m=18?(w-=18,S+=1,this.words[S]|=N>>>26):w+=8}this._strip()};function u(A,c,d,g){for(var m=0,w=0,S=Math.min(A.length,d),N=c;N=49?w=_-49+10:_>=17?w=_-17+10:w=_,t(_>=0&&w1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},n.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{n.prototype[Symbol.for("nodejs.util.inspect.custom")]=p}catch{n.prototype.inspect=p}else n.prototype.inspect=p;function p(){return(this.red?""}var v=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],B=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],R=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];n.prototype.toString=function(c,d){c=c||10,d=d|0||1;var g;if(c===16||c==="hex"){g="";for(var m=0,w=0,S=0;S>>24-m&16777215,m+=2,m>=26&&(m-=26,S--),w!==0||S!==this.length-1?g=v[6-_.length]+_+g:g=_+g}for(w!==0&&(g=w.toString(16)+g);g.length%d!==0;)g="0"+g;return this.negative!==0&&(g="-"+g),g}if(c===(c|0)&&c>=2&&c<=36){var f=B[c],C=R[c];g="";var Z=this.clone();for(Z.negative=0;!Z.isZero();){var te=Z.modrn(C).toString(c);Z=Z.idivn(C),Z.isZero()?g=te+g:g=v[f-te.length]+te+g}for(this.isZero()&&(g="0"+g);g.length%d!==0;)g="0"+g;return this.negative!==0&&(g="-"+g),g}t(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var c=this.words[0];return this.length===2?c+=this.words[1]*67108864:this.length===3&&this.words[2]===1?c+=4503599627370496+this.words[1]*67108864:this.length>2&&t(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-c:c},n.prototype.toJSON=function(){return this.toString(16,2)},s&&(n.prototype.toBuffer=function(c,d){return this.toArrayLike(s,c,d)}),n.prototype.toArray=function(c,d){return this.toArrayLike(Array,c,d)};var x=function(c,d){return c.allocUnsafe?c.allocUnsafe(d):new c(d)};n.prototype.toArrayLike=function(c,d,g){this._strip();var m=this.byteLength(),w=g||Math.max(1,m);t(m<=w,"byte array longer than desired length"),t(w>0,"Requested array length <= 0");var S=x(c,w),N=d==="le"?"LE":"BE";return this["_toArrayLike"+N](S,m),S},n.prototype._toArrayLikeLE=function(c,d){for(var g=0,m=0,w=0,S=0;w>8&255),g>16&255),S===6?(g>24&255),m=0,S=0):(m=N>>>24,S+=2)}if(g=0&&(c[g--]=N>>8&255),g>=0&&(c[g--]=N>>16&255),S===6?(g>=0&&(c[g--]=N>>24&255),m=0,S=0):(m=N>>>24,S+=2)}if(g>=0)for(c[g--]=m;g>=0;)c[g--]=0},Math.clz32?n.prototype._countBits=function(c){return 32-Math.clz32(c)}:n.prototype._countBits=function(c){var d=c,g=0;return d>=4096&&(g+=13,d>>>=13),d>=64&&(g+=7,d>>>=7),d>=8&&(g+=4,d>>>=4),d>=2&&(g+=2,d>>>=2),g+d},n.prototype._zeroBits=function(c){if(c===0)return 26;var d=c,g=0;return(d&8191)===0&&(g+=13,d>>>=13),(d&127)===0&&(g+=7,d>>>=7),(d&15)===0&&(g+=4,d>>>=4),(d&3)===0&&(g+=2,d>>>=2),(d&1)===0&&g++,g},n.prototype.bitLength=function(){var c=this.words[this.length-1],d=this._countBits(c);return(this.length-1)*26+d};function V(A){for(var c=new Array(A.bitLength()),d=0;d>>m&1}return c}n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var c=0,d=0;dc.length?this.clone().ior(c):c.clone().ior(this)},n.prototype.uor=function(c){return this.length>c.length?this.clone().iuor(c):c.clone().iuor(this)},n.prototype.iuand=function(c){var d;this.length>c.length?d=c:d=this;for(var g=0;gc.length?this.clone().iand(c):c.clone().iand(this)},n.prototype.uand=function(c){return this.length>c.length?this.clone().iuand(c):c.clone().iuand(this)},n.prototype.iuxor=function(c){var d,g;this.length>c.length?(d=this,g=c):(d=c,g=this);for(var m=0;mc.length?this.clone().ixor(c):c.clone().ixor(this)},n.prototype.uxor=function(c){return this.length>c.length?this.clone().iuxor(c):c.clone().iuxor(this)},n.prototype.inotn=function(c){t(typeof c=="number"&&c>=0);var d=Math.ceil(c/26)|0,g=c%26;this._expand(d),g>0&&d--;for(var m=0;m0&&(this.words[m]=~this.words[m]&67108863>>26-g),this._strip()},n.prototype.notn=function(c){return this.clone().inotn(c)},n.prototype.setn=function(c,d){t(typeof c=="number"&&c>=0);var g=c/26|0,m=c%26;return this._expand(g+1),d?this.words[g]=this.words[g]|1<c.length?(g=this,m=c):(g=c,m=this);for(var w=0,S=0;S>>26;for(;w!==0&&S>>26;if(this.length=g.length,w!==0)this.words[this.length]=w,this.length++;else if(g!==this)for(;Sc.length?this.clone().iadd(c):c.clone().iadd(this)},n.prototype.isub=function(c){if(c.negative!==0){c.negative=0;var d=this.iadd(c);return c.negative=1,d._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(c),this.negative=1,this._normSign();var g=this.cmp(c);if(g===0)return this.negative=0,this.length=1,this.words[0]=0,this;var m,w;g>0?(m=this,w=c):(m=c,w=this);for(var S=0,N=0;N>26,this.words[N]=d&67108863;for(;S!==0&&N>26,this.words[N]=d&67108863;if(S===0&&N>>26,Z=_&67108863,te=Math.min(f,c.length-1),ee=Math.max(0,f-A.length+1);ee<=te;ee++){var ae=f-ee|0;m=A.words[ae]|0,w=c.words[ee]|0,S=m*w+Z,C+=S/67108864|0,Z=S&67108863}d.words[f]=Z|0,_=C|0}return _!==0?d.words[f]=_|0:d.length--,d._strip()}var K=function(c,d,g){var m=c.words,w=d.words,S=g.words,N=0,_,f,C,Z=m[0]|0,te=Z&8191,ee=Z>>>13,ae=m[1]|0,E=ae&8191,b=ae>>>13,T=m[2]|0,L=T&8191,O=T>>>13,U=m[3]|0,q=U&8191,M=U>>>13,j=m[4]|0,z=j&8191,Q=j>>>13,ue=m[5]|0,he=ue&8191,de=ue>>>13,Be=m[6]|0,Ie=Be&8191,Se=Be>>>13,Oe=m[7]|0,Ae=Oe&8191,De=Oe>>>13,ps=m[8]|0,Je=ps&8191,Xe=ps>>>13,_r=m[9]|0,Ge=_r&8191,Le=_r>>>13,qt=w[0]|0,be=qt&8191,lt=qt>>>13,IE=w[1]|0,ft=IE&8191,ht=IE>>>13,bE=w[2]|0,dt=bE&8191,pt=bE>>>13,CE=w[3]|0,gt=CE&8191,yt=CE>>>13,SE=w[4]|0,mt=SE&8191,vt=SE>>>13,xE=w[5]|0,wt=xE&8191,Et=xE>>>13,TE=w[6]|0,At=TE&8191,_t=TE>>>13,NE=w[7]|0,It=NE&8191,bt=NE>>>13,DE=w[8]|0,Ct=DE&8191,St=DE>>>13,OE=w[9]|0,xt=OE&8191,Tt=OE>>>13;g.negative=c.negative^d.negative,g.length=19,_=Math.imul(te,be),f=Math.imul(te,lt),f=f+Math.imul(ee,be)|0,C=Math.imul(ee,lt);var n0=(N+_|0)+((f&8191)<<13)|0;N=(C+(f>>>13)|0)+(n0>>>26)|0,n0&=67108863,_=Math.imul(E,be),f=Math.imul(E,lt),f=f+Math.imul(b,be)|0,C=Math.imul(b,lt),_=_+Math.imul(te,ft)|0,f=f+Math.imul(te,ht)|0,f=f+Math.imul(ee,ft)|0,C=C+Math.imul(ee,ht)|0;var s0=(N+_|0)+((f&8191)<<13)|0;N=(C+(f>>>13)|0)+(s0>>>26)|0,s0&=67108863,_=Math.imul(L,be),f=Math.imul(L,lt),f=f+Math.imul(O,be)|0,C=Math.imul(O,lt),_=_+Math.imul(E,ft)|0,f=f+Math.imul(E,ht)|0,f=f+Math.imul(b,ft)|0,C=C+Math.imul(b,ht)|0,_=_+Math.imul(te,dt)|0,f=f+Math.imul(te,pt)|0,f=f+Math.imul(ee,dt)|0,C=C+Math.imul(ee,pt)|0;var o0=(N+_|0)+((f&8191)<<13)|0;N=(C+(f>>>13)|0)+(o0>>>26)|0,o0&=67108863,_=Math.imul(q,be),f=Math.imul(q,lt),f=f+Math.imul(M,be)|0,C=Math.imul(M,lt),_=_+Math.imul(L,ft)|0,f=f+Math.imul(L,ht)|0,f=f+Math.imul(O,ft)|0,C=C+Math.imul(O,ht)|0,_=_+Math.imul(E,dt)|0,f=f+Math.imul(E,pt)|0,f=f+Math.imul(b,dt)|0,C=C+Math.imul(b,pt)|0,_=_+Math.imul(te,gt)|0,f=f+Math.imul(te,yt)|0,f=f+Math.imul(ee,gt)|0,C=C+Math.imul(ee,yt)|0;var a0=(N+_|0)+((f&8191)<<13)|0;N=(C+(f>>>13)|0)+(a0>>>26)|0,a0&=67108863,_=Math.imul(z,be),f=Math.imul(z,lt),f=f+Math.imul(Q,be)|0,C=Math.imul(Q,lt),_=_+Math.imul(q,ft)|0,f=f+Math.imul(q,ht)|0,f=f+Math.imul(M,ft)|0,C=C+Math.imul(M,ht)|0,_=_+Math.imul(L,dt)|0,f=f+Math.imul(L,pt)|0,f=f+Math.imul(O,dt)|0,C=C+Math.imul(O,pt)|0,_=_+Math.imul(E,gt)|0,f=f+Math.imul(E,yt)|0,f=f+Math.imul(b,gt)|0,C=C+Math.imul(b,yt)|0,_=_+Math.imul(te,mt)|0,f=f+Math.imul(te,vt)|0,f=f+Math.imul(ee,mt)|0,C=C+Math.imul(ee,vt)|0;var u0=(N+_|0)+((f&8191)<<13)|0;N=(C+(f>>>13)|0)+(u0>>>26)|0,u0&=67108863,_=Math.imul(he,be),f=Math.imul(he,lt),f=f+Math.imul(de,be)|0,C=Math.imul(de,lt),_=_+Math.imul(z,ft)|0,f=f+Math.imul(z,ht)|0,f=f+Math.imul(Q,ft)|0,C=C+Math.imul(Q,ht)|0,_=_+Math.imul(q,dt)|0,f=f+Math.imul(q,pt)|0,f=f+Math.imul(M,dt)|0,C=C+Math.imul(M,pt)|0,_=_+Math.imul(L,gt)|0,f=f+Math.imul(L,yt)|0,f=f+Math.imul(O,gt)|0,C=C+Math.imul(O,yt)|0,_=_+Math.imul(E,mt)|0,f=f+Math.imul(E,vt)|0,f=f+Math.imul(b,mt)|0,C=C+Math.imul(b,vt)|0,_=_+Math.imul(te,wt)|0,f=f+Math.imul(te,Et)|0,f=f+Math.imul(ee,wt)|0,C=C+Math.imul(ee,Et)|0;var c0=(N+_|0)+((f&8191)<<13)|0;N=(C+(f>>>13)|0)+(c0>>>26)|0,c0&=67108863,_=Math.imul(Ie,be),f=Math.imul(Ie,lt),f=f+Math.imul(Se,be)|0,C=Math.imul(Se,lt),_=_+Math.imul(he,ft)|0,f=f+Math.imul(he,ht)|0,f=f+Math.imul(de,ft)|0,C=C+Math.imul(de,ht)|0,_=_+Math.imul(z,dt)|0,f=f+Math.imul(z,pt)|0,f=f+Math.imul(Q,dt)|0,C=C+Math.imul(Q,pt)|0,_=_+Math.imul(q,gt)|0,f=f+Math.imul(q,yt)|0,f=f+Math.imul(M,gt)|0,C=C+Math.imul(M,yt)|0,_=_+Math.imul(L,mt)|0,f=f+Math.imul(L,vt)|0,f=f+Math.imul(O,mt)|0,C=C+Math.imul(O,vt)|0,_=_+Math.imul(E,wt)|0,f=f+Math.imul(E,Et)|0,f=f+Math.imul(b,wt)|0,C=C+Math.imul(b,Et)|0,_=_+Math.imul(te,At)|0,f=f+Math.imul(te,_t)|0,f=f+Math.imul(ee,At)|0,C=C+Math.imul(ee,_t)|0;var l0=(N+_|0)+((f&8191)<<13)|0;N=(C+(f>>>13)|0)+(l0>>>26)|0,l0&=67108863,_=Math.imul(Ae,be),f=Math.imul(Ae,lt),f=f+Math.imul(De,be)|0,C=Math.imul(De,lt),_=_+Math.imul(Ie,ft)|0,f=f+Math.imul(Ie,ht)|0,f=f+Math.imul(Se,ft)|0,C=C+Math.imul(Se,ht)|0,_=_+Math.imul(he,dt)|0,f=f+Math.imul(he,pt)|0,f=f+Math.imul(de,dt)|0,C=C+Math.imul(de,pt)|0,_=_+Math.imul(z,gt)|0,f=f+Math.imul(z,yt)|0,f=f+Math.imul(Q,gt)|0,C=C+Math.imul(Q,yt)|0,_=_+Math.imul(q,mt)|0,f=f+Math.imul(q,vt)|0,f=f+Math.imul(M,mt)|0,C=C+Math.imul(M,vt)|0,_=_+Math.imul(L,wt)|0,f=f+Math.imul(L,Et)|0,f=f+Math.imul(O,wt)|0,C=C+Math.imul(O,Et)|0,_=_+Math.imul(E,At)|0,f=f+Math.imul(E,_t)|0,f=f+Math.imul(b,At)|0,C=C+Math.imul(b,_t)|0,_=_+Math.imul(te,It)|0,f=f+Math.imul(te,bt)|0,f=f+Math.imul(ee,It)|0,C=C+Math.imul(ee,bt)|0;var f0=(N+_|0)+((f&8191)<<13)|0;N=(C+(f>>>13)|0)+(f0>>>26)|0,f0&=67108863,_=Math.imul(Je,be),f=Math.imul(Je,lt),f=f+Math.imul(Xe,be)|0,C=Math.imul(Xe,lt),_=_+Math.imul(Ae,ft)|0,f=f+Math.imul(Ae,ht)|0,f=f+Math.imul(De,ft)|0,C=C+Math.imul(De,ht)|0,_=_+Math.imul(Ie,dt)|0,f=f+Math.imul(Ie,pt)|0,f=f+Math.imul(Se,dt)|0,C=C+Math.imul(Se,pt)|0,_=_+Math.imul(he,gt)|0,f=f+Math.imul(he,yt)|0,f=f+Math.imul(de,gt)|0,C=C+Math.imul(de,yt)|0,_=_+Math.imul(z,mt)|0,f=f+Math.imul(z,vt)|0,f=f+Math.imul(Q,mt)|0,C=C+Math.imul(Q,vt)|0,_=_+Math.imul(q,wt)|0,f=f+Math.imul(q,Et)|0,f=f+Math.imul(M,wt)|0,C=C+Math.imul(M,Et)|0,_=_+Math.imul(L,At)|0,f=f+Math.imul(L,_t)|0,f=f+Math.imul(O,At)|0,C=C+Math.imul(O,_t)|0,_=_+Math.imul(E,It)|0,f=f+Math.imul(E,bt)|0,f=f+Math.imul(b,It)|0,C=C+Math.imul(b,bt)|0,_=_+Math.imul(te,Ct)|0,f=f+Math.imul(te,St)|0,f=f+Math.imul(ee,Ct)|0,C=C+Math.imul(ee,St)|0;var h0=(N+_|0)+((f&8191)<<13)|0;N=(C+(f>>>13)|0)+(h0>>>26)|0,h0&=67108863,_=Math.imul(Ge,be),f=Math.imul(Ge,lt),f=f+Math.imul(Le,be)|0,C=Math.imul(Le,lt),_=_+Math.imul(Je,ft)|0,f=f+Math.imul(Je,ht)|0,f=f+Math.imul(Xe,ft)|0,C=C+Math.imul(Xe,ht)|0,_=_+Math.imul(Ae,dt)|0,f=f+Math.imul(Ae,pt)|0,f=f+Math.imul(De,dt)|0,C=C+Math.imul(De,pt)|0,_=_+Math.imul(Ie,gt)|0,f=f+Math.imul(Ie,yt)|0,f=f+Math.imul(Se,gt)|0,C=C+Math.imul(Se,yt)|0,_=_+Math.imul(he,mt)|0,f=f+Math.imul(he,vt)|0,f=f+Math.imul(de,mt)|0,C=C+Math.imul(de,vt)|0,_=_+Math.imul(z,wt)|0,f=f+Math.imul(z,Et)|0,f=f+Math.imul(Q,wt)|0,C=C+Math.imul(Q,Et)|0,_=_+Math.imul(q,At)|0,f=f+Math.imul(q,_t)|0,f=f+Math.imul(M,At)|0,C=C+Math.imul(M,_t)|0,_=_+Math.imul(L,It)|0,f=f+Math.imul(L,bt)|0,f=f+Math.imul(O,It)|0,C=C+Math.imul(O,bt)|0,_=_+Math.imul(E,Ct)|0,f=f+Math.imul(E,St)|0,f=f+Math.imul(b,Ct)|0,C=C+Math.imul(b,St)|0,_=_+Math.imul(te,xt)|0,f=f+Math.imul(te,Tt)|0,f=f+Math.imul(ee,xt)|0,C=C+Math.imul(ee,Tt)|0;var d0=(N+_|0)+((f&8191)<<13)|0;N=(C+(f>>>13)|0)+(d0>>>26)|0,d0&=67108863,_=Math.imul(Ge,ft),f=Math.imul(Ge,ht),f=f+Math.imul(Le,ft)|0,C=Math.imul(Le,ht),_=_+Math.imul(Je,dt)|0,f=f+Math.imul(Je,pt)|0,f=f+Math.imul(Xe,dt)|0,C=C+Math.imul(Xe,pt)|0,_=_+Math.imul(Ae,gt)|0,f=f+Math.imul(Ae,yt)|0,f=f+Math.imul(De,gt)|0,C=C+Math.imul(De,yt)|0,_=_+Math.imul(Ie,mt)|0,f=f+Math.imul(Ie,vt)|0,f=f+Math.imul(Se,mt)|0,C=C+Math.imul(Se,vt)|0,_=_+Math.imul(he,wt)|0,f=f+Math.imul(he,Et)|0,f=f+Math.imul(de,wt)|0,C=C+Math.imul(de,Et)|0,_=_+Math.imul(z,At)|0,f=f+Math.imul(z,_t)|0,f=f+Math.imul(Q,At)|0,C=C+Math.imul(Q,_t)|0,_=_+Math.imul(q,It)|0,f=f+Math.imul(q,bt)|0,f=f+Math.imul(M,It)|0,C=C+Math.imul(M,bt)|0,_=_+Math.imul(L,Ct)|0,f=f+Math.imul(L,St)|0,f=f+Math.imul(O,Ct)|0,C=C+Math.imul(O,St)|0,_=_+Math.imul(E,xt)|0,f=f+Math.imul(E,Tt)|0,f=f+Math.imul(b,xt)|0,C=C+Math.imul(b,Tt)|0;var p0=(N+_|0)+((f&8191)<<13)|0;N=(C+(f>>>13)|0)+(p0>>>26)|0,p0&=67108863,_=Math.imul(Ge,dt),f=Math.imul(Ge,pt),f=f+Math.imul(Le,dt)|0,C=Math.imul(Le,pt),_=_+Math.imul(Je,gt)|0,f=f+Math.imul(Je,yt)|0,f=f+Math.imul(Xe,gt)|0,C=C+Math.imul(Xe,yt)|0,_=_+Math.imul(Ae,mt)|0,f=f+Math.imul(Ae,vt)|0,f=f+Math.imul(De,mt)|0,C=C+Math.imul(De,vt)|0,_=_+Math.imul(Ie,wt)|0,f=f+Math.imul(Ie,Et)|0,f=f+Math.imul(Se,wt)|0,C=C+Math.imul(Se,Et)|0,_=_+Math.imul(he,At)|0,f=f+Math.imul(he,_t)|0,f=f+Math.imul(de,At)|0,C=C+Math.imul(de,_t)|0,_=_+Math.imul(z,It)|0,f=f+Math.imul(z,bt)|0,f=f+Math.imul(Q,It)|0,C=C+Math.imul(Q,bt)|0,_=_+Math.imul(q,Ct)|0,f=f+Math.imul(q,St)|0,f=f+Math.imul(M,Ct)|0,C=C+Math.imul(M,St)|0,_=_+Math.imul(L,xt)|0,f=f+Math.imul(L,Tt)|0,f=f+Math.imul(O,xt)|0,C=C+Math.imul(O,Tt)|0;var g0=(N+_|0)+((f&8191)<<13)|0;N=(C+(f>>>13)|0)+(g0>>>26)|0,g0&=67108863,_=Math.imul(Ge,gt),f=Math.imul(Ge,yt),f=f+Math.imul(Le,gt)|0,C=Math.imul(Le,yt),_=_+Math.imul(Je,mt)|0,f=f+Math.imul(Je,vt)|0,f=f+Math.imul(Xe,mt)|0,C=C+Math.imul(Xe,vt)|0,_=_+Math.imul(Ae,wt)|0,f=f+Math.imul(Ae,Et)|0,f=f+Math.imul(De,wt)|0,C=C+Math.imul(De,Et)|0,_=_+Math.imul(Ie,At)|0,f=f+Math.imul(Ie,_t)|0,f=f+Math.imul(Se,At)|0,C=C+Math.imul(Se,_t)|0,_=_+Math.imul(he,It)|0,f=f+Math.imul(he,bt)|0,f=f+Math.imul(de,It)|0,C=C+Math.imul(de,bt)|0,_=_+Math.imul(z,Ct)|0,f=f+Math.imul(z,St)|0,f=f+Math.imul(Q,Ct)|0,C=C+Math.imul(Q,St)|0,_=_+Math.imul(q,xt)|0,f=f+Math.imul(q,Tt)|0,f=f+Math.imul(M,xt)|0,C=C+Math.imul(M,Tt)|0;var y0=(N+_|0)+((f&8191)<<13)|0;N=(C+(f>>>13)|0)+(y0>>>26)|0,y0&=67108863,_=Math.imul(Ge,mt),f=Math.imul(Ge,vt),f=f+Math.imul(Le,mt)|0,C=Math.imul(Le,vt),_=_+Math.imul(Je,wt)|0,f=f+Math.imul(Je,Et)|0,f=f+Math.imul(Xe,wt)|0,C=C+Math.imul(Xe,Et)|0,_=_+Math.imul(Ae,At)|0,f=f+Math.imul(Ae,_t)|0,f=f+Math.imul(De,At)|0,C=C+Math.imul(De,_t)|0,_=_+Math.imul(Ie,It)|0,f=f+Math.imul(Ie,bt)|0,f=f+Math.imul(Se,It)|0,C=C+Math.imul(Se,bt)|0,_=_+Math.imul(he,Ct)|0,f=f+Math.imul(he,St)|0,f=f+Math.imul(de,Ct)|0,C=C+Math.imul(de,St)|0,_=_+Math.imul(z,xt)|0,f=f+Math.imul(z,Tt)|0,f=f+Math.imul(Q,xt)|0,C=C+Math.imul(Q,Tt)|0;var m0=(N+_|0)+((f&8191)<<13)|0;N=(C+(f>>>13)|0)+(m0>>>26)|0,m0&=67108863,_=Math.imul(Ge,wt),f=Math.imul(Ge,Et),f=f+Math.imul(Le,wt)|0,C=Math.imul(Le,Et),_=_+Math.imul(Je,At)|0,f=f+Math.imul(Je,_t)|0,f=f+Math.imul(Xe,At)|0,C=C+Math.imul(Xe,_t)|0,_=_+Math.imul(Ae,It)|0,f=f+Math.imul(Ae,bt)|0,f=f+Math.imul(De,It)|0,C=C+Math.imul(De,bt)|0,_=_+Math.imul(Ie,Ct)|0,f=f+Math.imul(Ie,St)|0,f=f+Math.imul(Se,Ct)|0,C=C+Math.imul(Se,St)|0,_=_+Math.imul(he,xt)|0,f=f+Math.imul(he,Tt)|0,f=f+Math.imul(de,xt)|0,C=C+Math.imul(de,Tt)|0;var v0=(N+_|0)+((f&8191)<<13)|0;N=(C+(f>>>13)|0)+(v0>>>26)|0,v0&=67108863,_=Math.imul(Ge,At),f=Math.imul(Ge,_t),f=f+Math.imul(Le,At)|0,C=Math.imul(Le,_t),_=_+Math.imul(Je,It)|0,f=f+Math.imul(Je,bt)|0,f=f+Math.imul(Xe,It)|0,C=C+Math.imul(Xe,bt)|0,_=_+Math.imul(Ae,Ct)|0,f=f+Math.imul(Ae,St)|0,f=f+Math.imul(De,Ct)|0,C=C+Math.imul(De,St)|0,_=_+Math.imul(Ie,xt)|0,f=f+Math.imul(Ie,Tt)|0,f=f+Math.imul(Se,xt)|0,C=C+Math.imul(Se,Tt)|0;var w0=(N+_|0)+((f&8191)<<13)|0;N=(C+(f>>>13)|0)+(w0>>>26)|0,w0&=67108863,_=Math.imul(Ge,It),f=Math.imul(Ge,bt),f=f+Math.imul(Le,It)|0,C=Math.imul(Le,bt),_=_+Math.imul(Je,Ct)|0,f=f+Math.imul(Je,St)|0,f=f+Math.imul(Xe,Ct)|0,C=C+Math.imul(Xe,St)|0,_=_+Math.imul(Ae,xt)|0,f=f+Math.imul(Ae,Tt)|0,f=f+Math.imul(De,xt)|0,C=C+Math.imul(De,Tt)|0;var E0=(N+_|0)+((f&8191)<<13)|0;N=(C+(f>>>13)|0)+(E0>>>26)|0,E0&=67108863,_=Math.imul(Ge,Ct),f=Math.imul(Ge,St),f=f+Math.imul(Le,Ct)|0,C=Math.imul(Le,St),_=_+Math.imul(Je,xt)|0,f=f+Math.imul(Je,Tt)|0,f=f+Math.imul(Xe,xt)|0,C=C+Math.imul(Xe,Tt)|0;var A0=(N+_|0)+((f&8191)<<13)|0;N=(C+(f>>>13)|0)+(A0>>>26)|0,A0&=67108863,_=Math.imul(Ge,xt),f=Math.imul(Ge,Tt),f=f+Math.imul(Le,xt)|0,C=Math.imul(Le,Tt);var _0=(N+_|0)+((f&8191)<<13)|0;return N=(C+(f>>>13)|0)+(_0>>>26)|0,_0&=67108863,S[0]=n0,S[1]=s0,S[2]=o0,S[3]=a0,S[4]=u0,S[5]=c0,S[6]=l0,S[7]=f0,S[8]=h0,S[9]=d0,S[10]=p0,S[11]=g0,S[12]=y0,S[13]=m0,S[14]=v0,S[15]=w0,S[16]=E0,S[17]=A0,S[18]=_0,N!==0&&(S[19]=N,g.length++),g};Math.imul||(K=H);function ie(A,c,d){d.negative=c.negative^A.negative,d.length=A.length+c.length;for(var g=0,m=0,w=0;w>>26)|0,m+=S>>>26,S&=67108863}d.words[w]=N,g=S,S=m}return g!==0?d.words[w]=g:d.length--,d._strip()}function k(A,c,d){return ie(A,c,d)}n.prototype.mulTo=function(c,d){var g,m=this.length+c.length;return this.length===10&&c.length===10?g=K(this,c,d):m<63?g=H(this,c,d):m<1024?g=ie(this,c,d):g=k(this,c,d),g};function J(A,c){this.x=A,this.y=c}J.prototype.makeRBT=function(c){for(var d=new Array(c),g=n.prototype._countBits(c)-1,m=0;m>=1;return m},J.prototype.permute=function(c,d,g,m,w,S){for(var N=0;N>>1)w++;return 1<>>13,g[2*S+1]=w&8191,w=w>>>13;for(S=2*d;S>=26,g+=w/67108864|0,g+=S>>>26,this.words[m]=S&67108863}return g!==0&&(this.words[m]=g,this.length++),d?this.ineg():this},n.prototype.muln=function(c){return this.clone().imuln(c)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(c){var d=V(c);if(d.length===0)return new n(1);for(var g=this,m=0;m=0);var d=c%26,g=(c-d)/26,m=67108863>>>26-d<<26-d,w;if(d!==0){var S=0;for(w=0;w>>26-d}S&&(this.words[w]=S,this.length++)}if(g!==0){for(w=this.length-1;w>=0;w--)this.words[w+g]=this.words[w];for(w=0;w=0);var m;d?m=(d-d%26)/26:m=0;var w=c%26,S=Math.min((c-w)/26,this.length),N=67108863^67108863>>>w<S)for(this.length-=S,f=0;f=0&&(C!==0||f>=m);f--){var Z=this.words[f]|0;this.words[f]=C<<26-w|Z>>>w,C=Z&N}return _&&C!==0&&(_.words[_.length++]=C),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},n.prototype.ishrn=function(c,d,g){return t(this.negative===0),this.iushrn(c,d,g)},n.prototype.shln=function(c){return this.clone().ishln(c)},n.prototype.ushln=function(c){return this.clone().iushln(c)},n.prototype.shrn=function(c){return this.clone().ishrn(c)},n.prototype.ushrn=function(c){return this.clone().iushrn(c)},n.prototype.testn=function(c){t(typeof c=="number"&&c>=0);var d=c%26,g=(c-d)/26,m=1<=0);var d=c%26,g=(c-d)/26;if(t(this.negative===0,"imaskn works only with positive numbers"),this.length<=g)return this;if(d!==0&&g++,this.length=Math.min(g,this.length),d!==0){var m=67108863^67108863>>>d<=67108864;d++)this.words[d]-=67108864,d===this.length-1?this.words[d+1]=1:this.words[d+1]++;return this.length=Math.max(this.length,d+1),this},n.prototype.isubn=function(c){if(t(typeof c=="number"),t(c<67108864),c<0)return this.iaddn(-c);if(this.negative!==0)return this.negative=0,this.iaddn(c),this.negative=1,this;if(this.words[0]-=c,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var d=0;d>26)-(_/67108864|0),this.words[w+g]=S&67108863}for(;w>26,this.words[w+g]=S&67108863;if(N===0)return this._strip();for(t(N===-1),N=0,w=0;w>26,this.words[w]=S&67108863;return this.negative=1,this._strip()},n.prototype._wordDiv=function(c,d){var g=this.length-c.length,m=this.clone(),w=c,S=w.words[w.length-1]|0,N=this._countBits(S);g=26-N,g!==0&&(w=w.ushln(g),m.iushln(g),S=w.words[w.length-1]|0);var _=m.length-w.length,f;if(d!=="mod"){f=new n(null),f.length=_+1,f.words=new Array(f.length);for(var C=0;C=0;te--){var ee=(m.words[w.length+te]|0)*67108864+(m.words[w.length+te-1]|0);for(ee=Math.min(ee/S|0,67108863),m._ishlnsubmul(w,ee,te);m.negative!==0;)ee--,m.negative=0,m._ishlnsubmul(w,1,te),m.isZero()||(m.negative^=1);f&&(f.words[te]=ee)}return f&&f._strip(),m._strip(),d!=="div"&&g!==0&&m.iushrn(g),{div:f||null,mod:m}},n.prototype.divmod=function(c,d,g){if(t(!c.isZero()),this.isZero())return{div:new n(0),mod:new n(0)};var m,w,S;return this.negative!==0&&c.negative===0?(S=this.neg().divmod(c,d),d!=="mod"&&(m=S.div.neg()),d!=="div"&&(w=S.mod.neg(),g&&w.negative!==0&&w.iadd(c)),{div:m,mod:w}):this.negative===0&&c.negative!==0?(S=this.divmod(c.neg(),d),d!=="mod"&&(m=S.div.neg()),{div:m,mod:S.mod}):(this.negative&c.negative)!==0?(S=this.neg().divmod(c.neg(),d),d!=="div"&&(w=S.mod.neg(),g&&w.negative!==0&&w.isub(c)),{div:S.div,mod:w}):c.length>this.length||this.cmp(c)<0?{div:new n(0),mod:this}:c.length===1?d==="div"?{div:this.divn(c.words[0]),mod:null}:d==="mod"?{div:null,mod:new n(this.modrn(c.words[0]))}:{div:this.divn(c.words[0]),mod:new n(this.modrn(c.words[0]))}:this._wordDiv(c,d)},n.prototype.div=function(c){return this.divmod(c,"div",!1).div},n.prototype.mod=function(c){return this.divmod(c,"mod",!1).mod},n.prototype.umod=function(c){return this.divmod(c,"mod",!0).mod},n.prototype.divRound=function(c){var d=this.divmod(c);if(d.mod.isZero())return d.div;var g=d.div.negative!==0?d.mod.isub(c):d.mod,m=c.ushrn(1),w=c.andln(1),S=g.cmp(m);return S<0||w===1&&S===0?d.div:d.div.negative!==0?d.div.isubn(1):d.div.iaddn(1)},n.prototype.modrn=function(c){var d=c<0;d&&(c=-c),t(c<=67108863);for(var g=(1<<26)%c,m=0,w=this.length-1;w>=0;w--)m=(g*m+(this.words[w]|0))%c;return d?-m:m},n.prototype.modn=function(c){return this.modrn(c)},n.prototype.idivn=function(c){var d=c<0;d&&(c=-c),t(c<=67108863);for(var g=0,m=this.length-1;m>=0;m--){var w=(this.words[m]|0)+g*67108864;this.words[m]=w/c|0,g=w%c}return this._strip(),d?this.ineg():this},n.prototype.divn=function(c){return this.clone().idivn(c)},n.prototype.egcd=function(c){t(c.negative===0),t(!c.isZero());var d=this,g=c.clone();d.negative!==0?d=d.umod(c):d=d.clone();for(var m=new n(1),w=new n(0),S=new n(0),N=new n(1),_=0;d.isEven()&&g.isEven();)d.iushrn(1),g.iushrn(1),++_;for(var f=g.clone(),C=d.clone();!d.isZero();){for(var Z=0,te=1;(d.words[0]&te)===0&&Z<26;++Z,te<<=1);if(Z>0)for(d.iushrn(Z);Z-- >0;)(m.isOdd()||w.isOdd())&&(m.iadd(f),w.isub(C)),m.iushrn(1),w.iushrn(1);for(var ee=0,ae=1;(g.words[0]&ae)===0&&ee<26;++ee,ae<<=1);if(ee>0)for(g.iushrn(ee);ee-- >0;)(S.isOdd()||N.isOdd())&&(S.iadd(f),N.isub(C)),S.iushrn(1),N.iushrn(1);d.cmp(g)>=0?(d.isub(g),m.isub(S),w.isub(N)):(g.isub(d),S.isub(m),N.isub(w))}return{a:S,b:N,gcd:g.iushln(_)}},n.prototype._invmp=function(c){t(c.negative===0),t(!c.isZero());var d=this,g=c.clone();d.negative!==0?d=d.umod(c):d=d.clone();for(var m=new n(1),w=new n(0),S=g.clone();d.cmpn(1)>0&&g.cmpn(1)>0;){for(var N=0,_=1;(d.words[0]&_)===0&&N<26;++N,_<<=1);if(N>0)for(d.iushrn(N);N-- >0;)m.isOdd()&&m.iadd(S),m.iushrn(1);for(var f=0,C=1;(g.words[0]&C)===0&&f<26;++f,C<<=1);if(f>0)for(g.iushrn(f);f-- >0;)w.isOdd()&&w.iadd(S),w.iushrn(1);d.cmp(g)>=0?(d.isub(g),m.isub(w)):(g.isub(d),w.isub(m))}var Z;return d.cmpn(1)===0?Z=m:Z=w,Z.cmpn(0)<0&&Z.iadd(c),Z},n.prototype.gcd=function(c){if(this.isZero())return c.abs();if(c.isZero())return this.abs();var d=this.clone(),g=c.clone();d.negative=0,g.negative=0;for(var m=0;d.isEven()&&g.isEven();m++)d.iushrn(1),g.iushrn(1);do{for(;d.isEven();)d.iushrn(1);for(;g.isEven();)g.iushrn(1);var w=d.cmp(g);if(w<0){var S=d;d=g,g=S}else if(w===0||g.cmpn(1)===0)break;d.isub(g)}while(!0);return g.iushln(m)},n.prototype.invm=function(c){return this.egcd(c).a.umod(c)},n.prototype.isEven=function(){return(this.words[0]&1)===0},n.prototype.isOdd=function(){return(this.words[0]&1)===1},n.prototype.andln=function(c){return this.words[0]&c},n.prototype.bincn=function(c){t(typeof c=="number");var d=c%26,g=(c-d)/26,m=1<>>26,N&=67108863,this.words[S]=N}return w!==0&&(this.words[S]=w,this.length++),this},n.prototype.isZero=function(){return this.length===1&&this.words[0]===0},n.prototype.cmpn=function(c){var d=c<0;if(this.negative!==0&&!d)return-1;if(this.negative===0&&d)return 1;this._strip();var g;if(this.length>1)g=1;else{d&&(c=-c),t(c<=67108863,"Number is too big");var m=this.words[0]|0;g=m===c?0:mc.length)return 1;if(this.length=0;g--){var m=this.words[g]|0,w=c.words[g]|0;if(m!==w){mw&&(d=1);break}}return d},n.prototype.gtn=function(c){return this.cmpn(c)===1},n.prototype.gt=function(c){return this.cmp(c)===1},n.prototype.gten=function(c){return this.cmpn(c)>=0},n.prototype.gte=function(c){return this.cmp(c)>=0},n.prototype.ltn=function(c){return this.cmpn(c)===-1},n.prototype.lt=function(c){return this.cmp(c)===-1},n.prototype.lten=function(c){return this.cmpn(c)<=0},n.prototype.lte=function(c){return this.cmp(c)<=0},n.prototype.eqn=function(c){return this.cmpn(c)===0},n.prototype.eq=function(c){return this.cmp(c)===0},n.red=function(c){return new Y(c)},n.prototype.toRed=function(c){return t(!this.red,"Already a number in reduction context"),t(this.negative===0,"red works only with positives"),c.convertTo(this)._forceRed(c)},n.prototype.fromRed=function(){return t(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(c){return this.red=c,this},n.prototype.forceRed=function(c){return t(!this.red,"Already a number in reduction context"),this._forceRed(c)},n.prototype.redAdd=function(c){return t(this.red,"redAdd works only with red numbers"),this.red.add(this,c)},n.prototype.redIAdd=function(c){return t(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,c)},n.prototype.redSub=function(c){return t(this.red,"redSub works only with red numbers"),this.red.sub(this,c)},n.prototype.redISub=function(c){return t(this.red,"redISub works only with red numbers"),this.red.isub(this,c)},n.prototype.redShl=function(c){return t(this.red,"redShl works only with red numbers"),this.red.shl(this,c)},n.prototype.redMul=function(c){return t(this.red,"redMul works only with red numbers"),this.red._verify2(this,c),this.red.mul(this,c)},n.prototype.redIMul=function(c){return t(this.red,"redMul works only with red numbers"),this.red._verify2(this,c),this.red.imul(this,c)},n.prototype.redSqr=function(){return t(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return t(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return t(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return t(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return t(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(c){return t(this.red&&!c.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,c)};var W={k256:null,p224:null,p192:null,p25519:null};function G(A,c){this.name=A,this.p=new n(c,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}G.prototype._tmp=function(){var c=new n(null);return c.words=new Array(Math.ceil(this.n/13)),c},G.prototype.ireduce=function(c){var d=c,g;do this.split(d,this.tmp),d=this.imulK(d),d=d.iadd(this.tmp),g=d.bitLength();while(g>this.n);var m=g0?d.isub(this.p):d.strip!==void 0?d.strip():d._strip(),d},G.prototype.split=function(c,d){c.iushrn(this.n,0,d)},G.prototype.imulK=function(c){return c.imul(this.k)};function P(){G.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(P,G),P.prototype.split=function(c,d){for(var g=4194303,m=Math.min(c.length,9),w=0;w>>22,S=N}S>>>=22,c.words[w-10]=S,S===0&&c.length>10?c.length-=10:c.length-=9},P.prototype.imulK=function(c){c.words[c.length]=0,c.words[c.length+1]=0,c.length+=2;for(var d=0,g=0;g>>=26,c.words[g]=w,d=m}return d!==0&&(c.words[c.length++]=d),c},n._prime=function(c){if(W[c])return W[c];var d;if(c==="k256")d=new P;else if(c==="p224")d=new F;else if(c==="p192")d=new $;else if(c==="p25519")d=new ce;else throw new Error("Unknown prime "+c);return W[c]=d,d};function Y(A){if(typeof A=="string"){var c=n._prime(A);this.m=c.p,this.prime=c}else t(A.gtn(1),"modulus must be greater than 1"),this.m=A,this.prime=null}Y.prototype._verify1=function(c){t(c.negative===0,"red works only with positives"),t(c.red,"red works only with red numbers")},Y.prototype._verify2=function(c,d){t((c.negative|d.negative)===0,"red works only with positives"),t(c.red&&c.red===d.red,"red works only with red numbers")},Y.prototype.imod=function(c){return this.prime?this.prime.ireduce(c)._forceRed(this):(h(c,c.umod(this.m)._forceRed(this)),c)},Y.prototype.neg=function(c){return c.isZero()?c.clone():this.m.sub(c)._forceRed(this)},Y.prototype.add=function(c,d){this._verify2(c,d);var g=c.add(d);return g.cmp(this.m)>=0&&g.isub(this.m),g._forceRed(this)},Y.prototype.iadd=function(c,d){this._verify2(c,d);var g=c.iadd(d);return g.cmp(this.m)>=0&&g.isub(this.m),g},Y.prototype.sub=function(c,d){this._verify2(c,d);var g=c.sub(d);return g.cmpn(0)<0&&g.iadd(this.m),g._forceRed(this)},Y.prototype.isub=function(c,d){this._verify2(c,d);var g=c.isub(d);return g.cmpn(0)<0&&g.iadd(this.m),g},Y.prototype.shl=function(c,d){return this._verify1(c),this.imod(c.ushln(d))},Y.prototype.imul=function(c,d){return this._verify2(c,d),this.imod(c.imul(d))},Y.prototype.mul=function(c,d){return this._verify2(c,d),this.imod(c.mul(d))},Y.prototype.isqr=function(c){return this.imul(c,c.clone())},Y.prototype.sqr=function(c){return this.mul(c,c)},Y.prototype.sqrt=function(c){if(c.isZero())return c.clone();var d=this.m.andln(3);if(t(d%2===1),d===3){var g=this.m.add(new n(1)).iushrn(2);return this.pow(c,g)}for(var m=this.m.subn(1),w=0;!m.isZero()&&m.andln(1)===0;)w++,m.iushrn(1);t(!m.isZero());var S=new n(1).toRed(this),N=S.redNeg(),_=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new n(2*f*f).toRed(this);this.pow(f,_).cmp(N)!==0;)f.redIAdd(N);for(var C=this.pow(f,m),Z=this.pow(c,m.addn(1).iushrn(1)),te=this.pow(c,m),ee=w;te.cmp(S)!==0;){for(var ae=te,E=0;ae.cmp(S)!==0;E++)ae=ae.redSqr();t(E=0;w--){for(var C=d.words[w],Z=f-1;Z>=0;Z--){var te=C>>Z&1;if(S!==m[0]&&(S=this.sqr(S)),te===0&&N===0){_=0;continue}N<<=1,N|=te,_++,!(_!==g&&(w!==0||Z!==0))&&(S=this.mul(S,m[N]),_=0,N=0)}f=26}return S},Y.prototype.convertTo=function(c){var d=c.umod(this.m);return d===c?d.clone():d},Y.prototype.convertFrom=function(c){var d=c.clone();return d.red=null,d},n.mont=function(c){return new X(c)};function X(A){Y.call(this,A),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(X,Y),X.prototype.convertTo=function(c){return this.imod(c.ushln(this.shift))},X.prototype.convertFrom=function(c){var d=this.imod(c.mul(this.rinv));return d.red=null,d},X.prototype.imul=function(c,d){if(c.isZero()||d.isZero())return c.words[0]=0,c.length=1,c;var g=c.imul(d),m=g.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),w=g.isub(m).iushrn(this.shift),S=w;return w.cmp(this.m)>=0?S=w.isub(this.m):w.cmpn(0)<0&&(S=w.iadd(this.m)),S._forceRed(this)},X.prototype.mul=function(c,d){if(c.isZero()||d.isZero())return new n(0)._forceRed(this);var g=c.mul(d),m=g.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),w=g.isub(m).iushrn(this.shift),S=w;return w.cmp(this.m)>=0?S=w.isub(this.m):w.cmpn(0)<0&&(S=w.iadd(this.m)),S._forceRed(this)},X.prototype.invm=function(c){var d=this.imod(c._invmp(this.m).mul(this.r2));return d._forceRed(this)}})(typeof zw>"u"||zw,ZD)});var tO=D(Lp=>{"use strict";l();Object.defineProperty(Lp,"__esModule",{value:!0});Lp.TransactionStatus=void 0;var Cl=class{constructor(e){this.status=(e||"").toLowerCase()}static createUnknown(){return new Cl("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}};Lp.TransactionStatus=Cl});var ju=D(Jt=>{"use strict";l();var qG=Jt&&Jt.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),VG=Jt&&Jt.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),HG=Jt&&Jt.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&qG(e,r,t);return VG(e,r),e};Object.defineProperty(Jt,"__esModule",{value:!0});Jt.zeroPadStringIfOddLength=Jt.isPaddedHex=Jt.numberToPaddedHex=Jt.Nonce=Jt.Address=void 0;var rO=HG(ef()),QG="erd",Sl=class{constructor(e){this.value=e}static fromPubkey(e){let t=rO.toWords(e),i=rO.encode(QG,t);return new Sl(i)}bech32(){return this.value}toString(){return this.bech32()}};Jt.Address=Sl;var $w=class{constructor(e){this.value=e}valueOf(){return this.value}hex(){return iO(this.value)}};Jt.Nonce=$w;function iO(r){let e=r.toString(16);return nO(e)}Jt.numberToPaddedHex=iO;function jG(r){r=r||"";let e=y.Buffer.from(r,"hex").toString("hex");return r.toUpperCase()==e.toUpperCase()}Jt.isPaddedHex=jG;function nO(r){return r=r||"",r.length%2==1?"0"+r:r}Jt.zeroPadStringIfOddLength=nO});var oO=D(Rp=>{"use strict";l();Object.defineProperty(Rp,"__esModule",{value:!0});Rp.TransactionReceipt=void 0;var sO=ju(),xl=class{constructor(){this.value="",this.sender=new sO.Address(""),this.data="",this.hash=""}static fromHttpResponse(e){let t=new xl;return t.value=(e.value||0).toString(),t.sender=new sO.Address(e.sender),t.data=e.data,t.hash=e.txHash,t}};Rp.TransactionReceipt=xl});var aO=D(Ri=>{"use strict";l();Object.defineProperty(Ri,"__esModule",{value:!0});Ri.ErrContractQuery=Ri.ErrNetworkProvider=Ri.ErrUnexpectedCondition=Ri.Err=void 0;var Gu=class extends Error{constructor(e,t){super(e),this.inner=void 0,this.inner=t}};Ri.Err=Gu;var kw=class extends Gu{constructor(e){super(`Unexpected condition: [${e}]`)}};Ri.ErrUnexpectedCondition=kw;var Ww=class extends Gu{constructor(e,t,i){let n=`Request error on url [${e}]: [${t}]`;super(n,i)}};Ri.ErrNetworkProvider=Ww;var Yw=class extends Gu{constructor(e){super(e.message.replace("executeQuery:",""))}};Ri.ErrContractQuery=Yw});var cO=D(Ku=>{"use strict";l();Object.defineProperty(Ku,"__esModule",{value:!0});Ku.TransactionEventTopic=Ku.TransactionEvent=void 0;var uO=ju(),Tl=class{constructor(e){this.address=new uO.Address(""),this.identifier="",this.topics=[],this.data="",Object.assign(this,e)}static fromHttpResponse(e){let t=new Tl;return t.address=new uO.Address(e.address),t.identifier=e.identifier||"",t.topics=(e.topics||[]).map(i=>new Fp(i)),t.data=y.Buffer.from(e.data||"","base64").toString(),t}findFirstOrNoneTopic(e){return this.topics.filter(t=>e(t))[0]}getLastTopic(){return this.topics[this.topics.length-1]}};Ku.TransactionEvent=Tl;var Fp=class{constructor(e){this.raw=y.Buffer.from(e||"","base64")}toString(){return this.raw.toString("utf8")}hex(){return this.raw.toString("hex")}valueOf(){return this.raw}};Ku.TransactionEventTopic=Fp});var Jw=D(Up=>{"use strict";l();Object.defineProperty(Up,"__esModule",{value:!0});Up.TransactionLogs=void 0;var GG=aO(),lO=ju(),KG=cO(),Nl=class{constructor(e){this.address=new lO.Address(""),this.events=[],Object.assign(this,e)}static fromHttpResponse(e){let t=new Nl;return t.address=new lO.Address(e.address),t.events=(e.events||[]).map(i=>KG.TransactionEvent.fromHttpResponse(i)),t}findSingleOrNoneEvent(e,t){let i=this.findEvents(e,t);if(i.length>1)throw new GG.ErrUnexpectedCondition(`more than one event of type ${e}`);return i[0]}findFirstOrNoneEvent(e,t){return this.findEvents(e,t)[0]}findEvents(e,t){let i=this.events.filter(n=>n.identifier==e);return t&&(i=i.filter(n=>t(n))),i}};Up.TransactionLogs=Nl});var hO=D($u=>{"use strict";l();Object.defineProperty($u,"__esModule",{value:!0});$u.ContractResultItem=$u.ContractResults=void 0;var fO=Jw(),qp=ju(),zu=class{constructor(e){this.items=e,this.items.sort(function(t,i){return t.nonce.valueOf()-i.nonce.valueOf()})}static fromProxyHttpResponse(e){let t=e.map(i=>fn.fromProxyHttpResponse(i));return new zu(t)}static fromApiHttpResponse(e){let t=e.map(i=>fn.fromApiHttpResponse(i));return new zu(t)}};$u.ContractResults=zu;var fn=class{constructor(e){this.hash="",this.nonce=0,this.value="",this.receiver=new qp.Address(""),this.sender=new qp.Address(""),this.data="",this.previousHash="",this.originalHash="",this.gasLimit=0,this.gasPrice=0,this.callType=0,this.returnMessage="",this.logs=new fO.TransactionLogs,Object.assign(this,e)}static fromProxyHttpResponse(e){return fn.fromHttpResponse(e)}static fromApiHttpResponse(e){let t=fn.fromHttpResponse(e);return t.data=y.Buffer.from(t.data,"base64").toString(),t.callType=Number(t.callType),t}static fromHttpResponse(e){let t=new fn;return t.hash=e.hash,t.nonce=Number(e.nonce||0),t.value=(e.value||0).toString(),t.receiver=new qp.Address(e.receiver),t.sender=new qp.Address(e.sender),t.previousHash=e.prevTxHash,t.originalHash=e.originalTxHash,t.gasLimit=Number(e.gasLimit||0),t.gasPrice=Number(e.gasPrice||0),t.data=e.data||"",t.callType=e.callType,t.returnMessage=e.returnMessage,t.logs=fO.TransactionLogs.fromHttpResponse(e.logs||{}),t}};$u.ContractResultItem=fn});var dO=D(us=>{"use strict";l();var zG=us&&us.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(us,"__esModule",{value:!0});us.EsdtContractAddress=us.MaxUint64AsBigNumber=void 0;var $G=zG(Vr()),kG=ju();us.MaxUint64AsBigNumber=new $G.default("18446744073709551615");us.EsdtContractAddress=new kG.Address("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u")});var pO=D(ku=>{"use strict";l();var WG=ku&&ku.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(ku,"__esModule",{value:!0});ku.ContractQueryResponse=void 0;var YG=WG(Vr()),JG=dO(),Dl=class{constructor(e){this.returnData=e?.returnData||[],this.returnCode=e?.returnCode||"",this.returnMessage=e?.returnMessage||"",this.gasUsed=e?.gasUsed||0}static fromHttpResponse(e){let t=e.returnData||e.ReturnData,i=e.returnCode||e.ReturnCode,n=e.returnMessage||e.ReturnMessage,s=new YG.default(e.gasRemaining||e.GasRemaining||0),o=JG.MaxUint64AsBigNumber.minus(s).toNumber();return new Dl({returnData:t,returnCode:i,returnMessage:n,gasUsed:o})}getReturnDataParts(){return this.returnData.map(e=>y.Buffer.from(e||"","base64"))}toJSON(){return{returnData:this.returnData,returnCode:this.returnCode,returnMessage:this.returnMessage,gasUsed:this.gasUsed.valueOf()}}};ku.ContractQueryResponse=Dl});var gO=D(Vp=>{"use strict";l();Object.defineProperty(Vp,"__esModule",{value:!0});Vp.ContractQueryRequest=void 0;var Xw=class{constructor(e){this.query=e}toHttpRequest(){var e;let t={},i=this.query;return t.scAddress=i.address.bech32(),t.caller=!((e=i.caller)===null||e===void 0)&&e.bech32()?i.caller.bech32():void 0,t.funcName=i.func.toString(),t.value=i.value?i.value.toString():void 0,t.args=i.getEncodedArguments(),t}};Vp.ContractQueryRequest=Xw});var yO=D(Hp=>{"use strict";l();Object.defineProperty(Hp,"__esModule",{value:!0});Hp.Query=void 0;var XG=Hr(),ZG=Wf(),Zw=class{constructor(e){this.caller=e.caller||new XG.Address,this.address=e.address,this.func=e.func,this.args=e.args||[],this.value=e.value||0}getEncodedArguments(){return new ZG.ArgSerializer().valuesToStrings(this.args)}};Hp.Query=Zw});var xO=D((qne,SO)=>{l();SO.exports=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}});var cs=D(bo=>{l();var eE,eK=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];bo.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return e*4+17};bo.getSymbolTotalCodewords=function(e){return eK[e]};bo.getBCHDigit=function(r){let e=0;for(;r!==0;)e++,r>>>=1;return e};bo.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');eE=e};bo.isKanjiModeEnabled=function(){return typeof eE<"u"};bo.toSJIS=function(e){return eE(e)}});var Gp=D(qr=>{l();qr.L={bit:1};qr.M={bit:0};qr.Q={bit:3};qr.H={bit:2};function tK(r){if(typeof r!="string")throw new Error("Param is not a string");switch(r.toLowerCase()){case"l":case"low":return qr.L;case"m":case"medium":return qr.M;case"q":case"quartile":return qr.Q;case"h":case"high":return qr.H;default:throw new Error("Unknown EC Level: "+r)}}qr.isValid=function(e){return e&&typeof e.bit<"u"&&e.bit>=0&&e.bit<4};qr.from=function(e,t){if(qr.isValid(e))return e;try{return tK(e)}catch{return t}}});var DO=D((Kne,NO)=>{l();function TO(){this.buffer=[],this.length=0}TO.prototype={get:function(r){let e=Math.floor(r/8);return(this.buffer[e]>>>7-r%8&1)===1},put:function(r,e){for(let t=0;t>>e-t-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(r){let e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),r&&(this.buffer[e]|=128>>>this.length%8),this.length++}};NO.exports=TO});var BO=D(($ne,OO)=>{l();function Ol(r){if(!r||r<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=r,this.data=new Uint8Array(r*r),this.reservedBit=new Uint8Array(r*r)}Ol.prototype.set=function(r,e,t,i){let n=r*this.size+e;this.data[n]=t,i&&(this.reservedBit[n]=!0)};Ol.prototype.get=function(r,e){return this.data[r*this.size+e]};Ol.prototype.xor=function(r,e,t){this.data[r*this.size+e]^=t};Ol.prototype.isReserved=function(r,e){return this.reservedBit[r*this.size+e]};OO.exports=Ol});var MO=D(Kp=>{l();var rK=cs().getSymbolSize;Kp.getRowColCoords=function(e){if(e===1)return[];let t=Math.floor(e/7)+2,i=rK(e),n=i===145?26:Math.ceil((i-13)/(2*t-2))*2,s=[i-7];for(let o=1;o{l();var iK=cs().getSymbolSize,PO=7;LO.getPositions=function(e){let t=iK(e);return[[0,0],[t-PO,0],[0,t-PO]]}});var FO=D($e=>{l();$e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var Co={N1:3,N2:3,N3:40,N4:10};$e.isValid=function(e){return e!=null&&e!==""&&!isNaN(e)&&e>=0&&e<=7};$e.from=function(e){return $e.isValid(e)?parseInt(e,10):void 0};$e.getPenaltyN1=function(e){let t=e.size,i=0,n=0,s=0,o=null,a=null;for(let u=0;u=5&&(i+=Co.N1+(n-5)),o=p,n=1),p=e.get(h,u),p===a?s++:(s>=5&&(i+=Co.N1+(s-5)),a=p,s=1)}n>=5&&(i+=Co.N1+(n-5)),s>=5&&(i+=Co.N1+(s-5))}return i};$e.getPenaltyN2=function(e){let t=e.size,i=0;for(let n=0;n=10&&(n===1488||n===93)&&i++,s=s<<1&2047|e.get(a,o),a>=10&&(s===1488||s===93)&&i++}return i*Co.N3};$e.getPenaltyN4=function(e){let t=0,i=e.data.length;for(let s=0;s{l();var ls=Gp(),zp=[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],$p=[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];tE.getBlocksCount=function(e,t){switch(t){case ls.L:return zp[(e-1)*4+0];case ls.M:return zp[(e-1)*4+1];case ls.Q:return zp[(e-1)*4+2];case ls.H:return zp[(e-1)*4+3];default:return}};tE.getTotalCodewordsCount=function(e,t){switch(t){case ls.L:return $p[(e-1)*4+0];case ls.M:return $p[(e-1)*4+1];case ls.Q:return $p[(e-1)*4+2];case ls.H:return $p[(e-1)*4+3];default:return}}});var UO=D(Wp=>{l();var Bl=new Uint8Array(512),kp=new Uint8Array(256);(function(){let e=1;for(let t=0;t<255;t++)Bl[t]=e,kp[e]=t,e<<=1,e&256&&(e^=285);for(let t=255;t<512;t++)Bl[t]=Bl[t-255]})();Wp.log=function(e){if(e<1)throw new Error("log("+e+")");return kp[e]};Wp.exp=function(e){return Bl[e]};Wp.mul=function(e,t){return e===0||t===0?0:Bl[kp[e]+kp[t]]}});var qO=D(Ml=>{l();var iE=UO();Ml.mul=function(e,t){let i=new Uint8Array(e.length+t.length-1);for(let n=0;n=0;){let n=i[0];for(let o=0;o{l();var VO=qO();function nE(r){this.genPoly=void 0,this.degree=r,this.degree&&this.initialize(this.degree)}nE.prototype.initialize=function(e){this.degree=e,this.genPoly=VO.generateECPolynomial(this.degree)};nE.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");let t=new Uint8Array(e.length+this.degree);t.set(e);let i=VO.mod(t,this.genPoly),n=this.degree-i.length;if(n>0){let s=new Uint8Array(this.degree);return s.set(i,n),s}return i};HO.exports=nE});var sE=D(jO=>{l();jO.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}});var oE=D(hn=>{l();var GO="[0-9]+",sK="[A-Z $%*+\\-./:]+",Pl="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";Pl=Pl.replace(/u/g,"\\u");var oK="(?:(?![A-Z0-9 $%*+\\-./:]|"+Pl+`)(?:.|[\r -]))+`;hn.KANJI=new RegExp(Pl,"g");hn.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");hn.BYTE=new RegExp(oK,"g");hn.NUMERIC=new RegExp(GO,"g");hn.ALPHANUMERIC=new RegExp(sK,"g");var aK=new RegExp("^"+Pl+"$"),uK=new RegExp("^"+GO+"$"),cK=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");hn.testKanji=function(e){return aK.test(e)};hn.testNumeric=function(e){return uK.test(e)};hn.testAlphanumeric=function(e){return cK.test(e)}});var fs=D(Lt=>{l();var lK=sE(),aE=oE();Lt.NUMERIC={id:"Numeric",bit:1<<0,ccBits:[10,12,14]};Lt.ALPHANUMERIC={id:"Alphanumeric",bit:1<<1,ccBits:[9,11,13]};Lt.BYTE={id:"Byte",bit:1<<2,ccBits:[8,16,16]};Lt.KANJI={id:"Kanji",bit:1<<3,ccBits:[8,10,12]};Lt.MIXED={bit:-1};Lt.getCharCountIndicator=function(e,t){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!lK.isValid(t))throw new Error("Invalid version: "+t);return t>=1&&t<10?e.ccBits[0]:t<27?e.ccBits[1]:e.ccBits[2]};Lt.getBestModeForData=function(e){return aE.testNumeric(e)?Lt.NUMERIC:aE.testAlphanumeric(e)?Lt.ALPHANUMERIC:aE.testKanji(e)?Lt.KANJI:Lt.BYTE};Lt.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")};Lt.isValid=function(e){return e&&e.bit&&e.ccBits};function fK(r){if(typeof r!="string")throw new Error("Param is not a string");switch(r.toLowerCase()){case"numeric":return Lt.NUMERIC;case"alphanumeric":return Lt.ALPHANUMERIC;case"kanji":return Lt.KANJI;case"byte":return Lt.BYTE;default:throw new Error("Unknown mode: "+r)}}Lt.from=function(e,t){if(Lt.isValid(e))return e;try{return fK(e)}catch{return t}}});var WO=D(So=>{l();var Yp=cs(),hK=rE(),KO=Gp(),hs=fs(),uE=sE(),$O=1<<12|1<<11|1<<10|1<<9|1<<8|1<<5|1<<2|1<<0,zO=Yp.getBCHDigit($O);function dK(r,e,t){for(let i=1;i<=40;i++)if(e<=So.getCapacity(i,t,r))return i}function kO(r,e){return hs.getCharCountIndicator(r,e)+4}function pK(r,e){let t=0;return r.forEach(function(i){let n=kO(i.mode,e);t+=n+i.getBitsLength()}),t}function gK(r,e){for(let t=1;t<=40;t++)if(pK(r,t)<=So.getCapacity(t,e,hs.MIXED))return t}So.from=function(e,t){return uE.isValid(e)?parseInt(e,10):t};So.getCapacity=function(e,t,i){if(!uE.isValid(e))throw new Error("Invalid QR Code version");typeof i>"u"&&(i=hs.BYTE);let n=Yp.getSymbolTotalCodewords(e),s=hK.getTotalCodewordsCount(e,t),o=(n-s)*8;if(i===hs.MIXED)return o;let a=o-kO(i,e);switch(i){case hs.NUMERIC:return Math.floor(a/10*3);case hs.ALPHANUMERIC:return Math.floor(a/11*2);case hs.KANJI:return Math.floor(a/13);case hs.BYTE:default:return Math.floor(a/8)}};So.getBestVersionForData=function(e,t){let i,n=KO.from(t,KO.M);if(Array.isArray(e)){if(e.length>1)return gK(e,n);if(e.length===0)return 1;i=e[0]}else i=e;return dK(i.mode,i.getLength(),n)};So.getEncodedBits=function(e){if(!uE.isValid(e)||e<7)throw new Error("Invalid QR Code version");let t=e<<12;for(;Yp.getBCHDigit(t)-zO>=0;)t^=$O<{l();var cE=cs(),JO=1<<10|1<<8|1<<5|1<<4|1<<2|1<<1|1<<0,yK=1<<14|1<<12|1<<10|1<<4|1<<1,YO=cE.getBCHDigit(JO);XO.getEncodedBits=function(e,t){let i=e.bit<<3|t,n=i<<10;for(;cE.getBCHDigit(n)-YO>=0;)n^=JO<{l();var mK=fs();function Wu(r){this.mode=mK.NUMERIC,this.data=r.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 t,i,n;for(t=0;t+3<=this.data.length;t+=3)i=this.data.substr(t,3),n=parseInt(i,10),e.put(n,10);let s=this.data.length-t;s>0&&(i=this.data.substr(t),n=parseInt(i,10),e.put(n,s*3+1))};e8.exports=Wu});var i8=D((Ase,r8)=>{l();var vK=fs(),lE=["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 Yu(r){this.mode=vK.ALPHANUMERIC,this.data=r}Yu.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)};Yu.prototype.getLength=function(){return this.data.length};Yu.prototype.getBitsLength=function(){return Yu.getBitsLength(this.data.length)};Yu.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let i=lE.indexOf(this.data[t])*45;i+=lE.indexOf(this.data[t+1]),e.put(i,11)}this.data.length%2&&e.put(lE.indexOf(this.data[t]),6)};r8.exports=Yu});var s8=D((Ise,n8)=>{"use strict";l();n8.exports=function(e){for(var t=[],i=e.length,n=0;n=55296&&s<=56319&&i>n+1){var o=e.charCodeAt(n+1);o>=56320&&o<=57343&&(s=(s-55296)*1024+o-56320+65536,n+=1)}if(s<128){t.push(s);continue}if(s<2048){t.push(s>>6|192),t.push(s&63|128);continue}if(s<55296||s>=57344&&s<65536){t.push(s>>12|224),t.push(s>>6&63|128),t.push(s&63|128);continue}if(s>=65536&&s<=1114111){t.push(s>>18|240),t.push(s>>12&63|128),t.push(s>>6&63|128),t.push(s&63|128);continue}t.push(239,191,189)}return new Uint8Array(t).buffer}});var a8=D((Cse,o8)=>{l();var wK=s8(),EK=fs();function Ju(r){this.mode=EK.BYTE,typeof r=="string"&&(r=wK(r)),this.data=new Uint8Array(r)}Ju.getBitsLength=function(e){return e*8};Ju.prototype.getLength=function(){return this.data.length};Ju.prototype.getBitsLength=function(){return Ju.getBitsLength(this.data.length)};Ju.prototype.write=function(r){for(let e=0,t=this.data.length;e{l();var AK=fs(),_K=cs();function Xu(r){this.mode=AK.KANJI,this.data=r}Xu.getBitsLength=function(e){return e*13};Xu.prototype.getLength=function(){return this.data.length};Xu.prototype.getBitsLength=function(){return Xu.getBitsLength(this.data.length)};Xu.prototype.write=function(r){let e;for(e=0;e=33088&&t<=40956)t-=33088;else if(t>=57408&&t<=60351)t-=49472;else throw new Error("Invalid SJIS character: "+this.data[e]+` -Make sure your charset is UTF-8`);t=(t>>>8&255)*192+(t&255),r.put(t,13)}};u8.exports=Xu});var l8=D((Nse,fE)=>{"use strict";l();var Ll={single_source_shortest_paths:function(r,e,t){var i={},n={};n[e]=0;var s=Ll.PriorityQueue.make();s.push(e,0);for(var o,a,u,h,p,v,B,R,x;!s.empty();){o=s.pop(),a=o.value,h=o.cost,p=r[a]||{};for(u in p)p.hasOwnProperty(u)&&(v=p[u],B=h+v,R=n[u],x=typeof n[u]>"u",(x||R>B)&&(n[u]=B,s.push(u,B),i[u]=a))}if(typeof t<"u"&&typeof n[t]>"u"){var V=["Could not find a path from ",e," to ",t,"."].join("");throw new Error(V)}return i},extract_shortest_path_from_predecessor_list:function(r,e){for(var t=[],i=e,n;i;)t.push(i),n=r[i],i=r[i];return t.reverse(),t},find_path:function(r,e,t){var i=Ll.single_source_shortest_paths(r,e,t);return Ll.extract_shortest_path_from_predecessor_list(i,t)},PriorityQueue:{make:function(r){var e=Ll.PriorityQueue,t={},i;r=r||{};for(i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);return t.queue=[],t.sorter=r.sorter||e.default_sorter,t},default_sorter:function(r,e){return r.cost-e.cost},push:function(r,e){var t={value:r,cost:e};this.queue.push(t),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};typeof fE<"u"&&(fE.exports=Ll)});var v8=D(Zu=>{l();var Ve=fs(),d8=t8(),p8=i8(),g8=a8(),y8=c8(),Rl=oE(),Jp=cs(),IK=l8();function f8(r){return unescape(encodeURIComponent(r)).length}function Fl(r,e,t){let i=[],n;for(;(n=r.exec(t))!==null;)i.push({data:n[0],index:n.index,mode:e,length:n[0].length});return i}function m8(r){let e=Fl(Rl.NUMERIC,Ve.NUMERIC,r),t=Fl(Rl.ALPHANUMERIC,Ve.ALPHANUMERIC,r),i,n;return Jp.isKanjiModeEnabled()?(i=Fl(Rl.BYTE,Ve.BYTE,r),n=Fl(Rl.KANJI,Ve.KANJI,r)):(i=Fl(Rl.BYTE_KANJI,Ve.BYTE,r),n=[]),e.concat(t,i,n).sort(function(o,a){return o.index-a.index}).map(function(o){return{data:o.data,mode:o.mode,length:o.length}})}function hE(r,e){switch(e){case Ve.NUMERIC:return d8.getBitsLength(r);case Ve.ALPHANUMERIC:return p8.getBitsLength(r);case Ve.KANJI:return y8.getBitsLength(r);case Ve.BYTE:return g8.getBitsLength(r)}}function bK(r){return r.reduce(function(e,t){let i=e.length-1>=0?e[e.length-1]:null;return i&&i.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)},[])}function CK(r){let e=[];for(let t=0;t{l();var Zp=cs(),dE=Gp(),xK=DO(),TK=BO(),NK=MO(),DK=RO(),yE=FO(),mE=rE(),OK=QO(),Xp=WO(),BK=ZO(),MK=fs(),pE=v8();function PK(r,e){let t=r.size,i=DK.getPositions(e);for(let n=0;n=0&&a<=6&&(u===0||u===6)||u>=0&&u<=6&&(a===0||a===6)||a>=2&&a<=4&&u>=2&&u<=4?r.set(s+a,o+u,!0,!0):r.set(s+a,o+u,!1,!0))}}function LK(r){let e=r.size;for(let t=8;t>a&1)===1,r.set(n,s,o,!0),r.set(s,n,o,!0)}function gE(r,e,t){let i=r.size,n=BK.getEncodedBits(e,t),s,o;for(s=0;s<15;s++)o=(n>>s&1)===1,s<6?r.set(s,8,o,!0):s<8?r.set(s+1,8,o,!0):r.set(i-15+s,8,o,!0),s<8?r.set(8,i-s-1,o,!0):s<9?r.set(8,15-s-1+1,o,!0):r.set(8,15-s-1,o,!0);r.set(i-8,8,1,!0)}function UK(r,e){let t=r.size,i=-1,n=t-1,s=7,o=0;for(let a=t-1;a>0;a-=2)for(a===6&&a--;;){for(let u=0;u<2;u++)if(!r.isReserved(n,a-u)){let h=!1;o>>s&1)===1),r.set(n,a-u,h),s--,s===-1&&(o++,s=7)}if(n+=i,n<0||t<=n){n-=i,i=-i;break}}}function qK(r,e,t){let i=new xK;t.forEach(function(u){i.put(u.mode.bit,4),i.put(u.getLength(),MK.getCharCountIndicator(u.mode,r)),u.write(i)});let n=Zp.getSymbolTotalCodewords(r),s=mE.getTotalCodewordsCount(r,e),o=(n-s)*8;for(i.getLengthInBits()+4<=o&&i.put(0,4);i.getLengthInBits()%8!==0;)i.putBit(0);let a=(o-i.getLengthInBits())/8;for(let u=0;u=7&&FK(u,e),UK(u,o),isNaN(i)&&(i=yE.getBestMask(u,gE.bind(null,u,t))),yE.applyMask(i,u),gE(u,t,i),{modules:u,version:e,errorCorrectionLevel:t,maskPattern:i,segments:n}}w8.create=function(e,t){if(typeof e>"u"||e==="")throw new Error("No input text");let i=dE.M,n,s;return typeof t<"u"&&(i=dE.from(t.errorCorrectionLevel,dE.M),n=Xp.from(t.version),s=yE.from(t.maskPattern),t.toSJISFunc&&Zp.setToSJISFunction(t.toSJISFunc)),HK(e,n,i,s)}});var vE=D(xo=>{l();function A8(r){if(typeof r=="number"&&(r=r.toString()),typeof r!="string")throw new Error("Color should be defined as hex string");let e=r.slice().replace("#","").split("");if(e.length<3||e.length===5||e.length>8)throw new Error("Invalid hex color: "+r);(e.length===3||e.length===4)&&(e=Array.prototype.concat.apply([],e.map(function(i){return[i,i]}))),e.length===6&&e.push("F","F");let t=parseInt(e.join(""),16);return{r:t>>24&255,g:t>>16&255,b:t>>8&255,a:t&255,hex:"#"+e.slice(0,6).join("")}}xo.getOptions=function(e){e||(e={}),e.color||(e.color={});let t=typeof e.margin>"u"||e.margin===null||e.margin<0?4:e.margin,i=e.width&&e.width>=21?e.width:void 0,n=e.scale||4;return{width:i,scale:i?4:n,margin:t,color:{dark:A8(e.color.dark||"#000000ff"),light:A8(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}};xo.getScale=function(e,t){return t.width&&t.width>=e+t.margin*2?t.width/(e+t.margin*2):t.scale};xo.getImageWidth=function(e,t){let i=xo.getScale(e,t);return Math.floor((e+t.margin*2)*i)};xo.qrToImageData=function(e,t,i){let n=t.modules.size,s=t.modules.data,o=xo.getScale(n,i),a=Math.floor((n+i.margin*2)*o),u=i.margin*o,h=[i.color.light,i.color.dark];for(let p=0;p=u&&v>=u&&p{l();var wE=vE();function QK(r,e,t){r.clearRect(0,0,e.width,e.height),e.style||(e.style={}),e.height=t,e.width=t,e.style.height=t+"px",e.style.width=t+"px"}function jK(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}e0.render=function(e,t,i){let n=i,s=t;typeof n>"u"&&(!t||!t.getContext)&&(n=t,t=void 0),t||(s=jK()),n=wE.getOptions(n);let o=wE.getImageWidth(e.modules.size,n),a=s.getContext("2d"),u=a.createImageData(o,o);return wE.qrToImageData(u.data,e,n),QK(a,s,o),a.putImageData(u,0,0),s};e0.renderToDataURL=function(e,t,i){let n=i;typeof n>"u"&&(!t||!t.getContext)&&(n=t,t=void 0),n||(n={});let s=e0.render(e,t,n),o=n.type||"image/png",a=n.rendererOpts||{};return s.toDataURL(o,a.quality)}});var C8=D(b8=>{l();var GK=vE();function I8(r,e){let t=r.a/255,i=e+'="'+r.hex+'"';return t<1?i+" "+e+'-opacity="'+t.toFixed(2).slice(1)+'"':i}function EE(r,e,t){let i=r+e;return typeof t<"u"&&(i+=" "+t),i}function KK(r,e,t){let i="",n=0,s=!1,o=0;for(let a=0;a0&&u>0&&r[a-1]||(i+=s?EE("M",u+t,.5+h+t):EE("m",n,0),n=0,s=!1),u+1':"",h="',p='viewBox="0 0 '+a+" "+a+'"',B=''+u+h+` -`;return typeof i=="function"&&i(null,B),B}});var x8=D(Ul=>{l();var zK=xO(),AE=E8(),S8=_8(),$K=C8();function _E(r,e,t,i,n){let s=[].slice.call(arguments,1),o=s.length,a=typeof s[o-1]=="function";if(!a&&!zK())throw new Error("Callback required as last argument");if(a){if(o<2)throw new Error("Too few arguments provided");o===2?(n=t,t=e,e=i=void 0):o===3&&(e.getContext&&typeof n>"u"?(n=i,i=void 0):(n=i,i=t,t=e,e=void 0))}else{if(o<1)throw new Error("Too few arguments provided");return o===1?(t=e,e=i=void 0):o===2&&!e.getContext&&(i=t,t=e,e=void 0),new Promise(function(u,h){try{let p=AE.create(t,i);u(r(p,e,i))}catch(p){h(p)}})}try{let u=AE.create(t,i);n(null,r(u,e,i))}catch(u){n(u)}}Ul.create=AE.create;Ul.toCanvas=_E.bind(null,S8.render);Ul.toDataURL=_E.bind(null,S8.renderToDataURL);Ul.toString=_E.bind(null,function(r,e,t){return $K.render(r,t)})});var U8=D(ds=>{"use strict";l();var XK=ds&&ds.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),F8=ds&&ds.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&XK(e,r,t)};Object.defineProperty(ds,"__esModule",{value:!0});F8(bl(),ds);F8(jw(),ds)});l();var ZK=_e(dg(),1),G8=_e(Z_(),1),ez=_e(Hr(),1),tz=_e(Xf(),1),rz=_e(Wy(),1),iz=_e(dc(),1),nz=_e(em(),1),sz=_e(mn(),1),K8=_e(lc(),1),oz=_e(ac(),1),az=_e(gy(),1),uz=_e(eC(),1),cz=_e(Wo(),1);l();l();var aC=_e(sm(),1);l();l();var fh="elvenjs_state",sC="https://devnet-api.elrond.com";var hh="/dapp/init",dh="devnet",oC="https://maiar.page.link/?apn=com.elrond.maiar.wallet&isi=1519405832&ibi=com.elrond.maiar.wallet&link=https://maiar.com/";var ph=["wss://relay.walletconnect.com"],Si={devnet:{id:"devnet",shortId:"D",name:"Devnet",egldLabel:"xEGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://devnet-wallet.elrond.com",apiAddress:"https://devnet-api.elrond.com",explorerAddress:"https://devnet-explorer.elrond.com",apiTimeout:1e4},testnet:{id:"testnet",shortId:"T",name:"Testnet",egldLabel:"xEGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://testnet-wallet.elrond.com",apiAddress:"https://testnet-api.elrond.com",explorerAddress:"https://testnet-explorer.elrond.com",apiTimeout:1e4},mainnet:{id:"mainnet",shortId:"1",name:"Mainnet",egldLabel:"EGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://wallet.elrond.com",apiAddress:"https://api.elrond.com",explorerAddress:"https://explorer.elrond.com",apiTimeout:1e4}};var xe={get(r){let e=localStorage.getItem(fh);if(!e)return{};let t=JSON.parse(e);return r?t[r]:t},set(r,e){let t=this.get();t[r]=e,localStorage.setItem(fh,JSON.stringify(t))},clear(){localStorage.removeItem(fh)}};var gh=()=>Te(void 0,null,function*(){let r=aC.ExtensionProvider.getInstance();try{let e=yield r.init(),t=xe.get();if(t!=null&&t.address&&r.setAddress(t.address),!e){console.warn("Something went wrong when trying to initialize the ExtensionProvider..");return}return r}catch(e){console.warn("Can't initialize the Dapp Provider!")}});var H8=_e(sm(),1),Q8=_e(wp(),1),j8=_e(bl(),1);l();var YD=_e(wp(),1);l();l();var Fe=class{static set(e,t){if(!e)return;let i=LE(Ql({},this.events),{[e]:t});this.events=i}static get(e){if(!(!e||!this.events))return this.events[e]}static run(e,t){var i,n;!e||!this.events||(n=(i=this.events)[e])==null||n.call(i,t)}static clear(){this.events=void 0}};var Hu=r=>Te(void 0,null,function*(){if(!r.dappProvider)throw new Error("Error: Logout failed: There is no active session!");Fe.run("onLoginPending");let e=yield r.dappProvider.logout();return e&&(xe.clear(),Fe.run("onLogout")),e});l();var kD=_e(Hr(),1),WD=_e(Xf(),1);l();var Ar=r=>typeof r=="string"?r.toUpperCase():r instanceof Error?r.message:`Error: ${JSON.stringify(r)}`;l();var Qu=()=>new Date().setHours(new Date().getHours()+24),Mp=r=>Date.now()>r;var as=r=>Te(void 0,null,function*(){let e=xe.get("address"),t=xe.get("expires");if(!(t&&Mp(t))&&e&&r.networkProvider){let n=new kD.Address(e),s=new WD.Account(n);try{let o=yield r.networkProvider.getAccount(n);xe.set("address",e),xe.set("nonce",o.nonce.valueOf()),xe.set("balance",o.balance.toString()),s.update(o)}catch(o){let a=Ar(o);console.warn(`Something went wrong trying to synchronize the user account: ${a}`)}}});l();function Pp(r){return r[Math.floor(Math.random()*r.length)]}var JD=r=>Te(void 0,null,function*(){if(!r.initOptions.walletConnectV2ProjectId||!r.initOptions.chainType)return;let e={onClientLogin:()=>{as(r),Fe.run("onLoggedIn")},onClientLogout:()=>Hu(r),onClientEvent:n=>{console.log("wc2 session event: ",n)}},t=Pp(ph),i=new YD.WalletConnectV2Provider(e,Si[r.initOptions.chainType].shortId,t,r.initOptions.walletConnectV2ProjectId);try{return yield i.init(),i}catch(n){console.warn("Can't initialize the Dapp Provider!")}});l();var mO=_e(eO(),1),Qp=_e(Hr(),1),vO=_e(tO(),1),wO=_e(oO(),1),EO=_e(Jw(),1),AO=_e(hO(),1),_O=_e(pO(),1),IO=_e(gO(),1),bO=_e(yO(),1);var jp=class{constructor({apiUrl:e,chainType:t,apiTimeout:i}){var n,s;this.chainType=t||dh,this.apiUrl=e||((n=Si[this.chainType])==null?void 0:n.apiAddress),this.apiTimeout=i||((s=Si[this.chainType])==null?void 0:s.apiTimeout)}apiGet(e,t){return Te(this,null,function*(){if(typeof fetch!="undefined"){let i=new AbortController,n=setTimeout(()=>i.abort(),this.apiTimeout),s={method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json"},signal:i.signal};try{let o=yield fetch(this.apiUrl+"/"+e,Object.assign(s,t||{})),a=yield o.json();if(!o.ok){let u=(a==null?void 0:a.error)||o.status;return clearTimeout(n),Promise.reject(u)}return clearTimeout(n),a}catch(o){this.handleApiError(o,e)}}})}apiPost(e,t,i){return Te(this,null,function*(){if(typeof fetch!="undefined"){let n=new AbortController,s=setTimeout(()=>n.abort(),this.apiTimeout),o={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(t||{}),signal:n.signal};try{let a=yield fetch(this.apiUrl+"/"+e,Object.assign(o,i||{})),u=yield a.json();if(!a.ok){let h=(u==null?void 0:u.error)||a.status;return clearTimeout(s),Promise.reject(h)}return clearTimeout(s),u}catch(a){this.handleApiError(a,e)}}})}handleApiError(e,t){if(!e.response)throw new Error(`Request error on url [${t}]: [${e.toString()}]`);let i=e.response.data,n=i.error||i.message||JSON.stringify(i);throw new Error(n)}sendTransaction(e){return Te(this,null,function*(){return(yield this.apiPost("transactions",e.toSendable())).txHash})}getAccount(e){return Te(this,null,function*(){let t=yield this.apiGet(`accounts/${e.bech32()}`);return{address:new Qp.Address((t==null?void 0:t.address)||""),nonce:Number((t==null?void 0:t.nonce)||0),balance:new mO.default((t==null?void 0:t.balance)||0),code:(t==null?void 0:t.code)||"",userName:(t==null?void 0:t.username)||""}})}getTransaction(e){return Te(this,null,function*(){let t=yield this.apiGet(`transactions/${e}`),i=new vO.TransactionStatus(t.status);return{hash:e,type:t.type||"",nonce:t.nonce||0,round:t.round,epoch:t.epoch||0,value:(t.value||0).toString(),sender:new Qp.Address(t.sender),receiver:new Qp.Address(t.receiver),gasPrice:t.gasPrice||0,gasLimit:t.gasLimit||0,data:y.Buffer.from(t.data||"","base64"),status:i,timestamp:t.timestamp||0,blockNonce:t.blockNonce||0,hyperblockNonce:t.hyperblockNonce||0,hyperblockHash:t.hyperblockHash||"",receipt:wO.TransactionReceipt.fromHttpResponse(t.receipt||{}),logs:EO.TransactionLogs.fromHttpResponse(t.logs||{}),contractResults:AO.ContractResults.fromApiHttpResponse(t.results||[]),isCompleted:!i.isPending()}})}queryContract(o){return Te(this,arguments,function*({address:e,func:t,args:i,value:n,caller:s}){try{let a=new bO.Query({address:e,func:t,args:i,value:n,caller:s}),u=new IO.ContractQueryRequest(a).toHttpRequest(),h=yield this.apiPost("query",u);return _O.ContractQueryResponse.fromHttpResponse(h)}catch(a){this.handleApiError(a,"query")}})}};l();var Io=(n=>(n.ledger="ledger",n.maiarMobile="maiar-mobile",n.webWallet="web-wallet",n.maiarBrowserExtension="maiar-browser-extension",n))(Io||{});l();var CO=(r,e)=>Te(void 0,null,function*(){let t=yield gh();try{t&&(yield t.login())}catch(n){let s=Ar(n);console.warn(`Something went wrong trying to login the user: ${s}`)}if(!t)throw new Error("Error: There were problems with auth provider initialization!");let{signature:i}=t.account;if(e&&xe.set("loginToken",e),i&&xe.set("signature",i),r.networkProvider)try{let n=yield t.getAddress();if(!n)throw new Error("Canceled!");return Fe.run("onLoginPending"),xe.set("address",n),xe.set("loginMethod","maiar-browser-extension"),xe.set("expires",Qu()),yield as(r),Fe.run("onLoggedIn"),t}catch(n){console.warn(`Something went wrong trying to synchronize the user account: ${n==null?void 0:n.message}`)}});l();l();var T8=_e(x8(),1);var kK=r=>{var t;let e=document.createElement("template");return e.innerHTML=r.trim(),(t=e.content.firstChild)==null?void 0:t.cloneNode(!0)},WK=r=>{let e=`${oC}?wallet-connect=${encodeURIComponent(r)}`,t=document.createElement("a");return t.setAttribute("href",e),t.setAttribute("rel","noopener noreferrer nofollow"),t.setAttribute("target","_blank"),t.textContent="Maiar login",t.classList.add("elven-qr-code-deep-link"),t},YK=()=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),JK=r=>Te(void 0,null,function*(){return r?yield T8.default.toString(r,{type:"svg"}):void 0}),N8=(r,e)=>Te(void 0,null,function*(){if(!r)throw new Error("Please provide the QR Code container id!");let t=yield JK(e),i=null;typeof r=="string"?i=document.getElementById(r):r instanceof HTMLElement&&(i=r);let n;return t&&(n=kK(t)),i&&n&&(i.appendChild(n),YK()&&i.appendChild(WK(e))),i});var t0=_e(wp(),1);var D8=(r,e,t)=>Te(void 0,null,function*(){if(!e)throw new Error("You haven't provided the QR code container DOM element id");let i=Pp(ph);if(!i||!r.networkProvider)throw new Error("Something wen't wrong with the initialization (ApiNetworkProvider or Wallet Connect Bridge address), plese try to refresh the page!");if(!r.initOptions.walletConnectV2ProjectId)throw new Error("Please provide your WalletConnect project id. You can get it here: https://cloud.walletconnect.com)");if(!r.initOptions.chainType)throw new Error("Please provide the chain type in ElvenJS.init function!");let n,s={onClientLogin:()=>Te(void 0,null,function*(){if(r.dappProvider instanceof t0.WalletConnectV2Provider){Fe.run("onLoginPending");let a=yield r.dappProvider.getAddress(),u=yield r.dappProvider.getSignature();xe.set("address",a),xe.set("loginMethod","maiar-mobile"),xe.set("expires",Qu()),yield as(r),u&&xe.set("signature",u),t&&xe.set("loginToken",t),Fe.run("onLoggedIn"),n==null||n.replaceChildren()}}),onClientLogout:()=>Te(void 0,null,function*(){r.dappProvider instanceof t0.WalletConnectV2Provider&&(yield Hu(r),Fe.run("onLogout"))}),onClientEvent:a=>{console.log("wc2 session event: ",a)}},o=new t0.WalletConnectV2Provider(s,Si[r.initOptions.chainType].shortId,i,r.initOptions.walletConnectV2ProjectId);try{if(o){r.dappProvider=o;let{uri:a,approval:u}=yield o.connect({methods:["erd_cancelAction"]}),h=t?`${a}&token=${t}`:a;return e&&a&&h&&(n=yield N8(e,h)),yield o.login({approval:u,token:t}),o}}catch(a){let u=Ar(a);console.warn(`Something went wrong trying to login the user: ${u}`)}});l();var O8=_e(bl(),1);var B8=(r,e,t)=>Te(void 0,null,function*(){let i=new O8.WalletProvider(`${r}${hh}`),n=typeof window!="undefined"?encodeURIComponent(`${window.location.origin}${e||"/"}`):"/",s=Ql({callbackUrl:n},t?{token:t}:{});try{return Fe.run("onLoginPending"),xe.set("loginMethod","web-wallet"),yield i.login(s),xe.set("expires",Qu()),t&&xe.set("loginToken",t),i}catch(o){let a=Ar(o);console.warn(`Something went wrong trying to login the user: ${a}`),xe.set("loginMethod","")}});l();var To=r=>{if(typeof window!="undefined"){let e=new URL(window.location.href);return new URLSearchParams(e.search).get(r)}};l();var M8=_e(bl(),1);var P8=r=>Te(void 0,null,function*(){let e=To("signature"),t=To("address"),i=xe.get("address");if(e&&xe.set("signature",e),t||i)return t&&(xe.set("address",t),window.history.replaceState(null,"",window.location.pathname)),new M8.WalletProvider(`${r}${hh}`)});l();var L8=_e(Xf(),1),R8=_e(em(),1);var r0=(r,e)=>Te(void 0,null,function*(){yield new R8.TransactionWatcher(e).awaitCompleted(r);let i=r.getSender(),n=new L8.Account(i),s=yield e.getAccount(i);n.update(s),xe.set("address",n.address.bech32()),xe.set("nonce",n.getNonceThenIncrement().valueOf()),xe.set("balance",n.balance.toString()),Fe.run("onTxFinalized",r)});l();var i0=_e(U8(),1),q8=_e(Wy(),1);var V8=(r,e,t)=>Te(void 0,null,function*(){if(To(i0.WALLET_PROVIDER_CALLBACK_PARAM)===i0.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED&&r&&e&&"getTransactionsFromWalletUrl"in r){let n=r.getTransactionsFromWalletUrl();window.history.replaceState(null,"",window.location.pathname);let s=n==null?void 0:n[0];if(s){s.data=y.Buffer.from(s.data).toString("base64");let o=q8.Transaction.fromPlainObject(s);o.setNonce(t);try{Fe.run("onTxStarted",o),yield e.sendTransaction(o),yield r0(o,e)}catch(a){let u=Ar(a);throw Fe.run("onTxFinalized",o),new Error(`Error: Transaction signing failed! ${u}`)}}}});var Vl=class{static init(e){return Te(this,null,function*(){let t=xe.get();if(t.expires&&Mp(t.expires)){xe.clear(),this.dappProvider=void 0;return}this.initOptions=e||{chainType:dh,apiUrl:sC},this.networkProvider=new jp(this.initOptions),this.initOptions.onLoginPending&&Fe.set("onLoginPending",this.initOptions.onLoginPending),this.initOptions.onLoggedIn&&Fe.set("onLoggedIn",this.initOptions.onLoggedIn),this.initOptions.onLogout&&Fe.set("onLogout",this.initOptions.onLogout),this.initOptions.onTxStarted&&Fe.set("onTxStarted",this.initOptions.onTxStarted),this.initOptions.onTxFinalized&&Fe.set("onTxFinalized",this.initOptions.onTxFinalized),((t==null?void 0:t.address)||t.loginMethod==="web-wallet"&&To("address"))&&(t==null?void 0:t.loginMethod)&&(Fe.run("onLoginPending"),t.loginMethod==="maiar-browser-extension"&&(this.dappProvider=yield gh()),t.loginMethod==="maiar-mobile"&&(this.dappProvider=yield JD(this)),t.loginMethod==="web-wallet"&&(this.dappProvider=yield P8(Si[this.initOptions.chainType].walletAddress)),yield as(this),Fe.run("onLoggedIn"),t.loginMethod==="web-wallet"&&(yield V8(this.dappProvider,this.networkProvider,t.nonce)))})}static login(e,t){return Te(this,null,function*(){if(!Object.values(Io).includes(e))throw new Error("Error: Wrong login method!");if(!this.networkProvider)throw new Error("Error: Login failed: Use ElvenJs.init() first!");try{if(e==="maiar-browser-extension"){let n=yield CO(this,t==null?void 0:t.token);this.dappProvider=n}if(e==="maiar-mobile"){let n=yield D8(this,t==null?void 0:t.qrCodeContainer,t==null?void 0:t.token);this.dappProvider=n}if(e==="web-wallet"&&this.initOptions){let n=yield B8(Si[this.initOptions.chainType].walletAddress,t==null?void 0:t.callbackRoute,t==null?void 0:t.token);this.dappProvider=n}}catch(n){let s=Ar(n);throw new Error(`Error: ${s}`)}})}static logout(){return Te(this,null,function*(){let e=yield Hu(this);return this.dappProvider=void 0,e})}static signAndSendTransaction(e){return Te(this,null,function*(){if(!this.dappProvider)throw new Error("Error: Transaction signing failed: There is no active session!");if(!this.networkProvider)throw new Error("Error: Transaction signing failed: There is no active network provider!");try{Fe.run("onTxStarted",e);let t=xe.get();e.setNonce(t.nonce),this.dappProvider instanceof H8.ExtensionProvider&&(yield this.dappProvider.signTransaction(e)),this.dappProvider instanceof Q8.WalletConnectV2Provider&&(yield this.dappProvider.signTransactions([e])),this.dappProvider instanceof j8.WalletProvider&&(yield this.dappProvider.signTransaction(e)),t.loginMethod!=="web-wallet"&&(yield this.networkProvider.sendTransaction(e),yield r0(e,this.networkProvider))}catch(t){let i=Ar(t);throw Fe.run("onTxFinalized",e),new Error(`Error: Transaction signing failed! ${i}`)}return e})}static queryContract(o){return Te(this,arguments,function*({address:e,func:t,args:i=[],value:n=0,caller:s}){if(!this.networkProvider)throw new Error("Error: Query failed: There is no active network provider!");if(!e||!t)throw new Error("Error: Query failed: The Query arguments are not valid! Address and func required");try{return yield this.networkProvider.queryContract({address:e,func:t,args:i,value:n,caller:s})}catch(a){let u=Ar(a);throw new Error(`Error: Smart contract query failed! ${u}`)}})}},ql=Vl;ql.storage=xe,ql.destroy=()=>{Vl.networkProvider=void 0,Vl.dappProvider=void 0,Vl.initOptions=void 0,Fe.clear()};var export_Account=tz.Account;var export_Address=ez.Address;var export_AddressValue=cz.AddressValue;var export_BigUIntValue=K8.BigUIntValue;var export_BooleanValue=oz.BooleanValue;var export_BytesValue=sz.BytesValue;var export_ContractCallPayloadBuilder=az.ContractCallPayloadBuilder;var export_ContractFunction=uz.ContractFunction;var export_ESDTNFTTransferPayloadBuilder=G8.ESDTNFTTransferPayloadBuilder;var export_ESDTTransferPayloadBuilder=G8.ESDTTransferPayloadBuilder;var export_TokenPayment=ZK.TokenPayment;var export_Transaction=rz.Transaction;var export_TransactionPayload=iz.TransactionPayload;var export_TransactionWatcher=nz.TransactionWatcher;var export_U32Value=K8.U32Value;export{export_Account as Account,export_Address as Address,export_AddressValue as AddressValue,export_BigUIntValue as BigUIntValue,export_BooleanValue as BooleanValue,export_BytesValue as BytesValue,export_ContractCallPayloadBuilder as ContractCallPayloadBuilder,export_ContractFunction as ContractFunction,export_ESDTNFTTransferPayloadBuilder as ESDTNFTTransferPayloadBuilder,export_ESDTTransferPayloadBuilder as ESDTTransferPayloadBuilder,ql as ElvenJS,Io as LoginMethodsEnum,export_TokenPayment as TokenPayment,export_Transaction as Transaction,export_TransactionPayload as TransactionPayload,export_TransactionWatcher as TransactionWatcher,export_U32Value as U32Value}; -/*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh - * @license MIT - */ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */ -/*! https://mths.be/punycode v1.4.1 by @mathias */ -/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ diff --git a/build/types/auth/account-sync.d.ts b/build/types/auth/account-sync.d.ts deleted file mode 100644 index 3e210b9..0000000 --- a/build/types/auth/account-sync.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare const accountSync: (elven: any) => Promise; diff --git a/build/types/auth/expires-at.d.ts b/build/types/auth/expires-at.d.ts deleted file mode 100644 index c40ec0d..0000000 --- a/build/types/auth/expires-at.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare const getNewLoginExpiresTimestamp: () => number; -export declare const isLoginExpired: (expirationTimestamp: number) => boolean; diff --git a/build/types/auth/init-extension-provider.d.ts b/build/types/auth/init-extension-provider.d.ts deleted file mode 100644 index 9869f9a..0000000 --- a/build/types/auth/init-extension-provider.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -import { ExtensionProvider } from '@elrondnetwork/erdjs-extension-provider/out/extensionProvider'; -export declare const initExtensionProvider: () => Promise; diff --git a/build/types/auth/init-maiar-mobile-provider.d.ts b/build/types/auth/init-maiar-mobile-provider.d.ts deleted file mode 100644 index 1ce6378..0000000 --- a/build/types/auth/init-maiar-mobile-provider.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -import { WalletConnectV2Provider } from '@elrondnetwork/erdjs-wallet-connect-provider/out/walletConnectV2Provider'; -export declare const initMaiarMobileProvider: (elven: any) => Promise; diff --git a/build/types/auth/init-web-wallet-provider.d.ts b/build/types/auth/init-web-wallet-provider.d.ts deleted file mode 100644 index 379af07..0000000 --- a/build/types/auth/init-web-wallet-provider.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -import { WalletProvider } from '@elrondnetwork/erdjs-web-wallet-provider/out/walletProvider'; -export declare const initWebWalletProvider: (webWalletAddress: string) => Promise; diff --git a/build/types/auth/login-with-extension.d.ts b/build/types/auth/login-with-extension.d.ts deleted file mode 100644 index 1a8ca5f..0000000 --- a/build/types/auth/login-with-extension.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare const loginWithExtension: (elven: any, token?: string) => Promise; diff --git a/build/types/auth/login-with-mobile.d.ts b/build/types/auth/login-with-mobile.d.ts deleted file mode 100644 index b2bbc94..0000000 --- a/build/types/auth/login-with-mobile.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -import { WalletConnectV2Provider } from '@elrondnetwork/erdjs-wallet-connect-provider/out/walletConnectV2Provider'; -export declare const loginWithMobile: (elven: any, qrCodeContainer?: string | HTMLElement, token?: string) => Promise; diff --git a/build/types/auth/login-with-web-wallet.d.ts b/build/types/auth/login-with-web-wallet.d.ts deleted file mode 100644 index f683046..0000000 --- a/build/types/auth/login-with-web-wallet.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -import { WalletProvider } from '@elrondnetwork/erdjs-web-wallet-provider/out/walletProvider'; -export declare const loginWithWebWallet: (webWalletAddress: string, callbackRoute?: string, token?: string) => Promise; diff --git a/build/types/auth/logout.d.ts b/build/types/auth/logout.d.ts deleted file mode 100644 index 4ee4ee6..0000000 --- a/build/types/auth/logout.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare const logout: (elven: any) => Promise; diff --git a/build/types/auth/qr-code-builder.d.ts b/build/types/auth/qr-code-builder.d.ts deleted file mode 100644 index c8d29c1..0000000 --- a/build/types/auth/qr-code-builder.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare const qrCodeBuilder: (qrCodeContainer: string | HTMLElement, walletConnectUri: string) => Promise; diff --git a/build/types/elven.d.ts b/build/types/elven.d.ts deleted file mode 100644 index ce96d1a..0000000 --- a/build/types/elven.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -export { TokenPayment } from '@elrondnetwork/erdjs/out/tokenPayment'; -export { ESDTNFTTransferPayloadBuilder, ESDTTransferPayloadBuilder, } from '@elrondnetwork/erdjs/out/tokenTransferBuilders'; -export { Address } from '@elrondnetwork/erdjs/out/address'; -export { Account } from '@elrondnetwork/erdjs/out/account'; -export { Transaction } from '@elrondnetwork/erdjs/out/transaction'; -export { TransactionPayload } from '@elrondnetwork/erdjs/out/transactionPayload'; -export { TransactionWatcher } from '@elrondnetwork/erdjs/out/transactionWatcher'; -export { BytesValue } from '@elrondnetwork/erdjs/out/smartcontracts/typesystem/bytes'; -export { BigUIntValue, U32Value, } from '@elrondnetwork/erdjs/out/smartcontracts/typesystem/numerical'; -export { BooleanValue } from '@elrondnetwork/erdjs/out/smartcontracts/typesystem/boolean'; -export { ContractCallPayloadBuilder } from '@elrondnetwork/erdjs/out/smartcontracts/transactionPayloadBuilders'; -export { ContractFunction } from '@elrondnetwork/erdjs/out/smartcontracts/function'; -export { AddressValue } from '@elrondnetwork/erdjs/out/smartcontracts/typesystem/address'; -export { ElvenJS } from './main'; -export { LoginMethodsEnum } from './types'; diff --git a/build/types/events-store.d.ts b/build/types/events-store.d.ts deleted file mode 100644 index 0a97557..0000000 --- a/build/types/events-store.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -export declare class EventsStore { - private static events; - static set(name: string, fn: (arg?: any) => void): void; - static get(name: string): ((arg?: any) => void) | undefined; - static run(name: string, arg?: any): void; - static clear(): void; -} diff --git a/build/types/interaction/post-send-tx.d.ts b/build/types/interaction/post-send-tx.d.ts deleted file mode 100644 index e475438..0000000 --- a/build/types/interaction/post-send-tx.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { Transaction } from '@elrondnetwork/erdjs/out/transaction'; -import { ApiNetworkProvider } from '../network-provider'; -export declare const postSendTx: (transaction: Transaction, networkProvider: ApiNetworkProvider) => Promise; diff --git a/build/types/interaction/web-wallet-tx-finalize.d.ts b/build/types/interaction/web-wallet-tx-finalize.d.ts deleted file mode 100644 index 5f5640a..0000000 --- a/build/types/interaction/web-wallet-tx-finalize.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { DappProvider } from '../types'; -import { ApiNetworkProvider } from '../network-provider'; -export declare const webWalletTxFinalize: (dappProvider: DappProvider, networkProvider: ApiNetworkProvider, nonce: number) => Promise; diff --git a/build/types/main.d.ts b/build/types/main.d.ts deleted file mode 100644 index 0174640..0000000 --- a/build/types/main.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { Transaction } from '@elrondnetwork/erdjs/out/transaction'; -import { ApiNetworkProvider, SmartContractQueryArgs } from './network-provider'; -import { DappProvider, LoginMethodsEnum, LoginOptions, InitOptions } from './types'; -export declare class ElvenJS { - private static initOptions; - static dappProvider: DappProvider; - static networkProvider: ApiNetworkProvider | undefined; - /** - * Initialization of the Elven.js - */ - static init(options: InitOptions): Promise; - /** - * Login function - */ - static login(loginMethod: LoginMethodsEnum, options?: LoginOptions): Promise; - /** - * Logout function - */ - static logout(): Promise; - /** - * Sign and send function - */ - static signAndSendTransaction(transaction: Transaction): Promise; - /** - * Query Smart Contracts - */ - static queryContract({ address, func, args, value, caller, }: SmartContractQueryArgs): Promise; - /** - * Main storage - */ - static storage: { - get(key?: string | undefined): any; - set(key: string, value: string | number): void; - clear(): void; - }; - /** - * Destroy and cleanup if needed - */ - static destroy: () => void; -} diff --git a/build/types/network-provider.d.ts b/build/types/network-provider.d.ts deleted file mode 100644 index 2f92770..0000000 --- a/build/types/network-provider.d.ts +++ /dev/null @@ -1,61 +0,0 @@ -/// -import BigNumber from 'bn.js'; -import { Address } from '@elrondnetwork/erdjs/out/address'; -import { TransactionStatus } from '@elrondnetwork/erdjs-network-providers/out/transactionStatus'; -import { TransactionReceipt } from '@elrondnetwork/erdjs-network-providers/out/transactionReceipt'; -import { TransactionLogs } from '@elrondnetwork/erdjs-network-providers/out/transactionLogs'; -import { ContractResults } from '@elrondnetwork/erdjs-network-providers/out/contractResults'; -import { ContractQueryResponse } from '@elrondnetwork/erdjs-network-providers/out/contractQueryResponse'; -import { QueryArguments } from '@elrondnetwork/erdjs/out/smartcontracts/interface'; -import { InitOptions } from './types'; -export interface IAddress { - bech32: () => string; -} -export interface SmartContractQueryArgs extends QueryArguments { - address: IAddress; -} -export declare type NetworkProviderOptions = Pick; -export interface AccountOnNetwork { - address: IAddress; - nonce: number; - balance: BigNumber; - code: string; - userName: string; -} -export interface ITransaction { - toSendable(): any; -} -export declare class ApiNetworkProvider { - private apiUrl; - private chainType; - private apiTimeout; - constructor({ apiUrl, chainType, apiTimeout }: NetworkProviderOptions); - private apiGet; - private apiPost; - private handleApiError; - sendTransaction(tx: ITransaction): Promise; - getAccount(address: IAddress): Promise; - getTransaction(txHash: string): Promise<{ - hash: string; - type: any; - nonce: any; - round: any; - epoch: any; - value: any; - sender: Address; - receiver: Address; - gasPrice: any; - gasLimit: any; - data: Buffer; - status: TransactionStatus; - timestamp: any; - blockNonce: any; - hyperblockNonce: any; - hyperblockHash: any; - receipt: TransactionReceipt; - logs: TransactionLogs; - contractResults: ContractResults; - isCompleted: boolean; - }>; - queryContract({ address, func, args, value, caller, }: SmartContractQueryArgs): Promise; -} diff --git a/build/types/types.d.ts b/build/types/types.d.ts deleted file mode 100644 index 1fcef04..0000000 --- a/build/types/types.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { ExtensionProvider } from '@elrondnetwork/erdjs-extension-provider/out/extensionProvider'; -import { Transaction } from '@elrondnetwork/erdjs/out/transaction'; -import { WalletConnectV2Provider } from '@elrondnetwork/erdjs-wallet-connect-provider/out/walletConnectV2Provider'; -import { WalletProvider } from '@elrondnetwork/erdjs-web-wallet-provider/out/walletProvider'; -export interface InitOptions { - apiUrl: string; - chainType: string; - apiTimeout: number; - walletConnectV2ProjectId?: string; - onLoginPending?: () => void; - onLoggedIn?: () => void; - onLogout?: () => void; - onTxStarted?: (transaction: Transaction) => void; - onTxFinalized?: (transaction: Transaction) => void; -} -export declare enum LoginMethodsEnum { - ledger = "ledger", - maiarMobile = "maiar-mobile", - webWallet = "web-wallet", - maiarBrowserExtension = "maiar-browser-extension" -} -export declare type DappProvider = ExtensionProvider | WalletConnectV2Provider | WalletProvider | undefined; -export interface LoginOptions { - qrCodeContainer?: string | HTMLElement; - token?: string; - callbackRoute?: string; -} -export declare enum DappCoreWCV2CustomMethodsEnum { - erd_cancelAction = "erd_cancelAction" -} diff --git a/build/types/utils/constants.d.ts b/build/types/utils/constants.d.ts deleted file mode 100644 index d55b587..0000000 --- a/build/types/utils/constants.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -interface NetworkType { - id: string; - shortId: string; - name: string; - egldLabel: string; - egldDenomination: string; - decimals: string; - gasPerDataByte: string; - walletAddress: string; - apiAddress: string; - explorerAddress: string; - apiTimeout: number; -} -export declare const LOCAL_STORAGE_KEY = "elvenjs_state"; -export declare const defaultApiEndpoint = "https://devnet-api.elrond.com"; -export declare const DEFAULT_MIN_GAS_LIMIT = 50000; -export declare const DAPP_CONFIG_ENDPOINT = "/dapp/config"; -export declare const DAPP_INIT_ROUTE = "/dapp/init"; -export declare const defaultChainTypeConfig = "devnet"; -export declare const walletConnectDeepLink = "https://maiar.page.link/?apn=com.elrond.maiar.wallet&isi=1519405832&ibi=com.elrond.maiar.wallet&link=https://maiar.com/"; -export declare const walletConnectBridgeAddresses: string[]; -export declare const walletConnectV2RelayAddresses: string[]; -export declare const networkConfig: Record; -export {}; diff --git a/build/types/utils/error-parse.d.ts b/build/types/utils/error-parse.d.ts deleted file mode 100644 index c440983..0000000 --- a/build/types/utils/error-parse.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare const errorParse: (err: unknown) => string; diff --git a/build/types/utils/get-param-from-url.d.ts b/build/types/utils/get-param-from-url.d.ts deleted file mode 100644 index 4b79a6c..0000000 --- a/build/types/utils/get-param-from-url.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare const getParamFromUrl: (paramName: string) => string | null | undefined; diff --git a/build/types/utils/get-random-address-from-network.d.ts b/build/types/utils/get-random-address-from-network.d.ts deleted file mode 100644 index 0fef300..0000000 --- a/build/types/utils/get-random-address-from-network.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare function getRandomAddressFromNetwork(addresses: string[]): string; diff --git a/build/types/utils/ls-helpers.d.ts b/build/types/utils/ls-helpers.d.ts deleted file mode 100644 index 425d2e4..0000000 --- a/build/types/utils/ls-helpers.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -export declare const ls: { - get(key?: string): any; - set(key: string, value: string | number): void; - clear(): void; -}; diff --git a/example/elven.js b/example/elven.js deleted file mode 100644 index b35d9d2..0000000 --- a/example/elven.js +++ /dev/null @@ -1,55 +0,0 @@ -var z8=Object.create;var ec=Object.defineProperty,$8=Object.defineProperties,k8=Object.getOwnPropertyDescriptor,W8=Object.getOwnPropertyDescriptors,Y8=Object.getOwnPropertyNames,BE=Object.getOwnPropertySymbols,J8=Object.getPrototypeOf,PE=Object.prototype.hasOwnProperty,X8=Object.prototype.propertyIsEnumerable;var ME=(r,e,t)=>e in r?ec(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ql=(r,e)=>{for(var t in e||={})PE.call(e,t)&&ME(r,t,e[t]);if(BE)for(var t of BE(e))X8.call(e,t)&&ME(r,t,e[t]);return r},LE=(r,e)=>$8(r,W8(e));var jl=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+r+'" is not supported')});var ye=(r,e)=>()=>(r&&(e=r(r=0)),e);var D=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),st=(r,e)=>{for(var t in e)ec(r,t,{get:e[t],enumerable:!0})},Hl=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Y8(e))!PE.call(r,n)&&n!==t&&ec(r,n,{get:()=>e[n],enumerable:!(i=k8(e,n))||i.enumerable});return r},Xt=(r,e,t)=>(Hl(r,e,"default"),t&&Hl(t,e,"default")),_e=(r,e,t)=>(t=r!=null?z8(J8(r)):{},Hl(e||!r||!r.__esModule?ec(t,"default",{value:r,enumerable:!0}):t,r)),ti=r=>Hl(ec({},"__esModule",{value:!0}),r);var Te=(r,e,t)=>new Promise((i,n)=>{var s=u=>{try{a(t.next(u))}catch(h){n(h)}},o=u=>{try{a(t.throw(u))}catch(h){n(h)}},a=u=>u.done?i(u.value):Promise.resolve(u.value).then(s,o);a((t=t.apply(r,e)).next())});var b0=D(Gl=>{"use strict";l();Gl.byteLength=eB;Gl.toByteArray=rB;Gl.fromByteArray=sB;var ri=[],Sr=[],Z8=typeof Uint8Array<"u"?Uint8Array:Array,I0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(gs=0,RE=I0.length;gs0)throw new Error("Invalid string. Length must be a multiple of 4");var t=r.indexOf("=");t===-1&&(t=e);var i=t===e?0:4-t%4;return[t,i]}function eB(r){var e=FE(r),t=e[0],i=e[1];return(t+i)*3/4-i}function tB(r,e,t){return(e+t)*3/4-t}function rB(r){var e,t=FE(r),i=t[0],n=t[1],s=new Z8(tB(r,i,n)),o=0,a=n>0?i-4:i,u;for(u=0;u>16&255,s[o++]=e>>8&255,s[o++]=e&255;return n===2&&(e=Sr[r.charCodeAt(u)]<<2|Sr[r.charCodeAt(u+1)]>>4,s[o++]=e&255),n===1&&(e=Sr[r.charCodeAt(u)]<<10|Sr[r.charCodeAt(u+1)]<<4|Sr[r.charCodeAt(u+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function iB(r){return ri[r>>18&63]+ri[r>>12&63]+ri[r>>6&63]+ri[r&63]}function nB(r,e,t){for(var i,n=[],s=e;sa?a:o+s));return i===1?(e=r[t-1],n.push(ri[e>>2]+ri[e<<4&63]+"==")):i===2&&(e=(r[t-2]<<8)+r[t-1],n.push(ri[e>>10]+ri[e>>4&63]+ri[e<<2&63]+"=")),n.join("")}});var S0=D(C0=>{l();C0.read=function(r,e,t,i,n){var s,o,a=n*8-i-1,u=(1<>1,p=-7,v=t?n-1:0,B=t?-1:1,R=r[e+v];for(v+=B,s=R&(1<<-p)-1,R>>=-p,p+=a;p>0;s=s*256+r[e+v],v+=B,p-=8);for(o=s&(1<<-p)-1,s>>=-p,p+=i;p>0;o=o*256+r[e+v],v+=B,p-=8);if(s===0)s=1-h;else{if(s===u)return o?NaN:(R?-1:1)*(1/0);o=o+Math.pow(2,i),s=s-h}return(R?-1:1)*o*Math.pow(2,s-i)};C0.write=function(r,e,t,i,n,s){var o,a,u,h=s*8-n-1,p=(1<>1,B=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,R=i?0:s-1,x=i?1:-1,V=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=p):(o=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-o))<1&&(o--,u*=2),o+v>=1?e+=B/u:e+=B*Math.pow(2,1-v),e*u>=2&&(o++,u/=2),o+v>=p?(a=0,o=p):o+v>=1?(a=(e*u-1)*Math.pow(2,n),o=o+v):(a=e*Math.pow(2,v-1)*Math.pow(2,n),o=0));n>=8;r[t+R]=a&255,R+=x,a/=256,n-=8);for(o=o<0;r[t+R]=o&255,R+=x,o/=256,h-=8);r[t+R-x]|=V*128}});var YE=D(Do=>{"use strict";l();var x0=b0(),No=S0(),UE=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Do.Buffer=se;Do.SlowBuffer=fB;Do.INSPECT_MAX_BYTES=50;var Kl=2147483647;Do.kMaxLength=Kl;se.TYPED_ARRAY_SUPPORT=oB();!se.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 oB(){try{var r=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(r,e),r.foo()===42}catch{return!1}}Object.defineProperty(se.prototype,"parent",{enumerable:!0,get:function(){if(!!se.isBuffer(this))return this.buffer}});Object.defineProperty(se.prototype,"offset",{enumerable:!0,get:function(){if(!!se.isBuffer(this))return this.byteOffset}});function Fi(r){if(r>Kl)throw new RangeError('The value "'+r+'" is invalid for option "size"');var e=new Uint8Array(r);return Object.setPrototypeOf(e,se.prototype),e}function se(r,e,t){if(typeof r=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return O0(r)}return HE(r,e,t)}se.poolSize=8192;function HE(r,e,t){if(typeof r=="string")return uB(r,e);if(ArrayBuffer.isView(r))return cB(r);if(r==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r);if(ii(r,ArrayBuffer)||r&&ii(r.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ii(r,SharedArrayBuffer)||r&&ii(r.buffer,SharedArrayBuffer)))return N0(r,e,t);if(typeof r=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var i=r.valueOf&&r.valueOf();if(i!=null&&i!==r)return se.from(i,e,t);var n=lB(r);if(n)return n;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return se.from(r[Symbol.toPrimitive]("string"),e,t);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r)}se.from=function(r,e,t){return HE(r,e,t)};Object.setPrototypeOf(se.prototype,Uint8Array.prototype);Object.setPrototypeOf(se,Uint8Array);function QE(r){if(typeof r!="number")throw new TypeError('"size" argument must be of type number');if(r<0)throw new RangeError('The value "'+r+'" is invalid for option "size"')}function aB(r,e,t){return QE(r),r<=0?Fi(r):e!==void 0?typeof t=="string"?Fi(r).fill(e,t):Fi(r).fill(e):Fi(r)}se.alloc=function(r,e,t){return aB(r,e,t)};function O0(r){return QE(r),Fi(r<0?0:B0(r)|0)}se.allocUnsafe=function(r){return O0(r)};se.allocUnsafeSlow=function(r){return O0(r)};function uB(r,e){if((typeof e!="string"||e==="")&&(e="utf8"),!se.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var t=jE(r,e)|0,i=Fi(t),n=i.write(r,e);return n!==t&&(i=i.slice(0,n)),i}function T0(r){for(var e=r.length<0?0:B0(r.length)|0,t=Fi(e),i=0;i=Kl)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Kl.toString(16)+" bytes");return r|0}function fB(r){return+r!=r&&(r=0),se.alloc(+r)}se.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==se.prototype};se.compare=function(e,t){if(ii(e,Uint8Array)&&(e=se.from(e,e.offset,e.byteLength)),ii(t,Uint8Array)&&(t=se.from(t,t.offset,t.byteLength)),!se.isBuffer(e)||!se.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var i=e.length,n=t.length,s=0,o=Math.min(i,n);sn.length?se.from(o).copy(n,s):Uint8Array.prototype.set.call(n,o,s);else if(se.isBuffer(o))o.copy(n,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return n};function jE(r,e){if(se.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||ii(r,ArrayBuffer))return r.byteLength;if(typeof r!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof r);var t=r.length,i=arguments.length>2&&arguments[2]===!0;if(!i&&t===0)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return D0(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return WE(r).length;default:if(n)return i?-1:D0(r).length;e=(""+e).toLowerCase(),n=!0}}se.byteLength=jE;function hB(r,e,t){var i=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0,e>>>=0,t<=e))return"";for(r||(r="utf8");;)switch(r){case"hex":return _B(this,e,t);case"utf8":case"utf-8":return KE(this,e,t);case"ascii":return EB(this,e,t);case"latin1":case"binary":return AB(this,e,t);case"base64":return vB(this,e,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return IB(this,e,t);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),i=!0}}se.prototype._isBuffer=!0;function ys(r,e,t){var i=r[e];r[e]=r[t],r[t]=i}se.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 t=0;tt&&(e+=" ... "),""};UE&&(se.prototype[UE]=se.prototype.inspect);se.prototype.compare=function(e,t,i,n,s){if(ii(e,Uint8Array)&&(e=se.from(e,e.offset,e.byteLength)),!se.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(t===void 0&&(t=0),i===void 0&&(i=e?e.length:0),n===void 0&&(n=0),s===void 0&&(s=this.length),t<0||i>e.length||n<0||s>this.length)throw new RangeError("out of range index");if(n>=s&&t>=i)return 0;if(n>=s)return-1;if(t>=i)return 1;if(t>>>=0,i>>>=0,n>>>=0,s>>>=0,this===e)return 0;for(var o=s-n,a=i-t,u=Math.min(o,a),h=this.slice(n,s),p=e.slice(t,i),v=0;v2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,M0(t)&&(t=n?0:r.length-1),t<0&&(t=r.length+t),t>=r.length){if(n)return-1;t=r.length-1}else if(t<0)if(n)t=0;else return-1;if(typeof e=="string"&&(e=se.from(e,i)),se.isBuffer(e))return e.length===0?-1:qE(r,e,t,i,n);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?n?Uint8Array.prototype.indexOf.call(r,e,t):Uint8Array.prototype.lastIndexOf.call(r,e,t):qE(r,[e],t,i,n);throw new TypeError("val must be string, number or Buffer")}function qE(r,e,t,i,n){var s=1,o=r.length,a=e.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(r.length<2||e.length<2)return-1;s=2,o/=2,a/=2,t/=2}function u(R,x){return s===1?R[x]:R.readUInt16BE(x*s)}var h;if(n){var p=-1;for(h=t;ho&&(t=o-a),h=t;h>=0;h--){for(var v=!0,B=0;Bn&&(i=n)):i=n;var s=e.length;i>s/2&&(i=s/2);for(var o=0;o>>0,isFinite(i)?(i=i>>>0,n===void 0&&(n="utf8")):(n=i,i=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var s=this.length-t;if((i===void 0||i>s)&&(i=s),e.length>0&&(i<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return dB(this,e,t,i);case"utf8":case"utf-8":return pB(this,e,t,i);case"ascii":case"latin1":case"binary":return gB(this,e,t,i);case"base64":return yB(this,e,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return mB(this,e,t,i);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}};se.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function vB(r,e,t){return e===0&&t===r.length?x0.fromByteArray(r):x0.fromByteArray(r.slice(e,t))}function KE(r,e,t){t=Math.min(r.length,t);for(var i=[],n=e;n239?4:s>223?3:s>191?2:1;if(n+a<=t){var u,h,p,v;switch(a){case 1:s<128&&(o=s);break;case 2:u=r[n+1],(u&192)===128&&(v=(s&31)<<6|u&63,v>127&&(o=v));break;case 3:u=r[n+1],h=r[n+2],(u&192)===128&&(h&192)===128&&(v=(s&15)<<12|(u&63)<<6|h&63,v>2047&&(v<55296||v>57343)&&(o=v));break;case 4:u=r[n+1],h=r[n+2],p=r[n+3],(u&192)===128&&(h&192)===128&&(p&192)===128&&(v=(s&15)<<18|(u&63)<<12|(h&63)<<6|p&63,v>65535&&v<1114112&&(o=v))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,i.push(o>>>10&1023|55296),o=56320|o&1023),i.push(o),n+=a}return wB(i)}var VE=4096;function wB(r){var e=r.length;if(e<=VE)return String.fromCharCode.apply(String,r);for(var t="",i=0;ii)&&(t=i);for(var n="",s=e;si&&(e=i),t<0?(t+=i,t<0&&(t=0)):t>i&&(t=i),tt)throw new RangeError("Trying to access beyond buffer length")}se.prototype.readUintLE=se.prototype.readUIntLE=function(e,t,i){e=e>>>0,t=t>>>0,i||Vt(e,t,this.length);for(var n=this[e],s=1,o=0;++o>>0,t=t>>>0,i||Vt(e,t,this.length);for(var n=this[e+--t],s=1;t>0&&(s*=256);)n+=this[e+--t]*s;return n};se.prototype.readUint8=se.prototype.readUInt8=function(e,t){return e=e>>>0,t||Vt(e,1,this.length),this[e]};se.prototype.readUint16LE=se.prototype.readUInt16LE=function(e,t){return e=e>>>0,t||Vt(e,2,this.length),this[e]|this[e+1]<<8};se.prototype.readUint16BE=se.prototype.readUInt16BE=function(e,t){return e=e>>>0,t||Vt(e,2,this.length),this[e]<<8|this[e+1]};se.prototype.readUint32LE=se.prototype.readUInt32LE=function(e,t){return e=e>>>0,t||Vt(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};se.prototype.readUint32BE=se.prototype.readUInt32BE=function(e,t){return e=e>>>0,t||Vt(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};se.prototype.readIntLE=function(e,t,i){e=e>>>0,t=t>>>0,i||Vt(e,t,this.length);for(var n=this[e],s=1,o=0;++o=s&&(n-=Math.pow(2,8*t)),n};se.prototype.readIntBE=function(e,t,i){e=e>>>0,t=t>>>0,i||Vt(e,t,this.length);for(var n=t,s=1,o=this[e+--n];n>0&&(s*=256);)o+=this[e+--n]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*t)),o};se.prototype.readInt8=function(e,t){return e=e>>>0,t||Vt(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};se.prototype.readInt16LE=function(e,t){e=e>>>0,t||Vt(e,2,this.length);var i=this[e]|this[e+1]<<8;return i&32768?i|4294901760:i};se.prototype.readInt16BE=function(e,t){e=e>>>0,t||Vt(e,2,this.length);var i=this[e+1]|this[e]<<8;return i&32768?i|4294901760:i};se.prototype.readInt32LE=function(e,t){return e=e>>>0,t||Vt(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};se.prototype.readInt32BE=function(e,t){return e=e>>>0,t||Vt(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};se.prototype.readFloatLE=function(e,t){return e=e>>>0,t||Vt(e,4,this.length),No.read(this,e,!0,23,4)};se.prototype.readFloatBE=function(e,t){return e=e>>>0,t||Vt(e,4,this.length),No.read(this,e,!1,23,4)};se.prototype.readDoubleLE=function(e,t){return e=e>>>0,t||Vt(e,8,this.length),No.read(this,e,!0,52,8)};se.prototype.readDoubleBE=function(e,t){return e=e>>>0,t||Vt(e,8,this.length),No.read(this,e,!1,52,8)};function hr(r,e,t,i,n,s){if(!se.isBuffer(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||er.length)throw new RangeError("Index out of range")}se.prototype.writeUintLE=se.prototype.writeUIntLE=function(e,t,i,n){if(e=+e,t=t>>>0,i=i>>>0,!n){var s=Math.pow(2,8*i)-1;hr(this,e,t,i,s,0)}var o=1,a=0;for(this[t]=e&255;++a>>0,i=i>>>0,!n){var s=Math.pow(2,8*i)-1;hr(this,e,t,i,s,0)}var o=i-1,a=1;for(this[t+o]=e&255;--o>=0&&(a*=256);)this[t+o]=e/a&255;return t+i};se.prototype.writeUint8=se.prototype.writeUInt8=function(e,t,i){return e=+e,t=t>>>0,i||hr(this,e,t,1,255,0),this[t]=e&255,t+1};se.prototype.writeUint16LE=se.prototype.writeUInt16LE=function(e,t,i){return e=+e,t=t>>>0,i||hr(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2};se.prototype.writeUint16BE=se.prototype.writeUInt16BE=function(e,t,i){return e=+e,t=t>>>0,i||hr(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2};se.prototype.writeUint32LE=se.prototype.writeUInt32LE=function(e,t,i){return e=+e,t=t>>>0,i||hr(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4};se.prototype.writeUint32BE=se.prototype.writeUInt32BE=function(e,t,i){return e=+e,t=t>>>0,i||hr(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};se.prototype.writeIntLE=function(e,t,i,n){if(e=+e,t=t>>>0,!n){var s=Math.pow(2,8*i-1);hr(this,e,t,i,s-1,-s)}var o=0,a=1,u=0;for(this[t]=e&255;++o>0)-u&255;return t+i};se.prototype.writeIntBE=function(e,t,i,n){if(e=+e,t=t>>>0,!n){var s=Math.pow(2,8*i-1);hr(this,e,t,i,s-1,-s)}var o=i-1,a=1,u=0;for(this[t+o]=e&255;--o>=0&&(a*=256);)e<0&&u===0&&this[t+o+1]!==0&&(u=1),this[t+o]=(e/a>>0)-u&255;return t+i};se.prototype.writeInt8=function(e,t,i){return e=+e,t=t>>>0,i||hr(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1};se.prototype.writeInt16LE=function(e,t,i){return e=+e,t=t>>>0,i||hr(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2};se.prototype.writeInt16BE=function(e,t,i){return e=+e,t=t>>>0,i||hr(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2};se.prototype.writeInt32LE=function(e,t,i){return e=+e,t=t>>>0,i||hr(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4};se.prototype.writeInt32BE=function(e,t,i){return e=+e,t=t>>>0,i||hr(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function zE(r,e,t,i,n,s){if(t+i>r.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function $E(r,e,t,i,n){return e=+e,t=t>>>0,n||zE(r,e,t,4,34028234663852886e22,-34028234663852886e22),No.write(r,e,t,i,23,4),t+4}se.prototype.writeFloatLE=function(e,t,i){return $E(this,e,t,!0,i)};se.prototype.writeFloatBE=function(e,t,i){return $E(this,e,t,!1,i)};function kE(r,e,t,i,n){return e=+e,t=t>>>0,n||zE(r,e,t,8,17976931348623157e292,-17976931348623157e292),No.write(r,e,t,i,52,8),t+8}se.prototype.writeDoubleLE=function(e,t,i){return kE(this,e,t,!0,i)};se.prototype.writeDoubleBE=function(e,t,i){return kE(this,e,t,!1,i)};se.prototype.copy=function(e,t,i,n){if(!se.isBuffer(e))throw new TypeError("argument should be a Buffer");if(i||(i=0),!n&&n!==0&&(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t>>0,i=i===void 0?this.length:i>>>0,e||(e=0);var o;if(typeof e=="number")for(o=t;o55295&&t<57344){if(!n){if(t>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===i){(e-=3)>-1&&s.push(239,191,189);continue}n=t;continue}if(t<56320){(e-=3)>-1&&s.push(239,191,189),n=t;continue}t=(n-55296<<10|t-56320)+65536}else n&&(e-=3)>-1&&s.push(239,191,189);if(n=null,t<128){if((e-=1)<0)break;s.push(t)}else if(t<2048){if((e-=2)<0)break;s.push(t>>6|192,t&63|128)}else if(t<65536){if((e-=3)<0)break;s.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((e-=4)<0)break;s.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return s}function SB(r){for(var e=[],t=0;t>8,n=t%256,s.push(n),s.push(i);return s}function WE(r){return x0.toByteArray(CB(r))}function zl(r,e,t,i){for(var n=0;n=e.length||n>=r.length);++n)e[n+t]=r[n];return n}function ii(r,e){return r instanceof e||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===e.name}function M0(r){return r!==r}var TB=function(){for(var r="0123456789abcdef",e=new Array(256),t=0;t<16;++t)for(var i=t*16,n=0;n<16;++n)e[i+n]=r[t]+r[n];return e}()});var tA=D((mz,eA)=>{l();var ot=eA.exports={},ni,si;function P0(){throw new Error("setTimeout has not been defined")}function L0(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?ni=setTimeout:ni=P0}catch{ni=P0}try{typeof clearTimeout=="function"?si=clearTimeout:si=L0}catch{si=L0}})();function JE(r){if(ni===setTimeout)return setTimeout(r,0);if((ni===P0||!ni)&&setTimeout)return ni=setTimeout,setTimeout(r,0);try{return ni(r,0)}catch{try{return ni.call(null,r,0)}catch{return ni.call(this,r,0)}}}function NB(r){if(si===clearTimeout)return clearTimeout(r);if((si===L0||!si)&&clearTimeout)return si=clearTimeout,clearTimeout(r);try{return si(r)}catch{try{return si.call(null,r)}catch{return si.call(this,r)}}}var Ui=[],Oo=!1,ms,$l=-1;function DB(){!Oo||!ms||(Oo=!1,ms.length?Ui=ms.concat(Ui):$l=-1,Ui.length&&XE())}function XE(){if(!Oo){var r=JE(DB);Oo=!0;for(var e=Ui.length;e;){for(ms=Ui,Ui=[];++$l1)for(var t=1;t{y=_e(YE()),I=_e(tA()),OB=function(r){function e(){var i=this||self;return delete r.prototype.__magic__,i}if(typeof globalThis=="object")return globalThis;if(this)return e();r.defineProperty(r.prototype,"__magic__",{configurable:!0,get:e});var t=__magic__;return t}(Object),global=OB});var Vr=D((rA,kl)=>{l();(function(r){"use strict";var e,t=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,i=Math.ceil,n=Math.floor,s="[BigNumber Error] ",o=s+"Number primitive has more than 15 significant digits: ",a=1e14,u=14,h=9007199254740991,p=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],v=1e7,B=1e9;function R(W){var G,P,F,$=f.prototype={constructor:f,toString:null,valueOf:null},ce=new f(1),Y=20,X=4,A=-7,c=21,d=-1e7,g=1e7,m=!1,w=1,S=0,N={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},_="0123456789abcdefghijklmnopqrstuvwxyz";function f(E,b){var T,L,O,U,q,M,j,z,Q=this;if(!(Q instanceof f))return new f(E,b);if(b==null){if(E&&E._isBigNumber===!0){Q.s=E.s,!E.c||E.e>g?Q.c=Q.e=null:E.e=10;q/=10,U++);U>g?Q.c=Q.e=null:(Q.e=U,Q.c=[E]);return}z=String(E)}else{if(!t.test(z=String(E)))return F(Q,z,M);Q.s=z.charCodeAt(0)==45?(z=z.slice(1),-1):1}(U=z.indexOf("."))>-1&&(z=z.replace(".","")),(q=z.search(/e/i))>0?(U<0&&(U=q),U+=+z.slice(q+1),z=z.substring(0,q)):U<0&&(U=z.length)}else{if(K(b,2,_.length,"Base"),b==10)return Q=new f(E),ee(Q,Y+Q.e+1,X);if(z=String(E),M=typeof E=="number"){if(E*0!=0)return F(Q,z,M,b);if(Q.s=1/E<0?(z=z.slice(1),-1):1,f.DEBUG&&z.replace(/^0\.0*|\./,"").length>15)throw Error(o+E)}else Q.s=z.charCodeAt(0)===45?(z=z.slice(1),-1):1;for(T=_.slice(0,b),U=q=0,j=z.length;qU){U=j;continue}}else if(!O&&(z==z.toUpperCase()&&(z=z.toLowerCase())||z==z.toLowerCase()&&(z=z.toUpperCase()))){O=!0,q=-1,U=0;continue}return F(Q,String(E),M,b)}M=!1,z=P(z,b,10,Q.s),(U=z.indexOf("."))>-1?z=z.replace(".",""):U=z.length}for(q=0;z.charCodeAt(q)===48;q++);for(j=z.length;z.charCodeAt(--j)===48;);if(z=z.slice(q,++j)){if(j-=q,M&&f.DEBUG&&j>15&&(E>h||E!==n(E)))throw Error(o+Q.s*E);if((U=U-q-1)>g)Q.c=Q.e=null;else if(U=-B&&O<=B&&O===n(O)){if(L[0]===0){if(O===0&&L.length===1)return!0;break e}if(b=(O+1)%u,b<1&&(b+=u),String(L[0]).length==b){for(b=0;b=a||T!==n(T))break e;if(T!==0)return!0}}}else if(L===null&&O===null&&(U===null||U===1||U===-1))return!0;throw Error(s+"Invalid BigNumber: "+E)},f.maximum=f.max=function(){return Z(arguments,$.lt)},f.minimum=f.min=function(){return Z(arguments,$.gt)},f.random=function(){var E=9007199254740992,b=Math.random()*E&2097151?function(){return n(Math.random()*E)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(T){var L,O,U,q,M,j=0,z=[],Q=new f(ce);if(T==null?T=Y:K(T,0,B),q=i(T/u),m)if(crypto.getRandomValues){for(L=crypto.getRandomValues(new Uint32Array(q*=2));j>>11),M>=9e15?(O=crypto.getRandomValues(new Uint32Array(2)),L[j]=O[0],L[j+1]=O[1]):(z.push(M%1e14),j+=2);j=q/2}else if(crypto.randomBytes){for(L=crypto.randomBytes(q*=7);j=9e15?crypto.randomBytes(7).copy(L,j):(z.push(M%1e14),j+=7);j=q/7}else throw m=!1,Error(s+"crypto unavailable");if(!m)for(;j=10;M/=10,j++);jO-1&&(M[q+1]==null&&(M[q+1]=0),M[q+1]+=M[q]/O|0,M[q]%=O)}return M.reverse()}return function(T,L,O,U,q){var M,j,z,Q,ue,he,de,Be,Ie=T.indexOf("."),Se=Y,Oe=X;for(Ie>=0&&(Q=S,S=0,T=T.replace(".",""),Be=new f(L),he=Be.pow(T.length-Ie),S=Q,Be.c=b(J(V(he.c),he.e,"0"),10,O,E),Be.e=Be.c.length),de=b(T,L,O,q?(M=_,E):(M=E,_)),z=Q=de.length;de[--Q]==0;de.pop());if(!de[0])return M.charAt(0);if(Ie<0?--z:(he.c=de,he.e=z,he.s=U,he=G(he,Be,Se,Oe,O),de=he.c,ue=he.r,z=he.e),j=z+Se+1,Ie=de[j],Q=O/2,ue=ue||j<0||de[j+1]!=null,ue=Oe<4?(Ie!=null||ue)&&(Oe==0||Oe==(he.s<0?3:2)):Ie>Q||Ie==Q&&(Oe==4||ue||Oe==6&&de[j-1]&1||Oe==(he.s<0?8:7)),j<1||!de[0])T=ue?J(M.charAt(1),-Se,M.charAt(0)):M.charAt(0);else{if(de.length=j,ue)for(--O;++de[--j]>O;)de[j]=0,j||(++z,de=[1].concat(de));for(Q=de.length;!de[--Q];);for(Ie=0,T="";Ie<=Q;T+=M.charAt(de[Ie++]));T=J(T,z,M.charAt(0))}return T}}(),G=function(){function E(L,O,U){var q,M,j,z,Q=0,ue=L.length,he=O%v,de=O/v|0;for(L=L.slice();ue--;)j=L[ue]%v,z=L[ue]/v|0,q=de*j+z*he,M=he*j+q%v*v+Q,Q=(M/U|0)+(q/v|0)+de*z,L[ue]=M%U;return Q&&(L=[Q].concat(L)),L}function b(L,O,U,q){var M,j;if(U!=q)j=U>q?1:-1;else for(M=j=0;MO[M]?1:-1;break}return j}function T(L,O,U,q){for(var M=0;U--;)L[U]-=M,M=L[U]1;L.splice(0,1));}return function(L,O,U,q,M){var j,z,Q,ue,he,de,Be,Ie,Se,Oe,Ae,De,ps,Je,Xe,_r,Ge,Le=L.s==O.s?1:-1,qt=L.c,be=O.c;if(!qt||!qt[0]||!be||!be[0])return new f(!L.s||!O.s||(qt?be&&qt[0]==be[0]:!be)?NaN:qt&&qt[0]==0||!be?Le*0:Le/0);for(Ie=new f(Le),Se=Ie.c=[],z=L.e-O.e,Le=U+z+1,M||(M=a,z=x(L.e/u)-x(O.e/u),Le=Le/u|0),Q=0;be[Q]==(qt[Q]||0);Q++);if(be[Q]>(qt[Q]||0)&&z--,Le<0)Se.push(1),ue=!0;else{for(Je=qt.length,_r=be.length,Q=0,Le+=2,he=n(M/(be[0]+1)),he>1&&(be=E(be,he,M),qt=E(qt,he,M),_r=be.length,Je=qt.length),ps=_r,Oe=qt.slice(0,_r),Ae=Oe.length;Ae<_r;Oe[Ae++]=0);Ge=be.slice(),Ge=[0].concat(Ge),Xe=be[0],be[1]>=M/2&&Xe++;do{if(he=0,j=b(be,Oe,_r,Ae),j<0){if(De=Oe[0],_r!=Ae&&(De=De*M+(Oe[1]||0)),he=n(De/Xe),he>1)for(he>=M&&(he=M-1),de=E(be,he,M),Be=de.length,Ae=Oe.length;b(de,Oe,Be,Ae)==1;)he--,T(de,_r=10;Le/=10,Q++);ee(Ie,U+(Ie.e=Q+z*u-1)+1,q,ue)}else Ie.e=z,Ie.r=+ue;return Ie}}();function C(E,b,T,L){var O,U,q,M,j;if(T==null?T=X:K(T,0,8),!E.c)return E.toString();if(O=E.c[0],q=E.e,b==null)j=V(E.c),j=L==1||L==2&&(q<=A||q>=c)?k(j,q):J(j,q,"0");else if(E=ee(new f(E),b,T),U=E.e,j=V(E.c),M=j.length,L==1||L==2&&(b<=U||U<=A)){for(;MM){if(--b>0)for(j+=".";b--;j+="0");}else if(b+=U-M,b>0)for(U+1==M&&(j+=".");b--;j+="0");return E.s<0&&O?"-"+j:j}function Z(E,b){for(var T,L=1,O=new f(E[0]);L=10;O/=10,L++);return(T=L+T*u-1)>g?E.c=E.e=null:T=10;M/=10,O++);if(U=b-O,U<0)U+=u,q=b,j=ue[z=0],Q=j/he[O-q-1]%10|0;else if(z=i((U+1)/u),z>=ue.length)if(L){for(;ue.length<=z;ue.push(0));j=Q=0,O=1,U%=u,q=U-u+1}else break e;else{for(j=M=ue[z],O=1;M>=10;M/=10,O++);U%=u,q=U-u+O,Q=q<0?0:j/he[O-q-1]%10|0}if(L=L||b<0||ue[z+1]!=null||(q<0?j:j%he[O-q-1]),L=T<4?(Q||L)&&(T==0||T==(E.s<0?3:2)):Q>5||Q==5&&(T==4||L||T==6&&(U>0?q>0?j/he[O-q]:0:ue[z-1])%10&1||T==(E.s<0?8:7)),b<1||!ue[0])return ue.length=0,L?(b-=E.e+1,ue[0]=he[(u-b%u)%u],E.e=-b||0):ue[0]=E.e=0,E;if(U==0?(ue.length=z,M=1,z--):(ue.length=z+1,M=he[u-U],ue[z]=q>0?n(j/he[O-q]%he[q])*M:0),L)for(;;)if(z==0){for(U=1,q=ue[0];q>=10;q/=10,U++);for(q=ue[0]+=M,M=1;q>=10;q/=10,M++);U!=M&&(E.e++,ue[0]==a&&(ue[0]=1));break}else{if(ue[z]+=M,ue[z]!=a)break;ue[z--]=0,M=1}for(U=ue.length;ue[--U]===0;ue.pop());}E.e>g?E.c=E.e=null:E.e=c?k(b,T):J(b,T,"0"),E.s<0?"-"+b:b)}return $.absoluteValue=$.abs=function(){var E=new f(this);return E.s<0&&(E.s=1),E},$.comparedTo=function(E,b){return H(this,new f(E,b))},$.decimalPlaces=$.dp=function(E,b){var T,L,O,U=this;if(E!=null)return K(E,0,B),b==null?b=X:K(b,0,8),ee(new f(U),E+U.e+1,b);if(!(T=U.c))return null;if(L=((O=T.length-1)-x(this.e/u))*u,O=T[O])for(;O%10==0;O/=10,L--);return L<0&&(L=0),L},$.dividedBy=$.div=function(E,b){return G(this,new f(E,b),Y,X)},$.dividedToIntegerBy=$.idiv=function(E,b){return G(this,new f(E,b),0,1)},$.exponentiatedBy=$.pow=function(E,b){var T,L,O,U,q,M,j,z,Q,ue=this;if(E=new f(E),E.c&&!E.isInteger())throw Error(s+"Exponent not an integer: "+ae(E));if(b!=null&&(b=new f(b)),M=E.e>14,!ue.c||!ue.c[0]||ue.c[0]==1&&!ue.e&&ue.c.length==1||!E.c||!E.c[0])return Q=new f(Math.pow(+ae(ue),M?2-ie(E):+ae(E))),b?Q.mod(b):Q;if(j=E.s<0,b){if(b.c?!b.c[0]:!b.s)return new f(NaN);L=!j&&ue.isInteger()&&b.isInteger(),L&&(ue=ue.mod(b))}else{if(E.e>9&&(ue.e>0||ue.e<-1||(ue.e==0?ue.c[0]>1||M&&ue.c[1]>=24e7:ue.c[0]<8e13||M&&ue.c[0]<=9999975e7)))return U=ue.s<0&&ie(E)?-0:0,ue.e>-1&&(U=1/U),new f(j?1/U:U);S&&(U=i(S/u+2))}for(M?(T=new f(.5),j&&(E.s=1),z=ie(E)):(O=Math.abs(+ae(E)),z=O%2),Q=new f(ce);;){if(z){if(Q=Q.times(ue),!Q.c)break;U?Q.c.length>U&&(Q.c.length=U):L&&(Q=Q.mod(b))}if(O){if(O=n(O/2),O===0)break;z=O%2}else if(E=E.times(T),ee(E,E.e+1,1),E.e>14)z=ie(E);else{if(O=+ae(E),O===0)break;z=O%2}ue=ue.times(ue),U?ue.c&&ue.c.length>U&&(ue.c.length=U):L&&(ue=ue.mod(b))}return L?Q:(j&&(Q=ce.div(Q)),b?Q.mod(b):U?ee(Q,S,X,q):Q)},$.integerValue=function(E){var b=new f(this);return E==null?E=X:K(E,0,8),ee(b,b.e+1,E)},$.isEqualTo=$.eq=function(E,b){return H(this,new f(E,b))===0},$.isFinite=function(){return!!this.c},$.isGreaterThan=$.gt=function(E,b){return H(this,new f(E,b))>0},$.isGreaterThanOrEqualTo=$.gte=function(E,b){return(b=H(this,new f(E,b)))===1||b===0},$.isInteger=function(){return!!this.c&&x(this.e/u)>this.c.length-2},$.isLessThan=$.lt=function(E,b){return H(this,new f(E,b))<0},$.isLessThanOrEqualTo=$.lte=function(E,b){return(b=H(this,new f(E,b)))===-1||b===0},$.isNaN=function(){return!this.s},$.isNegative=function(){return this.s<0},$.isPositive=function(){return this.s>0},$.isZero=function(){return!!this.c&&this.c[0]==0},$.minus=function(E,b){var T,L,O,U,q=this,M=q.s;if(E=new f(E,b),b=E.s,!M||!b)return new f(NaN);if(M!=b)return E.s=-b,q.plus(E);var j=q.e/u,z=E.e/u,Q=q.c,ue=E.c;if(!j||!z){if(!Q||!ue)return Q?(E.s=-b,E):new f(ue?q:NaN);if(!Q[0]||!ue[0])return ue[0]?(E.s=-b,E):new f(Q[0]?q:X==3?-0:0)}if(j=x(j),z=x(z),Q=Q.slice(),M=j-z){for((U=M<0)?(M=-M,O=Q):(z=j,O=ue),O.reverse(),b=M;b--;O.push(0));O.reverse()}else for(L=(U=(M=Q.length)<(b=ue.length))?M:b,M=b=0;b0)for(;b--;Q[T++]=0);for(b=a-1;L>M;){if(Q[--L]=0;){for(T=0,he=De[O]%Se,de=De[O]/Se|0,q=j,U=O+q;U>O;)z=Ae[--q]%Se,Q=Ae[q]/Se|0,M=de*z+Q*he,z=he*z+M%Se*Se+Be[U]+T,T=(z/Ie|0)+(M/Se|0)+de*Q,Be[U--]=z%Ie;Be[U]=T}return T?++L:Be.splice(0,1),te(E,Be,L)},$.negated=function(){var E=new f(this);return E.s=-E.s||null,E},$.plus=function(E,b){var T,L=this,O=L.s;if(E=new f(E,b),b=E.s,!O||!b)return new f(NaN);if(O!=b)return E.s=-b,L.minus(E);var U=L.e/u,q=E.e/u,M=L.c,j=E.c;if(!U||!q){if(!M||!j)return new f(O/0);if(!M[0]||!j[0])return j[0]?E:new f(M[0]?L:O*0)}if(U=x(U),q=x(q),M=M.slice(),O=U-q){for(O>0?(q=U,T=j):(O=-O,T=M),T.reverse();O--;T.push(0));T.reverse()}for(O=M.length,b=j.length,O-b<0&&(T=j,j=M,M=T,b=O),O=0;b;)O=(M[--b]=M[b]+j[b]+O)/a|0,M[b]=a===M[b]?0:M[b]%a;return O&&(M=[O].concat(M),++q),te(E,M,q)},$.precision=$.sd=function(E,b){var T,L,O,U=this;if(E!=null&&E!==!!E)return K(E,1,B),b==null?b=X:K(b,0,8),ee(new f(U),E,b);if(!(T=U.c))return null;if(O=T.length-1,L=O*u+1,O=T[O]){for(;O%10==0;O/=10,L--);for(O=T[0];O>=10;O/=10,L++);}return E&&U.e+1>L&&(L=U.e+1),L},$.shiftedBy=function(E){return K(E,-h,h),this.times("1e"+E)},$.squareRoot=$.sqrt=function(){var E,b,T,L,O,U=this,q=U.c,M=U.s,j=U.e,z=Y+4,Q=new f("0.5");if(M!==1||!q||!q[0])return new f(!M||M<0&&(!q||q[0])?NaN:q?U:1/0);if(M=Math.sqrt(+ae(U)),M==0||M==1/0?(b=V(q),(b.length+j)%2==0&&(b+="0"),M=Math.sqrt(+b),j=x((j+1)/2)-(j<0||j%2),M==1/0?b="5e"+j:(b=M.toExponential(),b=b.slice(0,b.indexOf("e")+1)+j),T=new f(b)):T=new f(M+""),T.c[0]){for(j=T.e,M=j+z,M<3&&(M=0);;)if(O=T,T=Q.times(O.plus(G(U,O,z,1))),V(O.c).slice(0,M)===(b=V(T.c)).slice(0,M))if(T.e0&&Be>0){for(U=Be%M||M,Q=de.substr(0,U);U0&&(Q+=z+de.slice(U)),he&&(Q="-"+Q)}L=ue?Q+(T.decimalSeparator||"")+((j=+T.fractionGroupSize)?ue.replace(new RegExp("\\d{"+j+"}\\B","g"),"$&"+(T.fractionGroupSeparator||"")):ue):Q}return(T.prefix||"")+L+(T.suffix||"")},$.toFraction=function(E){var b,T,L,O,U,q,M,j,z,Q,ue,he,de=this,Be=de.c;if(E!=null&&(M=new f(E),!M.isInteger()&&(M.c||M.s!==1)||M.lt(ce)))throw Error(s+"Argument "+(M.isInteger()?"out of range: ":"not an integer: ")+ae(M));if(!Be)return new f(de);for(b=new f(ce),z=T=new f(ce),L=j=new f(ce),he=V(Be),U=b.e=he.length-de.e-1,b.c[0]=p[(q=U%u)<0?u+q:q],E=!E||M.comparedTo(b)>0?U>0?b:z:M,q=g,g=1/0,M=new f(he),j.c[0]=0;Q=G(M,b,0,1),O=T.plus(Q.times(L)),O.comparedTo(E)!=1;)T=L,L=O,z=j.plus(Q.times(O=z)),j=O,b=M.minus(Q.times(O=b)),M=O;return O=G(E.minus(T),L,0,1),j=j.plus(O.times(z)),T=T.plus(O.times(L)),j.s=z.s=de.s,U=U*2,ue=G(z,L,U,X).minus(de).abs().comparedTo(G(j,T,U,X).minus(de).abs())<1?[z,L]:[j,T],g=q,ue},$.toNumber=function(){return+ae(this)},$.toPrecision=function(E,b){return E!=null&&K(E,1,B),C(this,E,b,2)},$.toString=function(E){var b,T=this,L=T.s,O=T.e;return O===null?L?(b="Infinity",L<0&&(b="-"+b)):b="NaN":(E==null?b=O<=A||O>=c?k(V(T.c),O):J(V(T.c),O,"0"):E===10?(T=ee(new f(T),Y+O+1,X),b=J(V(T.c),T.e,"0")):(K(E,2,_.length,"Base"),b=P(J(V(T.c),O,"0"),10,E,L,!0)),L<0&&T.c[0]&&(b="-"+b)),b},$.valueOf=$.toJSON=function(){return ae(this)},$._isBigNumber=!0,W!=null&&f.set(W),f}function x(W){var G=W|0;return W>0||W===G?G:G-1}function V(W){for(var G,P,F=1,$=W.length,ce=W[0]+"";F<$;){for(G=W[F++]+"",P=u-G.length;P--;G="0"+G);ce+=G}for($=ce.length;ce.charCodeAt(--$)===48;);return ce.slice(0,$+1||1)}function H(W,G){var P,F,$=W.c,ce=G.c,Y=W.s,X=G.s,A=W.e,c=G.e;if(!Y||!X)return null;if(P=$&&!$[0],F=ce&&!ce[0],P||F)return P?F?0:-X:Y;if(Y!=X)return Y;if(P=Y<0,F=A==c,!$||!ce)return F?0:!$^P?1:-1;if(!F)return A>c^P?1:-1;for(X=(A=$.length)<(c=ce.length)?A:c,Y=0;Yce[Y]^P?1:-1;return A==c?0:A>c^P?1:-1}function K(W,G,P,F){if(WP||W!==n(W))throw Error(s+(F||"Argument")+(typeof W=="number"?WP?" out of range: ":" not an integer: ":" not a primitive number: ")+String(W))}function ie(W){var G=W.c.length-1;return x(W.e/u)==G&&W.c[G]%2!=0}function k(W,G){return(W.length>1?W.charAt(0)+"."+W.slice(1):W)+(G<0?"e":"e+")+G}function J(W,G,P){var F,$;if(G<0){for($=P+".";++G;$+=P);W=$+W}else if(F=W.length,++G>F){for($=P,G-=F;--G;$+=P);W+=$}else G{"use strict";l();Object.defineProperty(ge,"__esModule",{value:!0});ge.ErrGasLimitShouldBe0ForInnerTransaction=ge.ErrInvalidRelayedV2BuilderArguments=ge.ErrInvalidRelayedV1BuilderArguments=ge.ErrNotImplemented=ge.ErrContractInteraction=ge.ErrCodec=ge.ErrCannotParseContractResults=ge.ErrMissingFieldOnEnum=ge.ErrMissingFieldOnStruct=ge.ErrTypeInferenceSystemRequiresRegularJavascriptObjects=ge.ErrTypingSystem=ge.ErrMock=ge.ErrContractHasNoAddress=ge.ErrContract=ge.ErrExpectedTransactionEventsNotFound=ge.ErrExpectedTransactionStatusNotReached=ge.ErrTransactionWatcherTimeout=ge.ErrAsyncTimerAborted=ge.ErrAsyncTimerAlreadyRunning=ge.ErrInvalidFunctionName=ge.ErrSignatureCannotCreate=ge.ErrTransactionOptionsInvalid=ge.ErrTransactionVersionInvalid=ge.ErrNonceInvalid=ge.ErrNotEnoughGas=ge.ErrAddressEmpty=ge.ErrAddressBadHrp=ge.ErrAddressCannotCreate=ge.ErrUnexpectedCondition=ge.ErrInvariantFailed=ge.ErrBadType=ge.ErrUnsupportedOperation=ge.ErrInvalidArgument=ge.Err=void 0;var Me=class extends Error{constructor(e,t){super(e),this.inner=void 0,this.inner=t}summary(){let e=[];e.push({name:this.name,message:this.message});let t=this.inner;for(;t;)e.push({name:t.name,message:t.message}),t=t.inner;return e}};ge.Err=Me;var R0=class extends Me{constructor(e,t){super(`Invalid argument: ${e}`,t)}};ge.ErrInvalidArgument=R0;var F0=class extends Me{constructor(e,t="not specified"){super(`Operation "${e}" not supported. Reason: ${t}`)}};ge.ErrUnsupportedOperation=F0;var U0=class extends Me{constructor(e,t,i){super(`Bad type of "${e}": ${i}. Expected type: ${t}`)}};ge.ErrBadType=U0;var q0=class extends Me{constructor(e){super(`Invariant failed: [${e}]`)}};ge.ErrInvariantFailed=q0;var V0=class extends Me{constructor(e){super(`Unexpected condition: [${e}]`)}};ge.ErrUnexpectedCondition=V0;var H0=class extends Me{constructor(e,t){let i=`Cannot create address from: ${e}`;super(i,t)}};ge.ErrAddressCannotCreate=H0;var Q0=class extends Me{constructor(e,t){super(`Wrong address HRP. Expected: ${e}, got ${t}`)}};ge.ErrAddressBadHrp=Q0;var j0=class extends Me{constructor(){super("Address is empty")}};ge.ErrAddressEmpty=j0;var G0=class extends Me{constructor(e){super(`Not enough gas provided: ${e}`)}};ge.ErrNotEnoughGas=G0;var K0=class extends Me{constructor(e){super(`Invalid nonce: ${e}`)}};ge.ErrNonceInvalid=K0;var z0=class extends Me{constructor(e){super(`Invalid transaction version: ${e}`)}};ge.ErrTransactionVersionInvalid=z0;var $0=class extends Me{constructor(e){super(`Invalid transaction options: ${e}`)}};ge.ErrTransactionOptionsInvalid=$0;var k0=class extends Me{constructor(e,t){let i=`Cannot create signature from: ${e}`;super(i,t)}};ge.ErrSignatureCannotCreate=k0;var W0=class extends Me{constructor(){super("Invalid function name")}};ge.ErrInvalidFunctionName=W0;var Y0=class extends Me{constructor(){super("Async timer already running")}};ge.ErrAsyncTimerAlreadyRunning=Y0;var J0=class extends Me{constructor(){super("Async timer aborted")}};ge.ErrAsyncTimerAborted=J0;var X0=class extends Me{constructor(){super("TransactionWatcher has timed out")}};ge.ErrTransactionWatcherTimeout=X0;var Z0=class extends Me{constructor(){super("Expected transaction status not reached")}};ge.ErrExpectedTransactionStatusNotReached=Z0;var eg=class extends Me{constructor(){super("Expected transaction events not found")}};ge.ErrExpectedTransactionEventsNotFound=eg;var Wl=class extends Me{constructor(e){super(e)}};ge.ErrContract=Wl;var tg=class extends Wl{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). -`)}};ge.ErrContractHasNoAddress=tg;var rg=class extends Me{constructor(e){super(e)}};ge.ErrMock=rg;var Yl=class extends Me{constructor(e){super(e)}};ge.ErrTypingSystem=Yl;var ig=class extends Yl{constructor(e){super(` -argument at position ${e} seems to be a TypedValue. The automatic type inference system requires regular javascript objects as input. -This error might occur when you pass a TypedValue to contract.methods.myFunction([...]). For passing TypedValues instead of regular javascript objects, and bypass the automatic type inference system, use contract.methodsExplicit.myFunction([...]) instead. -Also see https://github.com/ElrondNetwork/elrond-sdk-erdjs/pull/187. -`)}};ge.ErrTypeInferenceSystemRequiresRegularJavascriptObjects=ig;var ng=class extends Me{constructor(e,t){super(`field ${e} does not exist on struct ${t}`)}};ge.ErrMissingFieldOnStruct=ng;var sg=class extends Me{constructor(e,t){super(`field ${e} does not exist on enum ${t}`)}};ge.ErrMissingFieldOnEnum=sg;var og=class extends Me{constructor(e){super(`cannot parse contract results: ${e}`)}};ge.ErrCannotParseContractResults=og;var ag=class extends Me{constructor(e){super(e)}};ge.ErrCodec=ag;var ug=class extends Me{constructor(e){super(e)}};ge.ErrContractInteraction=ug;var cg=class extends Me{constructor(){super("Method not yet implemented")}};ge.ErrNotImplemented=cg;var lg=class extends Me{constructor(){super("invalid arguments for relayed v1 builder")}};ge.ErrInvalidRelayedV1BuilderArguments=lg;var fg=class extends Me{constructor(){super("invalid arguments for relayed v2 builder")}};ge.ErrInvalidRelayedV2BuilderArguments=fg;var hg=class extends Me{constructor(){super("gas limit must be 0 for the inner transaction for relayed v2")}};ge.ErrGasLimitShouldBe0ForInnerTransaction=hg});var dg=D(Bo=>{"use strict";l();var BB=Bo&&Bo.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Bo,"__esModule",{value:!0});Bo.TokenPayment=void 0;var tc=BB(Vr()),MB=ke(),iA="EGLD",nA=18;tc.default.set({ROUNDING_MODE:1});var Vi=class{constructor(e,t,i,n){let s=new tc.default(i);if(!s.isInteger()||s.isNegative())throw new MB.ErrInvalidArgument(`bad amountAsBigInteger: ${i}`);this.tokenIdentifier=e,this.nonce=t,this.amountAsBigInteger=s,this.numDecimals=n}static egldFromAmount(e){let t=new tc.default(e).shiftedBy(nA).decimalPlaces(0);return this.egldFromBigInteger(t)}static egldFromBigInteger(e){return new Vi(iA,0,e,nA)}static fungibleFromAmount(e,t,i){let n=new tc.default(t).shiftedBy(i).decimalPlaces(0);return this.fungibleFromBigInteger(e,n,i)}static fungibleFromBigInteger(e,t,i=0){return new Vi(e,0,t,i)}static nonFungible(e,t){return new Vi(e,t,1,0)}static semiFungible(e,t,i){return new Vi(e,t,i,0)}static metaEsdtFromAmount(e,t,i,n){let s=new tc.default(i).shiftedBy(n).decimalPlaces(0);return this.metaEsdtFromBigInteger(e,t,s,n)}static metaEsdtFromBigInteger(e,t,i,n=0){return new Vi(e,t,i,n)}toString(){return this.amountAsBigInteger.toFixed(0)}valueOf(){return this.amountAsBigInteger}toPrettyString(){return`${this.toRationalNumber()} ${this.tokenIdentifier}`}toRationalNumber(){return this.amountAsBigInteger.shiftedBy(-this.numDecimals).toFixed(this.numDecimals)}isEgld(){return this.tokenIdentifier==iA}isFungible(){return this.nonce==0}};Bo.TokenPayment=Vi});var ef=D((Cz,aA)=>{"use strict";l();var Xl="qpzry9x8gf2tvdw0s3jn54khce6mua7l",pg={};for(rc=0;rc>25;return(r&33554431)<<5^-(e>>0&1)&996825010^-(e>>1&1)&642813549^-(e>>2&1)&513874426^-(e>>3&1)&1027748829^-(e>>4&1)&705979059}function sA(r){for(var e=1,t=0;t126)return"Invalid prefix ("+r+")";e=Mo(e)^i>>5}for(e=Mo(e),t=0;tt)throw new TypeError("Exceeds length limit");r=r.toLowerCase();var i=sA(r);if(typeof i=="string")throw new Error(i);for(var n=r+"1",s=0;s>5!==0)throw new Error("Non 5-bit word");i=Mo(i)^o,n+=Xl.charAt(o)}for(s=0;s<6;++s)i=Mo(i);for(i^=1,s=0;s<6;++s){var a=i>>(5-s)*5&31;n+=Xl.charAt(a)}return n}function oA(r,e){if(e=e||90,r.length<8)return r+" too short";if(r.length>e)return"Exceeds length limit";var t=r.toLowerCase(),i=r.toUpperCase();if(r!==t&&r!==i)return"Mixed-case string "+r;r=t;var n=r.lastIndexOf("1");if(n===-1)return"No separator character for "+r;if(n===0)return"Missing prefix for "+r;var s=r.slice(0,n),o=r.slice(n+1);if(o.length<6)return"Data too short";var a=sA(s);if(typeof a=="string")return a;for(var u=[],h=0;h=o.length)&&u.push(v)}return a!==1?"Invalid checksum for "+r:{prefix:s,words:u}}function LB(){var r=oA.apply(null,arguments);if(typeof r=="object")return r}function RB(r){var e=oA.apply(null,arguments);if(typeof e=="object")return e;throw new Error(e)}function Zl(r,e,t,i){for(var n=0,s=0,o=(1<=t;)s-=t,a.push(n>>s&o);if(i)s>0&&a.push(n<=e)return"Excess padding";if(n<{"use strict";l();var HB=oi&&oi.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),QB=oi&&oi.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),uA=oi&&oi.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&HB(e,r,t);return QB(e,r),e};Object.defineProperty(oi,"__esModule",{value:!0});oi.Address=void 0;var tf=uA(ef()),Po=uA(ke()),gg="erd",yg=32,jB="0".repeat(16),Ht=class{constructor(e){if(this.valueHex="",!!e){if(e instanceof Ht)return Ht.fromAddress(e);if(e instanceof y.Buffer)return Ht.fromBuffer(e);if(typeof e=="string")return Ht.fromString(e);throw new Po.ErrAddressCannotCreate(e)}}static fromAddress(e){return Ht.fromValidHex(e.valueHex)}static fromValidHex(e){let t=new Ht;return t.valueHex=e,t}static fromBuffer(e){if(e.length!=yg)throw new Po.ErrAddressCannotCreate(e);return Ht.fromValidHex(e.toString("hex"))}static fromString(e){return Ht.isValidHex(e)?Ht.fromValidHex(e):Ht.fromBech32(e)}static isValidHex(e){return y.Buffer.from(e,"hex").length==yg}static fromHex(e){if(!Ht.isValidHex(e))throw new Po.ErrAddressCannotCreate(e);return Ht.fromValidHex(e)}static fromBech32(e){let t;try{t=tf.decode(e)}catch(s){throw new Po.ErrAddressCannotCreate(e,s)}let i=t.prefix;if(i!=gg)throw new Po.ErrAddressBadHrp(gg,i);let n=y.Buffer.from(tf.fromWords(t.words));if(n.length!=yg)throw new Po.ErrAddressCannotCreate(e);return Ht.fromValidHex(n.toString("hex"))}hex(){return this.isEmpty()?"":this.valueHex}bech32(){if(this.isEmpty())return"";let e=tf.toWords(this.pubkey());return tf.encode(gg,e)}pubkey(){return this.isEmpty()?y.Buffer.from([]):y.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 Ht("0".repeat(64))}isContractAddress(){return this.hex().startsWith(jB)}};oi.Address=Ht});var xr=D(Ze=>{"use strict";l();var GB=Ze&&Ze.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),KB=Ze&&Ze.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),zB=Ze&&Ze.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&GB(e,r,t);return KB(e,r),e};Object.defineProperty(Ze,"__esModule",{value:!0});Ze.isEmpty=Ze.guardEmpty=Ze.guardNotEmpty=Ze.guardLength=Ze.guardSameLength=Ze.guardValueIsSetWithMessage=Ze.guardValueIsSet=Ze.guardTrue=void 0;var Lo=zB(ke());function $B(r,e){if(!r)throw new Lo.ErrInvariantFailed(`[<${e}>] isn't true`)}Ze.guardTrue=$B;function kB(r,e){cA(`${r} isn't set (null or undefined)`,e)}Ze.guardValueIsSet=kB;function cA(r,e){if(e==null||e===void 0)throw new Lo.ErrInvariantFailed(r)}Ze.guardValueIsSetWithMessage=cA;function WB(r,e){if(r=r||[],e=e||[],r.length!=e.length)throw new Lo.ErrInvariantFailed("arrays do not have the same length")}Ze.guardSameLength=WB;function YB(r,e){let t=r.length||0;if(t!=e)throw new Lo.ErrInvariantFailed(`wrong length, expected: ${e}, actual: ${t}`)}Ze.guardLength=YB;function JB(r,e){if(mg(r))throw new Lo.ErrInvariantFailed(`${e} is empty`)}Ze.guardNotEmpty=JB;function XB(r,e){if(!mg(r))throw new Lo.ErrInvariantFailed(`${e} is not empty`)}Ze.guardEmpty=XB;function mg(r){return r.isEmpty?r.isEmpty():r.length===0}Ze.isEmpty=mg});var lA=D(rf=>{"use strict";l();Object.defineProperty(rf,"__esModule",{value:!0});rf.getJavascriptPrototypesInHierarchy=void 0;function ZB(r,e){let t=[],i=Object.getPrototypeOf(r);for(;i&&e(i);)t.push(i),i=Object.getPrototypeOf(i);return t}rf.getJavascriptPrototypesInHierarchy=ZB});var Dt=D(Nt=>{"use strict";l();Object.defineProperty(Nt,"__esModule",{value:!0});Nt.NullType=Nt.TypePlaceholder=Nt.isTyped=Nt.PrimitiveValue=Nt.TypedValue=Nt.CustomType=Nt.PrimitiveType=Nt.TypeCardinality=Nt.Type=void 0;var vg=lA(),fA=xr(),Ir=class{constructor(e,t=[],i=Hi.fixed(1)){fA.guardValueIsSet("name",e),this.name=e,this.typeParameters=t,this.cardinality=i}getName(){return this.name}getClassName(){return Ir.ClassName}getClassHierarchy(){return vg.getJavascriptPrototypesInHierarchy(this,i=>i.belongsToTypesystem).map(i=>i.getClassName()).reverse()}getFullyQualifiedName(){let e=this.getTypeParameters().map(t=>t.getFullyQualifiedName()).join(", ");return this.isGenericType()?`erdjs:types:${this.getName()}<${e}>`:`erdjs: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 fA.guardTrue(this.typeParameters.length>0,"type parameters length > 0"),this.typeParameters[0]}toString(){let e=this.getTypeParameters().map(i=>i.toString()).join(", "),t=e?`<${e}>`:"";return`${this.name}${t}`}equals(e){return Ir.equals(this,e)}static equals(e,t){return e.getFullyQualifiedName()==t.getFullyQualifiedName()}static equalsMany(e,t){return e.every((i,n)=>i.equals(t[n]))}static isAssignableFromMany(e,t){return e.every((i,n)=>i.isAssignableFrom(t[n]))}differs(e){return!this.equals(e)}valueOf(){return this.name}isAssignableFrom(e){if(!Ir.equalsMany(this.getTypeParameters(),e.getTypeParameters()))return!1;let i=this.getFullyQualifiedName();return Ir.getFullyQualifiedNamesInHierarchy(e).includes(i)?!0:e.hasClassOrSuperclass(this.getClassName())}static getFullyQualifiedNamesInHierarchy(e){return vg.getJavascriptPrototypesInHierarchy(e,n=>n.belongsToTypesystem).map(n=>n.getFullyQualifiedName.call(e))}getNamesOfDependencies(){let e=[];for(let t of this.typeParameters)e.push(t.getName()),e.push(...t.getNamesOfDependencies());return[...new Set(e)]}toJSON(){return{name:this.name,typeParameters:this.typeParameters.map(e=>e.toJSON())}}getCardinality(){return this.cardinality}belongsToTypesystem(){}};Nt.Type=Ir;Ir.ClassName="Type";var Hi=class{constructor(e,t){this.lowerBound=e,this.upperBound=t}static fixed(e){return new Hi(e,e)}static variable(e){return new Hi(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||Hi.MaxCardinality}};Nt.TypeCardinality=Hi;Hi.MaxCardinality=4096;var Ro=class extends Ir{constructor(e){super(e)}getClassName(){return Ro.ClassName}};Nt.PrimitiveType=Ro;Ro.ClassName="PrimitiveType";var Fo=class extends Ir{getClassName(){return Fo.ClassName}};Nt.CustomType=Fo;Fo.ClassName="CustomType";var vs=class{constructor(e){this.type=e}getClassName(){return vs.ClassName}getClassHierarchy(){return vg.getJavascriptPrototypesInHierarchy(this,i=>i.belongsToTypesystem).map(i=>i.getClassName()).reverse()}getType(){return this.type}hasExactClass(e){return this.getClassName()==e}hasClassOrSuperclass(e){return this.getClassHierarchy().includes(e)}belongsToTypesystem(){}};Nt.TypedValue=vs;vs.ClassName="TypedValue";var Uo=class extends vs{constructor(e){super(e)}getClassName(){return Uo.ClassName}};Nt.PrimitiveValue=Uo;Uo.ClassName="PrimitiveValue";function eM(r){return r.belongsToTypesystem!==void 0}Nt.isTyped=eM;var qo=class extends Ir{constructor(){super("...")}getClassName(){return qo.ClassName}};Nt.TypePlaceholder=qo;qo.ClassName="TypePlaceholder";var Vo=class extends Ir{constructor(){super("?")}getClassName(){return Vo.ClassName}};Nt.NullType=Vo;Vo.ClassName="NullType"});var hA=D((Ho,Qo)=>{l();(function(r){var e=typeof Ho=="object"&&Ho&&!Ho.nodeType&&Ho,t=typeof Qo=="object"&&Qo&&!Qo.nodeType&&Qo,i=typeof global=="object"&&global;(i.global===i||i.window===i||i.self===i)&&(r=i);var n,s=2147483647,o=36,a=1,u=26,h=38,p=700,v=72,B=128,R="-",x=/^xn--/,V=/[^\x20-\x7E]/,H=/[\x2E\u3002\uFF0E\uFF61]/g,K={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},ie=o-a,k=Math.floor,J=String.fromCharCode,W;function G(w){throw new RangeError(K[w])}function P(w,S){for(var N=w.length,_=[];N--;)_[N]=S(w[N]);return _}function F(w,S){var N=w.split("@"),_="";N.length>1&&(_=N[0]+"@",w=N[1]),w=w.replace(H,".");var f=w.split("."),C=P(f,S).join(".");return _+C}function $(w){for(var S=[],N=0,_=w.length,f,C;N<_;)f=w.charCodeAt(N++),f>=55296&&f<=56319&&N<_?(C=w.charCodeAt(N++),(C&64512)==56320?S.push(((f&1023)<<10)+(C&1023)+65536):(S.push(f),N--)):S.push(f);return S}function ce(w){return P(w,function(S){var N="";return S>65535&&(S-=65536,N+=J(S>>>10&1023|55296),S=56320|S&1023),N+=J(S),N}).join("")}function Y(w){return w-48<10?w-22:w-65<26?w-65:w-97<26?w-97:o}function X(w,S){return w+22+75*(w<26)-((S!=0)<<5)}function A(w,S,N){var _=0;for(w=N?k(w/p):w>>1,w+=k(w/S);w>ie*u>>1;_+=o)w=k(w/ie);return k(_+(ie+1)*w/(w+h))}function c(w){var S=[],N=w.length,_,f=0,C=B,Z=v,te,ee,ae,E,b,T,L,O,U;for(te=w.lastIndexOf(R),te<0&&(te=0),ee=0;ee=128&&G("not-basic"),S.push(w.charCodeAt(ee));for(ae=te>0?te+1:0;ae=N&&G("invalid-input"),L=Y(w.charCodeAt(ae++)),(L>=o||L>k((s-f)/b))&&G("overflow"),f+=L*b,O=T<=Z?a:T>=Z+u?u:T-Z,!(Lk(s/U)&&G("overflow"),b*=U;_=S.length+1,Z=A(f-E,_,E==0),k(f/_)>s-C&&G("overflow"),C+=k(f/_),f%=_,S.splice(f++,0,C)}return ce(S)}function d(w){var S,N,_,f,C,Z,te,ee,ae,E,b,T=[],L,O,U,q;for(w=$(w),L=w.length,S=B,N=0,C=v,Z=0;Z=S&&bk((s-N)/O)&&G("overflow"),N+=(te-S)*O,S=te,Z=0;Zs&&G("overflow"),b==S){for(ee=N,ae=o;E=ae<=C?a:ae>=C+u?u:ae-C,!(ee{"use strict";l();var pA=hA();function tM(r,e){this.__proto__=new Error(e),this.__proto__.name="BackslashError",this.offset=r}function wg(r){return r>="0"&&r<="7"}function rM(r){return r>="0"&&r<="9"||r>="a"&&r<="f"||r>="A"&&r<="F"}function dA(r){return r=parseInt(r,16),pA.ucs2.encode([r])}function gA(r,e,t){var i=!1,n=[];function s(u){var h=r[u];if(!rM(h))throw new tM(u,"Unexpected token ILLEGAL");return h}for(;e{l();var wA=yA();_A.exports={validate:iM,parse:nM};function iM(r,e){var t;if(e=e||!1,typeof r!="string")t="Input must be a string";else try{nf(r,0,e,!1)}catch(i){t=i.message}return t}function nM(r,e){if(typeof r!="string")throw new Error("Input must be a string");e=e||!1;var t=nf(r,0,e,!0);return t.value}function EA(r,e){for(var t=r.length,i=e,n,s=e;s-1&&r[t]==="\\";)i++,t--;return i%2===0}function uM(r,e,t,i){for(var n=e,s=",",o=[],a=e;ws(r[a]);)a++;if(r[a]==="]")return{start:e,end:a,value:o};for(;s===",";){var u=nf(r,n,t,i),h=EA(r,u.end);i&&o.push(u.value),n=h.end,s=h.value}return{start:e,end:n,value:o}}function cM(r,e){return r.substr(e,4)==="true"}function lM(r,e){return r.substr(e,5)==="false"}function fM(r,e){return r.substr(e,4)==="null"}var hM=new RegExp(/^\s$/);function ws(r){return hM.test(r)}var dM=new RegExp(/^\d$/);function mA(r){return dM.test(r)}function Qi(r,e,t){var i=10,n;r.length{"use strict";l();var pM=ai&&ai.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),gM=ai&&ai.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),yM=ai&&ai.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&pM(e,r,t);return gM(e,r),e};Object.defineProperty(ai,"__esModule",{value:!0});ai.TypeExpressionParser=void 0;var bA=yM(ke()),mM=Dt(),vM=IA(),Ag=class{parse(e){let t=this.doParse(e),i=Object.keys(t);if(i.length!=1)throw new bA.ErrTypingSystem(`bad type expression: ${e}`);let n=i[0];return this.nodeToType(n,t[n])}doParse(e){let t=this.getJsonedString(e);try{return vM.parse(t)}catch{throw new bA.ErrTypingSystem(`cannot parse type expression: ${e}. internal json: ${t}.`)}}getJsonedString(e){let t="";for(var i=0;i"?a!=">"?t+=": {} }":t+="}":o==","?u==">"||(a==">"?t+=",":t+=": {},"):t+=o}let n=/(:|\{|\}|,|\s)/,s=t.replace(/utf\-8\sstring/ig,"utf-8-string").split(n).filter(o=>o);return t=s.map(o=>n.test(o)?o:`"${o}"`).map(o=>o.replace(/utf\-8\-string/ig,"utf-8 string")).join(""),s.length==1?`{${t}: {}}`:`{${t}}`}nodeToType(e,t){e.charAt(e.length-1)==="1"&&(e=e.slice(0,-1));let i=Object.keys(t).map(n=>this.nodeToType(n,t[n]));return new mM.Type(e,i)}};ai.TypeExpressionParser=Ag});var jo=D(dr=>{"use strict";l();var wM=dr&&dr.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),EM=dr&&dr.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),AM=dr&&dr.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&wM(e,r,t);return EM(e,r),e};Object.defineProperty(dr,"__esModule",{value:!0});dr.Fields=dr.Field=dr.FieldDefinition=void 0;var _g=AM(ke()),_M=sf(),ic=class{constructor(e,t,i){this.name=e,this.description=t,this.type=i}static fromJSON(e){let t=new _M.TypeExpressionParser().parse(e.type);return new ic(e.name,e.description,t)}};dr.FieldDefinition=ic;var Ig=class{constructor(e,t=""){this.value=e,this.name=t}checkTyping(e){let t=this.value.getType();if(!t.equals(e.type))throw new _g.ErrTypingSystem(`check type of field "${e.name}; expected: ${e.type}, actual: ${t}"`);if(this.name!=e.name)throw new _g.ErrTypingSystem(`check name of field "${e.name}"`)}equals(e){return this.name==e.name&&this.value.equals(e.value)}};dr.Field=Ig;var bg=class{static checkTyping(e,t){if(e.length!=t.length)throw new _g.ErrTypingSystem("fields length vs. field definitions length");for(let i=0;i{"use strict";l();Object.defineProperty(Ko,"__esModule",{value:!0});Ko.Struct=Ko.StructType=void 0;var IM=ke(),of=jo(),CA=Dt(),Es=class extends CA.CustomType{constructor(e,t){super(e),this.fieldsDefinitions=[],this.fieldsDefinitions=t}getClassName(){return Es.ClassName}static fromJSON(e){let t=(e.fields||[]).map(i=>of.FieldDefinition.fromJSON(i));return new Es(e.name,t)}getFieldsDefinitions(){return this.fieldsDefinitions}getFieldDefinition(e){return this.fieldsDefinitions.find(t=>t.name==e)}getNamesOfDependencies(){return of.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};Ko.StructType=Es;Es.ClassName="StructType";var Go=class extends CA.TypedValue{constructor(e,t){super(e),this.fields=t,this.fieldsByName=new Map(t.map(i=>[i.name,i])),this.checkTyping()}getClassName(){return Go.ClassName}checkTyping(){let t=this.getType().getFieldsDefinitions();of.Fields.checkTyping(this.fields,t)}getFields(){return this.fields}getFieldValue(e){let t=this.fieldsByName.get(e);if(t)return t.value.valueOf();throw new IM.ErrMissingFieldOnStruct(e,this.getType().getName())}valueOf(){let e={};for(let t of this.fields)e[t.name]=t.value.valueOf();return e}equals(e){if(!this.getType().equals(e.getType()))return!1;let t=this.getFields(),i=e.getFields();return of.Fields.equals(t,i)}};Ko.Struct=Go;Go.ClassName="Struct"});var uf=D(dn=>{"use strict";l();Object.defineProperty(dn,"__esModule",{value:!0});dn.EndpointParameterDefinition=dn.EndpointModifiers=dn.EndpointDefinition=void 0;var bM=sf(),SA="?",CM="N / A",nc=class{constructor(e,t,i,n){this.input=[],this.output=[],this.name=e,this.input=t||[],this.output=i||[],this.modifiers=n}isConstructor(){return this.name=="constructor"}static fromJSON(e){e.name=e.name==null?SA:e.name,e.payableInTokens=e.payableInTokens||[],e.inputs=e.inputs||[],e.outputs=e.outputs||[];let t=e.inputs.map(s=>_s.fromJSON(s)),i=e.outputs.map(s=>_s.fromJSON(s)),n=new af(e.mutability,e.payableInTokens);return new nc(e.name,t,i,n)}};dn.EndpointDefinition=nc;var af=class{constructor(e,t){this.mutability=e||"",this.payableInTokens=t||[]}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"}};dn.EndpointModifiers=af;var _s=class{constructor(e,t,i){this.name=e,this.description=t,this.type=i}static fromJSON(e){let t=new bM.TypeExpressionParser().parse(e.type);return new _s(e.name||SA,e.description||CM,t)}};dn.EndpointParameterDefinition=_s});var Cg=D(cf=>{"use strict";l();Object.defineProperty(cf,"__esModule",{value:!0});cf.ContractInterface=void 0;var SM=xr(),xA=uf(),xM="?",sc=class{constructor(e,t,i){this.endpoints=[],this.name=e,this.constructorDefinition=t,this.endpoints=i}static fromJSON(e){e.name=e.name||xM,e.endpoints=e.endpoints||[];let t=TM(e),i=e.endpoints.map(n=>xA.EndpointDefinition.fromJSON(n));return new sc(e.name,t,i)}getConstructorDefinition(){return this.constructorDefinition}getEndpoint(e){let t=this.endpoints.find(i=>i.name==e);return SM.guardValueIsSetWithMessage(`endpoint [${e}] not found`,t),t}};cf.ContractInterface=sc;function TM(r){if(r.constructor.inputs===void 0||r.constructor.outputs===void 0)return null;let e=Object.assign({name:"constructor"},r.constructor);return xA.EndpointDefinition.fromJSON(e)}});var oc=D(gn=>{"use strict";l();Object.defineProperty(gn,"__esModule",{value:!0});gn.EnumValue=gn.EnumVariantDefinition=gn.EnumType=void 0;var NM=ke(),Sg=xr(),lf=jo(),NA=Dt(),TA=256,Is=class extends NA.CustomType{constructor(e,t){super(e),this.variants=[],this.variants=t}getClassName(){return Is.ClassName}static fromJSON(e){let t=(e.variants||[]).map(i=>zo.fromJSON(i));return new Is(e.name,t)}getVariantByDiscriminant(e){let t=this.variants.find(i=>i.discriminant==e);return Sg.guardValueIsSet(`variant by discriminant (${e})`,t),t}getVariantByName(e){let t=this.variants.find(i=>i.name==e);return Sg.guardValueIsSet(`variant by name (${e})`,t),t}getNamesOfDependencies(){let e=[];for(let t of this.variants)e.push(...t.getNamesOfDependencies());return[...new Set(e)]}};gn.EnumType=Is;Is.ClassName="EnumType";var zo=class{constructor(e,t,i=[]){this.fieldsDefinitions=[],Sg.guardTrue(tlf.FieldDefinition.fromJSON(i));return new zo(e.name,e.discriminant,t)}getFieldsDefinitions(){return this.fieldsDefinitions}getFieldDefinition(e){return this.fieldsDefinitions.find(t=>t.name==e)}getNamesOfDependencies(){return lf.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};gn.EnumVariantDefinition=zo;var pn=class extends NA.TypedValue{constructor(e,t,i){super(e),this.fields=[],this.name=t.name,this.discriminant=t.discriminant,this.fields=i,this.fieldsByName=new Map(i.map(s=>[s.name,s]));let n=t.getFieldsDefinitions();lf.Fields.checkTyping(this.fields,n)}getClassName(){return pn.ClassName}static fromName(e,t){let i=e.getVariantByName(t);return new pn(e,i,[])}static fromDiscriminant(e,t){let i=e.getVariantByDiscriminant(t);return new pn(e,i,[])}equals(e){if(!this.getType().equals(e.getType()))return!1;let t=this.getFields(),i=e.getFields(),n=this.name==e.name,s=this.discriminant==e.discriminant,o=lf.Fields.equals(t,i);return n&&s&&o}getFields(){return this.fields}getFieldValue(e){let t=this.fieldsByName.get(e);if(t)return t.value.valueOf();throw new NM.ErrMissingFieldOnEnum(e,this.getType().getName())}valueOf(){let e={name:this.name,fields:[]};return this.fields.forEach(t=>e.fields[t.name]=t.value.valueOf()),e}};gn.EnumValue=pn;pn.ClassName="EnumValue"});var Wo=D(ko=>{"use strict";l();Object.defineProperty(ko,"__esModule",{value:!0});ko.AddressValue=ko.AddressType=void 0;var DM=Hr(),DA=Dt(),bs=class extends DA.PrimitiveType{constructor(){super("Address")}getClassName(){return bs.ClassName}};ko.AddressType=bs;bs.ClassName="AddressType";var $o=class extends DA.PrimitiveValue{constructor(e){super(new bs),this.value=new DM.Address(e.bech32())}getClassName(){return $o.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};ko.AddressValue=$o;$o.ClassName="AddressValue"});var ac=D(Jo=>{"use strict";l();Object.defineProperty(Jo,"__esModule",{value:!0});Jo.BooleanValue=Jo.BooleanType=void 0;var OA=Dt(),Cs=class extends OA.PrimitiveType{constructor(){super("bool")}getClassName(){return Cs.ClassName}};Jo.BooleanType=Cs;Cs.ClassName="BooleanType";var Yo=class extends OA.PrimitiveValue{constructor(e){super(new Cs),this.value=e}getClassName(){return Yo.ClassName}equals(e){return this.value===e.value}isTrue(){return this.value===!0}isFalse(){return!this.isTrue()}valueOf(){return this.value}};Jo.BooleanValue=Yo;Yo.ClassName="BooleanValue"});var mn=D(Xo=>{"use strict";l();Object.defineProperty(Xo,"__esModule",{value:!0});Xo.BytesValue=Xo.BytesType=void 0;var BA=Dt(),Ss=class extends BA.PrimitiveType{constructor(){super("bytes")}getClassName(){return Ss.ClassName}};Xo.BytesType=Ss;Ss.ClassName="BytesType";var yn=class extends BA.PrimitiveValue{constructor(e){super(new Ss),this.value=e}getClassName(){return yn.ClassName}static fromUTF8(e){let t=y.Buffer.from(e,"utf-8");return new yn(t)}static fromHex(e){let t=y.Buffer.from(e,"hex");return new yn(t)}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()}};Xo.BytesValue=yn;yn.ClassName="BytesValue"});var ff=D(Zo=>{"use strict";l();Object.defineProperty(Zo,"__esModule",{value:!0});Zo.CompositeValue=Zo.CompositeType=void 0;var OM=xr(),xg=Dt(),xs=class extends xg.Type{constructor(...e){super("Composite",e,xg.TypeCardinality.variable(e.length))}getClassName(){return xs.ClassName}};Zo.CompositeType=xs;xs.ClassName="CompositeType";var Ts=class extends xg.TypedValue{constructor(e,t){super(e),OM.guardLength(t,e.getTypeParameters().length),this.items=t}getClassName(){return Ts.ClassName}static fromItems(...e){let t=e.map(n=>n.getType()),i=new xs(...t);return new Ts(i,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 t=0;t{"use strict";l();Object.defineProperty(hf,"__esModule",{value:!0});hf.CollectionOfTypedValues=void 0;var Tg=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 t=0;t{"use strict";l();Object.defineProperty(ui,"__esModule",{value:!0});ui.List=ui.OptionValue=ui.ListType=ui.OptionType=void 0;var BM=xr(),MM=Ng(),Ns=Dt(),ci=class extends Ns.Type{constructor(e){super("Option",[e])}getClassName(){return ci.ClassName}isAssignableFrom(e){if(!e.hasExactClass(ci.ClassName))return!1;let t=this.getFirstTypeParameter().equals(e.getFirstTypeParameter()),i=e.getFirstTypeParameter().hasExactClass(Ns.NullType.ClassName);return t||i}};ui.OptionType=ci;ci.ClassName="OptionType";var Ds=class extends Ns.Type{constructor(e){super("List",[e])}getClassName(){return Ds.ClassName}};ui.ListType=Ds;Ds.ClassName="ListType";var ji=class extends Ns.TypedValue{constructor(e,t=null){super(e),this.value=t}getClassName(){return ji.ClassName}static newMissing(){let e=new ci(new Ns.NullType);return new ji(e)}static newMissingTyped(e){return new ji(new ci(e))}static newProvided(e){let t=new ci(e.getType());return new ji(t,e)}isSet(){return!!this.value}getTypedValue(){return BM.guardValueIsSet("value",this.value),this.value}valueOf(){return this.value?this.value.valueOf():null}equals(e){var t;return((t=this.value)===null||t===void 0?void 0:t.equals(e.value))||!1}};ui.OptionValue=ji;ji.ClassName="OptionValue";var vn=class extends Ns.TypedValue{constructor(e,t){super(e),this.backingCollection=new MM.CollectionOfTypedValues(t)}getClassName(){return vn.ClassName}static fromItems(e){if(e.length==0)return new vn(new Ns.TypePlaceholder,[]);let t=e[0].getType(),i=new Ds(t);return new vn(i,e)}getLength(){return this.backingCollection.getLength()}getItems(){return this.backingCollection.getItems()}valueOf(){return this.backingCollection.valueOf()}equals(e){return this.backingCollection.equals(e.backingCollection)}};ui.List=vn;vn.ClassName="List"});var cc=D(ta=>{"use strict";l();Object.defineProperty(ta,"__esModule",{value:!0});ta.H256Value=ta.H256Type=void 0;var MA=Dt(),Os=class extends MA.PrimitiveType{constructor(){super("H256")}getClassName(){return Os.ClassName}};ta.H256Type=Os;Os.ClassName="H256Type";var ea=class extends MA.PrimitiveValue{constructor(e){super(new Os),this.value=e}getClassName(){return ea.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};ta.H256Value=ea;ea.ClassName="H256Value"});var lc=D(Ee=>{"use strict";l();var PM=Ee&&Ee.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),LM=Ee&&Ee.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),RM=Ee&&Ee.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&PM(e,r,t);return LM(e,r),e},FM=Ee&&Ee.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ee,"__esModule",{value:!0});Ee.BigIntValue=Ee.BigUIntValue=Ee.I64Value=Ee.U64Value=Ee.I32Value=Ee.U32Value=Ee.I16Value=Ee.U16Value=Ee.I8Value=Ee.U8Value=Ee.NumericalValue=Ee.BigIntType=Ee.BigUIntType=Ee.I64Type=Ee.U64Type=Ee.I32Type=Ee.U32Type=Ee.I16Type=Ee.U16Type=Ee.I8Type=Ee.U8Type=Ee.NumericalType=void 0;var PA=RM(ke()),LA=Dt(),Qs=FM(Vr()),er=class extends LA.PrimitiveType{constructor(e,t,i){super(e),this.sizeInBytes=t,this.withSign=i}getClassName(){return er.ClassName}hasFixedSize(){return!!this.sizeInBytes}hasArbitrarySize(){return!this.hasFixedSize()}};Ee.NumericalType=er;er.ClassName="NumericalType";var Bs=class extends er{constructor(){super("u8",1,!1)}getClassName(){return Bs.ClassName}};Ee.U8Type=Bs;Bs.ClassName="U8Type";var Ms=class extends er{constructor(){super("i8",1,!0)}getClassName(){return Ms.ClassName}};Ee.I8Type=Ms;Ms.ClassName="I8Type";var Ps=class extends er{constructor(){super("u16",2,!1)}getClassName(){return Ps.ClassName}};Ee.U16Type=Ps;Ps.ClassName="U16Type";var Ls=class extends er{constructor(){super("i16",2,!0)}getClassName(){return Ls.ClassName}};Ee.I16Type=Ls;Ls.ClassName="I16Type";var Rs=class extends er{constructor(){super("u32",4,!1)}getClassName(){return Rs.ClassName}};Ee.U32Type=Rs;Rs.ClassName="U32Type";var Fs=class extends er{constructor(){super("i32",4,!0)}getClassName(){return Fs.ClassName}};Ee.I32Type=Fs;Fs.ClassName="I32Type";var Us=class extends er{constructor(){super("u64",8,!1)}getClassName(){return Us.ClassName}};Ee.U64Type=Us;Us.ClassName="U64Type";var qs=class extends er{constructor(){super("i64",8,!0)}getClassName(){return qs.ClassName}};Ee.I64Type=qs;qs.ClassName="I64Type";var Vs=class extends er{constructor(){super("BigUint",0,!1)}getClassName(){return Vs.ClassName}};Ee.BigUIntType=Vs;Vs.ClassName="BigUIntType";var Hs=class extends er{constructor(){super("Bigint",0,!0)}getClassName(){return Hs.ClassName}};Ee.BigIntType=Hs;Hs.ClassName="BigIntType";var tr=class extends LA.PrimitiveValue{constructor(e,t){if(super(e),this.value=new Qs.default(t),this.sizeInBytes=e.sizeInBytes,this.withSign=e.withSign,this.value.isNaN())throw new PA.ErrInvalidArgument(`not a number: ${t}`);if(!this.withSign&&this.value.isNegative())throw new PA.ErrInvalidArgument(`negative, but type is unsigned: ${t}`)}getClassName(){return tr.ClassName}equals(e){return this.value.isEqualTo(e.value)}valueOf(){return this.value}toString(){return this.value.toString()}};Ee.NumericalValue=tr;tr.ClassName="NumericalValue";var ra=class extends tr{constructor(e){super(new Bs,new Qs.default(e))}getClassName(){return ra.ClassName}};Ee.U8Value=ra;ra.ClassName="U8Value";var ia=class extends tr{constructor(e){super(new Ms,new Qs.default(e))}getClassName(){return ia.ClassName}};Ee.I8Value=ia;ia.ClassName="I8Value";var na=class extends tr{constructor(e){super(new Ps,new Qs.default(e))}getClassName(){return na.ClassName}};Ee.U16Value=na;na.ClassName="U16Value";var sa=class extends tr{constructor(e){super(new Ls,new Qs.default(e))}getClassName(){return sa.ClassName}};Ee.I16Value=sa;sa.ClassName="I16Value";var oa=class extends tr{constructor(e){super(new Rs,new Qs.default(e))}getClassName(){return oa.ClassName}};Ee.U32Value=oa;oa.ClassName="U32Value";var aa=class extends tr{constructor(e){super(new Fs,new Qs.default(e))}getClassName(){return aa.ClassName}};Ee.I32Value=aa;aa.ClassName="I32Value";var ua=class extends tr{constructor(e){super(new Us,e)}getClassName(){return ua.ClassName}};Ee.U64Value=ua;ua.ClassName="U64Value";var ca=class extends tr{constructor(e){super(new qs,e)}getClassName(){return ca.ClassName}};Ee.I64Value=ca;ca.ClassName="I64Value";var la=class extends tr{constructor(e){super(new Vs,e)}getClassName(){return la.ClassName}};Ee.BigUIntValue=la;la.ClassName="BigUIntValue";var fa=class extends tr{constructor(e){super(new Hs,e)}getClassName(){return fa.ClassName}};Ee.BigIntValue=fa;fa.ClassName="BigIntValue"});var da=D(ha=>{"use strict";l();Object.defineProperty(ha,"__esModule",{value:!0});ha.TokenIdentifierValue=ha.TokenIdentifierType=void 0;var RA=Dt(),UM="EGLD",js=class extends RA.PrimitiveType{constructor(){super("TokenIdentifier")}getClassName(){return js.ClassName}};ha.TokenIdentifierType=js;js.ClassName="TokenIdentifierType";var wn=class extends RA.PrimitiveValue{constructor(e){super(new js),this.value=e}static egld(){return new wn(UM)}static esdtTokenIdentifier(e){return new wn(e)}getClassName(){return wn.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()}};ha.TokenIdentifierValue=wn;wn.ClassName="TokenIdentifierValue"});var pf=D(pa=>{"use strict";l();Object.defineProperty(pa,"__esModule",{value:!0});pa.VariadicValue=pa.VariadicType=void 0;var df=Dt(),An=class extends df.Type{constructor(e){super("Variadic",[e],df.TypeCardinality.variable())}getClassName(){return An.ClassName}};pa.VariadicType=An;An.ClassName="VariadicType";var En=class extends df.TypedValue{constructor(e,t){super(e),this.items=t}getClassName(){return En.ClassName}static fromItems(...e){if(e.length==0)return new En(new An(new df.TypePlaceholder),[]);let t=e[0].getType();return new En(new An(t),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 t=0;t{"use strict";l();Object.defineProperty(ga,"__esModule",{value:!0});ga.OptionalValue=ga.OptionalType=void 0;var qM=xr(),fc=Dt(),_n=class extends fc.Type{constructor(e){super("Optional",[e],fc.TypeCardinality.variable(1))}getClassName(){return _n.ClassName}isAssignableFrom(e){if(!e.hasExactClass(_n.ClassName))return!1;let t=this.getFirstTypeParameter().equals(e.getFirstTypeParameter()),i=e.getFirstTypeParameter().hasExactClass(fc.NullType.ClassName);return t||i}};ga.OptionalType=_n;_n.ClassName="OptionalType";var Gs=class extends fc.TypedValue{constructor(e,t=null){super(e),this.value=t}getClassName(){return Gs.ClassName}static newMissing(){let e=new _n(new fc.NullType);return new Gs(e)}isSet(){return!!this.value}getTypedValue(){return qM.guardValueIsSet("value",this.value),this.value}valueOf(){return this.value?this.value.valueOf():null}equals(e){var t;return((t=this.value)===null||t===void 0?void 0:t.equals(e.value))||!1}};ga.OptionalValue=Gs;Gs.ClassName="OptionalValue"});var yf=D(va=>{"use strict";l();Object.defineProperty(va,"__esModule",{value:!0});va.ArrayVec=va.ArrayVecType=void 0;var FA=xr(),VM=Ng(),UA=Dt(),ya=class extends UA.Type{constructor(e,t){super("Array",[t]),FA.guardTrue(e>0,"array length > 0"),this.length=e}getClassName(){return ya.ClassName}};va.ArrayVecType=ya;ya.ClassName="ArrayVecType";var ma=class extends UA.TypedValue{constructor(e,t){super(e),FA.guardLength(t,e.length),this.backingCollection=new VM.CollectionOfTypedValues(t)}getClassName(){return ma.ClassName}getLength(){return this.backingCollection.getLength()}getItems(){return this.backingCollection.getItems()}valueOf(){return this.backingCollection.valueOf()}equals(e){return this.backingCollection.equals(e.backingCollection)}};va.ArrayVec=ma;ma.ClassName="ArrayVec"});var mf=D(wa=>{"use strict";l();Object.defineProperty(wa,"__esModule",{value:!0});wa.StringValue=wa.StringType=void 0;var qA=Dt(),Ks=class extends qA.PrimitiveType{constructor(){super("utf-8 string")}getClassName(){return Ks.ClassName}};wa.StringType=Ks;Ks.ClassName="StringType";var In=class extends qA.PrimitiveValue{constructor(e){super(new Ks),this.value=e}getClassName(){return In.ClassName}static fromUTF8(e){return new In(e)}static fromHex(e){let t=y.Buffer.from(e,"hex").toString();return new In(t)}getLength(){return this.value.length}equals(e){return this.value===e.value}valueOf(){return this.value}};wa.StringValue=In;In.ClassName="StringValue"});var vf=D(Tr=>{"use strict";l();var HM=Tr&&Tr.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),QM=Tr&&Tr.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),jM=Tr&&Tr.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&HM(e,r,t);return QM(e,r),e};Object.defineProperty(Tr,"__esModule",{value:!0});Tr.Tuple=Tr.TupleType=void 0;var GM=jM(ke()),KM=As(),VA=jo(),zM=As(),Gi=class extends zM.StructType{constructor(...e){super(Gi.prepareName(e),Gi.prepareFieldDefinitions(e))}getClassName(){return Gi.ClassName}static prepareName(e){let t=e.map(n=>n.toString()).join(", ");return`tuple${t.length}<${t}>`}static prepareFieldDefinitions(e){return e.map((i,n)=>new VA.FieldDefinition(HA(n),"anonymous tuple field",i))}};Tr.TupleType=Gi;Gi.ClassName="TupleType";function HA(r){return`field${r}`}var zs=class extends KM.Struct{constructor(e,t){super(e,t)}getClassName(){return zs.ClassName}static fromItems(e){if(e.length<1)throw new GM.ErrTypingSystem("bad tuple items");let t=e.map(s=>s.getType()),i=new Gi(...t),n=e.map((s,o)=>new VA.Field(s,HA(o)));return new zs(i,n)}};Tr.Tuple=zs;zs.ClassName="Tuple"});var jA=D(Ea=>{"use strict";l();Object.defineProperty(Ea,"__esModule",{value:!0});Ea.CodeMetadataValue=Ea.CodeMetadataType=void 0;var QA=Dt(),wf=class extends QA.PrimitiveType{constructor(){super("CodeMetadata")}};Ea.CodeMetadataType=wf;var Dg=class extends QA.PrimitiveValue{constructor(e){super(new wf),this.value=e}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};Ea.CodeMetadataValue=Dg});var Ef=D(_a=>{"use strict";l();Object.defineProperty(_a,"__esModule",{value:!0});_a.NothingValue=_a.NothingType=void 0;var GA=Dt(),$s=class extends GA.PrimitiveType{constructor(){super("nothing")}getClassName(){return $s.ClassName}};_a.NothingType=$s;$s.ClassName="NothingType";var Aa=class extends GA.PrimitiveValue{constructor(){super(new $s)}getClassName(){return Aa.ClassName}equals(e){return!1}valueOf(){return{}}};_a.NothingValue=Aa;Aa.ClassName="NothingValue"});var Lg=D(li=>{"use strict";l();var $M=li&&li.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),kM=li&&li.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),WM=li&&li.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&$M(e,r,t);return kM(e,r),e};Object.defineProperty(li,"__esModule",{value:!0});li.TypeMapper=void 0;var KA=WM(ke()),YM=Wo(),JM=ac(),XM=mn(),Af=ff(),Og=oc(),zA=uc(),ZM=cc(),Nr=lc(),$A=As(),eP=jo(),kA=da(),Bg=pf(),Mg=gf(),_f=yf(),tP=mf(),bn=vf(),rP=jA(),WA=Ef(),Pg=class{constructor(e=[]){this.openTypesFactories=new Map([["Option",(...t)=>new zA.OptionType(t[0])],["List",(...t)=>new zA.ListType(t[0])],["VarArgs",(...t)=>new Bg.VariadicType(t[0])],["MultiResultVec",(...t)=>new Bg.VariadicType(t[0])],["variadic",(...t)=>new Bg.VariadicType(t[0])],["OptionalArg",(...t)=>new Mg.OptionalType(t[0])],["optional",(...t)=>new Mg.OptionalType(t[0])],["OptionalResult",(...t)=>new Mg.OptionalType(t[0])],["multi",(...t)=>new Af.CompositeType(...t)],["MultiArg",(...t)=>new Af.CompositeType(...t)],["MultiResult",(...t)=>new Af.CompositeType(...t)],["multi",(...t)=>new Af.CompositeType(...t)],["tuple",(...t)=>new bn.TupleType(...t)],["tuple2",(...t)=>new bn.TupleType(...t)],["tuple3",(...t)=>new bn.TupleType(...t)],["tuple4",(...t)=>new bn.TupleType(...t)],["tuple5",(...t)=>new bn.TupleType(...t)],["tuple6",(...t)=>new bn.TupleType(...t)],["tuple7",(...t)=>new bn.TupleType(...t)],["tuple8",(...t)=>new bn.TupleType(...t)],["array20",(...t)=>new _f.ArrayVecType(20,t[0])],["array32",(...t)=>new _f.ArrayVecType(32,t[0])],["array46",(...t)=>new _f.ArrayVecType(46,t[0])],["array64",(...t)=>new _f.ArrayVecType(64,t[0])]]),this.closedTypesMap=new Map([["u8",new Nr.U8Type],["u16",new Nr.U16Type],["u32",new Nr.U32Type],["u64",new Nr.U64Type],["U64",new Nr.U64Type],["BigUint",new Nr.BigUIntType],["i8",new Nr.I8Type],["i16",new Nr.I16Type],["i32",new Nr.I32Type],["i64",new Nr.I64Type],["Bigint",new Nr.BigIntType],["BigInt",new Nr.BigIntType],["bool",new JM.BooleanType],["bytes",new XM.BytesType],["Address",new YM.AddressType],["H256",new ZM.H256Type],["utf-8 string",new tP.StringType],["TokenIdentifier",new kA.TokenIdentifierType],["EgldOrEsdtTokenIdentifier",new kA.TokenIdentifierType],["CodeMetadata",new rP.CodeMetadataType],["nothing",new WA.NothingType],["AsyncCall",new WA.NothingType]]),this.learnedTypesMap=new Map;for(let t of e)this.learnedTypesMap.set(t.getName(),t)}mapType(e){let t=this.mapRecursiveType(e);if(t)return t.isGenericType()||this.learnType(t),t;throw new KA.ErrTypingSystem(`Cannot map the type "${e.getName()}" to a known type`)}mapRecursiveType(e){let t=e.isGenericType(),i=this.learnedTypesMap.get(e.getName());if(i)return i;let n=this.closedTypesMap.get(e.getName());return n||(e.hasExactClass(Og.EnumType.ClassName)?this.mapEnumType(e):e.hasExactClass($A.StructType.ClassName)?this.mapStructType(e):t?this.mapGenericType(e):null)}learnType(e){this.learnedTypesMap.delete(e.getName()),this.learnedTypesMap.set(e.getName(),e)}mapStructType(e){let t=this.mappedFields(e.getFieldsDefinitions());return new $A.StructType(e.getName(),t)}mapEnumType(e){let t=e.variants.map(n=>new Og.EnumVariantDefinition(n.name,n.discriminant,this.mappedFields(n.getFieldsDefinitions())));return new Og.EnumType(e.getName(),t)}mappedFields(e){return e.map(t=>new eP.FieldDefinition(t.name,t.description,this.mapType(t.type)))}mapGenericType(e){let i=e.getTypeParameters().map(s=>this.mapType(s)),n=this.openTypesFactories.get(e.getName());if(!n)throw new KA.ErrTypingSystem(`Cannot map the generic type "${e.getName()}" to a known type`);return n(...i)}};li.TypeMapper=Pg});var t_=D(fi=>{"use strict";l();var iP=fi&&fi.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),nP=fi&&fi.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),sP=fi&&fi.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&iP(e,r,t);return nP(e,r),e};Object.defineProperty(fi,"__esModule",{value:!0});fi.AbiRegistry=void 0;var oP=sP(ke()),Rg=xr(),YA=As(),JA=Cg(),XA=oc(),ZA=Lg(),Fg=uf(),Ia=class{constructor(){this.interfaces=[],this.customTypes=[]}static create(e){return new Ia().extend(e).remapToKnownTypes()}extend(e){e.types=e.types||{};let t=JA.ContractInterface.fromJSON(e);this.interfaces.push(t);for(let i in e.types){let n=e.types[i],s=n.type;n.name=i;let o=this.createCustomType(s,n);this.customTypes.push(o)}return this.sortCustomTypesByDependencies(),this}createCustomType(e,t){if(e=="struct")return YA.StructType.fromJSON(t);if(e=="enum")return XA.EnumType.fromJSON(t);throw new oP.ErrTypingSystem(`Unknown type discriminant: ${e}`)}sortCustomTypesByDependencies(){this.customTypes.sort((e,t)=>t.getNamesOfDependencies().indexOf(e.getName())>-1?-1:1)}getInterface(e){let t=this.interfaces.find(i=>i.name==e);return Rg.guardValueIsSetWithMessage(`interface [${e}] not found`,t),t}getInterfaces(e){return e.map(t=>this.getInterface(t))}getStruct(e){let t=this.customTypes.find(i=>i.getName()==e&&i.hasExactClass(YA.StructType.ClassName));return Rg.guardValueIsSetWithMessage(`struct [${e}] not found`,t),t}getStructs(e){return e.map(t=>this.getStruct(t))}getEnum(e){let t=this.customTypes.find(i=>i.getName()==e&&i.hasExactClass(XA.EnumType.ClassName));return Rg.guardValueIsSetWithMessage(`enum [${e}] not found`,t),t}getEnums(e){return e.map(t=>this.getEnum(t))}remapToKnownTypes(){let e=new ZA.TypeMapper([]),t=[],i=[];for(let s of this.customTypes){let o=e.mapType(s);t.push(o)}e=new ZA.TypeMapper(t);for(let s of this.interfaces){let o=[];for(let u of s.endpoints)o.push(e_(u,e));let a=s.constructorDefinition?e_(s.constructorDefinition,e):null;i.push(new JA.ContractInterface(s.name,a,o))}let n=new Ia;return n.customTypes.push(...t),n.interfaces.push(...i),n}};fi.AbiRegistry=Ia;function e_(r,e){let t=r.input.map(n=>new Fg.EndpointParameterDefinition(n.name,n.description,e.mapType(n.type))),i=r.output.map(n=>new Fg.EndpointParameterDefinition(n.name,n.description,e.mapType(n.type)));return new Fg.EndpointDefinition(r.name,t,i,r.modifiers)}});var i_=D(ba=>{"use strict";l();Object.defineProperty(ba,"__esModule",{value:!0});ba.createListOfTokenIdentifiers=ba.createListOfAddresses=void 0;var aP=Wo(),r_=uc(),uP=da();function cP(r){let e=r.map(i=>new aP.AddressValue(i));return r_.List.fromItems(e)}ba.createListOfAddresses=cP;function lP(r){let e=r.map(i=>new uP.TokenIdentifierValue(i));return r_.List.fromItems(e)}ba.createListOfTokenIdentifiers=lP});var m_=D(rr=>{"use strict";l();var fP=rr&&rr.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),hP=rr&&rr.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),dP=rr&&rr.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&fP(e,r,t);return hP(e,r),e};Object.defineProperty(rr,"__esModule",{value:!0});rr.onPrimitiveTypeSelect=rr.onPrimitiveValueSelect=rr.onTypedValueSelect=rr.onTypeSelect=void 0;var bf=dP(ke()),n_=Wo(),s_=ac(),o_=mn(),a_=oc(),If=uc(),u_=cc(),c_=lc(),l_=Ef(),f_=As(),h_=da(),d_=vf(),p_=Dt(),g_=yf(),y_=mf();function pP(r,e){if(r.hasExactClass(If.OptionType.ClassName))return e.onOption();if(r.hasExactClass(If.ListType.ClassName))return e.onList();if(r.hasExactClass(g_.ArrayVecType.ClassName))return e.onArray();if(r.hasClassOrSuperclass(p_.PrimitiveType.ClassName))return e.onPrimitive();if(r.hasExactClass(f_.StructType.ClassName))return e.onStruct();if(r.hasExactClass(d_.TupleType.ClassName))return e.onTuple();if(r.hasExactClass(a_.EnumType.ClassName))return e.onEnum();if(e.onOther)return e.onOther();throw new bf.ErrTypingSystem(`type isn't known: ${r}`)}rr.onTypeSelect=pP;function gP(r,e){if(r.hasClassOrSuperclass(p_.PrimitiveValue.ClassName))return e.onPrimitive();if(r.hasExactClass(If.OptionValue.ClassName))return e.onOption();if(r.hasExactClass(If.List.ClassName))return e.onList();if(r.hasExactClass(g_.ArrayVec.ClassName))return e.onArray();if(r.hasExactClass(f_.Struct.ClassName))return e.onStruct();if(r.hasExactClass(d_.Tuple.ClassName))return e.onTuple();if(r.hasExactClass(a_.EnumValue.ClassName))return e.onEnum();if(e.onOther)return e.onOther();throw new bf.ErrTypingSystem(`value isn't typed: ${r}`)}rr.onTypedValueSelect=gP;function yP(r,e){if(r.hasExactClass(s_.BooleanValue.ClassName))return e.onBoolean();if(r.hasClassOrSuperclass(c_.NumericalValue.ClassName))return e.onNumerical();if(r.hasExactClass(n_.AddressValue.ClassName))return e.onAddress();if(r.hasExactClass(o_.BytesValue.ClassName))return e.onBytes();if(r.hasExactClass(y_.StringValue.ClassName))return e.onString();if(r.hasExactClass(u_.H256Value.ClassName))return e.onH256();if(r.hasExactClass(h_.TokenIdentifierValue.ClassName))return e.onTypeIdentifier();if(r.hasExactClass(l_.NothingValue.ClassName))return e.onNothing();if(e.onOther)return e.onOther();throw new bf.ErrTypingSystem(`value isn't a primitive: ${r.getType()}`)}rr.onPrimitiveValueSelect=yP;function mP(r,e){if(r.hasExactClass(s_.BooleanType.ClassName))return e.onBoolean();if(r.hasClassOrSuperclass(c_.NumericalType.ClassName))return e.onNumerical();if(r.hasExactClass(n_.AddressType.ClassName))return e.onAddress();if(r.hasExactClass(o_.BytesType.ClassName))return e.onBytes();if(r.hasExactClass(y_.StringType.ClassName))return e.onString();if(r.hasExactClass(u_.H256Type.ClassName))return e.onH256();if(r.hasExactClass(h_.TokenIdentifierType.ClassName))return e.onTokenIndetifier();if(r.hasExactClass(l_.NothingType.ClassName))return e.onNothing();if(e.onOther)return e.onOther();throw new bf.ErrTypingSystem(`type isn't a known primitive: ${r}`)}rr.onPrimitiveTypeSelect=mP});var ir=D(Ue=>{"use strict";l();var vP=Ue&&Ue.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),We=Ue&&Ue.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&vP(e,r,t)};Object.defineProperty(Ue,"__esModule",{value:!0});We(t_(),Ue);We(Wo(),Ue);We(gf(),Ue);We(ac(),Ue);We(mn(),Ue);We(ff(),Ue);We(Cg(),Ue);We(uf(),Ue);We(oc(),Ue);We(i_(),Ue);We(jo(),Ue);We(uc(),Ue);We(yf(),Ue);We(cc(),Ue);We(m_(),Ue);We(Ef(),Ue);We(lc(),Ue);We(mf(),Ue);We(As(),Ue);We(vf(),Ue);We(da(),Ue);We(sf(),Ue);We(Lg(),Ue);We(Dt(),Ue);We(pf(),Ue)});var w_=D(hi=>{"use strict";l();var wP=hi&&hi.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),EP=hi&&hi.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),AP=hi&&hi.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&wP(e,r,t);return EP(e,r),e};Object.defineProperty(hi,"__esModule",{value:!0});hi.OptionValueBinaryCodec=void 0;var v_=AP(ke()),Cf=ir(),Ug=class{constructor(e){this.binaryCodec=e}decodeNested(e,t){if(e[0]==0)return[Cf.OptionValue.newMissingTyped(t),1];if(e[0]!=1)throw new v_.ErrCodec("invalid buffer for optional value");let[i,n]=this.binaryCodec.decodeNested(e.slice(1),t);return[Cf.OptionValue.newProvided(i),n+1]}decodeTopLevel(e,t){if(e.length==0)return new Cf.OptionValue(t);if(e[0]!=1)throw new v_.ErrCodec("invalid buffer for optional value");let[i,n]=this.binaryCodec.decodeNested(e.slice(1),t);return new Cf.OptionValue(t,i)}encodeNested(e){return e.isSet()?y.Buffer.concat([y.Buffer.from([1]),this.binaryCodec.encodeNested(e.getTypedValue())]):y.Buffer.from([0])}encodeTopLevel(e){return e.isSet()?y.Buffer.concat([y.Buffer.from([1]),this.binaryCodec.encodeNested(e.getTypedValue())]):y.Buffer.from([])}};hi.OptionValueBinaryCodec=Ug});var E_=D(Sf=>{"use strict";l();Object.defineProperty(Sf,"__esModule",{value:!0});Sf.AddressBinaryCodec=void 0;var _P=Hr(),IP=ir(),qg=class{decodeNested(e){let t=e.slice(0,32),i=new _P.Address(t);return[new IP.AddressValue(i),32]}decodeTopLevel(e){let[t,i]=this.decodeNested(e);return t}encodeNested(e){return e.valueOf().pubkey()}encodeTopLevel(e){return e.valueOf().pubkey()}};Sf.AddressBinaryCodec=qg});var __=D(di=>{"use strict";l();var bP=di&&di.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),CP=di&&di.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),SP=di&&di.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&bP(e,r,t);return CP(e,r),e};Object.defineProperty(di,"__esModule",{value:!0});di.BooleanBinaryCodec=void 0;var xP=SP(ke()),A_=ir(),Qr=class{decodeNested(e){let t=e.readUInt8(0);return[new A_.BooleanValue(t==Qr.TRUE),1]}decodeTopLevel(e){if(e.length>1)throw new xP.ErrInvalidArgument("buffer should be of size <= 1");let t=e[0];return new A_.BooleanValue(t==Qr.TRUE)}encodeNested(e){return e.isTrue()?y.Buffer.from([Qr.TRUE]):y.Buffer.from([Qr.FALSE])}encodeTopLevel(e){return e.isTrue()?y.Buffer.from([Qr.TRUE]):y.Buffer.from([])}};di.BooleanBinaryCodec=Qr;Qr.TRUE=1;Qr.FALSE=0});var b_=D(pi=>{"use strict";l();var TP=pi&&pi.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(pi,"__esModule",{value:!0});pi.zeroPadStringIfOddLength=pi.isPaddedHex=pi.numberToPaddedHex=void 0;var NP=TP(Vr());function DP(r){let e=new NP.default(r).toString(16);return I_(e)}pi.numberToPaddedHex=DP;function OP(r){r=r||"";let e=y.Buffer.from(r,"hex").toString("hex");return r.toUpperCase()==e.toUpperCase()}pi.isPaddedHex=OP;function I_(r){return r=r||"",r.length%2==1?"0"+r:r}pi.zeroPadStringIfOddLength=I_});var Vg=D(Ot=>{"use strict";l();var BP=Ot&&Ot.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ot,"__esModule",{value:!0});Ot.prependByteToBuffer=Ot.flipBufferBitsInPlace=Ot.getHexMagnitudeOfBigInt=Ot.bigIntToBuffer=Ot.bufferToBigInt=Ot.cloneBuffer=Ot.isMsbZero=Ot.isMsbOne=void 0;var C_=BP(Vr()),MP=b_();function S_(r,e=0){return r[e]>>7==1}Ot.isMsbOne=S_;function PP(r,e=0){return!S_(r,e)}Ot.isMsbZero=PP;function LP(r){let e=y.Buffer.alloc(r.length);return r.copy(e),e}Ot.cloneBuffer=LP;function RP(r){let e=r.toString("hex");return new C_.default(`0x${e}`,16)}Ot.bufferToBigInt=RP;function FP(r){let e=x_(r);return y.Buffer.from(e,"hex")}Ot.bigIntToBuffer=FP;function x_(r){return r?(r.isNegative()&&(r=r.multipliedBy(new C_.default(-1))),MP.numberToPaddedHex(r)):""}Ot.getHexMagnitudeOfBigInt=x_;function UP(r){for(let e=0;e{"use strict";l();Object.defineProperty(xf,"__esModule",{value:!0});xf.SizeOfU32=void 0;xf.SizeOfU32=4});var N_=D(Ca=>{"use strict";l();var VP=Ca&&Ca.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ca,"__esModule",{value:!0});Ca.NumericalBinaryCodec=void 0;var Hg=ir(),at=Vg(),hc=VP(Vr()),T_=Tf(),Qg=class{decodeNested(e,t){let i=0,n=t.sizeInBytes;n||(i=T_.SizeOfU32,n=e.readUInt32BE(0));let s=e.slice(i,i+n),o=this.decodeTopLevel(s,t),a=n+i;return[o,a]}decodeTopLevel(e,t){let i=at.cloneBuffer(e);if(e.length==0)return new Hg.NumericalValue(t,new hc.default(0));if(!t.withSign||at.isMsbZero(i)){let h=at.bufferToBigInt(i);return new Hg.NumericalValue(t,h)}at.flipBufferBitsInPlace(i);let u=at.bufferToBigInt(i).multipliedBy(new hc.default(-1)).minus(new hc.default(1));return new Hg.NumericalValue(t,u)}encodeNested(e){if(e.sizeInBytes)return this.encodeNestedFixedSize(e,e.sizeInBytes);let t=this.encodeTopLevel(e),i=y.Buffer.alloc(T_.SizeOfU32);return i.writeUInt32BE(t.length),y.Buffer.concat([i,t])}encodeNestedFixedSize(e,t){if(e.value.isZero())return y.Buffer.alloc(t,0);if(!e.withSign){let o=at.bigIntToBuffer(e.value),a=y.Buffer.alloc(t-o.length,0);return y.Buffer.concat([a,o])}if(e.value.isPositive()){let o=at.bigIntToBuffer(e.value);at.isMsbOne(o)&&(o=at.prependByteToBuffer(o,0));let a=y.Buffer.alloc(t-o.length,0);return y.Buffer.concat([a,o])}let i=e.value.plus(new hc.default(1)),n=at.bigIntToBuffer(i);at.flipBufferBitsInPlace(n),at.isMsbZero(n)&&(n=at.prependByteToBuffer(n,255));let s=y.Buffer.alloc(t-n.length,255);return y.Buffer.concat([s,n])}encodeTopLevel(e){let t=e.withSign;return e.value.isZero()?y.Buffer.alloc(0):t?this.encodePrimitive(e):at.bigIntToBuffer(e.value)}encodePrimitive(e){if(e.value.isPositive()){let n=at.bigIntToBuffer(e.value);return at.isMsbOne(n)&&(n=at.prependByteToBuffer(n,0)),n}let t=e.value.plus(new hc.default(1)),i=at.bigIntToBuffer(t);return at.flipBufferBitsInPlace(i),at.isMsbZero(i)&&(i=at.prependByteToBuffer(i,255)),i}};Ca.NumericalBinaryCodec=Qg});var D_=D(Nf=>{"use strict";l();Object.defineProperty(Nf,"__esModule",{value:!0});Nf.H256BinaryCodec=void 0;var HP=cc(),jg=class{decodeNested(e){let t=e.slice(0,32);return[new HP.H256Value(t),32]}decodeTopLevel(e){let[t,i]=this.decodeNested(e);return t}encodeNested(e){return e.valueOf()}encodeTopLevel(e){return e.valueOf()}};Nf.H256BinaryCodec=jg});var Bf=D(Of=>{"use strict";l();Object.defineProperty(Of,"__esModule",{value:!0});Of.BytesBinaryCodec=void 0;var O_=mn(),Df=Tf(),Gg=class{decodeNested(e){let t=e.readUInt32BE(0),i=e.slice(Df.SizeOfU32,Df.SizeOfU32+t);return[new O_.BytesValue(i),Df.SizeOfU32+t]}decodeTopLevel(e){return new O_.BytesValue(e)}encodeNested(e){let t=y.Buffer.alloc(Df.SizeOfU32);return t.writeUInt32BE(e.getLength()),y.Buffer.concat([t,e.valueOf()])}encodeTopLevel(e){return e.valueOf()}};Of.BytesBinaryCodec=Gg});var M_=D(Mf=>{"use strict";l();Object.defineProperty(Mf,"__esModule",{value:!0});Mf.TokenIdentifierCodec=void 0;var QP=mn(),B_=da(),jP=Bf(),Kg=class{constructor(){this.bytesCodec=new jP.BytesBinaryCodec}decodeNested(e){let[t,i]=this.bytesCodec.decodeNested(e);return[new B_.TokenIdentifierValue(t.toString()),i]}decodeTopLevel(e){let t=this.bytesCodec.decodeTopLevel(e);return new B_.TokenIdentifierValue(t.toString())}encodeNested(e){let t=QP.BytesValue.fromUTF8(e.valueOf());return this.bytesCodec.encodeNested(t)}encodeTopLevel(e){return y.Buffer.from(e.valueOf())}};Mf.TokenIdentifierCodec=Kg});var L_=D(Pf=>{"use strict";l();Object.defineProperty(Pf,"__esModule",{value:!0});Pf.NothingCodec=void 0;var P_=ir(),zg=class{decodeNested(){return[new P_.NothingValue,0]}decodeTopLevel(){return new P_.NothingValue}encodeNested(){return y.Buffer.from([])}encodeTopLevel(){return y.Buffer.from([])}};Pf.NothingCodec=zg});var F_=D(Lf=>{"use strict";l();Object.defineProperty(Lf,"__esModule",{value:!0});Lf.StringBinaryCodec=void 0;var R_=ir(),GP=mn(),KP=Bf(),$g=class{constructor(){this.bytesBinaryCodec=new KP.BytesBinaryCodec}decodeNested(e){let[t,i]=this.bytesBinaryCodec.decodeNested(e);return[new R_.StringValue(t.valueOf().toString()),i]}decodeTopLevel(e){return new R_.StringValue(e.toString())}encodeNested(e){let t=GP.BytesValue.fromUTF8(e.valueOf());return this.bytesBinaryCodec.encodeNested(t)}encodeTopLevel(e){return y.Buffer.from(e.valueOf())}};Lf.StringBinaryCodec=$g});var U_=D(Ff=>{"use strict";l();Object.defineProperty(Ff,"__esModule",{value:!0});Ff.PrimitiveBinaryCodec=void 0;var Rf=ir(),zP=E_(),$P=__(),kP=N_(),WP=D_(),YP=Bf(),JP=M_(),XP=L_(),ZP=F_(),kg=class{constructor(e){this.binaryCodec=e,this.booleanCodec=new $P.BooleanBinaryCodec,this.numericalCodec=new kP.NumericalBinaryCodec,this.addressCodec=new zP.AddressBinaryCodec,this.h256Codec=new WP.H256BinaryCodec,this.bytesCodec=new YP.BytesBinaryCodec,this.stringCodec=new ZP.StringBinaryCodec,this.tokenIdentifierCodec=new JP.TokenIdentifierCodec,this.nothingCodec=new XP.NothingCodec}decodeNested(e,t){return Rf.onPrimitiveTypeSelect(t,{onBoolean:()=>this.booleanCodec.decodeNested(e),onNumerical:()=>this.numericalCodec.decodeNested(e,t),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,t){return Rf.onPrimitiveTypeSelect(t,{onBoolean:()=>this.booleanCodec.decodeTopLevel(e),onNumerical:()=>this.numericalCodec.decodeTopLevel(e,t),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 Rf.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 Rf.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()})}};Ff.PrimitiveBinaryCodec=kg});var H_=D(Uf=>{"use strict";l();Object.defineProperty(Uf,"__esModule",{value:!0});Uf.ListBinaryCodec=void 0;var q_=ir(),V_=Tf(),Wg=class{constructor(e){this.binaryCodec=e}decodeNested(e,t){let i=t.getFirstTypeParameter(),n=[],s=e.readUInt32BE(0);this.binaryCodec.constraints.checkListLength(s);let o=e,a=V_.SizeOfU32;e=o.slice(a);for(let u=0;u0;){let[a,u]=this.binaryCodec.decodeNested(e,i);n.push(a),o+=u,e=s.slice(o),this.binaryCodec.constraints.checkListLength(n.length)}return new q_.List(t,n)}encodeNested(e){this.binaryCodec.constraints.checkListLength(e.getLength());let t=y.Buffer.alloc(V_.SizeOfU32);t.writeUInt32BE(e.getLength());let i=[];for(let s of e.getItems()){let o=this.binaryCodec.encodeNested(s);i.push(o)}return y.Buffer.concat([t,...i])}encodeTopLevel(e){this.binaryCodec.constraints.checkListLength(e.getLength());let t=[];for(let n of e.getItems()){let s=this.binaryCodec.encodeNested(n);t.push(s)}return y.Buffer.concat(t)}};Uf.ListBinaryCodec=Wg});var Jg=D(qf=>{"use strict";l();Object.defineProperty(qf,"__esModule",{value:!0});qf.FieldsBinaryCodec=void 0;var e5=ir(),Yg=class{constructor(e){this.binaryCodec=e}decodeNested(e,t){let i=[],n=0;for(let s of t){let[o,a]=this.binaryCodec.decodeNested(e,s.type);e=e.slice(a),n+=a;let u=new e5.Field(o,s.name);i.push(u)}return[i,n]}encodeNested(e){let t=[];for(let i of e){let n=this.binaryCodec.encodeNested(i.value);t.push(n)}return y.Buffer.concat(t)}};qf.FieldsBinaryCodec=Yg});var Zg=D(Vf=>{"use strict";l();Object.defineProperty(Vf,"__esModule",{value:!0});Vf.StructBinaryCodec=void 0;var t5=ir(),r5=Jg(),Xg=class{constructor(e){this.fieldsCodec=new r5.FieldsBinaryCodec(e)}decodeTopLevel(e,t){let[i]=this.decodeNested(e,t);return i}decodeNested(e,t){let i=t.getFieldsDefinitions(),[n,s]=this.fieldsCodec.decodeNested(e,i);return[new t5.Struct(t,n),s]}encodeNested(e){let t=e.getFields();return this.fieldsCodec.encodeNested(t)}encodeTopLevel(e){return this.encodeNested(e)}};Vf.StructBinaryCodec=Xg});var Q_=D(Qf=>{"use strict";l();Object.defineProperty(Qf,"__esModule",{value:!0});Qf.EnumBinaryCodec=void 0;var Hf=ir(),i5=Jg(),ey=class{constructor(e){this.binaryCodec=e,this.fieldsCodec=new i5.FieldsBinaryCodec(e)}decodeTopLevel(e,t){let[i]=this.decodeNested(e,t);return i}decodeNested(e,t){let[i,n]=this.readDiscriminant(e);e=e.slice(n);let s=t.getVariantByDiscriminant(i),o=s.getFieldsDefinitions(),[a,u]=this.fieldsCodec.decodeNested(e,o);return[new Hf.EnumValue(t,s,a),n+u]}readDiscriminant(e){let[t,i]=this.binaryCodec.decodeNested(e,new Hf.U8Type);return[t.valueOf(),i]}encodeNested(e){let t=new Hf.U8Value(e.discriminant),i=this.binaryCodec.encodeNested(t),n=e.getFields(),s=this.fieldsCodec.encodeNested(n);return y.Buffer.concat([i,s])}encodeTopLevel(e){let t=e.getFields(),i=t.length>0,n=this.fieldsCodec.encodeNested(t),s=new Hf.U8Value(e.discriminant),o=i?this.binaryCodec.encodeNested(s):this.binaryCodec.encodeTopLevel(s);return y.Buffer.concat([o,n])}};Qf.EnumBinaryCodec=ey});var j_=D(jf=>{"use strict";l();Object.defineProperty(jf,"__esModule",{value:!0});jf.TupleBinaryCodec=void 0;var n5=Zg(),ty=class{constructor(e){this.structCodec=new n5.StructBinaryCodec(e)}decodeTopLevel(e,t){return this.structCodec.decodeTopLevel(e,t)}decodeNested(e,t){return this.structCodec.decodeNested(e,t)}encodeNested(e){return this.structCodec.encodeNested(e)}encodeTopLevel(e){return this.structCodec.encodeTopLevel(e)}};jf.TupleBinaryCodec=ty});var G_=D(Gf=>{"use strict";l();Object.defineProperty(Gf,"__esModule",{value:!0});Gf.ArrayVecBinaryCodec=void 0;var s5=ir(),ry=class{constructor(e){this.binaryCodec=e}decodeNested(e,t){let i=t.length,n=t.getFirstTypeParameter(),s=[],o=0;for(let a=0;a{"use strict";l();var o5=Dr&&Dr.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),a5=Dr&&Dr.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),u5=Dr&&Dr.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&o5(e,r,t);return a5(e,r),e};Object.defineProperty(Dr,"__esModule",{value:!0});Dr.BinaryCodecConstraints=Dr.BinaryCodec=void 0;var K_=u5(ke()),Kf=ir(),z_=xr(),c5=w_(),l5=U_(),f5=H_(),h5=Zg(),d5=Q_(),p5=j_(),g5=G_(),iy=class{constructor(e=null){this.constraints=e||new zf,this.optionCodec=new c5.OptionValueBinaryCodec(this),this.listCodec=new f5.ListBinaryCodec(this),this.arrayCodec=new g5.ArrayVecBinaryCodec(this),this.primitiveCodec=new l5.PrimitiveBinaryCodec(this),this.structCodec=new h5.StructBinaryCodec(this),this.tupleCodec=new p5.TupleBinaryCodec(this),this.enumCodec=new d5.EnumBinaryCodec(this)}decodeTopLevel(e,t){return this.constraints.checkBufferLength(e),Kf.onTypeSelect(t,{onOption:()=>this.optionCodec.decodeTopLevel(e,t.getFirstTypeParameter()),onList:()=>this.listCodec.decodeTopLevel(e,t),onArray:()=>this.arrayCodec.decodeTopLevel(e,t),onPrimitive:()=>this.primitiveCodec.decodeTopLevel(e,t),onStruct:()=>this.structCodec.decodeTopLevel(e,t),onTuple:()=>this.tupleCodec.decodeTopLevel(e,t),onEnum:()=>this.enumCodec.decodeTopLevel(e,t)})}decodeNested(e,t){this.constraints.checkBufferLength(e);let[i,n]=Kf.onTypeSelect(t,{onOption:()=>this.optionCodec.decodeNested(e,t.getFirstTypeParameter()),onList:()=>this.listCodec.decodeNested(e,t),onArray:()=>this.arrayCodec.decodeNested(e,t),onPrimitive:()=>this.primitiveCodec.decodeNested(e,t),onStruct:()=>this.structCodec.decodeNested(e,t),onTuple:()=>this.tupleCodec.decodeNested(e,t),onEnum:()=>this.enumCodec.decodeNested(e,t)});return[i,n]}encodeNested(e){return z_.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),Kf.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 z_.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),Kf.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)})}};Dr.BinaryCodec=iy;var zf=class{constructor(e){this.maxBufferLength=e?.maxBufferLength||4096,this.maxListLength=e?.maxListLength||1024}checkBufferLength(e){if(e.length>this.maxBufferLength)throw new K_.ErrCodec(`Buffer too large: ${e.length} > ${this.maxBufferLength}`)}checkListLength(e){if(e>this.maxListLength)throw new K_.ErrCodec(`List too large: ${e} > ${this.maxListLength}`)}};Dr.BinaryCodecConstraints=zf});var $_=D(Or=>{"use strict";l();var y5=Or&&Or.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Or,"__esModule",{value:!0});Or.decodeBigNumber=Or.decodeString=Or.decodeBool=Or.decodeUnsignedNumber=void 0;var m5=y5(Vr()),$f=ir(),v5=ny(),kf=new v5.BinaryCodec;function w5(r){let e=kf.decodeTopLevel(r,new $f.BigUIntType);return Number(e.valueOf())}Or.decodeUnsignedNumber=w5;function E5(r){let e=kf.decodeTopLevel(r,new $f.BooleanType);return Boolean(e.valueOf())}Or.decodeBool=E5;function A5(r){let e=kf.decodeTopLevel(r,new $f.BytesType);return String(e.valueOf())}Or.decodeString=A5;function _5(r){let e=kf.decodeTopLevel(r,new $f.BigUIntType);return new m5.default(e.valueOf())}Or.decodeBigNumber=_5});var W_=D(Cn=>{"use strict";l();var I5=Cn&&Cn.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),k_=Cn&&Cn.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&I5(e,r,t)};Object.defineProperty(Cn,"__esModule",{value:!0});k_(ny(),Cn);k_($_(),Cn)});var Wf=D(Sn=>{"use strict";l();Object.defineProperty(Sn,"__esModule",{value:!0});Sn.ArgSerializer=Sn.ArgumentsSeparator=void 0;var b5=W_(),sy=ff(),oy=pf(),ay=gf();Sn.ArgumentsSeparator="@";var Y_=new b5.BinaryCodec,uy=class{stringToValues(e,t){let i=this.stringToBuffers(e);return this.buffersToValues(i,t)}stringToBuffers(e){return e.split(Sn.ArgumentsSeparator).map(t=>y.Buffer.from(t,"hex"))}buffersToValues(e,t){e=e||[];let i=[],n=0,s=e.length;for(let h=0;h=s}return i}valuesToString(e){let t=this.valuesToStrings(e),i=t.join(Sn.ArgumentsSeparator),n=t.length;return{argumentsString:i,count:n}}valuesToStrings(e){return this.valuesToBuffers(e).map(n=>n.toString("hex"))}valuesToBuffers(e){let t=[];for(let n of e)i(n);function i(n){if(n.hasExactClass(ay.OptionalValue.ClassName)){let s=n;s.isSet()&&i(s.getTypedValue())}else if(n.hasExactClass(oy.VariadicValue.ClassName)){let s=n;for(let o of s.getItems())i(o)}else if(n.hasExactClass(sy.CompositeValue.ClassName)){let s=n;for(let o of s.getItems())i(o)}else{let s=Y_.encodeTopLevel(n);t.push(s)}}return t}};Sn.ArgSerializer=uy});var gy=D(jr=>{"use strict";l();Object.defineProperty(jr,"__esModule",{value:!0});jr.ContractCallPayloadBuilder=jr.ContractUpgradePayloadBuilder=jr.ContractDeployPayloadBuilder=jr.ArwenVirtualMachine=void 0;var hy=dc(),dy=xr(),C5=Wf();jr.ArwenVirtualMachine="0500";var cy=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(){dy.guardValueIsSet("code",this.code);let e=this.code.toString(),t=this.codeMetadata.toString(),i=`${e}@${jr.ArwenVirtualMachine}@${t}`;return i=py(i,this.arguments),new hy.TransactionPayload(i)}};jr.ContractDeployPayloadBuilder=cy;var ly=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(){dy.guardValueIsSet("code",this.code);let e=this.code.toString(),t=this.codeMetadata.toString(),i=`upgradeContract@${e}@${t}`;return i=py(i,this.arguments),new hy.TransactionPayload(i)}};jr.ContractUpgradePayloadBuilder=ly;var fy=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(){dy.guardValueIsSet("calledFunction",this.contractFunction);let e=this.contractFunction.name;return e=py(e,this.arguments),new hy.TransactionPayload(e)}};jr.ContractCallPayloadBuilder=fy;function py(r,e){let{argumentsString:t,count:i}=new C5.ArgSerializer().valuesToString(e);return i==0?r:`${r}@${t}`}});var dc=D(Yf=>{"use strict";l();Object.defineProperty(Yf,"__esModule",{value:!0});Yf.TransactionPayload=void 0;var yy=gy(),Sa=class{constructor(e){this.data=y.Buffer.from(e||[])}static fromEncoded(e){if(!e)return new Sa("");let t=y.Buffer.from(e,"base64").toString();return new Sa(t)}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=>y.Buffer.from(e,"hex"))}length(){return y.Buffer.from(this.data).length}static contractDeploy(){return new yy.ContractDeployPayloadBuilder}static contractUpgrade(){return new yy.ContractUpgradePayloadBuilder}static contractCall(){return new yy.ContractCallPayloadBuilder}};Yf.TransactionPayload=Sa});var Z_=D(xn=>{"use strict";l();Object.defineProperty(xn,"__esModule",{value:!0});xn.MultiESDTNFTTransferPayloadBuilder=xn.ESDTNFTTransferPayloadBuilder=xn.ESDTTransferPayloadBuilder=void 0;var J_=Hr(),Ey=Wf(),Gr=ir(),X_=dg(),Ay=dc(),my=class{constructor(){this.payment=X_.TokenPayment.fungibleFromAmount("","0",0)}setPayment(e){return this.payment=e,this}build(){let e=[Gr.BytesValue.fromUTF8(this.payment.tokenIdentifier),new Gr.BigUIntValue(this.payment.valueOf())],{argumentsString:t}=new Ey.ArgSerializer().valuesToString(e),i=`ESDTTransfer@${t}`;return new Ay.TransactionPayload(i)}};xn.ESDTTransferPayloadBuilder=my;var vy=class{constructor(){this.payment=X_.TokenPayment.nonFungible("",0),this.destination=new J_.Address("")}setPayment(e){return this.payment=e,this}setDestination(e){return this.destination=e,this}build(){let e=[Gr.BytesValue.fromUTF8(this.payment.tokenIdentifier),new Gr.U64Value(this.payment.nonce),new Gr.BigUIntValue(this.payment.valueOf()),new Gr.AddressValue(this.destination)],{argumentsString:t}=new Ey.ArgSerializer().valuesToString(e),i=`ESDTNFTTransfer@${t}`;return new Ay.TransactionPayload(i)}};xn.ESDTNFTTransferPayloadBuilder=vy;var wy=class{constructor(){this.payments=[],this.destination=new J_.Address("")}setPayments(e){return this.payments=e,this}setDestination(e){return this.destination=e,this}build(){let e=[new Gr.AddressValue(this.destination),new Gr.U16Value(this.payments.length)];for(let n of this.payments)e.push(Gr.BytesValue.fromUTF8(n.tokenIdentifier),new Gr.U64Value(n.nonce),new Gr.BigUIntValue(n.valueOf()));let{argumentsString:t}=new Ey.ArgSerializer().valuesToString(e),i=`MultiESDTNFTTransfer@${t}`;return new Ay.TransactionPayload(i)}};xn.MultiESDTNFTTransferPayloadBuilder=wy});var Xf=D(Jf=>{"use strict";l();Object.defineProperty(Jf,"__esModule",{value:!0});Jf.Account=void 0;var S5=Hr(),_y=class{constructor(e){this.address=new S5.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()}}};Jf.Account=_y});var Zf=D(it=>{"use strict";l();Object.defineProperty(it,"__esModule",{value:!0});it.ESDT_TRANSFER_VALUE=it.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME=it.ESDTNFT_TRANSFER_FUNCTION_NAME=it.ESDT_TRANSFER_FUNCTION_NAME=it.ESDT_TRANSFER_GAS_LIMIT=it.TRANSACTION_VERSION_TX_HASH_SIGN=it.TRANSACTION_VERSION_DEFAULT=it.TRANSACTION_OPTIONS_TX_HASH_SIGN=it.TRANSACTION_OPTIONS_DEFAULT=it.TRANSACTION_MIN_GAS_PRICE=void 0;it.TRANSACTION_MIN_GAS_PRICE=1e9;it.TRANSACTION_OPTIONS_DEFAULT=0;it.TRANSACTION_OPTIONS_TX_HASH_SIGN=1;it.TRANSACTION_VERSION_DEFAULT=1;it.TRANSACTION_VERSION_TX_HASH_SIGN=2;it.ESDT_TRANSFER_GAS_LIMIT=5e5;it.ESDT_TRANSFER_FUNCTION_NAME="ESDTTransfer";it.ESDTNFT_TRANSFER_FUNCTION_NAME="ESDTNFTTransfer";it.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME="MultiESDTNFTTransfer";it.ESDT_TRANSFER_VALUE="0"});var tI=D(Br=>{"use strict";l();var x5=Br&&Br.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),T5=Br&&Br.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),N5=Br&&Br.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&x5(e,r,t);return T5(e,r),e};Object.defineProperty(Br,"__esModule",{value:!0});Br.TransactionOptions=Br.TransactionVersion=void 0;var eI=N5(ke()),eh=Zf(),xa=class{constructor(e){if(e=Number(e),e<1)throw new eI.ErrTransactionVersionInvalid(e);this.value=e}static withDefaultVersion(){return new xa(eh.TRANSACTION_VERSION_DEFAULT)}static withTxHashSignVersion(){return new xa(eh.TRANSACTION_VERSION_TX_HASH_SIGN)}valueOf(){return this.value}};Br.TransactionVersion=xa;var Ta=class{constructor(e){if(e=Number(e),e<0)throw new eI.ErrTransactionOptionsInvalid(e);this.value=e}static withDefaultOptions(){return new Ta(eh.TRANSACTION_OPTIONS_DEFAULT)}static withTxHashSignOptions(){return new Ta(eh.TRANSACTION_OPTIONS_TX_HASH_SIGN)}valueOf(){return this.value}};Br.TransactionOptions=Ta});var nI=D(gi=>{"use strict";l();var D5=gi&&gi.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),O5=gi&&gi.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),B5=gi&&gi.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&D5(e,r,t);return O5(e,r),e};Object.defineProperty(gi,"__esModule",{value:!0});gi.Signature=void 0;var rI=B5(ke()),iI=64,Kr=class{constructor(e){if(this.valueHex="",!!e){if(typeof e=="string")return Kr.fromHex(e);if(e instanceof y.Buffer)return Kr.fromBuffer(e)}}static empty(){return new Kr}static fromHex(e){if(e.startsWith("0x")&&(e=e.slice(2)),!Kr.isValidHex(e))throw new rI.ErrSignatureCannotCreate(e);return Kr.fromValidHex(e)}static isValidHex(e){return y.Buffer.from(e,"hex").length==iI}static fromValidHex(e){let t=new Kr;return t.valueHex=e,t}static fromBuffer(e){if(e.length!=iI)throw new rI.ErrSignatureCannotCreate(e);return Kr.fromValidHex(e.toString("hex"))}hex(){return this.valueHex}};gi.Signature=Kr});var oI=D((zk,sI)=>{"use strict";l();sI.exports=M5;function M5(r,e){for(var t=new Array(arguments.length-1),i=0,n=2,s=!0;n{"use strict";l();var th=cI;th.length=function(e){var t=e.length;if(!t)return 0;for(var i=0;--t%4>1&&e.charAt(t)==="=";)++i;return Math.ceil(e.length*3)/4-i};var Na=new Array(64),uI=new Array(123);for(zr=0;zr<64;)uI[Na[zr]=zr<26?zr+65:zr<52?zr+71:zr<62?zr-4:zr-59|43]=zr++;var zr;th.encode=function(e,t,i){for(var n=null,s=[],o=0,a=0,u;t>2],u=(h&3)<<4,a=1;break;case 1:s[o++]=Na[u|h>>4],u=(h&15)<<2,a=2;break;case 2:s[o++]=Na[u|h>>6],s[o++]=Na[h&63],a=0;break}o>8191&&((n||(n=[])).push(String.fromCharCode.apply(String,s)),o=0)}return a&&(s[o++]=Na[u],s[o++]=61,a===1&&(s[o++]=61)),n?(o&&n.push(String.fromCharCode.apply(String,s.slice(0,o))),n.join("")):String.fromCharCode.apply(String,s.slice(0,o))};var aI="invalid encoding";th.decode=function(e,t,i){for(var n=i,s=0,o,a=0;a1)break;if((u=uI[u])===void 0)throw Error(aI);switch(s){case 0:o=u,s=1;break;case 1:t[i++]=o<<2|(u&48)>>4,o=u,s=2;break;case 2:t[i++]=(o&15)<<4|(u&60)>>2,o=u,s=3;break;case 3:t[i++]=(o&3)<<6|u,s=0;break}}if(s===1)throw Error(aI);return i-n};th.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var hI=D((Yk,fI)=>{"use strict";l();fI.exports=rh;function rh(){this._listeners={}}rh.prototype.on=function(e,t,i){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:i||this}),this};rh.prototype.off=function(e,t){if(e===void 0)this._listeners={};else if(t===void 0)this._listeners[e]=[];else for(var i=this._listeners[e],n=0;n{"use strict";l();vI.exports=dI(dI);function dI(r){return typeof Float32Array<"u"?function(){var e=new Float32Array([-0]),t=new Uint8Array(e.buffer),i=t[3]===128;function n(u,h,p){e[0]=u,h[p]=t[0],h[p+1]=t[1],h[p+2]=t[2],h[p+3]=t[3]}function s(u,h,p){e[0]=u,h[p]=t[3],h[p+1]=t[2],h[p+2]=t[1],h[p+3]=t[0]}r.writeFloatLE=i?n:s,r.writeFloatBE=i?s:n;function o(u,h){return t[0]=u[h],t[1]=u[h+1],t[2]=u[h+2],t[3]=u[h+3],e[0]}function a(u,h){return t[3]=u[h],t[2]=u[h+1],t[1]=u[h+2],t[0]=u[h+3],e[0]}r.readFloatLE=i?o:a,r.readFloatBE=i?a:o}():function(){function e(i,n,s,o){var a=n<0?1:0;if(a&&(n=-n),n===0)i(1/n>0?0:2147483648,s,o);else if(isNaN(n))i(2143289344,s,o);else if(n>34028234663852886e22)i((a<<31|2139095040)>>>0,s,o);else if(n<11754943508222875e-54)i((a<<31|Math.round(n/1401298464324817e-60))>>>0,s,o);else{var u=Math.floor(Math.log(n)/Math.LN2),h=Math.round(n*Math.pow(2,-u)*8388608)&8388607;i((a<<31|u+127<<23|h)>>>0,s,o)}}r.writeFloatLE=e.bind(null,pI),r.writeFloatBE=e.bind(null,gI);function t(i,n,s){var o=i(n,s),a=(o>>31)*2+1,u=o>>>23&255,h=o&8388607;return u===255?h?NaN:a*(1/0):u===0?a*1401298464324817e-60*h:a*Math.pow(2,u-150)*(h+8388608)}r.readFloatLE=t.bind(null,yI),r.readFloatBE=t.bind(null,mI)}(),typeof Float64Array<"u"?function(){var e=new Float64Array([-0]),t=new Uint8Array(e.buffer),i=t[7]===128;function n(u,h,p){e[0]=u,h[p]=t[0],h[p+1]=t[1],h[p+2]=t[2],h[p+3]=t[3],h[p+4]=t[4],h[p+5]=t[5],h[p+6]=t[6],h[p+7]=t[7]}function s(u,h,p){e[0]=u,h[p]=t[7],h[p+1]=t[6],h[p+2]=t[5],h[p+3]=t[4],h[p+4]=t[3],h[p+5]=t[2],h[p+6]=t[1],h[p+7]=t[0]}r.writeDoubleLE=i?n:s,r.writeDoubleBE=i?s:n;function o(u,h){return t[0]=u[h],t[1]=u[h+1],t[2]=u[h+2],t[3]=u[h+3],t[4]=u[h+4],t[5]=u[h+5],t[6]=u[h+6],t[7]=u[h+7],e[0]}function a(u,h){return t[7]=u[h],t[6]=u[h+1],t[5]=u[h+2],t[4]=u[h+3],t[3]=u[h+4],t[2]=u[h+5],t[1]=u[h+6],t[0]=u[h+7],e[0]}r.readDoubleLE=i?o:a,r.readDoubleBE=i?a:o}():function(){function e(i,n,s,o,a,u){var h=o<0?1:0;if(h&&(o=-o),o===0)i(0,a,u+n),i(1/o>0?0:2147483648,a,u+s);else if(isNaN(o))i(0,a,u+n),i(2146959360,a,u+s);else if(o>17976931348623157e292)i(0,a,u+n),i((h<<31|2146435072)>>>0,a,u+s);else{var p;if(o<22250738585072014e-324)p=o/5e-324,i(p>>>0,a,u+n),i((h<<31|p/4294967296)>>>0,a,u+s);else{var v=Math.floor(Math.log(o)/Math.LN2);v===1024&&(v=1023),p=o*Math.pow(2,-v),i(p*4503599627370496>>>0,a,u+n),i((h<<31|v+1023<<20|p*1048576&1048575)>>>0,a,u+s)}}}r.writeDoubleLE=e.bind(null,pI,0,4),r.writeDoubleBE=e.bind(null,gI,4,0);function t(i,n,s,o,a){var u=i(o,a+n),h=i(o,a+s),p=(h>>31)*2+1,v=h>>>20&2047,B=4294967296*(h&1048575)+u;return v===2047?B?NaN:p*(1/0):v===0?p*5e-324*B:p*Math.pow(2,v-1075)*(B+4503599627370496)}r.readDoubleLE=t.bind(null,yI,0,4),r.readDoubleBE=t.bind(null,mI,4,0)}(),r}function pI(r,e,t){e[t]=r&255,e[t+1]=r>>>8&255,e[t+2]=r>>>16&255,e[t+3]=r>>>24}function gI(r,e,t){e[t]=r>>>24,e[t+1]=r>>>16&255,e[t+2]=r>>>8&255,e[t+3]=r&255}function yI(r,e){return(r[e]|r[e+1]<<8|r[e+2]<<16|r[e+3]<<24)>>>0}function mI(r,e){return(r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3])>>>0}});var EI=D((exports,module)=>{"use strict";l();module.exports=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(r){}return null}});var _I=D(AI=>{"use strict";l();var Iy=AI;Iy.length=function(e){for(var t=0,i=0,n=0;n191&&u<224?o[a++]=(u&31)<<6|e[t++]&63:u>239&&u<365?(u=((u&7)<<18|(e[t++]&63)<<12|(e[t++]&63)<<6|e[t++]&63)-65536,o[a++]=55296+(u>>10),o[a++]=56320+(u&1023)):o[a++]=(u&15)<<12|(e[t++]&63)<<6|e[t++]&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))};Iy.write=function(e,t,i){for(var n=i,s,o,a=0;a>6|192,t[i++]=s&63|128):(s&64512)===55296&&((o=e.charCodeAt(a+1))&64512)===56320?(s=65536+((s&1023)<<10)+(o&1023),++a,t[i++]=s>>18|240,t[i++]=s>>12&63|128,t[i++]=s>>6&63|128,t[i++]=s&63|128):(t[i++]=s>>12|224,t[i++]=s>>6&63|128,t[i++]=s&63|128);return i-n}});var bI=D((iW,II)=>{"use strict";l();II.exports=P5;function P5(r,e,t){var i=t||8192,n=i>>>1,s=null,o=i;return function(u){if(u<1||u>n)return r(u);o+u>i&&(s=r(i),o=0);var h=e.call(s,o,o+=u);return o&7&&(o=(o|7)+1),h}}});var SI=D((sW,CI)=>{"use strict";l();CI.exports=Qt;var pc=Nn();function Qt(r,e){this.lo=r>>>0,this.hi=e>>>0}var ks=Qt.zero=new Qt(0,0);ks.toNumber=function(){return 0};ks.zzEncode=ks.zzDecode=function(){return this};ks.length=function(){return 1};var L5=Qt.zeroHash="\0\0\0\0\0\0\0\0";Qt.fromNumber=function(e){if(e===0)return ks;var t=e<0;t&&(e=-e);var i=e>>>0,n=(e-i)/4294967296>>>0;return t&&(n=~n>>>0,i=~i>>>0,++i>4294967295&&(i=0,++n>4294967295&&(n=0))),new Qt(i,n)};Qt.from=function(e){if(typeof e=="number")return Qt.fromNumber(e);if(pc.isString(e))if(pc.Long)e=pc.Long.fromString(e);else return Qt.fromNumber(parseInt(e,10));return e.low||e.high?new Qt(e.low>>>0,e.high>>>0):ks};Qt.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=~this.lo+1>>>0,i=~this.hi>>>0;return t||(i=i+1>>>0),-(t+i*4294967296)}return this.lo+this.hi*4294967296};Qt.prototype.toLong=function(e){return pc.Long?new pc.Long(this.lo|0,this.hi|0,Boolean(e)):{low:this.lo|0,high:this.hi|0,unsigned:Boolean(e)}};var Tn=String.prototype.charCodeAt;Qt.fromHash=function(e){return e===L5?ks:new Qt((Tn.call(e,0)|Tn.call(e,1)<<8|Tn.call(e,2)<<16|Tn.call(e,3)<<24)>>>0,(Tn.call(e,4)|Tn.call(e,5)<<8|Tn.call(e,6)<<16|Tn.call(e,7)<<24)>>>0)};Qt.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)};Qt.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this};Qt.prototype.zzDecode=function(){var e=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this};Qt.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,i=this.hi>>>24;return i===0?t===0?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:i<128?9:10}});var Nn=D(by=>{"use strict";l();var me=by;me.asPromise=oI();me.base64=lI();me.EventEmitter=hI();me.float=wI();me.inquire=EI();me.utf8=_I();me.pool=bI();me.LongBits=SI();me.isNode=Boolean(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);me.global=me.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||by;me.emptyArray=Object.freeze?Object.freeze([]):[];me.emptyObject=Object.freeze?Object.freeze({}):{};me.isInteger=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};me.isString=function(e){return typeof e=="string"||e instanceof String};me.isObject=function(e){return e&&typeof e=="object"};me.isset=me.isSet=function(e,t){var i=e[t];return i!=null&&e.hasOwnProperty(t)?typeof i!="object"||(Array.isArray(i)?i.length:Object.keys(i).length)>0:!1};me.Buffer=function(){try{var r=me.inquire("buffer").Buffer;return r.prototype.utf8Write?r:null}catch{return null}}();me._Buffer_from=null;me._Buffer_allocUnsafe=null;me.newBuffer=function(e){return typeof e=="number"?me.Buffer?me._Buffer_allocUnsafe(e):new me.Array(e):me.Buffer?me._Buffer_from(e):typeof Uint8Array>"u"?e:new Uint8Array(e)};me.Array=typeof Uint8Array<"u"?Uint8Array:Array;me.Long=me.global.dcodeIO&&me.global.dcodeIO.Long||me.global.Long||me.inquire("long");me.key2Re=/^true|false|0|1$/;me.key32Re=/^-?(?:0|[1-9][0-9]*)$/;me.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;me.longToHash=function(e){return e?me.LongBits.from(e).toHash():me.LongBits.zeroHash};me.longFromHash=function(e,t){var i=me.LongBits.fromHash(e);return me.Long?me.Long.fromBits(i.lo,i.hi,t):i.toNumber(Boolean(t))};function xI(r,e,t){for(var i=Object.keys(e),n=0;n-1;--s)if(t[n[s]]===1&&this[n[s]]!==void 0&&this[n[s]]!==null)return n[s]}};me.oneOfSetter=function(e){return function(t){for(var i=0;i{"use strict";l();BI.exports=Re;var Mr=Nn(),Cy,ih=Mr.LongBits,NI=Mr.base64,DI=Mr.utf8;function gc(r,e,t){this.fn=r,this.len=e,this.next=void 0,this.val=t}function xy(){}function R5(r){this.head=r.head,this.tail=r.tail,this.len=r.len,this.next=r.states}function Re(){this.len=0,this.head=new gc(xy,0,0),this.tail=this.head,this.states=null}var OI=function(){return Mr.Buffer?function(){return(Re.create=function(){return new Cy})()}:function(){return new Re}};Re.create=OI();Re.alloc=function(e){return new Mr.Array(e)};Mr.Array!==Array&&(Re.alloc=Mr.pool(Re.alloc,Mr.Array.prototype.subarray));Re.prototype._push=function(e,t,i){return this.tail=this.tail.next=new gc(e,t,i),this.len+=t,this};function Ty(r,e,t){e[t]=r&255}function F5(r,e,t){for(;r>127;)e[t++]=r&127|128,r>>>=7;e[t]=r}function Ny(r,e){this.len=r,this.next=void 0,this.val=e}Ny.prototype=Object.create(gc.prototype);Ny.prototype.fn=F5;Re.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new Ny((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this};Re.prototype.int32=function(e){return e<0?this._push(Dy,10,ih.fromNumber(e)):this.uint32(e)};Re.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function Dy(r,e,t){for(;r.hi;)e[t++]=r.lo&127|128,r.lo=(r.lo>>>7|r.hi<<25)>>>0,r.hi>>>=7;for(;r.lo>127;)e[t++]=r.lo&127|128,r.lo=r.lo>>>7;e[t++]=r.lo}Re.prototype.uint64=function(e){var t=ih.from(e);return this._push(Dy,t.length(),t)};Re.prototype.int64=Re.prototype.uint64;Re.prototype.sint64=function(e){var t=ih.from(e).zzEncode();return this._push(Dy,t.length(),t)};Re.prototype.bool=function(e){return this._push(Ty,1,e?1:0)};function Sy(r,e,t){e[t]=r&255,e[t+1]=r>>>8&255,e[t+2]=r>>>16&255,e[t+3]=r>>>24}Re.prototype.fixed32=function(e){return this._push(Sy,4,e>>>0)};Re.prototype.sfixed32=Re.prototype.fixed32;Re.prototype.fixed64=function(e){var t=ih.from(e);return this._push(Sy,4,t.lo)._push(Sy,4,t.hi)};Re.prototype.sfixed64=Re.prototype.fixed64;Re.prototype.float=function(e){return this._push(Mr.float.writeFloatLE,4,e)};Re.prototype.double=function(e){return this._push(Mr.float.writeDoubleLE,8,e)};var U5=Mr.Array.prototype.set?function(e,t,i){t.set(e,i)}:function(e,t,i){for(var n=0;n>>0;if(!t)return this._push(Ty,1,0);if(Mr.isString(e)){var i=Re.alloc(t=NI.length(e));NI.decode(e,i,0),e=i}return this.uint32(t)._push(U5,t,e)};Re.prototype.string=function(e){var t=DI.length(e);return t?this.uint32(t)._push(DI.write,t,e):this._push(Ty,1,0)};Re.prototype.fork=function(){return this.states=new R5(this),this.head=this.tail=new gc(xy,0,0),this.len=0,this};Re.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 gc(xy,0,0),this.len=0),this};Re.prototype.ldelim=function(){var e=this.head,t=this.tail,i=this.len;return this.reset().uint32(i),i&&(this.tail.next=e.next,this.tail=t,this.len+=i),this};Re.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),i=0;e;)e.fn(e.val,t,i),i+=e.len,e=e.next;return t};Re._configure=function(r){Cy=r,Re.create=OI(),Cy._configure()}});var LI=D((fW,PI)=>{"use strict";l();PI.exports=yi;var MI=Oy();(yi.prototype=Object.create(MI.prototype)).constructor=yi;var Dn=Nn();function yi(){MI.call(this)}yi._configure=function(){yi.alloc=Dn._Buffer_allocUnsafe,yi.writeBytesBuffer=Dn.Buffer&&Dn.Buffer.prototype instanceof Uint8Array&&Dn.Buffer.prototype.set.name==="set"?function(e,t,i){t.set(e,i)}:function(e,t,i){if(e.copy)e.copy(t,i,0,e.length);else for(var n=0;n>>0;return this.uint32(t),t&&this._push(yi.writeBytesBuffer,t,e),this};function q5(r,e,t){r.length<40?Dn.utf8.write(r,e,t):e.utf8Write?e.utf8Write(r,t):e.write(r,t)}yi.prototype.string=function(e){var t=Dn.Buffer.byteLength(e);return this.uint32(t),t&&this._push(q5,t,e),this};yi._configure()});var Py=D((dW,VI)=>{"use strict";l();VI.exports=ut;var mi=Nn(),My,UI=mi.LongBits,V5=mi.utf8;function $r(r,e){return RangeError("index out of range: "+r.pos+" + "+(e||1)+" > "+r.len)}function ut(r){this.buf=r,this.pos=0,this.len=r.length}var RI=typeof Uint8Array<"u"?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new ut(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new ut(e);throw Error("illegal buffer")},qI=function(){return mi.Buffer?function(t){return(ut.create=function(n){return mi.Buffer.isBuffer(n)?new My(n):RI(n)})(t)}:RI};ut.create=qI();ut.prototype._slice=mi.Array.prototype.subarray||mi.Array.prototype.slice;ut.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,$r(this,10);return e}}();ut.prototype.int32=function(){return this.uint32()|0};ut.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(e&1)|0};function By(){var r=new UI(0,0),e=0;if(this.len-this.pos>4){for(;e<4;++e)if(r.lo=(r.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return r;if(r.lo=(r.lo|(this.buf[this.pos]&127)<<28)>>>0,r.hi=(r.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return r;e=0}else{for(;e<3;++e){if(this.pos>=this.len)throw $r(this);if(r.lo=(r.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return r}return r.lo=(r.lo|(this.buf[this.pos++]&127)<>>0,r}if(this.len-this.pos>4){for(;e<5;++e)if(r.hi=(r.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return r}else for(;e<5;++e){if(this.pos>=this.len)throw $r(this);if(r.hi=(r.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return r}throw Error("invalid varint encoding")}ut.prototype.bool=function(){return this.uint32()!==0};function nh(r,e){return(r[e-4]|r[e-3]<<8|r[e-2]<<16|r[e-1]<<24)>>>0}ut.prototype.fixed32=function(){if(this.pos+4>this.len)throw $r(this,4);return nh(this.buf,this.pos+=4)};ut.prototype.sfixed32=function(){if(this.pos+4>this.len)throw $r(this,4);return nh(this.buf,this.pos+=4)|0};function FI(){if(this.pos+8>this.len)throw $r(this,8);return new UI(nh(this.buf,this.pos+=4),nh(this.buf,this.pos+=4))}ut.prototype.float=function(){if(this.pos+4>this.len)throw $r(this,4);var e=mi.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};ut.prototype.double=function(){if(this.pos+8>this.len)throw $r(this,4);var e=mi.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e};ut.prototype.bytes=function(){var e=this.uint32(),t=this.pos,i=this.pos+e;if(i>this.len)throw $r(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,i):t===i?new this.buf.constructor(0):this._slice.call(this.buf,t,i)};ut.prototype.string=function(){var e=this.bytes();return V5.read(e,0,e.length)};ut.prototype.skip=function(e){if(typeof e=="number"){if(this.pos+e>this.len)throw $r(this,e);this.pos+=e}else do if(this.pos>=this.len)throw $r(this);while(this.buf[this.pos++]&128);return this};ut.prototype.skipType=function(r){switch(r){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(r=this.uint32()&7)!==4;)this.skipType(r);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+r+" at offset "+this.pos)}return this};ut._configure=function(r){My=r,ut.create=qI(),My._configure();var e=mi.Long?"toLong":"toNumber";mi.merge(ut.prototype,{int64:function(){return By.call(this)[e](!1)},uint64:function(){return By.call(this)[e](!0)},sint64:function(){return By.call(this).zzDecode()[e](!1)},fixed64:function(){return FI.call(this)[e](!0)},sfixed64:function(){return FI.call(this)[e](!1)}})}});var GI=D((gW,jI)=>{"use strict";l();jI.exports=Ws;var QI=Py();(Ws.prototype=Object.create(QI.prototype)).constructor=Ws;var HI=Nn();function Ws(r){QI.call(this,r)}Ws._configure=function(){HI.Buffer&&(Ws.prototype._slice=HI.Buffer.prototype.slice)};Ws.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))};Ws._configure()});var zI=D((mW,KI)=>{"use strict";l();KI.exports=yc;var Ly=Nn();(yc.prototype=Object.create(Ly.EventEmitter.prototype)).constructor=yc;function yc(r,e,t){if(typeof r!="function")throw TypeError("rpcImpl must be a function");Ly.EventEmitter.call(this),this.rpcImpl=r,this.requestDelimited=Boolean(e),this.responseDelimited=Boolean(t)}yc.prototype.rpcCall=function r(e,t,i,n,s){if(!n)throw TypeError("request must be specified");var o=this;if(!s)return Ly.asPromise(r,o,e,t,i,n);if(!o.rpcImpl){setTimeout(function(){s(Error("already ended"))},0);return}try{return o.rpcImpl(e,t[o.requestDelimited?"encodeDelimited":"encode"](n).finish(),function(u,h){if(u)return o.emit("error",u,e),s(u);if(h===null){o.end(!0);return}if(!(h instanceof i))try{h=i[o.responseDelimited?"decodeDelimited":"decode"](h)}catch(p){return o.emit("error",p,e),s(p)}return o.emit("data",h,e),s(null,h)})}catch(a){o.emit("error",a,e),setTimeout(function(){s(a)},0);return}};yc.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var kI=D($I=>{"use strict";l();var H5=$I;H5.Service=zI()});var YI=D((AW,WI)=>{"use strict";l();WI.exports={}});var ZI=D(XI=>{"use strict";l();var pr=XI;pr.build="minimal";pr.Writer=Oy();pr.BufferWriter=LI();pr.Reader=Py();pr.BufferReader=GI();pr.util=Nn();pr.rpc=kI();pr.roots=YI();pr.configure=JI;function JI(){pr.util._configure(),pr.Writer._configure(pr.BufferWriter),pr.Reader._configure(pr.BufferReader)}JI()});var tb=D((CW,eb)=>{"use strict";l();eb.exports=ZI()});var ib=D((xW,rb)=>{"use strict";l();var Da=tb(),sh=Da.Reader,Q5=Da.Writer,le=Da.util,mc=Da.roots.default||(Da.roots.default={});mc.proto=function(){var r={};return r.Transaction=function(){function e(t){if(t)for(var i=Object.keys(t),n=0;n>>3){case 1:o.Nonce=i.uint64();break;case 2:o.Value=i.bytes();break;case 3:o.RcvAddr=i.bytes();break;case 4:o.RcvUserName=i.bytes();break;case 5:o.SndAddr=i.bytes();break;case 6:o.SndUserName=i.bytes();break;case 7:o.GasPrice=i.uint64();break;case 8:o.GasLimit=i.uint64();break;case 9:o.Data=i.bytes();break;case 10:o.ChainID=i.bytes();break;case 11:o.Version=i.uint32();break;case 12:o.Signature=i.bytes();break;case 13:o.Options=i.uint32();break;default:i.skipType(a&7);break}}return o},e.decodeDelimited=function(i){return i instanceof sh||(i=new sh(i)),this.decode(i,i.uint32())},e.verify=function(i){return typeof i!="object"||i===null?"object expected":i.Nonce!=null&&i.hasOwnProperty("Nonce")&&!le.isInteger(i.Nonce)&&!(i.Nonce&&le.isInteger(i.Nonce.low)&&le.isInteger(i.Nonce.high))?"Nonce: integer|Long expected":i.Value!=null&&i.hasOwnProperty("Value")&&!(i.Value&&typeof i.Value.length=="number"||le.isString(i.Value))?"Value: buffer expected":i.RcvAddr!=null&&i.hasOwnProperty("RcvAddr")&&!(i.RcvAddr&&typeof i.RcvAddr.length=="number"||le.isString(i.RcvAddr))?"RcvAddr: buffer expected":i.RcvUserName!=null&&i.hasOwnProperty("RcvUserName")&&!(i.RcvUserName&&typeof i.RcvUserName.length=="number"||le.isString(i.RcvUserName))?"RcvUserName: buffer expected":i.SndAddr!=null&&i.hasOwnProperty("SndAddr")&&!(i.SndAddr&&typeof i.SndAddr.length=="number"||le.isString(i.SndAddr))?"SndAddr: buffer expected":i.SndUserName!=null&&i.hasOwnProperty("SndUserName")&&!(i.SndUserName&&typeof i.SndUserName.length=="number"||le.isString(i.SndUserName))?"SndUserName: buffer expected":i.GasPrice!=null&&i.hasOwnProperty("GasPrice")&&!le.isInteger(i.GasPrice)&&!(i.GasPrice&&le.isInteger(i.GasPrice.low)&&le.isInteger(i.GasPrice.high))?"GasPrice: integer|Long expected":i.GasLimit!=null&&i.hasOwnProperty("GasLimit")&&!le.isInteger(i.GasLimit)&&!(i.GasLimit&&le.isInteger(i.GasLimit.low)&&le.isInteger(i.GasLimit.high))?"GasLimit: integer|Long expected":i.Data!=null&&i.hasOwnProperty("Data")&&!(i.Data&&typeof i.Data.length=="number"||le.isString(i.Data))?"Data: buffer expected":i.ChainID!=null&&i.hasOwnProperty("ChainID")&&!(i.ChainID&&typeof i.ChainID.length=="number"||le.isString(i.ChainID))?"ChainID: buffer expected":i.Version!=null&&i.hasOwnProperty("Version")&&!le.isInteger(i.Version)?"Version: integer expected":i.Signature!=null&&i.hasOwnProperty("Signature")&&!(i.Signature&&typeof i.Signature.length=="number"||le.isString(i.Signature))?"Signature: buffer expected":i.Options!=null&&i.hasOwnProperty("Options")&&!le.isInteger(i.Options)?"Options: integer expected":null},e.fromObject=function(i){if(i instanceof mc.proto.Transaction)return i;var n=new mc.proto.Transaction;return i.Nonce!=null&&(le.Long?(n.Nonce=le.Long.fromValue(i.Nonce)).unsigned=!0:typeof i.Nonce=="string"?n.Nonce=parseInt(i.Nonce,10):typeof i.Nonce=="number"?n.Nonce=i.Nonce:typeof i.Nonce=="object"&&(n.Nonce=new le.LongBits(i.Nonce.low>>>0,i.Nonce.high>>>0).toNumber(!0))),i.Value!=null&&(typeof i.Value=="string"?le.base64.decode(i.Value,n.Value=le.newBuffer(le.base64.length(i.Value)),0):i.Value.length&&(n.Value=i.Value)),i.RcvAddr!=null&&(typeof i.RcvAddr=="string"?le.base64.decode(i.RcvAddr,n.RcvAddr=le.newBuffer(le.base64.length(i.RcvAddr)),0):i.RcvAddr.length&&(n.RcvAddr=i.RcvAddr)),i.RcvUserName!=null&&(typeof i.RcvUserName=="string"?le.base64.decode(i.RcvUserName,n.RcvUserName=le.newBuffer(le.base64.length(i.RcvUserName)),0):i.RcvUserName.length&&(n.RcvUserName=i.RcvUserName)),i.SndAddr!=null&&(typeof i.SndAddr=="string"?le.base64.decode(i.SndAddr,n.SndAddr=le.newBuffer(le.base64.length(i.SndAddr)),0):i.SndAddr.length&&(n.SndAddr=i.SndAddr)),i.SndUserName!=null&&(typeof i.SndUserName=="string"?le.base64.decode(i.SndUserName,n.SndUserName=le.newBuffer(le.base64.length(i.SndUserName)),0):i.SndUserName.length&&(n.SndUserName=i.SndUserName)),i.GasPrice!=null&&(le.Long?(n.GasPrice=le.Long.fromValue(i.GasPrice)).unsigned=!0:typeof i.GasPrice=="string"?n.GasPrice=parseInt(i.GasPrice,10):typeof i.GasPrice=="number"?n.GasPrice=i.GasPrice:typeof i.GasPrice=="object"&&(n.GasPrice=new le.LongBits(i.GasPrice.low>>>0,i.GasPrice.high>>>0).toNumber(!0))),i.GasLimit!=null&&(le.Long?(n.GasLimit=le.Long.fromValue(i.GasLimit)).unsigned=!0:typeof i.GasLimit=="string"?n.GasLimit=parseInt(i.GasLimit,10):typeof i.GasLimit=="number"?n.GasLimit=i.GasLimit:typeof i.GasLimit=="object"&&(n.GasLimit=new le.LongBits(i.GasLimit.low>>>0,i.GasLimit.high>>>0).toNumber(!0))),i.Data!=null&&(typeof i.Data=="string"?le.base64.decode(i.Data,n.Data=le.newBuffer(le.base64.length(i.Data)),0):i.Data.length&&(n.Data=i.Data)),i.ChainID!=null&&(typeof i.ChainID=="string"?le.base64.decode(i.ChainID,n.ChainID=le.newBuffer(le.base64.length(i.ChainID)),0):i.ChainID.length&&(n.ChainID=i.ChainID)),i.Version!=null&&(n.Version=i.Version>>>0),i.Signature!=null&&(typeof i.Signature=="string"?le.base64.decode(i.Signature,n.Signature=le.newBuffer(le.base64.length(i.Signature)),0):i.Signature.length&&(n.Signature=i.Signature)),i.Options!=null&&(n.Options=i.Options>>>0),n},e.toObject=function(i,n){n||(n={});var s={};if(n.defaults){if(le.Long){var o=new le.Long(0,0,!0);s.Nonce=n.longs===String?o.toString():n.longs===Number?o.toNumber():o}else s.Nonce=n.longs===String?"0":0;if(n.bytes===String?s.Value="":(s.Value=[],n.bytes!==Array&&(s.Value=le.newBuffer(s.Value))),n.bytes===String?s.RcvAddr="":(s.RcvAddr=[],n.bytes!==Array&&(s.RcvAddr=le.newBuffer(s.RcvAddr))),n.bytes===String?s.RcvUserName="":(s.RcvUserName=[],n.bytes!==Array&&(s.RcvUserName=le.newBuffer(s.RcvUserName))),n.bytes===String?s.SndAddr="":(s.SndAddr=[],n.bytes!==Array&&(s.SndAddr=le.newBuffer(s.SndAddr))),n.bytes===String?s.SndUserName="":(s.SndUserName=[],n.bytes!==Array&&(s.SndUserName=le.newBuffer(s.SndUserName))),le.Long){var o=new le.Long(0,0,!0);s.GasPrice=n.longs===String?o.toString():n.longs===Number?o.toNumber():o}else s.GasPrice=n.longs===String?"0":0;if(le.Long){var o=new le.Long(0,0,!0);s.GasLimit=n.longs===String?o.toString():n.longs===Number?o.toNumber():o}else s.GasLimit=n.longs===String?"0":0;n.bytes===String?s.Data="":(s.Data=[],n.bytes!==Array&&(s.Data=le.newBuffer(s.Data))),n.bytes===String?s.ChainID="":(s.ChainID=[],n.bytes!==Array&&(s.ChainID=le.newBuffer(s.ChainID))),s.Version=0,n.bytes===String?s.Signature="":(s.Signature=[],n.bytes!==Array&&(s.Signature=le.newBuffer(s.Signature))),s.Options=0}return i.Nonce!=null&&i.hasOwnProperty("Nonce")&&(typeof i.Nonce=="number"?s.Nonce=n.longs===String?String(i.Nonce):i.Nonce:s.Nonce=n.longs===String?le.Long.prototype.toString.call(i.Nonce):n.longs===Number?new le.LongBits(i.Nonce.low>>>0,i.Nonce.high>>>0).toNumber(!0):i.Nonce),i.Value!=null&&i.hasOwnProperty("Value")&&(s.Value=n.bytes===String?le.base64.encode(i.Value,0,i.Value.length):n.bytes===Array?Array.prototype.slice.call(i.Value):i.Value),i.RcvAddr!=null&&i.hasOwnProperty("RcvAddr")&&(s.RcvAddr=n.bytes===String?le.base64.encode(i.RcvAddr,0,i.RcvAddr.length):n.bytes===Array?Array.prototype.slice.call(i.RcvAddr):i.RcvAddr),i.RcvUserName!=null&&i.hasOwnProperty("RcvUserName")&&(s.RcvUserName=n.bytes===String?le.base64.encode(i.RcvUserName,0,i.RcvUserName.length):n.bytes===Array?Array.prototype.slice.call(i.RcvUserName):i.RcvUserName),i.SndAddr!=null&&i.hasOwnProperty("SndAddr")&&(s.SndAddr=n.bytes===String?le.base64.encode(i.SndAddr,0,i.SndAddr.length):n.bytes===Array?Array.prototype.slice.call(i.SndAddr):i.SndAddr),i.SndUserName!=null&&i.hasOwnProperty("SndUserName")&&(s.SndUserName=n.bytes===String?le.base64.encode(i.SndUserName,0,i.SndUserName.length):n.bytes===Array?Array.prototype.slice.call(i.SndUserName):i.SndUserName),i.GasPrice!=null&&i.hasOwnProperty("GasPrice")&&(typeof i.GasPrice=="number"?s.GasPrice=n.longs===String?String(i.GasPrice):i.GasPrice:s.GasPrice=n.longs===String?le.Long.prototype.toString.call(i.GasPrice):n.longs===Number?new le.LongBits(i.GasPrice.low>>>0,i.GasPrice.high>>>0).toNumber(!0):i.GasPrice),i.GasLimit!=null&&i.hasOwnProperty("GasLimit")&&(typeof i.GasLimit=="number"?s.GasLimit=n.longs===String?String(i.GasLimit):i.GasLimit:s.GasLimit=n.longs===String?le.Long.prototype.toString.call(i.GasLimit):n.longs===Number?new le.LongBits(i.GasLimit.low>>>0,i.GasLimit.high>>>0).toNumber(!0):i.GasLimit),i.Data!=null&&i.hasOwnProperty("Data")&&(s.Data=n.bytes===String?le.base64.encode(i.Data,0,i.Data.length):n.bytes===Array?Array.prototype.slice.call(i.Data):i.Data),i.ChainID!=null&&i.hasOwnProperty("ChainID")&&(s.ChainID=n.bytes===String?le.base64.encode(i.ChainID,0,i.ChainID.length):n.bytes===Array?Array.prototype.slice.call(i.ChainID):i.ChainID),i.Version!=null&&i.hasOwnProperty("Version")&&(s.Version=i.Version),i.Signature!=null&&i.hasOwnProperty("Signature")&&(s.Signature=n.bytes===String?le.base64.encode(i.Signature,0,i.Signature.length):n.bytes===Array?Array.prototype.slice.call(i.Signature):i.Signature),i.Options!=null&&i.hasOwnProperty("Options")&&(s.Options=i.Options),s},e.prototype.toJSON=function(){return this.constructor.toObject(this,Da.util.toJSONOptions)},e}(),r}();rb.exports=mc});var ob=D(Pr=>{"use strict";l();var j5=Pr&&Pr.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),G5=Pr&&Pr.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),K5=Pr&&Pr.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&j5(e,r,t);return G5(e,r),e},z5=Pr&&Pr.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Pr,"__esModule",{value:!0});Pr.ProtoSerializer=void 0;var $5=K5(ke()),k5=Vg(),nb=ib(),W5=Zf(),sb=Hr(),Y5=z5(Vr()),Ry=class{serializeTransaction(e){let t=new sb.Address(e.getReceiver().bech32()).pubkey(),i=new sb.Address(e.getSender().bech32()).pubkey(),n=new nb.proto.Transaction({Nonce:e.getNonce().valueOf()?e.getNonce().valueOf():void 0,Value:this.serializeTransactionValue(e.getValue()),RcvAddr:t,RcvUserName:null,SndAddr:i,SndUserName:null,GasPrice:e.getGasPrice().valueOf(),GasLimit:e.getGasLimit().valueOf(),Data:e.getData().length()==0?null:e.getData().valueOf(),ChainID:y.Buffer.from(e.getChainID().valueOf()),Version:e.getVersion().valueOf(),Signature:y.Buffer.from(e.getSignature().hex(),"hex")});e.getOptions().valueOf()!==W5.TRANSACTION_OPTIONS_DEFAULT&&(n.Options=e.getOptions().valueOf());let s=nb.proto.Transaction.encode(n).finish();return y.Buffer.from(s)}serializeTransactionValue(e){let t=new Y5.default(e.toString());if(t.isZero())return y.Buffer.from([0,0]);let i=k5.bigIntToBuffer(t);return i=y.Buffer.concat([y.Buffer.from([0]),i]),i}deserializeTransaction(e){throw new $5.ErrUnsupportedOperation("deserializeTransaction")}};Pr.ProtoSerializer=Ry});var ab=D(Ys=>{"use strict";l();var J5=Ys&&Ys.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),X5=Ys&&Ys.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&J5(e,r,t)};Object.defineProperty(Ys,"__esModule",{value:!0});X5(ob(),Ys)});var ub=D(vi=>{"use strict";l();var Z5=vi&&vi.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),eL=vi&&vi.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),tL=vi&&vi.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&Z5(e,r,t);return eL(e,r),e};Object.defineProperty(vi,"__esModule",{value:!0});vi.Hash=void 0;var rL=tL(ke()),vc=class{constructor(e){if(!e)this.hash=y.Buffer.from([]);else if(e instanceof y.Buffer)this.hash=e;else if(typeof e=="string")this.hash=y.Buffer.from(e,"hex");else throw new rL.ErrBadType("hash","buffer | string",e)}static empty(){return new vc(y.Buffer.from([]))}isEmpty(){return this.hash.length==0}toString(){return this.hex()}hex(){return this.hash.toString("hex")}valueOf(){return this.hash}};vi.Hash=vc});var Fy=D((LW,cb)=>{l();Ki.notEqual=nL;Ki.notOk=sL;Ki.equal=iL;Ki.ok=Ki;cb.exports=Ki;function iL(r,e,t){Ki(r==e,t)}function nL(r,e,t){Ki(r!=e,t)}function sL(r,e){Ki(!r,e)}function Ki(r,e){if(!r)throw new Error(e||"AssertionError")}});var Sb=D(Pa=>{"use strict";l();var Uy=b0(),Ba=S0(),lb=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Pa.Buffer=re;Pa.SlowBuffer=fL;Pa.INSPECT_MAX_BYTES=50;var oh=2147483647;Pa.kMaxLength=oh;re.TYPED_ARRAY_SUPPORT=oL();!re.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 oL(){try{let r=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(r,e),r.foo()===42}catch{return!1}}Object.defineProperty(re.prototype,"parent",{enumerable:!0,get:function(){if(!!re.isBuffer(this))return this.buffer}});Object.defineProperty(re.prototype,"offset",{enumerable:!0,get:function(){if(!!re.isBuffer(this))return this.byteOffset}});function zi(r){if(r>oh)throw new RangeError('The value "'+r+'" is invalid for option "size"');let e=new Uint8Array(r);return Object.setPrototypeOf(e,re.prototype),e}function re(r,e,t){if(typeof r=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return Qy(r)}return pb(r,e,t)}re.poolSize=8192;function pb(r,e,t){if(typeof r=="string")return uL(r,e);if(ArrayBuffer.isView(r))return cL(r);if(r==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r);if(wi(r,ArrayBuffer)||r&&wi(r.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(wi(r,SharedArrayBuffer)||r&&wi(r.buffer,SharedArrayBuffer)))return Vy(r,e,t);if(typeof r=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let i=r.valueOf&&r.valueOf();if(i!=null&&i!==r)return re.from(i,e,t);let n=lL(r);if(n)return n;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return re.from(r[Symbol.toPrimitive]("string"),e,t);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r)}re.from=function(r,e,t){return pb(r,e,t)};Object.setPrototypeOf(re.prototype,Uint8Array.prototype);Object.setPrototypeOf(re,Uint8Array);function gb(r){if(typeof r!="number")throw new TypeError('"size" argument must be of type number');if(r<0)throw new RangeError('The value "'+r+'" is invalid for option "size"')}function aL(r,e,t){return gb(r),r<=0?zi(r):e!==void 0?typeof t=="string"?zi(r).fill(e,t):zi(r).fill(e):zi(r)}re.alloc=function(r,e,t){return aL(r,e,t)};function Qy(r){return gb(r),zi(r<0?0:jy(r)|0)}re.allocUnsafe=function(r){return Qy(r)};re.allocUnsafeSlow=function(r){return Qy(r)};function uL(r,e){if((typeof e!="string"||e==="")&&(e="utf8"),!re.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let t=yb(r,e)|0,i=zi(t),n=i.write(r,e);return n!==t&&(i=i.slice(0,n)),i}function qy(r){let e=r.length<0?0:jy(r.length)|0,t=zi(e);for(let i=0;i=oh)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+oh.toString(16)+" bytes");return r|0}function fL(r){return+r!=r&&(r=0),re.alloc(+r)}re.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==re.prototype};re.compare=function(e,t){if(wi(e,Uint8Array)&&(e=re.from(e,e.offset,e.byteLength)),wi(t,Uint8Array)&&(t=re.from(t,t.offset,t.byteLength)),!re.isBuffer(e)||!re.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let i=e.length,n=t.length;for(let s=0,o=Math.min(i,n);sn.length?(re.isBuffer(o)||(o=re.from(o)),o.copy(n,s)):Uint8Array.prototype.set.call(n,o,s);else if(re.isBuffer(o))o.copy(n,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return n};function yb(r,e){if(re.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||wi(r,ArrayBuffer))return r.byteLength;if(typeof r!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof r);let t=r.length,i=arguments.length>2&&arguments[2]===!0;if(!i&&t===0)return 0;let n=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return Hy(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return Cb(r).length;default:if(n)return i?-1:Hy(r).length;e=(""+e).toLowerCase(),n=!0}}re.byteLength=yb;function hL(r,e,t){let i=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0,e>>>=0,t<=e))return"";for(r||(r="utf8");;)switch(r){case"hex":return _L(this,e,t);case"utf8":case"utf-8":return vb(this,e,t);case"ascii":return EL(this,e,t);case"latin1":case"binary":return AL(this,e,t);case"base64":return vL(this,e,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return IL(this,e,t);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),i=!0}}re.prototype._isBuffer=!0;function Js(r,e,t){let i=r[e];r[e]=r[t],r[t]=i}re.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 t=0;tt&&(e+=" ... "),""};lb&&(re.prototype[lb]=re.prototype.inspect);re.prototype.compare=function(e,t,i,n,s){if(wi(e,Uint8Array)&&(e=re.from(e,e.offset,e.byteLength)),!re.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(t===void 0&&(t=0),i===void 0&&(i=e?e.length:0),n===void 0&&(n=0),s===void 0&&(s=this.length),t<0||i>e.length||n<0||s>this.length)throw new RangeError("out of range index");if(n>=s&&t>=i)return 0;if(n>=s)return-1;if(t>=i)return 1;if(t>>>=0,i>>>=0,n>>>=0,s>>>=0,this===e)return 0;let o=s-n,a=i-t,u=Math.min(o,a),h=this.slice(n,s),p=e.slice(t,i);for(let v=0;v2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,Ky(t)&&(t=n?0:r.length-1),t<0&&(t=r.length+t),t>=r.length){if(n)return-1;t=r.length-1}else if(t<0)if(n)t=0;else return-1;if(typeof e=="string"&&(e=re.from(e,i)),re.isBuffer(e))return e.length===0?-1:fb(r,e,t,i,n);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?n?Uint8Array.prototype.indexOf.call(r,e,t):Uint8Array.prototype.lastIndexOf.call(r,e,t):fb(r,[e],t,i,n);throw new TypeError("val must be string, number or Buffer")}function fb(r,e,t,i,n){let s=1,o=r.length,a=e.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(r.length<2||e.length<2)return-1;s=2,o/=2,a/=2,t/=2}function u(p,v){return s===1?p[v]:p.readUInt16BE(v*s)}let h;if(n){let p=-1;for(h=t;ho&&(t=o-a),h=t;h>=0;h--){let p=!0;for(let v=0;vn&&(i=n)):i=n;let s=e.length;i>s/2&&(i=s/2);let o;for(o=0;o>>0,isFinite(i)?(i=i>>>0,n===void 0&&(n="utf8")):(n=i,i=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let s=this.length-t;if((i===void 0||i>s)&&(i=s),e.length>0&&(i<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=!1;for(;;)switch(n){case"hex":return dL(this,e,t,i);case"utf8":case"utf-8":return pL(this,e,t,i);case"ascii":case"latin1":case"binary":return gL(this,e,t,i);case"base64":return yL(this,e,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return mL(this,e,t,i);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}};re.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function vL(r,e,t){return e===0&&t===r.length?Uy.fromByteArray(r):Uy.fromByteArray(r.slice(e,t))}function vb(r,e,t){t=Math.min(r.length,t);let i=[],n=e;for(;n239?4:s>223?3:s>191?2:1;if(n+a<=t){let u,h,p,v;switch(a){case 1:s<128&&(o=s);break;case 2:u=r[n+1],(u&192)===128&&(v=(s&31)<<6|u&63,v>127&&(o=v));break;case 3:u=r[n+1],h=r[n+2],(u&192)===128&&(h&192)===128&&(v=(s&15)<<12|(u&63)<<6|h&63,v>2047&&(v<55296||v>57343)&&(o=v));break;case 4:u=r[n+1],h=r[n+2],p=r[n+3],(u&192)===128&&(h&192)===128&&(p&192)===128&&(v=(s&15)<<18|(u&63)<<12|(h&63)<<6|p&63,v>65535&&v<1114112&&(o=v))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,i.push(o>>>10&1023|55296),o=56320|o&1023),i.push(o),n+=a}return wL(i)}var hb=4096;function wL(r){let e=r.length;if(e<=hb)return String.fromCharCode.apply(String,r);let t="",i=0;for(;ii)&&(t=i);let n="";for(let s=e;si&&(e=i),t<0?(t+=i,t<0&&(t=0)):t>i&&(t=i),tt)throw new RangeError("Trying to access beyond buffer length")}re.prototype.readUintLE=re.prototype.readUIntLE=function(e,t,i){e=e>>>0,t=t>>>0,i||jt(e,t,this.length);let n=this[e],s=1,o=0;for(;++o>>0,t=t>>>0,i||jt(e,t,this.length);let n=this[e+--t],s=1;for(;t>0&&(s*=256);)n+=this[e+--t]*s;return n};re.prototype.readUint8=re.prototype.readUInt8=function(e,t){return e=e>>>0,t||jt(e,1,this.length),this[e]};re.prototype.readUint16LE=re.prototype.readUInt16LE=function(e,t){return e=e>>>0,t||jt(e,2,this.length),this[e]|this[e+1]<<8};re.prototype.readUint16BE=re.prototype.readUInt16BE=function(e,t){return e=e>>>0,t||jt(e,2,this.length),this[e]<<8|this[e+1]};re.prototype.readUint32LE=re.prototype.readUInt32LE=function(e,t){return e=e>>>0,t||jt(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};re.prototype.readUint32BE=re.prototype.readUInt32BE=function(e,t){return e=e>>>0,t||jt(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};re.prototype.readBigUInt64LE=On(function(e){e=e>>>0,Ma(e,"offset");let t=this[e],i=this[e+7];(t===void 0||i===void 0)&&wc(e,this.length-8);let n=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,s=this[++e]+this[++e]*2**8+this[++e]*2**16+i*2**24;return BigInt(n)+(BigInt(s)<>>0,Ma(e,"offset");let t=this[e],i=this[e+7];(t===void 0||i===void 0)&&wc(e,this.length-8);let n=t*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+i;return(BigInt(n)<>>0,t=t>>>0,i||jt(e,t,this.length);let n=this[e],s=1,o=0;for(;++o=s&&(n-=Math.pow(2,8*t)),n};re.prototype.readIntBE=function(e,t,i){e=e>>>0,t=t>>>0,i||jt(e,t,this.length);let n=t,s=1,o=this[e+--n];for(;n>0&&(s*=256);)o+=this[e+--n]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*t)),o};re.prototype.readInt8=function(e,t){return e=e>>>0,t||jt(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};re.prototype.readInt16LE=function(e,t){e=e>>>0,t||jt(e,2,this.length);let i=this[e]|this[e+1]<<8;return i&32768?i|4294901760:i};re.prototype.readInt16BE=function(e,t){e=e>>>0,t||jt(e,2,this.length);let i=this[e+1]|this[e]<<8;return i&32768?i|4294901760:i};re.prototype.readInt32LE=function(e,t){return e=e>>>0,t||jt(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};re.prototype.readInt32BE=function(e,t){return e=e>>>0,t||jt(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};re.prototype.readBigInt64LE=On(function(e){e=e>>>0,Ma(e,"offset");let t=this[e],i=this[e+7];(t===void 0||i===void 0)&&wc(e,this.length-8);let n=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(i<<24);return(BigInt(n)<>>0,Ma(e,"offset");let t=this[e],i=this[e+7];(t===void 0||i===void 0)&&wc(e,this.length-8);let n=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(n)<>>0,t||jt(e,4,this.length),Ba.read(this,e,!0,23,4)};re.prototype.readFloatBE=function(e,t){return e=e>>>0,t||jt(e,4,this.length),Ba.read(this,e,!1,23,4)};re.prototype.readDoubleLE=function(e,t){return e=e>>>0,t||jt(e,8,this.length),Ba.read(this,e,!0,52,8)};re.prototype.readDoubleBE=function(e,t){return e=e>>>0,t||jt(e,8,this.length),Ba.read(this,e,!1,52,8)};function gr(r,e,t,i,n,s){if(!re.isBuffer(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||er.length)throw new RangeError("Index out of range")}re.prototype.writeUintLE=re.prototype.writeUIntLE=function(e,t,i,n){if(e=+e,t=t>>>0,i=i>>>0,!n){let a=Math.pow(2,8*i)-1;gr(this,e,t,i,a,0)}let s=1,o=0;for(this[t]=e&255;++o>>0,i=i>>>0,!n){let a=Math.pow(2,8*i)-1;gr(this,e,t,i,a,0)}let s=i-1,o=1;for(this[t+s]=e&255;--s>=0&&(o*=256);)this[t+s]=e/o&255;return t+i};re.prototype.writeUint8=re.prototype.writeUInt8=function(e,t,i){return e=+e,t=t>>>0,i||gr(this,e,t,1,255,0),this[t]=e&255,t+1};re.prototype.writeUint16LE=re.prototype.writeUInt16LE=function(e,t,i){return e=+e,t=t>>>0,i||gr(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2};re.prototype.writeUint16BE=re.prototype.writeUInt16BE=function(e,t,i){return e=+e,t=t>>>0,i||gr(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2};re.prototype.writeUint32LE=re.prototype.writeUInt32LE=function(e,t,i){return e=+e,t=t>>>0,i||gr(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4};re.prototype.writeUint32BE=re.prototype.writeUInt32BE=function(e,t,i){return e=+e,t=t>>>0,i||gr(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function wb(r,e,t,i,n){bb(e,i,n,r,t,7);let s=Number(e&BigInt(4294967295));r[t++]=s,s=s>>8,r[t++]=s,s=s>>8,r[t++]=s,s=s>>8,r[t++]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return r[t++]=o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o,t}function Eb(r,e,t,i,n){bb(e,i,n,r,t,7);let s=Number(e&BigInt(4294967295));r[t+7]=s,s=s>>8,r[t+6]=s,s=s>>8,r[t+5]=s,s=s>>8,r[t+4]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return r[t+3]=o,o=o>>8,r[t+2]=o,o=o>>8,r[t+1]=o,o=o>>8,r[t]=o,t+8}re.prototype.writeBigUInt64LE=On(function(e,t=0){return wb(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))});re.prototype.writeBigUInt64BE=On(function(e,t=0){return Eb(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))});re.prototype.writeIntLE=function(e,t,i,n){if(e=+e,t=t>>>0,!n){let u=Math.pow(2,8*i-1);gr(this,e,t,i,u-1,-u)}let s=0,o=1,a=0;for(this[t]=e&255;++s>0)-a&255;return t+i};re.prototype.writeIntBE=function(e,t,i,n){if(e=+e,t=t>>>0,!n){let u=Math.pow(2,8*i-1);gr(this,e,t,i,u-1,-u)}let s=i-1,o=1,a=0;for(this[t+s]=e&255;--s>=0&&(o*=256);)e<0&&a===0&&this[t+s+1]!==0&&(a=1),this[t+s]=(e/o>>0)-a&255;return t+i};re.prototype.writeInt8=function(e,t,i){return e=+e,t=t>>>0,i||gr(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1};re.prototype.writeInt16LE=function(e,t,i){return e=+e,t=t>>>0,i||gr(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2};re.prototype.writeInt16BE=function(e,t,i){return e=+e,t=t>>>0,i||gr(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2};re.prototype.writeInt32LE=function(e,t,i){return e=+e,t=t>>>0,i||gr(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4};re.prototype.writeInt32BE=function(e,t,i){return e=+e,t=t>>>0,i||gr(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};re.prototype.writeBigInt64LE=On(function(e,t=0){return wb(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});re.prototype.writeBigInt64BE=On(function(e,t=0){return Eb(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Ab(r,e,t,i,n,s){if(t+i>r.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function _b(r,e,t,i,n){return e=+e,t=t>>>0,n||Ab(r,e,t,4,34028234663852886e22,-34028234663852886e22),Ba.write(r,e,t,i,23,4),t+4}re.prototype.writeFloatLE=function(e,t,i){return _b(this,e,t,!0,i)};re.prototype.writeFloatBE=function(e,t,i){return _b(this,e,t,!1,i)};function Ib(r,e,t,i,n){return e=+e,t=t>>>0,n||Ab(r,e,t,8,17976931348623157e292,-17976931348623157e292),Ba.write(r,e,t,i,52,8),t+8}re.prototype.writeDoubleLE=function(e,t,i){return Ib(this,e,t,!0,i)};re.prototype.writeDoubleBE=function(e,t,i){return Ib(this,e,t,!1,i)};re.prototype.copy=function(e,t,i,n){if(!re.isBuffer(e))throw new TypeError("argument should be a Buffer");if(i||(i=0),!n&&n!==0&&(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t>>0,i=i===void 0?this.length:i>>>0,e||(e=0);let s;if(typeof e=="number")for(s=t;s2**32?n=db(String(t)):typeof t=="bigint"&&(n=String(t),(t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(n=db(n)),n+="n"),i+=` It must be ${e}. Received ${n}`,i},RangeError);function db(r){let e="",t=r.length,i=r[0]==="-"?1:0;for(;t>=i+4;t-=3)e=`_${r.slice(t-3,t)}${e}`;return`${r.slice(0,t)}${e}`}function bL(r,e,t){Ma(e,"offset"),(r[e]===void 0||r[e+t]===void 0)&&wc(e,r.length-(t+1))}function bb(r,e,t,i,n,s){if(r>t||r3?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 <= ${t}${o}`,new Oa.ERR_OUT_OF_RANGE("value",a,r)}bL(i,n,s)}function Ma(r,e){if(typeof r!="number")throw new Oa.ERR_INVALID_ARG_TYPE(e,"number",r)}function wc(r,e,t){throw Math.floor(r)!==r?(Ma(r,t),new Oa.ERR_OUT_OF_RANGE(t||"offset","an integer",r)):e<0?new Oa.ERR_BUFFER_OUT_OF_BOUNDS:new Oa.ERR_OUT_OF_RANGE(t||"offset",`>= ${t?1:0} and <= ${e}`,r)}var CL=/[^+/0-9A-Za-z-_]/g;function SL(r){if(r=r.split("=")[0],r=r.trim().replace(CL,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function Hy(r,e){e=e||1/0;let t,i=r.length,n=null,s=[];for(let o=0;o55295&&t<57344){if(!n){if(t>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===i){(e-=3)>-1&&s.push(239,191,189);continue}n=t;continue}if(t<56320){(e-=3)>-1&&s.push(239,191,189),n=t;continue}t=(n-55296<<10|t-56320)+65536}else n&&(e-=3)>-1&&s.push(239,191,189);if(n=null,t<128){if((e-=1)<0)break;s.push(t)}else if(t<2048){if((e-=2)<0)break;s.push(t>>6|192,t&63|128)}else if(t<65536){if((e-=3)<0)break;s.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((e-=4)<0)break;s.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return s}function xL(r){let e=[];for(let t=0;t>8,n=t%256,s.push(n),s.push(i);return s}function Cb(r){return Uy.toByteArray(SL(r))}function ah(r,e,t,i){let n;for(n=0;n=e.length||n>=r.length);++n)e[n+t]=r[n];return n}function wi(r,e){return r instanceof e||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===e.name}function Ky(r){return r!==r}var NL=function(){let r="0123456789abcdef",e=new Array(256);for(let t=0;t<16;++t){let i=t*16;for(let n=0;n<16;++n)e[i+n]=r[t]+r[n]}return e}();function On(r){return typeof BigInt>"u"?DL:r}function DL(){throw new Error("BigInt not supported")}});var Tb=D((VW,xb)=>{l();xb.exports=zy;zy.supported=typeof WebAssembly<"u";function zy(r){if(!zy.supported)return null;var e=r&&r.imports,t=OL("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"),i=null,n={buffer:t,memory:null,exports:null,realloc:s,onload:o};return o(function(){}),n;function s(u){n.exports.memory.grow(Math.ceil(Math.abs(u-n.memory.length)/65536)),n.memory=new Uint8Array(n.exports.memory.buffer)}function o(u){if(n.exports)return u();if(i){i.then(u.bind(null,null)).catch(u);return}try{if(r&&r.async)throw new Error("async");a({instance:new WebAssembly.Instance(new WebAssembly.Module(t),e)})}catch{i=WebAssembly.instantiate(t,e).then(a)}o(u)}function a(u){n.exports=u.instance.exports,n.memory=n.exports.memory&&n.exports.memory.buffer&&new Uint8Array(n.exports.memory.buffer)}}function OL(r){return typeof atob=="function"?new Uint8Array(atob(r).split("").map(BL)):new(Sb()).Buffer(r,"base64")}function BL(r){return r.charCodeAt(0)}});var Lb=D((GW,Ai)=>{l();var Ei=Fy(),Ke=Tb()(),$i=64,uh=[];Ai.exports=Lr;var Nb=Ai.exports.BYTES_MIN=16,Db=Ai.exports.BYTES_MAX=64,QW=Ai.exports.BYTES=32,Ob=Ai.exports.KEYBYTES_MIN=16,Bb=Ai.exports.KEYBYTES_MAX=64,jW=Ai.exports.KEYBYTES=32,Mb=Ai.exports.SALTBYTES=16,Pb=Ai.exports.PERSONALBYTES=16;function Lr(r,e,t,i,n){if(!(this instanceof Lr))return new Lr(r,e,t,i,n);if(!(Ke&&Ke.exports))throw new Error("WASM not loaded. Wait for Blake2b.ready(cb)");r||(r=32),n!==!0&&(Ei(r>=Nb,"digestLength must be at least "+Nb+", was given "+r),Ei(r<=Db,"digestLength must be at most "+Db+", was given "+r),e!=null&&Ei(e.length>=Ob,"key must be at least "+Ob+", was given "+e.length),e!=null&&Ei(e.length<=Bb,"key must be at least "+Bb+", was given "+e.length),t!=null&&Ei(t.length===Mb,"salt must be exactly "+Mb+", was given "+t.length),i!=null&&Ei(i.length===Pb,"personal must be exactly "+Pb+", was given "+i.length)),uh.length||(uh.push($i),$i+=216),this.digestLength=r,this.finalized=!1,this.pointer=uh.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,t&&Ke.memory.set(t,32),i&&Ke.memory.set(i,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,$i,$i+e.length),Ke.memory[this.pointer+200]=128)}Lr.prototype.update=function(r){return Ei(this.finalized===!1,"Hash instance finalized"),Ei(r,"input must be TypedArray or Buffer"),$i+r.length>Ke.memory.length&&Ke.realloc($i+r.length),Ke.memory.set(r,$i),Ke.exports.blake2b_update(this.pointer,$i,$i+r.length),this};Lr.prototype.digest=function(r){if(Ei(this.finalized===!1,"Hash instance finalized"),this.finalized=!0,uh.push(this.pointer),Ke.exports.blake2b_final(this.pointer),!r||r==="binary")return Ke.memory.slice(this.pointer+128,this.pointer+128+this.digestLength);if(r==="hex")return PL(Ke.memory,this.pointer+128,this.digestLength);Ei(r.length>=this.digestLength,"input must be TypedArray or Buffer");for(var e=0;e{l();var Pn=Fy(),Ac=Lb();function ch(r,e,t){var i=r[e]+r[t],n=r[e+1]+r[t+1];i>=4294967296&&n++,r[e]=i,r[e+1]=n}function Rb(r,e,t,i){var n=r[e]+t;t<0&&(n+=4294967296);var s=r[e+1]+i;n>=4294967296&&s++,r[e]=n,r[e+1]=s}function jb(r,e){return r[e]^r[e+1]<<8^r[e+2]<<16^r[e+3]<<24}function Bn(r,e,t,i,n,s){var o=Ec[n],a=Ec[n+1],u=Ec[s],h=Ec[s+1];ch(Ce,r,e),Rb(Ce,r,o,a);var p=Ce[i]^Ce[r],v=Ce[i+1]^Ce[r+1];Ce[i]=v,Ce[i+1]=p,ch(Ce,t,i),p=Ce[e]^Ce[t],v=Ce[e+1]^Ce[t+1],Ce[e]=p>>>24^v<<8,Ce[e+1]=v>>>24^p<<8,ch(Ce,r,e),Rb(Ce,r,u,h),p=Ce[i]^Ce[r],v=Ce[i+1]^Ce[r+1],Ce[i]=p>>>16^v<<16,Ce[i+1]=v>>>16^p<<16,ch(Ce,t,i),p=Ce[e]^Ce[t],v=Ce[e+1]^Ce[t+1],Ce[e]=v>>>31^p<<1,Ce[e+1]=p>>>31^v<<1}var Gb=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),RL=[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],nr=new Uint8Array(RL.map(function(r){return r*2})),Ce=new Uint32Array(32),Ec=new Uint32Array(32);function Kb(r,e){var t=0;for(t=0;t<16;t++)Ce[t]=r.h[t],Ce[t+16]=Gb[t];for(Ce[24]=Ce[24]^r.t,Ce[25]=Ce[25]^r.t/4294967296,e&&(Ce[28]=~Ce[28],Ce[29]=~Ce[29]),t=0;t<32;t++)Ec[t]=jb(r.b,4*t);for(t=0;t<12;t++)Bn(0,8,16,24,nr[t*16+0],nr[t*16+1]),Bn(2,10,18,26,nr[t*16+2],nr[t*16+3]),Bn(4,12,20,28,nr[t*16+4],nr[t*16+5]),Bn(6,14,22,30,nr[t*16+6],nr[t*16+7]),Bn(0,10,20,30,nr[t*16+8],nr[t*16+9]),Bn(2,12,22,24,nr[t*16+10],nr[t*16+11]),Bn(4,14,16,26,nr[t*16+12],nr[t*16+13]),Bn(6,8,18,28,nr[t*16+14],nr[t*16+15]);for(t=0;t<16;t++)r.h[t]=r.h[t]^Ce[t]^Ce[t+16]}var Mn=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);function La(r,e,t,i){Mn.fill(0),this.b=new Uint8Array(128),this.h=new Uint32Array(16),this.t=0,this.c=0,this.outlen=r,Mn[0]=r,e&&(Mn[1]=e.length),Mn[2]=1,Mn[3]=1,t&&Mn.set(t,32),i&&Mn.set(i,48);for(var n=0;n<16;n++)this.h[n]=Gb[n]^jb(Mn,n*4);e&&(zb(this,e),this.c=128)}La.prototype.update=function(r){return Pn(r!=null,"input must be Uint8Array or Buffer"),zb(this,r),this};La.prototype.digest=function(r){var e=!r||r==="binary"||r==="hex"?new Uint8Array(this.outlen):r;return Pn(e.length>=this.outlen,"out must have at least outlen bytes of space"),FL(this,e),r==="hex"?UL(e):e};La.prototype.final=La.prototype.digest;La.ready=function(r){Ac.ready(function(){r()})};function zb(r,e){for(var t=0;t>2]>>8*(t&3);return e}function UL(r){for(var e="",t=0;t=Fb,"outlen must be at least "+Fb+", was given "+e),Pn(e<=Ub,"outlen must be at most "+Ub+", was given "+e),t!=null&&Pn(t.length>=qb,"key must be at least "+qb+", was given "+t.length),t!=null&&Pn(t.length<=Vb,"key must be at most "+Vb+", was given "+t.length),i!=null&&Pn(i.length===Hb,"salt must be exactly "+Hb+", was given "+i.length),n!=null&&Pn(n.length===Qb,"personal must be exactly "+Qb+", was given "+n.length)),new $b(e,t,i,n)};yr.exports.ready=function(r){Ac.ready(function(){r()})};yr.exports.WASM_SUPPORTED=Ac.SUPPORTED;yr.exports.WASM_LOADED=!1;var Fb=yr.exports.BYTES_MIN=16,Ub=yr.exports.BYTES_MAX=64,zW=yr.exports.BYTES=32,qb=yr.exports.KEYBYTES_MIN=16,Vb=yr.exports.KEYBYTES_MAX=64,$W=yr.exports.KEYBYTES=32,Hb=yr.exports.SALTBYTES=16,Qb=yr.exports.PERSONALBYTES=16;Ac.ready(function(r){r||(yr.exports.WASM_LOADED=!0,$b=Ac)})});var Wy=D(Rr=>{"use strict";l();var VL=Rr&&Rr.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),HL=Rr&&Rr.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),QL=Rr&&Rr.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&VL(e,r,t);return HL(e,r),e};Object.defineProperty(Rr,"__esModule",{value:!0});Rr.TransactionHash=Rr.Transaction=void 0;var _c=Vr(),$y=Hr(),ky=tI(),Wb=nI(),jL=xr(),Yb=dc(),GL=QL(ke()),KL=ab(),zL=ub(),$L=Zf(),kL=kb(),WL=32,Ic=class{constructor({nonce:e,value:t,receiver:i,sender:n,gasPrice:s,gasLimit:o,data:a,chainID:u,version:h,options:p}){this.nonce=e||0,this.value=t||0,this.sender=n,this.receiver=i,this.gasPrice=s||$L.TRANSACTION_MIN_GAS_PRICE,this.gasLimit=o,this.data=a||new Yb.TransactionPayload,this.chainID=u,this.version=h||ky.TransactionVersion.withDefaultVersion(),this.options=p||ky.TransactionOptions.withDefaultOptions(),this.signature=Wb.Signature.empty(),this.hash=Xs.empty()}getNonce(){return this.nonce}setNonce(e){this.nonce=e}getValue(){return this.value}setValue(e){this.value=e}getSender(){return this.sender}getReceiver(){return this.receiver}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}getOptions(){return this.options}getSignature(){return this.signature}getHash(){return jL.guardNotEmpty(this.hash,"hash"),this.hash}serializeForSigning(e){let t=this.toPlainObject(e);t.signature&&delete t.signature;let i=JSON.stringify(t);return y.Buffer.from(i)}toPlainObject(e){return{nonce:this.nonce.valueOf(),value:this.value.toString(),receiver:this.receiver.bech32(),sender:e?e.bech32():this.sender.bech32(),gasPrice:this.gasPrice.valueOf(),gasLimit:this.gasLimit.valueOf(),data:this.data.length()==0?void 0:this.data.encoded(),chainID:this.chainID.valueOf(),version:this.version.valueOf(),options:this.options.valueOf()==0?void 0:this.options.valueOf(),signature:this.signature.hex()?this.signature.hex():void 0}}static fromPlainObject(e){let t=new Ic({nonce:Number(e.nonce),value:new _c.BigNumber(e.value),receiver:$y.Address.fromString(e.receiver),sender:$y.Address.fromString(e.sender),gasPrice:Number(e.gasPrice),gasLimit:Number(e.gasLimit),data:new Yb.TransactionPayload(y.Buffer.from(e.data||"","base64")),chainID:String(e.chainID),version:new ky.TransactionVersion(e.version)});return e.signature&&t.applySignature(new Wb.Signature(e.signature),$y.Address.fromString(e.sender)),t}applySignature(e,t){this.signature=e,this.sender=t,this.hash=Xs.compute(this)}toSendable(){return this.toPlainObject()}computeFee(e){let t=e.MinGasLimit.valueOf()+this.data.length()*e.GasPerDataByte.valueOf();if(t>this.gasLimit.valueOf())throw new GL.ErrNotEnoughGas(this.gasLimit.valueOf());let i=new _c.BigNumber(this.gasPrice.valueOf()),n=new _c.BigNumber(t).multipliedBy(i);if(t===this.gasLimit.valueOf())return n;let s=new _c.BigNumber(this.gasLimit.valueOf()-t),o=i.multipliedBy(new _c.BigNumber(e.GasPriceModifier.valueOf())),a=s.multipliedBy(o);return n.plus(a)}};Rr.Transaction=Ic;var Xs=class extends zL.Hash{constructor(e){super(e)}static compute(e){let i=new KL.ProtoSerializer().serializeTransaction(e),n=kL(WL).update(i).digest("hex");return new Xs(n)}};Rr.TransactionHash=Xs});var Yy=D(eo=>{"use strict";l();Object.defineProperty(eo,"__esModule",{value:!0});eo.Logger=eo.LogLevel=void 0;var Zs;(function(r){r[r.Trace=0]="Trace",r[r.Debug=1]="Debug",r[r.Info=2]="Info",r[r.Warn=3]="Warn",r[r.Error=4]="Error",r[r.None=5]="None"})(Zs=eo.LogLevel||(eo.LogLevel={}));var kr=class{static setLevel(e){kr.logLevel=e}static trace(e,...t){kr.logLevel>=Zs.Debug||console.debug(e,t)}static debug(e,...t){kr.logLevel>=Zs.Debug||console.debug(e,t)}static info(e,...t){kr.logLevel>=Zs.Info||console.log(e,t)}static warn(e,...t){kr.logLevel>=Zs.Warn||console.warn(e,t)}static error(e,...t){kr.logLevel>=Zs.Error||console.error(e,t)}};eo.Logger=kr;kr.logLevel=Zs.Debug});var Jb=D(_i=>{"use strict";l();var YL=_i&&_i.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),JL=_i&&_i.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),XL=_i&&_i.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&YL(e,r,t);return JL(e,r),e};Object.defineProperty(_i,"__esModule",{value:!0});_i.AsyncTimer=void 0;var ZL=XL(ke()),eR=ke(),Jy=Yy(),Xy=class{constructor(e){this.timeoutHandle=null,this.rejectionFunc=null,this.name=e,this.correlationTag=0}start(e){if(this.timeoutHandle)throw new ZL.ErrAsyncTimerAlreadyRunning;return this.correlationTag++,Jy.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].start()`),new Promise((t,i)=>{this.rejectionFunc=i;let n=()=>{this.rejectionFunc=null,this.stop(),t()};this.timeoutHandle=setTimeout(n,e)})}abort(){Jy.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].abort()`),this.rejectionFunc&&(this.rejectionFunc(new eR.ErrAsyncTimerAborted),this.rejectionFunc=null),this.stop()}stop(){this.isStopped()||(Jy.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].stop()`),this.timeoutHandle&&(clearTimeout(this.timeoutHandle),this.timeoutHandle=null))}isStopped(){return!this.timeoutHandle}};_i.AsyncTimer=Xy});var em=D(Fa=>{"use strict";l();var Fr=Fa&&Fa.__awaiter||function(r,e,t,i){function n(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(p){try{h(i.next(p))}catch(v){o(v)}}function u(p){try{h(i.throw(p))}catch(v){o(v)}}function h(p){p.done?s(p.value):n(p.value).then(a,u)}h((i=i.apply(r,e||[])).next())})};Object.defineProperty(Fa,"__esModule",{value:!0});Fa.TransactionWatcher=void 0;var Xb=Jb(),Zb=Yy(),Ra=ke(),Ii=class{constructor(e,t=Ii.DefaultPollingInterval,i=Ii.DefaultTimeout){this.fetcher=new Zy(e),this.pollingInterval=t,this.timeout=i}awaitPending(e){return Fr(this,void 0,void 0,function*(){let t=s=>s.status.isPending(),i=()=>Fr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),n=()=>new Ra.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(t,i,n)})}awaitCompleted(e){return Fr(this,void 0,void 0,function*(){let t=s=>s.isCompleted,i=()=>Fr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),n=()=>new Ra.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(t,i,n)})}awaitAllEvents(e,t){return Fr(this,void 0,void 0,function*(){let i=o=>{let a=this.getAllTransactionEvents(o).map(h=>h.identifier);return t.every(h=>a.includes(h))},n=()=>Fr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),s=()=>new Ra.ErrExpectedTransactionEventsNotFound;return this.awaitConditionally(i,n,s)})}awaitAnyEvent(e,t){return Fr(this,void 0,void 0,function*(){let i=o=>{let a=this.getAllTransactionEvents(o).map(h=>h.identifier);return t.find(h=>a.includes(h))!=null},n=()=>Fr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),s=()=>new Ra.ErrExpectedTransactionEventsNotFound;return this.awaitConditionally(i,n,s)})}awaitOnCondition(e,t){return Fr(this,void 0,void 0,function*(){let i=()=>Fr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),n=()=>new Ra.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(t,i,n)})}awaitConditionally(e,t,i){return Fr(this,void 0,void 0,function*(){let n=new Xb.AsyncTimer("watcher:periodic"),s=new Xb.AsyncTimer("watcher:timeout"),o=!1,a,u=!1;for(s.start(this.timeout).finally(()=>{s.stop(),o=!0});!o;){yield n.start(this.pollingInterval);try{if(a=yield t(),u=e(a),u||o)break}catch(h){if(Zb.Logger.debug("TransactionWatcher.awaitConditionally(): cannot (yet) fetch data."),!(h instanceof Ra.Err))throw h}}if(s.isStopped()||s.stop(),!a||!u)throw i();return a})}getAllTransactionEvents(e){let t=[...e.logs.events];for(let i of e.contractResults.items)t.push(...i.logs.events);return t}};Fa.TransactionWatcher=Ii;Ii.DefaultPollingInterval=6e3;Ii.DefaultTimeout=Ii.DefaultPollingInterval*15;Ii.NoopOnStatusReceived=r=>{};var Zy=class{constructor(e){this.fetcher=e}getTransaction(e){return Fr(this,void 0,void 0,function*(){return Zb.Logger.debug(`transactionWatcher, getTransaction(${e})`),yield this.fetcher.getTransaction(e)})}}});var eC=D(bi=>{"use strict";l();var tR=bi&&bi.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),rR=bi&&bi.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),iR=bi&&bi.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&tR(e,r,t);return rR(e,r),e};Object.defineProperty(bi,"__esModule",{value:!0});bi.ContractFunction=void 0;var nR=iR(ke()),bc=class{constructor(e){if(this.name=e,e==null)throw new nR.ErrInvalidFunctionName}static none(){return new bc("untitled")}toString(){return this.name}valueOf(){return this.name}equals(e){return e?this.name==e.name:!1}};bi.ContractFunction=bc});var tC=D(Ua=>{"use strict";l();Object.defineProperty(Ua,"__esModule",{value:!0});Ua.Signature=Ua.Address=void 0;var tm=class{constructor(e){this.value=e}bech32(){return this.value}};Ua.Address=tm;var rm=class{constructor(e){this.value=e}hex(){return this.value}};Ua.Signature=rm});var rC=D(Cc=>{"use strict";l();Object.defineProperty(Cc,"__esModule",{value:!0});Cc.Operation=void 0;var sR;(function(r){r.Connect="connect",r.Logout="logout",r.SignTransactions="signTransactions",r.SignMessage="signMessage",r.CancelAction="cancelAction"})(sR=Cc.Operation||(Cc.Operation={}))});var iC=D(Ln=>{"use strict";l();Object.defineProperty(Ln,"__esModule",{value:!0});Ln.ErrAccountNotConnected=Ln.ErrCannotSignSingleTransaction=Ln.Err=void 0;var Sc=class extends Error{constructor(e,t){super(e),this.inner=void 0,this.inner=t}};Ln.Err=Sc;var im=class extends Sc{constructor(){super("Cannot sign single transaction.")}};Ln.ErrCannotSignSingleTransaction=im;var nm=class extends Sc{constructor(){super("Account is not connected.")}};Ln.ErrAccountNotConnected=nm});var sm=D(qa=>{"use strict";l();var Rn=qa&&qa.__awaiter||function(r,e,t,i){function n(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(p){try{h(i.next(p))}catch(v){o(v)}}function u(p){try{h(i.throw(p))}catch(v){o(v)}}function h(p){p.done?s(p.value):n(p.value).then(a,u)}h((i=i.apply(r,e||[])).next())})};Object.defineProperty(qa,"__esModule",{value:!0});qa.ExtensionProvider=void 0;var lh=tC(),xc=rC(),nC=iC(),Ci=class{constructor(){if(this.account={address:""},this.initialized=!1,Ci._instance)throw new Error("Error: Instantiation failed: Use ExtensionProvider.getInstance() instead of new.");Ci._instance=this}static getInstance(){return Ci._instance}setAddress(e){return this.account.address=e,Ci._instance}init(){return Rn(this,void 0,void 0,function*(){return window&&window.elrondWallet&&(this.initialized=!0),this.initialized})}login(e={}){return Rn(this,void 0,void 0,function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");let{token:t}=e,i=t||"";return yield this.startBgrMsgChannel(xc.Operation.Connect,i),this.account.address})}logout(){return Rn(this,void 0,void 0,function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");try{yield this.startBgrMsgChannel(xc.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 Rn(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 Rn(this,void 0,void 0,function*(){return Boolean(this.account.address)})}signTransaction(e){return Rn(this,void 0,void 0,function*(){this.ensureConnected();let t=yield this.signTransactions([e]);if(t.length!=1)throw new nC.ErrCannotSignSingleTransaction;return t[0]})}ensureConnected(){if(!this.account.address)throw new nC.ErrAccountNotConnected}signTransactions(e){return Rn(this,void 0,void 0,function*(){this.ensureConnected();let t=yield this.startBgrMsgChannel(xc.Operation.SignTransactions,{from:this.account.address,transactions:e.map(i=>i.toPlainObject())});try{for(let i=0;i{window.postMessage({target:"erdw-inpage",type:e,data:t},window.origin);let n=s=>{s.isTrusted&&s.data.target==="erdw-contentScript"&&(s.data.type==="connectResponse"?(s.data.data&&Boolean(s.data.data.address)&&(this.account=s.data.data),window.removeEventListener("message",n),i(s.data.data)):(window.removeEventListener("message",n),i(s.data.data)))};window.addEventListener("message",n,!1)})}};qa.ExtensionProvider=Ci;Ci._instance=new Ci});var cC=D((IY,uC)=>{"use strict";l();function oR(r){try{return JSON.stringify(r)}catch{return'"[Circular]"'}}uC.exports=aR;function aR(r,e,t){var i=t&&t.stringify||oR,n=1;if(typeof r=="object"&&r!==null){var s=e.length+n;if(s===1)return r;var o=new Array(s);o[0]=i(r);for(var a=1;a-1?v:0,r.charCodeAt(R+1)){case 100:case 102:if(p>=u||e[p]==null)break;v=u||e[p]==null)break;v=u||e[p]===void 0)break;v",v=R+2,R++;break}h+=i(e[p]),v=R+2,R++;break;case 115:if(p>=u)break;v{"use strict";l();var lC=cC();dC.exports=xi;var Tc=yR().console||{},uR={mapHttpRequest:yh,mapHttpResponse:yh,wrapRequestSerializer:om,wrapResponseSerializer:om,wrapErrorSerializer:om,req:yh,res:yh,err:hR};function xi(r){r=r||{},r.browser=r.browser||{};var e=r.browser.transmit;if(e&&typeof e.send!="function")throw Error("pino: transmit option must have a send function");var t=r.browser.write||Tc;r.browser.write&&(r.browser.asObject=!0);var i=r.serializers||{},n=Array.isArray(r.browser.serialize)?r.browser.serialize.filter(function(x){return x!=="!stdSerializers.err"}):r.browser.serialize===!0?Object.keys(i):!1,s=r.browser.serialize;Array.isArray(r.browser.serialize)&&r.browser.serialize.indexOf("!stdSerializers.err")>-1&&(s=!1);var o=["error","fatal","warn","info","debug","trace"];typeof t=="function"&&(t.error=t.fatal=t.warn=t.info=t.debug=t.trace=t),r.enabled===!1&&(r.level="silent");var a=r.level||"info",u=Object.create(t);u.log||(u.log=Nc),Object.defineProperty(u,"levelVal",{get:p}),Object.defineProperty(u,"level",{get:v,set:B});var h={transmit:e,serialize:n,asObject:r.browser.asObject,levels:o,timestamp:dR(r)};u.levels=xi.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=Nc,u.serializers=i,u._serialize=n,u._stdErrSerialize=s,u.child=R,e&&(u._logEvent=am());function p(){return this.level==="silent"?1/0:this.levels.values[this.level]}function v(){return this._level}function B(x){if(x!=="silent"&&!this.levels.values[x])throw Error("unknown level "+x);this._level=x,Va(h,u,"error","log"),Va(h,u,"fatal","error"),Va(h,u,"warn","error"),Va(h,u,"info","log"),Va(h,u,"debug","log"),Va(h,u,"trace","log")}function R(x){if(!x)throw new Error("missing bindings for child Pino");var V=x.serializers;if(n&&V){var H=Object.assign({},i,V),K=r.browser.serialize===!0?Object.keys(H):n;delete x.serializers,mh([x],K,H,this._stdErrSerialize)}function ie(k){this._childLevel=(k._childLevel|0)+1,this.error=Ha(k,x,"error"),this.fatal=Ha(k,x,"fatal"),this.warn=Ha(k,x,"warn"),this.info=Ha(k,x,"info"),this.debug=Ha(k,x,"debug"),this.trace=Ha(k,x,"trace"),H&&(this.serializers=H,this._serialize=K),e&&(this._logEvent=am([].concat(k._logEvent.bindings,x)))}return ie.prototype=this,new ie(this)}return u}xi.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"}};xi.stdSerializers=uR;xi.stdTimeFunctions=Object.assign({},{nullTime:fC,epochTime:hC,unixTime:pR,isoTime:gR});function Va(r,e,t,i){var n=Object.getPrototypeOf(e);e[t]=e.levelVal>e.levels.values[t]?Nc:n[t]?n[t]:Tc[t]||Tc[i]||Nc,cR(r,e,t)}function cR(r,e,t){!r.transmit&&e[t]===Nc||(e[t]=function(i){return function(){for(var s=r.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Tc?Tc:this,u=0;u-1&&s in t&&(r[n][s]=t[s](r[n][s]))}function Ha(r,e,t){return function(){var i=new Array(1+arguments.length);i[0]=e;for(var n=1;n{l();var pC,gC,yC,mC,vC,wC,EC,AC,_C,vh,cm,IC,bC,Qa,CC,SC,xC,TC,NC,DC,OC,BC,MC;(function(r){var e=typeof global=="object"?global:typeof self=="object"?self:typeof this=="object"?this:{};typeof define=="function"&&define.amd?define("tslib",["exports"],function(i){r(t(e,t(i)))}):typeof wh=="object"&&typeof wh.exports=="object"?r(t(e,t(wh.exports))):r(t(e));function t(i,n){return i!==e&&(typeof Object.create=="function"?Object.defineProperty(i,"__esModule",{value:!0}):i.__esModule=!0),function(s,o){return i[s]=n?n(s,o):o}}})(function(r){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])};pC=function(t,i){e(t,i);function n(){this.constructor=t}t.prototype=i===null?Object.create(i):(n.prototype=i.prototype,new n)},gC=Object.assign||function(t){for(var i,n=1,s=arguments.length;n=0;h--)(u=t[h])&&(a=(o<3?u(a):o>3?u(i,n,a):u(i,n))||a);return o>3&&a&&Object.defineProperty(i,n,a),a},vC=function(t,i){return function(n,s){i(n,s,t)}},wC=function(t,i){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,i)},EC=function(t,i,n,s){function o(a){return a instanceof n?a:new n(function(u){u(a)})}return new(n||(n=Promise))(function(a,u){function h(B){try{v(s.next(B))}catch(R){u(R)}}function p(B){try{v(s.throw(B))}catch(R){u(R)}}function v(B){B.done?a(B.value):o(B.value).then(h,p)}v((s=s.apply(t,i||[])).next())})},AC=function(t,i){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},s,o,a,u;return u={next:h(0),throw:h(1),return:h(2)},typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function h(v){return function(B){return p([v,B])}}function p(v){if(s)throw new TypeError("Generator is already executing.");for(;n;)try{if(s=1,o&&(a=v[0]&2?o.return:v[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,v[1])).done)return a;switch(o=0,a&&(v=[v[0]&2,a.value]),v[0]){case 0:case 1:a=v;break;case 4:return n.label++,{value:v[1],done:!1};case 5:n.label++,o=v[1],v=[0];continue;case 7:v=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(v[0]===6||v[0]===2)){n=0;continue}if(v[0]===3&&(!a||v[1]>a[0]&&v[1]=t.length&&(t=void 0),{value:t&&t[s++],done:!t}}};throw new TypeError(i?"Object is not iterable.":"Symbol.iterator is not defined.")},cm=function(t,i){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var s=n.call(t),o,a=[],u;try{for(;(i===void 0||i-- >0)&&!(o=s.next()).done;)a.push(o.value)}catch(h){u={error:h}}finally{try{o&&!o.done&&(n=s.return)&&n.call(s)}finally{if(u)throw u.error}}return a},IC=function(){for(var t=[],i=0;i1||h(x,V)})})}function h(x,V){try{p(s[x](V))}catch(H){R(a[0][3],H)}}function p(x){x.value instanceof Qa?Promise.resolve(x.value.v).then(v,B):R(a[0][2],x)}function v(x){h("next",x)}function B(x){h("throw",x)}function R(x,V){x(V),a.shift(),a.length&&h(a[0][0],a[0][1])}},SC=function(t){var i,n;return i={},s("next"),s("throw",function(o){throw o}),s("return"),i[Symbol.iterator]=function(){return this},i;function s(o,a){i[o]=t[o]?function(u){return(n=!n)?{value:Qa(t[o](u)),done:o==="return"}:a?a(u):u}:a}},xC=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=t[Symbol.asyncIterator],n;return i?i.call(t):(t=typeof vh=="function"?vh(t):t[Symbol.iterator](),n={},s("next"),s("throw"),s("return"),n[Symbol.asyncIterator]=function(){return this},n);function s(a){n[a]=t[a]&&function(u){return new Promise(function(h,p){u=t[a](u),o(h,p,u.done,u.value)})}}function o(a,u,h,p){Promise.resolve(p).then(function(v){a({value:v,done:h})},u)}},TC=function(t,i){return Object.defineProperty?Object.defineProperty(t,"raw",{value:i}):t.raw=i,t},NC=function(t){if(t&&t.__esModule)return t;var i={};if(t!=null)for(var n in t)Object.hasOwnProperty.call(t,n)&&(i[n]=t[n]);return i.default=t,i},DC=function(t){return t&&t.__esModule?t:{default:t}},OC=function(t,i){if(!i.has(t))throw new TypeError("attempted to get private field on non-instance");return i.get(t)},BC=function(t,i,n){if(!i.has(t))throw new TypeError("attempted to set private field on non-instance");return i.set(t,n),n},r("__extends",pC),r("__assign",gC),r("__rest",yC),r("__decorate",mC),r("__param",vC),r("__metadata",wC),r("__awaiter",EC),r("__generator",AC),r("__exportStar",_C),r("__createBinding",MC),r("__values",vh),r("__read",cm),r("__spread",IC),r("__spreadArrays",bC),r("__await",Qa),r("__asyncGenerator",CC),r("__asyncDelegator",SC),r("__asyncValues",xC),r("__makeTemplateObject",TC),r("__importStar",NC),r("__importDefault",DC),r("__classPrivateFieldGet",OC),r("__classPrivateFieldSet",BC)})});var PC=D((NY,lm)=>{l();(function(){"use strict";var r;function e(){}r=e,r.prototype.getItem=function(t){return this.hasOwnProperty(t)?String(this[t]):null},r.prototype.setItem=function(t,i){this[t]=String(i)},r.prototype.removeItem=function(t){delete this[t]},r.prototype.clear=function(){var t=this;Object.keys(t).forEach(function(i){t[i]=void 0,delete t[i]})},r.prototype.key=function(t){return t=t||0,Object.keys(this)[t]},r.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),global.localStorage?lm.exports=localStorage:lm.exports=new e})()});var fm=D(Ah=>{"use strict";l();Object.defineProperty(Ah,"__esModule",{value:!0});function mR(r){if(typeof r!="string")throw new Error(`Cannot safe json parse value of type ${typeof r}`);try{return JSON.parse(r)}catch{return r}}Ah.safeJsonParse=mR;function vR(r){return typeof r=="string"?r:JSON.stringify(r,(e,t)=>typeof t>"u"?null:t)}Ah.safeJsonStringify=vR});var LC=D(_h=>{"use strict";l();Object.defineProperty(_h,"__esModule",{value:!0});_h.IKeyValueStorage=void 0;var hm=class{};_h.IKeyValueStorage=hm});var RC=D(Ih=>{"use strict";l();Object.defineProperty(Ih,"__esModule",{value:!0});Ih.parseEntry=void 0;var wR=fm();function ER(r){var e;return[r[0],wR.safeJsonParse((e=r[1])!==null&&e!==void 0?e:"")]}Ih.parseEntry=ER});var UC=D(bh=>{"use strict";l();Object.defineProperty(bh,"__esModule",{value:!0});var FC=Eh();FC.__exportStar(LC(),bh);FC.__exportStar(RC(),bh)});var VC=D(Dc=>{"use strict";l();Object.defineProperty(Dc,"__esModule",{value:!0});Dc.KeyValueStorage=void 0;var ja=Eh(),AR=ja.__importDefault(PC()),qC=fm(),_R=UC(),Ch=class{constructor(){this.localStorage=AR.default}getKeys(){return ja.__awaiter(this,void 0,void 0,function*(){return Object.keys(this.localStorage)})}getEntries(){return ja.__awaiter(this,void 0,void 0,function*(){return Object.entries(this.localStorage).map(_R.parseEntry)})}getItem(e){return ja.__awaiter(this,void 0,void 0,function*(){let t=this.localStorage.getItem(e);if(t!==null)return qC.safeJsonParse(t)})}setItem(e,t){return ja.__awaiter(this,void 0,void 0,function*(){this.localStorage.setItem(e,qC.safeJsonStringify(t))})}removeItem(e){return ja.__awaiter(this,void 0,void 0,function*(){this.localStorage.removeItem(e)})}};Dc.KeyValueStorage=Ch;Dc.default=Ch});var Th=D((HY,dm)=>{"use strict";l();var Ga=typeof Reflect=="object"?Reflect:null,HC=Ga&&typeof Ga.apply=="function"?Ga.apply:function(e,t,i){return Function.prototype.apply.call(e,t,i)},Sh;Ga&&typeof Ga.ownKeys=="function"?Sh=Ga.ownKeys:Object.getOwnPropertySymbols?Sh=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Sh=function(e){return Object.getOwnPropertyNames(e)};function IR(r){console&&console.warn&&console.warn(r)}var jC=Number.isNaN||function(e){return e!==e};function He(){He.init.call(this)}dm.exports=He;dm.exports.once=xR;He.EventEmitter=He;He.prototype._events=void 0;He.prototype._eventsCount=0;He.prototype._maxListeners=void 0;var QC=10;function xh(r){if(typeof r!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof r)}Object.defineProperty(He,"defaultMaxListeners",{enumerable:!0,get:function(){return QC},set:function(r){if(typeof r!="number"||r<0||jC(r))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+r+".");QC=r}});He.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};He.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||jC(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 GC(r){return r._maxListeners===void 0?He.defaultMaxListeners:r._maxListeners}He.prototype.getMaxListeners=function(){return GC(this)};He.prototype.emit=function(e){for(var t=[],i=1;i0&&(o=t[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")HC(u,this,t);else for(var h=u.length,p=WC(u,h),i=0;i0&&o.length>n&&!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=r,a.type=e,a.count=o.length,IR(a)}return r}He.prototype.addListener=function(e,t){return KC(this,e,t,!1)};He.prototype.on=He.prototype.addListener;He.prototype.prependListener=function(e,t){return KC(this,e,t,!0)};function bR(){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 zC(r,e,t){var i={fired:!1,wrapFn:void 0,target:r,type:e,listener:t},n=bR.bind(i);return n.listener=t,i.wrapFn=n,n}He.prototype.once=function(e,t){return xh(t),this.on(e,zC(this,e,t)),this};He.prototype.prependOnceListener=function(e,t){return xh(t),this.prependListener(e,zC(this,e,t)),this};He.prototype.removeListener=function(e,t){var i,n,s,o,a;if(xh(t),n=this._events,n===void 0)return this;if(i=n[e],i===void 0)return this;if(i===t||i.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,i.listener||t));else if(typeof i!="function"){for(s=-1,o=i.length-1;o>=0;o--)if(i[o]===t||i[o].listener===t){a=i[o].listener,s=o;break}if(s<0)return this;s===0?i.shift():CR(i,s),i.length===1&&(n[e]=i[0]),n.removeListener!==void 0&&this.emit("removeListener",e,a||t)}return this};He.prototype.off=He.prototype.removeListener;He.prototype.removeAllListeners=function(e){var t,i,n;if(i=this._events,i===void 0)return this;if(i.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):i[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete i[e]),this;if(arguments.length===0){var s=Object.keys(i),o;for(n=0;n=0;n--)this.removeListener(e,t[n]);return this};function $C(r,e,t){var i=r._events;if(i===void 0)return[];var n=i[e];return n===void 0?[]:typeof n=="function"?t?[n.listener||n]:[n]:t?SR(n):WC(n,n.length)}He.prototype.listeners=function(e){return $C(this,e,!0)};He.prototype.rawListeners=function(e){return $C(this,e,!1)};He.listenerCount=function(r,e){return typeof r.listenerCount=="function"?r.listenerCount(e):kC.call(r,e)};He.prototype.listenerCount=kC;function kC(r){var e=this._events;if(e!==void 0){var t=e[r];if(typeof t=="function")return 1;if(t!==void 0)return t.length}return 0}He.prototype.eventNames=function(){return this._eventsCount>0?Sh(this._events):[]};function WC(r,e){for(var t=new Array(e),i=0;i{"use strict";l();Object.defineProperty(Nh,"__esModule",{value:!0});Nh.delay=void 0;function NR(r){return new Promise(e=>{setTimeout(()=>{e(!0)},r)})}Nh.delay=NR});var XC=D(Ka=>{"use strict";l();Object.defineProperty(Ka,"__esModule",{value:!0});Ka.ONE_THOUSAND=Ka.ONE_HUNDRED=void 0;Ka.ONE_HUNDRED=100;Ka.ONE_THOUSAND=1e3});var ZC=D(pe=>{"use strict";l();Object.defineProperty(pe,"__esModule",{value:!0});pe.ONE_YEAR=pe.FOUR_WEEKS=pe.THREE_WEEKS=pe.TWO_WEEKS=pe.ONE_WEEK=pe.THIRTY_DAYS=pe.SEVEN_DAYS=pe.FIVE_DAYS=pe.THREE_DAYS=pe.ONE_DAY=pe.TWENTY_FOUR_HOURS=pe.TWELVE_HOURS=pe.SIX_HOURS=pe.THREE_HOURS=pe.ONE_HOUR=pe.SIXTY_MINUTES=pe.THIRTY_MINUTES=pe.TEN_MINUTES=pe.FIVE_MINUTES=pe.ONE_MINUTE=pe.SIXTY_SECONDS=pe.THIRTY_SECONDS=pe.TEN_SECONDS=pe.FIVE_SECONDS=pe.ONE_SECOND=void 0;pe.ONE_SECOND=1;pe.FIVE_SECONDS=5;pe.TEN_SECONDS=10;pe.THIRTY_SECONDS=30;pe.SIXTY_SECONDS=60;pe.ONE_MINUTE=pe.SIXTY_SECONDS;pe.FIVE_MINUTES=pe.ONE_MINUTE*5;pe.TEN_MINUTES=pe.ONE_MINUTE*10;pe.THIRTY_MINUTES=pe.ONE_MINUTE*30;pe.SIXTY_MINUTES=pe.ONE_MINUTE*60;pe.ONE_HOUR=pe.SIXTY_MINUTES;pe.THREE_HOURS=pe.ONE_HOUR*3;pe.SIX_HOURS=pe.ONE_HOUR*6;pe.TWELVE_HOURS=pe.ONE_HOUR*12;pe.TWENTY_FOUR_HOURS=pe.ONE_HOUR*24;pe.ONE_DAY=pe.TWENTY_FOUR_HOURS;pe.THREE_DAYS=pe.ONE_DAY*3;pe.FIVE_DAYS=pe.ONE_DAY*5;pe.SEVEN_DAYS=pe.ONE_DAY*7;pe.THIRTY_DAYS=pe.ONE_DAY*30;pe.ONE_WEEK=pe.SEVEN_DAYS;pe.TWO_WEEKS=pe.ONE_WEEK*2;pe.THREE_WEEKS=pe.ONE_WEEK*3;pe.FOUR_WEEKS=pe.ONE_WEEK*4;pe.ONE_YEAR=pe.ONE_DAY*365});var pm=D(Fn=>{"use strict";l();var DR=Fn&&Fn.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),eS=Fn&&Fn.__exportStar||function(r,e){for(var t in r)t!=="default"&&!e.hasOwnProperty(t)&&DR(e,r,t)};Object.defineProperty(Fn,"__esModule",{value:!0});eS(XC(),Fn);eS(ZC(),Fn)});var rS=D(za=>{"use strict";l();Object.defineProperty(za,"__esModule",{value:!0});za.fromMiliseconds=za.toMiliseconds=void 0;var tS=pm();function OR(r){return r*tS.ONE_THOUSAND}za.toMiliseconds=OR;function BR(r){return Math.floor(r/tS.ONE_THOUSAND)}za.fromMiliseconds=BR});var nS=D(Un=>{"use strict";l();var MR=Un&&Un.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),iS=Un&&Un.__exportStar||function(r,e){for(var t in r)t!=="default"&&!e.hasOwnProperty(t)&&MR(e,r,t)};Object.defineProperty(Un,"__esModule",{value:!0});iS(JC(),Un);iS(rS(),Un)});var sS=D(Oc=>{"use strict";l();Object.defineProperty(Oc,"__esModule",{value:!0});Oc.Watch=void 0;var Dh=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 t=this.get(e);if(typeof t.elapsed<"u")throw new Error(`Watch already stopped for label: ${e}`);let i=Date.now()-t.started;this.timestamps.set(e,{started:t.started,elapsed:i})}get(e){let t=this.timestamps.get(e);if(typeof t>"u")throw new Error(`No timestamp found for label: ${e}`);return t}elapsed(e){let t=this.get(e);return t.elapsed||Date.now()-t.started}};Oc.Watch=Dh;Oc.default=Dh});var oS=D(Oh=>{"use strict";l();Object.defineProperty(Oh,"__esModule",{value:!0});Oh.IWatch=void 0;var gm=class{};Oh.IWatch=gm});var aS=D(to=>{"use strict";l();var PR=to&&to.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),LR=to&&to.__exportStar||function(r,e){for(var t in r)t!=="default"&&!e.hasOwnProperty(t)&&PR(e,r,t)};Object.defineProperty(to,"__esModule",{value:!0});LR(oS(),to)});var ro=D(Ti=>{"use strict";l();var RR=Ti&&Ti.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),Bh=Ti&&Ti.__exportStar||function(r,e){for(var t in r)t!=="default"&&!e.hasOwnProperty(t)&&RR(e,r,t)};Object.defineProperty(Ti,"__esModule",{value:!0});Bh(nS(),Ti);Bh(sS(),Ti);Bh(aS(),Ti);Bh(pm(),Ti)});var ym,uS=ye(()=>{l();ym=class{}});var mm={};st(mm,{IEvents:()=>ym});var vm=ye(()=>{l();uS()});var cS=D(Mh=>{"use strict";l();Object.defineProperty(Mh,"__esModule",{value:!0});Mh.IHeartBeat=void 0;var FR=(vm(),ti(mm)),wm=class extends FR.IEvents{constructor(e){super()}};Mh.IHeartBeat=wm});var Em=D(io=>{"use strict";l();var UR=io&&io.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),qR=io&&io.__exportStar||function(r,e){for(var t in r)t!=="default"&&!e.hasOwnProperty(t)&&UR(e,r,t)};Object.defineProperty(io,"__esModule",{value:!0});qR(cS(),io)});var lS=D($a=>{"use strict";l();Object.defineProperty($a,"__esModule",{value:!0});$a.HEARTBEAT_EVENTS=$a.HEARTBEAT_INTERVAL=void 0;var VR=ro();$a.HEARTBEAT_INTERVAL=VR.FIVE_SECONDS;$a.HEARTBEAT_EVENTS={pulse:"heartbeat_pulse"}});var Am=D(no=>{"use strict";l();var HR=no&&no.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),QR=no&&no.__exportStar||function(r,e){for(var t in r)t!=="default"&&!e.hasOwnProperty(t)&&HR(e,r,t)};Object.defineProperty(no,"__esModule",{value:!0});QR(lS(),no)});var fS=D(ka=>{"use strict";l();var _m=ka&&ka.__awaiter||function(r,e,t,i){function n(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(p){try{h(i.next(p))}catch(v){o(v)}}function u(p){try{h(i.throw(p))}catch(v){o(v)}}function h(p){p.done?s(p.value):n(p.value).then(a,u)}h((i=i.apply(r,e||[])).next())})};Object.defineProperty(ka,"__esModule",{value:!0});ka.HeartBeat=void 0;var jR=Th(),GR=ro(),KR=Em(),Im=Am(),Bc=class extends KR.IHeartBeat{constructor(e){super(e),this.events=new jR.EventEmitter,this.interval=Im.HEARTBEAT_INTERVAL,this.interval=e?.interval||Im.HEARTBEAT_INTERVAL}static init(e){return _m(this,void 0,void 0,function*(){let t=new Bc(e);return yield t.init(),t})}init(){return _m(this,void 0,void 0,function*(){yield this.initialize()})}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}initialize(){return _m(this,void 0,void 0,function*(){setInterval(()=>this.pulse(),GR.toMiliseconds(this.interval))})}pulse(){this.events.emit(Im.HEARTBEAT_EVENTS.pulse)}};ka.HeartBeat=Bc});var hS=D(ki=>{"use strict";l();var zR=ki&&ki.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),bm=ki&&ki.__exportStar||function(r,e){for(var t in r)t!=="default"&&!e.hasOwnProperty(t)&&zR(e,r,t)};Object.defineProperty(ki,"__esModule",{value:!0});bm(fS(),ki);bm(Em(),ki);bm(Am(),ki)});var Cm=D(Wa=>{"use strict";l();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 mS=D(mr=>{"use strict";l();Object.defineProperty(mr,"__esModule",{value:!0});mr.generateChildLogger=mr.formatChildLoggerContext=mr.getLoggerContext=mr.setBrowserLoggerContext=mr.getBrowserLoggerContext=mr.getDefaultLoggerOptions=void 0;var Ya=Cm();function $R(r){return Object.assign(Object.assign({},r),{level:r?.level||Ya.PINO_LOGGER_DEFAULTS.level})}mr.getDefaultLoggerOptions=$R;function dS(r,e=Ya.PINO_CUSTOM_CONTEXT_KEY){return r[e]||""}mr.getBrowserLoggerContext=dS;function pS(r,e,t=Ya.PINO_CUSTOM_CONTEXT_KEY){return r[t]=e,r}mr.setBrowserLoggerContext=pS;function gS(r,e=Ya.PINO_CUSTOM_CONTEXT_KEY){let t="";return typeof r.bindings>"u"?t=dS(r,e):t=r.bindings().context||"",t}mr.getLoggerContext=gS;function yS(r,e,t=Ya.PINO_CUSTOM_CONTEXT_KEY){let i=gS(r,t);return i.trim()?`${i}/${e}`:e}mr.formatChildLoggerContext=yS;function kR(r,e,t=Ya.PINO_CUSTOM_CONTEXT_KEY){let i=yS(r,e,t),n=r.child({context:i});return pS(n,i,t)}mr.generateChildLogger=kR});var Sm=D(Ph=>{"use strict";l();Object.defineProperty(Ph,"__esModule",{value:!0});var vS=Eh();vS.__exportStar(Cm(),Ph);vS.__exportStar(mS(),Ph)});var jm=D(Kt=>{"use strict";l();Object.defineProperty(Kt,"__esModule",{value:!0});var Ja=(vm(),ti(mm)),xm=class extends Ja.IEvents{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},Tm=class{constructor(e,t,i){this.core=e,this.logger=t}},Nm=class extends Ja.IEvents{constructor(e,t){super(),this.core=e,this.logger=t,this.records=new Map}},Dm=class{constructor(e,t){this.logger=e,this.core=t}},Om=class extends Ja.IEvents{constructor(e,t){super(),this.relayer=e,this.logger=t}},Bm=class extends Ja.IEvents{constructor(e){super()}},Mm=class{constructor(e,t,i,n){this.core=e,this.logger=t,this.name=i}},Pm=class{constructor(){this.map=new Map}},Lm=class extends Ja.IEvents{constructor(e,t){super(),this.relayer=e,this.logger=t}},Rm=class{constructor(e,t){this.core=e,this.logger=t}},Fm=class extends Ja.IEvents{constructor(e,t){super(),this.core=e,this.logger=t}},Um=class{constructor(e,t){this.logger=e,this.core=t}};function Gt(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}var ES=Gt;Gt.EventEmitter=Gt,Gt.prototype._events=void 0,Gt.prototype._maxListeners=void 0,Gt.defaultMaxListeners=10,Gt.prototype.setMaxListeners=function(r){if(!WR(r)||r<0||isNaN(r))throw TypeError("n must be a positive number");return this._maxListeners=r,this},Gt.prototype.emit=function(r){var e,t,i,n,s,o;if(this._events||(this._events={}),r==="error"&&(!this._events.error||Mc(this._events.error)&&!this._events.error.length)){if(e=arguments[1],e instanceof Error)throw e;var a=new Error('Uncaught, unspecified "error" event. ('+e+")");throw a.context=e,a}if(t=this._events[r],wS(t))return!1;if(Wi(t))switch(arguments.length){case 1:t.call(this);break;case 2:t.call(this,arguments[1]);break;case 3:t.call(this,arguments[1],arguments[2]);break;default:n=Array.prototype.slice.call(arguments,1),t.apply(this,n)}else if(Mc(t))for(n=Array.prototype.slice.call(arguments,1),o=t.slice(),i=o.length,s=0;s0&&this._events[r].length>t&&(this._events[r].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[r].length),typeof console.trace=="function"&&console.trace())),this},Gt.prototype.on=Gt.prototype.addListener,Gt.prototype.once=function(r,e){if(!Wi(e))throw TypeError("listener must be a function");var t=!1;function i(){this.removeListener(r,i),t||(t=!0,e.apply(this,arguments))}return i.listener=e,this.on(r,i),this},Gt.prototype.removeListener=function(r,e){var t,i,n,s;if(!Wi(e))throw TypeError("listener must be a function");if(!this._events||!this._events[r])return this;if(t=this._events[r],n=t.length,i=-1,t===e||Wi(t.listener)&&t.listener===e)delete this._events[r],this._events.removeListener&&this.emit("removeListener",r,e);else if(Mc(t)){for(s=n;s-- >0;)if(t[s]===e||t[s].listener&&t[s].listener===e){i=s;break}if(i<0)return this;t.length===1?(t.length=0,delete this._events[r]):t.splice(i,1),this._events.removeListener&&this.emit("removeListener",r,e)}return this},Gt.prototype.removeAllListeners=function(r){var e,t;if(!this._events)return this;if(!this._events.removeListener)return arguments.length===0?this._events={}:this._events[r]&&delete this._events[r],this;if(arguments.length===0){for(e in this._events)e!=="removeListener"&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(t=this._events[r],Wi(t))this.removeListener(r,t);else if(t)for(;t.length;)this.removeListener(r,t[t.length-1]);return delete this._events[r],this},Gt.prototype.listeners=function(r){var e;return!this._events||!this._events[r]?e=[]:Wi(this._events[r])?e=[this._events[r]]:e=this._events[r].slice(),e},Gt.prototype.listenerCount=function(r){if(this._events){var e=this._events[r];if(Wi(e))return 1;if(e)return e.length}return 0},Gt.listenerCount=function(r,e){return r.listenerCount(e)};function Wi(r){return typeof r=="function"}function WR(r){return typeof r=="number"}function Mc(r){return typeof r=="object"&&r!==null}function wS(r){return r===void 0}var qm=class extends ES{constructor(){super()}},Vm=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},Hm=class extends ES.EventEmitter{constructor(){super()}},Qm=class{constructor(e){this.client=e}};Kt.ICore=xm,Kt.ICrypto=Tm,Kt.IEngine=Qm,Kt.IEngineEvents=Hm,Kt.IExpirer=Fm,Kt.IJsonRpcHistory=Nm,Kt.IKeyChain=Rm,Kt.IMessageTracker=Dm,Kt.IPairing=Um,Kt.IPublisher=Om,Kt.IRelayer=Bm,Kt.ISignClient=Vm,Kt.ISignClientEvents=qm,Kt.IStore=Mm,Kt.ISubscriber=Lm,Kt.ISubscriberTopicMap=Pm});var AS={};st(AS,{safeJsonParse:()=>Pc,safeJsonStringify:()=>Lc});function Pc(r){if(typeof r!="string")throw new Error(`Cannot safe json parse value of type ${typeof r}`);try{return JSON.parse(r)}catch{return r}}function Lc(r){return typeof r=="string"?r:JSON.stringify(r)}var Lh=ye(()=>{l()});var IS=D(Rh=>{"use strict";l();Object.defineProperty(Rh,"__esModule",{value:!0});Rh.BrowserRandomSource=void 0;var _S=65536,Gm=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 t=new Uint8Array(e);for(let i=0;i{"use strict";l();Object.defineProperty(Km,"__esModule",{value:!0});function YR(r){for(var e=0;e{l()});var bS=D(Fh=>{"use strict";l();Object.defineProperty(Fh,"__esModule",{value:!0});Fh.NodeRandomSource=void 0;var JR=vr(),$m=class{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof jl<"u"){let e=zm();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 t=this._crypto.randomBytes(e);if(t.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");let i=new Uint8Array(e);for(let n=0;n{"use strict";l();Object.defineProperty(Uh,"__esModule",{value:!0});Uh.SystemRandomSource=void 0;var XR=IS(),ZR=bS(),km=class{constructor(){if(this.isAvailable=!1,this.name="",this._source=new XR.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new ZR.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)}};Uh.SystemRandomSource=km});var SS=D(br=>{"use strict";l();Object.defineProperty(br,"__esModule",{value:!0});function eF(r,e){var t=r>>>16&65535,i=r&65535,n=e>>>16&65535,s=e&65535;return i*s+(t*s+i*n<<16>>>0)|0}br.mul=Math.imul||eF;function tF(r,e){return r+e|0}br.add=tF;function rF(r,e){return r-e|0}br.sub=rF;function iF(r,e){return r<>>32-e}br.rotl=iF;function nF(r,e){return r<<32-e|r>>>e}br.rotr=nF;function sF(r){return typeof r=="number"&&isFinite(r)&&Math.floor(r)===r}br.isInteger=Number.isInteger||sF;br.MAX_SAFE_INTEGER=9007199254740991;br.isSafeInteger=function(r){return br.isInteger(r)&&r>=-br.MAX_SAFE_INTEGER&&r<=br.MAX_SAFE_INTEGER}});var so=D(Ne=>{"use strict";l();Object.defineProperty(Ne,"__esModule",{value:!0});var xS=SS();function oF(r,e){return e===void 0&&(e=0),(r[e+0]<<8|r[e+1])<<16>>16}Ne.readInt16BE=oF;function aF(r,e){return e===void 0&&(e=0),(r[e+0]<<8|r[e+1])>>>0}Ne.readUint16BE=aF;function uF(r,e){return e===void 0&&(e=0),(r[e+1]<<8|r[e])<<16>>16}Ne.readInt16LE=uF;function cF(r,e){return e===void 0&&(e=0),(r[e+1]<<8|r[e])>>>0}Ne.readUint16LE=cF;function TS(r,e,t){return e===void 0&&(e=new Uint8Array(2)),t===void 0&&(t=0),e[t+0]=r>>>8,e[t+1]=r>>>0,e}Ne.writeUint16BE=TS;Ne.writeInt16BE=TS;function NS(r,e,t){return e===void 0&&(e=new Uint8Array(2)),t===void 0&&(t=0),e[t+0]=r>>>0,e[t+1]=r>>>8,e}Ne.writeUint16LE=NS;Ne.writeInt16LE=NS;function Wm(r,e){return e===void 0&&(e=0),r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3]}Ne.readInt32BE=Wm;function Ym(r,e){return e===void 0&&(e=0),(r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3])>>>0}Ne.readUint32BE=Ym;function Jm(r,e){return e===void 0&&(e=0),r[e+3]<<24|r[e+2]<<16|r[e+1]<<8|r[e]}Ne.readInt32LE=Jm;function Xm(r,e){return e===void 0&&(e=0),(r[e+3]<<24|r[e+2]<<16|r[e+1]<<8|r[e])>>>0}Ne.readUint32LE=Xm;function qh(r,e,t){return e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0),e[t+0]=r>>>24,e[t+1]=r>>>16,e[t+2]=r>>>8,e[t+3]=r>>>0,e}Ne.writeUint32BE=qh;Ne.writeInt32BE=qh;function Vh(r,e,t){return e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0),e[t+0]=r>>>0,e[t+1]=r>>>8,e[t+2]=r>>>16,e[t+3]=r>>>24,e}Ne.writeUint32LE=Vh;Ne.writeInt32LE=Vh;function lF(r,e){e===void 0&&(e=0);var t=Wm(r,e),i=Wm(r,e+4);return t*4294967296+i-(i>>31)*4294967296}Ne.readInt64BE=lF;function fF(r,e){e===void 0&&(e=0);var t=Ym(r,e),i=Ym(r,e+4);return t*4294967296+i}Ne.readUint64BE=fF;function hF(r,e){e===void 0&&(e=0);var t=Jm(r,e),i=Jm(r,e+4);return i*4294967296+t-(t>>31)*4294967296}Ne.readInt64LE=hF;function dF(r,e){e===void 0&&(e=0);var t=Xm(r,e),i=Xm(r,e+4);return i*4294967296+t}Ne.readUint64LE=dF;function DS(r,e,t){return e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0),qh(r/4294967296>>>0,e,t),qh(r>>>0,e,t+4),e}Ne.writeUint64BE=DS;Ne.writeInt64BE=DS;function OS(r,e,t){return e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0),Vh(r>>>0,e,t),Vh(r/4294967296>>>0,e,t+4),e}Ne.writeUint64LE=OS;Ne.writeInt64LE=OS;function pF(r,e,t){if(t===void 0&&(t=0),r%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(r/8>e.length-t)throw new Error("readUintBE: array is too short for the given bitLength");for(var i=0,n=1,s=r/8+t-1;s>=t;s--)i+=e[s]*n,n*=256;return i}Ne.readUintBE=pF;function gF(r,e,t){if(t===void 0&&(t=0),r%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(r/8>e.length-t)throw new Error("readUintLE: array is too short for the given bitLength");for(var i=0,n=1,s=t;s=i;s--)t[s]=e/n&255,n*=256;return t}Ne.writeUintBE=yF;function mF(r,e,t,i){if(t===void 0&&(t=new Uint8Array(r/8)),i===void 0&&(i=0),r%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!xS.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var n=1,s=i;s{"use strict";l();Object.defineProperty(sr,"__esModule",{value:!0});sr.randomStringForEntropy=sr.randomString=sr.randomUint32=sr.randomBytes=sr.defaultRandomSource=void 0;var SF=CS(),xF=so(),BS=vr();sr.defaultRandomSource=new SF.SystemRandomSource;function Zm(r,e=sr.defaultRandomSource){return e.randomBytes(r)}sr.randomBytes=Zm;function TF(r=sr.defaultRandomSource){let e=Zm(4,r),t=(0,xF.readUint32LE)(e);return(0,BS.wipe)(e),t}sr.randomUint32=TF;var MS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function PS(r,e=MS,t=sr.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 i="",n=e.length,s=256-256%n;for(;r>0;){let o=Zm(Math.ceil(r*256/s),t);for(let a=0;a0;a++){let u=o[a];u{"use strict";l();Object.defineProperty(Yi,"__esModule",{value:!0});var Za=so(),Xa=vr();Yi.DIGEST_LENGTH=64;Yi.BLOCK_SIZE=128;var FS=function(){function r(){this.digestLength=Yi.DIGEST_LENGTH,this.blockSize=Yi.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 r.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},r.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},r.prototype.clean=function(){Xa.wipe(this._buffer),Xa.wipe(this._tempHi),Xa.wipe(this._tempLo),this.reset()},r.prototype.update=function(e,t){if(t===void 0&&(t=e.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var i=0;if(this._bytesHashed+=t,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=e[i++],t--;this._bufferLength===this.blockSize&&(ev(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(t>=this.blockSize&&(i=ev(this._tempHi,this._tempLo,this._stateHi,this._stateLo,e,i,t),t%=this.blockSize);t>0;)this._buffer[this._bufferLength++]=e[i++],t--;return this},r.prototype.finish=function(e){if(!this._finished){var t=this._bytesHashed,i=this._bufferLength,n=t/536870912|0,s=t<<3,o=t%128<112?128:256;this._buffer[i]=128;for(var a=i+1;a0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},r.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},r.prototype.cleanSavedState=function(e){Xa.wipe(e.stateHi),Xa.wipe(e.stateLo),e.buffer&&Xa.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},r}();Yi.SHA512=FS;var RS=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 ev(r,e,t,i,n,s,o){for(var a=t[0],u=t[1],h=t[2],p=t[3],v=t[4],B=t[5],R=t[6],x=t[7],V=i[0],H=i[1],K=i[2],ie=i[3],k=i[4],J=i[5],W=i[6],G=i[7],P,F,$,ce,Y,X,A,c;o>=128;){for(var d=0;d<16;d++){var g=8*d+s;r[d]=Za.readUint32BE(n,g),e[d]=Za.readUint32BE(n,g+4)}for(var d=0;d<80;d++){var m=a,w=u,S=h,N=p,_=v,f=B,C=R,Z=x,te=V,ee=H,ae=K,E=ie,b=k,T=J,L=W,O=G;if(P=x,F=G,Y=F&65535,X=F>>>16,A=P&65535,c=P>>>16,P=(v>>>14|k<<32-14)^(v>>>18|k<<32-18)^(k>>>41-32|v<<32-(41-32)),F=(k>>>14|v<<32-14)^(k>>>18|v<<32-18)^(v>>>41-32|k<<32-(41-32)),Y+=F&65535,X+=F>>>16,A+=P&65535,c+=P>>>16,P=v&B^~v&R,F=k&J^~k&W,Y+=F&65535,X+=F>>>16,A+=P&65535,c+=P>>>16,P=RS[d*2],F=RS[d*2+1],Y+=F&65535,X+=F>>>16,A+=P&65535,c+=P>>>16,P=r[d%16],F=e[d%16],Y+=F&65535,X+=F>>>16,A+=P&65535,c+=P>>>16,X+=Y>>>16,A+=X>>>16,c+=A>>>16,$=A&65535|c<<16,ce=Y&65535|X<<16,P=$,F=ce,Y=F&65535,X=F>>>16,A=P&65535,c=P>>>16,P=(a>>>28|V<<32-28)^(V>>>34-32|a<<32-(34-32))^(V>>>39-32|a<<32-(39-32)),F=(V>>>28|a<<32-28)^(a>>>34-32|V<<32-(34-32))^(a>>>39-32|V<<32-(39-32)),Y+=F&65535,X+=F>>>16,A+=P&65535,c+=P>>>16,P=a&u^a&h^u&h,F=V&H^V&K^H&K,Y+=F&65535,X+=F>>>16,A+=P&65535,c+=P>>>16,X+=Y>>>16,A+=X>>>16,c+=A>>>16,Z=A&65535|c<<16,O=Y&65535|X<<16,P=N,F=E,Y=F&65535,X=F>>>16,A=P&65535,c=P>>>16,P=$,F=ce,Y+=F&65535,X+=F>>>16,A+=P&65535,c+=P>>>16,X+=Y>>>16,A+=X>>>16,c+=A>>>16,N=A&65535|c<<16,E=Y&65535|X<<16,u=m,h=w,p=S,v=N,B=_,R=f,x=C,a=Z,H=te,K=ee,ie=ae,k=E,J=b,W=T,G=L,V=O,d%16===15)for(var g=0;g<16;g++)P=r[g],F=e[g],Y=F&65535,X=F>>>16,A=P&65535,c=P>>>16,P=r[(g+9)%16],F=e[(g+9)%16],Y+=F&65535,X+=F>>>16,A+=P&65535,c+=P>>>16,$=r[(g+1)%16],ce=e[(g+1)%16],P=($>>>1|ce<<32-1)^($>>>8|ce<<32-8)^$>>>7,F=(ce>>>1|$<<32-1)^(ce>>>8|$<<32-8)^(ce>>>7|$<<32-7),Y+=F&65535,X+=F>>>16,A+=P&65535,c+=P>>>16,$=r[(g+14)%16],ce=e[(g+14)%16],P=($>>>19|ce<<32-19)^(ce>>>61-32|$<<32-(61-32))^$>>>6,F=(ce>>>19|$<<32-19)^($>>>61-32|ce<<32-(61-32))^(ce>>>6|$<<32-6),Y+=F&65535,X+=F>>>16,A+=P&65535,c+=P>>>16,X+=Y>>>16,A+=X>>>16,c+=A>>>16,r[g]=A&65535|c<<16,e[g]=Y&65535|X<<16}P=a,F=V,Y=F&65535,X=F>>>16,A=P&65535,c=P>>>16,P=t[0],F=i[0],Y+=F&65535,X+=F>>>16,A+=P&65535,c+=P>>>16,X+=Y>>>16,A+=X>>>16,c+=A>>>16,t[0]=a=A&65535|c<<16,i[0]=V=Y&65535|X<<16,P=u,F=H,Y=F&65535,X=F>>>16,A=P&65535,c=P>>>16,P=t[1],F=i[1],Y+=F&65535,X+=F>>>16,A+=P&65535,c+=P>>>16,X+=Y>>>16,A+=X>>>16,c+=A>>>16,t[1]=u=A&65535|c<<16,i[1]=H=Y&65535|X<<16,P=h,F=K,Y=F&65535,X=F>>>16,A=P&65535,c=P>>>16,P=t[2],F=i[2],Y+=F&65535,X+=F>>>16,A+=P&65535,c+=P>>>16,X+=Y>>>16,A+=X>>>16,c+=A>>>16,t[2]=h=A&65535|c<<16,i[2]=K=Y&65535|X<<16,P=p,F=ie,Y=F&65535,X=F>>>16,A=P&65535,c=P>>>16,P=t[3],F=i[3],Y+=F&65535,X+=F>>>16,A+=P&65535,c+=P>>>16,X+=Y>>>16,A+=X>>>16,c+=A>>>16,t[3]=p=A&65535|c<<16,i[3]=ie=Y&65535|X<<16,P=v,F=k,Y=F&65535,X=F>>>16,A=P&65535,c=P>>>16,P=t[4],F=i[4],Y+=F&65535,X+=F>>>16,A+=P&65535,c+=P>>>16,X+=Y>>>16,A+=X>>>16,c+=A>>>16,t[4]=v=A&65535|c<<16,i[4]=k=Y&65535|X<<16,P=B,F=J,Y=F&65535,X=F>>>16,A=P&65535,c=P>>>16,P=t[5],F=i[5],Y+=F&65535,X+=F>>>16,A+=P&65535,c+=P>>>16,X+=Y>>>16,A+=X>>>16,c+=A>>>16,t[5]=B=A&65535|c<<16,i[5]=J=Y&65535|X<<16,P=R,F=W,Y=F&65535,X=F>>>16,A=P&65535,c=P>>>16,P=t[6],F=i[6],Y+=F&65535,X+=F>>>16,A+=P&65535,c+=P>>>16,X+=Y>>>16,A+=X>>>16,c+=A>>>16,t[6]=R=A&65535|c<<16,i[6]=W=Y&65535|X<<16,P=x,F=G,Y=F&65535,X=F>>>16,A=P&65535,c=P>>>16,P=t[7],F=i[7],Y+=F&65535,X+=F>>>16,A+=P&65535,c+=P>>>16,X+=Y>>>16,A+=X>>>16,c+=A>>>16,t[7]=x=A&65535|c<<16,i[7]=G=Y&65535|X<<16,s+=128,o-=128}return s}function DF(r){var e=new FS;e.update(r);var t=e.digest();return e.clean(),t}Yi.hash=DF});var XS=D(qe=>{"use strict";l();Object.defineProperty(qe,"__esModule",{value:!0});qe.convertSecretKeyToX25519=qe.convertPublicKeyToX25519=qe.verify=qe.sign=qe.extractPublicKeyFromSecretKey=qe.generateKeyPair=qe.generateKeyPairFromSeed=qe.SEED_LENGTH=qe.SECRET_KEY_LENGTH=qe.PUBLIC_KEY_LENGTH=qe.SIGNATURE_LENGTH=void 0;var OF=LS(),Rc=US(),jS=vr();qe.SIGNATURE_LENGTH=64;qe.PUBLIC_KEY_LENGTH=32;qe.SECRET_KEY_LENGTH=64;qe.SEED_LENGTH=32;function ve(r){let e=new Float64Array(16);if(r)for(let t=0;t>16&1),t[o-1]&=65535;t[15]=i[15]-32767-(t[14]>>16&1);let s=t[15]>>16&1;t[14]&=65535,GS(i,t,1-s)}for(let n=0;n<16;n++)r[2*n]=i[n]&255,r[2*n+1]=i[n]>>8}function KS(r,e){let t=0;for(let i=0;i<32;i++)t|=r[i]^e[i];return(1&t-1>>>8)-1}function HS(r,e){let t=new Uint8Array(32),i=new Uint8Array(32);return Fc(t,r),Fc(i,e),KS(t,i)}function zS(r){let e=new Uint8Array(32);return Fc(e,r),e[0]&1}function RF(r,e){for(let t=0;t<16;t++)r[t]=e[2*t]+(e[2*t+1]<<8);r[15]&=32767}function oo(r,e,t){for(let i=0;i<16;i++)r[i]=e[i]+t[i]}function uo(r,e,t){for(let i=0;i<16;i++)r[i]=e[i]-t[i]}function Qe(r,e,t){let i,n,s=0,o=0,a=0,u=0,h=0,p=0,v=0,B=0,R=0,x=0,V=0,H=0,K=0,ie=0,k=0,J=0,W=0,G=0,P=0,F=0,$=0,ce=0,Y=0,X=0,A=0,c=0,d=0,g=0,m=0,w=0,S=0,N=t[0],_=t[1],f=t[2],C=t[3],Z=t[4],te=t[5],ee=t[6],ae=t[7],E=t[8],b=t[9],T=t[10],L=t[11],O=t[12],U=t[13],q=t[14],M=t[15];i=e[0],s+=i*N,o+=i*_,a+=i*f,u+=i*C,h+=i*Z,p+=i*te,v+=i*ee,B+=i*ae,R+=i*E,x+=i*b,V+=i*T,H+=i*L,K+=i*O,ie+=i*U,k+=i*q,J+=i*M,i=e[1],o+=i*N,a+=i*_,u+=i*f,h+=i*C,p+=i*Z,v+=i*te,B+=i*ee,R+=i*ae,x+=i*E,V+=i*b,H+=i*T,K+=i*L,ie+=i*O,k+=i*U,J+=i*q,W+=i*M,i=e[2],a+=i*N,u+=i*_,h+=i*f,p+=i*C,v+=i*Z,B+=i*te,R+=i*ee,x+=i*ae,V+=i*E,H+=i*b,K+=i*T,ie+=i*L,k+=i*O,J+=i*U,W+=i*q,G+=i*M,i=e[3],u+=i*N,h+=i*_,p+=i*f,v+=i*C,B+=i*Z,R+=i*te,x+=i*ee,V+=i*ae,H+=i*E,K+=i*b,ie+=i*T,k+=i*L,J+=i*O,W+=i*U,G+=i*q,P+=i*M,i=e[4],h+=i*N,p+=i*_,v+=i*f,B+=i*C,R+=i*Z,x+=i*te,V+=i*ee,H+=i*ae,K+=i*E,ie+=i*b,k+=i*T,J+=i*L,W+=i*O,G+=i*U,P+=i*q,F+=i*M,i=e[5],p+=i*N,v+=i*_,B+=i*f,R+=i*C,x+=i*Z,V+=i*te,H+=i*ee,K+=i*ae,ie+=i*E,k+=i*b,J+=i*T,W+=i*L,G+=i*O,P+=i*U,F+=i*q,$+=i*M,i=e[6],v+=i*N,B+=i*_,R+=i*f,x+=i*C,V+=i*Z,H+=i*te,K+=i*ee,ie+=i*ae,k+=i*E,J+=i*b,W+=i*T,G+=i*L,P+=i*O,F+=i*U,$+=i*q,ce+=i*M,i=e[7],B+=i*N,R+=i*_,x+=i*f,V+=i*C,H+=i*Z,K+=i*te,ie+=i*ee,k+=i*ae,J+=i*E,W+=i*b,G+=i*T,P+=i*L,F+=i*O,$+=i*U,ce+=i*q,Y+=i*M,i=e[8],R+=i*N,x+=i*_,V+=i*f,H+=i*C,K+=i*Z,ie+=i*te,k+=i*ee,J+=i*ae,W+=i*E,G+=i*b,P+=i*T,F+=i*L,$+=i*O,ce+=i*U,Y+=i*q,X+=i*M,i=e[9],x+=i*N,V+=i*_,H+=i*f,K+=i*C,ie+=i*Z,k+=i*te,J+=i*ee,W+=i*ae,G+=i*E,P+=i*b,F+=i*T,$+=i*L,ce+=i*O,Y+=i*U,X+=i*q,A+=i*M,i=e[10],V+=i*N,H+=i*_,K+=i*f,ie+=i*C,k+=i*Z,J+=i*te,W+=i*ee,G+=i*ae,P+=i*E,F+=i*b,$+=i*T,ce+=i*L,Y+=i*O,X+=i*U,A+=i*q,c+=i*M,i=e[11],H+=i*N,K+=i*_,ie+=i*f,k+=i*C,J+=i*Z,W+=i*te,G+=i*ee,P+=i*ae,F+=i*E,$+=i*b,ce+=i*T,Y+=i*L,X+=i*O,A+=i*U,c+=i*q,d+=i*M,i=e[12],K+=i*N,ie+=i*_,k+=i*f,J+=i*C,W+=i*Z,G+=i*te,P+=i*ee,F+=i*ae,$+=i*E,ce+=i*b,Y+=i*T,X+=i*L,A+=i*O,c+=i*U,d+=i*q,g+=i*M,i=e[13],ie+=i*N,k+=i*_,J+=i*f,W+=i*C,G+=i*Z,P+=i*te,F+=i*ee,$+=i*ae,ce+=i*E,Y+=i*b,X+=i*T,A+=i*L,c+=i*O,d+=i*U,g+=i*q,m+=i*M,i=e[14],k+=i*N,J+=i*_,W+=i*f,G+=i*C,P+=i*Z,F+=i*te,$+=i*ee,ce+=i*ae,Y+=i*E,X+=i*b,A+=i*T,c+=i*L,d+=i*O,g+=i*U,m+=i*q,w+=i*M,i=e[15],J+=i*N,W+=i*_,G+=i*f,P+=i*C,F+=i*Z,$+=i*te,ce+=i*ee,Y+=i*ae,X+=i*E,A+=i*b,c+=i*T,d+=i*L,g+=i*O,m+=i*U,w+=i*q,S+=i*M,s+=38*W,o+=38*G,a+=38*P,u+=38*F,h+=38*$,p+=38*ce,v+=38*Y,B+=38*X,R+=38*A,x+=38*c,V+=38*d,H+=38*g,K+=38*m,ie+=38*w,k+=38*S,n=1,i=s+n+65535,n=Math.floor(i/65536),s=i-n*65536,i=o+n+65535,n=Math.floor(i/65536),o=i-n*65536,i=a+n+65535,n=Math.floor(i/65536),a=i-n*65536,i=u+n+65535,n=Math.floor(i/65536),u=i-n*65536,i=h+n+65535,n=Math.floor(i/65536),h=i-n*65536,i=p+n+65535,n=Math.floor(i/65536),p=i-n*65536,i=v+n+65535,n=Math.floor(i/65536),v=i-n*65536,i=B+n+65535,n=Math.floor(i/65536),B=i-n*65536,i=R+n+65535,n=Math.floor(i/65536),R=i-n*65536,i=x+n+65535,n=Math.floor(i/65536),x=i-n*65536,i=V+n+65535,n=Math.floor(i/65536),V=i-n*65536,i=H+n+65535,n=Math.floor(i/65536),H=i-n*65536,i=K+n+65535,n=Math.floor(i/65536),K=i-n*65536,i=ie+n+65535,n=Math.floor(i/65536),ie=i-n*65536,i=k+n+65535,n=Math.floor(i/65536),k=i-n*65536,i=J+n+65535,n=Math.floor(i/65536),J=i-n*65536,s+=n-1+37*(n-1),n=1,i=s+n+65535,n=Math.floor(i/65536),s=i-n*65536,i=o+n+65535,n=Math.floor(i/65536),o=i-n*65536,i=a+n+65535,n=Math.floor(i/65536),a=i-n*65536,i=u+n+65535,n=Math.floor(i/65536),u=i-n*65536,i=h+n+65535,n=Math.floor(i/65536),h=i-n*65536,i=p+n+65535,n=Math.floor(i/65536),p=i-n*65536,i=v+n+65535,n=Math.floor(i/65536),v=i-n*65536,i=B+n+65535,n=Math.floor(i/65536),B=i-n*65536,i=R+n+65535,n=Math.floor(i/65536),R=i-n*65536,i=x+n+65535,n=Math.floor(i/65536),x=i-n*65536,i=V+n+65535,n=Math.floor(i/65536),V=i-n*65536,i=H+n+65535,n=Math.floor(i/65536),H=i-n*65536,i=K+n+65535,n=Math.floor(i/65536),K=i-n*65536,i=ie+n+65535,n=Math.floor(i/65536),ie=i-n*65536,i=k+n+65535,n=Math.floor(i/65536),k=i-n*65536,i=J+n+65535,n=Math.floor(i/65536),J=i-n*65536,s+=n-1+37*(n-1),r[0]=s,r[1]=o,r[2]=a,r[3]=u,r[4]=h,r[5]=p,r[6]=v,r[7]=B,r[8]=R,r[9]=x,r[10]=V,r[11]=H,r[12]=K,r[13]=ie,r[14]=k,r[15]=J}function ao(r,e){Qe(r,e,e)}function $S(r,e){let t=ve(),i;for(i=0;i<16;i++)t[i]=e[i];for(i=253;i>=0;i--)ao(t,t),i!==2&&i!==4&&Qe(t,t,e);for(i=0;i<16;i++)r[i]=t[i]}function FF(r,e){let t=ve(),i;for(i=0;i<16;i++)t[i]=e[i];for(i=250;i>=0;i--)ao(t,t),i!==1&&Qe(t,t,e);for(i=0;i<16;i++)r[i]=t[i]}function nv(r,e){let t=ve(),i=ve(),n=ve(),s=ve(),o=ve(),a=ve(),u=ve(),h=ve(),p=ve();uo(t,r[1],r[0]),uo(p,e[1],e[0]),Qe(t,t,p),oo(i,r[0],r[1]),oo(p,e[0],e[1]),Qe(i,i,p),Qe(n,r[3],e[3]),Qe(n,n,PF),Qe(s,r[2],e[2]),oo(s,s,s),uo(o,i,t),uo(a,s,n),oo(u,s,n),oo(h,i,t),Qe(r[0],o,a),Qe(r[1],h,u),Qe(r[2],u,a),Qe(r[3],o,h)}function QS(r,e,t){for(let i=0;i<4;i++)GS(r[i],e[i],t)}function ov(r,e){let t=ve(),i=ve(),n=ve();$S(n,e[2]),Qe(t,e[0],n),Qe(i,e[1],n),Fc(r,i),r[31]^=zS(t)<<7}function kS(r,e,t){qn(r[0],iv),qn(r[1],eu),qn(r[2],eu),qn(r[3],iv);for(let i=255;i>=0;--i){let n=t[i/8|0]>>(i&7)&1;QS(r,e,n),nv(e,r),nv(r,r),QS(r,e,n)}}function av(r,e){let t=[ve(),ve(),ve(),ve()];qn(t[0],qS),qn(t[1],VS),qn(t[2],eu),Qe(t[3],qS,VS),kS(r,t,e)}function WS(r){if(r.length!==qe.SEED_LENGTH)throw new Error(`ed25519: seed must be ${qe.SEED_LENGTH} bytes`);let e=(0,Rc.hash)(r);e[0]&=248,e[31]&=127,e[31]|=64;let t=new Uint8Array(32),i=[ve(),ve(),ve(),ve()];av(i,e),ov(t,i);let n=new Uint8Array(64);return n.set(r),n.set(t,32),{publicKey:t,secretKey:n}}qe.generateKeyPairFromSeed=WS;function UF(r){let e=(0,OF.randomBytes)(32,r),t=WS(e);return(0,jS.wipe)(e),t}qe.generateKeyPair=UF;function qF(r){if(r.length!==qe.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${qe.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(r.subarray(32))}qe.extractPublicKeyFromSecretKey=qF;var rv=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 YS(r,e){let t,i,n,s;for(i=63;i>=32;--i){for(t=0,n=i-32,s=i-12;n>4)*rv[n],t=e[n]>>8,e[n]&=255;for(n=0;n<32;n++)e[n]-=t*rv[n];for(i=0;i<32;i++)e[i+1]+=e[i]>>8,r[i]=e[i]&255}function sv(r){let e=new Float64Array(64);for(let t=0;t<64;t++)e[t]=r[t];for(let t=0;t<64;t++)r[t]=0;YS(r,e)}function VF(r,e){let t=new Float64Array(64),i=[ve(),ve(),ve(),ve()],n=(0,Rc.hash)(r.subarray(0,32));n[0]&=248,n[31]&=127,n[31]|=64;let s=new Uint8Array(64);s.set(n.subarray(32),32);let o=new Rc.SHA512;o.update(s.subarray(32)),o.update(e);let a=o.digest();o.clean(),sv(a),av(i,a),ov(s,i),o.reset(),o.update(s.subarray(0,32)),o.update(r.subarray(32)),o.update(e);let u=o.digest();sv(u);for(let h=0;h<32;h++)t[h]=a[h];for(let h=0;h<32;h++)for(let p=0;p<32;p++)t[h+p]+=u[h]*n[p];return YS(s.subarray(32),t),s}qe.sign=VF;function JS(r,e){let t=ve(),i=ve(),n=ve(),s=ve(),o=ve(),a=ve(),u=ve();return qn(r[2],eu),RF(r[1],e),ao(n,r[1]),Qe(s,n,MF),uo(n,n,r[2]),oo(s,r[2],s),ao(o,s),ao(a,o),Qe(u,a,o),Qe(t,u,n),Qe(t,t,s),FF(t,t),Qe(t,t,n),Qe(t,t,s),Qe(t,t,s),Qe(r[0],t,s),ao(i,r[0]),Qe(i,i,s),HS(i,n)&&Qe(r[0],r[0],LF),ao(i,r[0]),Qe(i,i,s),HS(i,n)?-1:(zS(r[0])===e[31]>>7&&uo(r[0],iv,r[0]),Qe(r[3],r[0],r[1]),0)}function HF(r,e,t){let i=new Uint8Array(32),n=[ve(),ve(),ve(),ve()],s=[ve(),ve(),ve(),ve()];if(t.length!==qe.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${qe.SIGNATURE_LENGTH} bytes`);if(JS(s,r))return!1;let o=new Rc.SHA512;o.update(t.subarray(0,32)),o.update(r),o.update(e);let a=o.digest();return sv(a),kS(n,s,a),av(s,t.subarray(32)),nv(n,s),ov(i,n),!KS(t,i)}qe.verify=HF;function QF(r){let e=[ve(),ve(),ve(),ve()];if(JS(e,r))throw new Error("Ed25519: invalid public key");let t=ve(),i=ve(),n=e[1];oo(t,eu,n),uo(i,eu,n),$S(i,i),Qe(t,t,i);let s=new Uint8Array(32);return Fc(s,t),s}qe.convertPublicKeyToX25519=QF;function jF(r){let e=(0,Rc.hash)(r.subarray(0,32));e[0]&=248,e[31]&=127,e[31]|=64;let t=new Uint8Array(e.subarray(0,32));return(0,jS.wipe)(e),t}qe.convertSecretKeyToX25519=jF});var ex=D(uv=>{"use strict";l();Object.defineProperty(uv,"__esModule",{value:!0});var ZS=65536,GF=function(){function r(){this.isAvailable=!1,this.isInstantiated=!1;var e=typeof self<"u"?self.crypto||self.msCrypto:null;e&&e.getRandomValues&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}return r.prototype.randomBytes=function(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");for(var t=new Uint8Array(e),i=0;i{"use strict";l();Object.defineProperty(cv,"__esModule",{value:!0});var KF=vr(),zF=function(){function r(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof jl<"u"){var e=zm();e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}}return r.prototype.randomBytes=function(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");var t=this._crypto.randomBytes(e);if(t.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");for(var i=new Uint8Array(e),n=0;n{"use strict";l();Object.defineProperty(lv,"__esModule",{value:!0});var $F=ex(),kF=tx(),WF=function(){function r(){if(this.isAvailable=!1,this.name="",this._source=new $F.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new kF.NodeRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Node";return}}return r.prototype.randomBytes=function(e){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(e)},r}();lv.SystemRandomSource=WF});var Hh=D(Wr=>{"use strict";l();Object.defineProperty(Wr,"__esModule",{value:!0});var YF=rx(),JF=so(),ix=vr();Wr.defaultRandomSource=new YF.SystemRandomSource;function fv(r,e){return e===void 0&&(e=Wr.defaultRandomSource),e.randomBytes(r)}Wr.randomBytes=fv;function XF(r){r===void 0&&(r=Wr.defaultRandomSource);var e=fv(4,r),t=JF.readUint32LE(e);return ix.wipe(e),t}Wr.randomUint32=XF;var nx="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function sx(r,e,t){if(e===void 0&&(e=nx),t===void 0&&(t=Wr.defaultRandomSource),e.length<2)throw new Error("randomString charset is too short");if(e.length>256)throw new Error("randomString charset is too long");for(var i="",n=e.length,s=256-256%n;r>0;){for(var o=fv(Math.ceil(r*256/s),t),a=0;a0;a++){var u=o[a];u{l();Qh="EdDSA",jh="JWT",tu=".",ru="base64url",Gh="utf8",Kh="utf8",zh=":",$h="did",kh="key",iu="base58btc",Wh="z",Yh="K36",ox=32,ax=32});function nu(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(r):new Uint8Array(r)}var Xh=ye(()=>{l()});function Zh(r,e){e||(e=r.reduce((n,s)=>n+s.length,0));let t=nu(e),i=0;for(let n of r)t.set(n,i),i+=n.length;return t}var hv=ye(()=>{l();Xh()});function e4(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),i=0;i>>0,J=new Uint8Array(k);K!==ie;){for(var W=x[K],G=0,P=k-1;(W!==0||G>>0,J[P]=W%a>>>0,W=W/a>>>0;if(W!==0)throw new Error("Non-zero carry");H=G,K++}for(var F=k-H;F!==k&&J[F]===0;)F++;for(var $=u.repeat(V);F>>0,k=new Uint8Array(ie);x[V];){var J=t[x.charCodeAt(V)];if(J===255)return;for(var W=0,G=ie-1;(J!==0||W>>0,k[G]=J%256>>>0,J=J/256>>>0;if(J!==0)throw new Error("Non-zero carry");K=W,V++}if(x[V]!==" "){for(var P=ie-K;P!==ie&&k[P]===0;)P++;for(var F=new Uint8Array(H+(ie-P)),$=H;P!==ie;)F[$++]=k[P++];return F}}}function R(x){var V=B(x);if(V)return V;throw new Error(`Non-${e} character`)}return{encode:v,decodeUnsafe:B,decode:R}}var t4,r4,ux,cx=ye(()=>{l();t4=e4,r4=t4,ux=r4});var EX,lx,Ji,fx,hx,Vn=ye(()=>{l();EX=new Uint8Array(0),lx=(r,e)=>{if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},fx=r=>new TextEncoder().encode(r),hx=r=>new TextDecoder().decode(r)});var dv,pv,gv,px,yv,su,Hn,i4,n4,nt,Yr=ye(()=>{l();cx();Vn();dv=class{constructor(e,t,i){this.name=e,this.prefix=t,this.baseEncode=i}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},pv=class{constructor(e,t,i){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=i}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 px(this,e)}},gv=class{constructor(e){this.decoders=e}or(e){return px(this,e)}decode(e){let t=e[0],i=this.decoders[t];if(i)return i.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},px=(r,e)=>new gv({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}}),yv=class{constructor(e,t,i,n){this.name=e,this.prefix=t,this.baseEncode=i,this.baseDecode=n,this.encoder=new dv(e,t,i),this.decoder=new pv(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},su=({name:r,prefix:e,encode:t,decode:i})=>new yv(r,e,t,i),Hn=({prefix:r,name:e,alphabet:t})=>{let{encode:i,decode:n}=ux(t,e);return su({prefix:r,name:e,encode:i,decode:s=>Ji(n(s))})},i4=(r,e,t,i)=>{let n={};for(let p=0;p=8&&(a-=8,o[h++]=255&u>>a)}if(a>=t||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},n4=(r,e,t)=>{let i=e[e.length-1]==="=",n=(1<t;)o-=t,s+=e[n&a>>o];if(o&&(s+=e[n&a<su({prefix:e,name:r,encode(n){return n4(n,i,t)},decode(n){return i4(n,i,t,r)}})});var mv={};st(mv,{identity:()=>s4});var s4,gx=ye(()=>{l();Yr();Vn();s4=su({prefix:"\0",name:"identity",encode:r=>hx(r),decode:r=>fx(r)})});var vv={};st(vv,{base2:()=>o4});var o4,yx=ye(()=>{l();Yr();o4=nt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1})});var wv={};st(wv,{base8:()=>a4});var a4,mx=ye(()=>{l();Yr();a4=nt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3})});var Ev={};st(Ev,{base10:()=>u4});var u4,vx=ye(()=>{l();Yr();u4=Hn({prefix:"9",name:"base10",alphabet:"0123456789"})});var Av={};st(Av,{base16:()=>c4,base16upper:()=>l4});var c4,l4,wx=ye(()=>{l();Yr();c4=nt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),l4=nt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})});var _v={};st(_v,{base32:()=>ou,base32hex:()=>p4,base32hexpad:()=>y4,base32hexpadupper:()=>m4,base32hexupper:()=>g4,base32pad:()=>h4,base32padupper:()=>d4,base32upper:()=>f4,base32z:()=>v4});var ou,f4,h4,d4,p4,g4,y4,m4,v4,Iv=ye(()=>{l();Yr();ou=nt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),f4=nt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),h4=nt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),d4=nt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),p4=nt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),g4=nt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),y4=nt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),m4=nt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),v4=nt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})});var bv={};st(bv,{base36:()=>w4,base36upper:()=>E4});var w4,E4,Ex=ye(()=>{l();Yr();w4=Hn({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),E4=Hn({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})});var Cv={};st(Cv,{base58btc:()=>Ni,base58flickr:()=>A4});var Ni,A4,Sv=ye(()=>{l();Yr();Ni=Hn({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),A4=Hn({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})});var xv={};st(xv,{base64:()=>_4,base64pad:()=>I4,base64url:()=>b4,base64urlpad:()=>C4});var _4,I4,b4,C4,Ax=ye(()=>{l();Yr();_4=nt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),I4=nt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),b4=nt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),C4=nt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})});var Tv={};st(Tv,{base256emoji:()=>D4});function T4(r){return r.reduce((e,t)=>(e+=S4[t],e),"")}function N4(r){let e=[];for(let t of r){let i=x4[t.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(i)}return new Uint8Array(e)}var _x,S4,x4,D4,Ix=ye(()=>{l();Yr();_x=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}"),S4=_x.reduce((r,e,t)=>(r[t]=e,r),[]),x4=_x.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);D4=su({prefix:"\u{1F680}",name:"base256emoji",encode:T4,decode:N4})});function Sx(r,e,t){e=e||[],t=t||0;for(var i=t;r>=P4;)e[t++]=r&255|bx,r/=128;for(;r&M4;)e[t++]=r&255|bx,r>>>=7;return e[t]=r|0,Sx.bytes=t-i+1,e}function Nv(r,i){var t=0,i=i||0,n=0,s=i,o,a=r.length;do{if(s>=a)throw Nv.bytes=0,new RangeError("Could not decode varint");o=r[s++],t+=n<28?(o&Cx)<=R4);return Nv.bytes=s-i,t}var O4,bx,B4,M4,P4,L4,R4,Cx,F4,U4,q4,V4,H4,Q4,j4,G4,K4,z4,$4,k4,Uc,xx=ye(()=>{l();O4=Sx,bx=128,B4=127,M4=~B4,P4=Math.pow(2,31);L4=Nv,R4=128,Cx=127;F4=Math.pow(2,7),U4=Math.pow(2,14),q4=Math.pow(2,21),V4=Math.pow(2,28),H4=Math.pow(2,35),Q4=Math.pow(2,42),j4=Math.pow(2,49),G4=Math.pow(2,56),K4=Math.pow(2,63),z4=function(r){return r{l();xx();qc=(r,e=0)=>[Uc.decode(r,e),Uc.decode.bytes],au=(r,e,t=0)=>(Uc.encode(r,e,t),e),uu=r=>Uc.encodingLength(r)});var co,Tx,Nx,cu,Hc=ye(()=>{l();Vn();td();co=(r,e)=>{let t=e.byteLength,i=uu(r),n=i+uu(t),s=new Uint8Array(n+t);return au(r,s,0),au(t,s,i),s.set(e,n),new cu(r,t,e,s)},Tx=r=>{let e=Ji(r),[t,i]=qc(e),[n,s]=qc(e.subarray(i)),o=e.subarray(i+s);if(o.byteLength!==n)throw new Error("Incorrect length");return new cu(t,n,o,e)},Nx=(r,e)=>r===e?!0:r.code===e.code&&r.size===e.size&&lx(r.bytes,e.bytes),cu=class{constructor(e,t,i,n){this.code=e,this.size=t,this.digest=i,this.bytes=n}}});var Ov,Dv,Bv=ye(()=>{l();Hc();Ov=({name:r,code:e,encode:t})=>new Dv(r,e,t),Dv=class{constructor(e,t,i){this.name=e,this.code=t,this.encode=i}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?co(this.code,t):t.then(i=>co(this.code,i))}else throw Error("Unknown type, must be binary type")}}});var Mv={};st(Mv,{sha256:()=>W4,sha512:()=>Y4});var Ox,W4,Y4,Bx=ye(()=>{l();Bv();Ox=r=>async e=>new Uint8Array(await crypto.subtle.digest(r,e)),W4=Ov({name:"sha2-256",code:18,encode:Ox("SHA-256")}),Y4=Ov({name:"sha2-512",code:19,encode:Ox("SHA-512")})});var Pv={};st(Pv,{identity:()=>Z4});var Mx,J4,Px,X4,Z4,Lx=ye(()=>{l();Vn();Hc();Mx=0,J4="identity",Px=Ji,X4=r=>co(Mx,Px(r)),Z4={code:Mx,name:J4,encode:Px,digest:X4}});var Rx=ye(()=>{l();Vn()});var oZ,aZ,Fx=ye(()=>{l();oZ=new TextEncoder,aZ=new TextDecoder});var Rt,rU,iU,nU,Qc,sU,Ux,qx,rd,id,oU,aU,uU,Vx=ye(()=>{l();td();Hc();Sv();Iv();Vn();Rt=class{constructor(e,t,i,n){this.code=t,this.version=e,this.multihash=i,this.bytes=n,this.byteOffset=n.byteOffset,this.byteLength=n.byteLength,this.asCID=this,this._baseCache=new Map,Object.defineProperties(this,{byteOffset:id,byteLength:id,code:rd,version:rd,multihash:rd,bytes:rd,_baseCache:id,asCID:id})}toV0(){switch(this.version){case 0:return this;default:{let{code:e,multihash:t}=this;if(e!==Qc)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==sU)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return Rt.createV0(t)}}}toV1(){switch(this.version){case 0:{let{code:e,digest:t}=this.multihash,i=co(e,t);return Rt.createV1(this.code,i)}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&&Nx(this.multihash,e.multihash)}toString(e){let{bytes:t,version:i,_baseCache:n}=this;switch(i){case 0:return iU(t,n,e||Ni.encoder);default:return nU(t,n,e||ou.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 aU(/^0\.0/,uU),!!(e&&(e[qx]||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 Rt)return e;if(e!=null&&e.asCID===e){let{version:t,code:i,multihash:n,bytes:s}=e;return new Rt(t,i,n,s||Ux(t,i,n.bytes))}else if(e!=null&&e[qx]===!0){let{version:t,multihash:i,code:n}=e,s=Tx(i);return Rt.create(t,n,s)}else return null}static create(e,t,i){if(typeof t!="number")throw new Error("String codecs are no longer supported");switch(e){case 0:{if(t!==Qc)throw new Error(`Version 0 CID must use dag-pb (code: ${Qc}) block encoding`);return new Rt(e,t,i,i.bytes)}case 1:{let n=Ux(e,t,i.bytes);return new Rt(e,t,i,n)}default:throw new Error("Invalid version")}}static createV0(e){return Rt.create(0,Qc,e)}static createV1(e,t){return Rt.create(1,e,t)}static decode(e){let[t,i]=Rt.decodeFirst(e);if(i.length)throw new Error("Incorrect length");return t}static decodeFirst(e){let t=Rt.inspectBytes(e),i=t.size-t.multihashSize,n=Ji(e.subarray(i,i+t.multihashSize));if(n.byteLength!==t.multihashSize)throw new Error("Incorrect length");let s=n.subarray(t.multihashSize-t.digestSize),o=new cu(t.multihashCode,t.digestSize,s,n);return[t.version===0?Rt.createV0(o):Rt.createV1(t.codec,o),e.subarray(t.size)]}static inspectBytes(e){let t=0,i=()=>{let[v,B]=qc(e.subarray(t));return t+=B,v},n=i(),s=Qc;if(n===18?(n=0,t=0):n===1&&(s=i()),n!==0&&n!==1)throw new RangeError(`Invalid CID version ${n}`);let o=t,a=i(),u=i(),h=t+u,p=h-o;return{version:n,codec:s,multihashCode:a,digestSize:u,multihashSize:p,size:h}}static parse(e,t){let[i,n]=rU(e,t),s=Rt.decode(n);return s._baseCache.set(i,e),s}},rU=(r,e)=>{switch(r[0]){case"Q":{let t=e||Ni;return[Ni.prefix,t.decode(`${Ni.prefix}${r}`)]}case Ni.prefix:{let t=e||Ni;return[Ni.prefix,t.decode(r)]}case ou.prefix:{let t=e||ou;return[ou.prefix,t.decode(r)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],e.decode(r)]}}},iU=(r,e,t)=>{let{prefix:i}=t;if(i!==Ni.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let n=e.get(i);if(n==null){let s=t.encode(r).slice(1);return e.set(i,s),s}else return n},nU=(r,e,t)=>{let{prefix:i}=t,n=e.get(i);if(n==null){let s=t.encode(r);return e.set(i,s),s}else return n},Qc=112,sU=18,Ux=(r,e,t)=>{let i=uu(r),n=i+uu(e),s=new Uint8Array(n+t.byteLength);return au(r,s,0),au(e,s,i),s.set(t,n),s},qx=Symbol.for("@ipld/js-cid/CID"),rd={writable:!1,configurable:!1,enumerable:!0},id={writable:!1,enumerable:!1,configurable:!1},oU="0.0.0-dev",aU=(r,e)=>{if(r.test(oU))console.warn(e);else throw new Error(e)},uU=`CID.isCID(v) is deprecated and will be removed in the next major release. -Following code pattern: - -if (CID.isCID(value)) { - doSomethingWithCID(value) -} - -Is replaced with: - -const cid = CID.asCID(value) -if (cid) { - // Make sure to use cid instead of value - doSomethingWithCID(cid) -} -`});var Hx=ye(()=>{l();Vx();td();Vn();Bv();Hc()});var Lv,vZ,Qx=ye(()=>{l();gx();yx();mx();vx();wx();Iv();Ex();Sv();Ax();Ix();Bx();Lx();Rx();Fx();Hx();Lv={...mv,...vv,...wv,...Ev,...Av,..._v,...bv,...Cv,...xv,...Tv},vZ={...Mv,...Pv}});function Gx(r,e,t,i){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:i}}}var jx,Rv,cU,nd,Fv=ye(()=>{l();Qx();Xh();jx=Gx("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Rv=Gx("ascii","a",r=>{let e="a";for(let t=0;t{r=r.substring(1);let e=nu(r.length);for(let t=0;t{l();Fv()});function Zi(r,e="utf8"){let t=nd[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r,"utf8"):t.decoder.decode(`${t.prefix}${r}`)}var qv=ye(()=>{l();Fv()});function jc(r){return Pc(Xi(Zi(r,ru),Gh))}function Gc(r){return Xi(Zi(Lc(r),Gh),ru)}function Vv(r){let e=Zi(Yh,iu),t=Wh+Xi(Zh([e,r]),iu);return[$h,kh,t].join(zh)}function Hv(r){let[e,t,i]=r.split(zh);if(e!==$h||t!==kh)throw new Error('Issuer must be a DID with method "key"');if(i.slice(0,1)!==Wh)throw new Error("Issuer must be a key in mulicodec format");let s=Zi(i.slice(1),iu);if(Xi(s.slice(0,2),iu)!==Yh)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 Kx(r){return Xi(r,ru)}function zx(r){return Zi(r,ru)}function sd(r){return Zi([Gc(r.header),Gc(r.payload)].join(tu),Kh)}function lU(r){let e=Xi(r,Kh).split(tu),t=jc(e[0]),i=jc(e[1]);return{header:t,payload:i}}function Qv(r){return[Gc(r.header),Gc(r.payload),Kx(r.signature)].join(tu)}function jv(r){let e=r.split(tu),t=jc(e[0]),i=jc(e[1]),n=zx(e[2]);return{header:t,payload:i,signature:n}}var Gv=ye(()=>{l();hv();Uv();qv();Lh();Jh()});function fU(r=(0,$x.randomBytes)(32)){return lu.generateKeyPairFromSeed(r)}async function hU(r,e,t,i,n=(0,kx.fromMiliseconds)(Date.now())){let s={alg:Qh,typ:jh},o=Vv(i.publicKey),a=n+t,u={iss:o,sub:r,aud:e,iat:n,exp:a},h=sd({header:s,payload:u}),p=lu.sign(i.secretKey,h);return Qv({header:s,payload:u,signature:p})}async function dU(r){let{header:e,payload:t,signature:i}=jv(r);if(e.alg!==Qh||e.typ!==jh)throw new Error("JWT must use EdDSA algorithm");let n=Hv(t.iss),s=sd({header:e,payload:t});return lu.verify(n,s,i)}var lu,$x,kx,Wx=ye(()=>{l();lu=_e(XS()),$x=_e(Hh()),kx=_e(ro());Jh();Gv()});var Yx=ye(()=>{l()});var Jx={};st(Jx,{DATA_ENCODING:()=>Kh,DID_DELIMITER:()=>zh,DID_METHOD:()=>kh,DID_PREFIX:()=>$h,JSON_ENCODING:()=>Gh,JWT_DELIMITER:()=>tu,JWT_ENCODING:()=>ru,JWT_IRIDIUM_ALG:()=>Qh,JWT_IRIDIUM_TYP:()=>jh,KEY_PAIR_SEED_LENGTH:()=>ax,MULTICODEC_ED25519_BASE:()=>Wh,MULTICODEC_ED25519_ENCODING:()=>iu,MULTICODEC_ED25519_HEADER:()=>Yh,MULTICODEC_ED25519_LENGTH:()=>ox,decodeData:()=>lU,decodeIss:()=>Hv,decodeJSON:()=>jc,decodeJWT:()=>jv,decodeSig:()=>zx,encodeData:()=>sd,encodeIss:()=>Vv,encodeJSON:()=>Gc,encodeJWT:()=>Qv,encodeSig:()=>Kx,generateKeyPair:()=>fU,signJWT:()=>hU,verifyJWT:()=>dU});var Xx=ye(()=>{l();Wx();Jh();Yx();Gv()});var e2=D(od=>{"use strict";l();Object.defineProperty(od,"__esModule",{value:!0});var or=so(),Kv=vr(),pU=20;function gU(r,e,t){for(var i=1634760805,n=857760878,s=2036477234,o=1797285236,a=t[3]<<24|t[2]<<16|t[1]<<8|t[0],u=t[7]<<24|t[6]<<16|t[5]<<8|t[4],h=t[11]<<24|t[10]<<16|t[9]<<8|t[8],p=t[15]<<24|t[14]<<16|t[13]<<8|t[12],v=t[19]<<24|t[18]<<16|t[17]<<8|t[16],B=t[23]<<24|t[22]<<16|t[21]<<8|t[20],R=t[27]<<24|t[26]<<16|t[25]<<8|t[24],x=t[31]<<24|t[30]<<16|t[29]<<8|t[28],V=e[3]<<24|e[2]<<16|e[1]<<8|e[0],H=e[7]<<24|e[6]<<16|e[5]<<8|e[4],K=e[11]<<24|e[10]<<16|e[9]<<8|e[8],ie=e[15]<<24|e[14]<<16|e[13]<<8|e[12],k=i,J=n,W=s,G=o,P=a,F=u,$=h,ce=p,Y=v,X=B,A=R,c=x,d=V,g=H,m=K,w=ie,S=0;S>>32-16|d<<16,Y=Y+d|0,P^=Y,P=P>>>32-12|P<<12,J=J+F|0,g^=J,g=g>>>32-16|g<<16,X=X+g|0,F^=X,F=F>>>32-12|F<<12,W=W+$|0,m^=W,m=m>>>32-16|m<<16,A=A+m|0,$^=A,$=$>>>32-12|$<<12,G=G+ce|0,w^=G,w=w>>>32-16|w<<16,c=c+w|0,ce^=c,ce=ce>>>32-12|ce<<12,W=W+$|0,m^=W,m=m>>>32-8|m<<8,A=A+m|0,$^=A,$=$>>>32-7|$<<7,G=G+ce|0,w^=G,w=w>>>32-8|w<<8,c=c+w|0,ce^=c,ce=ce>>>32-7|ce<<7,J=J+F|0,g^=J,g=g>>>32-8|g<<8,X=X+g|0,F^=X,F=F>>>32-7|F<<7,k=k+P|0,d^=k,d=d>>>32-8|d<<8,Y=Y+d|0,P^=Y,P=P>>>32-7|P<<7,k=k+F|0,w^=k,w=w>>>32-16|w<<16,A=A+w|0,F^=A,F=F>>>32-12|F<<12,J=J+$|0,d^=J,d=d>>>32-16|d<<16,c=c+d|0,$^=c,$=$>>>32-12|$<<12,W=W+ce|0,g^=W,g=g>>>32-16|g<<16,Y=Y+g|0,ce^=Y,ce=ce>>>32-12|ce<<12,G=G+P|0,m^=G,m=m>>>32-16|m<<16,X=X+m|0,P^=X,P=P>>>32-12|P<<12,W=W+ce|0,g^=W,g=g>>>32-8|g<<8,Y=Y+g|0,ce^=Y,ce=ce>>>32-7|ce<<7,G=G+P|0,m^=G,m=m>>>32-8|m<<8,X=X+m|0,P^=X,P=P>>>32-7|P<<7,J=J+$|0,d^=J,d=d>>>32-8|d<<8,c=c+d|0,$^=c,$=$>>>32-7|$<<7,k=k+F|0,w^=k,w=w>>>32-8|w<<8,A=A+w|0,F^=A,F=F>>>32-7|F<<7;or.writeUint32LE(k+i|0,r,0),or.writeUint32LE(J+n|0,r,4),or.writeUint32LE(W+s|0,r,8),or.writeUint32LE(G+o|0,r,12),or.writeUint32LE(P+a|0,r,16),or.writeUint32LE(F+u|0,r,20),or.writeUint32LE($+h|0,r,24),or.writeUint32LE(ce+p|0,r,28),or.writeUint32LE(Y+v|0,r,32),or.writeUint32LE(X+B|0,r,36),or.writeUint32LE(A+R|0,r,40),or.writeUint32LE(c+x|0,r,44),or.writeUint32LE(d+V|0,r,48),or.writeUint32LE(g+H|0,r,52),or.writeUint32LE(m+K|0,r,56),or.writeUint32LE(w+ie|0,r,60)}function Zx(r,e,t,i,n){if(n===void 0&&(n=0),r.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(i.length>>=8,e++;if(i>0)throw new Error("ChaCha: counter overflow")}});var ad=D(fu=>{"use strict";l();Object.defineProperty(fu,"__esModule",{value:!0});function vU(r,e,t){return~(r-1)&e|r-1&t}fu.select=vU;function wU(r,e){return(r|0)-(e|0)-1>>>31&1}fu.lessOrEqual=wU;function t2(r,e){if(r.length!==e.length)return 0;for(var t=0,i=0;i>>8}fu.compare=t2;function EU(r,e){return r.length===0||e.length===0?!1:t2(r,e)!==0}fu.equal=EU});var i2=D(en=>{"use strict";l();Object.defineProperty(en,"__esModule",{value:!0});var AU=ad(),ud=vr();en.DIGEST_LENGTH=16;var r2=function(){function r(e){this.digestLength=en.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 t=e[0]|e[1]<<8;this._r[0]=t&8191;var i=e[2]|e[3]<<8;this._r[1]=(t>>>13|i<<3)&8191;var n=e[4]|e[5]<<8;this._r[2]=(i>>>10|n<<6)&7939;var s=e[6]|e[7]<<8;this._r[3]=(n>>>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 h=e[14]|e[15]<<8;this._r[8]=(u>>>8|h<<8)&8191,this._r[9]=h>>>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 r.prototype._blocks=function(e,t,i){for(var n=this._fin?0:2048,s=this._h[0],o=this._h[1],a=this._h[2],u=this._h[3],h=this._h[4],p=this._h[5],v=this._h[6],B=this._h[7],R=this._h[8],x=this._h[9],V=this._r[0],H=this._r[1],K=this._r[2],ie=this._r[3],k=this._r[4],J=this._r[5],W=this._r[6],G=this._r[7],P=this._r[8],F=this._r[9];i>=16;){var $=e[t+0]|e[t+1]<<8;s+=$&8191;var ce=e[t+2]|e[t+3]<<8;o+=($>>>13|ce<<3)&8191;var Y=e[t+4]|e[t+5]<<8;a+=(ce>>>10|Y<<6)&8191;var X=e[t+6]|e[t+7]<<8;u+=(Y>>>7|X<<9)&8191;var A=e[t+8]|e[t+9]<<8;h+=(X>>>4|A<<12)&8191,p+=A>>>1&8191;var c=e[t+10]|e[t+11]<<8;v+=(A>>>14|c<<2)&8191;var d=e[t+12]|e[t+13]<<8;B+=(c>>>11|d<<5)&8191;var g=e[t+14]|e[t+15]<<8;R+=(d>>>8|g<<8)&8191,x+=g>>>5|n;var m=0,w=m;w+=s*V,w+=o*(5*F),w+=a*(5*P),w+=u*(5*G),w+=h*(5*W),m=w>>>13,w&=8191,w+=p*(5*J),w+=v*(5*k),w+=B*(5*ie),w+=R*(5*K),w+=x*(5*H),m+=w>>>13,w&=8191;var S=m;S+=s*H,S+=o*V,S+=a*(5*F),S+=u*(5*P),S+=h*(5*G),m=S>>>13,S&=8191,S+=p*(5*W),S+=v*(5*J),S+=B*(5*k),S+=R*(5*ie),S+=x*(5*K),m+=S>>>13,S&=8191;var N=m;N+=s*K,N+=o*H,N+=a*V,N+=u*(5*F),N+=h*(5*P),m=N>>>13,N&=8191,N+=p*(5*G),N+=v*(5*W),N+=B*(5*J),N+=R*(5*k),N+=x*(5*ie),m+=N>>>13,N&=8191;var _=m;_+=s*ie,_+=o*K,_+=a*H,_+=u*V,_+=h*(5*F),m=_>>>13,_&=8191,_+=p*(5*P),_+=v*(5*G),_+=B*(5*W),_+=R*(5*J),_+=x*(5*k),m+=_>>>13,_&=8191;var f=m;f+=s*k,f+=o*ie,f+=a*K,f+=u*H,f+=h*V,m=f>>>13,f&=8191,f+=p*(5*F),f+=v*(5*P),f+=B*(5*G),f+=R*(5*W),f+=x*(5*J),m+=f>>>13,f&=8191;var C=m;C+=s*J,C+=o*k,C+=a*ie,C+=u*K,C+=h*H,m=C>>>13,C&=8191,C+=p*V,C+=v*(5*F),C+=B*(5*P),C+=R*(5*G),C+=x*(5*W),m+=C>>>13,C&=8191;var Z=m;Z+=s*W,Z+=o*J,Z+=a*k,Z+=u*ie,Z+=h*K,m=Z>>>13,Z&=8191,Z+=p*H,Z+=v*V,Z+=B*(5*F),Z+=R*(5*P),Z+=x*(5*G),m+=Z>>>13,Z&=8191;var te=m;te+=s*G,te+=o*W,te+=a*J,te+=u*k,te+=h*ie,m=te>>>13,te&=8191,te+=p*K,te+=v*H,te+=B*V,te+=R*(5*F),te+=x*(5*P),m+=te>>>13,te&=8191;var ee=m;ee+=s*P,ee+=o*G,ee+=a*W,ee+=u*J,ee+=h*k,m=ee>>>13,ee&=8191,ee+=p*ie,ee+=v*K,ee+=B*H,ee+=R*V,ee+=x*(5*F),m+=ee>>>13,ee&=8191;var ae=m;ae+=s*F,ae+=o*P,ae+=a*G,ae+=u*W,ae+=h*J,m=ae>>>13,ae&=8191,ae+=p*k,ae+=v*ie,ae+=B*K,ae+=R*H,ae+=x*V,m+=ae>>>13,ae&=8191,m=(m<<2)+m|0,m=m+w|0,w=m&8191,m=m>>>13,S+=m,s=w,o=S,a=N,u=_,h=f,p=C,v=Z,B=te,R=ee,x=ae,t+=16,i-=16}this._h[0]=s,this._h[1]=o,this._h[2]=a,this._h[3]=u,this._h[4]=h,this._h[5]=p,this._h[6]=v,this._h[7]=B,this._h[8]=R,this._h[9]=x},r.prototype.finish=function(e,t){t===void 0&&(t=0);var i=new Uint16Array(10),n,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(n=this._h[1]>>>13,this._h[1]&=8191,a=2;a<10;a++)this._h[a]+=n,n=this._h[a]>>>13,this._h[a]&=8191;for(this._h[0]+=n*5,n=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=n,n=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=n,i[0]=this._h[0]+5,n=i[0]>>>13,i[0]&=8191,a=1;a<10;a++)i[a]=this._h[a]+n,n=i[a]>>>13,i[a]&=8191;for(i[9]-=1<<13,s=(n^1)-1,a=0;a<10;a++)i[a]&=s;for(s=~s,a=0;a<10;a++)this._h[a]=this._h[a]&s|i[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[t+0]=this._h[0]>>>0,e[t+1]=this._h[0]>>>8,e[t+2]=this._h[1]>>>0,e[t+3]=this._h[1]>>>8,e[t+4]=this._h[2]>>>0,e[t+5]=this._h[2]>>>8,e[t+6]=this._h[3]>>>0,e[t+7]=this._h[3]>>>8,e[t+8]=this._h[4]>>>0,e[t+9]=this._h[4]>>>8,e[t+10]=this._h[5]>>>0,e[t+11]=this._h[5]>>>8,e[t+12]=this._h[6]>>>0,e[t+13]=this._h[6]>>>8,e[t+14]=this._h[7]>>>0,e[t+15]=this._h[7]>>>8,this._finished=!0,this},r.prototype.update=function(e){var t=0,i=e.length,n;if(this._leftover){n=16-this._leftover,n>i&&(n=i);for(var s=0;s=16&&(n=i-i%16,this._blocks(e,t,n),t+=n,i-=n),i){for(var s=0;s{"use strict";l();Object.defineProperty(tn,"__esModule",{value:!0});var cd=e2(),bU=i2(),Kc=vr(),n2=so(),CU=ad();tn.KEY_LENGTH=32;tn.NONCE_LENGTH=12;tn.TAG_LENGTH=16;var s2=new Uint8Array(16),SU=function(){function r(e){if(this.nonceLength=tn.NONCE_LENGTH,this.tagLength=tn.TAG_LENGTH,e.length!==tn.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(e)}return r.prototype.seal=function(e,t,i,n){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);cd.stream(this._key,s,o,4);var a=t.length+this.tagLength,u;if(n){if(n.length!==a)throw new Error("ChaCha20Poly1305: incorrect destination length");u=n}else u=new Uint8Array(a);return cd.streamXOR(this._key,s,t,u,4),this._authenticate(u.subarray(u.length-this.tagLength,u.length),o,u.subarray(0,u.length-this.tagLength),i),Kc.wipe(s),u},r.prototype.open=function(e,t,i,n){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(t.length0&&s.update(s2.subarray(n.length%16))),s.update(i),i.length%16>0&&s.update(s2.subarray(i.length%16));var o=new Uint8Array(8);n&&n2.writeUint64LE(n.length,o),s.update(o),n2.writeUint64LE(i.length,o),s.update(o);for(var a=s.digest(),u=0;u{"use strict";l();Object.defineProperty(zv,"__esModule",{value:!0});function xU(r){return typeof r.saveState<"u"&&typeof r.restoreState<"u"&&typeof r.cleanSavedState<"u"}zv.isSerializableHash=xU});var c2=D(zc=>{"use strict";l();Object.defineProperty(zc,"__esModule",{value:!0});var Di=a2(),TU=ad(),NU=vr(),u2=function(){function r(e,t){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var i=new Uint8Array(this.blockSize);t.length>this.blockSize?this._inner.update(t).finish(i).clean():i.set(t);for(var n=0;n{"use strict";l();Object.defineProperty($v,"__esModule",{value:!0});var l2=c2(),f2=vr(),OU=function(){function r(e,t,i,n){i===void 0&&(i=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=n;var s=l2.hmac(this._hash,i,t);this._hmac=new l2.HMAC(e,s),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return r.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},r.prototype.expand=function(e){for(var t=new Uint8Array(e),i=0;i{"use strict";l();Object.defineProperty(Qn,"__esModule",{value:!0});var fd=so(),ld=vr();Qn.DIGEST_LENGTH=32;Qn.BLOCK_SIZE=64;var d2=function(){function r(){this.digestLength=Qn.DIGEST_LENGTH,this.blockSize=Qn.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 r.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},r.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},r.prototype.clean=function(){ld.wipe(this._buffer),ld.wipe(this._temp),this.reset()},r.prototype.update=function(e,t){if(t===void 0&&(t=e.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var i=0;if(this._bytesHashed+=t,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=e[i++],t--;this._bufferLength===this.blockSize&&(kv(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(t>=this.blockSize&&(i=kv(this._temp,this._state,e,i,t),t%=this.blockSize);t>0;)this._buffer[this._bufferLength++]=e[i++],t--;return this},r.prototype.finish=function(e){if(!this._finished){var t=this._bytesHashed,i=this._bufferLength,n=t/536870912|0,s=t<<3,o=t%64<56?64:128;this._buffer[i]=128;for(var a=i+1;a0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},r.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},r.prototype.cleanSavedState=function(e){ld.wipe(e.state),e.buffer&&ld.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},r}();Qn.SHA256=d2;var BU=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 kv(r,e,t,i,n){for(;n>=64;){for(var s=e[0],o=e[1],a=e[2],u=e[3],h=e[4],p=e[5],v=e[6],B=e[7],R=0;R<16;R++){var x=i+R*4;r[R]=fd.readUint32BE(t,x)}for(var R=16;R<64;R++){var V=r[R-2],H=(V>>>17|V<<32-17)^(V>>>19|V<<32-19)^V>>>10;V=r[R-15];var K=(V>>>7|V<<32-7)^(V>>>18|V<<32-18)^V>>>3;r[R]=(H+r[R-7]|0)+(K+r[R-16]|0)}for(var R=0;R<64;R++){var H=(((h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7))+(h&p^~h&v)|0)+(B+(BU[R]+r[R]|0)|0)|0,K=((s>>>2|s<<32-2)^(s>>>13|s<<32-13)^(s>>>22|s<<32-22))+(s&o^s&a^o&a)|0;B=v,v=p,p=h,h=u+H|0,u=a,a=o,o=s,s=H+K|0}e[0]+=s,e[1]+=o,e[2]+=a,e[3]+=u,e[4]+=h,e[5]+=p,e[6]+=v,e[7]+=B,i+=64,n-=64}return i}function MU(r){var e=new d2;e.update(r);var t=e.digest();return e.clean(),t}Qn.hash=MU});var v2=D(wr=>{"use strict";l();Object.defineProperty(wr,"__esModule",{value:!0});var PU=Hh(),LU=vr();wr.PUBLIC_KEY_LENGTH=32;wr.SECRET_KEY_LENGTH=32;wr.SHARED_KEY_LENGTH=32;function Oi(r){var e=new Float64Array(16);if(r)for(var t=0;t>16&1),t[n-1]&=65535;t[15]=i[15]-32767-(t[14]>>16&1);var o=t[15]>>16&1;t[14]&=65535,$c(i,t,1-o)}for(var n=0;n<16;n++)r[2*n]=i[n]&255,r[2*n+1]=i[n]>>8}function UU(r,e){for(var t=0;t<16;t++)r[t]=e[2*t]+(e[2*t+1]<<8);r[15]&=32767}function hd(r,e,t){for(var i=0;i<16;i++)r[i]=e[i]+t[i]}function dd(r,e,t){for(var i=0;i<16;i++)r[i]=e[i]-t[i]}function rn(r,e,t){var i,n,s=0,o=0,a=0,u=0,h=0,p=0,v=0,B=0,R=0,x=0,V=0,H=0,K=0,ie=0,k=0,J=0,W=0,G=0,P=0,F=0,$=0,ce=0,Y=0,X=0,A=0,c=0,d=0,g=0,m=0,w=0,S=0,N=t[0],_=t[1],f=t[2],C=t[3],Z=t[4],te=t[5],ee=t[6],ae=t[7],E=t[8],b=t[9],T=t[10],L=t[11],O=t[12],U=t[13],q=t[14],M=t[15];i=e[0],s+=i*N,o+=i*_,a+=i*f,u+=i*C,h+=i*Z,p+=i*te,v+=i*ee,B+=i*ae,R+=i*E,x+=i*b,V+=i*T,H+=i*L,K+=i*O,ie+=i*U,k+=i*q,J+=i*M,i=e[1],o+=i*N,a+=i*_,u+=i*f,h+=i*C,p+=i*Z,v+=i*te,B+=i*ee,R+=i*ae,x+=i*E,V+=i*b,H+=i*T,K+=i*L,ie+=i*O,k+=i*U,J+=i*q,W+=i*M,i=e[2],a+=i*N,u+=i*_,h+=i*f,p+=i*C,v+=i*Z,B+=i*te,R+=i*ee,x+=i*ae,V+=i*E,H+=i*b,K+=i*T,ie+=i*L,k+=i*O,J+=i*U,W+=i*q,G+=i*M,i=e[3],u+=i*N,h+=i*_,p+=i*f,v+=i*C,B+=i*Z,R+=i*te,x+=i*ee,V+=i*ae,H+=i*E,K+=i*b,ie+=i*T,k+=i*L,J+=i*O,W+=i*U,G+=i*q,P+=i*M,i=e[4],h+=i*N,p+=i*_,v+=i*f,B+=i*C,R+=i*Z,x+=i*te,V+=i*ee,H+=i*ae,K+=i*E,ie+=i*b,k+=i*T,J+=i*L,W+=i*O,G+=i*U,P+=i*q,F+=i*M,i=e[5],p+=i*N,v+=i*_,B+=i*f,R+=i*C,x+=i*Z,V+=i*te,H+=i*ee,K+=i*ae,ie+=i*E,k+=i*b,J+=i*T,W+=i*L,G+=i*O,P+=i*U,F+=i*q,$+=i*M,i=e[6],v+=i*N,B+=i*_,R+=i*f,x+=i*C,V+=i*Z,H+=i*te,K+=i*ee,ie+=i*ae,k+=i*E,J+=i*b,W+=i*T,G+=i*L,P+=i*O,F+=i*U,$+=i*q,ce+=i*M,i=e[7],B+=i*N,R+=i*_,x+=i*f,V+=i*C,H+=i*Z,K+=i*te,ie+=i*ee,k+=i*ae,J+=i*E,W+=i*b,G+=i*T,P+=i*L,F+=i*O,$+=i*U,ce+=i*q,Y+=i*M,i=e[8],R+=i*N,x+=i*_,V+=i*f,H+=i*C,K+=i*Z,ie+=i*te,k+=i*ee,J+=i*ae,W+=i*E,G+=i*b,P+=i*T,F+=i*L,$+=i*O,ce+=i*U,Y+=i*q,X+=i*M,i=e[9],x+=i*N,V+=i*_,H+=i*f,K+=i*C,ie+=i*Z,k+=i*te,J+=i*ee,W+=i*ae,G+=i*E,P+=i*b,F+=i*T,$+=i*L,ce+=i*O,Y+=i*U,X+=i*q,A+=i*M,i=e[10],V+=i*N,H+=i*_,K+=i*f,ie+=i*C,k+=i*Z,J+=i*te,W+=i*ee,G+=i*ae,P+=i*E,F+=i*b,$+=i*T,ce+=i*L,Y+=i*O,X+=i*U,A+=i*q,c+=i*M,i=e[11],H+=i*N,K+=i*_,ie+=i*f,k+=i*C,J+=i*Z,W+=i*te,G+=i*ee,P+=i*ae,F+=i*E,$+=i*b,ce+=i*T,Y+=i*L,X+=i*O,A+=i*U,c+=i*q,d+=i*M,i=e[12],K+=i*N,ie+=i*_,k+=i*f,J+=i*C,W+=i*Z,G+=i*te,P+=i*ee,F+=i*ae,$+=i*E,ce+=i*b,Y+=i*T,X+=i*L,A+=i*O,c+=i*U,d+=i*q,g+=i*M,i=e[13],ie+=i*N,k+=i*_,J+=i*f,W+=i*C,G+=i*Z,P+=i*te,F+=i*ee,$+=i*ae,ce+=i*E,Y+=i*b,X+=i*T,A+=i*L,c+=i*O,d+=i*U,g+=i*q,m+=i*M,i=e[14],k+=i*N,J+=i*_,W+=i*f,G+=i*C,P+=i*Z,F+=i*te,$+=i*ee,ce+=i*ae,Y+=i*E,X+=i*b,A+=i*T,c+=i*L,d+=i*O,g+=i*U,m+=i*q,w+=i*M,i=e[15],J+=i*N,W+=i*_,G+=i*f,P+=i*C,F+=i*Z,$+=i*te,ce+=i*ee,Y+=i*ae,X+=i*E,A+=i*b,c+=i*T,d+=i*L,g+=i*O,m+=i*U,w+=i*q,S+=i*M,s+=38*W,o+=38*G,a+=38*P,u+=38*F,h+=38*$,p+=38*ce,v+=38*Y,B+=38*X,R+=38*A,x+=38*c,V+=38*d,H+=38*g,K+=38*m,ie+=38*w,k+=38*S,n=1,i=s+n+65535,n=Math.floor(i/65536),s=i-n*65536,i=o+n+65535,n=Math.floor(i/65536),o=i-n*65536,i=a+n+65535,n=Math.floor(i/65536),a=i-n*65536,i=u+n+65535,n=Math.floor(i/65536),u=i-n*65536,i=h+n+65535,n=Math.floor(i/65536),h=i-n*65536,i=p+n+65535,n=Math.floor(i/65536),p=i-n*65536,i=v+n+65535,n=Math.floor(i/65536),v=i-n*65536,i=B+n+65535,n=Math.floor(i/65536),B=i-n*65536,i=R+n+65535,n=Math.floor(i/65536),R=i-n*65536,i=x+n+65535,n=Math.floor(i/65536),x=i-n*65536,i=V+n+65535,n=Math.floor(i/65536),V=i-n*65536,i=H+n+65535,n=Math.floor(i/65536),H=i-n*65536,i=K+n+65535,n=Math.floor(i/65536),K=i-n*65536,i=ie+n+65535,n=Math.floor(i/65536),ie=i-n*65536,i=k+n+65535,n=Math.floor(i/65536),k=i-n*65536,i=J+n+65535,n=Math.floor(i/65536),J=i-n*65536,s+=n-1+37*(n-1),n=1,i=s+n+65535,n=Math.floor(i/65536),s=i-n*65536,i=o+n+65535,n=Math.floor(i/65536),o=i-n*65536,i=a+n+65535,n=Math.floor(i/65536),a=i-n*65536,i=u+n+65535,n=Math.floor(i/65536),u=i-n*65536,i=h+n+65535,n=Math.floor(i/65536),h=i-n*65536,i=p+n+65535,n=Math.floor(i/65536),p=i-n*65536,i=v+n+65535,n=Math.floor(i/65536),v=i-n*65536,i=B+n+65535,n=Math.floor(i/65536),B=i-n*65536,i=R+n+65535,n=Math.floor(i/65536),R=i-n*65536,i=x+n+65535,n=Math.floor(i/65536),x=i-n*65536,i=V+n+65535,n=Math.floor(i/65536),V=i-n*65536,i=H+n+65535,n=Math.floor(i/65536),H=i-n*65536,i=K+n+65535,n=Math.floor(i/65536),K=i-n*65536,i=ie+n+65535,n=Math.floor(i/65536),ie=i-n*65536,i=k+n+65535,n=Math.floor(i/65536),k=i-n*65536,i=J+n+65535,n=Math.floor(i/65536),J=i-n*65536,s+=n-1+37*(n-1),r[0]=s,r[1]=o,r[2]=a,r[3]=u,r[4]=h,r[5]=p,r[6]=v,r[7]=B,r[8]=R,r[9]=x,r[10]=V,r[11]=H,r[12]=K,r[13]=ie,r[14]=k,r[15]=J}function kc(r,e){rn(r,e,e)}function qU(r,e){for(var t=Oi(),i=0;i<16;i++)t[i]=e[i];for(var i=253;i>=0;i--)kc(t,t),i!==2&&i!==4&&rn(t,t,e);for(var i=0;i<16;i++)r[i]=t[i]}function Yv(r,e){for(var t=new Uint8Array(32),i=new Float64Array(80),n=Oi(),s=Oi(),o=Oi(),a=Oi(),u=Oi(),h=Oi(),p=0;p<31;p++)t[p]=r[p];t[31]=r[31]&127|64,t[0]&=248,UU(i,e);for(var p=0;p<16;p++)s[p]=i[p];n[0]=a[0]=1;for(var p=254;p>=0;--p){var v=t[p>>>3]>>>(p&7)&1;$c(n,s,v),$c(o,a,v),hd(u,n,o),dd(n,n,o),hd(o,s,a),dd(s,s,a),kc(a,u),kc(h,n),rn(n,o,n),rn(o,s,u),hd(u,n,o),dd(n,n,o),kc(s,n),dd(o,a,h),rn(n,o,RU),hd(n,n,a),rn(o,o,n),rn(n,a,h),rn(a,s,i),kc(s,u),$c(n,s,v),$c(o,a,v)}for(var p=0;p<16;p++)i[p+16]=n[p],i[p+32]=o[p],i[p+48]=s[p],i[p+64]=a[p];var B=i.subarray(32),R=i.subarray(16);qU(B,B),rn(R,R,B);var x=new Uint8Array(32);return FU(x,R),x}wr.scalarMult=Yv;function y2(r){return Yv(r,g2)}wr.scalarMultBase=y2;function m2(r){if(r.length!==wr.SECRET_KEY_LENGTH)throw new Error("x25519: seed must be "+wr.SECRET_KEY_LENGTH+" bytes");var e=new Uint8Array(r),t=y2(e);return{publicKey:t,secretKey:e}}wr.generateKeyPairFromSeed=m2;function VU(r){var e=PU.randomBytes(32,r),t=m2(e);return LU.wipe(e),t}wr.generateKeyPair=VU;function HU(r,e,t){if(t===void 0&&(t=!1),r.length!==wr.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(e.length!==wr.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");var i=Yv(r,e);if(t){for(var n=0,s=0;se[t])return 1}return r.byteLength>e.byteLength?1:r.byteLength{l()});function A2(r,e){if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t{l()});function I2(r,e){if(r.length!==e.length)throw new Error("Inputs should have the same length");let t=nu(r.length);for(let i=0;i{l();Xh()});var C2={};st(C2,{compare:()=>w2,concat:()=>Zh,equals:()=>A2,fromString:()=>Zi,toString:()=>Xi,xor:()=>I2});var S2=ye(()=>{l();E2();hv();_2();qv();Uv();b2()});var U2=D(et=>{"use strict";l();var x2=et&&et.__spreadArray||function(r,e,t){if(t||arguments.length===2)for(var i=0,n=e.length,s;i"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new P2:typeof navigator<"u"?Jv(navigator.userAgent):F2()}et.detect=KU;function L2(r){return r!==""&&GU.reduce(function(e,t){var i=t[0],n=t[1];if(e)return e;var s=n.exec(r);return!!s&&[i,s]},!1)}function zU(r){var e=L2(r);return e?e[0]:null}et.browserName=zU;function Jv(r){var e=L2(r);if(!e)return null;var t=e[0],i=e[1];if(t==="searchbot")return new M2;var n=i[1]&&i[1].split(".").join("_").split("_").slice(0,3);n?n.length{"use strict";l();Object.defineProperty(ze,"__esModule",{value:!0});ze.getLocalStorage=ze.getLocalStorageOrThrow=ze.getCrypto=ze.getCryptoOrThrow=ze.getLocation=ze.getLocationOrThrow=ze.getNavigator=ze.getNavigatorOrThrow=ze.getDocument=ze.getDocumentOrThrow=ze.getFromWindowOrThrow=ze.getFromWindow=void 0;function lo(r){let e;return typeof window<"u"&&typeof window[r]<"u"&&(e=window[r]),e}ze.getFromWindow=lo;function hu(r){let e=lo(r);if(!e)throw new Error(`${r} is not defined in Window`);return e}ze.getFromWindowOrThrow=hu;function kU(){return hu("document")}ze.getDocumentOrThrow=kU;function WU(){return lo("document")}ze.getDocument=WU;function YU(){return hu("navigator")}ze.getNavigatorOrThrow=YU;function JU(){return lo("navigator")}ze.getNavigator=JU;function XU(){return hu("location")}ze.getLocationOrThrow=XU;function ZU(){return lo("location")}ze.getLocation=ZU;function eq(){return hu("crypto")}ze.getCryptoOrThrow=eq;function tq(){return lo("crypto")}ze.getCrypto=tq;function rq(){return hu("localStorage")}ze.getLocalStorageOrThrow=rq;function iq(){return lo("localStorage")}ze.getLocalStorage=iq});var V2=D(pd=>{"use strict";l();Object.defineProperty(pd,"__esModule",{value:!0});pd.getWindowMetadata=void 0;var q2=Xv();function nq(){let r,e;try{r=q2.getDocumentOrThrow(),e=q2.getLocationOrThrow()}catch{return null}function t(){let v=r.getElementsByTagName("link"),B=[];for(let R=0;R-1){let H=x.getAttribute("href");if(H)if(H.toLowerCase().indexOf("https:")===-1&&H.toLowerCase().indexOf("http:")===-1&&H.indexOf("//")!==0){let K=e.protocol+"//"+e.host;if(H.indexOf("/")===0)K+=H;else{let ie=e.pathname.split("/");ie.pop();let k=ie.join("/");K+=k+"/"+H}B.push(K)}else if(H.indexOf("//")===0){let K=e.protocol+H;B.push(K)}else B.push(H)}}return B}function i(...v){let B=r.getElementsByTagName("meta");for(let R=0;Rx.getAttribute(H)).filter(H=>H?v.includes(H):!1);if(V.length&&V){let H=x.getAttribute("content");if(H)return H}}return""}function n(){let v=i("name","og:site_name","og:title","twitter:title");return v||(v=r.title),v}function s(){return i("description","og:description","twitter:description","keywords")}let o=n(),a=s(),u=e.origin,h=t();return{description:a,url:u,icons:h,name:o}}pd.getWindowMetadata=nq});var Q2=D((Bee,H2)=>{"use strict";l();H2.exports=r=>encodeURIComponent(r).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)});var $2=D((Pee,z2)=>{"use strict";l();var K2="%[a-f0-9]{2}",j2=new RegExp(K2,"gi"),G2=new RegExp("("+K2+")+","gi");function Zv(r,e){try{return decodeURIComponent(r.join(""))}catch{}if(r.length===1)return r;e=e||1;var t=r.slice(0,e),i=r.slice(e);return Array.prototype.concat.call([],Zv(t),Zv(i))}function sq(r){try{return decodeURIComponent(r)}catch{for(var e=r.match(j2),t=1;t{"use strict";l();k2.exports=(r,e)=>{if(!(typeof r=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[r];let t=r.indexOf(e);return t===-1?[r]:[r.slice(0,t),r.slice(t+e.length)]}});var J2=D((Uee,Y2)=>{"use strict";l();Y2.exports=function(r,e){for(var t={},i=Object.keys(r),n=Array.isArray(e),s=0;s{"use strict";l();var aq=Q2(),uq=$2(),Z2=W2(),cq=J2(),lq=r=>r==null,e1=Symbol("encodeFragmentIdentifier");function fq(r){switch(r.arrayFormat){case"index":return e=>(t,i)=>{let n=t.length;return i===void 0||r.skipNull&&i===null||r.skipEmptyString&&i===""?t:i===null?[...t,[ct(e,r),"[",n,"]"].join("")]:[...t,[ct(e,r),"[",ct(n,r),"]=",ct(i,r)].join("")]};case"bracket":return e=>(t,i)=>i===void 0||r.skipNull&&i===null||r.skipEmptyString&&i===""?t:i===null?[...t,[ct(e,r),"[]"].join("")]:[...t,[ct(e,r),"[]=",ct(i,r)].join("")];case"colon-list-separator":return e=>(t,i)=>i===void 0||r.skipNull&&i===null||r.skipEmptyString&&i===""?t:i===null?[...t,[ct(e,r),":list="].join("")]:[...t,[ct(e,r),":list=",ct(i,r)].join("")];case"comma":case"separator":case"bracket-separator":{let e=r.arrayFormat==="bracket-separator"?"[]=":"=";return t=>(i,n)=>n===void 0||r.skipNull&&n===null||r.skipEmptyString&&n===""?i:(n=n===null?"":n,i.length===0?[[ct(t,r),e,ct(n,r)].join("")]:[[i,ct(n,r)].join(r.arrayFormatSeparator)])}default:return e=>(t,i)=>i===void 0||r.skipNull&&i===null||r.skipEmptyString&&i===""?t:i===null?[...t,ct(e,r)]:[...t,[ct(e,r),"=",ct(i,r)].join("")]}}function hq(r){let e;switch(r.arrayFormat){case"index":return(t,i,n)=>{if(e=/\[(\d*)\]$/.exec(t),t=t.replace(/\[\d*\]$/,""),!e){n[t]=i;return}n[t]===void 0&&(n[t]={}),n[t][e[1]]=i};case"bracket":return(t,i,n)=>{if(e=/(\[\])$/.exec(t),t=t.replace(/\[\]$/,""),!e){n[t]=i;return}if(n[t]===void 0){n[t]=[i];return}n[t]=[].concat(n[t],i)};case"colon-list-separator":return(t,i,n)=>{if(e=/(:list)$/.exec(t),t=t.replace(/:list$/,""),!e){n[t]=i;return}if(n[t]===void 0){n[t]=[i];return}n[t]=[].concat(n[t],i)};case"comma":case"separator":return(t,i,n)=>{let s=typeof i=="string"&&i.includes(r.arrayFormatSeparator),o=typeof i=="string"&&!s&&nn(i,r).includes(r.arrayFormatSeparator);i=o?nn(i,r):i;let a=s||o?i.split(r.arrayFormatSeparator).map(u=>nn(u,r)):i===null?i:nn(i,r);n[t]=a};case"bracket-separator":return(t,i,n)=>{let s=/(\[\])$/.test(t);if(t=t.replace(/\[\]$/,""),!s){n[t]=i&&nn(i,r);return}let o=i===null?[]:i.split(r.arrayFormatSeparator).map(a=>nn(a,r));if(n[t]===void 0){n[t]=o;return}n[t]=[].concat(n[t],o)};default:return(t,i,n)=>{if(n[t]===void 0){n[t]=i;return}n[t]=[].concat(n[t],i)}}}function e3(r){if(typeof r!="string"||r.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function ct(r,e){return e.encode?e.strict?aq(r):encodeURIComponent(r):r}function nn(r,e){return e.decode?uq(r):r}function t3(r){return Array.isArray(r)?r.sort():typeof r=="object"?t3(Object.keys(r)).sort((e,t)=>Number(e)-Number(t)).map(e=>r[e]):r}function r3(r){let e=r.indexOf("#");return e!==-1&&(r=r.slice(0,e)),r}function dq(r){let e="",t=r.indexOf("#");return t!==-1&&(e=r.slice(t)),e}function i3(r){r=r3(r);let e=r.indexOf("?");return e===-1?"":r.slice(e+1)}function X2(r,e){return e.parseNumbers&&!Number.isNaN(Number(r))&&typeof r=="string"&&r.trim()!==""?r=Number(r):e.parseBooleans&&r!==null&&(r.toLowerCase()==="true"||r.toLowerCase()==="false")&&(r=r.toLowerCase()==="true"),r}function n3(r,e){e=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},e),e3(e.arrayFormatSeparator);let t=hq(e),i=Object.create(null);if(typeof r!="string"||(r=r.trim().replace(/^[?#&]/,""),!r))return i;for(let n of r.split("&")){if(n==="")continue;let[s,o]=Z2(e.decode?n.replace(/\+/g," "):n,"=");o=o===void 0?null:["comma","separator","bracket-separator"].includes(e.arrayFormat)?o:nn(o,e),t(nn(s,e),o,i)}for(let n of Object.keys(i)){let s=i[n];if(typeof s=="object"&&s!==null)for(let o of Object.keys(s))s[o]=X2(s[o],e);else i[n]=X2(s,e)}return e.sort===!1?i:(e.sort===!0?Object.keys(i).sort():Object.keys(i).sort(e.sort)).reduce((n,s)=>{let o=i[s];return Boolean(o)&&typeof o=="object"&&!Array.isArray(o)?n[s]=t3(o):n[s]=o,n},Object.create(null))}Er.extract=i3;Er.parse=n3;Er.stringify=(r,e)=>{if(!r)return"";e=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},e),e3(e.arrayFormatSeparator);let t=o=>e.skipNull&&lq(r[o])||e.skipEmptyString&&r[o]==="",i=fq(e),n={};for(let o of Object.keys(r))t(o)||(n[o]=r[o]);let s=Object.keys(n);return e.sort!==!1&&s.sort(e.sort),s.map(o=>{let a=r[o];return a===void 0?"":a===null?ct(o,e):Array.isArray(a)?a.length===0&&e.arrayFormat==="bracket-separator"?ct(o,e)+"[]":a.reduce(i(o),[]).join("&"):ct(o,e)+"="+ct(a,e)}).filter(o=>o.length>0).join("&")};Er.parseUrl=(r,e)=>{e=Object.assign({decode:!0},e);let[t,i]=Z2(r,"#");return Object.assign({url:t.split("?")[0]||"",query:n3(i3(r),e)},e&&e.parseFragmentIdentifier&&i?{fragmentIdentifier:nn(i,e)}:{})};Er.stringifyUrl=(r,e)=>{e=Object.assign({encode:!0,strict:!0,[e1]:!0},e);let t=r3(r.url).split("?")[0]||"",i=Er.extract(r.url),n=Er.parse(i,{sort:!1}),s=Object.assign(n,r.query),o=Er.stringify(s,e);o&&(o=`?${o}`);let a=dq(r.url);return r.fragmentIdentifier&&(a=`#${e[e1]?ct(r.fragmentIdentifier,e):r.fragmentIdentifier}`),`${t}${o}${a}`};Er.pick=(r,e,t)=>{t=Object.assign({parseFragmentIdentifier:!0,[e1]:!1},t);let{url:i,query:n,fragmentIdentifier:s}=Er.parseUrl(r,t);return Er.stringifyUrl({url:i,query:cq(n,e),fragmentIdentifier:s},t)};Er.exclude=(r,e,t)=>{let i=Array.isArray(e)?n=>!e.includes(n):(n,s)=>!e(n,s);return Er.pick(r,i,t)}});var o3=ye(()=>{l()});function jn(r,e,t="string"){if(!r[e]||typeof r[e]!==t)throw new Error(`Missing or invalid "${e}" param`)}function pq(r,e){let t=!0;return e.forEach(i=>{i in r||(t=!1)}),t}function gq(r,e){return Array.isArray(r)?r.length===e:Object.keys(r).length===e}function yq(r,e){return Array.isArray(r)?r.length>=e:Object.keys(r).length>=e}function Wc(r,e,t){return(!t.length?gq(r,e.length):yq(r,e.length))?pq(r,e):!1}function Yc(r,e,t="_"){let i=r.split(t);return i[i.length-1].trim().toLowerCase()===e.trim().toLowerCase()}var t1=ye(()=>{l()});function mq(r){return gd(r.method)&&yd(r.params)}function gd(r){return Yc(r,"subscribe")}function yd(r){return Wc(r,["topic"],[])}function vq(r){return md(r.method)&&vd(r.params)}function md(r){return Yc(r,"publish")}function vd(r){return Wc(r,["message","topic","ttl"],["prompt","tag"])}function wq(r){return wd(r.method)&&Ed(r.params)}function wd(r){return Yc(r,"unsubscribe")}function Ed(r){return Wc(r,["id","topic"],[])}function Eq(r){return Ad(r.method)&&_d(r.params)}function Ad(r){return Yc(r,"subscription")}function _d(r){return Wc(r,["id","data"],[])}var r1=ye(()=>{l();t1()});function Aq(r){if(!gd(r.method))throw new Error("JSON-RPC Request has invalid subscribe method");if(!yd(r.params))throw new Error("JSON-RPC Request has invalid subscribe params");let e=r.params;return jn(e,"topic"),e}function _q(r){if(!md(r.method))throw new Error("JSON-RPC Request has invalid publish method");if(!vd(r.params))throw new Error("JSON-RPC Request has invalid publish params");let e=r.params;return jn(e,"topic"),jn(e,"message"),jn(e,"ttl","number"),e}function Iq(r){if(!wd(r.method))throw new Error("JSON-RPC Request has invalid unsubscribe method");if(!Ed(r.params))throw new Error("JSON-RPC Request has invalid unsubscribe params");let e=r.params;return jn(e,"id"),e}function bq(r){if(!Ad(r.method))throw new Error("JSON-RPC Request has invalid subscription method");if(!_d(r.params))throw new Error("JSON-RPC Request has invalid subscription params");let e=r.params;return jn(e,"id"),jn(e,"data"),e}var a3=ye(()=>{l();t1();r1()});var Cq,u3=ye(()=>{l();Cq={waku:{publish:"waku_publish",subscribe:"waku_subscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe"},irn:{publish:"irn_publish",subscribe:"irn_subscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe"},iridium:{publish:"iridium_publish",subscribe:"iridium_subscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe"}}});var c3={};st(c3,{RELAY_JSONRPC:()=>Cq,isPublishMethod:()=>md,isPublishParams:()=>vd,isPublishRequest:()=>vq,isSubscribeMethod:()=>gd,isSubscribeParams:()=>yd,isSubscribeRequest:()=>mq,isSubscriptionMethod:()=>Ad,isSubscriptionParams:()=>_d,isSubscriptionRequest:()=>Eq,isUnsubscribeMethod:()=>wd,isUnsubscribeParams:()=>Ed,isUnsubscribeRequest:()=>wq,parsePublishRequest:()=>_q,parseSubscribeRequest:()=>Aq,parseSubscriptionRequest:()=>bq,parseUnsubscribeRequest:()=>Iq});var l3=ye(()=>{l();o3();a3();u3();r1()});var Dd=D(ne=>{"use strict";l();Object.defineProperty(ne,"__esModule",{value:!0});var m3=o2(),Sq=h2(),v3=Hh(),u1=p2(),xq=v2(),tt=(S2(),ti(C2)),Tq=U2(),pu=ro(),Jc=Xv(),Nq=V2(),Dq=s3(),Oq=(l3(),ti(c3));function w3(r){if(r&&r.__esModule)return r;var e=Object.create(null);return r&&Object.keys(r).forEach(function(t){if(t!=="default"){var i=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:function(){return r[t]}})}}),e.default=r,Object.freeze(e)}var E3=w3(xq),Id=w3(Dq),Sd=":";function A3(r){let[e,t]=r.split(Sd);return{namespace:e,reference:t}}function _3(r){let{namespace:e,reference:t}=r;return[e,t].join(Sd)}function c1(r){let[e,t,i]=r.split(Sd);return{namespace:e,reference:t,address:i}}function I3(r){let{namespace:e,reference:t,address:i}=r;return[e,t,i].join(Sd)}function l1(r,e){let t=[];return r.forEach(i=>{let n=e(i);t.includes(n)||t.push(n)}),t}function b3(r){let{address:e}=c1(r);return e}function C3(r){let{namespace:e,reference:t}=c1(r);return _3({namespace:e,reference:t})}function Bq(r,e){let{namespace:t,reference:i}=A3(e);return I3({namespace:t,reference:i,address:r})}function Mq(r){return l1(r,b3)}function S3(r){return l1(r,C3)}function Pq(r,e=[]){let t=[];return Object.keys(r).forEach(i=>{if(e.length&&!e.includes(i))return;let n=r[i];t.push(...n.accounts)}),t}function Lq(r,e=[]){let t=[];return Object.keys(r).forEach(i=>{if(e.length&&!e.includes(i))return;let n=r[i];t.push(...S3(n.accounts))}),t}function Rq(r,e=[]){let t=[];return Object.keys(r).forEach(i=>{if(e.length&&!e.includes(i))return;let n=r[i];t.push(...n.chains)}),t}var f1="base10",fr="base16",bd="base64pad",xd="utf8",h1=0,gu=1,Fq=0,f3=1,i1=12,d1=32;function Uq(){let r=E3.generateKeyPair();return{privateKey:tt.toString(r.secretKey,fr),publicKey:tt.toString(r.publicKey,fr)}}function qq(){let r=v3.randomBytes(d1);return tt.toString(r,fr)}function Vq(r,e){let t=E3.sharedKey(tt.fromString(r,fr),tt.fromString(e,fr)),i=new Sq.HKDF(u1.SHA256,t).expand(d1);return tt.toString(i,fr)}function Hq(r){let e=u1.hash(tt.fromString(r,fr));return tt.toString(e,fr)}function Qq(r){let e=u1.hash(tt.fromString(r,xd));return tt.toString(e,fr)}function x3(r){return tt.fromString(`${r}`,f1)}function Xc(r){return Number(tt.toString(r,f1))}function jq(r){let e=x3(typeof r.type<"u"?r.type:h1);if(Xc(e)===gu&&typeof r.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");let t=typeof r.senderPublicKey<"u"?tt.fromString(r.senderPublicKey,fr):void 0,i=typeof r.iv<"u"?tt.fromString(r.iv,fr):v3.randomBytes(i1),n=new m3.ChaCha20Poly1305(tt.fromString(r.symKey,fr)).seal(i,tt.fromString(r.message,xd));return T3({type:e,sealed:n,iv:i,senderPublicKey:t})}function Gq(r){let e=new m3.ChaCha20Poly1305(tt.fromString(r.symKey,fr)),{sealed:t,iv:i}=p1(r.encoded),n=e.open(i,t);if(n===null)throw new Error("Failed to decrypt");return tt.toString(n,xd)}function T3(r){if(Xc(r.type)===gu){if(typeof r.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return tt.toString(tt.concat([r.type,r.senderPublicKey,r.iv,r.sealed]),bd)}return tt.toString(tt.concat([r.type,r.iv,r.sealed]),bd)}function p1(r){let e=tt.fromString(r,bd),t=e.slice(Fq,f3),i=f3;if(Xc(t)===gu){let a=i+d1,u=a+i1,h=e.slice(i,a),p=e.slice(a,u),v=e.slice(u);return{type:t,sealed:v,iv:p,senderPublicKey:h}}let n=i+i1,s=e.slice(i,n),o=e.slice(n);return{type:t,sealed:o,iv:s}}function Kq(r,e){let t=p1(r);return N3({type:Xc(t.type),senderPublicKey:typeof t.senderPublicKey<"u"?tt.toString(t.senderPublicKey,fr):void 0,receiverPublicKey:e?.receiverPublicKey})}function N3(r){let e=r?.type||h1;if(e===gu){if(typeof r?.senderPublicKey>"u")throw new Error("missing sender public key");if(typeof r?.receiverPublicKey>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:r?.senderPublicKey,receiverPublicKey:r?.receiverPublicKey}}function zq(r){return r.type===gu&&typeof r.senderPublicKey=="string"&&typeof r.receiverPublicKey=="string"}var $q=Object.defineProperty,h3=Object.getOwnPropertySymbols,kq=Object.prototype.hasOwnProperty,Wq=Object.prototype.propertyIsEnumerable,d3=(r,e,t)=>e in r?$q(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,p3=(r,e)=>{for(var t in e||(e={}))kq.call(e,t)&&d3(r,t,e[t]);if(h3)for(var t of h3(e))Wq.call(e,t)&&d3(r,t,e[t]);return r},D3="ReactNative",du={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},Cd=" ",Yq=":",O3="/",g1=2,Jq=1e3,B3="js";function y1(){return typeof I.default<"u"&&typeof I.default.versions<"u"&&typeof I.default.versions.node<"u"}function M3(){return!Jc.getDocument()&&!!Jc.getNavigator()&&navigator.product===D3}function P3(){return!y1()&&!!Jc.getNavigator()}function m1(){return M3()?du.reactNative:y1()?du.node:P3()?du.browser:du.unknown}function L3(r,e){let t=Id.parse(r);return t=p3(p3({},t),e),r=Id.stringify(t),r}function Xq(){return Nq.getWindowMetadata()||{name:"",description:"",url:"",icons:[""]}}function Zq(r,e){var t;let i=m1(),n={protocol:r,version:e,env:i};return i==="browser"&&(n.host=((t=Jc.getLocation())==null?void 0:t.host)||"unknown"),n}function R3(){let r=Tq.detect();if(r===null)return"unknown";let e=r.os?r.os.replace(" ","").toLowerCase():"unknown";return r.type==="browser"?[e,r.name,r.version].join("-"):[e,r.version].join("-")}function F3(){var r;let e=m1();return e===du.browser?[e,((r=Jc.getLocation())==null?void 0:r.host)||"unknown"].join(":"):e}function U3(r,e,t){let i=R3(),n=F3();return[[r,e].join("-"),[B3,t].join("-"),i,n].join("/")}function eV({protocol:r,version:e,relayUrl:t,sdkVersion:i,auth:n,projectId:s}){let o=t.split("?"),a=U3(r,e,i),u={auth:n,ua:a,projectId:s},h=L3(o[1]||"",u);return o[0]+"?"+h}function tV(r){let e=(r.match(/^[^:]+(?=:\/\/)/gi)||[])[0],t=typeof e<"u"?r.split("://")[1]:r;return e=e==="wss"?"https":"http",[e,t].join("://")}function rV(r,e,t){if(!r[e]||typeof r[e]!==t)throw new Error(`Missing or invalid "${e}" param`)}function q3(r,e=g1){return V3(r.split(O3),e)}function iV(r){return q3(r).join(Cd)}function lr(r,e){return r.filter(t=>e.includes(t)).length===r.length}function V3(r,e=g1){return r.slice(Math.max(r.length-e,0))}function nV(r){return Object.fromEntries(r.entries())}function sV(r){return new Map(Object.entries(r))}function oV(r,e){let t={};return Object.keys(r).forEach(i=>{t[i]=e(r[i])}),t}var aV=r=>r;function H3(r){return r.trim().replace(/^\w/,e=>e.toUpperCase())}function uV(r){return r.split(Cd).map(e=>H3(e)).join(Cd)}function cV(r,e){return pu.fromMiliseconds((e||Date.now())+pu.toMiliseconds(r))}function lV(r){return pu.fromMiliseconds(Date.now())>=pu.toMiliseconds(r)}function fV(){let r=pu.toMiliseconds(pu.FIVE_MINUTES),e,t,i;return{resolve:n=>{i&&e&&(clearTimeout(i),e(n))},reject:n=>{i&&t&&(clearTimeout(i),t(n))},done:()=>new Promise((n,s)=>{i=setTimeout(s,r),e=n,t=s})}}function v1(r,e){if(typeof e=="string"&&e.startsWith(`${r}:`))return e;if(r.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(r.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: ${r}`)}function hV(r){return v1("topic",r)}function dV(r){return v1("id",r)}function pV(r){let[e,t]=r.split(":"),i={id:void 0,topic:void 0};if(e==="topic"&&typeof t=="string")i.topic=t;else if(e==="id"&&Number.isInteger(Number(t)))i.id=Number(t);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${t}`);return i}function gV(r,e){return`${r}${e?`:${e}`:""}`}var Q3="irn";function yV(r){return r?.relay||{protocol:Q3}}function mV(r){let e=Oq.RELAY_JSONRPC[r];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${r}`);return e}var vV=Object.defineProperty,g3=Object.getOwnPropertySymbols,wV=Object.prototype.hasOwnProperty,EV=Object.prototype.propertyIsEnumerable,y3=(r,e,t)=>e in r?vV(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,AV=(r,e)=>{for(var t in e||(e={}))wV.call(e,t)&&y3(r,t,e[t]);if(g3)for(var t of g3(e))EV.call(e,t)&&y3(r,t,e[t]);return r};function j3(r,e="-"){let t={},i="relay"+e;return Object.keys(r).forEach(n=>{if(n.startsWith(i)){let s=n.replace(i,""),o=r[n];t[s]=o}}),t}function _V(r){let e=r.indexOf(":"),t=r.indexOf("?")!==-1?r.indexOf("?"):void 0,i=r.substring(0,e),n=r.substring(e+1,t).split("@"),s=typeof t<"u"?r.substring(t):"",o=Id.parse(s);return{protocol:i,topic:n[0],version:parseInt(n[1],10),symKey:o.symKey,relay:j3(o)}}function G3(r,e="-"){let t="relay",i={};return Object.keys(r).forEach(n=>{let s=t+e+n;r[n]&&(i[s]=r[n])}),i}function IV(r){return`${r.protocol}:${r.topic}@${r.version}?`+Id.stringify(AV({symKey:r.symKey},G3(r.relay)))}function Xr(r){let e=[];return r.forEach(t=>{let[i,n]=t.split(":");e.push(`${i}:${n}`)}),e}function K3(r){let e=[];return Object.values(r).forEach(t=>{e.push(...Xr(t.accounts)),t.extension&&t.extension.forEach(i=>{e.push(...Xr(i.accounts))})}),e}function z3(r,e){let t=[];return Object.values(r).forEach(i=>{Xr(i.accounts).includes(e)&&t.push(...i.methods),i.extension&&i.extension.forEach(n=>{Xr(n.accounts).includes(e)&&t.push(...n.methods)})}),t}function $3(r,e){let t=[];return Object.values(r).forEach(i=>{Xr(i.accounts).includes(e)&&t.push(...i.events),i.extension&&i.extension.forEach(n=>{Xr(n.accounts).includes(e)&&t.push(...n.events)})}),t}var bV={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}},CV={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 Jr(r,e){let{message:t,code:i}=CV[r];return{message:e?`${t} ${e}`:t,code:i}}function fo(r,e){let{message:t,code:i}=bV[r];return{message:e?`${t} ${e}`:t,code:i}}function yu(r,e){return Array.isArray(r)?typeof e<"u"&&r.length?r.every(e):!0:!1}function w1(r){return Object.getPrototypeOf(r)===Object.prototype&&Object.keys(r).length}function sn(r){return typeof r>"u"}function Cr(r,e){return e&&sn(r)?!0:typeof r=="string"&&Boolean(r.trim().length)}function E1(r,e){return e&&sn(r)?!0:typeof r=="number"&&!isNaN(r)}function SV(r,e){let{requiredNamespaces:t}=e,i=Object.keys(r.namespaces),n=Object.keys(t),s=!0;return lr(n,i)?(i.forEach(o=>{let{accounts:a,methods:u,events:h,extension:p}=r.namespaces[o],v=Xr(a),B=t[o];(!lr(B.chains,v)||!lr(B.methods,u)||!lr(B.events,h))&&(s=!1),s&&p&&p.forEach(R=>{var x;let{accounts:V,methods:H,events:K}=R,ie=Xr(V);(x=B.extension)!=null&&x.find(k=>lr(k.chains,ie)&&lr(k.methods,H)&&lr(k.events,K))||(s=!1)})}),s):!1}function Td(r){return Cr(r,!1)&&r.includes(":")?r.split(":").length===2:!1}function k3(r){if(Cr(r,!1)&&r.includes(":")){let e=r.split(":");if(e.length===3){let t=e[0]+":"+e[1];return!!e[2]&&Td(t)}}return!1}function xV(r){if(Cr(r,!1))try{return typeof new URL(r)<"u"}catch{return!1}return!1}function TV(r){var e;return(e=r?.proposer)==null?void 0:e.publicKey}function NV(r){return r?.topic}function DV(r,e){let t=null;return Cr(r?.publicKey,!1)||(t=Jr("MISSING_OR_INVALID",`${e} controller public key should be a string`)),t}function Nd(r,e){let t=null;return sn(r?.extension)||(!yu(r.extension)||!r.extension.length)&&(t=Jr("MISSING_OR_INVALID",`${e} extension should be an array of namespaces, or omitted`)),t}function n1(r){let e=!0;return yu(r)?r.length&&(e=r.every(t=>Cr(t,!1))):e=!1,e}function s1(r,e,t){let i=null;return yu(e)?e.forEach(n=>{i||(!Td(n)||!n.includes(r))&&(i=fo("UNSUPPORTED_CHAINS",`${t}, chain ${n} should be a string and conform to "namespace:chainId" format`))}):i=fo("UNSUPPORTED_CHAINS",`${t}, chains ${e} should be an array of strings conforming to "namespace:chainId" format`),i}function W3(r,e){let t=null;return Object.entries(r).forEach(([i,n])=>{if(t)return;let s=s1(i,n?.chains,`${e} requiredNamespace`),o=Nd(n,e);s?t=s:o?t=o:n.extension&&n.extension.forEach(a=>{if(t)return;let u=s1(i,a.chains,`${e} extension`);u&&(t=u)})}),t}function o1(r,e){let t=null;return yu(r)?r.forEach(i=>{t||k3(i)||(t=fo("UNSUPPORTED_ACCOUNTS",`${e}, account ${i} should be a string and conform to "namespace:chainId:address" format`))}):t=fo("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),t}function Y3(r,e){let t=null;return Object.values(r).forEach(i=>{if(t)return;let n=o1(i?.accounts,`${e} namespace`),s=Nd(i,e);n?t=n:s?t=s:i.extension&&i.extension.forEach(o=>{if(t)return;let a=o1(o.accounts,`${e} extension`);a&&(t=a)})}),t}function a1(r,e){let t=null;return n1(r?.methods)?n1(r?.events)||(t=fo("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):t=fo("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),t}function A1(r,e){let t=null;return Object.values(r).forEach(i=>{if(t)return;let n=a1(i,`${e}, namespace`),s=Nd(i,e);n?t=n:s?t=s:i.extension&&i.extension.forEach(o=>{if(t)return;let a=a1(o,`${e}, extension`);a&&(t=a)})}),t}function OV(r,e){let t=null;if(r&&w1(r)){let i=A1(r,e);i&&(t=i);let n=W3(r,e);n&&(t=n)}else t=Jr("MISSING_OR_INVALID",`${e}, requiredNamespaces should be an object with data`);return t}function BV(r,e){let t=null;if(r&&w1(r)){let i=A1(r,e);i&&(t=i);let n=Y3(r,e);n&&(t=n)}else t=Jr("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return t}function J3(r){return Cr(r.protocol,!0)}function MV(r,e){let t=!1;return e&&!r?t=!0:r&&yu(r)&&r.length&&r.forEach(i=>{t=J3(i)}),t}function PV(r){return typeof r=="number"}function LV(r){return typeof r<"u"&&typeof r!==null}function RV(r){return!(!r||typeof r!="object"||!r.code||!E1(r.code,!1)||!r.message||!Cr(r.message,!1))}function FV(r){return!(sn(r)||!Cr(r.method,!1))}function UV(r){return!(sn(r)||sn(r.result)&&sn(r.error)||!E1(r.id,!1)||!Cr(r.jsonrpc,!1))}function qV(r){return!(sn(r)||!Cr(r.name,!1))}function VV(r,e){return!(!Td(e)||!K3(r).includes(e))}function HV(r,e,t){return Cr(t,!1)?z3(r,e).includes(t):!1}function QV(r,e,t){return Cr(t,!1)?$3(r,e).includes(t):!1}function jV(r,e,t){let i=null,n=Object.keys(r),s=Object.keys(e);return lr(n,s)?n.forEach(o=>{var a;if(i)return;let u=r[o].chains,h=Xr(e[o].accounts);lr(u,h)?lr(r[o].methods,e[o].methods)?lr(r[o].events,e[o].events)?r[o].extension&&!e[o].extension?i=Jr("NON_CONFORMING_NAMESPACES",`${t} namespaces extension doesn't satisfy requiredNamespaces extension for ${o}`):r[o].extension&&e[o].extension&&((a=r[o].extension)==null||a.forEach(({methods:p,events:v,chains:B})=>{var R;i||(R=e[o].extension)!=null&&R.find(x=>{let V=Xr(x.accounts);return lr(B,V)&&lr(v,x.events)&&lr(p,x.methods)})||(i=Jr("NON_CONFORMING_NAMESPACES",`${t} namespaces extension doesn't satisfy requiredNamespaces extension for ${o}`))})):i=Jr("NON_CONFORMING_NAMESPACES",`${t} namespaces events don't satisfy requiredNamespaces events for ${o}`):i=Jr("NON_CONFORMING_NAMESPACES",`${t} namespaces methods don't satisfy requiredNamespaces methods for ${o}`):i=Jr("NON_CONFORMING_NAMESPACES",`${t} namespaces accounts don't satisfy requiredNamespaces chains for ${o}`)}):i=Jr("NON_CONFORMING_NAMESPACES",`${t} namespaces keys don't satisfy requiredNamespaces`),i}ne.BASE10=f1,ne.BASE16=fr,ne.BASE64=bd,ne.COLON=Yq,ne.DEFAULT_DEPTH=g1,ne.EMPTY_SPACE=Cd,ne.ENV_MAP=du,ne.ONE_THOUSAND=Jq,ne.REACT_NATIVE_PRODUCT=D3,ne.RELAYER_DEFAULT_PROTOCOL=Q3,ne.SDK_TYPE=B3,ne.SLASH=O3,ne.TYPE_0=h1,ne.TYPE_1=gu,ne.UTF8=xd,ne.appendToQueryString=L3,ne.assertType=rV,ne.calcExpiry=cV,ne.capitalize=uV,ne.capitalizeWord=H3,ne.createDelayedPromise=fV,ne.decodeTypeByte=Xc,ne.decrypt=Gq,ne.deriveSymKey=Vq,ne.deserialize=p1,ne.encodeTypeByte=x3,ne.encrypt=jq,ne.engineEvent=gV,ne.enumify=aV,ne.formatAccountId=I3,ne.formatAccountWithChain=Bq,ne.formatChainId=_3,ne.formatExpirerTarget=v1,ne.formatIdTarget=dV,ne.formatMessageContext=iV,ne.formatRelayParams=G3,ne.formatRelayRpcUrl=eV,ne.formatTopicTarget=hV,ne.formatUA=U3,ne.formatUri=IV,ne.generateKeyPair=Uq,ne.generateRandomBytes32=qq,ne.getAccountsChains=Xr,ne.getAccountsFromNamespaces=Pq,ne.getAddressFromAccount=b3,ne.getAddressesFromAccounts=Mq,ne.getAppMetadata=Xq,ne.getChainFromAccount=C3,ne.getChainsFromAccounts=S3,ne.getChainsFromNamespaces=Lq,ne.getChainsFromRequiredNamespaces=Rq,ne.getEnvironment=m1,ne.getHttpUrl=tV,ne.getInternalError=Jr,ne.getJavascriptID=F3,ne.getJavascriptOS=R3,ne.getLastItems=V3,ne.getNamespacesChains=K3,ne.getNamespacesEventsForChainId=$3,ne.getNamespacesMethodsForChainId=z3,ne.getRelayClientMetadata=Zq,ne.getRelayProtocolApi=mV,ne.getRelayProtocolName=yV,ne.getSdkError=fo,ne.getUniqueValues=l1,ne.hasOverlap=lr,ne.hashKey=Hq,ne.hashMessage=Qq,ne.isBrowser=P3,ne.isConformingNamespaces=jV,ne.isExpired=lV,ne.isNode=y1,ne.isProposalStruct=TV,ne.isReactNative=M3,ne.isSessionCompatible=SV,ne.isSessionStruct=NV,ne.isTypeOneEnvelope=zq,ne.isUndefined=sn,ne.isValidAccountId=k3,ne.isValidAccounts=o1,ne.isValidActions=a1,ne.isValidArray=yu,ne.isValidChainId=Td,ne.isValidChains=s1,ne.isValidController=DV,ne.isValidErrorReason=RV,ne.isValidEvent=qV,ne.isValidExtension=Nd,ne.isValidId=PV,ne.isValidNamespaceAccounts=Y3,ne.isValidNamespaceActions=A1,ne.isValidNamespaceChains=W3,ne.isValidNamespaceMethodsOrEvents=n1,ne.isValidNamespaces=BV,ne.isValidNamespacesChainId=VV,ne.isValidNamespacesEvent=QV,ne.isValidNamespacesRequest=HV,ne.isValidNumber=E1,ne.isValidObject=w1,ne.isValidParams=LV,ne.isValidRelay=J3,ne.isValidRelays=MV,ne.isValidRequest=FV,ne.isValidRequiredNamespaces=OV,ne.isValidResponse=UV,ne.isValidString=Cr,ne.isValidUrl=xV,ne.mapEntries=oV,ne.mapToObj=nV,ne.objToMap=sV,ne.parseAccountId=c1,ne.parseChainId=A3,ne.parseContextNames=q3,ne.parseExpirerTarget=pV,ne.parseRelayParams=j3,ne.parseUri=_V,ne.serialize=T3,ne.validateDecoding=Kq,ne.validateEncoding=N3});var X3,Z3,eT,tT,Od,Zc,_1,Bd,Gn,el,Md=ye(()=>{l();X3="PARSE_ERROR",Z3="INVALID_REQUEST",eT="METHOD_NOT_FOUND",tT="INVALID_PARAMS",Od="INTERNAL_ERROR",Zc="SERVER_ERROR",_1=[-32700,-32600,-32601,-32602,-32603],Bd=[-32e3,-32099],Gn={[X3]:{code:-32700,message:"Parse error"},[Z3]:{code:-32600,message:"Invalid Request"},[eT]:{code:-32601,message:"Method not found"},[tT]:{code:-32602,message:"Invalid params"},[Od]:{code:-32603,message:"Internal error"},[Zc]:{code:-32e3,message:"Server error"}},el=Zc});function GV(r){return r<=Bd[0]&&r>=Bd[1]}function Pd(r){return _1.includes(r)}function rT(r){return typeof r=="number"}function Ld(r){return Object.keys(Gn).includes(r)?Gn[r]:Gn[el]}function Rd(r){let e=Object.values(Gn).find(t=>t.code===r);return e||Gn[el]}function KV(r){if(typeof r.error.code>"u")return{valid:!1,error:"Missing code for JSON-RPC error"};if(typeof r.error.message>"u")return{valid:!1,error:"Missing message for JSON-RPC error"};if(!rT(r.error.code))return{valid:!1,error:`Invalid error code type for JSON-RPC: ${r.error.code}`};if(Pd(r.error.code)){let e=Rd(r.error.code);if(e.message!==Gn[el].message&&r.error.message===e.message)return{valid:!1,error:`Invalid error code message for JSON-RPC: ${r.error.code}`}}return{valid:!0}}function I1(r,e,t){return r.message.includes("getaddrinfo ENOTFOUND")||r.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${t} RPC url at ${e}`):r}var b1=ye(()=>{l();Md()});var nT=D(Kn=>{"use strict";l();Object.defineProperty(Kn,"__esModule",{value:!0});Kn.isBrowserCryptoAvailable=Kn.getSubtleCrypto=Kn.getBrowerCrypto=void 0;function C1(){return(global===null||global===void 0?void 0:global.crypto)||(global===null||global===void 0?void 0:global.msCrypto)||{}}Kn.getBrowerCrypto=C1;function iT(){let r=C1();return r.subtle||r.webkitSubtle}Kn.getSubtleCrypto=iT;function zV(){return!!C1()&&!!iT()}Kn.isBrowserCryptoAvailable=zV});var aT=D(zn=>{"use strict";l();Object.defineProperty(zn,"__esModule",{value:!0});zn.isBrowser=zn.isNode=zn.isReactNative=void 0;function sT(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}zn.isReactNative=sT;function oT(){return typeof I.default<"u"&&typeof I.default.versions<"u"&&typeof I.default.versions.node<"u"}zn.isNode=oT;function $V(){return!sT()&&!oT()}zn.isBrowser=$V});var S1=D($n=>{"use strict";l();var kV=$n&&$n.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),uT=$n&&$n.__exportStar||function(r,e){for(var t in r)t!=="default"&&!e.hasOwnProperty(t)&&kV(e,r,t)};Object.defineProperty($n,"__esModule",{value:!0});uT(nT(),$n);uT(aT(),$n)});var zt={};st(zt,{isNodeJs:()=>lT});var cT,lT,fT=ye(()=>{l();cT=_e(S1());Xt(zt,_e(S1()));lT=cT.isNode});function hT(){let r=Date.now()*Math.pow(10,3),e=Math.floor(Math.random()*Math.pow(10,3));return r+e}function x1(r,e,t){return{id:t||hT(),jsonrpc:"2.0",method:r,params:e}}function WV(r,e){return{id:r,jsonrpc:"2.0",result:e}}function T1(r,e,t){return{id:r,jsonrpc:"2.0",error:dT(e,t)}}function dT(r,e){return typeof r>"u"?Ld(Od):(typeof r=="string"&&(r=Object.assign(Object.assign({},Ld(Zc)),{message:r})),typeof e<"u"&&(r.data=e),Pd(r.code)&&(r=Rd(r.code)),r)}var pT=ye(()=>{l();b1();Md()});function YV(r){return r.includes("*")?Ud(r):!/\W/g.test(r)}function Fd(r){return r==="*"}function Ud(r){return Fd(r)?!0:!(!r.includes("*")||r.split("*").length!==2||r.split("*").filter(e=>e.trim()==="").length!==1)}function JV(r){return!Fd(r)&&Ud(r)&&!r.split("*")[0].trim()}function XV(r){return!Fd(r)&&Ud(r)&&!r.split("*")[1].trim()}var gT=ye(()=>{l()});var yT=ye(()=>{l()});var mu,N1=ye(()=>{l();mu=class{}});var D1,qd,tl,mT=ye(()=>{l();N1();D1=class extends mu{constructor(e){super()}},qd=class extends mu{constructor(){super()}},tl=class extends qd{constructor(e){super()}}});var vT=ye(()=>{l()});var wT=ye(()=>{l();yT();N1();mT();vT()});var ET=ye(()=>{l();wT()});function t7(r){let e=r.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function AT(r,e){let t=t7(r);return typeof t>"u"?!1:new RegExp(e).test(t)}function r7(r){return AT(r,ZV)}function Vd(r){return AT(r,e7)}function O1(r){return new RegExp("wss?://localhost(:d{2,5})?").test(r)}var ZV,e7,_T=ye(()=>{l();ZV="^https?:",e7="^wss?:"});function B1(r){return typeof r=="object"&&"id"in r&&"jsonrpc"in r&&r.jsonrpc==="2.0"}function i7(r){return B1(r)&&"method"in r}function M1(r){return B1(r)&&(IT(r)||Hd(r))}function IT(r){return"result"in r}function Hd(r){return"error"in r}function n7(r){return"error"in r&&r.valid===!1}var bT=ye(()=>{l()});var ar={};st(ar,{DEFAULT_ERROR:()=>el,IBaseJsonRpcProvider:()=>qd,IEvents:()=>mu,IJsonRpcConnection:()=>D1,IJsonRpcProvider:()=>tl,INTERNAL_ERROR:()=>Od,INVALID_PARAMS:()=>tT,INVALID_REQUEST:()=>Z3,METHOD_NOT_FOUND:()=>eT,PARSE_ERROR:()=>X3,RESERVED_ERROR_CODES:()=>_1,SERVER_ERROR:()=>Zc,SERVER_ERROR_CODE_RANGE:()=>Bd,STANDARD_ERROR_MAP:()=>Gn,formatErrorMessage:()=>dT,formatJsonRpcError:()=>T1,formatJsonRpcRequest:()=>x1,formatJsonRpcResult:()=>WV,getError:()=>Ld,getErrorByCode:()=>Rd,isHttpUrl:()=>r7,isJsonRpcError:()=>Hd,isJsonRpcPayload:()=>B1,isJsonRpcRequest:()=>i7,isJsonRpcResponse:()=>M1,isJsonRpcResult:()=>IT,isJsonRpcValidationInvalid:()=>n7,isLocalhostUrl:()=>O1,isNodeJs:()=>lT,isReservedErrorCode:()=>Pd,isServerErrorCode:()=>GV,isValidDefaultRoute:()=>Fd,isValidErrorCode:()=>rT,isValidLeadingWildcardRoute:()=>JV,isValidRoute:()=>YV,isValidTrailingWildcardRoute:()=>XV,isValidWildcardRoute:()=>Ud,isWsUrl:()=>Vd,parseConnectionError:()=>I1,payloadId:()=>hT,validateJsonRpcError:()=>KV});var rl=ye(()=>{l();Md();b1();fT();Xt(ar,zt);pT();gT();ET();_T();bT()});var CT,Qd,ST,P1=ye(()=>{l();CT=_e(Th());rl();Qd=class extends tl{constructor(e){super(e),this.events=new CT.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,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async request(e,t){return this.requestStrict(x1(e.method,e.params||[]),t)}async requestStrict(e,t){return new Promise(async(i,n)=>{if(!this.connection.connected)try{await this.open()}catch(s){n(s)}this.events.on(`${e.id}`,s=>{Hd(s)?n(s.error):i(s.result)});try{await this.connection.send(e,t)}catch(s){n(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),M1(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}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",()=>this.events.emit("disconnect")),this.connection.on("error",e=>this.events.emit("error",e)),this.hasRegisteredEventListeners=!0)}},ST=Qd});var xT={};st(xT,{JsonRpcProvider:()=>Qd,default:()=>s7});var s7,TT=ye(()=>{l();P1();P1();s7=ST});var DT=D((are,NT)=>{"use strict";l();NT.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}});var BT,OT,o7,jd,MT,L1=ye(()=>{l();BT=_e(Th());Lh();rl();OT=10,o7=typeof global.WebSocket<"u"?global.WebSocket:DT(),jd=class{constructor(e){if(this.url=e,this.events=new BT.EventEmitter,this.registering=!1,!Vd(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,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(e=this.url){await this.register(e)}async close(){if(typeof this.socket>"u")throw new Error("Connection already closed");this.socket.close(),this.onClose()}async send(e,t){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(Lc(e))}catch(i){this.onError(e.id,i)}}register(e=this.url){if(!Vd(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){let t=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=t||this.events.listenerCount("open")>=t)&&this.events.setMaxListeners(t+1),new Promise((i,n)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),n(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return n(new Error("WebSocket connection is missing or invalid"));i(this.socket)})})}return this.url=e,this.registering=!0,new Promise((t,i)=>{let n=(0,ar.isReactNative)()?void 0:{rejectUnauthorized:!O1(e)},s=new o7(e,[],n);s.onopen=()=>{this.onOpen(s),t(s)},s.onerror=o=>{let a=this.parseError(o.error);this.events.emit("register_error",a),this.onClose(),i(a)}})}onOpen(e){e.onmessage=t=>this.onPayload(t),e.onclose=()=>this.onClose(),e.onerror=t=>{let i=this.parseError(t.error);this.events.emit("error",i)},this.socket=e,this.registering=!1,this.events.emit("open")}onClose(){this.socket=void 0,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;let t=typeof e.data=="string"?Pc(e.data):e.data;this.events.emit("payload",t)}onError(e,t){let i=this.parseError(t),n=i.message||i.toString(),s=T1(e,n);this.events.emit("payload",s)}parseError(e,t=this.url){return I1(e,t,"WS")}resetMaxListeners(){this.events.getMaxListeners()>OT&&this.events.setMaxListeners(OT)}},MT=jd});var PT={};st(PT,{WsConnection:()=>jd,default:()=>a7});var a7,LT=ye(()=>{l();L1();L1();a7=MT});var yN=D((il,wu)=>{l();var u7=200,z1="__lodash_hash_undefined__",Jd=1,$T=2,kT=9007199254740991,Gd="[object Arguments]",q1="[object Array]",c7="[object AsyncFunction]",WT="[object Boolean]",YT="[object Date]",JT="[object Error]",XT="[object Function]",l7="[object GeneratorFunction]",Kd="[object Map]",ZT="[object Number]",f7="[object Null]",vu="[object Object]",RT="[object Promise]",h7="[object Proxy]",eN="[object RegExp]",zd="[object Set]",tN="[object String]",d7="[object Symbol]",p7="[object Undefined]",V1="[object WeakMap]",rN="[object ArrayBuffer]",$d="[object DataView]",g7="[object Float32Array]",y7="[object Float64Array]",m7="[object Int8Array]",v7="[object Int16Array]",w7="[object Int32Array]",E7="[object Uint8Array]",A7="[object Uint8ClampedArray]",_7="[object Uint16Array]",I7="[object Uint32Array]",b7=/[\\^$.*+?()[\]{}|]/g,C7=/^\[object .+?Constructor\]$/,S7=/^(?:0|[1-9]\d*)$/,Ye={};Ye[g7]=Ye[y7]=Ye[m7]=Ye[v7]=Ye[w7]=Ye[E7]=Ye[A7]=Ye[_7]=Ye[I7]=!0;Ye[Gd]=Ye[q1]=Ye[rN]=Ye[WT]=Ye[$d]=Ye[YT]=Ye[JT]=Ye[XT]=Ye[Kd]=Ye[ZT]=Ye[vu]=Ye[eN]=Ye[zd]=Ye[tN]=Ye[V1]=!1;var iN=typeof global=="object"&&global&&global.Object===Object&&global,x7=typeof self=="object"&&self&&self.Object===Object&&self,on=iN||x7||Function("return this")(),nN=typeof il=="object"&&il&&!il.nodeType&&il,FT=nN&&typeof wu=="object"&&wu&&!wu.nodeType&&wu,sN=FT&&FT.exports===nN,R1=sN&&iN.process,UT=function(){try{return R1&&R1.binding&&R1.binding("util")}catch{}}(),qT=UT&&UT.isTypedArray;function T7(r,e){for(var t=-1,i=r==null?0:r.length,n=0,s=[];++t-1}function nH(r,e){var t=this.__data__,i=Zd(t,r);return i<0?(++this.size,t.push([r,e])):t[i][1]=e,this}an.prototype.clear=eH;an.prototype.delete=tH;an.prototype.get=rH;an.prototype.has=iH;an.prototype.set=nH;function go(r){var e=-1,t=r==null?0:r.length;for(this.clear();++ea))return!1;var h=s.get(r);if(h&&s.get(e))return h==e;var p=-1,v=!0,B=t&$T?new Wd:void 0;for(s.set(r,e),s.set(e,r);++p-1&&r%1==0&&r-1&&r%1==0&&r<=kT}function pN(r){var e=typeof r;return r!=null&&(e=="object"||e=="function")}function ol(r){return r!=null&&typeof r=="object"}var gN=qT?B7(qT):AH;function LH(r){return MH(r)?mH(r):_H(r)}function RH(){return[]}function FH(){return!1}wu.exports=PH});var E6=D(we=>{"use strict";l();Object.defineProperty(we,"__esModule",{value:!0});var UH=um(),qH=VC(),hp=hS(),rt=Sm(),Jn=jm(),mN=(Lh(),ti(AS)),VH=(Xx(),ti(Jx)),fe=Dd(),Ft=ro(),HH=(TT(),ti(xT)),ei=(rl(),ti(ar)),QH=(LT(),ti(PT)),jH=yN();function dp(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}function GH(r){if(r&&r.__esModule)return r;var e=Object.create(null);return r&&Object.keys(r).forEach(function(t){if(t!=="default"){var i=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:function(){return r[t]}})}}),e.default=r,Object.freeze(e)}var LN=dp(UH),KH=dp(qH),tp=GH(VH),zH=dp(QH),$H=dp(jH);function $t(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}var vo=$t;$t.EventEmitter=$t,$t.prototype._events=void 0,$t.prototype._maxListeners=void 0,$t.defaultMaxListeners=10,$t.prototype.setMaxListeners=function(r){if(!kH(r)||r<0||isNaN(r))throw TypeError("n must be a positive number");return this._maxListeners=r,this},$t.prototype.emit=function(r){var e,t,i,n,s,o;if(this._events||(this._events={}),r==="error"&&(!this._events.error||ul(this._events.error)&&!this._events.error.length)){if(e=arguments[1],e instanceof Error)throw e;var a=new Error('Uncaught, unspecified "error" event. ('+e+")");throw a.context=e,a}if(t=this._events[r],vN(t))return!1;if(un(t))switch(arguments.length){case 1:t.call(this);break;case 2:t.call(this,arguments[1]);break;case 3:t.call(this,arguments[1],arguments[2]);break;default:n=Array.prototype.slice.call(arguments,1),t.apply(this,n)}else if(ul(t))for(n=Array.prototype.slice.call(arguments,1),o=t.slice(),i=o.length,s=0;s0&&this._events[r].length>t&&(this._events[r].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[r].length),typeof console.trace=="function"&&console.trace())),this},$t.prototype.on=$t.prototype.addListener,$t.prototype.once=function(r,e){if(!un(e))throw TypeError("listener must be a function");var t=!1;function i(){this.removeListener(r,i),t||(t=!0,e.apply(this,arguments))}return i.listener=e,this.on(r,i),this},$t.prototype.removeListener=function(r,e){var t,i,n,s;if(!un(e))throw TypeError("listener must be a function");if(!this._events||!this._events[r])return this;if(t=this._events[r],n=t.length,i=-1,t===e||un(t.listener)&&t.listener===e)delete this._events[r],this._events.removeListener&&this.emit("removeListener",r,e);else if(ul(t)){for(s=n;s-- >0;)if(t[s]===e||t[s].listener&&t[s].listener===e){i=s;break}if(i<0)return this;t.length===1?(t.length=0,delete this._events[r]):t.splice(i,1),this._events.removeListener&&this.emit("removeListener",r,e)}return this},$t.prototype.removeAllListeners=function(r){var e,t;if(!this._events)return this;if(!this._events.removeListener)return arguments.length===0?this._events={}:this._events[r]&&delete this._events[r],this;if(arguments.length===0){for(e in this._events)e!=="removeListener"&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(t=this._events[r],un(t))this.removeListener(r,t);else if(t)for(;t.length;)this.removeListener(r,t[t.length-1]);return delete this._events[r],this},$t.prototype.listeners=function(r){var e;return!this._events||!this._events[r]?e=[]:un(this._events[r])?e=[this._events[r]]:e=this._events[r].slice(),e},$t.prototype.listenerCount=function(r){if(this._events){var e=this._events[r];if(un(e))return 1;if(e)return e.length}return 0},$t.listenerCount=function(r,e){return r.listenerCount(e)};function un(r){return typeof r=="function"}function kH(r){return typeof r=="number"}function ul(r){return typeof r=="object"&&r!==null}function vN(r){return r===void 0}function WH(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),i=0;i>>0,J=new Uint8Array(k);K!==ie;){for(var W=x[K],G=0,P=k-1;(W!==0||G>>0,J[P]=W%a>>>0,W=W/a>>>0;if(W!==0)throw new Error("Non-zero carry");H=G,K++}for(var F=k-H;F!==k&&J[F]===0;)F++;for(var $=u.repeat(V);F>>0,k=new Uint8Array(ie);x[V];){var J=t[x.charCodeAt(V)];if(J===255)return;for(var W=0,G=ie-1;(J!==0||W>>0,k[G]=J%256>>>0,J=J/256>>>0;if(J!==0)throw new Error("Non-zero carry");K=W,V++}if(x[V]!==" "){for(var P=ie-K;P!==ie&&k[P]===0;)P++;for(var F=new Uint8Array(H+(ie-P)),$=H;P!==ie;)F[$++]=k[P++];return F}}}function R(x){var V=B(x);if(V)return V;throw new Error(`Non-${e} character`)}return{encode:v,decodeUnsafe:B,decode:R}}var YH=WH,JH=YH,RN=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},XH=r=>new TextEncoder().encode(r),ZH=r=>new TextDecoder().decode(r),W1=class{constructor(e,t,i){this.name=e,this.prefix=t,this.baseEncode=i}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},Y1=class{constructor(e,t,i){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=i}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 FN(this,e)}},J1=class{constructor(e){this.decoders=e}or(e){return FN(this,e)}decode(e){let t=e[0],i=this.decoders[t];if(i)return i.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},FN=(r,e)=>new J1({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}}),X1=class{constructor(e,t,i,n){this.name=e,this.prefix=t,this.baseEncode=i,this.baseDecode=n,this.encoder=new W1(e,t,i),this.decoder=new Y1(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},pp=({name:r,prefix:e,encode:t,decode:i})=>new X1(r,e,t,i),cl=({prefix:r,name:e,alphabet:t})=>{let{encode:i,decode:n}=JH(t,e);return pp({prefix:r,name:e,encode:i,decode:s=>RN(n(s))})},eQ=(r,e,t,i)=>{let n={};for(let p=0;p=8&&(a-=8,o[h++]=255&u>>a)}if(a>=t||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},tQ=(r,e,t)=>{let i=e[e.length-1]==="=",n=(1<t;)o-=t,s+=e[n&a>>o];if(o&&(s+=e[n&a<pp({prefix:e,name:r,encode(n){return tQ(n,i,t)},decode(n){return eQ(n,i,t,r)}}),rQ=pp({prefix:"\0",name:"identity",encode:r=>ZH(r),decode:r=>XH(r)}),iQ=Object.freeze({__proto__:null,identity:rQ}),nQ=Zt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),sQ=Object.freeze({__proto__:null,base2:nQ}),oQ=Zt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),aQ=Object.freeze({__proto__:null,base8:oQ}),uQ=cl({prefix:"9",name:"base10",alphabet:"0123456789"}),cQ=Object.freeze({__proto__:null,base10:uQ}),lQ=Zt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),fQ=Zt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),hQ=Object.freeze({__proto__:null,base16:lQ,base16upper:fQ}),dQ=Zt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),pQ=Zt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),gQ=Zt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),yQ=Zt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),mQ=Zt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),vQ=Zt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),wQ=Zt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),EQ=Zt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),AQ=Zt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),_Q=Object.freeze({__proto__:null,base32:dQ,base32upper:pQ,base32pad:gQ,base32padupper:yQ,base32hex:mQ,base32hexupper:vQ,base32hexpad:wQ,base32hexpadupper:EQ,base32z:AQ}),IQ=cl({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),bQ=cl({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),CQ=Object.freeze({__proto__:null,base36:IQ,base36upper:bQ}),SQ=cl({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),xQ=cl({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),TQ=Object.freeze({__proto__:null,base58btc:SQ,base58flickr:xQ}),NQ=Zt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),DQ=Zt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),OQ=Zt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),BQ=Zt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),MQ=Object.freeze({__proto__:null,base64:NQ,base64pad:DQ,base64url:OQ,base64urlpad:BQ}),UN=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}"),PQ=UN.reduce((r,e,t)=>(r[t]=e,r),[]),LQ=UN.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function RQ(r){return r.reduce((e,t)=>(e+=PQ[t],e),"")}function FQ(r){let e=[];for(let t of r){let i=LQ[t.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(i)}return new Uint8Array(e)}var UQ=pp({prefix:"\u{1F680}",name:"base256emoji",encode:RQ,decode:FQ}),qQ=Object.freeze({__proto__:null,base256emoji:UQ}),VQ=qN,wN=128,HQ=127,QQ=~HQ,jQ=Math.pow(2,31);function qN(r,e,t){e=e||[],t=t||0;for(var i=t;r>=jQ;)e[t++]=r&255|wN,r/=128;for(;r&QQ;)e[t++]=r&255|wN,r>>>=7;return e[t]=r|0,qN.bytes=t-i+1,e}var GQ=Z1,KQ=128,EN=127;function Z1(r,i){var t=0,i=i||0,n=0,s=i,o,a=r.length;do{if(s>=a)throw Z1.bytes=0,new RangeError("Could not decode varint");o=r[s++],t+=n<28?(o&EN)<=KQ);return Z1.bytes=s-i,t}var zQ=Math.pow(2,7),$Q=Math.pow(2,14),kQ=Math.pow(2,21),WQ=Math.pow(2,28),YQ=Math.pow(2,35),JQ=Math.pow(2,42),XQ=Math.pow(2,49),ZQ=Math.pow(2,56),e9=Math.pow(2,63),t9=function(r){return r(VN.encode(r,e,t),e),_N=r=>VN.encodingLength(r),ew=(r,e)=>{let t=e.byteLength,i=_N(r),n=i+_N(t),s=new Uint8Array(n+t);return AN(r,s,0),AN(t,s,i),s.set(e,n),new tw(r,t,e,s)},tw=class{constructor(e,t,i,n){this.code=e,this.size=t,this.digest=i,this.bytes=n}},HN=({name:r,code:e,encode:t})=>new rw(r,e,t),rw=class{constructor(e,t,i){this.name=e,this.code=t,this.encode=i}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?ew(this.code,t):t.then(i=>ew(this.code,i))}else throw Error("Unknown type, must be binary type")}},QN=r=>async e=>new Uint8Array(await crypto.subtle.digest(r,e)),i9=HN({name:"sha2-256",code:18,encode:QN("SHA-256")}),n9=HN({name:"sha2-512",code:19,encode:QN("SHA-512")}),s9=Object.freeze({__proto__:null,sha256:i9,sha512:n9}),jN=0,o9="identity",GN=RN,a9=r=>ew(jN,GN(r)),u9={code:jN,name:o9,encode:GN,digest:a9},c9=Object.freeze({__proto__:null,identity:u9});new TextEncoder,new TextDecoder;var IN={...iQ,...sQ,...aQ,...cQ,...hQ,..._Q,...CQ,...TQ,...MQ,...qQ};({...s9,...c9});function l9(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(r):new Uint8Array(r)}function KN(r,e,t,i){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:i}}}var bN=KN("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),$1=KN("ascii","a",r=>{let e="a";for(let t=0;t{r=r.substring(1);let e=l9(r.length);for(let t=0;t{if(!this.initialized){let i=await this.getKeyChain();typeof i<"u"&&(this.keychain=i),this.initialized=!0}},this.has=i=>(this.isInitialized(),this.keychain.has(i)),this.set=async(i,n)=>{this.isInitialized(),this.keychain.set(i,n),await this.persist()},this.get=i=>{this.isInitialized();let n=this.keychain.get(i);if(typeof n>"u"){let{message:s}=fe.getInternalError("NO_MATCHING_KEY",`${this.name}: ${i}`);throw new Error(s)}return n},this.del=async i=>{this.isInitialized(),this.keychain.delete(i),await this.persist()},this.core=e,this.logger=rt.generateChildLogger(t,this.name)}get context(){return rt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,fe.mapToObj(e))}async getKeyChain(){let e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?fe.objToMap(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){let{message:e}=fe.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},np=class{constructor(e,t,i){this.core=e,this.logger=t,this.name=WN,this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=n=>(this.isInitialized(),this.keychain.has(n)),this.getClientId=async()=>{this.isInitialized();let n=await this.getClientSeed(),s=tp.generateKeyPair(n);return tp.encodeIss(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();let n=fe.generateKeyPair();return this.setPrivateKey(n.publicKey,n.privateKey)},this.signJWT=async n=>{this.isInitialized();let s=await this.getClientSeed(),o=tp.generateKeyPair(s),a=fe.generateRandomBytes32(),u=YN;return await tp.signJWT(a,n,u,o)},this.generateSharedKey=(n,s,o)=>{this.isInitialized();let a=this.getPrivateKey(n),u=fe.deriveSymKey(a,s);return this.setSymKey(u,o)},this.setSymKey=async(n,s)=>{this.isInitialized();let o=s||fe.hashKey(n);return await this.keychain.set(o,n),o},this.deleteKeyPair=async n=>{this.isInitialized(),await this.keychain.del(n)},this.deleteSymKey=async n=>{this.isInitialized(),await this.keychain.del(n)},this.encode=async(n,s,o)=>{this.isInitialized();let a=fe.validateEncoding(o),u=mN.safeJsonStringify(s);if(fe.isTypeOneEnvelope(a)){let B=a.senderPublicKey,R=a.receiverPublicKey;n=await this.generateSharedKey(B,R)}let h=this.getSymKey(n),{type:p,senderPublicKey:v}=a;return fe.encrypt({type:p,symKey:h,message:u,senderPublicKey:v})},this.decode=async(n,s,o)=>{this.isInitialized();let a=fe.validateDecoding(s,o);if(fe.isTypeOneEnvelope(a)){let p=a.receiverPublicKey,v=a.senderPublicKey;n=await this.generateSharedKey(p,v)}let u=this.getSymKey(n),h=fe.decrypt({symKey:u,encoded:s});return mN.safeJsonParse(h)},this.core=e,this.logger=rt.generateChildLogger(t,this.name),this.keychain=i||new ip(this.core,this.logger)}get context(){return rt.getLoggerContext(this.logger)}getPayloadType(e){let t=fe.deserialize(e);return fe.decodeTypeByte(t.type)}async setPrivateKey(e,t){return await this.keychain.set(e,t),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(iw)}catch{e=fe.generateRandomBytes32(),await this.keychain.set(iw,e)}return h9(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){let{message:e}=fe.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},sp=class extends Jn.IMessageTracker{constructor(e,t){super(e,t),this.logger=e,this.core=t,this.messages=new Map,this.name=ZN,this.version=e6,this.initialized=!1,this.storagePrefix=cn,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{let i=await this.getRelayerMessages();typeof i<"u"&&(this.messages=i),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(i){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(i)}finally{this.initialized=!0}}},this.set=async(i,n)=>{this.isInitialized();let s=fe.hashMessage(n),o=this.messages.get(i);return typeof o>"u"&&(o={}),typeof o[s]<"u"||(o[s]=n,this.messages.set(i,o),await this.persist()),s},this.get=i=>{this.isInitialized();let n=this.messages.get(i);return typeof n>"u"&&(n={}),n},this.has=(i,n)=>{this.isInitialized();let s=this.get(i),o=fe.hashMessage(n);return typeof s[o]<"u"},this.del=async i=>{this.isInitialized(),this.messages.delete(i),await this.persist()},this.logger=rt.generateChildLogger(e,this.name),this.core=t}get context(){return rt.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,fe.mapToObj(e))}async getRelayerMessages(){let e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?fe.objToMap(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){let{message:e}=fe.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},nw=class extends Jn.IPublisher{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.events=new vo.EventEmitter,this.name=r6,this.queue=new Map,this.publish=async(i,n,s)=>{this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:i,message:n,opts:s}});try{let o=s?.ttl||t6,a=fe.getRelayProtocolName(s),u=s?.prompt||!1,h=s?.tag||0,p={topic:i,message:n,opts:{ttl:o,relay:a,prompt:u,tag:h}},v=fe.hashMessage(n);this.queue.set(v,p),await this.rpcPublish(i,n,o,a,u,h),this.onPublish(v,p),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:i,message:n,opts:s}})}catch(o){throw this.logger.debug("Failed to Publish Payload"),this.logger.error(o),o}},this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.relayer=e,this.logger=rt.generateChildLogger(t,this.name),this.registerEventListeners()}get context(){return rt.getLoggerContext(this.logger)}rpcPublish(e,t,i,n,s,o){var a,u,h,p;let v={method:fe.getRelayProtocolApi(n.protocol).publish,params:{topic:e,message:t,ttl:i,prompt:s,tag:o}};return fe.isUndefined((a=v.params)==null?void 0:a.prompt)&&((u=v.params)==null||delete u.prompt),fe.isUndefined((h=v.params)==null?void 0:h.tag)&&((p=v.params)==null||delete p.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:v}),this.relayer.provider.request(v)}onPublish(e,t){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{let{topic:t,message:i,opts:{ttl:n,relay:s,prompt:o,tag:a}}=e,u=fe.hashMessage(i);await this.rpcPublish(t,i,n,s,o,a),this.onPublish(u,e)})}registerEventListeners(){this.relayer.core.heartbeat.on(hp.HEARTBEAT_EVENTS.pulse,()=>{this.checkQueue()})}},sw=class{constructor(){this.map=new Map,this.set=(e,t)=>{let i=this.get(e);this.exists(e,t)||this.map.set(e,[...i,t])},this.get=e=>this.map.get(e)||[],this.exists=(e,t)=>this.get(e).includes(t),this.delete=(e,t)=>{if(typeof t>"u"){this.map.delete(e);return}if(!this.map.has(e))return;let i=this.get(e);if(!this.exists(e,t))return;let n=i.filter(s=>s!==t);if(!n.length){this.map.delete(e);return}this.map.set(e,n)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}},m9=Object.defineProperty,v9=Object.defineProperties,w9=Object.getOwnPropertyDescriptors,CN=Object.getOwnPropertySymbols,E9=Object.prototype.hasOwnProperty,A9=Object.prototype.propertyIsEnumerable,SN=(r,e,t)=>e in r?m9(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,rp=(r,e)=>{for(var t in e||(e={}))E9.call(e,t)&&SN(r,t,e[t]);if(CN)for(var t of CN(e))A9.call(e,t)&&SN(r,t,e[t]);return r},k1=(r,e)=>v9(r,w9(e)),op=class extends Jn.ISubscriber{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.subscriptions=new Map,this.topicMap=new sw,this.events=new vo.EventEmitter,this.name=f6,this.version=h6,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pendingSubInterval=20,this.storagePrefix=cn,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),await this.reset(),this.registerEventListeners(),this.onEnable())},this.subscribe=async(i,n)=>{this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:i,opts:n}});try{let s=fe.getRelayProtocolName(n),o={topic:i,relay:s};this.pending.set(i,o);let a=await this.rpcSubscribe(i,s);return this.onSubscribe(a,o),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:i,opts:n}}),a}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}},this.unsubscribe=async(i,n)=>{this.isInitialized(),typeof n?.id<"u"?await this.unsubscribeById(i,n.id,n):await this.unsubscribeByTopic(i,n)},this.isSubscribed=async i=>this.topics.includes(i)?!0:await new Promise((n,s)=>{let o=new Ft.Watch;o.start(this.pendingSubscriptionWatchLabel);let a=setInterval(()=>{!this.pending.has(i)&&this.topics.includes(i)&&(clearInterval(a),o.stop(this.pendingSubscriptionWatchLabel),n(!0)),o.elapsed(this.pendingSubscriptionWatchLabel)>=d6&&(clearInterval(a),o.stop(this.pendingSubscriptionWatchLabel),s(!1))},this.pendingSubInterval)}),this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.relayer=e,this.logger=rt.generateChildLogger(t,this.name)}get context(){return rt.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,t){let i=!1;try{i=this.getSubscription(e).topic===t}catch{}return i}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear(),this.initialized=!1}async unsubscribeByTopic(e,t){let i=this.topicMap.get(e);await Promise.all(i.map(async n=>await this.unsubscribeById(e,n,t)))}async unsubscribeById(e,t,i){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:i}});try{let n=fe.getRelayProtocolName(i);await this.rpcUnsubscribe(e,t,n);let s=fe.getSdkError("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,t,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:i}})}catch(n){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(n),n}}async rpcSubscribe(e,t){let i={method:fe.getRelayProtocolApi(t.protocol).subscribe,params:{topic:e}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),await this.relayer.provider.request(i)}rpcUnsubscribe(e,t,i){let n={method:fe.getRelayProtocolApi(i.protocol).unsubscribe,params:{topic:e,id:t}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n}),this.relayer.provider.request(n)}onSubscribe(e,t){this.setSubscription(e,k1(rp({},t),{id:e})),this.pending.delete(t.topic)}onResubscribe(e,t){this.addSubscription(e,k1(rp({},t),{id:e})),this.pending.delete(t.topic)}async onUnsubscribe(e,t,i){this.events.removeAllListeners(t),this.hasSubscription(t,e)&&this.deleteSubscription(t,i),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,t){this.subscriptions.has(e)||(this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:t}),this.addSubscription(e,t))}addSubscription(e,t){this.subscriptions.set(e,rp({},t)),this.topicMap.set(t.topic,e),this.events.emit(Yn.created,t)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});let t=this.subscriptions.get(e);if(!t){let{message:i}=fe.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(i)}return t}deleteSubscription(e,t){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:t});let i=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(i.topic,e),this.events.emit(Yn.deleted,k1(rp({},i),{reason:t}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Yn.sync)}async reset(){!this.cached.length||await Promise.all(this.cached.map(async e=>await this.resubscribe(e)))}async restore(){try{let e=await this.getRelayerSubscriptions();if(typeof e>"u"||!e.length)return;if(this.subscriptions.size){let{message:t}=fe.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}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 resubscribe(e){if(!this.ids.includes(e.id)){let{topic:t,relay:i}=e,n={topic:t,relay:i};this.pending.set(n.topic,n);let s=await this.rpcSubscribe(n.topic,n.relay);this.onResubscribe(s,n)}}async onConnect(){await this.reset(),this.onEnable()}onDisconnect(){this.onDisable()}checkPending(){this.pending.forEach(async e=>{let t=await this.rpcSubscribe(e.topic,e.relay);this.onSubscribe(t,e)})}registerEventListeners(){this.relayer.core.heartbeat.on(hp.HEARTBEAT_EVENTS.pulse,()=>{this.checkPending()}),this.relayer.provider.on(mo.connect,async()=>{await this.onConnect()}),this.relayer.provider.on(mo.disconnect,()=>{this.onDisconnect()}),this.events.on(Yn.created,async e=>{let t=Yn.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()}),this.events.on(Yn.deleted,async e=>{let t=Yn.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=fe.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},_9=Object.defineProperty,xN=Object.getOwnPropertySymbols,I9=Object.prototype.hasOwnProperty,b9=Object.prototype.propertyIsEnumerable,TN=(r,e,t)=>e in r?_9(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,C9=(r,e)=>{for(var t in e||(e={}))I9.call(e,t)&&TN(r,t,e[t]);if(xN)for(var t of xN(e))b9.call(e,t)&&TN(r,t,e[t]);return r},ap=class extends Jn.IRelayer{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new vo.EventEmitter,this.name=o6,this.initialized=!1,this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?rt.generateChildLogger(e.logger,this.name):LN.default(rt.getDefaultLoggerOptions({level:e.logger||n6})),this.messages=new sp(this.logger,e.core),this.subscriber=new op(this,this.logger),this.publisher=new nw(this,this.logger),this.relayUrl=e?.relayUrl||s6,this.projectId=e.projectId,this.provider={}}async init(){this.logger.trace("Initialized");let e=await this.core.crypto.signJWT(this.relayUrl);this.provider=this.createProvider(e),await Promise.all([this.messages.init(),this.provider.connect(),this.subscriber.init()]),this.registerEventListeners(),this.initialized=!0}get context(){return rt.getLoggerContext(this.logger)}get connected(){return this.provider.connection.connected}get connecting(){return this.provider.connection.connecting}async publish(e,t,i){this.isInitialized(),await this.publisher.publish(e,t,i),await this.recordMessageEvent({topic:e,message:t})}async subscribe(e,t){return this.isInitialized(),await this.subscriber.subscribe(e,t)}async unsubscribe(e,t){this.isInitialized(),await this.subscriber.unsubscribe(e,t)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}createProvider(e){return new HH.JsonRpcProvider(new zH.default(fe.formatRelayRpcUrl({sdkVersion:c6,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e})))}async recordMessageEvent(e){let{topic:t,message:i}=e;await this.messages.set(t,i)}async shouldIgnoreMessageEvent(e){let{topic:t,message:i}=e;return await this.subscriber.isSubscribed(t)?this.messages.has(t,i):!0}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),ei.isJsonRpcRequest(e)){if(!e.method.endsWith(a6))return;let t=e.params,{topic:i,message:n}=t.data,s={topic:i,message:n};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(C9({type:"event",event:t.id},s)),this.events.emit(t.id,s),await this.acknowledgePayload(e),await this.onMessageEvent(s)}}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(_u.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){let t=ei.formatJsonRpcResult(e.id,!0);await this.provider.connection.send(t)}registerEventListeners(){this.provider.on(mo.payload,e=>this.onProviderPayload(e)),this.provider.on(mo.connect,()=>{this.events.emit(_u.connect)}),this.provider.on(mo.disconnect,()=>{this.events.emit(_u.disconnect),setTimeout(()=>{this.provider.connect()},Ft.toMiliseconds(u6))}),this.provider.on(mo.error,e=>this.events.emit(_u.error,e))}isInitialized(){if(!this.initialized){let{message:e}=fe.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},S9=Object.defineProperty,NN=Object.getOwnPropertySymbols,x9=Object.prototype.hasOwnProperty,T9=Object.prototype.propertyIsEnumerable,DN=(r,e,t)=>e in r?S9(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ON=(r,e)=>{for(var t in e||(e={}))x9.call(e,t)&&DN(r,t,e[t]);if(NN)for(var t of NN(e))T9.call(e,t)&&DN(r,t,e[t]);return r},up=class extends Jn.IStore{constructor(e,t,i,n=cn,s=void 0){super(e,t,i,n),this.core=e,this.logger=t,this.name=i,this.map=new Map,this.version=l6,this.cached=[],this.initialized=!1,this.storagePrefix=cn,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{fe.isProposalStruct(o)?this.map.set(o.id,o):fe.isSessionStruct(o)?this.map.set(o.topic,o):this.getKey&&o!==null&&!fe.isUndefined(o)&&this.map.set(this.getKey(o),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=>$H.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=ON(ON({},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=rt.generateChildLogger(t,this.name),this.storagePrefix=n,this.getKey=s}get context(){return rt.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 t=this.map.get(e);if(!t){let{message:i}=fe.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}return t}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:t}=fe.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}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}=fe.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},cp=class{constructor(e,t){this.core=e,this.logger=t,this.name=p6,this.version=g6,this.events=new vo,this.initialized=!1,this.storagePrefix=cn,this.ignoredPayloadTypes=[fe.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:i})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...i])]},this.create=async()=>{this.isInitialized();let i=fe.generateRandomBytes32(),n=await this.core.crypto.setSymKey(i),s=fe.calcExpiry(Ft.FIVE_MINUTES),o={protocol:i6},a={topic:n,expiry:s,relay:o,active:!1},u=fe.formatUri({protocol:this.core.protocol,version:this.core.version,topic:n,symKey:i,relay:o});return await this.pairings.set(n,a),await this.core.relayer.subscribe(n),this.core.expirer.set(n,s),{topic:n,uri:u}},this.pair=async i=>{this.isInitialized(),this.isValidPair(i);let{topic:n,symKey:s,relay:o}=fe.parseUri(i.uri),a=fe.calcExpiry(Ft.FIVE_MINUTES),u={topic:n,relay:o,expiry:a,active:!1};return await this.pairings.set(n,u),await this.core.crypto.setSymKey(s,n),await this.core.relayer.subscribe(n,{relay:o}),this.core.expirer.set(n,a),i.activatePairing&&await this.activate({topic:n}),u},this.activate=async({topic:i})=>{this.isInitialized();let n=fe.calcExpiry(Ft.THIRTY_DAYS);await this.pairings.update(i,{active:!0,expiry:n}),this.core.expirer.set(i,n)},this.ping=async i=>{this.isInitialized(),await this.isValidPing(i);let{topic:n}=i;if(this.pairings.keys.includes(n)){let s=await this.sendRequest(n,"wc_pairingPing",{}),{done:o,resolve:a,reject:u}=fe.createDelayedPromise();this.events.once(fe.engineEvent("pairing_ping",s),({error:h})=>{h?u(h):a()}),await o()}},this.updateExpiry=async({topic:i,expiry:n})=>{this.isInitialized(),await this.pairings.update(i,{expiry:n})},this.updateMetadata=async({topic:i,metadata:n})=>{this.isInitialized(),await this.pairings.update(i,{peerMetadata:n})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async i=>{this.isInitialized(),await this.isValidDisconnect(i);let{topic:n}=i;this.pairings.keys.includes(n)&&(await this.sendRequest(n,"wc_pairingDelete",fe.getSdkError("USER_DISCONNECTED")),await this.deletePairing(n))},this.sendRequest=async(i,n,s)=>{let o=ei.formatJsonRpcRequest(n,s),a=await this.core.crypto.encode(i,o),u=Au[n].req;return this.core.history.set(i,o),await this.core.relayer.publish(i,a,u),o.id},this.sendResult=async(i,n,s)=>{let o=ei.formatJsonRpcResult(i,s),a=await this.core.crypto.encode(n,o),u=await this.core.history.get(n,i),h=Au[u.request.method].res;await this.core.relayer.publish(n,a,h),await this.core.history.resolve(o)},this.sendError=async(i,n,s)=>{let o=ei.formatJsonRpcError(i,s),a=await this.core.crypto.encode(n,o),u=await this.core.history.get(n,i),h=Au[u.request.method]?Au[u.request.method].res:Au.unregistered_method.res;await this.core.relayer.publish(n,a,h),await this.core.history.resolve(o)},this.deletePairing=async(i,n)=>{await this.core.relayer.unsubscribe(i),await Promise.all([this.pairings.delete(i,fe.getSdkError("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(i),n?Promise.resolve():this.core.expirer.del(i)])},this.cleanup=async()=>{let i=this.pairings.getAll().filter(n=>fe.isExpired(n.expiry));await Promise.all(i.map(n=>this.deletePairing(n.topic)))},this.onRelayEventRequest=i=>{let{topic:n,payload:s}=i;switch(s.method){case"wc_pairingPing":return this.onPairingPingRequest(n,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(n,s);default:return this.onUnknownRpcMethodRequest(n,s)}},this.onRelayEventResponse=async i=>{let{topic:n,payload:s}=i,o=(await this.core.history.get(n,s.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(n,s);default:return this.onUnknownRpcMethodResponse(o)}},this.onPairingPingRequest=async(i,n)=>{let{id:s}=n;try{this.isValidPing({topic:i}),await this.sendResult(s,i,!0),this.events.emit("pairing_ping",{id:s,topic:i})}catch(o){await this.sendError(s,i,o),this.logger.error(o)}},this.onPairingPingResponse=(i,n)=>{let{id:s}=n;setTimeout(()=>{ei.isJsonRpcResult(n)?this.events.emit(fe.engineEvent("pairing_ping",s),{}):ei.isJsonRpcError(n)&&this.events.emit(fe.engineEvent("pairing_ping",s),{error:n.error})},500)},this.onPairingDeleteRequest=async(i,n)=>{let{id:s}=n;try{this.isValidDisconnect({topic:i}),await this.sendResult(s,i,!0),await this.deletePairing(i),this.events.emit("pairing_delete",{id:s,topic:i})}catch(o){await this.sendError(s,i,o),this.logger.error(o)}},this.onUnknownRpcMethodRequest=async(i,n)=>{let{id:s,method:o}=n;try{if(this.registeredMethods.includes(o))return;let a=fe.getSdkError("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,i,a),this.logger.error(a)}catch(a){await this.sendError(s,i,a),this.logger.error(a)}},this.onUnknownRpcMethodResponse=i=>{this.registeredMethods.includes(i)||this.logger.error(fe.getSdkError("WC_METHOD_UNSUPPORTED",i))},this.isValidPair=i=>{if(!fe.isValidParams(i)){let{message:n}=fe.getInternalError("MISSING_OR_INVALID",`pair() params: ${i}`);throw new Error(n)}if(!fe.isValidUrl(i.uri)){let{message:n}=fe.getInternalError("MISSING_OR_INVALID",`pair() uri: ${i.uri}`);throw new Error(n)}},this.isValidPing=async i=>{if(!fe.isValidParams(i)){let{message:s}=fe.getInternalError("MISSING_OR_INVALID",`ping() params: ${i}`);throw new Error(s)}let{topic:n}=i;await this.isValidPairingTopic(n)},this.isValidDisconnect=async i=>{if(!fe.isValidParams(i)){let{message:s}=fe.getInternalError("MISSING_OR_INVALID",`disconnect() params: ${i}`);throw new Error(s)}let{topic:n}=i;await this.isValidPairingTopic(n)},this.isValidPairingTopic=async i=>{if(!fe.isValidString(i,!1)){let{message:n}=fe.getInternalError("MISSING_OR_INVALID",`pairing topic should be a string: ${i}`);throw new Error(n)}if(!this.pairings.keys.includes(i)){let{message:n}=fe.getInternalError("NO_MATCHING_KEY",`pairing topic doesn't exist: ${i}`);throw new Error(n)}if(fe.isExpired(this.pairings.get(i).expiry)){await this.deletePairing(i);let{message:n}=fe.getInternalError("EXPIRED",`pairing topic: ${i}`);throw new Error(n)}},this.core=e,this.logger=rt.generateChildLogger(t,this.name),this.pairings=new up(this.core,this.logger,this.name,this.storagePrefix)}get context(){return rt.getLoggerContext(this.logger)}isInitialized(){if(!this.initialized){let{message:e}=fe.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(_u.message,async e=>{let{topic:t,message:i}=e;if(this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(i)))return;let n=await this.core.crypto.decode(t,i);ei.isJsonRpcRequest(n)?(this.core.history.set(t,n),this.onRelayEventRequest({topic:t,payload:n})):ei.isJsonRpcResponse(n)&&(await this.core.history.resolve(n),this.onRelayEventResponse({topic:t,payload:n}))})}registerExpirerEvents(){this.core.expirer.on(Ur.expired,async e=>{let{topic:t}=fe.parseExpirerTarget(e.target);t&&this.pairings.keys.includes(t)&&(await this.deletePairing(t,!0),this.events.emit("pairing_expire",{topic:t}))})}},lp=class extends Jn.IJsonRpcHistory{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.records=new Map,this.events=new vo.EventEmitter,this.name=y6,this.version=m6,this.cached=[],this.initialized=!1,this.storagePrefix=cn,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(i=>this.records.set(i.id,i)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(i,n,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:i,request:n,chainId:s}),this.records.has(n.id))return;let o={id:n.id,topic:i,request:{method:n.method,params:n.params||null},chainId:s};this.records.set(o.id,o),this.events.emit(Zr.created,o)},this.resolve=async i=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:i}),!this.records.has(i.id))return;let n=await this.getRecord(i.id);typeof n.response>"u"&&(n.response=ei.isJsonRpcError(i)?{error:i.error}:{result:i.result},this.records.set(n.id,n),this.events.emit(Zr.updated,n))},this.get=async(i,n)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:i,id:n}),await this.getRecord(n)),this.delete=(i,n)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:n}),this.values.forEach(s=>{if(s.topic===i){if(typeof n<"u"&&s.id!==n)return;this.records.delete(s.id),this.events.emit(Zr.deleted,s)}})},this.exists=async(i,n)=>(this.isInitialized(),this.records.has(n)?(await this.getRecord(n)).topic===i:!1),this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.logger=rt.generateChildLogger(t,this.name)}get context(){return rt.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(t=>{if(typeof t.response<"u")return;let i={topic:t.topic,request:ei.formatJsonRpcRequest(t.request.method,t.request.params,t.id),chainId:t.chainId};return e.push(i)}),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 t=this.records.get(e);if(!t){let{message:i}=fe.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(i)}return t}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(Zr.sync)}async restore(){try{let e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){let{message:t}=fe.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(Zr.created,e=>{let t=Zr.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e}),this.persist()}),this.events.on(Zr.updated,e=>{let t=Zr.updated;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e}),this.persist()}),this.events.on(Zr.deleted,e=>{let t=Zr.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e}),this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=fe.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},fp=class extends Jn.IExpirer{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.expirations=new Map,this.events=new vo.EventEmitter,this.name=v6,this.version=w6,this.cached=[],this.initialized=!1,this.storagePrefix=cn,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(i=>this.expirations.set(i.target,i)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=i=>{try{let n=this.formatTarget(i);return typeof this.getExpiration(n)<"u"}catch{return!1}},this.set=(i,n)=>{this.isInitialized();let s=this.formatTarget(i),o={target:s,expiry:n};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(Ur.created,{target:s,expiration:o})},this.get=i=>{this.isInitialized();let n=this.formatTarget(i);return this.getExpiration(n)},this.del=i=>{this.isInitialized();let n=this.formatTarget(i);if(this.has(n)){let s=this.getExpiration(n);this.expirations.delete(n),this.events.emit(Ur.deleted,{target:n,expiration:s})}},this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.logger=rt.generateChildLogger(t,this.name)}get context(){return rt.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 fe.formatTopicTarget(e);if(typeof e=="number")return fe.formatIdTarget(e);let{message:t}=fe.getInternalError("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(t)}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:t}=fe.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}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 t=this.expirations.get(e);if(!t){let{message:i}=fe.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}return t}checkExpiry(e,t){let{expiry:i}=t;Ft.toMiliseconds(i)-Date.now()<=0&&this.expire(e,t)}expire(e,t){this.expirations.delete(e),this.events.emit(Ur.expired,{target:e,expiration:t})}checkExpirations(){this.expirations.forEach((e,t)=>this.checkExpiry(t,e))}registerEventListeners(){this.core.heartbeat.on(hp.HEARTBEAT_EVENTS.pulse,()=>this.checkExpirations()),this.events.on(Ur.created,e=>{let t=Ur.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(Ur.expired,e=>{let t=Ur.expired;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(Ur.deleted,e=>{let t=Ur.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=fe.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},N9=Object.defineProperty,BN=Object.getOwnPropertySymbols,D9=Object.prototype.hasOwnProperty,O9=Object.prototype.propertyIsEnumerable,MN=(r,e,t)=>e in r?N9(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,PN=(r,e)=>{for(var t in e||(e={}))D9.call(e,t)&&MN(r,t,e[t]);if(BN)for(var t of BN(e))O9.call(e,t)&&MN(r,t,e[t]);return r},Iu=class extends Jn.ICore{constructor(e){super(e),this.protocol=ow,this.version=zN,this.name=gp,this.events=new vo.EventEmitter,this.initialized=!1,this.on=(i,n)=>this.events.on(i,n),this.once=(i,n)=>this.events.once(i,n),this.off=(i,n)=>this.events.off(i,n),this.removeListener=(i,n)=>this.events.removeListener(i,n),this.projectId=e?.projectId;let t=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:LN.default(rt.getDefaultLoggerOptions({level:e?.logger||$N.logger}));this.logger=rt.generateChildLogger(t,this.name),this.heartbeat=new hp.HeartBeat,this.crypto=new np(this,this.logger,e?.keychain),this.history=new lp(this,this.logger),this.expirer=new fp(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new KH.default(PN(PN({},kN),e?.storageOptions)),this.relayer=new ap({core:this,logger:this.logger,relayUrl:e?.relayUrl,projectId:this.projectId}),this.pairing=new cp(this,this.logger)}static async init(e){let t=new Iu(e);return await t.initialize(),t}get context(){return rt.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 Initilization Success")}catch(e){throw this.logger.warn(`Core Initilization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}},B9=Iu;we.CORE_CONTEXT=gp,we.CORE_DEFAULT=$N,we.CORE_PROTOCOL=ow,we.CORE_STORAGE_OPTIONS=kN,we.CORE_STORAGE_PREFIX=cn,we.CORE_VERSION=zN,we.CRYPTO_CLIENT_SEED=iw,we.CRYPTO_CONTEXT=WN,we.CRYPTO_JWT_TTL=YN,we.Core=B9,we.Crypto=np,we.EXPIRER_CONTEXT=v6,we.EXPIRER_DEFAULT_TTL=y9,we.EXPIRER_EVENTS=Ur,we.EXPIRER_STORAGE_VERSION=w6,we.Expirer=fp,we.HISTORY_CONTEXT=y6,we.HISTORY_EVENTS=Zr,we.HISTORY_STORAGE_VERSION=m6,we.JsonRpcHistory=lp,we.KEYCHAIN_CONTEXT=JN,we.KEYCHAIN_STORAGE_VERSION=XN,we.KeyChain=ip,we.MESSAGES_CONTEXT=ZN,we.MESSAGES_STORAGE_VERSION=e6,we.MessageTracker=sp,we.PAIRING_CONTEXT=p6,we.PAIRING_DEFAULT_TTL=g9,we.PAIRING_RPC_OPTS=Au,we.PAIRING_STORAGE_VERSION=g6,we.PENDING_SUB_RESOLUTION_TIMEOUT=d6,we.PUBLISHER_CONTEXT=r6,we.PUBLISHER_DEFAULT_TTL=t6,we.Pairing=cp,we.RELAYER_CONTEXT=o6,we.RELAYER_DEFAULT_LOGGER=n6,we.RELAYER_DEFAULT_PROTOCOL=i6,we.RELAYER_DEFAULT_RELAY_URL=s6,we.RELAYER_EVENTS=_u,we.RELAYER_PROVIDER_EVENTS=mo,we.RELAYER_RECONNECT_TIMEOUT=u6,we.RELAYER_SDK_VERSION=c6,we.RELAYER_STORAGE_OPTIONS=d9,we.RELAYER_SUBSCRIBER_SUFFIX=a6,we.Relayer=ap,we.STORE_STORAGE_VERSION=l6,we.SUBSCRIBER_CONTEXT=f6,we.SUBSCRIBER_DEFAULT_TTL=p9,we.SUBSCRIBER_EVENTS=Yn,we.SUBSCRIBER_STORAGE_VERSION=h6,we.Store=up,we.Subscriber=op,we.default=Iu});var D6=D(Bt=>{"use strict";l();Object.defineProperty(Bt,"__esModule",{value:!0});var bu=E6(),aw=Sm(),C6=jm(),oe=Dd(),M9=um(),Mt=ro(),Ut=(rl(),ti(ar));function P9(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}var L9=P9(M9);function kt(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}var S6=kt;kt.EventEmitter=kt,kt.prototype._events=void 0,kt.prototype._maxListeners=void 0,kt.defaultMaxListeners=10,kt.prototype.setMaxListeners=function(r){if(!R9(r)||r<0||isNaN(r))throw TypeError("n must be a positive number");return this._maxListeners=r,this},kt.prototype.emit=function(r){var e,t,i,n,s,o;if(this._events||(this._events={}),r==="error"&&(!this._events.error||ll(this._events.error)&&!this._events.error.length)){if(e=arguments[1],e instanceof Error)throw e;var a=new Error('Uncaught, unspecified "error" event. ('+e+")");throw a.context=e,a}if(t=this._events[r],A6(t))return!1;if(ln(t))switch(arguments.length){case 1:t.call(this);break;case 2:t.call(this,arguments[1]);break;case 3:t.call(this,arguments[1],arguments[2]);break;default:n=Array.prototype.slice.call(arguments,1),t.apply(this,n)}else if(ll(t))for(n=Array.prototype.slice.call(arguments,1),o=t.slice(),i=o.length,s=0;s0&&this._events[r].length>t&&(this._events[r].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[r].length),typeof console.trace=="function"&&console.trace())),this},kt.prototype.on=kt.prototype.addListener,kt.prototype.once=function(r,e){if(!ln(e))throw TypeError("listener must be a function");var t=!1;function i(){this.removeListener(r,i),t||(t=!0,e.apply(this,arguments))}return i.listener=e,this.on(r,i),this},kt.prototype.removeListener=function(r,e){var t,i,n,s;if(!ln(e))throw TypeError("listener must be a function");if(!this._events||!this._events[r])return this;if(t=this._events[r],n=t.length,i=-1,t===e||ln(t.listener)&&t.listener===e)delete this._events[r],this._events.removeListener&&this.emit("removeListener",r,e);else if(ll(t)){for(s=n;s-- >0;)if(t[s]===e||t[s].listener&&t[s].listener===e){i=s;break}if(i<0)return this;t.length===1?(t.length=0,delete this._events[r]):t.splice(i,1),this._events.removeListener&&this.emit("removeListener",r,e)}return this},kt.prototype.removeAllListeners=function(r){var e,t;if(!this._events)return this;if(!this._events.removeListener)return arguments.length===0?this._events={}:this._events[r]&&delete this._events[r],this;if(arguments.length===0){for(e in this._events)e!=="removeListener"&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(t=this._events[r],ln(t))this.removeListener(r,t);else if(t)for(;t.length;)this.removeListener(r,t[t.length-1]);return delete this._events[r],this},kt.prototype.listeners=function(r){var e;return!this._events||!this._events[r]?e=[]:ln(this._events[r])?e=[this._events[r]]:e=this._events[r].slice(),e},kt.prototype.listenerCount=function(r){if(this._events){var e=this._events[r];if(ln(e))return 1;if(e)return e.length}return 0},kt.listenerCount=function(r,e){return r.listenerCount(e)};function ln(r){return typeof r=="function"}function R9(r){return typeof r=="number"}function ll(r){return typeof r=="object"&&r!==null}function A6(r){return r===void 0}var fw="wc",hw=2,dw="client",pw=`${fw}@${hw}:${dw}:`,yp={name:dw,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},F9={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_event:"session_event",proposal_expire:"proposal_expire"},U9={database:":memory:"},q9={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},V9="history",H9="0.3",x6="proposal",Q9=Mt.THIRTY_DAYS,T6="session",fl=Mt.SEVEN_DAYS,N6="engine",hl={wc_sessionPropose:{req:{ttl:Mt.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:Mt.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:Mt.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:Mt.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:Mt.ONE_DAY,prompt:!1,tag:1104},res:{ttl:Mt.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:Mt.ONE_DAY,prompt:!1,tag:1106},res:{ttl:Mt.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:Mt.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:Mt.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:Mt.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:Mt.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:Mt.ONE_DAY,prompt:!1,tag:1112},res:{ttl:Mt.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:Mt.THIRTY_SECONDS,prompt:!1,tag:1114},res:{ttl:Mt.THIRTY_SECONDS,prompt:!1,tag:1115}}},j9=Object.defineProperty,G9=Object.defineProperties,K9=Object.getOwnPropertyDescriptors,_6=Object.getOwnPropertySymbols,z9=Object.prototype.hasOwnProperty,$9=Object.prototype.propertyIsEnumerable,I6=(r,e,t)=>e in r?j9(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Xn=(r,e)=>{for(var t in e||(e={}))z9.call(e,t)&&I6(r,t,e[t]);if(_6)for(var t of _6(e))$9.call(e,t)&&I6(r,t,e[t]);return r},b6=(r,e)=>G9(r,K9(e)),uw=class extends C6.IEngine{constructor(e){super(e),this.name=N6,this.events=new S6,this.initialized=!1,this.ignoredPayloadTypes=[oe.TYPE_1],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.client.core.pairing.register({methods:Object.keys(hl)}),this.initialized=!0)},this.connect=async t=>{this.isInitialized(),await this.isValidConnect(t);let{pairingTopic:i,requiredNamespaces:n,relays:s}=t,o=i,a,u=!1;if(o&&(u=this.client.core.pairing.pairings.get(o).active),!o||!u){let{topic:H,uri:K}=await this.client.core.pairing.create();o=H,a=K}let h=await this.client.core.crypto.generateKeyPair(),p={requiredNamespaces:n,relays:s??[{protocol:bu.RELAYER_DEFAULT_PROTOCOL}],proposer:{publicKey:h,metadata:this.client.metadata}},{reject:v,resolve:B,done:R}=oe.createDelayedPromise();if(this.events.once(oe.engineEvent("session_connect"),async({error:H,session:K})=>{if(H)v(H);else if(K){K.self.publicKey=h;let ie=b6(Xn({},K),{requiredNamespaces:n});await this.client.session.set(K.topic,ie),await this.setExpiry(K.topic,K.expiry),o&&await this.client.core.pairing.updateMetadata({topic:o,metadata:K.peer.metadata}),B(ie)}}),!o){let{message:H}=oe.getInternalError("NO_MATCHING_KEY",`connect() pairing topic: ${o}`);throw new Error(H)}let x=await this.sendRequest(o,"wc_sessionPropose",p),V=oe.calcExpiry(Mt.FIVE_MINUTES);return await this.setProposal(x,Xn({id:x,expiry:V},p)),{uri:a,approval:R}},this.pair=async t=>(this.isInitialized(),await this.client.core.pairing.pair(t)),this.approve=async t=>{this.isInitialized(),await this.isValidApprove(t);let{id:i,relayProtocol:n,namespaces:s}=t,{pairingTopic:o,proposer:a,requiredNamespaces:u}=this.client.proposal.get(i),h=await this.client.core.crypto.generateKeyPair(),p=a.publicKey,v=await this.client.core.crypto.generateSharedKey(h,p),B={relay:{protocol:n??"irn"},namespaces:s,requiredNamespaces:u,controller:{publicKey:h,metadata:this.client.metadata},expiry:oe.calcExpiry(fl)};await this.client.core.relayer.subscribe(v);let R=await this.sendRequest(v,"wc_sessionSettle",B),{done:x,resolve:V,reject:H}=oe.createDelayedPromise();this.events.once(oe.engineEvent("session_approve",R),({error:ie})=>{ie?H(ie):V(this.client.session.get(v))});let K=b6(Xn({},B),{topic:v,acknowledged:!1,self:B.controller,peer:{publicKey:a.publicKey,metadata:a.metadata},controller:h});return await this.client.session.set(v,K),await this.setExpiry(v,oe.calcExpiry(fl)),o&&await this.client.core.pairing.updateMetadata({topic:o,metadata:K.peer.metadata}),o&&i&&(await this.sendResult(i,o,{relay:{protocol:n??"irn"},responderPublicKey:h}),await this.client.proposal.delete(i,oe.getSdkError("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:o})),{topic:v,acknowledged:x}},this.reject=async t=>{this.isInitialized(),await this.isValidReject(t);let{id:i,reason:n}=t,{pairingTopic:s}=this.client.proposal.get(i);s&&(await this.sendError(i,s,n),await this.client.proposal.delete(i,oe.getSdkError("USER_DISCONNECTED")))},this.update=async t=>{this.isInitialized(),await this.isValidUpdate(t);let{topic:i,namespaces:n}=t,s=await this.sendRequest(i,"wc_sessionUpdate",{namespaces:n}),{done:o,resolve:a,reject:u}=oe.createDelayedPromise();return this.events.once(oe.engineEvent("session_update",s),({error:h})=>{h?u(h):a()}),await this.client.session.update(i,{namespaces:n}),{acknowledged:o}},this.extend=async t=>{this.isInitialized(),await this.isValidExtend(t);let{topic:i}=t,n=await this.sendRequest(i,"wc_sessionExtend",{}),{done:s,resolve:o,reject:a}=oe.createDelayedPromise();return this.events.once(oe.engineEvent("session_extend",n),({error:u})=>{u?a(u):o()}),await this.setExpiry(i,oe.calcExpiry(fl)),{acknowledged:s}},this.request=async t=>{this.isInitialized(),await this.isValidRequest(t);let{chainId:i,request:n,topic:s}=t,o=await this.sendRequest(s,"wc_sessionRequest",{request:n,chainId:i}),{done:a,resolve:u,reject:h}=oe.createDelayedPromise();return this.events.once(oe.engineEvent("session_request",o),({error:p,result:v})=>{p?h(p):u(v)}),await a()},this.respond=async t=>{this.isInitialized(),await this.isValidRespond(t);let{topic:i,response:n}=t,{id:s}=n;Ut.isJsonRpcResult(n)?await this.sendResult(s,i,n.result):Ut.isJsonRpcError(n)&&await this.sendError(s,i,n.error)},this.ping=async t=>{this.isInitialized(),await this.isValidPing(t);let{topic:i}=t;if(this.client.session.keys.includes(i)){let n=await this.sendRequest(i,"wc_sessionPing",{}),{done:s,resolve:o,reject:a}=oe.createDelayedPromise();this.events.once(oe.engineEvent("session_ping",n),({error:u})=>{u?a(u):o()}),await s()}else this.client.core.pairing.pairings.keys.includes(i)&&await this.client.core.pairing.ping({topic:i})},this.emit=async t=>{this.isInitialized(),await this.isValidEmit(t);let{topic:i,event:n,chainId:s}=t;await this.sendRequest(i,"wc_sessionEvent",{event:n,chainId:s})},this.disconnect=async t=>{this.isInitialized(),await this.isValidDisconnect(t);let{topic:i}=t;this.client.session.keys.includes(i)?(await this.sendRequest(i,"wc_sessionDelete",oe.getSdkError("USER_DISCONNECTED")),await this.deleteSession(i)):await this.client.core.pairing.disconnect({topic:i})},this.find=t=>(this.isInitialized(),this.client.session.getAll().filter(i=>oe.isSessionCompatible(i,t))),this.deleteSession=async(t,i)=>{let{self:n}=this.client.session.get(t);await this.client.core.relayer.unsubscribe(t),await Promise.all([this.client.session.delete(t,oe.getSdkError("USER_DISCONNECTED")),this.client.core.crypto.deleteKeyPair(n.publicKey),this.client.core.crypto.deleteSymKey(t),i?Promise.resolve():this.client.core.expirer.del(t)])},this.deleteProposal=async(t,i)=>{await Promise.all([this.client.proposal.delete(t,oe.getSdkError("USER_DISCONNECTED")),i?Promise.resolve():this.client.core.expirer.del(t)])},this.setExpiry=async(t,i)=>{this.client.session.keys.includes(t)&&await this.client.session.update(t,{expiry:i}),this.client.core.expirer.set(t,i)},this.setProposal=async(t,i)=>{await this.client.proposal.set(t,i),this.client.core.expirer.set(t,i.expiry)},this.sendRequest=async(t,i,n)=>{let s=Ut.formatJsonRpcRequest(i,n),o=await this.client.core.crypto.encode(t,s),a=hl[i].req;return this.client.core.history.set(t,s),this.client.core.relayer.publish(t,o,a),s.id},this.sendResult=async(t,i,n)=>{let s=Ut.formatJsonRpcResult(t,n),o=await this.client.core.crypto.encode(i,s),a=await this.client.core.history.get(i,t),u=hl[a.request.method].res;await this.client.core.relayer.publish(i,o,u),await this.client.core.history.resolve(s)},this.sendError=async(t,i,n)=>{let s=Ut.formatJsonRpcError(t,n),o=await this.client.core.crypto.encode(i,s),a=await this.client.core.history.get(i,t),u=hl[a.request.method].res;await this.client.core.relayer.publish(i,o,u),await this.client.core.history.resolve(s)},this.cleanup=async()=>{let t=[],i=[];this.client.session.getAll().forEach(n=>{oe.isExpired(n.expiry)&&t.push(n.topic)}),this.client.proposal.getAll().forEach(n=>{oe.isExpired(n.expiry)&&i.push(n.id)}),await Promise.all([...t.map(n=>this.deleteSession(n)),...i.map(n=>this.deleteProposal(n))])},this.onRelayEventRequest=t=>{let{topic:i,payload:n}=t,s=n.method;switch(s){case"wc_sessionPropose":return this.onSessionProposeRequest(i,n);case"wc_sessionSettle":return this.onSessionSettleRequest(i,n);case"wc_sessionUpdate":return this.onSessionUpdateRequest(i,n);case"wc_sessionExtend":return this.onSessionExtendRequest(i,n);case"wc_sessionPing":return this.onSessionPingRequest(i,n);case"wc_sessionDelete":return this.onSessionDeleteRequest(i,n);case"wc_sessionRequest":return this.onSessionRequest(i,n);case"wc_sessionEvent":return this.onSessionEventRequest(i,n);default:return this.client.logger.info(`Unsupported request method ${s}`)}},this.onRelayEventResponse=async t=>{let{topic:i,payload:n}=t,s=(await this.client.core.history.get(i,n.id)).request.method;switch(s){case"wc_sessionPropose":return this.onSessionProposeResponse(i,n);case"wc_sessionSettle":return this.onSessionSettleResponse(i,n);case"wc_sessionUpdate":return this.onSessionUpdateResponse(i,n);case"wc_sessionExtend":return this.onSessionExtendResponse(i,n);case"wc_sessionPing":return this.onSessionPingResponse(i,n);case"wc_sessionRequest":return this.onSessionRequestResponse(i,n);default:return this.client.logger.info(`Unsupported response method ${s}`)}},this.onSessionProposeRequest=async(t,i)=>{let{params:n,id:s}=i;try{this.isValidConnect(Xn({},i.params));let o=oe.calcExpiry(Mt.FIVE_MINUTES),a=Xn({id:s,pairingTopic:t,expiry:o},n);await this.setProposal(s,a),this.client.events.emit("session_proposal",{id:s,params:a})}catch(o){await this.sendError(s,t,o),this.client.logger.error(o)}},this.onSessionProposeResponse=async(t,i)=>{let{id:n}=i;if(Ut.isJsonRpcResult(i)){let{result:s}=i;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:s});let o=this.client.proposal.get(n);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 h=await this.client.core.crypto.generateSharedKey(a,u);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:h});let p=await this.client.core.relayer.subscribe(h);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:p}),await this.client.core.pairing.activate({topic:t})}else Ut.isJsonRpcError(i)&&(await this.client.proposal.delete(n,oe.getSdkError("USER_DISCONNECTED")),this.events.emit(oe.engineEvent("session_connect"),{error:i.error}))},this.onSessionSettleRequest=async(t,i)=>{let{id:n,params:s}=i;try{this.isValidSessionSettleRequest(s);let{relay:o,controller:a,expiry:u,namespaces:h}=i.params,p={topic:t,relay:o,expiry:u,namespaces:h,acknowledged:!0,controller:a.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}};await this.sendResult(i.id,t,!0),this.events.emit(oe.engineEvent("session_connect"),{session:p})}catch(o){await this.sendError(n,t,o),this.client.logger.error(o)}},this.onSessionSettleResponse=async(t,i)=>{let{id:n}=i;Ut.isJsonRpcResult(i)?(await this.client.session.update(t,{acknowledged:!0}),this.events.emit(oe.engineEvent("session_approve",n),{})):Ut.isJsonRpcError(i)&&(await this.client.session.delete(t,oe.getSdkError("USER_DISCONNECTED")),this.events.emit(oe.engineEvent("session_approve",n),{error:i.error}))},this.onSessionUpdateRequest=async(t,i)=>{let{params:n,id:s}=i;try{this.isValidUpdate(Xn({topic:t},n)),await this.client.session.update(t,{namespaces:n.namespaces}),await this.sendResult(s,t,!0),this.client.events.emit("session_update",{id:s,topic:t,params:n})}catch(o){await this.sendError(s,t,o),this.client.logger.error(o)}},this.onSessionUpdateResponse=(t,i)=>{let{id:n}=i;Ut.isJsonRpcResult(i)?this.events.emit(oe.engineEvent("session_update",n),{}):Ut.isJsonRpcError(i)&&this.events.emit(oe.engineEvent("session_update",n),{error:i.error})},this.onSessionExtendRequest=async(t,i)=>{let{id:n}=i;try{this.isValidExtend({topic:t}),await this.setExpiry(t,oe.calcExpiry(fl)),await this.sendResult(n,t,!0),this.client.events.emit("session_extend",{id:n,topic:t})}catch(s){await this.sendError(n,t,s),this.client.logger.error(s)}},this.onSessionExtendResponse=(t,i)=>{let{id:n}=i;Ut.isJsonRpcResult(i)?this.events.emit(oe.engineEvent("session_extend",n),{}):Ut.isJsonRpcError(i)&&this.events.emit(oe.engineEvent("session_extend",n),{error:i.error})},this.onSessionPingRequest=async(t,i)=>{let{id:n}=i;try{this.isValidPing({topic:t}),await this.sendResult(n,t,!0),this.client.events.emit("session_ping",{id:n,topic:t})}catch(s){await this.sendError(n,t,s),this.client.logger.error(s)}},this.onSessionPingResponse=(t,i)=>{let{id:n}=i;setTimeout(()=>{Ut.isJsonRpcResult(i)?this.events.emit(oe.engineEvent("session_ping",n),{}):Ut.isJsonRpcError(i)&&this.events.emit(oe.engineEvent("session_ping",n),{error:i.error})},500)},this.onSessionDeleteRequest=async(t,i)=>{let{id:n}=i;try{this.isValidDisconnect({topic:t,reason:i.params}),await this.sendResult(n,t,!0),await this.deleteSession(t),this.client.events.emit("session_delete",{id:n,topic:t})}catch(s){await this.sendError(n,t,s),this.client.logger.error(s)}},this.onSessionRequest=async(t,i)=>{let{id:n,params:s}=i;try{this.isValidRequest(Xn({topic:t},s)),this.client.events.emit("session_request",{id:n,topic:t,params:s})}catch(o){await this.sendError(n,t,o),this.client.logger.error(o)}},this.onSessionRequestResponse=(t,i)=>{let{id:n}=i;Ut.isJsonRpcResult(i)?this.events.emit(oe.engineEvent("session_request",n),{result:i.result}):Ut.isJsonRpcError(i)&&this.events.emit(oe.engineEvent("session_request",n),{error:i.error})},this.onSessionEventRequest=async(t,i)=>{let{id:n,params:s}=i;try{this.isValidEmit(Xn({topic:t},s)),this.client.events.emit("session_event",{id:n,topic:t,params:s})}catch(o){await this.sendError(n,t,o),this.client.logger.error(o)}},this.isValidConnect=async t=>{if(!oe.isValidParams(t)){let{message:a}=oe.getInternalError("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(t)}`);throw new Error(a)}let{pairingTopic:i,requiredNamespaces:n,relays:s}=t;oe.isUndefined(i)||await this.isValidPairingTopic(i);let o=oe.isValidRequiredNamespaces(n,"connect()");if(o)throw new Error(o.message);if(!oe.isValidRelays(s,!0)){let{message:a}=oe.getInternalError("MISSING_OR_INVALID",`connect() relays: ${s}`);throw new Error(a)}},this.isValidApprove=async t=>{if(!oe.isValidParams(t))throw new Error(oe.getInternalError("MISSING_OR_INVALID",`approve() params: ${t}`).message);let{id:i,namespaces:n,relayProtocol:s}=t;await this.isValidProposalId(i);let o=this.client.proposal.get(i),a=oe.isValidNamespaces(n,"approve()");if(a)throw new Error(a.message);let u=oe.isConformingNamespaces(o.requiredNamespaces,n,"update()");if(u)throw new Error(u.message);if(!oe.isValidString(s,!0)){let{message:h}=oe.getInternalError("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(h)}},this.isValidReject=async t=>{if(!oe.isValidParams(t)){let{message:s}=oe.getInternalError("MISSING_OR_INVALID",`reject() params: ${t}`);throw new Error(s)}let{id:i,reason:n}=t;if(await this.isValidProposalId(i),!oe.isValidErrorReason(n)){let{message:s}=oe.getInternalError("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(n)}`);throw new Error(s)}},this.isValidSessionSettleRequest=t=>{if(!oe.isValidParams(t)){let{message:h}=oe.getInternalError("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${t}`);throw new Error(h)}let{relay:i,controller:n,namespaces:s,expiry:o}=t;if(!oe.isValidRelay(i)){let{message:h}=oe.getInternalError("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(h)}let a=oe.isValidController(n,"onSessionSettleRequest()");if(a)throw new Error(a.message);let u=oe.isValidNamespaces(s,"onSessionSettleRequest()");if(u)throw new Error(u.message);if(oe.isExpired(o)){let{message:h}=oe.getInternalError("EXPIRED","onSessionSettleRequest()");throw new Error(h)}},this.isValidUpdate=async t=>{if(!oe.isValidParams(t)){let{message:u}=oe.getInternalError("MISSING_OR_INVALID",`update() params: ${t}`);throw new Error(u)}let{topic:i,namespaces:n}=t;await this.isValidSessionTopic(i);let s=this.client.session.get(i),o=oe.isValidNamespaces(n,"update()");if(o)throw new Error(o.message);let a=oe.isConformingNamespaces(s.requiredNamespaces,n,"update()");if(a)throw new Error(a.message)},this.isValidExtend=async t=>{if(!oe.isValidParams(t)){let{message:n}=oe.getInternalError("MISSING_OR_INVALID",`extend() params: ${t}`);throw new Error(n)}let{topic:i}=t;await this.isValidSessionTopic(i)},this.isValidRequest=async t=>{if(!oe.isValidParams(t)){let{message:a}=oe.getInternalError("MISSING_OR_INVALID",`request() params: ${t}`);throw new Error(a)}let{topic:i,request:n,chainId:s}=t;await this.isValidSessionTopic(i);let{namespaces:o}=this.client.session.get(i);if(!oe.isValidNamespacesChainId(o,s)){let{message:a}=oe.getInternalError("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(a)}if(!oe.isValidRequest(n)){let{message:a}=oe.getInternalError("MISSING_OR_INVALID",`request() ${JSON.stringify(n)}`);throw new Error(a)}if(!oe.isValidNamespacesRequest(o,s,n.method)){let{message:a}=oe.getInternalError("MISSING_OR_INVALID",`request() method: ${n.method}`);throw new Error(a)}},this.isValidRespond=async t=>{if(!oe.isValidParams(t)){let{message:s}=oe.getInternalError("MISSING_OR_INVALID",`respond() params: ${t}`);throw new Error(s)}let{topic:i,response:n}=t;if(await this.isValidSessionTopic(i),!oe.isValidResponse(n)){let{message:s}=oe.getInternalError("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(n)}`);throw new Error(s)}},this.isValidPing=async t=>{if(!oe.isValidParams(t)){let{message:n}=oe.getInternalError("MISSING_OR_INVALID",`ping() params: ${t}`);throw new Error(n)}let{topic:i}=t;await this.isValidSessionOrPairingTopic(i)},this.isValidEmit=async t=>{if(!oe.isValidParams(t)){let{message:a}=oe.getInternalError("MISSING_OR_INVALID",`emit() params: ${t}`);throw new Error(a)}let{topic:i,event:n,chainId:s}=t;await this.isValidSessionTopic(i);let{namespaces:o}=this.client.session.get(i);if(!oe.isValidNamespacesChainId(o,s)){let{message:a}=oe.getInternalError("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(a)}if(!oe.isValidEvent(n)){let{message:a}=oe.getInternalError("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(n)}`);throw new Error(a)}if(!oe.isValidNamespacesEvent(o,s,n.name)){let{message:a}=oe.getInternalError("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(n)}`);throw new Error(a)}},this.isValidDisconnect=async t=>{if(!oe.isValidParams(t)){let{message:n}=oe.getInternalError("MISSING_OR_INVALID",`disconnect() params: ${t}`);throw new Error(n)}let{topic:i}=t;await this.isValidSessionOrPairingTopic(i)}}isInitialized(){if(!this.initialized){let{message:e}=oe.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.client.core.relayer.on(bu.RELAYER_EVENTS.message,async e=>{let{topic:t,message:i}=e;if(this.ignoredPayloadTypes.includes(this.client.core.crypto.getPayloadType(i)))return;let n=await this.client.core.crypto.decode(t,i);Ut.isJsonRpcRequest(n)?(this.client.core.history.set(t,n),this.onRelayEventRequest({topic:t,payload:n})):Ut.isJsonRpcResponse(n)&&(await this.client.core.history.resolve(n),this.onRelayEventResponse({topic:t,payload:n}))})}registerExpirerEvents(){this.client.core.expirer.on(bu.EXPIRER_EVENTS.expired,async e=>{let{topic:t,id:i}=oe.parseExpirerTarget(e.target);t?this.client.session.keys.includes(t)&&(await this.deleteSession(t,!0),this.client.events.emit("session_expire",{topic:t})):i&&await this.deleteProposal(i,!0)})}isValidPairingTopic(e){if(!oe.isValidString(e,!1)){let{message:t}=oe.getInternalError("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(t)}if(!this.client.core.pairing.pairings.keys.includes(e)){let{message:t}=oe.getInternalError("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(t)}if(oe.isExpired(this.client.core.pairing.pairings.get(e).expiry)){let{message:t}=oe.getInternalError("EXPIRED",`pairing topic: ${e}`);throw new Error(t)}}async isValidSessionTopic(e){if(!oe.isValidString(e,!1)){let{message:t}=oe.getInternalError("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(t)}if(!this.client.session.keys.includes(e)){let{message:t}=oe.getInternalError("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(t)}if(oe.isExpired(this.client.session.get(e).expiry)){await this.deleteSession(e);let{message:t}=oe.getInternalError("EXPIRED",`session topic: ${e}`);throw new Error(t)}}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(oe.isValidString(e,!1)){let{message:t}=oe.getInternalError("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(t)}else{let{message:t}=oe.getInternalError("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(t)}}async isValidProposalId(e){if(!oe.isValidId(e)){let{message:t}=oe.getInternalError("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(t)}if(!this.client.proposal.keys.includes(e)){let{message:t}=oe.getInternalError("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(t)}if(oe.isExpired(this.client.proposal.get(e).expiry)){await this.deleteProposal(e);let{message:t}=oe.getInternalError("EXPIRED",`proposal id: ${e}`);throw new Error(t)}}},cw=class extends bu.Store{constructor(e,t){super(e,t,x6,pw),this.core=e,this.logger=t}},lw=class extends bu.Store{constructor(e,t){super(e,t,T6,pw),this.core=e,this.logger=t}},Cu=class extends C6.ISignClient{constructor(e){super(e),this.protocol=fw,this.version=hw,this.name=yp.name,this.events=new S6.EventEmitter,this.on=(i,n)=>this.events.on(i,n),this.once=(i,n)=>this.events.once(i,n),this.off=(i,n)=>this.events.off(i,n),this.removeListener=(i,n)=>this.events.removeListener(i,n),this.connect=async i=>{try{return await this.engine.connect(i)}catch(n){throw this.logger.error(n.message),n}},this.pair=async i=>{try{return await this.engine.pair(i)}catch(n){throw this.logger.error(n.message),n}},this.approve=async i=>{try{return await this.engine.approve(i)}catch(n){throw this.logger.error(n.message),n}},this.reject=async i=>{try{return await this.engine.reject(i)}catch(n){throw this.logger.error(n.message),n}},this.update=async i=>{try{return await this.engine.update(i)}catch(n){throw this.logger.error(n.message),n}},this.extend=async i=>{try{return await this.engine.extend(i)}catch(n){throw this.logger.error(n.message),n}},this.request=async i=>{try{return await this.engine.request(i)}catch(n){throw this.logger.error(n.message),n}},this.respond=async i=>{try{return await this.engine.respond(i)}catch(n){throw this.logger.error(n.message),n}},this.ping=async i=>{try{return await this.engine.ping(i)}catch(n){throw this.logger.error(n.message),n}},this.emit=async i=>{try{return await this.engine.emit(i)}catch(n){throw this.logger.error(n.message),n}},this.disconnect=async i=>{try{return await this.engine.disconnect(i)}catch(n){throw this.logger.error(n.message),n}},this.find=i=>{try{return this.engine.find(i)}catch(n){throw this.logger.error(n.message),n}},this.name=e?.name||yp.name,this.metadata=e?.metadata||oe.getAppMetadata();let t=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:L9.default(aw.getDefaultLoggerOptions({level:e?.logger||yp.logger}));this.core=e?.core||new bu.Core(e),this.logger=aw.generateChildLogger(t,this.name),this.session=new lw(this.core,this.logger),this.proposal=new cw(this.core,this.logger),this.engine=new uw(this)}static async init(e){let t=new Cu(e);return await t.initialize(),t}get context(){return aw.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.engine.init(),this.logger.info("SignClient Initilization Success")}catch(e){throw this.logger.info("SignClient Initilization Failure"),this.logger.error(e.message),e}}},k9=Cu;Bt.ENGINE_CONTEXT=N6,Bt.ENGINE_RPC_OPTS=hl,Bt.HISTORY_CONTEXT=V9,Bt.HISTORY_EVENTS=q9,Bt.HISTORY_STORAGE_VERSION=H9,Bt.PROPOSAL_CONTEXT=x6,Bt.PROPOSAL_EXPIRY=Q9,Bt.SESSION_CONTEXT=T6,Bt.SESSION_EXPIRY=fl,Bt.SIGN_CLIENT_CONTEXT=dw,Bt.SIGN_CLIENT_DEFAULT=yp,Bt.SIGN_CLIENT_EVENTS=F9,Bt.SIGN_CLIENT_PROTOCOL=fw,Bt.SIGN_CLIENT_STORAGE_OPTIONS=U9,Bt.SIGN_CLIENT_STORAGE_PREFIX=pw,Bt.SIGN_CLIENT_VERSION=hw,Bt.SignClient=k9,Bt.default=Cu});var O6=D(Su=>{"use strict";l();Object.defineProperty(Su,"__esModule",{value:!0});Su.WALLETCONNECT_ELROND_NAMESPACE=Su.WALLETCONNECT_ELROND_CHAIN_ID=void 0;Su.WALLETCONNECT_ELROND_CHAIN_ID=508;Su.WALLETCONNECT_ELROND_NAMESPACE="elrond"});var B6=D(dl=>{"use strict";l();Object.defineProperty(dl,"__esModule",{value:!0});dl.Operation=void 0;var W9;(function(r){r.SIGN_TRANSACTION="erd_signTransaction",r.SIGN_TRANSACTIONS="erd_signTransactions",r.SIGN_MESSAGE="erd_signMessage",r.SIGN_LOGIN_TOKEN="erd_signLoginToken"})(W9=dl.Operation||(dl.Operation={}))});var M6=D(mp=>{"use strict";l();Object.defineProperty(mp,"__esModule",{value:!0});mp.Logger=void 0;var gw=class{static error(e){console.error(e)}static trace(e){console.trace(e)}};mp.Logger=gw});var P6=D(xu=>{"use strict";l();Object.defineProperty(xu,"__esModule",{value:!0});xu.Signature=xu.Address=void 0;var yw=class{constructor(e){this.value=e}bech32(){return this.value}};xu.Address=yw;var pl=class{constructor(e){this.buffer=e}static fromHex(e){return new pl(y.Buffer.from(e,"hex"))}hex(){return this.buffer.toString("hex")}};xu.Signature=pl});var L6=D(Zn=>{"use strict";l();Object.defineProperty(Zn,"__esModule",{value:!0});Zn.ErrBadAddress=Zn.ErrNotImplemented=Zn.Err=void 0;var gl=class extends Error{constructor(e,t){super(e),this.inner=void 0,this.inner=t}};Zn.Err=gl;var mw=class extends gl{constructor(){super("Method not yet implemented")}};Zn.ErrNotImplemented=mw;var vw=class extends gl{constructor(e,t){super(`Bad address: ${e}`,t)}};Zn.ErrBadAddress=vw});var F6=D(Mi=>{"use strict";l();var Y9=Mi&&Mi.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),J9=Mi&&Mi.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),X9=Mi&&Mi.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&Y9(e,r,t);return J9(e,r),e};Object.defineProperty(Mi,"__esModule",{value:!0});Mi.UserAddress=void 0;var Z9=X9(ef()),R6=L6(),ej="erd",yl=class{constructor(e){this.value=e}static fromBech32(e){let t;try{t=Z9.decode(e)}catch(i){throw new R6.ErrBadAddress(e,i)}if(t.prefix!=ej)throw new R6.ErrBadAddress(e);return new yl(e)}bech32(){return this.value}};Mi.UserAddress=yl});var wp=D(ts=>{"use strict";l();var Wt=ts&&ts.__awaiter||function(r,e,t,i){function n(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(p){try{h(i.next(p))}catch(v){o(v)}}function u(p){try{h(i.throw(p))}catch(v){o(v)}}function h(p){p.done?s(p.value):n(p.value).then(a,u)}h((i=i.apply(r,e||[])).next())})},tj=ts&&ts.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(ts,"__esModule",{value:!0});ts.WalletConnectV2Provider=void 0;var rj=tj(D6()),U6=Dd(),es=O6(),ml=B6(),je=M6(),vl=P6(),vp=F6(),ww=class{constructor(e,t,i,n){this.chainId="",this.address="",this.signature="",this.isInitializing=!1,this.events=[],this.methods=[],this.onClientConnect=e,this.chainId=t,this.walletConnectV2Relay=i,this.walletConnectV2ProjectId=n}init(){return Wt(this,void 0,void 0,function*(){try{let e=yield rj.default.init({relayUrl:this.walletConnectV2Relay,projectId:this.walletConnectV2ProjectId});this.walletConnector=e,yield this.subscribeToEvents(e),yield this.checkPersistedState(e)}catch{throw new Error("connect: WalletConnect is unable to init")}finally{this.isInitializing=!1}return!0})}isInitialized(){return!!this.walletConnector}isConnected(){return new Promise((e,t)=>e(Boolean(this.isInitialized()&&typeof this.session<"u")))}connect(e){var t,i;return Wt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u"&&(yield this.init()),typeof this.walletConnector>"u")throw new Error("WalletConnect is not initialized");let n=[...Object.values(ml.Operation),...(t=e?.methods)!==null&&t!==void 0?t:[]],s=[`${es.WALLETCONNECT_ELROND_NAMESPACE}:${this.chainId}`],o=(i=e?.events)!==null&&i!==void 0?i:[];try{let a=yield this.walletConnector.connect({pairingTopic:e?.topic,requiredNamespaces:{[es.WALLETCONNECT_ELROND_NAMESPACE]:{methods:n,chains:s,events:o}}});return this.events=o,this.methods=n,a}catch{throw e?.topic?(yield this.logout({topic:e.topic}),je.Logger.error("connect: WalletConnect is unable to connect to existing pairing"),new Error("connect: WalletConnect is unable to connect to existing pairing")):(je.Logger.error("connect: WalletConnect is unable to connect"),new Error("connect: WalletConnect is unable to connect"))}})}login(e){return Wt(this,void 0,void 0,function*(){if(this.isInitializing=!0,typeof this.walletConnector>"u"&&(yield this.connect()),typeof this.walletConnector>"u")throw new Error("WalletConnect is not initialized");typeof this.session<"u"&&(yield this.logout());try{if(e&&e.approval){let t=yield e.approval();if(e.token){let i=this.getAddressFromSession(t),{signature:n}=yield this.walletConnector.request({chainId:`${es.WALLETCONNECT_ELROND_NAMESPACE}:${this.chainId}`,topic:t.topic,request:{method:ml.Operation.SIGN_LOGIN_TOKEN,params:{token:e.token,address:i}}});if(!n)throw je.Logger.error("login: WalletConnect could not sign login token"),new Error("WalletConnect could not sign login token");return yield this.onSessionConnected({session:t,signature:n})}return yield this.onSessionConnected({session:t,signature:""})}}catch{throw je.Logger.error("login: WalletConnect is unable to login"),new Error("login: WalletConnect is unable to login")}finally{this.isInitializing=!1}return""})}logout(e){var t,i;return Wt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw je.Logger.error("logout: WalletConnect not initialised, call init() first"),new Error("WalletConnect not initialised, call init() first");try{let n=(t=e?.topic)!==null&&t!==void 0?t:(i=this.session)===null||i===void 0?void 0:i.topic;if(n){yield this.walletConnector.disconnect({topic:n,reason:U6.getSdkError("USER_DISCONNECTED")});let s=this.walletConnector.pairing.getAll({active:!0}).filter(o=>o.topic!==n);this.pairings=s}}catch{je.Logger.error("logout: WalletConnect was unable to logout")}return this.session=void 0,!0})}getAddress(){return Wt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw je.Logger.error("getAddress: WalletConnect not initialised, call init() first"),new Error("WalletConnect not initialised, call init() first");return this.address})}getSignature(){return Wt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw je.Logger.error("getSignature: WalletConnect not initialised, call init() first"),new Error("WalletConnect not initialised, call init() first");return this.signature})}getPairings(){var e;return Wt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw je.Logger.error("getPairings: WalletConnect not initialised, call init() first"),new Error("WalletConnect not initialised, call init() first");return(e=this.pairings)!==null&&e!==void 0?e:this.walletConnector.pairing.getAll({active:!0})})}signMessage(e){return Wt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw je.Logger.error("signMessage: WalletConnect not initialised, call init() first"),new Error("WalletConnect not initialised, call init() first");if(typeof this.session>"u")throw je.Logger.error("signMessage: Session is not connected"),new Error("Session is not connected");let t=yield this.getAddress(),{signature:i}=yield this.walletConnector.request({chainId:`${es.WALLETCONNECT_ELROND_NAMESPACE}:${this.chainId}`,topic:this.session.topic,request:{method:ml.Operation.SIGN_MESSAGE,params:{address:t,message:e.message.toString()}}});if(!i)throw je.Logger.error("signMessage: WalletConnect could not sign the message"),new Error("WalletConnect could not sign the message");return e.applySignature(new vl.Signature(i),vp.UserAddress.fromBech32(t)),e})}signTransaction(e){return Wt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw je.Logger.error("signTransaction: WalletConnect not initialised, call init() first"),new Error("WalletConnect not initialised, call init() first");if(typeof this.session>"u")throw je.Logger.error("signTransaction: Session is not connected"),new Error("Session is not connected");let t=yield this.getAddress(),i=new vl.Address(t),n=e.toPlainObject(i);if(this.chainId!==e.getChainID().valueOf())throw je.Logger.error("signTransaction: Transaction Chain Id different than Connection Chain Id"),new Error("Transaction Chain Id different than Connection Chain Id");let{signature:s}=yield this.walletConnector.request({chainId:`${es.WALLETCONNECT_ELROND_NAMESPACE}:${this.chainId}`,topic:this.session.topic,request:{method:ml.Operation.SIGN_TRANSACTION,params:{transaction:n}}});if(!s)throw je.Logger.error("signTransaction: WalletConnect could not sign the transaction"),new Error("WalletConnect could not sign the transaction");return e.applySignature(vl.Signature.fromHex(s),vp.UserAddress.fromBech32(t)),e})}signTransactions(e){return Wt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw je.Logger.error("signTransactions: WalletConnect not initialised, call init() first"),new Error("WalletConnect not initialised, call init() first");if(typeof this.session>"u")throw je.Logger.error("signTransactions: Session is not connected"),new Error("Session is not connected");let t=yield this.getAddress(),i=new vl.Address(t),n=e.map(o=>{if(this.chainId!==o.getChainID().valueOf())throw je.Logger.error("signTransactions: Transaction Chain Id different than Connection Chain Id"),new Error("Transactions Chain Id different than Connection Chain Id");return o.toPlainObject(i)}),{signatures:s}=yield this.walletConnector.request({chainId:`${es.WALLETCONNECT_ELROND_NAMESPACE}:${this.chainId}`,topic:this.session.topic,request:{method:ml.Operation.SIGN_TRANSACTIONS,params:{transactions:n}}});if(!s||!Array.isArray(s))throw je.Logger.error("signTransactions: WalletConnect could not sign the transactions"),new Error("WalletConnect could not sign the transactions");if(e.length!==s.length)throw je.Logger.error("signTransactions: WalletConnect could not sign the transactions. Invalid signatures."),new Error("WalletConnect could not sign the transactions. Invalid signatures.");for(let[o,a]of e.entries())a.applySignature(vl.Signature.fromHex(s[o].signature),vp.UserAddress.fromBech32(t));return e})}sendCustomRequest(e){return Wt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw je.Logger.error("sendCustomRequest: WalletConnect not initialised, call init() first"),new Error("WalletConnect not initialised, call init() first");if(typeof this.session>"u")throw je.Logger.error("sendCustomRequest: Session is not connected"),new Error("Session is not connected");if(e?.request){let{response:t}=yield this.walletConnector.request({chainId:`${es.WALLETCONNECT_ELROND_NAMESPACE}:${this.chainId}`,topic:this.session.topic,request:e.request});if(!t)throw je.Logger.error("sendCustomRequest: WalletConnect could not send the custom request"),new Error("WalletConnect could not send the custom request");return t}})}ping(){return Wt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw je.Logger.error("ping: WalletConnect not initialised, call init() first"),new Error("WalletConnect not initialised, call init() first");if(typeof this.session>"u")throw je.Logger.error("ping: Session is not connected"),new Error("Session is not connected");try{return yield this.walletConnector.ping({topic:this.session.topic}),!0}catch{return je.Logger.error("ping: Ping failed"),!1}})}loginAccount(e){var t;return Wt(this,void 0,void 0,function*(){if(!!e){if(this.addressIsValid(e.address)){this.address=e.address,e.signature&&(this.signature=e.signature),this.onClientConnect.onClientLogin();return}if(je.Logger.error(`WalletConnect invalid address ${e.address}`),((t=this.session)===null||t===void 0?void 0:t.topic)&&this.walletConnector){yield this.walletConnector.disconnect({topic:this.session.topic,reason:U6.getSdkError("USER_DISCONNECTED")});let i=this.walletConnector.pairing.getAll({active:!0});this.pairings=i}}})}onSessionConnected(e){return Wt(this,void 0,void 0,function*(){if(!e)return"";this.session=e.session;let t=this.getAddressFromSession(e.session);return t&&(yield this.loginAccount({address:t,signature:e.signature})),""})}handleTopicUpdateEvent({topic:e}){var t;return Wt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw new Error("WalletConnect is not initialized");this.pairings=this.walletConnector.pairing.getAll({active:!0}),this.address&&!this.isInitializing&&(((t=this===null||this===void 0?void 0:this.session)===null||t===void 0?void 0:t.topic)===e||this.pairings.length===0)&&this.onClientConnect.onClientLogout()})}handleSessionEvents({topic:e,params:t}){var i;return Wt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw new Error("WalletConnect is not initialized");let{event:n}=t;if(n?.name&&((i=this.session)===null||i===void 0?void 0:i.topic)===e){let s=n.data;this.onClientConnect.onClientEvent(s)}})}subscribeToEvents(e){return Wt(this,void 0,void 0,function*(){if(typeof e>"u")throw new Error("WalletConnect is not initialized");e.on("session_update",({topic:t,params:i})=>{let{namespaces:n}=i,s=e.session.get(t),o=Object.assign(Object.assign({},s),{namespaces:n});this.onSessionConnected({session:o})}),e.on("session_event",this.handleSessionEvents.bind(this)),e.on("session_delete",this.handleTopicUpdateEvent.bind(this)),e.on("session_expire",this.handleTopicUpdateEvent.bind(this))})}checkPersistedState(e){return Wt(this,void 0,void 0,function*(){if(typeof e>"u")throw new Error("WalletConnect is not initialized");if(this.pairings=e.pairing.getAll({active:!0}),!(typeof this.session<"u")&&e.session.length&&!this.address&&!this.isInitializing){let t=e.session.keys.length-1,i=e.session.get(e.session.keys[t]);return yield this.onSessionConnected({session:i}),i}})}addressIsValid(e){try{return!!vp.UserAddress.fromBech32(e)}catch{return!1}}getAddressFromSession(e){let t=e.namespaces[es.WALLETCONNECT_ELROND_NAMESPACE];if(t&&t.accounts){let i=t.accounts[0],[n,s,o]=i.split(":");return o}return""}};ts.WalletConnectV2Provider=ww});var V6=D((Lre,q6)=>{"use strict";l();q6.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},t=Symbol("test"),i=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[object Symbol]")return!1;var n=42;e[t]=n;for(t 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]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var o=Object.getOwnPropertyDescriptor(e,t);if(o.value!==n||o.enumerable!==!0)return!1}return!0}});var j6=D((Fre,Q6)=>{"use strict";l();var H6=typeof Symbol<"u"&&Symbol,ij=V6();Q6.exports=function(){return typeof H6!="function"||typeof Symbol!="function"||typeof H6("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:ij()}});var K6=D((qre,G6)=>{"use strict";l();var nj="Function.prototype.bind called on incompatible ",Ew=Array.prototype.slice,sj=Object.prototype.toString,oj="[object Function]";G6.exports=function(e){var t=this;if(typeof t!="function"||sj.call(t)!==oj)throw new TypeError(nj+t);for(var i=Ew.call(arguments,1),n,s=function(){if(this instanceof n){var p=t.apply(this,i.concat(Ew.call(arguments)));return Object(p)===p?p:this}else return t.apply(e,i.concat(Ew.call(arguments)))},o=Math.max(0,t.length-i.length),a=[],u=0;u{"use strict";l();var aj=K6();z6.exports=Function.prototype.bind||aj});var k6=D((jre,$6)=>{"use strict";l();var uj=Ep();$6.exports=uj.call(Function.call,Object.prototype.hasOwnProperty)});var Ip=D((Kre,X6)=>{"use strict";l();var Pe,Bu=SyntaxError,J6=Function,Du=TypeError,Aw=function(r){try{return J6('"use strict"; return ('+r+").constructor;")()}catch{}},wo=Object.getOwnPropertyDescriptor;if(wo)try{wo({},"")}catch{wo=null}var _w=function(){throw new Du},cj=wo?function(){try{return arguments.callee,_w}catch{try{return wo(arguments,"callee").get}catch{return _w}}}():_w,Tu=j6()(),rs=Object.getPrototypeOf||function(r){return r.__proto__},Nu={},lj=typeof Uint8Array>"u"?Pe:rs(Uint8Array),Ou={"%AggregateError%":typeof AggregateError>"u"?Pe:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Pe:ArrayBuffer,"%ArrayIteratorPrototype%":Tu?rs([][Symbol.iterator]()):Pe,"%AsyncFromSyncIteratorPrototype%":Pe,"%AsyncFunction%":Nu,"%AsyncGenerator%":Nu,"%AsyncGeneratorFunction%":Nu,"%AsyncIteratorPrototype%":Nu,"%Atomics%":typeof Atomics>"u"?Pe:Atomics,"%BigInt%":typeof BigInt>"u"?Pe:BigInt,"%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%":J6,"%GeneratorFunction%":Nu,"%Int8Array%":typeof Int8Array>"u"?Pe:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Pe:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Pe:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Tu?rs(rs([][Symbol.iterator]())):Pe,"%JSON%":typeof JSON=="object"?JSON:Pe,"%Map%":typeof Map>"u"?Pe:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Tu?Pe:rs(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?Pe:rs(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Pe:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Tu?rs(""[Symbol.iterator]()):Pe,"%Symbol%":Tu?Symbol:Pe,"%SyntaxError%":Bu,"%ThrowTypeError%":cj,"%TypedArray%":lj,"%TypeError%":Du,"%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},fj=function r(e){var t;if(e==="%AsyncFunction%")t=Aw("async function () {}");else if(e==="%GeneratorFunction%")t=Aw("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=Aw("async function* () {}");else if(e==="%AsyncGenerator%"){var i=r("%AsyncGeneratorFunction%");i&&(t=i.prototype)}else if(e==="%AsyncIteratorPrototype%"){var n=r("%AsyncGenerator%");n&&(t=rs(n.prototype))}return Ou[e]=t,t},W6={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},wl=Ep(),Ap=k6(),hj=wl.call(Function.call,Array.prototype.concat),dj=wl.call(Function.apply,Array.prototype.splice),Y6=wl.call(Function.call,String.prototype.replace),_p=wl.call(Function.call,String.prototype.slice),pj=wl.call(Function.call,RegExp.prototype.exec),gj=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,yj=/\\(\\)?/g,mj=function(e){var t=_p(e,0,1),i=_p(e,-1);if(t==="%"&&i!=="%")throw new Bu("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&t!=="%")throw new Bu("invalid intrinsic syntax, expected opening `%`");var n=[];return Y6(e,gj,function(s,o,a,u){n[n.length]=a?Y6(u,yj,"$1"):o||s}),n},vj=function(e,t){var i=e,n;if(Ap(W6,i)&&(n=W6[i],i="%"+n[0]+"%"),Ap(Ou,i)){var s=Ou[i];if(s===Nu&&(s=fj(i)),typeof s>"u"&&!t)throw new Du("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:n,name:i,value:s}}throw new Bu("intrinsic "+e+" does not exist!")};X6.exports=function(e,t){if(typeof e!="string"||e.length===0)throw new Du("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new Du('"allowMissing" argument must be a boolean');if(pj(/^%?[^%]*%?$/,e)===null)throw new Bu("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=mj(e),n=i.length>0?i[0]:"",s=vj("%"+n+"%",t),o=s.name,a=s.value,u=!1,h=s.alias;h&&(n=h[0],dj(i,hj([0,1],h)));for(var p=1,v=!0;p=i.length){var V=wo(a,B);v=!!V,v&&"get"in V&&!("originalValue"in V.get)?a=V.get:a=a[B]}else v=Ap(a,B),a=a[B];v&&!u&&(Ou[o]=a)}}return a}});var nD=D(($re,bp)=>{"use strict";l();var Iw=Ep(),Mu=Ip(),tD=Mu("%Function.prototype.apply%"),rD=Mu("%Function.prototype.call%"),iD=Mu("%Reflect.apply%",!0)||Iw.call(rD,tD),Z6=Mu("%Object.getOwnPropertyDescriptor%",!0),Eo=Mu("%Object.defineProperty%",!0),wj=Mu("%Math.max%");if(Eo)try{Eo({},"a",{value:1})}catch{Eo=null}bp.exports=function(e){var t=iD(Iw,rD,arguments);if(Z6&&Eo){var i=Z6(t,"length");i.configurable&&Eo(t,"length",{value:1+wj(0,e.length-(arguments.length-1))})}return t};var eD=function(){return iD(Iw,tD,arguments)};Eo?Eo(bp.exports,"apply",{value:eD}):bp.exports.apply=eD});var uD=D((Wre,aD)=>{"use strict";l();var sD=Ip(),oD=nD(),Ej=oD(sD("String.prototype.indexOf"));aD.exports=function(e,t){var i=sD(e,!!t);return typeof i=="function"&&Ej(e,".prototype.")>-1?oD(i):i}});var cD=D(()=>{l()});var xD=D((eie,SD)=>{l();var Mw=typeof Map=="function"&&Map.prototype,bw=Object.getOwnPropertyDescriptor&&Mw?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Sp=Mw&&bw&&typeof bw.get=="function"?bw.get:null,Aj=Mw&&Map.prototype.forEach,Pw=typeof Set=="function"&&Set.prototype,Cw=Object.getOwnPropertyDescriptor&&Pw?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,xp=Pw&&Cw&&typeof Cw.get=="function"?Cw.get:null,_j=Pw&&Set.prototype.forEach,Ij=typeof WeakMap=="function"&&WeakMap.prototype,Al=Ij?WeakMap.prototype.has:null,bj=typeof WeakSet=="function"&&WeakSet.prototype,_l=bj?WeakSet.prototype.has:null,Cj=typeof WeakRef=="function"&&WeakRef.prototype,lD=Cj?WeakRef.prototype.deref:null,Sj=Boolean.prototype.valueOf,xj=Object.prototype.toString,Tj=Function.prototype.toString,Nj=String.prototype.match,Lw=String.prototype.slice,ns=String.prototype.replace,Dj=String.prototype.toUpperCase,fD=String.prototype.toLowerCase,ED=RegExp.prototype.test,hD=Array.prototype.concat,Pi=Array.prototype.join,Oj=Array.prototype.slice,dD=Math.floor,Tw=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Sw=Object.getOwnPropertySymbols,Nw=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Pu=typeof Symbol=="function"&&typeof Symbol.iterator=="object",ur=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Pu?"object":"symbol")?Symbol.toStringTag:null,AD=Object.prototype.propertyIsEnumerable,pD=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function gD(r,e){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||ED.call(/e/,e))return e;var t=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var i=r<0?-dD(-r):dD(r);if(i!==r){var n=String(i),s=Lw.call(e,n.length+1);return ns.call(n,t,"$&_")+"."+ns.call(ns.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return ns.call(e,t,"$&_")}var Dw=cD(),yD=Dw.custom,mD=ID(yD)?yD:null;SD.exports=function r(e,t,i,n){var s=t||{};if(is(s,"quoteStyle")&&s.quoteStyle!=="single"&&s.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(is(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=is(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(is(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(is(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 CD(e,s);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var u=String(e);return a?gD(e,u):u}if(typeof e=="bigint"){var h=String(e)+"n";return a?gD(e,h):h}var p=typeof s.depth>"u"?5:s.depth;if(typeof i>"u"&&(i=0),i>=p&&p>0&&typeof e=="object")return Ow(e)?"[Array]":"[Object]";var v=Wj(s,i);if(typeof n>"u")n=[];else if(bD(n,e)>=0)return"[Circular]";function B(A,c,d){if(c&&(n=Oj.call(n),n.push(c)),d){var g={depth:s.depth};return is(s,"quoteStyle")&&(g.quoteStyle=s.quoteStyle),r(A,g,i+1,n)}return r(A,s,i+1,n)}if(typeof e=="function"&&!vD(e)){var R=Vj(e),x=Cp(e,B);return"[Function"+(R?": "+R:" (anonymous)")+"]"+(x.length>0?" { "+Pi.call(x,", ")+" }":"")}if(ID(e)){var V=Pu?ns.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):Nw.call(e);return typeof e=="object"&&!Pu?El(V):V}if(zj(e)){for(var H="<"+fD.call(String(e.nodeName)),K=e.attributes||[],ie=0;ie",H}if(Ow(e)){if(e.length===0)return"[]";var k=Cp(e,B);return v&&!kj(k)?"["+Bw(k,v)+"]":"[ "+Pi.call(k,", ")+" ]"}if(Pj(e)){var J=Cp(e,B);return!("cause"in Error.prototype)&&"cause"in e&&!AD.call(e,"cause")?"{ ["+String(e)+"] "+Pi.call(hD.call("[cause]: "+B(e.cause),J),", ")+" }":J.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+Pi.call(J,", ")+" }"}if(typeof e=="object"&&o){if(mD&&typeof e[mD]=="function"&&Dw)return Dw(e,{depth:p-i});if(o!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(Hj(e)){var W=[];return Aj.call(e,function(A,c){W.push(B(c,e,!0)+" => "+B(A,e))}),wD("Map",Sp.call(e),W,v)}if(Gj(e)){var G=[];return _j.call(e,function(A){G.push(B(A,e))}),wD("Set",xp.call(e),G,v)}if(Qj(e))return xw("WeakMap");if(Kj(e))return xw("WeakSet");if(jj(e))return xw("WeakRef");if(Rj(e))return El(B(Number(e)));if(Uj(e))return El(B(Tw.call(e)));if(Fj(e))return El(Sj.call(e));if(Lj(e))return El(B(String(e)));if(!Mj(e)&&!vD(e)){var P=Cp(e,B),F=pD?pD(e)===Object.prototype:e instanceof Object||e.constructor===Object,$=e instanceof Object?"":"null prototype",ce=!F&&ur&&Object(e)===e&&ur in e?Lw.call(ss(e),8,-1):$?"Object":"",Y=F||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",X=Y+(ce||$?"["+Pi.call(hD.call([],ce||[],$||[]),": ")+"] ":"");return P.length===0?X+"{}":v?X+"{"+Bw(P,v)+"}":X+"{ "+Pi.call(P,", ")+" }"}return String(e)};function _D(r,e,t){var i=(t.quoteStyle||e)==="double"?'"':"'";return i+r+i}function Bj(r){return ns.call(String(r),/"/g,""")}function Ow(r){return ss(r)==="[object Array]"&&(!ur||!(typeof r=="object"&&ur in r))}function Mj(r){return ss(r)==="[object Date]"&&(!ur||!(typeof r=="object"&&ur in r))}function vD(r){return ss(r)==="[object RegExp]"&&(!ur||!(typeof r=="object"&&ur in r))}function Pj(r){return ss(r)==="[object Error]"&&(!ur||!(typeof r=="object"&&ur in r))}function Lj(r){return ss(r)==="[object String]"&&(!ur||!(typeof r=="object"&&ur in r))}function Rj(r){return ss(r)==="[object Number]"&&(!ur||!(typeof r=="object"&&ur in r))}function Fj(r){return ss(r)==="[object Boolean]"&&(!ur||!(typeof r=="object"&&ur in r))}function ID(r){if(Pu)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!Nw)return!1;try{return Nw.call(r),!0}catch{}return!1}function Uj(r){if(!r||typeof r!="object"||!Tw)return!1;try{return Tw.call(r),!0}catch{}return!1}var qj=Object.prototype.hasOwnProperty||function(r){return r in this};function is(r,e){return qj.call(r,e)}function ss(r){return xj.call(r)}function Vj(r){if(r.name)return r.name;var e=Nj.call(Tj.call(r),/^function\s*([\w$]+)/);return e?e[1]:null}function bD(r,e){if(r.indexOf)return r.indexOf(e);for(var t=0,i=r.length;te.maxStringLength){var t=r.length-e.maxStringLength,i="... "+t+" more character"+(t>1?"s":"");return CD(Lw.call(r,0,e.maxStringLength),e)+i}var n=ns.call(ns.call(r,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,$j);return _D(n,"single",e)}function $j(r){var e=r.charCodeAt(0),t={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return t?"\\"+t:"\\x"+(e<16?"0":"")+Dj.call(e.toString(16))}function El(r){return"Object("+r+")"}function xw(r){return r+" { ? }"}function wD(r,e,t,i){var n=i?Bw(t,i):Pi.call(t,", ");return r+" ("+e+") {"+n+"}"}function kj(r){for(var e=0;e=0)return!1;return!0}function Wj(r,e){var t;if(r.indent===" ")t=" ";else if(typeof r.indent=="number"&&r.indent>0)t=Pi.call(Array(r.indent+1)," ");else return null;return{base:t,prev:Pi.call(Array(e+1),t)}}function Bw(r,e){if(r.length===0)return"";var t=` -`+e.prev+e.base;return t+Pi.call(r,","+t)+` -`+e.prev}function Cp(r,e){var t=Ow(r),i=[];if(t){i.length=r.length;for(var n=0;n{"use strict";l();var Rw=Ip(),Lu=uD(),Yj=xD(),Jj=Rw("%TypeError%"),Tp=Rw("%WeakMap%",!0),Np=Rw("%Map%",!0),Xj=Lu("WeakMap.prototype.get",!0),Zj=Lu("WeakMap.prototype.set",!0),eG=Lu("WeakMap.prototype.has",!0),tG=Lu("Map.prototype.get",!0),rG=Lu("Map.prototype.set",!0),iG=Lu("Map.prototype.has",!0),Fw=function(r,e){for(var t=r,i;(i=t.next)!==null;t=i)if(i.key===e)return t.next=i.next,i.next=r.next,r.next=i,i},nG=function(r,e){var t=Fw(r,e);return t&&t.value},sG=function(r,e,t){var i=Fw(r,e);i?i.value=t:r.next={key:e,next:r.next,value:t}},oG=function(r,e){return!!Fw(r,e)};TD.exports=function(){var e,t,i,n={assert:function(s){if(!n.has(s))throw new Jj("Side channel does not contain "+Yj(s))},get:function(s){if(Tp&&s&&(typeof s=="object"||typeof s=="function")){if(e)return Xj(e,s)}else if(Np){if(t)return tG(t,s)}else if(i)return nG(i,s)},has:function(s){if(Tp&&s&&(typeof s=="object"||typeof s=="function")){if(e)return eG(e,s)}else if(Np){if(t)return iG(t,s)}else if(i)return oG(i,s);return!1},set:function(s,o){Tp&&s&&(typeof s=="object"||typeof s=="function")?(e||(e=new Tp),Zj(e,s,o)):Np?(t||(t=new Np),rG(t,s,o)):(i||(i={key:{},next:null}),sG(i,s,o))}};return n}});var Dp=D((nie,DD)=>{"use strict";l();var aG=String.prototype.replace,uG=/%20/g,Uw={RFC1738:"RFC1738",RFC3986:"RFC3986"};DD.exports={default:Uw.RFC3986,formatters:{RFC1738:function(r){return aG.call(r,uG,"+")},RFC3986:function(r){return String(r)}},RFC1738:Uw.RFC1738,RFC3986:Uw.RFC3986}});var Vw=D((oie,BD)=>{"use strict";l();var cG=Dp(),qw=Object.prototype.hasOwnProperty,Ao=Array.isArray,Li=function(){for(var r=[],e=0;e<256;++e)r.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return r}(),lG=function(e){for(;e.length>1;){var t=e.pop(),i=t.obj[t.prop];if(Ao(i)){for(var n=[],s=0;s=48&&h<=57||h>=65&&h<=90||h>=97&&h<=122||s===cG.RFC1738&&(h===40||h===41)){a+=o.charAt(u);continue}if(h<128){a=a+Li[h];continue}if(h<2048){a=a+(Li[192|h>>6]+Li[128|h&63]);continue}if(h<55296||h>=57344){a=a+(Li[224|h>>12]+Li[128|h>>6&63]+Li[128|h&63]);continue}u+=1,h=65536+((h&1023)<<10|o.charCodeAt(u)&1023),a+=Li[240|h>>18]+Li[128|h>>12&63]+Li[128|h>>6&63]+Li[128|h&63]}return a},gG=function(e){for(var t=[{obj:{o:e},prop:"o"}],i=[],n=0;n{"use strict";l();var LD=ND(),Hw=Vw(),Il=Dp(),EG=Object.prototype.hasOwnProperty,MD={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},_o=Array.isArray,AG=Array.prototype.push,RD=function(r,e){AG.apply(r,_o(e)?e:[e])},_G=Date.prototype.toISOString,PD=Il.default,cr={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:Hw.encode,encodeValuesOnly:!1,format:PD,formatter:Il.formatters[PD],indices:!1,serializeDate:function(e){return _G.call(e)},skipNulls:!1,strictNullHandling:!1},IG=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},bG=function r(e,t,i,n,s,o,a,u,h,p,v,B,R,x,V){var H=e;if(V.has(e))throw new RangeError("Cyclic object value");if(typeof a=="function"?H=a(t,H):H instanceof Date?H=p(H):i==="comma"&&_o(H)&&(H=Hw.maybeMap(H,function(ce){return ce instanceof Date?p(ce):ce})),H===null){if(n)return o&&!R?o(t,cr.encoder,x,"key",v):t;H=""}if(IG(H)||Hw.isBuffer(H)){if(o){var K=R?t:o(t,cr.encoder,x,"key",v);return[B(K)+"="+B(o(H,cr.encoder,x,"value",v))]}return[B(t)+"="+B(String(H))]}var ie=[];if(typeof H>"u")return ie;var k;if(i==="comma"&&_o(H))k=[{value:H.length>0?H.join(",")||null:void 0}];else if(_o(a))k=a;else{var J=Object.keys(H);k=u?J.sort(u):J}for(var W=0;W"u"?cr.allowDots:!!e.allowDots,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:cr.charsetSentinel,delimiter:typeof e.delimiter>"u"?cr.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:cr.encode,encoder:typeof e.encoder=="function"?e.encoder:cr.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:cr.encodeValuesOnly,filter:s,format:i,formatter:n,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:cr.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:cr.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:cr.strictNullHandling}};FD.exports=function(r,e){var t=r,i=CG(e),n,s;typeof i.filter=="function"?(s=i.filter,t=s("",t)):_o(i.filter)&&(s=i.filter,n=s);var o=[];if(typeof t!="object"||t===null)return"";var a;e&&e.arrayFormat in MD?a=e.arrayFormat:e&&"indices"in e?a=e.indices?"indices":"repeat":a="indices";var u=MD[a];n||(n=Object.keys(t)),i.sort&&n.sort(i.sort);for(var h=LD(),p=0;p0?R+B:""}});var HD=D((lie,VD)=>{"use strict";l();var Ru=Vw(),Qw=Object.prototype.hasOwnProperty,SG=Array.isArray,Yt={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:Ru.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},xG=function(r){return r.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},qD=function(r,e){return r&&typeof r=="string"&&e.comma&&r.indexOf(",")>-1?r.split(","):r},TG="utf8=%26%2310003%3B",NG="utf8=%E2%9C%93",DG=function(e,t){var i={},n=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,s=t.parameterLimit===1/0?void 0:t.parameterLimit,o=n.split(t.delimiter,s),a=-1,u,h=t.charset;if(t.charsetSentinel)for(u=0;u-1&&(x=SG(x)?[x]:x),Qw.call(i,R)?i[R]=Ru.combine(i[R],x):i[R]=x}return i},OG=function(r,e,t,i){for(var n=i?e:qD(e,t),s=r.length-1;s>=0;--s){var o,a=r[s];if(a==="[]"&&t.parseArrays)o=[].concat(n);else{o=t.plainObjects?Object.create(null):{};var u=a.charAt(0)==="["&&a.charAt(a.length-1)==="]"?a.slice(1,-1):a,h=parseInt(u,10);!t.parseArrays&&u===""?o={0:n}:!isNaN(h)&&a!==u&&String(h)===u&&h>=0&&t.parseArrays&&h<=t.arrayLimit?(o=[],o[h]=n):o[u]=n}n=o}return n},BG=function(e,t,i,n){if(!!e){var s=i.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,o=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,u=i.depth>0&&o.exec(s),h=u?s.slice(0,u.index):s,p=[];if(h){if(!i.plainObjects&&Qw.call(Object.prototype,h)&&!i.allowPrototypes)return;p.push(h)}for(var v=0;i.depth>0&&(u=a.exec(s))!==null&&v"u"?Yt.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?Yt.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:Yt.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:Yt.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:Yt.arrayLimit,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Yt.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:Yt.comma,decoder:typeof e.decoder=="function"?e.decoder:Yt.decoder,delimiter:typeof e.delimiter=="string"||Ru.isRegExp(e.delimiter)?e.delimiter:Yt.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:Yt.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:Yt.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:Yt.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:Yt.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Yt.strictNullHandling}};VD.exports=function(r,e){var t=MG(e);if(r===""||r===null||typeof r>"u")return t.plainObjects?Object.create(null):{};for(var i=typeof r=="string"?DG(r,t):r,n=t.plainObjects?Object.create(null):{},s=Object.keys(i),o=0;o{"use strict";l();var PG=UD(),LG=HD(),RG=Dp();QD.exports={formats:RG,parse:LG,stringify:PG}});var jw=D(Pt=>{"use strict";l();Object.defineProperty(Pt,"__esModule",{value:!0});Pt.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED=Pt.WALLET_PROVIDER_CALLBACK_PARAM=Pt.WALLET_PROVIDER_SIGN_TRANSACTION_URL=Pt.WALLET_PROVIDER_SEND_TRANSACTION_URL=Pt.WALLET_PROVIDER_DISCONNECT_URL=Pt.WALLET_PROVIDER_CONNECT_URL=Pt.WALLET_PROVIDER_TESTNET=Pt.WALLET_PROVIDER_DEVNET=Pt.WALLET_PROVIDER_MAINNET=void 0;Pt.WALLET_PROVIDER_MAINNET="https://wallet.elrond.com/dapp/init";Pt.WALLET_PROVIDER_DEVNET="https://devnet-wallet.elrond.com/dapp/init";Pt.WALLET_PROVIDER_TESTNET="https://testnet-wallet.elrond.com/dapp/init";Pt.WALLET_PROVIDER_CONNECT_URL="hook/login";Pt.WALLET_PROVIDER_DISCONNECT_URL="hook/logout";Pt.WALLET_PROVIDER_SEND_TRANSACTION_URL="hook/transaction";Pt.WALLET_PROVIDER_SIGN_TRANSACTION_URL="hook/sign";Pt.WALLET_PROVIDER_CALLBACK_PARAM="walletProviderStatus";Pt.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED="transactionsSigned"});var GD=D(Fu=>{"use strict";l();Object.defineProperty(Fu,"__esModule",{value:!0});Fu.ErrInvalidTxSignReturnValue=Fu.Err=void 0;var Op=class extends Error{constructor(e,t){super(e),this.inner=void 0,this.inner=t}};Fu.Err=Op;var Gw=class extends Op{constructor(){super("Invalid response in transaction sign return url")}};Fu.ErrInvalidTxSignReturnValue=Gw});var KD=D(Bp=>{"use strict";l();Object.defineProperty(Bp,"__esModule",{value:!0});Bp.PlainSignedTransaction=void 0;var Kw=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)}};Bp.PlainSignedTransaction=Kw});var bl=D(os=>{"use strict";l();var Uu=os&&os.__awaiter||function(r,e,t,i){function n(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(p){try{h(i.next(p))}catch(v){o(v)}}function u(p){try{h(i.throw(p))}catch(v){o(v)}}function h(p){p.done?s(p.value):n(p.value).then(a,u)}h((i=i.apply(r,e||[])).next())})},FG=os&&os.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(os,"__esModule",{value:!0});os.WalletProvider=void 0;var zD=FG(jD()),qu=jw(),$D=GD(),UG=KD(),Vu=class{constructor(e){this.walletUrl=e}login(e){return Uu(this,void 0,void 0,function*(){let t=this.buildWalletUrl({endpoint:qu.WALLET_PROVIDER_CONNECT_URL,callbackUrl:e?.callbackUrl,params:{token:e?.token}});return yield this.redirect(t,e?.redirectDelayMilliseconds),t})}redirect(e,t){return Uu(this,void 0,void 0,function*(){t?yield this.redirectLater(e,t):this.redirectImmediately(e)})}redirectImmediately(e){window.location.href=e}redirectLater(e,t){return Uu(this,void 0,void 0,function*(){yield new Promise(i=>{setTimeout(()=>{window.location.href=e,i(!0)},t)})})}logout(e){return Uu(this,void 0,void 0,function*(){let t=this.buildWalletUrl({endpoint:qu.WALLET_PROVIDER_DISCONNECT_URL,callbackUrl:e?.callbackUrl});return yield this.redirect(t,e?.redirectDelayMilliseconds),!0})}signTransactions(e,t){return Uu(this,void 0,void 0,function*(){let i={};e.map(s=>{let o=Vu.prepareWalletTransaction(s);for(let a in o)o.hasOwnProperty(a)&&!i.hasOwnProperty(a)&&(i[a]=[]),i[a].push(o[a])});let n=this.buildWalletUrl({endpoint:qu.WALLET_PROVIDER_SIGN_TRANSACTION_URL,callbackUrl:t?.callbackUrl,params:i});window.location.href=n})}signTransaction(e,t){return Uu(this,void 0,void 0,function*(){yield this.signTransactions([e],t)})}getTransactionsFromWalletUrl(){let e=zD.default.parse(window.location.search.slice(1));return Vu.isTxSignReturnSuccess(e)?this.getTxSignReturnValue(e):[]}static isTxSignReturnSuccess(e){return e.hasOwnProperty(qu.WALLET_PROVIDER_CALLBACK_PARAM)&&e[qu.WALLET_PROVIDER_CALLBACK_PARAM]===qu.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED}getTxSignReturnValue(e){let t=["nonce","value","receiver","sender","gasPrice","gasLimit","data","chainID","version","signature"];for(let s of t)if(!e[s]||!Array.isArray(e[s]))throw new $D.ErrInvalidTxSignReturnValue;let i=e.nonce.length;for(let s of t)if(e[s].length!==i)throw new $D.ErrInvalidTxSignReturnValue;let n=[];for(let s=0;s{l()});var eO=D((ZD,zw)=>{l();(function(r,e){"use strict";function t(A,c){if(!A)throw new Error(c||"Assertion failed")}function i(A,c){A.super_=c;var d=function(){};d.prototype=c.prototype,A.prototype=new d,A.prototype.constructor=A}function n(A,c,d){if(n.isBN(A))return A;this.negative=0,this.words=null,this.length=0,this.red=null,A!==null&&((c==="le"||c==="be")&&(d=c,c=10),this._init(A||0,c||10,d||"be"))}typeof r=="object"?r.exports=n:e.BN=n,n.BN=n,n.wordSize=26;var s;try{typeof window<"u"&&typeof window.Buffer<"u"?s=window.Buffer:s=XD().Buffer}catch{}n.isBN=function(c){return c instanceof n?!0:c!==null&&typeof c=="object"&&c.constructor.wordSize===n.wordSize&&Array.isArray(c.words)},n.max=function(c,d){return c.cmp(d)>0?c:d},n.min=function(c,d){return c.cmp(d)<0?c:d},n.prototype._init=function(c,d,g){if(typeof c=="number")return this._initNumber(c,d,g);if(typeof c=="object")return this._initArray(c,d,g);d==="hex"&&(d=16),t(d===(d|0)&&d>=2&&d<=36),c=c.toString().replace(/\s+/g,"");var m=0;c[0]==="-"&&(m++,this.negative=1),m=0;m-=3)S=c[m]|c[m-1]<<8|c[m-2]<<16,this.words[w]|=S<>>26-N&67108863,N+=24,N>=26&&(N-=26,w++);else if(g==="le")for(m=0,w=0;m>>26-N&67108863,N+=24,N>=26&&(N-=26,w++);return this._strip()};function o(A,c){var d=A.charCodeAt(c);if(d>=48&&d<=57)return d-48;if(d>=65&&d<=70)return d-55;if(d>=97&&d<=102)return d-87;t(!1,"Invalid character in "+A)}function a(A,c,d){var g=o(A,d);return d-1>=c&&(g|=o(A,d-1)<<4),g}n.prototype._parseHex=function(c,d,g){this.length=Math.ceil((c.length-d)/6),this.words=new Array(this.length);for(var m=0;m=d;m-=2)N=a(c,d,m)<=18?(w-=18,S+=1,this.words[S]|=N>>>26):w+=8;else{var _=c.length-d;for(m=_%2===0?d+1:d;m=18?(w-=18,S+=1,this.words[S]|=N>>>26):w+=8}this._strip()};function u(A,c,d,g){for(var m=0,w=0,S=Math.min(A.length,d),N=c;N=49?w=_-49+10:_>=17?w=_-17+10:w=_,t(_>=0&&w1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},n.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{n.prototype[Symbol.for("nodejs.util.inspect.custom")]=p}catch{n.prototype.inspect=p}else n.prototype.inspect=p;function p(){return(this.red?""}var v=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],B=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],R=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];n.prototype.toString=function(c,d){c=c||10,d=d|0||1;var g;if(c===16||c==="hex"){g="";for(var m=0,w=0,S=0;S>>24-m&16777215,m+=2,m>=26&&(m-=26,S--),w!==0||S!==this.length-1?g=v[6-_.length]+_+g:g=_+g}for(w!==0&&(g=w.toString(16)+g);g.length%d!==0;)g="0"+g;return this.negative!==0&&(g="-"+g),g}if(c===(c|0)&&c>=2&&c<=36){var f=B[c],C=R[c];g="";var Z=this.clone();for(Z.negative=0;!Z.isZero();){var te=Z.modrn(C).toString(c);Z=Z.idivn(C),Z.isZero()?g=te+g:g=v[f-te.length]+te+g}for(this.isZero()&&(g="0"+g);g.length%d!==0;)g="0"+g;return this.negative!==0&&(g="-"+g),g}t(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var c=this.words[0];return this.length===2?c+=this.words[1]*67108864:this.length===3&&this.words[2]===1?c+=4503599627370496+this.words[1]*67108864:this.length>2&&t(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-c:c},n.prototype.toJSON=function(){return this.toString(16,2)},s&&(n.prototype.toBuffer=function(c,d){return this.toArrayLike(s,c,d)}),n.prototype.toArray=function(c,d){return this.toArrayLike(Array,c,d)};var x=function(c,d){return c.allocUnsafe?c.allocUnsafe(d):new c(d)};n.prototype.toArrayLike=function(c,d,g){this._strip();var m=this.byteLength(),w=g||Math.max(1,m);t(m<=w,"byte array longer than desired length"),t(w>0,"Requested array length <= 0");var S=x(c,w),N=d==="le"?"LE":"BE";return this["_toArrayLike"+N](S,m),S},n.prototype._toArrayLikeLE=function(c,d){for(var g=0,m=0,w=0,S=0;w>8&255),g>16&255),S===6?(g>24&255),m=0,S=0):(m=N>>>24,S+=2)}if(g=0&&(c[g--]=N>>8&255),g>=0&&(c[g--]=N>>16&255),S===6?(g>=0&&(c[g--]=N>>24&255),m=0,S=0):(m=N>>>24,S+=2)}if(g>=0)for(c[g--]=m;g>=0;)c[g--]=0},Math.clz32?n.prototype._countBits=function(c){return 32-Math.clz32(c)}:n.prototype._countBits=function(c){var d=c,g=0;return d>=4096&&(g+=13,d>>>=13),d>=64&&(g+=7,d>>>=7),d>=8&&(g+=4,d>>>=4),d>=2&&(g+=2,d>>>=2),g+d},n.prototype._zeroBits=function(c){if(c===0)return 26;var d=c,g=0;return(d&8191)===0&&(g+=13,d>>>=13),(d&127)===0&&(g+=7,d>>>=7),(d&15)===0&&(g+=4,d>>>=4),(d&3)===0&&(g+=2,d>>>=2),(d&1)===0&&g++,g},n.prototype.bitLength=function(){var c=this.words[this.length-1],d=this._countBits(c);return(this.length-1)*26+d};function V(A){for(var c=new Array(A.bitLength()),d=0;d>>m&1}return c}n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var c=0,d=0;dc.length?this.clone().ior(c):c.clone().ior(this)},n.prototype.uor=function(c){return this.length>c.length?this.clone().iuor(c):c.clone().iuor(this)},n.prototype.iuand=function(c){var d;this.length>c.length?d=c:d=this;for(var g=0;gc.length?this.clone().iand(c):c.clone().iand(this)},n.prototype.uand=function(c){return this.length>c.length?this.clone().iuand(c):c.clone().iuand(this)},n.prototype.iuxor=function(c){var d,g;this.length>c.length?(d=this,g=c):(d=c,g=this);for(var m=0;mc.length?this.clone().ixor(c):c.clone().ixor(this)},n.prototype.uxor=function(c){return this.length>c.length?this.clone().iuxor(c):c.clone().iuxor(this)},n.prototype.inotn=function(c){t(typeof c=="number"&&c>=0);var d=Math.ceil(c/26)|0,g=c%26;this._expand(d),g>0&&d--;for(var m=0;m0&&(this.words[m]=~this.words[m]&67108863>>26-g),this._strip()},n.prototype.notn=function(c){return this.clone().inotn(c)},n.prototype.setn=function(c,d){t(typeof c=="number"&&c>=0);var g=c/26|0,m=c%26;return this._expand(g+1),d?this.words[g]=this.words[g]|1<c.length?(g=this,m=c):(g=c,m=this);for(var w=0,S=0;S>>26;for(;w!==0&&S>>26;if(this.length=g.length,w!==0)this.words[this.length]=w,this.length++;else if(g!==this)for(;Sc.length?this.clone().iadd(c):c.clone().iadd(this)},n.prototype.isub=function(c){if(c.negative!==0){c.negative=0;var d=this.iadd(c);return c.negative=1,d._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(c),this.negative=1,this._normSign();var g=this.cmp(c);if(g===0)return this.negative=0,this.length=1,this.words[0]=0,this;var m,w;g>0?(m=this,w=c):(m=c,w=this);for(var S=0,N=0;N>26,this.words[N]=d&67108863;for(;S!==0&&N>26,this.words[N]=d&67108863;if(S===0&&N>>26,Z=_&67108863,te=Math.min(f,c.length-1),ee=Math.max(0,f-A.length+1);ee<=te;ee++){var ae=f-ee|0;m=A.words[ae]|0,w=c.words[ee]|0,S=m*w+Z,C+=S/67108864|0,Z=S&67108863}d.words[f]=Z|0,_=C|0}return _!==0?d.words[f]=_|0:d.length--,d._strip()}var K=function(c,d,g){var m=c.words,w=d.words,S=g.words,N=0,_,f,C,Z=m[0]|0,te=Z&8191,ee=Z>>>13,ae=m[1]|0,E=ae&8191,b=ae>>>13,T=m[2]|0,L=T&8191,O=T>>>13,U=m[3]|0,q=U&8191,M=U>>>13,j=m[4]|0,z=j&8191,Q=j>>>13,ue=m[5]|0,he=ue&8191,de=ue>>>13,Be=m[6]|0,Ie=Be&8191,Se=Be>>>13,Oe=m[7]|0,Ae=Oe&8191,De=Oe>>>13,ps=m[8]|0,Je=ps&8191,Xe=ps>>>13,_r=m[9]|0,Ge=_r&8191,Le=_r>>>13,qt=w[0]|0,be=qt&8191,lt=qt>>>13,IE=w[1]|0,ft=IE&8191,ht=IE>>>13,bE=w[2]|0,dt=bE&8191,pt=bE>>>13,CE=w[3]|0,gt=CE&8191,yt=CE>>>13,SE=w[4]|0,mt=SE&8191,vt=SE>>>13,xE=w[5]|0,wt=xE&8191,Et=xE>>>13,TE=w[6]|0,At=TE&8191,_t=TE>>>13,NE=w[7]|0,It=NE&8191,bt=NE>>>13,DE=w[8]|0,Ct=DE&8191,St=DE>>>13,OE=w[9]|0,xt=OE&8191,Tt=OE>>>13;g.negative=c.negative^d.negative,g.length=19,_=Math.imul(te,be),f=Math.imul(te,lt),f=f+Math.imul(ee,be)|0,C=Math.imul(ee,lt);var n0=(N+_|0)+((f&8191)<<13)|0;N=(C+(f>>>13)|0)+(n0>>>26)|0,n0&=67108863,_=Math.imul(E,be),f=Math.imul(E,lt),f=f+Math.imul(b,be)|0,C=Math.imul(b,lt),_=_+Math.imul(te,ft)|0,f=f+Math.imul(te,ht)|0,f=f+Math.imul(ee,ft)|0,C=C+Math.imul(ee,ht)|0;var s0=(N+_|0)+((f&8191)<<13)|0;N=(C+(f>>>13)|0)+(s0>>>26)|0,s0&=67108863,_=Math.imul(L,be),f=Math.imul(L,lt),f=f+Math.imul(O,be)|0,C=Math.imul(O,lt),_=_+Math.imul(E,ft)|0,f=f+Math.imul(E,ht)|0,f=f+Math.imul(b,ft)|0,C=C+Math.imul(b,ht)|0,_=_+Math.imul(te,dt)|0,f=f+Math.imul(te,pt)|0,f=f+Math.imul(ee,dt)|0,C=C+Math.imul(ee,pt)|0;var o0=(N+_|0)+((f&8191)<<13)|0;N=(C+(f>>>13)|0)+(o0>>>26)|0,o0&=67108863,_=Math.imul(q,be),f=Math.imul(q,lt),f=f+Math.imul(M,be)|0,C=Math.imul(M,lt),_=_+Math.imul(L,ft)|0,f=f+Math.imul(L,ht)|0,f=f+Math.imul(O,ft)|0,C=C+Math.imul(O,ht)|0,_=_+Math.imul(E,dt)|0,f=f+Math.imul(E,pt)|0,f=f+Math.imul(b,dt)|0,C=C+Math.imul(b,pt)|0,_=_+Math.imul(te,gt)|0,f=f+Math.imul(te,yt)|0,f=f+Math.imul(ee,gt)|0,C=C+Math.imul(ee,yt)|0;var a0=(N+_|0)+((f&8191)<<13)|0;N=(C+(f>>>13)|0)+(a0>>>26)|0,a0&=67108863,_=Math.imul(z,be),f=Math.imul(z,lt),f=f+Math.imul(Q,be)|0,C=Math.imul(Q,lt),_=_+Math.imul(q,ft)|0,f=f+Math.imul(q,ht)|0,f=f+Math.imul(M,ft)|0,C=C+Math.imul(M,ht)|0,_=_+Math.imul(L,dt)|0,f=f+Math.imul(L,pt)|0,f=f+Math.imul(O,dt)|0,C=C+Math.imul(O,pt)|0,_=_+Math.imul(E,gt)|0,f=f+Math.imul(E,yt)|0,f=f+Math.imul(b,gt)|0,C=C+Math.imul(b,yt)|0,_=_+Math.imul(te,mt)|0,f=f+Math.imul(te,vt)|0,f=f+Math.imul(ee,mt)|0,C=C+Math.imul(ee,vt)|0;var u0=(N+_|0)+((f&8191)<<13)|0;N=(C+(f>>>13)|0)+(u0>>>26)|0,u0&=67108863,_=Math.imul(he,be),f=Math.imul(he,lt),f=f+Math.imul(de,be)|0,C=Math.imul(de,lt),_=_+Math.imul(z,ft)|0,f=f+Math.imul(z,ht)|0,f=f+Math.imul(Q,ft)|0,C=C+Math.imul(Q,ht)|0,_=_+Math.imul(q,dt)|0,f=f+Math.imul(q,pt)|0,f=f+Math.imul(M,dt)|0,C=C+Math.imul(M,pt)|0,_=_+Math.imul(L,gt)|0,f=f+Math.imul(L,yt)|0,f=f+Math.imul(O,gt)|0,C=C+Math.imul(O,yt)|0,_=_+Math.imul(E,mt)|0,f=f+Math.imul(E,vt)|0,f=f+Math.imul(b,mt)|0,C=C+Math.imul(b,vt)|0,_=_+Math.imul(te,wt)|0,f=f+Math.imul(te,Et)|0,f=f+Math.imul(ee,wt)|0,C=C+Math.imul(ee,Et)|0;var c0=(N+_|0)+((f&8191)<<13)|0;N=(C+(f>>>13)|0)+(c0>>>26)|0,c0&=67108863,_=Math.imul(Ie,be),f=Math.imul(Ie,lt),f=f+Math.imul(Se,be)|0,C=Math.imul(Se,lt),_=_+Math.imul(he,ft)|0,f=f+Math.imul(he,ht)|0,f=f+Math.imul(de,ft)|0,C=C+Math.imul(de,ht)|0,_=_+Math.imul(z,dt)|0,f=f+Math.imul(z,pt)|0,f=f+Math.imul(Q,dt)|0,C=C+Math.imul(Q,pt)|0,_=_+Math.imul(q,gt)|0,f=f+Math.imul(q,yt)|0,f=f+Math.imul(M,gt)|0,C=C+Math.imul(M,yt)|0,_=_+Math.imul(L,mt)|0,f=f+Math.imul(L,vt)|0,f=f+Math.imul(O,mt)|0,C=C+Math.imul(O,vt)|0,_=_+Math.imul(E,wt)|0,f=f+Math.imul(E,Et)|0,f=f+Math.imul(b,wt)|0,C=C+Math.imul(b,Et)|0,_=_+Math.imul(te,At)|0,f=f+Math.imul(te,_t)|0,f=f+Math.imul(ee,At)|0,C=C+Math.imul(ee,_t)|0;var l0=(N+_|0)+((f&8191)<<13)|0;N=(C+(f>>>13)|0)+(l0>>>26)|0,l0&=67108863,_=Math.imul(Ae,be),f=Math.imul(Ae,lt),f=f+Math.imul(De,be)|0,C=Math.imul(De,lt),_=_+Math.imul(Ie,ft)|0,f=f+Math.imul(Ie,ht)|0,f=f+Math.imul(Se,ft)|0,C=C+Math.imul(Se,ht)|0,_=_+Math.imul(he,dt)|0,f=f+Math.imul(he,pt)|0,f=f+Math.imul(de,dt)|0,C=C+Math.imul(de,pt)|0,_=_+Math.imul(z,gt)|0,f=f+Math.imul(z,yt)|0,f=f+Math.imul(Q,gt)|0,C=C+Math.imul(Q,yt)|0,_=_+Math.imul(q,mt)|0,f=f+Math.imul(q,vt)|0,f=f+Math.imul(M,mt)|0,C=C+Math.imul(M,vt)|0,_=_+Math.imul(L,wt)|0,f=f+Math.imul(L,Et)|0,f=f+Math.imul(O,wt)|0,C=C+Math.imul(O,Et)|0,_=_+Math.imul(E,At)|0,f=f+Math.imul(E,_t)|0,f=f+Math.imul(b,At)|0,C=C+Math.imul(b,_t)|0,_=_+Math.imul(te,It)|0,f=f+Math.imul(te,bt)|0,f=f+Math.imul(ee,It)|0,C=C+Math.imul(ee,bt)|0;var f0=(N+_|0)+((f&8191)<<13)|0;N=(C+(f>>>13)|0)+(f0>>>26)|0,f0&=67108863,_=Math.imul(Je,be),f=Math.imul(Je,lt),f=f+Math.imul(Xe,be)|0,C=Math.imul(Xe,lt),_=_+Math.imul(Ae,ft)|0,f=f+Math.imul(Ae,ht)|0,f=f+Math.imul(De,ft)|0,C=C+Math.imul(De,ht)|0,_=_+Math.imul(Ie,dt)|0,f=f+Math.imul(Ie,pt)|0,f=f+Math.imul(Se,dt)|0,C=C+Math.imul(Se,pt)|0,_=_+Math.imul(he,gt)|0,f=f+Math.imul(he,yt)|0,f=f+Math.imul(de,gt)|0,C=C+Math.imul(de,yt)|0,_=_+Math.imul(z,mt)|0,f=f+Math.imul(z,vt)|0,f=f+Math.imul(Q,mt)|0,C=C+Math.imul(Q,vt)|0,_=_+Math.imul(q,wt)|0,f=f+Math.imul(q,Et)|0,f=f+Math.imul(M,wt)|0,C=C+Math.imul(M,Et)|0,_=_+Math.imul(L,At)|0,f=f+Math.imul(L,_t)|0,f=f+Math.imul(O,At)|0,C=C+Math.imul(O,_t)|0,_=_+Math.imul(E,It)|0,f=f+Math.imul(E,bt)|0,f=f+Math.imul(b,It)|0,C=C+Math.imul(b,bt)|0,_=_+Math.imul(te,Ct)|0,f=f+Math.imul(te,St)|0,f=f+Math.imul(ee,Ct)|0,C=C+Math.imul(ee,St)|0;var h0=(N+_|0)+((f&8191)<<13)|0;N=(C+(f>>>13)|0)+(h0>>>26)|0,h0&=67108863,_=Math.imul(Ge,be),f=Math.imul(Ge,lt),f=f+Math.imul(Le,be)|0,C=Math.imul(Le,lt),_=_+Math.imul(Je,ft)|0,f=f+Math.imul(Je,ht)|0,f=f+Math.imul(Xe,ft)|0,C=C+Math.imul(Xe,ht)|0,_=_+Math.imul(Ae,dt)|0,f=f+Math.imul(Ae,pt)|0,f=f+Math.imul(De,dt)|0,C=C+Math.imul(De,pt)|0,_=_+Math.imul(Ie,gt)|0,f=f+Math.imul(Ie,yt)|0,f=f+Math.imul(Se,gt)|0,C=C+Math.imul(Se,yt)|0,_=_+Math.imul(he,mt)|0,f=f+Math.imul(he,vt)|0,f=f+Math.imul(de,mt)|0,C=C+Math.imul(de,vt)|0,_=_+Math.imul(z,wt)|0,f=f+Math.imul(z,Et)|0,f=f+Math.imul(Q,wt)|0,C=C+Math.imul(Q,Et)|0,_=_+Math.imul(q,At)|0,f=f+Math.imul(q,_t)|0,f=f+Math.imul(M,At)|0,C=C+Math.imul(M,_t)|0,_=_+Math.imul(L,It)|0,f=f+Math.imul(L,bt)|0,f=f+Math.imul(O,It)|0,C=C+Math.imul(O,bt)|0,_=_+Math.imul(E,Ct)|0,f=f+Math.imul(E,St)|0,f=f+Math.imul(b,Ct)|0,C=C+Math.imul(b,St)|0,_=_+Math.imul(te,xt)|0,f=f+Math.imul(te,Tt)|0,f=f+Math.imul(ee,xt)|0,C=C+Math.imul(ee,Tt)|0;var d0=(N+_|0)+((f&8191)<<13)|0;N=(C+(f>>>13)|0)+(d0>>>26)|0,d0&=67108863,_=Math.imul(Ge,ft),f=Math.imul(Ge,ht),f=f+Math.imul(Le,ft)|0,C=Math.imul(Le,ht),_=_+Math.imul(Je,dt)|0,f=f+Math.imul(Je,pt)|0,f=f+Math.imul(Xe,dt)|0,C=C+Math.imul(Xe,pt)|0,_=_+Math.imul(Ae,gt)|0,f=f+Math.imul(Ae,yt)|0,f=f+Math.imul(De,gt)|0,C=C+Math.imul(De,yt)|0,_=_+Math.imul(Ie,mt)|0,f=f+Math.imul(Ie,vt)|0,f=f+Math.imul(Se,mt)|0,C=C+Math.imul(Se,vt)|0,_=_+Math.imul(he,wt)|0,f=f+Math.imul(he,Et)|0,f=f+Math.imul(de,wt)|0,C=C+Math.imul(de,Et)|0,_=_+Math.imul(z,At)|0,f=f+Math.imul(z,_t)|0,f=f+Math.imul(Q,At)|0,C=C+Math.imul(Q,_t)|0,_=_+Math.imul(q,It)|0,f=f+Math.imul(q,bt)|0,f=f+Math.imul(M,It)|0,C=C+Math.imul(M,bt)|0,_=_+Math.imul(L,Ct)|0,f=f+Math.imul(L,St)|0,f=f+Math.imul(O,Ct)|0,C=C+Math.imul(O,St)|0,_=_+Math.imul(E,xt)|0,f=f+Math.imul(E,Tt)|0,f=f+Math.imul(b,xt)|0,C=C+Math.imul(b,Tt)|0;var p0=(N+_|0)+((f&8191)<<13)|0;N=(C+(f>>>13)|0)+(p0>>>26)|0,p0&=67108863,_=Math.imul(Ge,dt),f=Math.imul(Ge,pt),f=f+Math.imul(Le,dt)|0,C=Math.imul(Le,pt),_=_+Math.imul(Je,gt)|0,f=f+Math.imul(Je,yt)|0,f=f+Math.imul(Xe,gt)|0,C=C+Math.imul(Xe,yt)|0,_=_+Math.imul(Ae,mt)|0,f=f+Math.imul(Ae,vt)|0,f=f+Math.imul(De,mt)|0,C=C+Math.imul(De,vt)|0,_=_+Math.imul(Ie,wt)|0,f=f+Math.imul(Ie,Et)|0,f=f+Math.imul(Se,wt)|0,C=C+Math.imul(Se,Et)|0,_=_+Math.imul(he,At)|0,f=f+Math.imul(he,_t)|0,f=f+Math.imul(de,At)|0,C=C+Math.imul(de,_t)|0,_=_+Math.imul(z,It)|0,f=f+Math.imul(z,bt)|0,f=f+Math.imul(Q,It)|0,C=C+Math.imul(Q,bt)|0,_=_+Math.imul(q,Ct)|0,f=f+Math.imul(q,St)|0,f=f+Math.imul(M,Ct)|0,C=C+Math.imul(M,St)|0,_=_+Math.imul(L,xt)|0,f=f+Math.imul(L,Tt)|0,f=f+Math.imul(O,xt)|0,C=C+Math.imul(O,Tt)|0;var g0=(N+_|0)+((f&8191)<<13)|0;N=(C+(f>>>13)|0)+(g0>>>26)|0,g0&=67108863,_=Math.imul(Ge,gt),f=Math.imul(Ge,yt),f=f+Math.imul(Le,gt)|0,C=Math.imul(Le,yt),_=_+Math.imul(Je,mt)|0,f=f+Math.imul(Je,vt)|0,f=f+Math.imul(Xe,mt)|0,C=C+Math.imul(Xe,vt)|0,_=_+Math.imul(Ae,wt)|0,f=f+Math.imul(Ae,Et)|0,f=f+Math.imul(De,wt)|0,C=C+Math.imul(De,Et)|0,_=_+Math.imul(Ie,At)|0,f=f+Math.imul(Ie,_t)|0,f=f+Math.imul(Se,At)|0,C=C+Math.imul(Se,_t)|0,_=_+Math.imul(he,It)|0,f=f+Math.imul(he,bt)|0,f=f+Math.imul(de,It)|0,C=C+Math.imul(de,bt)|0,_=_+Math.imul(z,Ct)|0,f=f+Math.imul(z,St)|0,f=f+Math.imul(Q,Ct)|0,C=C+Math.imul(Q,St)|0,_=_+Math.imul(q,xt)|0,f=f+Math.imul(q,Tt)|0,f=f+Math.imul(M,xt)|0,C=C+Math.imul(M,Tt)|0;var y0=(N+_|0)+((f&8191)<<13)|0;N=(C+(f>>>13)|0)+(y0>>>26)|0,y0&=67108863,_=Math.imul(Ge,mt),f=Math.imul(Ge,vt),f=f+Math.imul(Le,mt)|0,C=Math.imul(Le,vt),_=_+Math.imul(Je,wt)|0,f=f+Math.imul(Je,Et)|0,f=f+Math.imul(Xe,wt)|0,C=C+Math.imul(Xe,Et)|0,_=_+Math.imul(Ae,At)|0,f=f+Math.imul(Ae,_t)|0,f=f+Math.imul(De,At)|0,C=C+Math.imul(De,_t)|0,_=_+Math.imul(Ie,It)|0,f=f+Math.imul(Ie,bt)|0,f=f+Math.imul(Se,It)|0,C=C+Math.imul(Se,bt)|0,_=_+Math.imul(he,Ct)|0,f=f+Math.imul(he,St)|0,f=f+Math.imul(de,Ct)|0,C=C+Math.imul(de,St)|0,_=_+Math.imul(z,xt)|0,f=f+Math.imul(z,Tt)|0,f=f+Math.imul(Q,xt)|0,C=C+Math.imul(Q,Tt)|0;var m0=(N+_|0)+((f&8191)<<13)|0;N=(C+(f>>>13)|0)+(m0>>>26)|0,m0&=67108863,_=Math.imul(Ge,wt),f=Math.imul(Ge,Et),f=f+Math.imul(Le,wt)|0,C=Math.imul(Le,Et),_=_+Math.imul(Je,At)|0,f=f+Math.imul(Je,_t)|0,f=f+Math.imul(Xe,At)|0,C=C+Math.imul(Xe,_t)|0,_=_+Math.imul(Ae,It)|0,f=f+Math.imul(Ae,bt)|0,f=f+Math.imul(De,It)|0,C=C+Math.imul(De,bt)|0,_=_+Math.imul(Ie,Ct)|0,f=f+Math.imul(Ie,St)|0,f=f+Math.imul(Se,Ct)|0,C=C+Math.imul(Se,St)|0,_=_+Math.imul(he,xt)|0,f=f+Math.imul(he,Tt)|0,f=f+Math.imul(de,xt)|0,C=C+Math.imul(de,Tt)|0;var v0=(N+_|0)+((f&8191)<<13)|0;N=(C+(f>>>13)|0)+(v0>>>26)|0,v0&=67108863,_=Math.imul(Ge,At),f=Math.imul(Ge,_t),f=f+Math.imul(Le,At)|0,C=Math.imul(Le,_t),_=_+Math.imul(Je,It)|0,f=f+Math.imul(Je,bt)|0,f=f+Math.imul(Xe,It)|0,C=C+Math.imul(Xe,bt)|0,_=_+Math.imul(Ae,Ct)|0,f=f+Math.imul(Ae,St)|0,f=f+Math.imul(De,Ct)|0,C=C+Math.imul(De,St)|0,_=_+Math.imul(Ie,xt)|0,f=f+Math.imul(Ie,Tt)|0,f=f+Math.imul(Se,xt)|0,C=C+Math.imul(Se,Tt)|0;var w0=(N+_|0)+((f&8191)<<13)|0;N=(C+(f>>>13)|0)+(w0>>>26)|0,w0&=67108863,_=Math.imul(Ge,It),f=Math.imul(Ge,bt),f=f+Math.imul(Le,It)|0,C=Math.imul(Le,bt),_=_+Math.imul(Je,Ct)|0,f=f+Math.imul(Je,St)|0,f=f+Math.imul(Xe,Ct)|0,C=C+Math.imul(Xe,St)|0,_=_+Math.imul(Ae,xt)|0,f=f+Math.imul(Ae,Tt)|0,f=f+Math.imul(De,xt)|0,C=C+Math.imul(De,Tt)|0;var E0=(N+_|0)+((f&8191)<<13)|0;N=(C+(f>>>13)|0)+(E0>>>26)|0,E0&=67108863,_=Math.imul(Ge,Ct),f=Math.imul(Ge,St),f=f+Math.imul(Le,Ct)|0,C=Math.imul(Le,St),_=_+Math.imul(Je,xt)|0,f=f+Math.imul(Je,Tt)|0,f=f+Math.imul(Xe,xt)|0,C=C+Math.imul(Xe,Tt)|0;var A0=(N+_|0)+((f&8191)<<13)|0;N=(C+(f>>>13)|0)+(A0>>>26)|0,A0&=67108863,_=Math.imul(Ge,xt),f=Math.imul(Ge,Tt),f=f+Math.imul(Le,xt)|0,C=Math.imul(Le,Tt);var _0=(N+_|0)+((f&8191)<<13)|0;return N=(C+(f>>>13)|0)+(_0>>>26)|0,_0&=67108863,S[0]=n0,S[1]=s0,S[2]=o0,S[3]=a0,S[4]=u0,S[5]=c0,S[6]=l0,S[7]=f0,S[8]=h0,S[9]=d0,S[10]=p0,S[11]=g0,S[12]=y0,S[13]=m0,S[14]=v0,S[15]=w0,S[16]=E0,S[17]=A0,S[18]=_0,N!==0&&(S[19]=N,g.length++),g};Math.imul||(K=H);function ie(A,c,d){d.negative=c.negative^A.negative,d.length=A.length+c.length;for(var g=0,m=0,w=0;w>>26)|0,m+=S>>>26,S&=67108863}d.words[w]=N,g=S,S=m}return g!==0?d.words[w]=g:d.length--,d._strip()}function k(A,c,d){return ie(A,c,d)}n.prototype.mulTo=function(c,d){var g,m=this.length+c.length;return this.length===10&&c.length===10?g=K(this,c,d):m<63?g=H(this,c,d):m<1024?g=ie(this,c,d):g=k(this,c,d),g};function J(A,c){this.x=A,this.y=c}J.prototype.makeRBT=function(c){for(var d=new Array(c),g=n.prototype._countBits(c)-1,m=0;m>=1;return m},J.prototype.permute=function(c,d,g,m,w,S){for(var N=0;N>>1)w++;return 1<>>13,g[2*S+1]=w&8191,w=w>>>13;for(S=2*d;S>=26,g+=w/67108864|0,g+=S>>>26,this.words[m]=S&67108863}return g!==0&&(this.words[m]=g,this.length++),d?this.ineg():this},n.prototype.muln=function(c){return this.clone().imuln(c)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(c){var d=V(c);if(d.length===0)return new n(1);for(var g=this,m=0;m=0);var d=c%26,g=(c-d)/26,m=67108863>>>26-d<<26-d,w;if(d!==0){var S=0;for(w=0;w>>26-d}S&&(this.words[w]=S,this.length++)}if(g!==0){for(w=this.length-1;w>=0;w--)this.words[w+g]=this.words[w];for(w=0;w=0);var m;d?m=(d-d%26)/26:m=0;var w=c%26,S=Math.min((c-w)/26,this.length),N=67108863^67108863>>>w<S)for(this.length-=S,f=0;f=0&&(C!==0||f>=m);f--){var Z=this.words[f]|0;this.words[f]=C<<26-w|Z>>>w,C=Z&N}return _&&C!==0&&(_.words[_.length++]=C),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},n.prototype.ishrn=function(c,d,g){return t(this.negative===0),this.iushrn(c,d,g)},n.prototype.shln=function(c){return this.clone().ishln(c)},n.prototype.ushln=function(c){return this.clone().iushln(c)},n.prototype.shrn=function(c){return this.clone().ishrn(c)},n.prototype.ushrn=function(c){return this.clone().iushrn(c)},n.prototype.testn=function(c){t(typeof c=="number"&&c>=0);var d=c%26,g=(c-d)/26,m=1<=0);var d=c%26,g=(c-d)/26;if(t(this.negative===0,"imaskn works only with positive numbers"),this.length<=g)return this;if(d!==0&&g++,this.length=Math.min(g,this.length),d!==0){var m=67108863^67108863>>>d<=67108864;d++)this.words[d]-=67108864,d===this.length-1?this.words[d+1]=1:this.words[d+1]++;return this.length=Math.max(this.length,d+1),this},n.prototype.isubn=function(c){if(t(typeof c=="number"),t(c<67108864),c<0)return this.iaddn(-c);if(this.negative!==0)return this.negative=0,this.iaddn(c),this.negative=1,this;if(this.words[0]-=c,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var d=0;d>26)-(_/67108864|0),this.words[w+g]=S&67108863}for(;w>26,this.words[w+g]=S&67108863;if(N===0)return this._strip();for(t(N===-1),N=0,w=0;w>26,this.words[w]=S&67108863;return this.negative=1,this._strip()},n.prototype._wordDiv=function(c,d){var g=this.length-c.length,m=this.clone(),w=c,S=w.words[w.length-1]|0,N=this._countBits(S);g=26-N,g!==0&&(w=w.ushln(g),m.iushln(g),S=w.words[w.length-1]|0);var _=m.length-w.length,f;if(d!=="mod"){f=new n(null),f.length=_+1,f.words=new Array(f.length);for(var C=0;C=0;te--){var ee=(m.words[w.length+te]|0)*67108864+(m.words[w.length+te-1]|0);for(ee=Math.min(ee/S|0,67108863),m._ishlnsubmul(w,ee,te);m.negative!==0;)ee--,m.negative=0,m._ishlnsubmul(w,1,te),m.isZero()||(m.negative^=1);f&&(f.words[te]=ee)}return f&&f._strip(),m._strip(),d!=="div"&&g!==0&&m.iushrn(g),{div:f||null,mod:m}},n.prototype.divmod=function(c,d,g){if(t(!c.isZero()),this.isZero())return{div:new n(0),mod:new n(0)};var m,w,S;return this.negative!==0&&c.negative===0?(S=this.neg().divmod(c,d),d!=="mod"&&(m=S.div.neg()),d!=="div"&&(w=S.mod.neg(),g&&w.negative!==0&&w.iadd(c)),{div:m,mod:w}):this.negative===0&&c.negative!==0?(S=this.divmod(c.neg(),d),d!=="mod"&&(m=S.div.neg()),{div:m,mod:S.mod}):(this.negative&c.negative)!==0?(S=this.neg().divmod(c.neg(),d),d!=="div"&&(w=S.mod.neg(),g&&w.negative!==0&&w.isub(c)),{div:S.div,mod:w}):c.length>this.length||this.cmp(c)<0?{div:new n(0),mod:this}:c.length===1?d==="div"?{div:this.divn(c.words[0]),mod:null}:d==="mod"?{div:null,mod:new n(this.modrn(c.words[0]))}:{div:this.divn(c.words[0]),mod:new n(this.modrn(c.words[0]))}:this._wordDiv(c,d)},n.prototype.div=function(c){return this.divmod(c,"div",!1).div},n.prototype.mod=function(c){return this.divmod(c,"mod",!1).mod},n.prototype.umod=function(c){return this.divmod(c,"mod",!0).mod},n.prototype.divRound=function(c){var d=this.divmod(c);if(d.mod.isZero())return d.div;var g=d.div.negative!==0?d.mod.isub(c):d.mod,m=c.ushrn(1),w=c.andln(1),S=g.cmp(m);return S<0||w===1&&S===0?d.div:d.div.negative!==0?d.div.isubn(1):d.div.iaddn(1)},n.prototype.modrn=function(c){var d=c<0;d&&(c=-c),t(c<=67108863);for(var g=(1<<26)%c,m=0,w=this.length-1;w>=0;w--)m=(g*m+(this.words[w]|0))%c;return d?-m:m},n.prototype.modn=function(c){return this.modrn(c)},n.prototype.idivn=function(c){var d=c<0;d&&(c=-c),t(c<=67108863);for(var g=0,m=this.length-1;m>=0;m--){var w=(this.words[m]|0)+g*67108864;this.words[m]=w/c|0,g=w%c}return this._strip(),d?this.ineg():this},n.prototype.divn=function(c){return this.clone().idivn(c)},n.prototype.egcd=function(c){t(c.negative===0),t(!c.isZero());var d=this,g=c.clone();d.negative!==0?d=d.umod(c):d=d.clone();for(var m=new n(1),w=new n(0),S=new n(0),N=new n(1),_=0;d.isEven()&&g.isEven();)d.iushrn(1),g.iushrn(1),++_;for(var f=g.clone(),C=d.clone();!d.isZero();){for(var Z=0,te=1;(d.words[0]&te)===0&&Z<26;++Z,te<<=1);if(Z>0)for(d.iushrn(Z);Z-- >0;)(m.isOdd()||w.isOdd())&&(m.iadd(f),w.isub(C)),m.iushrn(1),w.iushrn(1);for(var ee=0,ae=1;(g.words[0]&ae)===0&&ee<26;++ee,ae<<=1);if(ee>0)for(g.iushrn(ee);ee-- >0;)(S.isOdd()||N.isOdd())&&(S.iadd(f),N.isub(C)),S.iushrn(1),N.iushrn(1);d.cmp(g)>=0?(d.isub(g),m.isub(S),w.isub(N)):(g.isub(d),S.isub(m),N.isub(w))}return{a:S,b:N,gcd:g.iushln(_)}},n.prototype._invmp=function(c){t(c.negative===0),t(!c.isZero());var d=this,g=c.clone();d.negative!==0?d=d.umod(c):d=d.clone();for(var m=new n(1),w=new n(0),S=g.clone();d.cmpn(1)>0&&g.cmpn(1)>0;){for(var N=0,_=1;(d.words[0]&_)===0&&N<26;++N,_<<=1);if(N>0)for(d.iushrn(N);N-- >0;)m.isOdd()&&m.iadd(S),m.iushrn(1);for(var f=0,C=1;(g.words[0]&C)===0&&f<26;++f,C<<=1);if(f>0)for(g.iushrn(f);f-- >0;)w.isOdd()&&w.iadd(S),w.iushrn(1);d.cmp(g)>=0?(d.isub(g),m.isub(w)):(g.isub(d),w.isub(m))}var Z;return d.cmpn(1)===0?Z=m:Z=w,Z.cmpn(0)<0&&Z.iadd(c),Z},n.prototype.gcd=function(c){if(this.isZero())return c.abs();if(c.isZero())return this.abs();var d=this.clone(),g=c.clone();d.negative=0,g.negative=0;for(var m=0;d.isEven()&&g.isEven();m++)d.iushrn(1),g.iushrn(1);do{for(;d.isEven();)d.iushrn(1);for(;g.isEven();)g.iushrn(1);var w=d.cmp(g);if(w<0){var S=d;d=g,g=S}else if(w===0||g.cmpn(1)===0)break;d.isub(g)}while(!0);return g.iushln(m)},n.prototype.invm=function(c){return this.egcd(c).a.umod(c)},n.prototype.isEven=function(){return(this.words[0]&1)===0},n.prototype.isOdd=function(){return(this.words[0]&1)===1},n.prototype.andln=function(c){return this.words[0]&c},n.prototype.bincn=function(c){t(typeof c=="number");var d=c%26,g=(c-d)/26,m=1<>>26,N&=67108863,this.words[S]=N}return w!==0&&(this.words[S]=w,this.length++),this},n.prototype.isZero=function(){return this.length===1&&this.words[0]===0},n.prototype.cmpn=function(c){var d=c<0;if(this.negative!==0&&!d)return-1;if(this.negative===0&&d)return 1;this._strip();var g;if(this.length>1)g=1;else{d&&(c=-c),t(c<=67108863,"Number is too big");var m=this.words[0]|0;g=m===c?0:mc.length)return 1;if(this.length=0;g--){var m=this.words[g]|0,w=c.words[g]|0;if(m!==w){mw&&(d=1);break}}return d},n.prototype.gtn=function(c){return this.cmpn(c)===1},n.prototype.gt=function(c){return this.cmp(c)===1},n.prototype.gten=function(c){return this.cmpn(c)>=0},n.prototype.gte=function(c){return this.cmp(c)>=0},n.prototype.ltn=function(c){return this.cmpn(c)===-1},n.prototype.lt=function(c){return this.cmp(c)===-1},n.prototype.lten=function(c){return this.cmpn(c)<=0},n.prototype.lte=function(c){return this.cmp(c)<=0},n.prototype.eqn=function(c){return this.cmpn(c)===0},n.prototype.eq=function(c){return this.cmp(c)===0},n.red=function(c){return new Y(c)},n.prototype.toRed=function(c){return t(!this.red,"Already a number in reduction context"),t(this.negative===0,"red works only with positives"),c.convertTo(this)._forceRed(c)},n.prototype.fromRed=function(){return t(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(c){return this.red=c,this},n.prototype.forceRed=function(c){return t(!this.red,"Already a number in reduction context"),this._forceRed(c)},n.prototype.redAdd=function(c){return t(this.red,"redAdd works only with red numbers"),this.red.add(this,c)},n.prototype.redIAdd=function(c){return t(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,c)},n.prototype.redSub=function(c){return t(this.red,"redSub works only with red numbers"),this.red.sub(this,c)},n.prototype.redISub=function(c){return t(this.red,"redISub works only with red numbers"),this.red.isub(this,c)},n.prototype.redShl=function(c){return t(this.red,"redShl works only with red numbers"),this.red.shl(this,c)},n.prototype.redMul=function(c){return t(this.red,"redMul works only with red numbers"),this.red._verify2(this,c),this.red.mul(this,c)},n.prototype.redIMul=function(c){return t(this.red,"redMul works only with red numbers"),this.red._verify2(this,c),this.red.imul(this,c)},n.prototype.redSqr=function(){return t(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return t(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return t(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return t(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return t(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(c){return t(this.red&&!c.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,c)};var W={k256:null,p224:null,p192:null,p25519:null};function G(A,c){this.name=A,this.p=new n(c,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}G.prototype._tmp=function(){var c=new n(null);return c.words=new Array(Math.ceil(this.n/13)),c},G.prototype.ireduce=function(c){var d=c,g;do this.split(d,this.tmp),d=this.imulK(d),d=d.iadd(this.tmp),g=d.bitLength();while(g>this.n);var m=g0?d.isub(this.p):d.strip!==void 0?d.strip():d._strip(),d},G.prototype.split=function(c,d){c.iushrn(this.n,0,d)},G.prototype.imulK=function(c){return c.imul(this.k)};function P(){G.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(P,G),P.prototype.split=function(c,d){for(var g=4194303,m=Math.min(c.length,9),w=0;w>>22,S=N}S>>>=22,c.words[w-10]=S,S===0&&c.length>10?c.length-=10:c.length-=9},P.prototype.imulK=function(c){c.words[c.length]=0,c.words[c.length+1]=0,c.length+=2;for(var d=0,g=0;g>>=26,c.words[g]=w,d=m}return d!==0&&(c.words[c.length++]=d),c},n._prime=function(c){if(W[c])return W[c];var d;if(c==="k256")d=new P;else if(c==="p224")d=new F;else if(c==="p192")d=new $;else if(c==="p25519")d=new ce;else throw new Error("Unknown prime "+c);return W[c]=d,d};function Y(A){if(typeof A=="string"){var c=n._prime(A);this.m=c.p,this.prime=c}else t(A.gtn(1),"modulus must be greater than 1"),this.m=A,this.prime=null}Y.prototype._verify1=function(c){t(c.negative===0,"red works only with positives"),t(c.red,"red works only with red numbers")},Y.prototype._verify2=function(c,d){t((c.negative|d.negative)===0,"red works only with positives"),t(c.red&&c.red===d.red,"red works only with red numbers")},Y.prototype.imod=function(c){return this.prime?this.prime.ireduce(c)._forceRed(this):(h(c,c.umod(this.m)._forceRed(this)),c)},Y.prototype.neg=function(c){return c.isZero()?c.clone():this.m.sub(c)._forceRed(this)},Y.prototype.add=function(c,d){this._verify2(c,d);var g=c.add(d);return g.cmp(this.m)>=0&&g.isub(this.m),g._forceRed(this)},Y.prototype.iadd=function(c,d){this._verify2(c,d);var g=c.iadd(d);return g.cmp(this.m)>=0&&g.isub(this.m),g},Y.prototype.sub=function(c,d){this._verify2(c,d);var g=c.sub(d);return g.cmpn(0)<0&&g.iadd(this.m),g._forceRed(this)},Y.prototype.isub=function(c,d){this._verify2(c,d);var g=c.isub(d);return g.cmpn(0)<0&&g.iadd(this.m),g},Y.prototype.shl=function(c,d){return this._verify1(c),this.imod(c.ushln(d))},Y.prototype.imul=function(c,d){return this._verify2(c,d),this.imod(c.imul(d))},Y.prototype.mul=function(c,d){return this._verify2(c,d),this.imod(c.mul(d))},Y.prototype.isqr=function(c){return this.imul(c,c.clone())},Y.prototype.sqr=function(c){return this.mul(c,c)},Y.prototype.sqrt=function(c){if(c.isZero())return c.clone();var d=this.m.andln(3);if(t(d%2===1),d===3){var g=this.m.add(new n(1)).iushrn(2);return this.pow(c,g)}for(var m=this.m.subn(1),w=0;!m.isZero()&&m.andln(1)===0;)w++,m.iushrn(1);t(!m.isZero());var S=new n(1).toRed(this),N=S.redNeg(),_=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new n(2*f*f).toRed(this);this.pow(f,_).cmp(N)!==0;)f.redIAdd(N);for(var C=this.pow(f,m),Z=this.pow(c,m.addn(1).iushrn(1)),te=this.pow(c,m),ee=w;te.cmp(S)!==0;){for(var ae=te,E=0;ae.cmp(S)!==0;E++)ae=ae.redSqr();t(E=0;w--){for(var C=d.words[w],Z=f-1;Z>=0;Z--){var te=C>>Z&1;if(S!==m[0]&&(S=this.sqr(S)),te===0&&N===0){_=0;continue}N<<=1,N|=te,_++,!(_!==g&&(w!==0||Z!==0))&&(S=this.mul(S,m[N]),_=0,N=0)}f=26}return S},Y.prototype.convertTo=function(c){var d=c.umod(this.m);return d===c?d.clone():d},Y.prototype.convertFrom=function(c){var d=c.clone();return d.red=null,d},n.mont=function(c){return new X(c)};function X(A){Y.call(this,A),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(X,Y),X.prototype.convertTo=function(c){return this.imod(c.ushln(this.shift))},X.prototype.convertFrom=function(c){var d=this.imod(c.mul(this.rinv));return d.red=null,d},X.prototype.imul=function(c,d){if(c.isZero()||d.isZero())return c.words[0]=0,c.length=1,c;var g=c.imul(d),m=g.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),w=g.isub(m).iushrn(this.shift),S=w;return w.cmp(this.m)>=0?S=w.isub(this.m):w.cmpn(0)<0&&(S=w.iadd(this.m)),S._forceRed(this)},X.prototype.mul=function(c,d){if(c.isZero()||d.isZero())return new n(0)._forceRed(this);var g=c.mul(d),m=g.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),w=g.isub(m).iushrn(this.shift),S=w;return w.cmp(this.m)>=0?S=w.isub(this.m):w.cmpn(0)<0&&(S=w.iadd(this.m)),S._forceRed(this)},X.prototype.invm=function(c){var d=this.imod(c._invmp(this.m).mul(this.r2));return d._forceRed(this)}})(typeof zw>"u"||zw,ZD)});var tO=D(Lp=>{"use strict";l();Object.defineProperty(Lp,"__esModule",{value:!0});Lp.TransactionStatus=void 0;var Cl=class{constructor(e){this.status=(e||"").toLowerCase()}static createUnknown(){return new Cl("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}};Lp.TransactionStatus=Cl});var ju=D(Jt=>{"use strict";l();var qG=Jt&&Jt.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),VG=Jt&&Jt.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),HG=Jt&&Jt.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&qG(e,r,t);return VG(e,r),e};Object.defineProperty(Jt,"__esModule",{value:!0});Jt.zeroPadStringIfOddLength=Jt.isPaddedHex=Jt.numberToPaddedHex=Jt.Nonce=Jt.Address=void 0;var rO=HG(ef()),QG="erd",Sl=class{constructor(e){this.value=e}static fromPubkey(e){let t=rO.toWords(e),i=rO.encode(QG,t);return new Sl(i)}bech32(){return this.value}toString(){return this.bech32()}};Jt.Address=Sl;var $w=class{constructor(e){this.value=e}valueOf(){return this.value}hex(){return iO(this.value)}};Jt.Nonce=$w;function iO(r){let e=r.toString(16);return nO(e)}Jt.numberToPaddedHex=iO;function jG(r){r=r||"";let e=y.Buffer.from(r,"hex").toString("hex");return r.toUpperCase()==e.toUpperCase()}Jt.isPaddedHex=jG;function nO(r){return r=r||"",r.length%2==1?"0"+r:r}Jt.zeroPadStringIfOddLength=nO});var oO=D(Rp=>{"use strict";l();Object.defineProperty(Rp,"__esModule",{value:!0});Rp.TransactionReceipt=void 0;var sO=ju(),xl=class{constructor(){this.value="",this.sender=new sO.Address(""),this.data="",this.hash=""}static fromHttpResponse(e){let t=new xl;return t.value=(e.value||0).toString(),t.sender=new sO.Address(e.sender),t.data=e.data,t.hash=e.txHash,t}};Rp.TransactionReceipt=xl});var aO=D(Ri=>{"use strict";l();Object.defineProperty(Ri,"__esModule",{value:!0});Ri.ErrContractQuery=Ri.ErrNetworkProvider=Ri.ErrUnexpectedCondition=Ri.Err=void 0;var Gu=class extends Error{constructor(e,t){super(e),this.inner=void 0,this.inner=t}};Ri.Err=Gu;var kw=class extends Gu{constructor(e){super(`Unexpected condition: [${e}]`)}};Ri.ErrUnexpectedCondition=kw;var Ww=class extends Gu{constructor(e,t,i){let n=`Request error on url [${e}]: [${t}]`;super(n,i)}};Ri.ErrNetworkProvider=Ww;var Yw=class extends Gu{constructor(e){super(e.message.replace("executeQuery:",""))}};Ri.ErrContractQuery=Yw});var cO=D(Ku=>{"use strict";l();Object.defineProperty(Ku,"__esModule",{value:!0});Ku.TransactionEventTopic=Ku.TransactionEvent=void 0;var uO=ju(),Tl=class{constructor(e){this.address=new uO.Address(""),this.identifier="",this.topics=[],this.data="",Object.assign(this,e)}static fromHttpResponse(e){let t=new Tl;return t.address=new uO.Address(e.address),t.identifier=e.identifier||"",t.topics=(e.topics||[]).map(i=>new Fp(i)),t.data=y.Buffer.from(e.data||"","base64").toString(),t}findFirstOrNoneTopic(e){return this.topics.filter(t=>e(t))[0]}getLastTopic(){return this.topics[this.topics.length-1]}};Ku.TransactionEvent=Tl;var Fp=class{constructor(e){this.raw=y.Buffer.from(e||"","base64")}toString(){return this.raw.toString("utf8")}hex(){return this.raw.toString("hex")}valueOf(){return this.raw}};Ku.TransactionEventTopic=Fp});var Jw=D(Up=>{"use strict";l();Object.defineProperty(Up,"__esModule",{value:!0});Up.TransactionLogs=void 0;var GG=aO(),lO=ju(),KG=cO(),Nl=class{constructor(e){this.address=new lO.Address(""),this.events=[],Object.assign(this,e)}static fromHttpResponse(e){let t=new Nl;return t.address=new lO.Address(e.address),t.events=(e.events||[]).map(i=>KG.TransactionEvent.fromHttpResponse(i)),t}findSingleOrNoneEvent(e,t){let i=this.findEvents(e,t);if(i.length>1)throw new GG.ErrUnexpectedCondition(`more than one event of type ${e}`);return i[0]}findFirstOrNoneEvent(e,t){return this.findEvents(e,t)[0]}findEvents(e,t){let i=this.events.filter(n=>n.identifier==e);return t&&(i=i.filter(n=>t(n))),i}};Up.TransactionLogs=Nl});var hO=D($u=>{"use strict";l();Object.defineProperty($u,"__esModule",{value:!0});$u.ContractResultItem=$u.ContractResults=void 0;var fO=Jw(),qp=ju(),zu=class{constructor(e){this.items=e,this.items.sort(function(t,i){return t.nonce.valueOf()-i.nonce.valueOf()})}static fromProxyHttpResponse(e){let t=e.map(i=>fn.fromProxyHttpResponse(i));return new zu(t)}static fromApiHttpResponse(e){let t=e.map(i=>fn.fromApiHttpResponse(i));return new zu(t)}};$u.ContractResults=zu;var fn=class{constructor(e){this.hash="",this.nonce=0,this.value="",this.receiver=new qp.Address(""),this.sender=new qp.Address(""),this.data="",this.previousHash="",this.originalHash="",this.gasLimit=0,this.gasPrice=0,this.callType=0,this.returnMessage="",this.logs=new fO.TransactionLogs,Object.assign(this,e)}static fromProxyHttpResponse(e){return fn.fromHttpResponse(e)}static fromApiHttpResponse(e){let t=fn.fromHttpResponse(e);return t.data=y.Buffer.from(t.data,"base64").toString(),t.callType=Number(t.callType),t}static fromHttpResponse(e){let t=new fn;return t.hash=e.hash,t.nonce=Number(e.nonce||0),t.value=(e.value||0).toString(),t.receiver=new qp.Address(e.receiver),t.sender=new qp.Address(e.sender),t.previousHash=e.prevTxHash,t.originalHash=e.originalTxHash,t.gasLimit=Number(e.gasLimit||0),t.gasPrice=Number(e.gasPrice||0),t.data=e.data||"",t.callType=e.callType,t.returnMessage=e.returnMessage,t.logs=fO.TransactionLogs.fromHttpResponse(e.logs||{}),t}};$u.ContractResultItem=fn});var dO=D(us=>{"use strict";l();var zG=us&&us.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(us,"__esModule",{value:!0});us.EsdtContractAddress=us.MaxUint64AsBigNumber=void 0;var $G=zG(Vr()),kG=ju();us.MaxUint64AsBigNumber=new $G.default("18446744073709551615");us.EsdtContractAddress=new kG.Address("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u")});var pO=D(ku=>{"use strict";l();var WG=ku&&ku.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(ku,"__esModule",{value:!0});ku.ContractQueryResponse=void 0;var YG=WG(Vr()),JG=dO(),Dl=class{constructor(e){this.returnData=e?.returnData||[],this.returnCode=e?.returnCode||"",this.returnMessage=e?.returnMessage||"",this.gasUsed=e?.gasUsed||0}static fromHttpResponse(e){let t=e.returnData||e.ReturnData,i=e.returnCode||e.ReturnCode,n=e.returnMessage||e.ReturnMessage,s=new YG.default(e.gasRemaining||e.GasRemaining||0),o=JG.MaxUint64AsBigNumber.minus(s).toNumber();return new Dl({returnData:t,returnCode:i,returnMessage:n,gasUsed:o})}getReturnDataParts(){return this.returnData.map(e=>y.Buffer.from(e||"","base64"))}toJSON(){return{returnData:this.returnData,returnCode:this.returnCode,returnMessage:this.returnMessage,gasUsed:this.gasUsed.valueOf()}}};ku.ContractQueryResponse=Dl});var gO=D(Vp=>{"use strict";l();Object.defineProperty(Vp,"__esModule",{value:!0});Vp.ContractQueryRequest=void 0;var Xw=class{constructor(e){this.query=e}toHttpRequest(){var e;let t={},i=this.query;return t.scAddress=i.address.bech32(),t.caller=!((e=i.caller)===null||e===void 0)&&e.bech32()?i.caller.bech32():void 0,t.funcName=i.func.toString(),t.value=i.value?i.value.toString():void 0,t.args=i.getEncodedArguments(),t}};Vp.ContractQueryRequest=Xw});var yO=D(Hp=>{"use strict";l();Object.defineProperty(Hp,"__esModule",{value:!0});Hp.Query=void 0;var XG=Hr(),ZG=Wf(),Zw=class{constructor(e){this.caller=e.caller||new XG.Address,this.address=e.address,this.func=e.func,this.args=e.args||[],this.value=e.value||0}getEncodedArguments(){return new ZG.ArgSerializer().valuesToStrings(this.args)}};Hp.Query=Zw});var xO=D((qne,SO)=>{l();SO.exports=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}});var cs=D(bo=>{l();var eE,eK=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];bo.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return e*4+17};bo.getSymbolTotalCodewords=function(e){return eK[e]};bo.getBCHDigit=function(r){let e=0;for(;r!==0;)e++,r>>>=1;return e};bo.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');eE=e};bo.isKanjiModeEnabled=function(){return typeof eE<"u"};bo.toSJIS=function(e){return eE(e)}});var Gp=D(qr=>{l();qr.L={bit:1};qr.M={bit:0};qr.Q={bit:3};qr.H={bit:2};function tK(r){if(typeof r!="string")throw new Error("Param is not a string");switch(r.toLowerCase()){case"l":case"low":return qr.L;case"m":case"medium":return qr.M;case"q":case"quartile":return qr.Q;case"h":case"high":return qr.H;default:throw new Error("Unknown EC Level: "+r)}}qr.isValid=function(e){return e&&typeof e.bit<"u"&&e.bit>=0&&e.bit<4};qr.from=function(e,t){if(qr.isValid(e))return e;try{return tK(e)}catch{return t}}});var DO=D((Kne,NO)=>{l();function TO(){this.buffer=[],this.length=0}TO.prototype={get:function(r){let e=Math.floor(r/8);return(this.buffer[e]>>>7-r%8&1)===1},put:function(r,e){for(let t=0;t>>e-t-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(r){let e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),r&&(this.buffer[e]|=128>>>this.length%8),this.length++}};NO.exports=TO});var BO=D(($ne,OO)=>{l();function Ol(r){if(!r||r<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=r,this.data=new Uint8Array(r*r),this.reservedBit=new Uint8Array(r*r)}Ol.prototype.set=function(r,e,t,i){let n=r*this.size+e;this.data[n]=t,i&&(this.reservedBit[n]=!0)};Ol.prototype.get=function(r,e){return this.data[r*this.size+e]};Ol.prototype.xor=function(r,e,t){this.data[r*this.size+e]^=t};Ol.prototype.isReserved=function(r,e){return this.reservedBit[r*this.size+e]};OO.exports=Ol});var MO=D(Kp=>{l();var rK=cs().getSymbolSize;Kp.getRowColCoords=function(e){if(e===1)return[];let t=Math.floor(e/7)+2,i=rK(e),n=i===145?26:Math.ceil((i-13)/(2*t-2))*2,s=[i-7];for(let o=1;o{l();var iK=cs().getSymbolSize,PO=7;LO.getPositions=function(e){let t=iK(e);return[[0,0],[t-PO,0],[0,t-PO]]}});var FO=D($e=>{l();$e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var Co={N1:3,N2:3,N3:40,N4:10};$e.isValid=function(e){return e!=null&&e!==""&&!isNaN(e)&&e>=0&&e<=7};$e.from=function(e){return $e.isValid(e)?parseInt(e,10):void 0};$e.getPenaltyN1=function(e){let t=e.size,i=0,n=0,s=0,o=null,a=null;for(let u=0;u=5&&(i+=Co.N1+(n-5)),o=p,n=1),p=e.get(h,u),p===a?s++:(s>=5&&(i+=Co.N1+(s-5)),a=p,s=1)}n>=5&&(i+=Co.N1+(n-5)),s>=5&&(i+=Co.N1+(s-5))}return i};$e.getPenaltyN2=function(e){let t=e.size,i=0;for(let n=0;n=10&&(n===1488||n===93)&&i++,s=s<<1&2047|e.get(a,o),a>=10&&(s===1488||s===93)&&i++}return i*Co.N3};$e.getPenaltyN4=function(e){let t=0,i=e.data.length;for(let s=0;s{l();var ls=Gp(),zp=[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],$p=[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];tE.getBlocksCount=function(e,t){switch(t){case ls.L:return zp[(e-1)*4+0];case ls.M:return zp[(e-1)*4+1];case ls.Q:return zp[(e-1)*4+2];case ls.H:return zp[(e-1)*4+3];default:return}};tE.getTotalCodewordsCount=function(e,t){switch(t){case ls.L:return $p[(e-1)*4+0];case ls.M:return $p[(e-1)*4+1];case ls.Q:return $p[(e-1)*4+2];case ls.H:return $p[(e-1)*4+3];default:return}}});var UO=D(Wp=>{l();var Bl=new Uint8Array(512),kp=new Uint8Array(256);(function(){let e=1;for(let t=0;t<255;t++)Bl[t]=e,kp[e]=t,e<<=1,e&256&&(e^=285);for(let t=255;t<512;t++)Bl[t]=Bl[t-255]})();Wp.log=function(e){if(e<1)throw new Error("log("+e+")");return kp[e]};Wp.exp=function(e){return Bl[e]};Wp.mul=function(e,t){return e===0||t===0?0:Bl[kp[e]+kp[t]]}});var qO=D(Ml=>{l();var iE=UO();Ml.mul=function(e,t){let i=new Uint8Array(e.length+t.length-1);for(let n=0;n=0;){let n=i[0];for(let o=0;o{l();var VO=qO();function nE(r){this.genPoly=void 0,this.degree=r,this.degree&&this.initialize(this.degree)}nE.prototype.initialize=function(e){this.degree=e,this.genPoly=VO.generateECPolynomial(this.degree)};nE.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");let t=new Uint8Array(e.length+this.degree);t.set(e);let i=VO.mod(t,this.genPoly),n=this.degree-i.length;if(n>0){let s=new Uint8Array(this.degree);return s.set(i,n),s}return i};HO.exports=nE});var sE=D(jO=>{l();jO.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}});var oE=D(hn=>{l();var GO="[0-9]+",sK="[A-Z $%*+\\-./:]+",Pl="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";Pl=Pl.replace(/u/g,"\\u");var oK="(?:(?![A-Z0-9 $%*+\\-./:]|"+Pl+`)(?:.|[\r -]))+`;hn.KANJI=new RegExp(Pl,"g");hn.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");hn.BYTE=new RegExp(oK,"g");hn.NUMERIC=new RegExp(GO,"g");hn.ALPHANUMERIC=new RegExp(sK,"g");var aK=new RegExp("^"+Pl+"$"),uK=new RegExp("^"+GO+"$"),cK=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");hn.testKanji=function(e){return aK.test(e)};hn.testNumeric=function(e){return uK.test(e)};hn.testAlphanumeric=function(e){return cK.test(e)}});var fs=D(Lt=>{l();var lK=sE(),aE=oE();Lt.NUMERIC={id:"Numeric",bit:1<<0,ccBits:[10,12,14]};Lt.ALPHANUMERIC={id:"Alphanumeric",bit:1<<1,ccBits:[9,11,13]};Lt.BYTE={id:"Byte",bit:1<<2,ccBits:[8,16,16]};Lt.KANJI={id:"Kanji",bit:1<<3,ccBits:[8,10,12]};Lt.MIXED={bit:-1};Lt.getCharCountIndicator=function(e,t){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!lK.isValid(t))throw new Error("Invalid version: "+t);return t>=1&&t<10?e.ccBits[0]:t<27?e.ccBits[1]:e.ccBits[2]};Lt.getBestModeForData=function(e){return aE.testNumeric(e)?Lt.NUMERIC:aE.testAlphanumeric(e)?Lt.ALPHANUMERIC:aE.testKanji(e)?Lt.KANJI:Lt.BYTE};Lt.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")};Lt.isValid=function(e){return e&&e.bit&&e.ccBits};function fK(r){if(typeof r!="string")throw new Error("Param is not a string");switch(r.toLowerCase()){case"numeric":return Lt.NUMERIC;case"alphanumeric":return Lt.ALPHANUMERIC;case"kanji":return Lt.KANJI;case"byte":return Lt.BYTE;default:throw new Error("Unknown mode: "+r)}}Lt.from=function(e,t){if(Lt.isValid(e))return e;try{return fK(e)}catch{return t}}});var WO=D(So=>{l();var Yp=cs(),hK=rE(),KO=Gp(),hs=fs(),uE=sE(),$O=1<<12|1<<11|1<<10|1<<9|1<<8|1<<5|1<<2|1<<0,zO=Yp.getBCHDigit($O);function dK(r,e,t){for(let i=1;i<=40;i++)if(e<=So.getCapacity(i,t,r))return i}function kO(r,e){return hs.getCharCountIndicator(r,e)+4}function pK(r,e){let t=0;return r.forEach(function(i){let n=kO(i.mode,e);t+=n+i.getBitsLength()}),t}function gK(r,e){for(let t=1;t<=40;t++)if(pK(r,t)<=So.getCapacity(t,e,hs.MIXED))return t}So.from=function(e,t){return uE.isValid(e)?parseInt(e,10):t};So.getCapacity=function(e,t,i){if(!uE.isValid(e))throw new Error("Invalid QR Code version");typeof i>"u"&&(i=hs.BYTE);let n=Yp.getSymbolTotalCodewords(e),s=hK.getTotalCodewordsCount(e,t),o=(n-s)*8;if(i===hs.MIXED)return o;let a=o-kO(i,e);switch(i){case hs.NUMERIC:return Math.floor(a/10*3);case hs.ALPHANUMERIC:return Math.floor(a/11*2);case hs.KANJI:return Math.floor(a/13);case hs.BYTE:default:return Math.floor(a/8)}};So.getBestVersionForData=function(e,t){let i,n=KO.from(t,KO.M);if(Array.isArray(e)){if(e.length>1)return gK(e,n);if(e.length===0)return 1;i=e[0]}else i=e;return dK(i.mode,i.getLength(),n)};So.getEncodedBits=function(e){if(!uE.isValid(e)||e<7)throw new Error("Invalid QR Code version");let t=e<<12;for(;Yp.getBCHDigit(t)-zO>=0;)t^=$O<{l();var cE=cs(),JO=1<<10|1<<8|1<<5|1<<4|1<<2|1<<1|1<<0,yK=1<<14|1<<12|1<<10|1<<4|1<<1,YO=cE.getBCHDigit(JO);XO.getEncodedBits=function(e,t){let i=e.bit<<3|t,n=i<<10;for(;cE.getBCHDigit(n)-YO>=0;)n^=JO<{l();var mK=fs();function Wu(r){this.mode=mK.NUMERIC,this.data=r.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 t,i,n;for(t=0;t+3<=this.data.length;t+=3)i=this.data.substr(t,3),n=parseInt(i,10),e.put(n,10);let s=this.data.length-t;s>0&&(i=this.data.substr(t),n=parseInt(i,10),e.put(n,s*3+1))};e8.exports=Wu});var i8=D((Ase,r8)=>{l();var vK=fs(),lE=["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 Yu(r){this.mode=vK.ALPHANUMERIC,this.data=r}Yu.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)};Yu.prototype.getLength=function(){return this.data.length};Yu.prototype.getBitsLength=function(){return Yu.getBitsLength(this.data.length)};Yu.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let i=lE.indexOf(this.data[t])*45;i+=lE.indexOf(this.data[t+1]),e.put(i,11)}this.data.length%2&&e.put(lE.indexOf(this.data[t]),6)};r8.exports=Yu});var s8=D((Ise,n8)=>{"use strict";l();n8.exports=function(e){for(var t=[],i=e.length,n=0;n=55296&&s<=56319&&i>n+1){var o=e.charCodeAt(n+1);o>=56320&&o<=57343&&(s=(s-55296)*1024+o-56320+65536,n+=1)}if(s<128){t.push(s);continue}if(s<2048){t.push(s>>6|192),t.push(s&63|128);continue}if(s<55296||s>=57344&&s<65536){t.push(s>>12|224),t.push(s>>6&63|128),t.push(s&63|128);continue}if(s>=65536&&s<=1114111){t.push(s>>18|240),t.push(s>>12&63|128),t.push(s>>6&63|128),t.push(s&63|128);continue}t.push(239,191,189)}return new Uint8Array(t).buffer}});var a8=D((Cse,o8)=>{l();var wK=s8(),EK=fs();function Ju(r){this.mode=EK.BYTE,typeof r=="string"&&(r=wK(r)),this.data=new Uint8Array(r)}Ju.getBitsLength=function(e){return e*8};Ju.prototype.getLength=function(){return this.data.length};Ju.prototype.getBitsLength=function(){return Ju.getBitsLength(this.data.length)};Ju.prototype.write=function(r){for(let e=0,t=this.data.length;e{l();var AK=fs(),_K=cs();function Xu(r){this.mode=AK.KANJI,this.data=r}Xu.getBitsLength=function(e){return e*13};Xu.prototype.getLength=function(){return this.data.length};Xu.prototype.getBitsLength=function(){return Xu.getBitsLength(this.data.length)};Xu.prototype.write=function(r){let e;for(e=0;e=33088&&t<=40956)t-=33088;else if(t>=57408&&t<=60351)t-=49472;else throw new Error("Invalid SJIS character: "+this.data[e]+` -Make sure your charset is UTF-8`);t=(t>>>8&255)*192+(t&255),r.put(t,13)}};u8.exports=Xu});var l8=D((Nse,fE)=>{"use strict";l();var Ll={single_source_shortest_paths:function(r,e,t){var i={},n={};n[e]=0;var s=Ll.PriorityQueue.make();s.push(e,0);for(var o,a,u,h,p,v,B,R,x;!s.empty();){o=s.pop(),a=o.value,h=o.cost,p=r[a]||{};for(u in p)p.hasOwnProperty(u)&&(v=p[u],B=h+v,R=n[u],x=typeof n[u]>"u",(x||R>B)&&(n[u]=B,s.push(u,B),i[u]=a))}if(typeof t<"u"&&typeof n[t]>"u"){var V=["Could not find a path from ",e," to ",t,"."].join("");throw new Error(V)}return i},extract_shortest_path_from_predecessor_list:function(r,e){for(var t=[],i=e,n;i;)t.push(i),n=r[i],i=r[i];return t.reverse(),t},find_path:function(r,e,t){var i=Ll.single_source_shortest_paths(r,e,t);return Ll.extract_shortest_path_from_predecessor_list(i,t)},PriorityQueue:{make:function(r){var e=Ll.PriorityQueue,t={},i;r=r||{};for(i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);return t.queue=[],t.sorter=r.sorter||e.default_sorter,t},default_sorter:function(r,e){return r.cost-e.cost},push:function(r,e){var t={value:r,cost:e};this.queue.push(t),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};typeof fE<"u"&&(fE.exports=Ll)});var v8=D(Zu=>{l();var Ve=fs(),d8=t8(),p8=i8(),g8=a8(),y8=c8(),Rl=oE(),Jp=cs(),IK=l8();function f8(r){return unescape(encodeURIComponent(r)).length}function Fl(r,e,t){let i=[],n;for(;(n=r.exec(t))!==null;)i.push({data:n[0],index:n.index,mode:e,length:n[0].length});return i}function m8(r){let e=Fl(Rl.NUMERIC,Ve.NUMERIC,r),t=Fl(Rl.ALPHANUMERIC,Ve.ALPHANUMERIC,r),i,n;return Jp.isKanjiModeEnabled()?(i=Fl(Rl.BYTE,Ve.BYTE,r),n=Fl(Rl.KANJI,Ve.KANJI,r)):(i=Fl(Rl.BYTE_KANJI,Ve.BYTE,r),n=[]),e.concat(t,i,n).sort(function(o,a){return o.index-a.index}).map(function(o){return{data:o.data,mode:o.mode,length:o.length}})}function hE(r,e){switch(e){case Ve.NUMERIC:return d8.getBitsLength(r);case Ve.ALPHANUMERIC:return p8.getBitsLength(r);case Ve.KANJI:return y8.getBitsLength(r);case Ve.BYTE:return g8.getBitsLength(r)}}function bK(r){return r.reduce(function(e,t){let i=e.length-1>=0?e[e.length-1]:null;return i&&i.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)},[])}function CK(r){let e=[];for(let t=0;t{l();var Zp=cs(),dE=Gp(),xK=DO(),TK=BO(),NK=MO(),DK=RO(),yE=FO(),mE=rE(),OK=QO(),Xp=WO(),BK=ZO(),MK=fs(),pE=v8();function PK(r,e){let t=r.size,i=DK.getPositions(e);for(let n=0;n=0&&a<=6&&(u===0||u===6)||u>=0&&u<=6&&(a===0||a===6)||a>=2&&a<=4&&u>=2&&u<=4?r.set(s+a,o+u,!0,!0):r.set(s+a,o+u,!1,!0))}}function LK(r){let e=r.size;for(let t=8;t>a&1)===1,r.set(n,s,o,!0),r.set(s,n,o,!0)}function gE(r,e,t){let i=r.size,n=BK.getEncodedBits(e,t),s,o;for(s=0;s<15;s++)o=(n>>s&1)===1,s<6?r.set(s,8,o,!0):s<8?r.set(s+1,8,o,!0):r.set(i-15+s,8,o,!0),s<8?r.set(8,i-s-1,o,!0):s<9?r.set(8,15-s-1+1,o,!0):r.set(8,15-s-1,o,!0);r.set(i-8,8,1,!0)}function UK(r,e){let t=r.size,i=-1,n=t-1,s=7,o=0;for(let a=t-1;a>0;a-=2)for(a===6&&a--;;){for(let u=0;u<2;u++)if(!r.isReserved(n,a-u)){let h=!1;o>>s&1)===1),r.set(n,a-u,h),s--,s===-1&&(o++,s=7)}if(n+=i,n<0||t<=n){n-=i,i=-i;break}}}function qK(r,e,t){let i=new xK;t.forEach(function(u){i.put(u.mode.bit,4),i.put(u.getLength(),MK.getCharCountIndicator(u.mode,r)),u.write(i)});let n=Zp.getSymbolTotalCodewords(r),s=mE.getTotalCodewordsCount(r,e),o=(n-s)*8;for(i.getLengthInBits()+4<=o&&i.put(0,4);i.getLengthInBits()%8!==0;)i.putBit(0);let a=(o-i.getLengthInBits())/8;for(let u=0;u=7&&FK(u,e),UK(u,o),isNaN(i)&&(i=yE.getBestMask(u,gE.bind(null,u,t))),yE.applyMask(i,u),gE(u,t,i),{modules:u,version:e,errorCorrectionLevel:t,maskPattern:i,segments:n}}w8.create=function(e,t){if(typeof e>"u"||e==="")throw new Error("No input text");let i=dE.M,n,s;return typeof t<"u"&&(i=dE.from(t.errorCorrectionLevel,dE.M),n=Xp.from(t.version),s=yE.from(t.maskPattern),t.toSJISFunc&&Zp.setToSJISFunction(t.toSJISFunc)),HK(e,n,i,s)}});var vE=D(xo=>{l();function A8(r){if(typeof r=="number"&&(r=r.toString()),typeof r!="string")throw new Error("Color should be defined as hex string");let e=r.slice().replace("#","").split("");if(e.length<3||e.length===5||e.length>8)throw new Error("Invalid hex color: "+r);(e.length===3||e.length===4)&&(e=Array.prototype.concat.apply([],e.map(function(i){return[i,i]}))),e.length===6&&e.push("F","F");let t=parseInt(e.join(""),16);return{r:t>>24&255,g:t>>16&255,b:t>>8&255,a:t&255,hex:"#"+e.slice(0,6).join("")}}xo.getOptions=function(e){e||(e={}),e.color||(e.color={});let t=typeof e.margin>"u"||e.margin===null||e.margin<0?4:e.margin,i=e.width&&e.width>=21?e.width:void 0,n=e.scale||4;return{width:i,scale:i?4:n,margin:t,color:{dark:A8(e.color.dark||"#000000ff"),light:A8(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}};xo.getScale=function(e,t){return t.width&&t.width>=e+t.margin*2?t.width/(e+t.margin*2):t.scale};xo.getImageWidth=function(e,t){let i=xo.getScale(e,t);return Math.floor((e+t.margin*2)*i)};xo.qrToImageData=function(e,t,i){let n=t.modules.size,s=t.modules.data,o=xo.getScale(n,i),a=Math.floor((n+i.margin*2)*o),u=i.margin*o,h=[i.color.light,i.color.dark];for(let p=0;p=u&&v>=u&&p{l();var wE=vE();function QK(r,e,t){r.clearRect(0,0,e.width,e.height),e.style||(e.style={}),e.height=t,e.width=t,e.style.height=t+"px",e.style.width=t+"px"}function jK(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}e0.render=function(e,t,i){let n=i,s=t;typeof n>"u"&&(!t||!t.getContext)&&(n=t,t=void 0),t||(s=jK()),n=wE.getOptions(n);let o=wE.getImageWidth(e.modules.size,n),a=s.getContext("2d"),u=a.createImageData(o,o);return wE.qrToImageData(u.data,e,n),QK(a,s,o),a.putImageData(u,0,0),s};e0.renderToDataURL=function(e,t,i){let n=i;typeof n>"u"&&(!t||!t.getContext)&&(n=t,t=void 0),n||(n={});let s=e0.render(e,t,n),o=n.type||"image/png",a=n.rendererOpts||{};return s.toDataURL(o,a.quality)}});var C8=D(b8=>{l();var GK=vE();function I8(r,e){let t=r.a/255,i=e+'="'+r.hex+'"';return t<1?i+" "+e+'-opacity="'+t.toFixed(2).slice(1)+'"':i}function EE(r,e,t){let i=r+e;return typeof t<"u"&&(i+=" "+t),i}function KK(r,e,t){let i="",n=0,s=!1,o=0;for(let a=0;a0&&u>0&&r[a-1]||(i+=s?EE("M",u+t,.5+h+t):EE("m",n,0),n=0,s=!1),u+1':"",h="',p='viewBox="0 0 '+a+" "+a+'"',B=''+u+h+` -`;return typeof i=="function"&&i(null,B),B}});var x8=D(Ul=>{l();var zK=xO(),AE=E8(),S8=_8(),$K=C8();function _E(r,e,t,i,n){let s=[].slice.call(arguments,1),o=s.length,a=typeof s[o-1]=="function";if(!a&&!zK())throw new Error("Callback required as last argument");if(a){if(o<2)throw new Error("Too few arguments provided");o===2?(n=t,t=e,e=i=void 0):o===3&&(e.getContext&&typeof n>"u"?(n=i,i=void 0):(n=i,i=t,t=e,e=void 0))}else{if(o<1)throw new Error("Too few arguments provided");return o===1?(t=e,e=i=void 0):o===2&&!e.getContext&&(i=t,t=e,e=void 0),new Promise(function(u,h){try{let p=AE.create(t,i);u(r(p,e,i))}catch(p){h(p)}})}try{let u=AE.create(t,i);n(null,r(u,e,i))}catch(u){n(u)}}Ul.create=AE.create;Ul.toCanvas=_E.bind(null,S8.render);Ul.toDataURL=_E.bind(null,S8.renderToDataURL);Ul.toString=_E.bind(null,function(r,e,t){return $K.render(r,t)})});var U8=D(ds=>{"use strict";l();var XK=ds&&ds.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),F8=ds&&ds.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&XK(e,r,t)};Object.defineProperty(ds,"__esModule",{value:!0});F8(bl(),ds);F8(jw(),ds)});l();var ZK=_e(dg(),1),G8=_e(Z_(),1),ez=_e(Hr(),1),tz=_e(Xf(),1),rz=_e(Wy(),1),iz=_e(dc(),1),nz=_e(em(),1),sz=_e(mn(),1),K8=_e(lc(),1),oz=_e(ac(),1),az=_e(gy(),1),uz=_e(eC(),1),cz=_e(Wo(),1);l();l();var aC=_e(sm(),1);l();l();var fh="elvenjs_state",sC="https://devnet-api.elrond.com";var hh="/dapp/init",dh="devnet",oC="https://maiar.page.link/?apn=com.elrond.maiar.wallet&isi=1519405832&ibi=com.elrond.maiar.wallet&link=https://maiar.com/";var ph=["wss://relay.walletconnect.com"],Si={devnet:{id:"devnet",shortId:"D",name:"Devnet",egldLabel:"xEGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://devnet-wallet.elrond.com",apiAddress:"https://devnet-api.elrond.com",explorerAddress:"https://devnet-explorer.elrond.com",apiTimeout:1e4},testnet:{id:"testnet",shortId:"T",name:"Testnet",egldLabel:"xEGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://testnet-wallet.elrond.com",apiAddress:"https://testnet-api.elrond.com",explorerAddress:"https://testnet-explorer.elrond.com",apiTimeout:1e4},mainnet:{id:"mainnet",shortId:"1",name:"Mainnet",egldLabel:"EGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://wallet.elrond.com",apiAddress:"https://api.elrond.com",explorerAddress:"https://explorer.elrond.com",apiTimeout:1e4}};var xe={get(r){let e=localStorage.getItem(fh);if(!e)return{};let t=JSON.parse(e);return r?t[r]:t},set(r,e){let t=this.get();t[r]=e,localStorage.setItem(fh,JSON.stringify(t))},clear(){localStorage.removeItem(fh)}};var gh=()=>Te(void 0,null,function*(){let r=aC.ExtensionProvider.getInstance();try{let e=yield r.init(),t=xe.get();if(t!=null&&t.address&&r.setAddress(t.address),!e){console.warn("Something went wrong when trying to initialize the ExtensionProvider..");return}return r}catch(e){console.warn("Can't initialize the Dapp Provider!")}});var H8=_e(sm(),1),Q8=_e(wp(),1),j8=_e(bl(),1);l();var YD=_e(wp(),1);l();l();var Fe=class{static set(e,t){if(!e)return;let i=LE(Ql({},this.events),{[e]:t});this.events=i}static get(e){if(!(!e||!this.events))return this.events[e]}static run(e,t){var i,n;!e||!this.events||(n=(i=this.events)[e])==null||n.call(i,t)}static clear(){this.events=void 0}};var Hu=r=>Te(void 0,null,function*(){if(!r.dappProvider)throw new Error("Error: Logout failed: There is no active session!");Fe.run("onLoginPending");let e=yield r.dappProvider.logout();return e&&(xe.clear(),Fe.run("onLogout")),e});l();var kD=_e(Hr(),1),WD=_e(Xf(),1);l();var Ar=r=>typeof r=="string"?r.toUpperCase():r instanceof Error?r.message:`Error: ${JSON.stringify(r)}`;l();var Qu=()=>new Date().setHours(new Date().getHours()+24),Mp=r=>Date.now()>r;var as=r=>Te(void 0,null,function*(){let e=xe.get("address"),t=xe.get("expires");if(!(t&&Mp(t))&&e&&r.networkProvider){let n=new kD.Address(e),s=new WD.Account(n);try{let o=yield r.networkProvider.getAccount(n);xe.set("address",e),xe.set("nonce",o.nonce.valueOf()),xe.set("balance",o.balance.toString()),s.update(o)}catch(o){let a=Ar(o);console.warn(`Something went wrong trying to synchronize the user account: ${a}`)}}});l();function Pp(r){return r[Math.floor(Math.random()*r.length)]}var JD=r=>Te(void 0,null,function*(){if(!r.initOptions.walletConnectV2ProjectId||!r.initOptions.chainType)return;let e={onClientLogin:()=>{as(r),Fe.run("onLoggedIn")},onClientLogout:()=>Hu(r),onClientEvent:n=>{console.log("wc2 session event: ",n)}},t=Pp(ph),i=new YD.WalletConnectV2Provider(e,Si[r.initOptions.chainType].shortId,t,r.initOptions.walletConnectV2ProjectId);try{return yield i.init(),i}catch(n){console.warn("Can't initialize the Dapp Provider!")}});l();var mO=_e(eO(),1),Qp=_e(Hr(),1),vO=_e(tO(),1),wO=_e(oO(),1),EO=_e(Jw(),1),AO=_e(hO(),1),_O=_e(pO(),1),IO=_e(gO(),1),bO=_e(yO(),1);var jp=class{constructor({apiUrl:e,chainType:t,apiTimeout:i}){var n,s;this.chainType=t||dh,this.apiUrl=e||((n=Si[this.chainType])==null?void 0:n.apiAddress),this.apiTimeout=i||((s=Si[this.chainType])==null?void 0:s.apiTimeout)}apiGet(e,t){return Te(this,null,function*(){if(typeof fetch!="undefined"){let i=new AbortController,n=setTimeout(()=>i.abort(),this.apiTimeout),s={method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json"},signal:i.signal};try{let o=yield fetch(this.apiUrl+"/"+e,Object.assign(s,t||{})),a=yield o.json();if(!o.ok){let u=(a==null?void 0:a.error)||o.status;return clearTimeout(n),Promise.reject(u)}return clearTimeout(n),a}catch(o){this.handleApiError(o,e)}}})}apiPost(e,t,i){return Te(this,null,function*(){if(typeof fetch!="undefined"){let n=new AbortController,s=setTimeout(()=>n.abort(),this.apiTimeout),o={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(t||{}),signal:n.signal};try{let a=yield fetch(this.apiUrl+"/"+e,Object.assign(o,i||{})),u=yield a.json();if(!a.ok){let h=(u==null?void 0:u.error)||a.status;return clearTimeout(s),Promise.reject(h)}return clearTimeout(s),u}catch(a){this.handleApiError(a,e)}}})}handleApiError(e,t){if(!e.response)throw new Error(`Request error on url [${t}]: [${e.toString()}]`);let i=e.response.data,n=i.error||i.message||JSON.stringify(i);throw new Error(n)}sendTransaction(e){return Te(this,null,function*(){return(yield this.apiPost("transactions",e.toSendable())).txHash})}getAccount(e){return Te(this,null,function*(){let t=yield this.apiGet(`accounts/${e.bech32()}`);return{address:new Qp.Address((t==null?void 0:t.address)||""),nonce:Number((t==null?void 0:t.nonce)||0),balance:new mO.default((t==null?void 0:t.balance)||0),code:(t==null?void 0:t.code)||"",userName:(t==null?void 0:t.username)||""}})}getTransaction(e){return Te(this,null,function*(){let t=yield this.apiGet(`transactions/${e}`),i=new vO.TransactionStatus(t.status);return{hash:e,type:t.type||"",nonce:t.nonce||0,round:t.round,epoch:t.epoch||0,value:(t.value||0).toString(),sender:new Qp.Address(t.sender),receiver:new Qp.Address(t.receiver),gasPrice:t.gasPrice||0,gasLimit:t.gasLimit||0,data:y.Buffer.from(t.data||"","base64"),status:i,timestamp:t.timestamp||0,blockNonce:t.blockNonce||0,hyperblockNonce:t.hyperblockNonce||0,hyperblockHash:t.hyperblockHash||"",receipt:wO.TransactionReceipt.fromHttpResponse(t.receipt||{}),logs:EO.TransactionLogs.fromHttpResponse(t.logs||{}),contractResults:AO.ContractResults.fromApiHttpResponse(t.results||[]),isCompleted:!i.isPending()}})}queryContract(o){return Te(this,arguments,function*({address:e,func:t,args:i,value:n,caller:s}){try{let a=new bO.Query({address:e,func:t,args:i,value:n,caller:s}),u=new IO.ContractQueryRequest(a).toHttpRequest(),h=yield this.apiPost("query",u);return _O.ContractQueryResponse.fromHttpResponse(h)}catch(a){this.handleApiError(a,"query")}})}};l();var Io=(n=>(n.ledger="ledger",n.maiarMobile="maiar-mobile",n.webWallet="web-wallet",n.maiarBrowserExtension="maiar-browser-extension",n))(Io||{});l();var CO=(r,e)=>Te(void 0,null,function*(){let t=yield gh();try{t&&(yield t.login())}catch(n){let s=Ar(n);console.warn(`Something went wrong trying to login the user: ${s}`)}if(!t)throw new Error("Error: There were problems with auth provider initialization!");let{signature:i}=t.account;if(e&&xe.set("loginToken",e),i&&xe.set("signature",i),r.networkProvider)try{let n=yield t.getAddress();if(!n)throw new Error("Canceled!");return Fe.run("onLoginPending"),xe.set("address",n),xe.set("loginMethod","maiar-browser-extension"),xe.set("expires",Qu()),yield as(r),Fe.run("onLoggedIn"),t}catch(n){console.warn(`Something went wrong trying to synchronize the user account: ${n==null?void 0:n.message}`)}});l();l();var T8=_e(x8(),1);var kK=r=>{var t;let e=document.createElement("template");return e.innerHTML=r.trim(),(t=e.content.firstChild)==null?void 0:t.cloneNode(!0)},WK=r=>{let e=`${oC}?wallet-connect=${encodeURIComponent(r)}`,t=document.createElement("a");return t.setAttribute("href",e),t.setAttribute("rel","noopener noreferrer nofollow"),t.setAttribute("target","_blank"),t.textContent="Maiar login",t.classList.add("elven-qr-code-deep-link"),t},YK=()=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),JK=r=>Te(void 0,null,function*(){return r?yield T8.default.toString(r,{type:"svg"}):void 0}),N8=(r,e)=>Te(void 0,null,function*(){if(!r)throw new Error("Please provide the QR Code container id!");let t=yield JK(e),i=null;typeof r=="string"?i=document.getElementById(r):r instanceof HTMLElement&&(i=r);let n;return t&&(n=kK(t)),i&&n&&(i.appendChild(n),YK()&&i.appendChild(WK(e))),i});var t0=_e(wp(),1);var D8=(r,e,t)=>Te(void 0,null,function*(){if(!e)throw new Error("You haven't provided the QR code container DOM element id");let i=Pp(ph);if(!i||!r.networkProvider)throw new Error("Something wen't wrong with the initialization (ApiNetworkProvider or Wallet Connect Bridge address), plese try to refresh the page!");if(!r.initOptions.walletConnectV2ProjectId)throw new Error("Please provide your WalletConnect project id. You can get it here: https://cloud.walletconnect.com)");if(!r.initOptions.chainType)throw new Error("Please provide the chain type in ElvenJS.init function!");let n,s={onClientLogin:()=>Te(void 0,null,function*(){if(r.dappProvider instanceof t0.WalletConnectV2Provider){Fe.run("onLoginPending");let a=yield r.dappProvider.getAddress(),u=yield r.dappProvider.getSignature();xe.set("address",a),xe.set("loginMethod","maiar-mobile"),xe.set("expires",Qu()),yield as(r),u&&xe.set("signature",u),t&&xe.set("loginToken",t),Fe.run("onLoggedIn"),n==null||n.replaceChildren()}}),onClientLogout:()=>Te(void 0,null,function*(){r.dappProvider instanceof t0.WalletConnectV2Provider&&(yield Hu(r),Fe.run("onLogout"))}),onClientEvent:a=>{console.log("wc2 session event: ",a)}},o=new t0.WalletConnectV2Provider(s,Si[r.initOptions.chainType].shortId,i,r.initOptions.walletConnectV2ProjectId);try{if(o){r.dappProvider=o;let{uri:a,approval:u}=yield o.connect({methods:["erd_cancelAction"]}),h=t?`${a}&token=${t}`:a;return e&&a&&h&&(n=yield N8(e,h)),yield o.login({approval:u,token:t}),o}}catch(a){let u=Ar(a);console.warn(`Something went wrong trying to login the user: ${u}`)}});l();var O8=_e(bl(),1);var B8=(r,e,t)=>Te(void 0,null,function*(){let i=new O8.WalletProvider(`${r}${hh}`),n=typeof window!="undefined"?encodeURIComponent(`${window.location.origin}${e||"/"}`):"/",s=Ql({callbackUrl:n},t?{token:t}:{});try{return Fe.run("onLoginPending"),xe.set("loginMethod","web-wallet"),yield i.login(s),xe.set("expires",Qu()),t&&xe.set("loginToken",t),i}catch(o){let a=Ar(o);console.warn(`Something went wrong trying to login the user: ${a}`),xe.set("loginMethod","")}});l();var To=r=>{if(typeof window!="undefined"){let e=new URL(window.location.href);return new URLSearchParams(e.search).get(r)}};l();var M8=_e(bl(),1);var P8=r=>Te(void 0,null,function*(){let e=To("signature"),t=To("address"),i=xe.get("address");if(e&&xe.set("signature",e),t||i)return t&&(xe.set("address",t),window.history.replaceState(null,"",window.location.pathname)),new M8.WalletProvider(`${r}${hh}`)});l();var L8=_e(Xf(),1),R8=_e(em(),1);var r0=(r,e)=>Te(void 0,null,function*(){yield new R8.TransactionWatcher(e).awaitCompleted(r);let i=r.getSender(),n=new L8.Account(i),s=yield e.getAccount(i);n.update(s),xe.set("address",n.address.bech32()),xe.set("nonce",n.getNonceThenIncrement().valueOf()),xe.set("balance",n.balance.toString()),Fe.run("onTxFinalized",r)});l();var i0=_e(U8(),1),q8=_e(Wy(),1);var V8=(r,e,t)=>Te(void 0,null,function*(){if(To(i0.WALLET_PROVIDER_CALLBACK_PARAM)===i0.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED&&r&&e&&"getTransactionsFromWalletUrl"in r){let n=r.getTransactionsFromWalletUrl();window.history.replaceState(null,"",window.location.pathname);let s=n==null?void 0:n[0];if(s){s.data=y.Buffer.from(s.data).toString("base64");let o=q8.Transaction.fromPlainObject(s);o.setNonce(t);try{Fe.run("onTxStarted",o),yield e.sendTransaction(o),yield r0(o,e)}catch(a){let u=Ar(a);throw Fe.run("onTxFinalized",o),new Error(`Error: Transaction signing failed! ${u}`)}}}});var Vl=class{static init(e){return Te(this,null,function*(){let t=xe.get();if(t.expires&&Mp(t.expires)){xe.clear(),this.dappProvider=void 0;return}this.initOptions=e||{chainType:dh,apiUrl:sC},this.networkProvider=new jp(this.initOptions),this.initOptions.onLoginPending&&Fe.set("onLoginPending",this.initOptions.onLoginPending),this.initOptions.onLoggedIn&&Fe.set("onLoggedIn",this.initOptions.onLoggedIn),this.initOptions.onLogout&&Fe.set("onLogout",this.initOptions.onLogout),this.initOptions.onTxStarted&&Fe.set("onTxStarted",this.initOptions.onTxStarted),this.initOptions.onTxFinalized&&Fe.set("onTxFinalized",this.initOptions.onTxFinalized),((t==null?void 0:t.address)||t.loginMethod==="web-wallet"&&To("address"))&&(t==null?void 0:t.loginMethod)&&(Fe.run("onLoginPending"),t.loginMethod==="maiar-browser-extension"&&(this.dappProvider=yield gh()),t.loginMethod==="maiar-mobile"&&(this.dappProvider=yield JD(this)),t.loginMethod==="web-wallet"&&(this.dappProvider=yield P8(Si[this.initOptions.chainType].walletAddress)),yield as(this),Fe.run("onLoggedIn"),t.loginMethod==="web-wallet"&&(yield V8(this.dappProvider,this.networkProvider,t.nonce)))})}static login(e,t){return Te(this,null,function*(){if(!Object.values(Io).includes(e))throw new Error("Error: Wrong login method!");if(!this.networkProvider)throw new Error("Error: Login failed: Use ElvenJs.init() first!");try{if(e==="maiar-browser-extension"){let n=yield CO(this,t==null?void 0:t.token);this.dappProvider=n}if(e==="maiar-mobile"){let n=yield D8(this,t==null?void 0:t.qrCodeContainer,t==null?void 0:t.token);this.dappProvider=n}if(e==="web-wallet"&&this.initOptions){let n=yield B8(Si[this.initOptions.chainType].walletAddress,t==null?void 0:t.callbackRoute,t==null?void 0:t.token);this.dappProvider=n}}catch(n){let s=Ar(n);throw new Error(`Error: ${s}`)}})}static logout(){return Te(this,null,function*(){let e=yield Hu(this);return this.dappProvider=void 0,e})}static signAndSendTransaction(e){return Te(this,null,function*(){if(!this.dappProvider)throw new Error("Error: Transaction signing failed: There is no active session!");if(!this.networkProvider)throw new Error("Error: Transaction signing failed: There is no active network provider!");try{Fe.run("onTxStarted",e);let t=xe.get();e.setNonce(t.nonce),this.dappProvider instanceof H8.ExtensionProvider&&(yield this.dappProvider.signTransaction(e)),this.dappProvider instanceof Q8.WalletConnectV2Provider&&(yield this.dappProvider.signTransactions([e])),this.dappProvider instanceof j8.WalletProvider&&(yield this.dappProvider.signTransaction(e)),t.loginMethod!=="web-wallet"&&(yield this.networkProvider.sendTransaction(e),yield r0(e,this.networkProvider))}catch(t){let i=Ar(t);throw Fe.run("onTxFinalized",e),new Error(`Error: Transaction signing failed! ${i}`)}return e})}static queryContract(o){return Te(this,arguments,function*({address:e,func:t,args:i=[],value:n=0,caller:s}){if(!this.networkProvider)throw new Error("Error: Query failed: There is no active network provider!");if(!e||!t)throw new Error("Error: Query failed: The Query arguments are not valid! Address and func required");try{return yield this.networkProvider.queryContract({address:e,func:t,args:i,value:n,caller:s})}catch(a){let u=Ar(a);throw new Error(`Error: Smart contract query failed! ${u}`)}})}},ql=Vl;ql.storage=xe,ql.destroy=()=>{Vl.networkProvider=void 0,Vl.dappProvider=void 0,Vl.initOptions=void 0,Fe.clear()};var export_Account=tz.Account;var export_Address=ez.Address;var export_AddressValue=cz.AddressValue;var export_BigUIntValue=K8.BigUIntValue;var export_BooleanValue=oz.BooleanValue;var export_BytesValue=sz.BytesValue;var export_ContractCallPayloadBuilder=az.ContractCallPayloadBuilder;var export_ContractFunction=uz.ContractFunction;var export_ESDTNFTTransferPayloadBuilder=G8.ESDTNFTTransferPayloadBuilder;var export_ESDTTransferPayloadBuilder=G8.ESDTTransferPayloadBuilder;var export_TokenPayment=ZK.TokenPayment;var export_Transaction=rz.Transaction;var export_TransactionPayload=iz.TransactionPayload;var export_TransactionWatcher=nz.TransactionWatcher;var export_U32Value=K8.U32Value;export{export_Account as Account,export_Address as Address,export_AddressValue as AddressValue,export_BigUIntValue as BigUIntValue,export_BooleanValue as BooleanValue,export_BytesValue as BytesValue,export_ContractCallPayloadBuilder as ContractCallPayloadBuilder,export_ContractFunction as ContractFunction,export_ESDTNFTTransferPayloadBuilder as ESDTNFTTransferPayloadBuilder,export_ESDTTransferPayloadBuilder as ESDTTransferPayloadBuilder,ql as ElvenJS,Io as LoginMethodsEnum,export_TokenPayment as TokenPayment,export_Transaction as Transaction,export_TransactionPayload as TransactionPayload,export_TransactionWatcher as TransactionWatcher,export_U32Value as U32Value}; -/*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh - * @license MIT - */ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */ -/*! https://mths.be/punycode v1.4.1 by @mathias */ -/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ diff --git a/example/index.html b/example/index.html index a43c971..021b9bf 100644 --- a/example/index.html +++ b/example/index.html @@ -152,7 +152,9 @@

Other demos:

AddressValue, } from './elven.js'; - // Options are the defaults + // Options are the defaults and here only to show all of them + // You don't have to add them if you want to use default setup + // You can only add your custom callbacks const initElven = async () => { await ElvenJS.init( { @@ -160,6 +162,7 @@

Other demos:

chainType: 'devnet', apiTimeout: 10000, walletConnectV2ProjectId: 'f502675c63610bfe4454080ac86d70e6', + WalletConnectV2RelayAddresses: ['wss://relay.walletconnect.com'], onLoginPending: () => { uiPending(true) }, onLoggedIn: () => { uiLoggedInState(true); uiPending(false); }, onLogout: () => { uiLoggedInState(false); }, @@ -181,6 +184,7 @@

Other demos:

}); document.getElementById('button-login-mobile').addEventListener('click', async () => { + clearQrCodeContainer(); try { await ElvenJS.login('maiar-mobile', { // You can also use the DOM element here: diff --git a/src/auth/init-maiar-mobile-provider.ts b/src/auth/init-maiar-mobile-provider.ts index ddd50b0..8575216 100644 --- a/src/auth/init-maiar-mobile-provider.ts +++ b/src/auth/init-maiar-mobile-provider.ts @@ -2,10 +2,7 @@ import { SessionEventTypes, WalletConnectV2Provider, } from '@elrondnetwork/erdjs-wallet-connect-provider/out/walletConnectV2Provider'; -import { - walletConnectV2RelayAddresses, - networkConfig, -} from '../utils/constants'; +import { networkConfig } from '../utils/constants'; import { logout } from './logout'; import { accountSync } from './account-sync'; import { EventsStore } from '../events-store'; @@ -30,7 +27,7 @@ export const initMaiarMobileProvider = async (elven: any) => { }; const relayAddress = getRandomAddressFromNetwork( - walletConnectV2RelayAddresses + elven.initOptions.walletConnectV2RelayAddresses ); const dappProviderInstance = new WalletConnectV2Provider( diff --git a/src/auth/login-with-mobile.ts b/src/auth/login-with-mobile.ts index 7ba86e1..21d32a3 100644 --- a/src/auth/login-with-mobile.ts +++ b/src/auth/login-with-mobile.ts @@ -1,9 +1,6 @@ import { errorParse } from '../utils/error-parse'; import { qrCodeBuilder } from './qr-code-builder'; -import { - walletConnectV2RelayAddresses, - networkConfig, -} from '../utils/constants'; +import { networkConfig } from '../utils/constants'; import { getRandomAddressFromNetwork } from '../utils/get-random-address-from-network'; import { WalletConnectV2Provider, @@ -29,7 +26,7 @@ export const loginWithMobile = async ( } const relayAddress = getRandomAddressFromNetwork( - walletConnectV2RelayAddresses + elven.initOptions.walletConnectV2RelayAddresses ); if (!relayAddress || !elven.networkProvider) { diff --git a/src/main.ts b/src/main.ts index 47fa5f7..a96ee6e 100644 --- a/src/main.ts +++ b/src/main.ts @@ -24,6 +24,7 @@ import { networkConfig, defaultApiEndpoint, defaultChainTypeConfig, + defaultWalletConnectV2RelayAddresses, } from './utils/constants'; import { getParamFromUrl } from './utils/get-param-from-url'; import { initWebWalletProvider } from './auth/init-web-wallet-provider'; @@ -47,9 +48,13 @@ export class ElvenJS { return; } - this.initOptions = options || { + this.initOptions = { chainType: defaultChainTypeConfig, apiUrl: defaultApiEndpoint, + apiTimeout: 10000, + walletConnectV2ProjectId: '', + walletConnectV2RelayAddresses: defaultWalletConnectV2RelayAddresses, + ...options, }; this.networkProvider = new ApiNetworkProvider(this.initOptions); @@ -84,7 +89,10 @@ export class ElvenJS { if (state.loginMethod === LoginMethodsEnum.maiarMobile) { this.dappProvider = await initMaiarMobileProvider(this); } - if (state.loginMethod === LoginMethodsEnum.webWallet) { + if ( + state.loginMethod === LoginMethodsEnum.webWallet && + this.initOptions.chainType + ) { this.dappProvider = await initWebWalletProvider( networkConfig[this.initOptions.chainType].walletAddress ); @@ -139,7 +147,10 @@ export class ElvenJS { } // Login with Web Wallet - if (loginMethod === LoginMethodsEnum.webWallet && this.initOptions) { + if ( + loginMethod === LoginMethodsEnum.webWallet && + this.initOptions?.chainType + ) { const dappProvider = await loginWithWebWallet( networkConfig[this.initOptions.chainType].walletAddress, options?.callbackRoute, diff --git a/src/types.ts b/src/types.ts index 2b3436e..01dab3e 100644 --- a/src/types.ts +++ b/src/types.ts @@ -4,10 +4,11 @@ import { WalletConnectV2Provider } from '@elrondnetwork/erdjs-wallet-connect-pro import { WalletProvider } from '@elrondnetwork/erdjs-web-wallet-provider/out/walletProvider'; export interface InitOptions { - apiUrl: string; - chainType: string; - apiTimeout: number; + apiUrl?: string; + chainType?: string; + apiTimeout?: number; walletConnectV2ProjectId?: string; + walletConnectV2RelayAddresses?: string[]; onLoginPending?: () => void; onLoggedIn?: () => void; onLogout?: () => void; diff --git a/src/utils/constants.ts b/src/utils/constants.ts index c64355f..a28f81e 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -26,7 +26,9 @@ export const defaultChainTypeConfig = 'devnet'; export const walletConnectDeepLink = 'https://maiar.page.link/?apn=com.elrond.maiar.wallet&isi=1519405832&ibi=com.elrond.maiar.wallet&link=https://maiar.com/'; -export const walletConnectV2RelayAddresses = ['wss://relay.walletconnect.com']; +export const defaultWalletConnectV2RelayAddresses = [ + 'wss://relay.walletconnect.com', +]; export const networkConfig: Record = { devnet: {