@ultrade/shared 1.0.9 → 1.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  function Re(){throw new Error("setTimeout has not been defined")}function Oe(){throw new Error("clearTimeout has not been defined")}var U=Re,M=Oe;typeof globalThis.setTimeout=="function"&&(U=setTimeout);typeof globalThis.clearTimeout=="function"&&(M=clearTimeout);function ke(t){if(U===setTimeout)return setTimeout(t,0);if((U===Re||!U)&&setTimeout)return U=setTimeout,setTimeout(t,0);try{return U(t,0)}catch{try{return U.call(null,t,0)}catch{return U.call(this,t,0)}}}function Or(t){if(M===clearTimeout)return clearTimeout(t);if((M===Oe||!M)&&clearTimeout)return M=clearTimeout,clearTimeout(t);try{return M(t)}catch{try{return M.call(null,t)}catch{return M.call(this,t)}}}var O=[],H=!1,v,j=-1;function kr(){!H||!v||(H=!1,v.length?O=v.concat(O):j=-1,O.length&&Be())}function Be(){if(!H){var t=ke(kr);H=!0;for(var e=O.length;e;){for(v=O,O=[];++j<e;)v&&v[j].run();j=-1,e=O.length}v=null,H=!1,Or(t)}}function Br(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];O.push(new Pe(t,e)),O.length===1&&!H&&ke(Be)}function Pe(t,e){this.fun=t,this.array=e}Pe.prototype.run=function(){this.fun.apply(null,this.array)};var Pr="browser",Ur="browser",Mr=!0,Lr={},vr=[],Fr="",Wr={},Yr={},Kr={};function F(){}var Gr=F,Hr=F,Vr=F,$r=F,zr=F,qr=F,Xr=F;function Jr(t){throw new Error("process.binding is not supported")}function jr(){return"/"}function Qr(t){throw new Error("process.chdir is not supported")}function Zr(){return 0}var G=globalThis.performance||{},et=G.now||G.mozNow||G.msNow||G.oNow||G.webkitNow||function(){return new Date().getTime()};function rt(t){var e=et.call(G)*.001,r=Math.floor(e),n=Math.floor(e%1*1e9);return t&&(r=r-t[0],n=n-t[1],n<0&&(r--,n+=1e9)),[r,n]}var tt=new Date;function nt(){var t=new Date,e=t-tt;return e/1e3}var u={nextTick:Br,title:Pr,browser:Mr,env:Lr,argv:vr,version:Fr,versions:Wr,on:Gr,addListener:Hr,once:Vr,off:$r,removeListener:zr,removeAllListeners:qr,emit:Xr,binding:Jr,cwd:jr,chdir:Qr,umask:Zr,hrtime:rt,platform:Ur,release:Yr,config:Kr,uptime:nt},Ne={};Object.keys(Ne).forEach(t=>{let e=t.split("."),r=u;for(let n=0;n<e.length;n++){let i=e[n];n===e.length-1?r[i]=Ne[t]:r=r[i]||(r[i]={})}});var C=[],_=[],it=typeof Uint8Array<"u"?Uint8Array:Array,le=!1;function ve(){le=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0,r=t.length;e<r;++e)C[e]=t[e],_[t.charCodeAt(e)]=e;_[45]=62,_[95]=63}function ot(t){le||ve();var e,r,n,i,o,a,c=t.length;if(c%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o=t[c-2]==="="?2:t[c-1]==="="?1:0,a=new it(c*3/4-o),n=o>0?c-4:c;var d=0;for(e=0,r=0;e<n;e+=4,r+=3)i=_[t.charCodeAt(e)]<<18|_[t.charCodeAt(e+1)]<<12|_[t.charCodeAt(e+2)]<<6|_[t.charCodeAt(e+3)],a[d++]=i>>16&255,a[d++]=i>>8&255,a[d++]=i&255;return o===2?(i=_[t.charCodeAt(e)]<<2|_[t.charCodeAt(e+1)]>>4,a[d++]=i&255):o===1&&(i=_[t.charCodeAt(e)]<<10|_[t.charCodeAt(e+1)]<<4|_[t.charCodeAt(e+2)]>>2,a[d++]=i>>8&255,a[d++]=i&255),a}function at(t){return C[t>>18&63]+C[t>>12&63]+C[t>>6&63]+C[t&63]}function st(t,e,r){for(var n,i=[],o=e;o<r;o+=3)n=(t[o]<<16)+(t[o+1]<<8)+t[o+2],i.push(at(n));return i.join("")}function Ue(t){le||ve();for(var e,r=t.length,n=r%3,i="",o=[],a=16383,c=0,d=r-n;c<d;c+=a)o.push(st(t,c,c+a>d?d:c+a));return n===1?(e=t[r-1],i+=C[e>>2],i+=C[e<<4&63],i+="=="):n===2&&(e=(t[r-2]<<8)+t[r-1],i+=C[e>>10],i+=C[e>>4&63],i+=C[e<<2&63],i+="="),o.push(i),o.join("")}s.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;function Q(){return s.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function k(t,e){if(Q()<e)throw new RangeError("Invalid typed array length");return s.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e),t.__proto__=s.prototype):(t===null&&(t=new s(e)),t.length=e),t}function s(t,e,r){if(!s.TYPED_ARRAY_SUPPORT&&!(this instanceof s))return new s(t,e,r);if(typeof t=="number"){if(typeof e=="string")throw new Error("If encoding is specified then the first argument must be a string");return ge(this,t)}return Fe(this,t,e,r)}s.poolSize=8192;s._augment=function(t){return t.__proto__=s.prototype,t};function Fe(t,e,r,n){if(typeof e=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer?pt(t,e,r,n):typeof e=="string"?ut(t,e,r):dt(t,e)}s.from=function(t,e,r){return Fe(null,t,e,r)};s.kMaxLength=Q();s.TYPED_ARRAY_SUPPORT&&(s.prototype.__proto__=Uint8Array.prototype,s.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&s[Symbol.species]);function We(t){if(typeof t!="number")throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function ct(t,e,r,n){return We(e),e<=0?k(t,e):r!==void 0?typeof n=="string"?k(t,e).fill(r,n):k(t,e).fill(r):k(t,e)}s.alloc=function(t,e,r){return ct(null,t,e,r)};function ge(t,e){if(We(e),t=k(t,e<0?0:fe(e)|0),!s.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}s.allocUnsafe=function(t){return ge(null,t)};s.allocUnsafeSlow=function(t){return ge(null,t)};function ut(t,e,r){if((typeof r!="string"||r==="")&&(r="utf8"),!s.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=Ye(e,r)|0;t=k(t,n);var i=t.write(e,r);return i!==n&&(t=t.slice(0,i)),t}function me(t,e){var r=e.length<0?0:fe(e.length)|0;t=k(t,r);for(var n=0;n<r;n+=1)t[n]=e[n]&255;return t}function pt(t,e,r,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");return r===void 0&&n===void 0?e=new Uint8Array(e):n===void 0?e=new Uint8Array(e,r):e=new Uint8Array(e,r,n),s.TYPED_ARRAY_SUPPORT?(t=e,t.__proto__=s.prototype):t=me(t,e),t}function dt(t,e){if(D(e)){var r=fe(e.length)|0;return t=k(t,r),t.length===0||e.copy(t,0,0,r),t}if(e){if(typeof ArrayBuffer<"u"&&e.buffer instanceof ArrayBuffer||"length"in e)return typeof e.length!="number"||Rt(e.length)?k(t,0):me(t,e);if(e.type==="Buffer"&&Array.isArray(e.data))return me(t,e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function fe(t){if(t>=Q())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Q().toString(16)+" bytes");return t|0}s.isBuffer=Ot;function D(t){return!!(t!=null&&t._isBuffer)}s.compare=function(e,r){if(!D(e)||!D(r))throw new TypeError("Arguments must be Buffers");if(e===r)return 0;for(var n=e.length,i=r.length,o=0,a=Math.min(n,i);o<a;++o)if(e[o]!==r[o]){n=e[o],i=r[o];break}return n<i?-1:i<n?1:0};s.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};s.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return s.alloc(0);var n;if(r===void 0)for(r=0,n=0;n<e.length;++n)r+=e[n].length;var i=s.allocUnsafe(r),o=0;for(n=0;n<e.length;++n){var a=e[n];if(!D(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(i,o),o+=a.length}return i};function Ye(t,e){if(D(t))return t.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;typeof t!="string"&&(t=""+t);var r=t.length;if(r===0)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return Z(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return qe(t).length;default:if(n)return Z(t).length;e=(""+e).toLowerCase(),n=!0}}s.byteLength=Ye;function mt(t,e,r){var n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return Tt(this,e,r);case"utf8":case"utf-8":return He(this,e,r);case"ascii":return It(this,e,r);case"latin1":case"binary":return yt(this,e,r);case"base64":return xt(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Et(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}s.prototype._isBuffer=!0;function W(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}s.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<e;r+=2)W(this,r,r+1);return this};s.prototype.swap32=function(){var e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<e;r+=4)W(this,r,r+3),W(this,r+1,r+2);return this};s.prototype.swap64=function(){var e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<e;r+=8)W(this,r,r+7),W(this,r+1,r+6),W(this,r+2,r+5),W(this,r+3,r+4);return this};s.prototype.toString=function(){var e=this.length|0;return e===0?"":arguments.length===0?He(this,0,e):mt.apply(this,arguments)};s.prototype.equals=function(e){if(!D(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:s.compare(this,e)===0};s.prototype.compare=function(e,r,n,i,o){if(!D(e))throw new TypeError("Argument must be a Buffer");if(r===void 0&&(r=0),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),o===void 0&&(o=this.length),r<0||n>e.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&r>=n)return 0;if(i>=o)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,o>>>=0,this===e)return 0;for(var a=o-i,c=n-r,d=Math.min(a,c),l=this.slice(i,o),g=e.slice(r,n),m=0;m<d;++m)if(l[m]!==g[m]){a=l[m],c=g[m];break}return a<c?-1:c<a?1:0};function Ke(t,e,r,n,i){if(t.length===0)return-1;if(typeof r=="string"?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof e=="string"&&(e=s.from(e,n)),D(e))return e.length===0?-1:Me(t,e,r,n,i);if(typeof e=="number")return e=e&255,s.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):Me(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function Me(t,e,r,n,i){var o=1,a=t.length,c=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;o=2,a/=2,c/=2,r/=2}function d(f,I){return o===1?f[I]:f.readUInt16BE(I*o)}var l;if(i){var g=-1;for(l=r;l<a;l++)if(d(t,l)===d(e,g===-1?0:l-g)){if(g===-1&&(g=l),l-g+1===c)return g*o}else g!==-1&&(l-=l-g),g=-1}else for(r+c>a&&(r=a-c),l=r;l>=0;l--){for(var m=!0,b=0;b<c;b++)if(d(t,l+b)!==d(e,b)){m=!1;break}if(m)return l}return-1}s.prototype.includes=function(e,r,n){return this.indexOf(e,r,n)!==-1};s.prototype.indexOf=function(e,r,n){return Ke(this,e,r,n,!0)};s.prototype.lastIndexOf=function(e,r,n){return Ke(this,e,r,n,!1)};function lt(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n),n>i&&(n=i)):n=i;var o=e.length;if(o%2!==0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var a=0;a<n;++a){var c=parseInt(e.substr(a*2,2),16);if(isNaN(c))return a;t[r+a]=c}return a}function gt(t,e,r,n){return te(Z(e,t.length-r),t,r,n)}function Ge(t,e,r,n){return te(Dt(e),t,r,n)}function ft(t,e,r,n){return Ge(t,e,r,n)}function bt(t,e,r,n){return te(qe(e),t,r,n)}function ht(t,e,r,n){return te(Nt(e,t.length-r),t,r,n)}s.prototype.write=function(e,r,n,i){if(r===void 0)i="utf8",n=this.length,r=0;else if(n===void 0&&typeof r=="string")i=r,n=this.length,r=0;else if(isFinite(r))r=r|0,isFinite(n)?(n=n|0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var o=this.length-r;if((n===void 0||n>o)&&(n=o),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var a=!1;;)switch(i){case"hex":return lt(this,e,r,n);case"utf8":case"utf-8":return gt(this,e,r,n);case"ascii":return Ge(this,e,r,n);case"latin1":case"binary":return ft(this,e,r,n);case"base64":return bt(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ht(this,e,r,n);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0}};s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function xt(t,e,r){return e===0&&r===t.length?Ue(t):Ue(t.slice(e,r))}function He(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o=t[i],a=null,c=o>239?4:o>223?3:o>191?2:1;if(i+c<=r){var d,l,g,m;switch(c){case 1:o<128&&(a=o);break;case 2:d=t[i+1],(d&192)===128&&(m=(o&31)<<6|d&63,m>127&&(a=m));break;case 3:d=t[i+1],l=t[i+2],(d&192)===128&&(l&192)===128&&(m=(o&15)<<12|(d&63)<<6|l&63,m>2047&&(m<55296||m>57343)&&(a=m));break;case 4:d=t[i+1],l=t[i+2],g=t[i+3],(d&192)===128&&(l&192)===128&&(g&192)===128&&(m=(o&15)<<18|(d&63)<<12|(l&63)<<6|g&63,m>65535&&m<1114112&&(a=m))}}a===null?(a=65533,c=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|a&1023),n.push(a),i+=c}return At(n)}var Le=4096;function At(t){var e=t.length;if(e<=Le)return String.fromCharCode.apply(String,t);for(var r="",n=0;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=Le));return r}function It(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]&127);return n}function yt(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function Tt(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=e;o<r;++o)i+=Ct(t[o]);return i}function Et(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+n[o+1]*256);return i}s.prototype.slice=function(e,r){var n=this.length;e=~~e,r=r===void 0?n:~~r,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),r<e&&(r=e);var i;if(s.TYPED_ARRAY_SUPPORT)i=this.subarray(e,r),i.__proto__=s.prototype;else{var o=r-e;i=new s(o,void 0);for(var a=0;a<o;++a)i[a]=this[a+e]}return i};function h(t,e,r){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}s.prototype.readUIntLE=function(e,r,n){e=e|0,r=r|0,n||h(e,r,this.length);for(var i=this[e],o=1,a=0;++a<r&&(o*=256);)i+=this[e+a]*o;return i};s.prototype.readUIntBE=function(e,r,n){e=e|0,r=r|0,n||h(e,r,this.length);for(var i=this[e+--r],o=1;r>0&&(o*=256);)i+=this[e+--r]*o;return i};s.prototype.readUInt8=function(e,r){return r||h(e,1,this.length),this[e]};s.prototype.readUInt16LE=function(e,r){return r||h(e,2,this.length),this[e]|this[e+1]<<8};s.prototype.readUInt16BE=function(e,r){return r||h(e,2,this.length),this[e]<<8|this[e+1]};s.prototype.readUInt32LE=function(e,r){return r||h(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};s.prototype.readUInt32BE=function(e,r){return r||h(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};s.prototype.readIntLE=function(e,r,n){e=e|0,r=r|0,n||h(e,r,this.length);for(var i=this[e],o=1,a=0;++a<r&&(o*=256);)i+=this[e+a]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*r)),i};s.prototype.readIntBE=function(e,r,n){e=e|0,r=r|0,n||h(e,r,this.length);for(var i=r,o=1,a=this[e+--i];i>0&&(o*=256);)a+=this[e+--i]*o;return o*=128,a>=o&&(a-=Math.pow(2,8*r)),a};s.prototype.readInt8=function(e,r){return r||h(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};s.prototype.readInt16LE=function(e,r){r||h(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};s.prototype.readInt16BE=function(e,r){r||h(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};s.prototype.readInt32LE=function(e,r){return r||h(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};s.prototype.readInt32BE=function(e,r){return r||h(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};s.prototype.readFloatLE=function(e,r){return r||h(e,4,this.length),ne(this,e,!0,23,4)};s.prototype.readFloatBE=function(e,r){return r||h(e,4,this.length),ne(this,e,!1,23,4)};s.prototype.readDoubleLE=function(e,r){return r||h(e,8,this.length),ne(this,e,!0,52,8)};s.prototype.readDoubleBE=function(e,r){return r||h(e,8,this.length),ne(this,e,!1,52,8)};function y(t,e,r,n,i,o){if(!D(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}s.prototype.writeUIntLE=function(e,r,n,i){if(e=+e,r=r|0,n=n|0,!i){var o=Math.pow(2,8*n)-1;y(this,e,r,n,o,0)}var a=1,c=0;for(this[r]=e&255;++c<n&&(a*=256);)this[r+c]=e/a&255;return r+n};s.prototype.writeUIntBE=function(e,r,n,i){if(e=+e,r=r|0,n=n|0,!i){var o=Math.pow(2,8*n)-1;y(this,e,r,n,o,0)}var a=n-1,c=1;for(this[r+a]=e&255;--a>=0&&(c*=256);)this[r+a]=e/c&255;return r+n};s.prototype.writeUInt8=function(e,r,n){return e=+e,r=r|0,n||y(this,e,r,1,255,0),s.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[r]=e&255,r+1};function ee(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i<o;++i)t[r+i]=(e&255<<8*(n?i:1-i))>>>(n?i:1-i)*8}s.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r|0,n||y(this,e,r,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[r]=e&255,this[r+1]=e>>>8):ee(this,e,r,!0),r+2};s.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r|0,n||y(this,e,r,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[r]=e>>>8,this[r+1]=e&255):ee(this,e,r,!1),r+2};function re(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i<o;++i)t[r+i]=e>>>(n?i:3-i)*8&255}s.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r|0,n||y(this,e,r,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255):re(this,e,r,!0),r+4};s.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r|0,n||y(this,e,r,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255):re(this,e,r,!1),r+4};s.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r|0,!i){var o=Math.pow(2,8*n-1);y(this,e,r,n,o-1,-o)}var a=0,c=1,d=0;for(this[r]=e&255;++a<n&&(c*=256);)e<0&&d===0&&this[r+a-1]!==0&&(d=1),this[r+a]=(e/c>>0)-d&255;return r+n};s.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r|0,!i){var o=Math.pow(2,8*n-1);y(this,e,r,n,o-1,-o)}var a=n-1,c=1,d=0;for(this[r+a]=e&255;--a>=0&&(c*=256);)e<0&&d===0&&this[r+a+1]!==0&&(d=1),this[r+a]=(e/c>>0)-d&255;return r+n};s.prototype.writeInt8=function(e,r,n){return e=+e,r=r|0,n||y(this,e,r,1,127,-128),s.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[r]=e&255,r+1};s.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r|0,n||y(this,e,r,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[r]=e&255,this[r+1]=e>>>8):ee(this,e,r,!0),r+2};s.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r|0,n||y(this,e,r,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[r]=e>>>8,this[r+1]=e&255):ee(this,e,r,!1),r+2};s.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r|0,n||y(this,e,r,4,2147483647,-2147483648),s.TYPED_ARRAY_SUPPORT?(this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24):re(this,e,r,!0),r+4};s.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r|0,n||y(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),s.TYPED_ARRAY_SUPPORT?(this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255):re(this,e,r,!1),r+4};function Ve(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function $e(t,e,r,n,i){return i||Ve(t,e,r,4,34028234663852886e22,-34028234663852886e22),Je(t,e,r,n,23,4),r+4}s.prototype.writeFloatLE=function(e,r,n){return $e(this,e,r,!0,n)};s.prototype.writeFloatBE=function(e,r,n){return $e(this,e,r,!1,n)};function ze(t,e,r,n,i){return i||Ve(t,e,r,8,17976931348623157e292,-17976931348623157e292),Je(t,e,r,n,52,8),r+8}s.prototype.writeDoubleLE=function(e,r,n){return ze(this,e,r,!0,n)};s.prototype.writeDoubleBE=function(e,r,n){return ze(this,e,r,!1,n)};s.prototype.copy=function(e,r,n,i){if(n||(n=0),!i&&i!==0&&(i=this.length),r>=e.length&&(r=e.length),r||(r=0),i>0&&i<n&&(i=n),i===n||e.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-r<i-n&&(i=e.length-r+n);var o=i-n,a;if(this===e&&n<r&&r<i)for(a=o-1;a>=0;--a)e[a+r]=this[a+n];else if(o<1e3||!s.TYPED_ARRAY_SUPPORT)for(a=0;a<o;++a)e[a+r]=this[a+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+o),r);return o};s.prototype.fill=function(e,r,n,i){if(typeof e=="string"){if(typeof r=="string"?(i=r,r=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),e.length===1){var o=e.charCodeAt(0);o<256&&(e=o)}if(i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!s.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else typeof e=="number"&&(e=e&255);if(r<0||this.length<r||this.length<n)throw new RangeError("Out of range index");if(n<=r)return this;r=r>>>0,n=n===void 0?this.length:n>>>0,e||(e=0);var a;if(typeof e=="number")for(a=r;a<n;++a)this[a]=e;else{var c=D(e)?e:Z(new s(e,i).toString()),d=c.length;for(a=0;a<n-r;++a)this[a+r]=c[a%d]}return this};var _t=/[^+\/0-9A-Za-z-_]/g;function St(t){if(t=wt(t).replace(_t,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function wt(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function Ct(t){return t<16?"0"+t.toString(16):t.toString(16)}function Z(t,e){e=e||1/0;for(var r,n=t.length,i=null,o=[],a=0;a<n;++a){if(r=t.charCodeAt(a),r>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}else if(a+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return o}function Dt(t){for(var e=[],r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function Nt(t,e){for(var r,n,i,o=[],a=0;a<t.length&&!((e-=2)<0);++a)r=t.charCodeAt(a),n=r>>8,i=r%256,o.push(i),o.push(n);return o}function qe(t){return ot(St(t))}function te(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function Rt(t){return t!==t}function Ot(t){return t!=null&&(!!t._isBuffer||Xe(t)||kt(t))}function Xe(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function kt(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&Xe(t.slice(0,0))}function ne(t,e,r,n,i){var o,a,c=i*8-n-1,d=(1<<c)-1,l=d>>1,g=-7,m=r?i-1:0,b=r?-1:1,f=t[e+m];for(m+=b,o=f&(1<<-g)-1,f>>=-g,g+=c;g>0;o=o*256+t[e+m],m+=b,g-=8);for(a=o&(1<<-g)-1,o>>=-g,g+=n;g>0;a=a*256+t[e+m],m+=b,g-=8);if(o===0)o=1-l;else{if(o===d)return a?NaN:(f?-1:1)*(1/0);a=a+Math.pow(2,n),o=o-l}return(f?-1:1)*a*Math.pow(2,o-n)}function Je(t,e,r,n,i,o){var a,c,d,l=o*8-i-1,g=(1<<l)-1,m=g>>1,b=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:o-1,I=n?1:-1,X=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(c=isNaN(e)?1:0,a=g):(a=Math.floor(Math.log(e)/Math.LN2),e*(d=Math.pow(2,-a))<1&&(a--,d*=2),a+m>=1?e+=b/d:e+=b*Math.pow(2,1-m),e*d>=2&&(a++,d/=2),a+m>=g?(c=0,a=g):a+m>=1?(c=(e*d-1)*Math.pow(2,i),a=a+m):(c=e*Math.pow(2,m-1)*Math.pow(2,i),a=0));i>=8;t[r+f]=c&255,f+=I,c/=256,i-=8);for(a=a<<i|c,l+=i;l>0;t[r+f]=a&255,f+=I,a/=256,l-=8);t[r+f-I]|=X*128}import{PublicKey as q}from"@solana/web3.js";var V={"0x4343545055534443000000000000000000000000000000000000000000000000":65537};import vu from"algosdk";import*as Dr from"bs58";import fn from"algosdk";import ti,{decodeAddress as ni,encodeAddress as ii}from"algosdk";var N=[],S=[],Bt=typeof Uint8Array<"u"?Uint8Array:Array,he=!1;function er(){he=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0,r=t.length;e<r;++e)N[e]=t[e],S[t.charCodeAt(e)]=e;S[45]=62,S[95]=63}function Pt(t){he||er();var e,r,n,i,o,a,c=t.length;if(c%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o=t[c-2]==="="?2:t[c-1]==="="?1:0,a=new Bt(c*3/4-o),n=o>0?c-4:c;var d=0;for(e=0,r=0;e<n;e+=4,r+=3)i=S[t.charCodeAt(e)]<<18|S[t.charCodeAt(e+1)]<<12|S[t.charCodeAt(e+2)]<<6|S[t.charCodeAt(e+3)],a[d++]=i>>16&255,a[d++]=i>>8&255,a[d++]=i&255;return o===2?(i=S[t.charCodeAt(e)]<<2|S[t.charCodeAt(e+1)]>>4,a[d++]=i&255):o===1&&(i=S[t.charCodeAt(e)]<<10|S[t.charCodeAt(e+1)]<<4|S[t.charCodeAt(e+2)]>>2,a[d++]=i>>8&255,a[d++]=i&255),a}function Ut(t){return N[t>>18&63]+N[t>>12&63]+N[t>>6&63]+N[t&63]}function Mt(t,e,r){for(var n,i=[],o=e;o<r;o+=3)n=(t[o]<<16)+(t[o+1]<<8)+t[o+2],i.push(Ut(n));return i.join("")}function je(t){he||er();for(var e,r=t.length,n=r%3,i="",o=[],a=16383,c=0,d=r-n;c<d;c+=a)o.push(Mt(t,c,c+a>d?d:c+a));return n===1?(e=t[r-1],i+=N[e>>2],i+=N[e<<4&63],i+="=="):n===2&&(e=(t[r-2]<<8)+t[r-1],i+=N[e>>10],i+=N[e>>4&63],i+=N[e<<2&63],i+="="),o.push(i),o.join("")}function ae(t,e,r,n,i){var o,a,c=i*8-n-1,d=(1<<c)-1,l=d>>1,g=-7,m=r?i-1:0,b=r?-1:1,f=t[e+m];for(m+=b,o=f&(1<<-g)-1,f>>=-g,g+=c;g>0;o=o*256+t[e+m],m+=b,g-=8);for(a=o&(1<<-g)-1,o>>=-g,g+=n;g>0;a=a*256+t[e+m],m+=b,g-=8);if(o===0)o=1-l;else{if(o===d)return a?NaN:(f?-1:1)*(1/0);a=a+Math.pow(2,n),o=o-l}return(f?-1:1)*a*Math.pow(2,o-n)}function rr(t,e,r,n,i,o){var a,c,d,l=o*8-i-1,g=(1<<l)-1,m=g>>1,b=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:o-1,I=n?1:-1,X=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(c=isNaN(e)?1:0,a=g):(a=Math.floor(Math.log(e)/Math.LN2),e*(d=Math.pow(2,-a))<1&&(a--,d*=2),a+m>=1?e+=b/d:e+=b*Math.pow(2,1-m),e*d>=2&&(a++,d/=2),a+m>=g?(c=0,a=g):a+m>=1?(c=(e*d-1)*Math.pow(2,i),a=a+m):(c=e*Math.pow(2,m-1)*Math.pow(2,i),a=0));i>=8;t[r+f]=c&255,f+=I,c/=256,i-=8);for(a=a<<i|c,l+=i;l>0;t[r+f]=a&255,f+=I,a/=256,l-=8);t[r+f-I]|=X*128}var Lt={}.toString,tr=Array.isArray||function(t){return Lt.call(t)=="[object Array]"};var vt=50;p.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;var jn=ie();function ie(){return p.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function B(t,e){if(ie()<e)throw new RangeError("Invalid typed array length");return p.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e),t.__proto__=p.prototype):(t===null&&(t=new p(e)),t.length=e),t}function p(t,e,r){if(!p.TYPED_ARRAY_SUPPORT&&!(this instanceof p))return new p(t,e,r);if(typeof t=="number"){if(typeof e=="string")throw new Error("If encoding is specified then the first argument must be a string");return xe(this,t)}return nr(this,t,e,r)}p.poolSize=8192;p._augment=function(t){return t.__proto__=p.prototype,t};function nr(t,e,r,n){if(typeof e=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer?Yt(t,e,r,n):typeof e=="string"?Wt(t,e,r):Kt(t,e)}p.from=function(t,e,r){return nr(null,t,e,r)};p.TYPED_ARRAY_SUPPORT&&(p.prototype.__proto__=Uint8Array.prototype,p.__proto__=Uint8Array);function ir(t){if(typeof t!="number")throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function Ft(t,e,r,n){return ir(e),e<=0?B(t,e):r!==void 0?typeof n=="string"?B(t,e).fill(r,n):B(t,e).fill(r):B(t,e)}p.alloc=function(t,e,r){return Ft(null,t,e,r)};function xe(t,e){if(ir(e),t=B(t,e<0?0:Ae(e)|0),!p.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}p.allocUnsafe=function(t){return xe(null,t)};p.allocUnsafeSlow=function(t){return xe(null,t)};function Wt(t,e,r){if((typeof r!="string"||r==="")&&(r="utf8"),!p.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=or(e,r)|0;t=B(t,n);var i=t.write(e,r);return i!==n&&(t=t.slice(0,i)),t}function be(t,e){var r=e.length<0?0:Ae(e.length)|0;t=B(t,r);for(var n=0;n<r;n+=1)t[n]=e[n]&255;return t}function Yt(t,e,r,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");return r===void 0&&n===void 0?e=new Uint8Array(e):n===void 0?e=new Uint8Array(e,r):e=new Uint8Array(e,r,n),p.TYPED_ARRAY_SUPPORT?(t=e,t.__proto__=p.prototype):t=be(t,e),t}function Kt(t,e){if(R(e)){var r=Ae(e.length)|0;return t=B(t,r),t.length===0||e.copy(t,0,0,r),t}if(e){if(typeof ArrayBuffer<"u"&&e.buffer instanceof ArrayBuffer||"length"in e)return typeof e.length!="number"||cn(e.length)?B(t,0):be(t,e);if(e.type==="Buffer"&&tr(e.data))return be(t,e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function Ae(t){if(t>=ie())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+ie().toString(16)+" bytes");return t|0}p.isBuffer=un;function R(t){return!!(t!=null&&t._isBuffer)}p.compare=function(e,r){if(!R(e)||!R(r))throw new TypeError("Arguments must be Buffers");if(e===r)return 0;for(var n=e.length,i=r.length,o=0,a=Math.min(n,i);o<a;++o)if(e[o]!==r[o]){n=e[o],i=r[o];break}return n<i?-1:i<n?1:0};p.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};p.concat=function(e,r){if(!tr(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return p.alloc(0);var n;if(r===void 0)for(r=0,n=0;n<e.length;++n)r+=e[n].length;var i=p.allocUnsafe(r),o=0;for(n=0;n<e.length;++n){var a=e[n];if(!R(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(i,o),o+=a.length}return i};function or(t,e){if(R(t))return t.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;typeof t!="string"&&(t=""+t);var r=t.length;if(r===0)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return oe(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return mr(t).length;default:if(n)return oe(t).length;e=(""+e).toLowerCase(),n=!0}}p.byteLength=or;function Gt(t,e,r){var n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return Zt(this,e,r);case"utf8":case"utf-8":return cr(this,e,r);case"ascii":return jt(this,e,r);case"latin1":case"binary":return Qt(this,e,r);case"base64":return Xt(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return en(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}p.prototype._isBuffer=!0;function Y(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}p.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<e;r+=2)Y(this,r,r+1);return this};p.prototype.swap32=function(){var e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<e;r+=4)Y(this,r,r+3),Y(this,r+1,r+2);return this};p.prototype.swap64=function(){var e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<e;r+=8)Y(this,r,r+7),Y(this,r+1,r+6),Y(this,r+2,r+5),Y(this,r+3,r+4);return this};p.prototype.toString=function(){var e=this.length|0;return e===0?"":arguments.length===0?cr(this,0,e):Gt.apply(this,arguments)};p.prototype.equals=function(e){if(!R(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:p.compare(this,e)===0};p.prototype.inspect=function(){var e="",r=vt;return this.length>0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),"<Buffer "+e+">"};p.prototype.compare=function(e,r,n,i,o){if(!R(e))throw new TypeError("Argument must be a Buffer");if(r===void 0&&(r=0),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),o===void 0&&(o=this.length),r<0||n>e.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&r>=n)return 0;if(i>=o)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,o>>>=0,this===e)return 0;for(var a=o-i,c=n-r,d=Math.min(a,c),l=this.slice(i,o),g=e.slice(r,n),m=0;m<d;++m)if(l[m]!==g[m]){a=l[m],c=g[m];break}return a<c?-1:c<a?1:0};function ar(t,e,r,n,i){if(t.length===0)return-1;if(typeof r=="string"?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof e=="string"&&(e=p.from(e,n)),R(e))return e.length===0?-1:Qe(t,e,r,n,i);if(typeof e=="number")return e=e&255,p.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):Qe(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function Qe(t,e,r,n,i){var o=1,a=t.length,c=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;o=2,a/=2,c/=2,r/=2}function d(f,I){return o===1?f[I]:f.readUInt16BE(I*o)}var l;if(i){var g=-1;for(l=r;l<a;l++)if(d(t,l)===d(e,g===-1?0:l-g)){if(g===-1&&(g=l),l-g+1===c)return g*o}else g!==-1&&(l-=l-g),g=-1}else for(r+c>a&&(r=a-c),l=r;l>=0;l--){for(var m=!0,b=0;b<c;b++)if(d(t,l+b)!==d(e,b)){m=!1;break}if(m)return l}return-1}p.prototype.includes=function(e,r,n){return this.indexOf(e,r,n)!==-1};p.prototype.indexOf=function(e,r,n){return ar(this,e,r,n,!0)};p.prototype.lastIndexOf=function(e,r,n){return ar(this,e,r,n,!1)};function Ht(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n),n>i&&(n=i)):n=i;var o=e.length;if(o%2!==0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var a=0;a<n;++a){var c=parseInt(e.substr(a*2,2),16);if(isNaN(c))return a;t[r+a]=c}return a}function Vt(t,e,r,n){return ue(oe(e,t.length-r),t,r,n)}function sr(t,e,r,n){return ue(an(e),t,r,n)}function $t(t,e,r,n){return sr(t,e,r,n)}function zt(t,e,r,n){return ue(mr(e),t,r,n)}function qt(t,e,r,n){return ue(sn(e,t.length-r),t,r,n)}p.prototype.write=function(e,r,n,i){if(r===void 0)i="utf8",n=this.length,r=0;else if(n===void 0&&typeof r=="string")i=r,n=this.length,r=0;else if(isFinite(r))r=r|0,isFinite(n)?(n=n|0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var o=this.length-r;if((n===void 0||n>o)&&(n=o),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var a=!1;;)switch(i){case"hex":return Ht(this,e,r,n);case"utf8":case"utf-8":return Vt(this,e,r,n);case"ascii":return sr(this,e,r,n);case"latin1":case"binary":return $t(this,e,r,n);case"base64":return zt(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return qt(this,e,r,n);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0}};p.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Xt(t,e,r){return e===0&&r===t.length?je(t):je(t.slice(e,r))}function cr(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o=t[i],a=null,c=o>239?4:o>223?3:o>191?2:1;if(i+c<=r){var d,l,g,m;switch(c){case 1:o<128&&(a=o);break;case 2:d=t[i+1],(d&192)===128&&(m=(o&31)<<6|d&63,m>127&&(a=m));break;case 3:d=t[i+1],l=t[i+2],(d&192)===128&&(l&192)===128&&(m=(o&15)<<12|(d&63)<<6|l&63,m>2047&&(m<55296||m>57343)&&(a=m));break;case 4:d=t[i+1],l=t[i+2],g=t[i+3],(d&192)===128&&(l&192)===128&&(g&192)===128&&(m=(o&15)<<18|(d&63)<<12|(l&63)<<6|g&63,m>65535&&m<1114112&&(a=m))}}a===null?(a=65533,c=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|a&1023),n.push(a),i+=c}return Jt(n)}var Ze=4096;function Jt(t){var e=t.length;if(e<=Ze)return String.fromCharCode.apply(String,t);for(var r="",n=0;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=Ze));return r}function jt(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]&127);return n}function Qt(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function Zt(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=e;o<r;++o)i+=on(t[o]);return i}function en(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+n[o+1]*256);return i}p.prototype.slice=function(e,r){var n=this.length;e=~~e,r=r===void 0?n:~~r,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),r<e&&(r=e);var i;if(p.TYPED_ARRAY_SUPPORT)i=this.subarray(e,r),i.__proto__=p.prototype;else{var o=r-e;i=new p(o,void 0);for(var a=0;a<o;++a)i[a]=this[a+e]}return i};function x(t,e,r){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}p.prototype.readUIntLE=function(e,r,n){e=e|0,r=r|0,n||x(e,r,this.length);for(var i=this[e],o=1,a=0;++a<r&&(o*=256);)i+=this[e+a]*o;return i};p.prototype.readUIntBE=function(e,r,n){e=e|0,r=r|0,n||x(e,r,this.length);for(var i=this[e+--r],o=1;r>0&&(o*=256);)i+=this[e+--r]*o;return i};p.prototype.readUInt8=function(e,r){return r||x(e,1,this.length),this[e]};p.prototype.readUInt16LE=function(e,r){return r||x(e,2,this.length),this[e]|this[e+1]<<8};p.prototype.readUInt16BE=function(e,r){return r||x(e,2,this.length),this[e]<<8|this[e+1]};p.prototype.readUInt32LE=function(e,r){return r||x(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};p.prototype.readUInt32BE=function(e,r){return r||x(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};p.prototype.readIntLE=function(e,r,n){e=e|0,r=r|0,n||x(e,r,this.length);for(var i=this[e],o=1,a=0;++a<r&&(o*=256);)i+=this[e+a]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*r)),i};p.prototype.readIntBE=function(e,r,n){e=e|0,r=r|0,n||x(e,r,this.length);for(var i=r,o=1,a=this[e+--i];i>0&&(o*=256);)a+=this[e+--i]*o;return o*=128,a>=o&&(a-=Math.pow(2,8*r)),a};p.prototype.readInt8=function(e,r){return r||x(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};p.prototype.readInt16LE=function(e,r){r||x(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};p.prototype.readInt16BE=function(e,r){r||x(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};p.prototype.readInt32LE=function(e,r){return r||x(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};p.prototype.readInt32BE=function(e,r){return r||x(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};p.prototype.readFloatLE=function(e,r){return r||x(e,4,this.length),ae(this,e,!0,23,4)};p.prototype.readFloatBE=function(e,r){return r||x(e,4,this.length),ae(this,e,!1,23,4)};p.prototype.readDoubleLE=function(e,r){return r||x(e,8,this.length),ae(this,e,!0,52,8)};p.prototype.readDoubleBE=function(e,r){return r||x(e,8,this.length),ae(this,e,!1,52,8)};function T(t,e,r,n,i,o){if(!R(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}p.prototype.writeUIntLE=function(e,r,n,i){if(e=+e,r=r|0,n=n|0,!i){var o=Math.pow(2,8*n)-1;T(this,e,r,n,o,0)}var a=1,c=0;for(this[r]=e&255;++c<n&&(a*=256);)this[r+c]=e/a&255;return r+n};p.prototype.writeUIntBE=function(e,r,n,i){if(e=+e,r=r|0,n=n|0,!i){var o=Math.pow(2,8*n)-1;T(this,e,r,n,o,0)}var a=n-1,c=1;for(this[r+a]=e&255;--a>=0&&(c*=256);)this[r+a]=e/c&255;return r+n};p.prototype.writeUInt8=function(e,r,n){return e=+e,r=r|0,n||T(this,e,r,1,255,0),p.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[r]=e&255,r+1};function se(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i<o;++i)t[r+i]=(e&255<<8*(n?i:1-i))>>>(n?i:1-i)*8}p.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r|0,n||T(this,e,r,2,65535,0),p.TYPED_ARRAY_SUPPORT?(this[r]=e&255,this[r+1]=e>>>8):se(this,e,r,!0),r+2};p.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r|0,n||T(this,e,r,2,65535,0),p.TYPED_ARRAY_SUPPORT?(this[r]=e>>>8,this[r+1]=e&255):se(this,e,r,!1),r+2};function ce(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i<o;++i)t[r+i]=e>>>(n?i:3-i)*8&255}p.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r|0,n||T(this,e,r,4,4294967295,0),p.TYPED_ARRAY_SUPPORT?(this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255):ce(this,e,r,!0),r+4};p.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r|0,n||T(this,e,r,4,4294967295,0),p.TYPED_ARRAY_SUPPORT?(this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255):ce(this,e,r,!1),r+4};p.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r|0,!i){var o=Math.pow(2,8*n-1);T(this,e,r,n,o-1,-o)}var a=0,c=1,d=0;for(this[r]=e&255;++a<n&&(c*=256);)e<0&&d===0&&this[r+a-1]!==0&&(d=1),this[r+a]=(e/c>>0)-d&255;return r+n};p.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r|0,!i){var o=Math.pow(2,8*n-1);T(this,e,r,n,o-1,-o)}var a=n-1,c=1,d=0;for(this[r+a]=e&255;--a>=0&&(c*=256);)e<0&&d===0&&this[r+a+1]!==0&&(d=1),this[r+a]=(e/c>>0)-d&255;return r+n};p.prototype.writeInt8=function(e,r,n){return e=+e,r=r|0,n||T(this,e,r,1,127,-128),p.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[r]=e&255,r+1};p.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r|0,n||T(this,e,r,2,32767,-32768),p.TYPED_ARRAY_SUPPORT?(this[r]=e&255,this[r+1]=e>>>8):se(this,e,r,!0),r+2};p.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r|0,n||T(this,e,r,2,32767,-32768),p.TYPED_ARRAY_SUPPORT?(this[r]=e>>>8,this[r+1]=e&255):se(this,e,r,!1),r+2};p.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r|0,n||T(this,e,r,4,2147483647,-2147483648),p.TYPED_ARRAY_SUPPORT?(this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24):ce(this,e,r,!0),r+4};p.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r|0,n||T(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),p.TYPED_ARRAY_SUPPORT?(this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255):ce(this,e,r,!1),r+4};function ur(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function pr(t,e,r,n,i){return i||ur(t,e,r,4),rr(t,e,r,n,23,4),r+4}p.prototype.writeFloatLE=function(e,r,n){return pr(this,e,r,!0,n)};p.prototype.writeFloatBE=function(e,r,n){return pr(this,e,r,!1,n)};function dr(t,e,r,n,i){return i||ur(t,e,r,8),rr(t,e,r,n,52,8),r+8}p.prototype.writeDoubleLE=function(e,r,n){return dr(this,e,r,!0,n)};p.prototype.writeDoubleBE=function(e,r,n){return dr(this,e,r,!1,n)};p.prototype.copy=function(e,r,n,i){if(n||(n=0),!i&&i!==0&&(i=this.length),r>=e.length&&(r=e.length),r||(r=0),i>0&&i<n&&(i=n),i===n||e.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-r<i-n&&(i=e.length-r+n);var o=i-n,a;if(this===e&&n<r&&r<i)for(a=o-1;a>=0;--a)e[a+r]=this[a+n];else if(o<1e3||!p.TYPED_ARRAY_SUPPORT)for(a=0;a<o;++a)e[a+r]=this[a+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+o),r);return o};p.prototype.fill=function(e,r,n,i){if(typeof e=="string"){if(typeof r=="string"?(i=r,r=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),e.length===1){var o=e.charCodeAt(0);o<256&&(e=o)}if(i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!p.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else typeof e=="number"&&(e=e&255);if(r<0||this.length<r||this.length<n)throw new RangeError("Out of range index");if(n<=r)return this;r=r>>>0,n=n===void 0?this.length:n>>>0,e||(e=0);var a;if(typeof e=="number")for(a=r;a<n;++a)this[a]=e;else{var c=R(e)?e:oe(new p(e,i).toString()),d=c.length;for(a=0;a<n-r;++a)this[a+r]=c[a%d]}return this};var rn=/[^+\/0-9A-Za-z-_]/g;function tn(t){if(t=nn(t).replace(rn,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function nn(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function on(t){return t<16?"0"+t.toString(16):t.toString(16)}function oe(t,e){e=e||1/0;for(var r,n=t.length,i=null,o=[],a=0;a<n;++a){if(r=t.charCodeAt(a),r>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}else if(a+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return o}function an(t){for(var e=[],r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function sn(t,e){for(var r,n,i,o=[],a=0;a<t.length&&!((e-=2)<0);++a)r=t.charCodeAt(a),n=r>>8,i=r%256,o.push(i),o.push(n);return o}function mr(t){return Pt(tn(t))}function ue(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function cn(t){return t!==t}function un(t){return t!=null&&(!!t._isBuffer||lr(t)||pn(t))}function lr(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function pn(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&lr(t.slice(0,0))}import{encodeAddress as dn,decodeAddress as pi}from"algosdk";function P(t){return t.reduce((e,r)=>Uint8Array.from([...e,...r]))}function Ie(t){return new Uint8Array(p.from(t))}function gr(t){return p.from(t).toString("utf-8")}function fr(t){return p.from(t).toString("base64")}function ye(t){return p.from(t,"base64")}import mn from"bignumber.js";mn.config({DECIMAL_PLACES:40,EXPONENTIAL_AT:45});var Ni=`{"theme1":{"value":"${u.env.FRONTEND_URL}/Theme%3DDark.svg","active":true},"theme2":{"value":"${u.env.FRONTEND_URL}/Theme%3DLight.svg","active":true},"theme3":{"value":"${u.env.FRONTEND_URL}/Theme%3DLight.svg","active":true}}`;var br={V1_1:"v1_1",V2:"v2"},Bi={[br.V1_1]:{testnet:62368684,mainnet:552635992},[br.V2]:{testnet:148607e3,mainnet:1002541853}};var hr=t=>fn.decodeAddress(t.toUpperCase()).publicKey;import*as A from"ethereumjs-util";function Te(t){let e=A.fromSigned(s.from(t));return BigInt(e.toString())}function hn(t){return A.toUnsigned(new A.BN(String(t)))}function $(t){let e=hn(t);if(e.length>32)throw new Error("Invalid value. The buffer length of the value is more than 32");return new Uint8Array(A.setLengthLeft(e,32))}var xr=t=>{if(t.length!==32)throw new Error("Invalid address bytes. The address buffer length is not equel 32");let e=s.from(t).toString("hex");if(e.slice(0,24)!=="000000000000000000000000")throw console.log("normalizedAddress",e),new Error("Invalid normalized address");let r="0x"+e.slice(-40);if(!An(r))throw new Error("Invalid hex address");return r},Ar=t=>new Uint8Array(A.setLengthLeft(pe(t),32)),pe=t=>s.from(xn(t),"hex"),xn=t=>t.startsWith("0x")?t.slice(2):t,An=t=>A.isValidAddress(t);var Ee=t=>new Uint8Array(A.keccak256(s.from(t)));import L from"algosdk";import*as we from"bs58";import ko from"algosdk";import Yo from"algosdk";import Ia from"algosdk";var jo={SMALLESTUNIT:u.env.SMALLEST_UNIT},Qo={SMALLEST_UNITS:u.env.SMALLEST_UNIT};var na=["point-system.discordEnabled","point-system.telegramBotName","point-system.telegramBotId","point-system.telegramEnabled","point-system.telegramGroupId","point-system.telegramGroupName","point-system.twitterAccountId","point-system.twitterAccountName","point-system.twitterEnabled","point-system.twitterJobEnabled","point-system.guideLink"];var Tr=t=>`By signing this message, you confirm that the wallet is a trusted one ${t}; Data: `;import Nc from"algosdk";var Er=(i=>(i.GLOBAL_PAIR_DELISTING="GLOBAL_PAIR_DELISTING",i.GLOBAL_NEW_PAIR_LISTING="GLOBAL_NEW_PAIR_LISTING",i.GLOBAL_SYSTEM_MAINTENANCE="GLOBAL_SYSTEM_MAINTENANCE",i.GLOBAL_SMART_CONTRACT_UPDATE="GLOBAL_SMART_CONTRACT_UPDATE",i))(Er||{}),_r=(n=>(n.ACCOUNT_POINTS_UNLOCK_ACHIEVEMENT="ACCOUNT_POINTS_UNLOCK_ACHIEVEMENT",n.ACCOUNT_KYC_STATUS_CHANGED="ACCOUNT_KYC_STATUS_CHANGED",n.ACCOUNT_AFFILIATE_DASHBOARD_UNLOCKED="ACCOUNT_AFFILIATE_DASHBOARD_UNLOCKED",n))(_r||{}),Ds={...Er,..._r};import Gc from"algosdk";var E=(t,e,r)=>{switch(e){case"8B":return L.encodeUint64(Number(t));case"32B":return $(t);case"str":return Ie(String(t));case"address":return K(String(t),r);case"token":return Cr(String(t),r);case"float":{var n=s.alloc(8);return n.writeDoubleBE(Number(t),0),new Uint8Array(n)}case"bool":return new Uint8Array(s.from(L.encodeUint64(Number(t))).subarray(-1));case"2B":return new Uint8Array(s.from(L.encodeUint64(Number(t))).subarray(-2));case"4B":return new Uint8Array(s.from(L.encodeUint64(Number(t))).subarray(-4));default:return s.from(t.toString())}},w=(t,e,r)=>{switch(e){case"8B":return L.decodeUint64(t,"safe");case"32B":return Te(t);case"str":return gr(t);case"address":return wr(t,r);case"token":return Dn(t,r);case"float":return s.from(t).readDoubleBE(0);case"bool":case"2B":return w(t,"8B");default:return s.from(t).toString()}};var wr=(t,e)=>e===8?L.encodeAddress(t):e===1?we.encode(t):xr(t),Dn=(t,e)=>{let r=s.from(t).toString("hex");return r.startsWith("0x")||(r="0x"+r),V[r]?r:e===8?String(Te(t)):e===1?we.encode(t):wr(t,e)};var Cr=(t,e)=>e===8?$(+t):V[t]?new Uint8Array(pe(String(t))):K(String(t),e);var Se=(t,e,r,n)=>{let i=K(t,e),o=L.encodeUint64(e),a=L.encodeUint64(n),c=Cr(r,n);return P([i,o,c,a])};var Ce=(t,e)=>P([Nn(t),Sr(e)]),Nn=t=>new Uint8Array(s.from(t+`
2
- `,"utf-8")),Sr=t=>new Uint8Array(s.from(fr(t)));var de=t=>s.from(Ee(t)).toString("hex");var z=(t,e,r)=>{let n=s.from(t,e),i=n.subarray(n.length-r),o=s.from(i).toString();return ye(o)};var K=(t,e)=>e===8?hr(t):e===1?Dr.decode(t):Ar(t);var On=new q("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),kn=new q("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");function Bn(t,e,r=!1,n=On,i=kn){if(!r&&!q.isOnCurve(e.toBuffer()))throw new Error("TokenOwnerOffCurveError");let[o]=q.findProgramAddressSync([e.toBuffer(),n.toBuffer(),t.toBuffer()],i);return o}var Tm=(t,e,r)=>{let n=t==="MainNet"?"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v":"4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU";if(Rr(e,r))return n},Em=u.env.ALGO_NETWORK==="MainNet"?"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v":"4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU",Rr=(t,e)=>V[t]&&e===1,Pn=(t,e="hex")=>z(t,e,248),_m=t=>de(Pn(t,"hex")),Sm=(t,e="hex")=>{let r=z(t,e,248),n=Number(w(r.subarray(32,40),"8B")),i=Number(w(r.subarray(104,112),"8B"));return{loginAddress:String(w(r.subarray(0,32),"address",n)),loginChainId:n,tokenIndex:String(w(r.subarray(40,72),"token",i)),tokenChainId:i,recipient:String(w(r.subarray(72,104),"address",i)),recipientChainId:i,tokenAmount:String(w(r.subarray(112,144),"32B")),isNative:!!w(r.subarray(144,145),"bool"),fee:Number(w(r.subarray(145,177),"32B")),random:Number(w(r.subarray(177,185),"8B"))}},wm=(t,e)=>{let{loginAddress:r,loginChainId:n,recipient:i,recipientChainId:o,tokenAmount:a,tokenIndex:c,isNative:d,fee:l,random:g,solanaUsdc:m}=t,b=K(i,o);if(Rr(String(c),o)){let X=new q(m),De=Bn(X,new q(i));console.log("associatedTokenAddress",De.toBase58()),b=K(De.toBase58(),o)}let f=Se(r,n,c,o),I=P([f.slice(0,72),b,E(o,"8B"),$(a),E(+d,"bool"),$(l),E(g,"8B")]);return Ce(e||JSON.stringify(t),I)},Un={EVM:5,ALGORAND:8,SOLANA:1},Cm=t=>{let e=[E(t.address,"address",Un[t.type]),E(t.name,"str"),E(t.type,"str"),E(t.description||"","str")],r=s.concat(e),n=Tr(t.address);return Ce(n,r)};export{kn as ASSOCIATED_TOKEN_PROGRAM_ID,Em as SOLANA_USDC,On as TOKEN_PROGRAM_ID,_m as calcWithdrawHash,Cm as createWithdrawalWalletMsg,Sm as decodeWithdrawMsg,Bn as getAssociatedTokenAddressSync,Tm as getSolanaUsdc,Pn as getWithdrawBytesFromMsg,Rr as isSolanaCctp,wm as makeWithdrawMsg};
2
+ `,"utf-8")),Sr=t=>new Uint8Array(s.from(fr(t)));var de=t=>s.from(Ee(t)).toString("hex");var z=(t,e,r)=>{let n=s.from(t,e),i=n.subarray(n.length-r),o=s.from(i).toString();return ye(o)};var K=(t,e)=>e===8?hr(t):e===1?Dr.decode(t):Ar(t);var On=new q("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),kn=new q("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");function Bn(t,e,r=!1,n=On,i=kn){if(!r&&!q.isOnCurve(e.toBuffer()))throw new Error("TokenOwnerOffCurveError");let[o]=q.findProgramAddressSync([e.toBuffer(),n.toBuffer(),t.toBuffer()],i);return o}var Sm=(t,e,r)=>{let n=t==="MainNet"?"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v":"4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU";if(Rr(e,r))return n},wm=u.env.ALGO_NETWORK==="MainNet"?"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v":"4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU",Rr=(t,e)=>V[t]&&e===1,Pn=(t,e="hex")=>z(t,e,248),Cm=t=>de(Pn(t,"hex")),Dm=(t,e="hex")=>{let r=z(t,e,248),n=Number(w(r.subarray(32,40),"8B")),i=Number(w(r.subarray(104,112),"8B"));return{loginAddress:String(w(r.subarray(0,32),"address",n)),loginChainId:n,tokenIndex:String(w(r.subarray(40,72),"token",i)),tokenChainId:i,recipient:String(w(r.subarray(72,104),"address",i)),recipientChainId:i,tokenAmount:String(w(r.subarray(112,144),"32B")),isNative:!!w(r.subarray(144,145),"bool"),fee:Number(w(r.subarray(145,177),"32B")),random:Number(w(r.subarray(177,185),"8B"))}},Nm=(t,e)=>{let{loginAddress:r,loginChainId:n,recipient:i,recipientChainId:o,tokenAmount:a,tokenIndex:c,isNative:d,fee:l,random:g,solanaUsdc:m}=t,b=K(i,o);if(Rr(String(c),o)){let X=new q(m),De=Bn(X,new q(i));console.log("associatedTokenAddress",De.toBase58()),b=K(De.toBase58(),o)}let f=Se(r,n,c,o),I=P([f.slice(0,72),b,E(o,"8B"),$(a),E(+d,"bool"),$(l),E(g,"8B")]);return Ce(e||JSON.stringify(t),I)},Un={EVM:5,ALGORAND:8,SOLANA:1},Rm=t=>{let e=[E(t.address,"address",Un[t.type]),E(t.name,"str"),E(t.type,"str"),E(t.description||"","str")],r=s.concat(e),n=Tr(t.address);return Ce(n,r)};export{kn as ASSOCIATED_TOKEN_PROGRAM_ID,wm as SOLANA_USDC,On as TOKEN_PROGRAM_ID,Cm as calcWithdrawHash,Rm as createWithdrawalWalletMsg,Dm as decodeWithdrawMsg,Bn as getAssociatedTokenAddressSync,Sm as getSolanaUsdc,Pn as getWithdrawBytesFromMsg,Rr as isSolanaCctp,Nm as makeWithdrawMsg};
3
3
  /*!
4
4
  * The buffer module from node.js, for the browser.
5
5
  *
@@ -1,4 +1,4 @@
1
- function H(){throw new Error("setTimeout has not been defined")}function V(){throw new Error("clearTimeout has not been defined")}var _=H,E=V;typeof globalThis.setTimeout=="function"&&(_=setTimeout);typeof globalThis.clearTimeout=="function"&&(E=clearTimeout);function q(t){if(_===setTimeout)return setTimeout(t,0);if((_===H||!_)&&setTimeout)return _=setTimeout,setTimeout(t,0);try{return _(t,0)}catch{try{return _.call(null,t,0)}catch{return _.call(this,t,0)}}}function Ie(t){if(E===clearTimeout)return clearTimeout(t);if((E===V||!E)&&clearTimeout)return E=clearTimeout,clearTimeout(t);try{return E(t)}catch{try{return E.call(null,t)}catch{return E.call(this,t)}}}var y=[],O=!1,C,N=-1;function he(){!O||!C||(O=!1,C.length?y=C.concat(y):N=-1,y.length&&z())}function z(){if(!O){var t=q(he);O=!0;for(var e=y.length;e;){for(C=y,y=[];++N<e;)C&&C[N].run();N=-1,e=y.length}C=null,O=!1,Ie(t)}}function be(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];y.push(new J(t,e)),y.length===1&&!O&&q(z)}function J(t,e){this.fun=t,this.array=e}J.prototype.run=function(){this.fun.apply(null,this.array)};var xe="browser",Ae="browser",ye=!0,Te={},_e=[],Ee="",Ce={},De={},Se={};function D(){}var we=D,Re=D,Oe=D,Ne=D,ve=D,ke=D,Pe=D;function Le(t){throw new Error("process.binding is not supported")}function Me(){return"/"}function Ue(t){throw new Error("process.chdir is not supported")}function Be(){return 0}var R=globalThis.performance||{},We=R.now||R.mozNow||R.msNow||R.oNow||R.webkitNow||function(){return new Date().getTime()};function Fe(t){var e=We.call(R)*.001,r=Math.floor(e),n=Math.floor(e%1*1e9);return t&&(r=r-t[0],n=n-t[1],n<0&&(r--,n+=1e9)),[r,n]}var Ge=new Date;function Ye(){var t=new Date,e=t-Ge;return e/1e3}var p={nextTick:be,title:xe,browser:ye,env:Te,argv:_e,version:Ee,versions:Ce,on:we,addListener:Re,once:Oe,off:Ne,removeListener:ve,removeAllListeners:ke,emit:Pe,binding:Le,cwd:Me,chdir:Ue,umask:Be,hrtime:Fe,platform:Ae,release:De,config:Se,uptime:Ye},K={};Object.keys(K).forEach(t=>{let e=t.split("."),r=p;for(let n=0;n<e.length;n++){let i=e[n];n===e.length-1?r[i]=K[t]:r=r[i]||(r[i]={})}});var x=[],h=[],Ke=typeof Uint8Array<"u"?Uint8Array:Array,W=!1;function $(){W=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0,r=t.length;e<r;++e)x[e]=t[e],h[t.charCodeAt(e)]=e;h[45]=62,h[95]=63}function He(t){W||$();var e,r,n,i,o,s,c=t.length;if(c%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o=t[c-2]==="="?2:t[c-1]==="="?1:0,s=new Ke(c*3/4-o),n=o>0?c-4:c;var u=0;for(e=0,r=0;e<n;e+=4,r+=3)i=h[t.charCodeAt(e)]<<18|h[t.charCodeAt(e+1)]<<12|h[t.charCodeAt(e+2)]<<6|h[t.charCodeAt(e+3)],s[u++]=i>>16&255,s[u++]=i>>8&255,s[u++]=i&255;return o===2?(i=h[t.charCodeAt(e)]<<2|h[t.charCodeAt(e+1)]>>4,s[u++]=i&255):o===1&&(i=h[t.charCodeAt(e)]<<10|h[t.charCodeAt(e+1)]<<4|h[t.charCodeAt(e+2)]>>2,s[u++]=i>>8&255,s[u++]=i&255),s}function Ve(t){return x[t>>18&63]+x[t>>12&63]+x[t>>6&63]+x[t&63]}function qe(t,e,r){for(var n,i=[],o=e;o<r;o+=3)n=(t[o]<<16)+(t[o+1]<<8)+t[o+2],i.push(Ve(n));return i.join("")}function X(t){W||$();for(var e,r=t.length,n=r%3,i="",o=[],s=16383,c=0,u=r-n;c<u;c+=s)o.push(qe(t,c,c+s>u?u:c+s));return n===1?(e=t[r-1],i+=x[e>>2],i+=x[e<<4&63],i+="=="):n===2&&(e=(t[r-2]<<8)+t[r-1],i+=x[e>>10],i+=x[e>>4&63],i+=x[e<<2&63],i+="="),o.push(i),o.join("")}a.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;function v(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function T(t,e){if(v()<e)throw new RangeError("Invalid typed array length");return a.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e),t.__proto__=a.prototype):(t===null&&(t=new a(e)),t.length=e),t}function a(t,e,r){if(!a.TYPED_ARRAY_SUPPORT&&!(this instanceof a))return new a(t,e,r);if(typeof t=="number"){if(typeof e=="string")throw new Error("If encoding is specified then the first argument must be a string");return F(this,t)}return j(this,t,e,r)}a.poolSize=8192;a._augment=function(t){return t.__proto__=a.prototype,t};function j(t,e,r,n){if(typeof e=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer?Xe(t,e,r,n):typeof e=="string"?Je(t,e,r):Qe(t,e)}a.from=function(t,e,r){return j(null,t,e,r)};a.kMaxLength=v();a.TYPED_ARRAY_SUPPORT&&(a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&a[Symbol.species]);function ee(t){if(typeof t!="number")throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function ze(t,e,r,n){return ee(e),e<=0?T(t,e):r!==void 0?typeof n=="string"?T(t,e).fill(r,n):T(t,e).fill(r):T(t,e)}a.alloc=function(t,e,r){return ze(null,t,e,r)};function F(t,e){if(ee(e),t=T(t,e<0?0:G(e)|0),!a.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}a.allocUnsafe=function(t){return F(null,t)};a.allocUnsafeSlow=function(t){return F(null,t)};function Je(t,e,r){if((typeof r!="string"||r==="")&&(r="utf8"),!a.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=re(e,r)|0;t=T(t,n);var i=t.write(e,r);return i!==n&&(t=t.slice(0,i)),t}function B(t,e){var r=e.length<0?0:G(e.length)|0;t=T(t,r);for(var n=0;n<r;n+=1)t[n]=e[n]&255;return t}function Xe(t,e,r,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");return r===void 0&&n===void 0?e=new Uint8Array(e):n===void 0?e=new Uint8Array(e,r):e=new Uint8Array(e,r,n),a.TYPED_ARRAY_SUPPORT?(t=e,t.__proto__=a.prototype):t=B(t,e),t}function Qe(t,e){if(A(e)){var r=G(e.length)|0;return t=T(t,r),t.length===0||e.copy(t,0,0,r),t}if(e){if(typeof ArrayBuffer<"u"&&e.buffer instanceof ArrayBuffer||"length"in e)return typeof e.length!="number"||gr(e.length)?T(t,0):B(t,e);if(e.type==="Buffer"&&Array.isArray(e.data))return B(t,e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function G(t){if(t>=v())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+v().toString(16)+" bytes");return t|0}a.isBuffer=Ir;function A(t){return!!(t!=null&&t._isBuffer)}a.compare=function(e,r){if(!A(e)||!A(r))throw new TypeError("Arguments must be Buffers");if(e===r)return 0;for(var n=e.length,i=r.length,o=0,s=Math.min(n,i);o<s;++o)if(e[o]!==r[o]){n=e[o],i=r[o];break}return n<i?-1:i<n?1:0};a.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};a.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return a.alloc(0);var n;if(r===void 0)for(r=0,n=0;n<e.length;++n)r+=e[n].length;var i=a.allocUnsafe(r),o=0;for(n=0;n<e.length;++n){var s=e[n];if(!A(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(i,o),o+=s.length}return i};function re(t,e){if(A(t))return t.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;typeof t!="string"&&(t=""+t);var r=t.length;if(r===0)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return k(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return pe(t).length;default:if(n)return k(t).length;e=(""+e).toLowerCase(),n=!0}}a.byteLength=re;function Ze(t,e,r){var n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return sr(this,e,r);case"utf8":case"utf-8":return ie(this,e,r);case"ascii":return ar(this,e,r);case"latin1":case"binary":return or(this,e,r);case"base64":return nr(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return pr(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}a.prototype._isBuffer=!0;function S(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}a.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<e;r+=2)S(this,r,r+1);return this};a.prototype.swap32=function(){var e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<e;r+=4)S(this,r,r+3),S(this,r+1,r+2);return this};a.prototype.swap64=function(){var e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<e;r+=8)S(this,r,r+7),S(this,r+1,r+6),S(this,r+2,r+5),S(this,r+3,r+4);return this};a.prototype.toString=function(){var e=this.length|0;return e===0?"":arguments.length===0?ie(this,0,e):Ze.apply(this,arguments)};a.prototype.equals=function(e){if(!A(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:a.compare(this,e)===0};a.prototype.compare=function(e,r,n,i,o){if(!A(e))throw new TypeError("Argument must be a Buffer");if(r===void 0&&(r=0),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),o===void 0&&(o=this.length),r<0||n>e.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&r>=n)return 0;if(i>=o)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,o>>>=0,this===e)return 0;for(var s=o-i,c=n-r,u=Math.min(s,c),l=this.slice(i,o),d=e.slice(r,n),m=0;m<u;++m)if(l[m]!==d[m]){s=l[m],c=d[m];break}return s<c?-1:c<s?1:0};function te(t,e,r,n,i){if(t.length===0)return-1;if(typeof r=="string"?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof e=="string"&&(e=a.from(e,n)),A(e))return e.length===0?-1:Q(t,e,r,n,i);if(typeof e=="number")return e=e&255,a.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):Q(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function Q(t,e,r,n,i){var o=1,s=t.length,c=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;o=2,s/=2,c/=2,r/=2}function u(I,w){return o===1?I[w]:I.readUInt16BE(w*o)}var l;if(i){var d=-1;for(l=r;l<s;l++)if(u(t,l)===u(e,d===-1?0:l-d)){if(d===-1&&(d=l),l-d+1===c)return d*o}else d!==-1&&(l-=l-d),d=-1}else for(r+c>s&&(r=s-c),l=r;l>=0;l--){for(var m=!0,b=0;b<c;b++)if(u(t,l+b)!==u(e,b)){m=!1;break}if(m)return l}return-1}a.prototype.includes=function(e,r,n){return this.indexOf(e,r,n)!==-1};a.prototype.indexOf=function(e,r,n){return te(this,e,r,n,!0)};a.prototype.lastIndexOf=function(e,r,n){return te(this,e,r,n,!1)};function $e(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n),n>i&&(n=i)):n=i;var o=e.length;if(o%2!==0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var s=0;s<n;++s){var c=parseInt(e.substr(s*2,2),16);if(isNaN(c))return s;t[r+s]=c}return s}function je(t,e,r,n){return M(k(e,t.length-r),t,r,n)}function ne(t,e,r,n){return M(lr(e),t,r,n)}function er(t,e,r,n){return ne(t,e,r,n)}function rr(t,e,r,n){return M(pe(e),t,r,n)}function tr(t,e,r,n){return M(fr(e,t.length-r),t,r,n)}a.prototype.write=function(e,r,n,i){if(r===void 0)i="utf8",n=this.length,r=0;else if(n===void 0&&typeof r=="string")i=r,n=this.length,r=0;else if(isFinite(r))r=r|0,isFinite(n)?(n=n|0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var o=this.length-r;if((n===void 0||n>o)&&(n=o),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var s=!1;;)switch(i){case"hex":return $e(this,e,r,n);case"utf8":case"utf-8":return je(this,e,r,n);case"ascii":return ne(this,e,r,n);case"latin1":case"binary":return er(this,e,r,n);case"base64":return rr(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return tr(this,e,r,n);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}};a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function nr(t,e,r){return e===0&&r===t.length?X(t):X(t.slice(e,r))}function ie(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o=t[i],s=null,c=o>239?4:o>223?3:o>191?2:1;if(i+c<=r){var u,l,d,m;switch(c){case 1:o<128&&(s=o);break;case 2:u=t[i+1],(u&192)===128&&(m=(o&31)<<6|u&63,m>127&&(s=m));break;case 3:u=t[i+1],l=t[i+2],(u&192)===128&&(l&192)===128&&(m=(o&15)<<12|(u&63)<<6|l&63,m>2047&&(m<55296||m>57343)&&(s=m));break;case 4:u=t[i+1],l=t[i+2],d=t[i+3],(u&192)===128&&(l&192)===128&&(d&192)===128&&(m=(o&15)<<18|(u&63)<<12|(l&63)<<6|d&63,m>65535&&m<1114112&&(s=m))}}s===null?(s=65533,c=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|s&1023),n.push(s),i+=c}return ir(n)}var Z=4096;function ir(t){var e=t.length;if(e<=Z)return String.fromCharCode.apply(String,t);for(var r="",n=0;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=Z));return r}function ar(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]&127);return n}function or(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function sr(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=e;o<r;++o)i+=mr(t[o]);return i}function pr(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+n[o+1]*256);return i}a.prototype.slice=function(e,r){var n=this.length;e=~~e,r=r===void 0?n:~~r,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),r<e&&(r=e);var i;if(a.TYPED_ARRAY_SUPPORT)i=this.subarray(e,r),i.__proto__=a.prototype;else{var o=r-e;i=new a(o,void 0);for(var s=0;s<o;++s)i[s]=this[s+e]}return i};function f(t,e,r){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUIntLE=function(e,r,n){e=e|0,r=r|0,n||f(e,r,this.length);for(var i=this[e],o=1,s=0;++s<r&&(o*=256);)i+=this[e+s]*o;return i};a.prototype.readUIntBE=function(e,r,n){e=e|0,r=r|0,n||f(e,r,this.length);for(var i=this[e+--r],o=1;r>0&&(o*=256);)i+=this[e+--r]*o;return i};a.prototype.readUInt8=function(e,r){return r||f(e,1,this.length),this[e]};a.prototype.readUInt16LE=function(e,r){return r||f(e,2,this.length),this[e]|this[e+1]<<8};a.prototype.readUInt16BE=function(e,r){return r||f(e,2,this.length),this[e]<<8|this[e+1]};a.prototype.readUInt32LE=function(e,r){return r||f(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};a.prototype.readUInt32BE=function(e,r){return r||f(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};a.prototype.readIntLE=function(e,r,n){e=e|0,r=r|0,n||f(e,r,this.length);for(var i=this[e],o=1,s=0;++s<r&&(o*=256);)i+=this[e+s]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*r)),i};a.prototype.readIntBE=function(e,r,n){e=e|0,r=r|0,n||f(e,r,this.length);for(var i=r,o=1,s=this[e+--i];i>0&&(o*=256);)s+=this[e+--i]*o;return o*=128,s>=o&&(s-=Math.pow(2,8*r)),s};a.prototype.readInt8=function(e,r){return r||f(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};a.prototype.readInt16LE=function(e,r){r||f(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};a.prototype.readInt16BE=function(e,r){r||f(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};a.prototype.readInt32LE=function(e,r){return r||f(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};a.prototype.readInt32BE=function(e,r){return r||f(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};a.prototype.readFloatLE=function(e,r){return r||f(e,4,this.length),U(this,e,!0,23,4)};a.prototype.readFloatBE=function(e,r){return r||f(e,4,this.length),U(this,e,!1,23,4)};a.prototype.readDoubleLE=function(e,r){return r||f(e,8,this.length),U(this,e,!0,52,8)};a.prototype.readDoubleBE=function(e,r){return r||f(e,8,this.length),U(this,e,!1,52,8)};function g(t,e,r,n,i,o){if(!A(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}a.prototype.writeUIntLE=function(e,r,n,i){if(e=+e,r=r|0,n=n|0,!i){var o=Math.pow(2,8*n)-1;g(this,e,r,n,o,0)}var s=1,c=0;for(this[r]=e&255;++c<n&&(s*=256);)this[r+c]=e/s&255;return r+n};a.prototype.writeUIntBE=function(e,r,n,i){if(e=+e,r=r|0,n=n|0,!i){var o=Math.pow(2,8*n)-1;g(this,e,r,n,o,0)}var s=n-1,c=1;for(this[r+s]=e&255;--s>=0&&(c*=256);)this[r+s]=e/c&255;return r+n};a.prototype.writeUInt8=function(e,r,n){return e=+e,r=r|0,n||g(this,e,r,1,255,0),a.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[r]=e&255,r+1};function P(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i<o;++i)t[r+i]=(e&255<<8*(n?i:1-i))>>>(n?i:1-i)*8}a.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r|0,n||g(this,e,r,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[r]=e&255,this[r+1]=e>>>8):P(this,e,r,!0),r+2};a.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r|0,n||g(this,e,r,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[r]=e>>>8,this[r+1]=e&255):P(this,e,r,!1),r+2};function L(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i<o;++i)t[r+i]=e>>>(n?i:3-i)*8&255}a.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r|0,n||g(this,e,r,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255):L(this,e,r,!0),r+4};a.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r|0,n||g(this,e,r,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255):L(this,e,r,!1),r+4};a.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r|0,!i){var o=Math.pow(2,8*n-1);g(this,e,r,n,o-1,-o)}var s=0,c=1,u=0;for(this[r]=e&255;++s<n&&(c*=256);)e<0&&u===0&&this[r+s-1]!==0&&(u=1),this[r+s]=(e/c>>0)-u&255;return r+n};a.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r|0,!i){var o=Math.pow(2,8*n-1);g(this,e,r,n,o-1,-o)}var s=n-1,c=1,u=0;for(this[r+s]=e&255;--s>=0&&(c*=256);)e<0&&u===0&&this[r+s+1]!==0&&(u=1),this[r+s]=(e/c>>0)-u&255;return r+n};a.prototype.writeInt8=function(e,r,n){return e=+e,r=r|0,n||g(this,e,r,1,127,-128),a.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[r]=e&255,r+1};a.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r|0,n||g(this,e,r,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[r]=e&255,this[r+1]=e>>>8):P(this,e,r,!0),r+2};a.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r|0,n||g(this,e,r,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[r]=e>>>8,this[r+1]=e&255):P(this,e,r,!1),r+2};a.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r|0,n||g(this,e,r,4,2147483647,-2147483648),a.TYPED_ARRAY_SUPPORT?(this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24):L(this,e,r,!0),r+4};a.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r|0,n||g(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),a.TYPED_ARRAY_SUPPORT?(this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255):L(this,e,r,!1),r+4};function ae(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function oe(t,e,r,n,i){return i||ae(t,e,r,4,34028234663852886e22,-34028234663852886e22),ue(t,e,r,n,23,4),r+4}a.prototype.writeFloatLE=function(e,r,n){return oe(this,e,r,!0,n)};a.prototype.writeFloatBE=function(e,r,n){return oe(this,e,r,!1,n)};function se(t,e,r,n,i){return i||ae(t,e,r,8,17976931348623157e292,-17976931348623157e292),ue(t,e,r,n,52,8),r+8}a.prototype.writeDoubleLE=function(e,r,n){return se(this,e,r,!0,n)};a.prototype.writeDoubleBE=function(e,r,n){return se(this,e,r,!1,n)};a.prototype.copy=function(e,r,n,i){if(n||(n=0),!i&&i!==0&&(i=this.length),r>=e.length&&(r=e.length),r||(r=0),i>0&&i<n&&(i=n),i===n||e.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-r<i-n&&(i=e.length-r+n);var o=i-n,s;if(this===e&&n<r&&r<i)for(s=o-1;s>=0;--s)e[s+r]=this[s+n];else if(o<1e3||!a.TYPED_ARRAY_SUPPORT)for(s=0;s<o;++s)e[s+r]=this[s+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+o),r);return o};a.prototype.fill=function(e,r,n,i){if(typeof e=="string"){if(typeof r=="string"?(i=r,r=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),e.length===1){var o=e.charCodeAt(0);o<256&&(e=o)}if(i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!a.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else typeof e=="number"&&(e=e&255);if(r<0||this.length<r||this.length<n)throw new RangeError("Out of range index");if(n<=r)return this;r=r>>>0,n=n===void 0?this.length:n>>>0,e||(e=0);var s;if(typeof e=="number")for(s=r;s<n;++s)this[s]=e;else{var c=A(e)?e:k(new a(e,i).toString()),u=c.length;for(s=0;s<n-r;++s)this[s+r]=c[s%u]}return this};var cr=/[^+\/0-9A-Za-z-_]/g;function ur(t){if(t=dr(t).replace(cr,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function dr(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function mr(t){return t<16?"0"+t.toString(16):t.toString(16)}function k(t,e){e=e||1/0;for(var r,n=t.length,i=null,o=[],s=0;s<n;++s){if(r=t.charCodeAt(s),r>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}else if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return o}function lr(t){for(var e=[],r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function fr(t,e){for(var r,n,i,o=[],s=0;s<t.length&&!((e-=2)<0);++s)r=t.charCodeAt(s),n=r>>8,i=r%256,o.push(i),o.push(n);return o}function pe(t){return He(ur(t))}function M(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function gr(t){return t!==t}function Ir(t){return t!=null&&(!!t._isBuffer||ce(t)||hr(t))}function ce(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function hr(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&ce(t.slice(0,0))}function U(t,e,r,n,i){var o,s,c=i*8-n-1,u=(1<<c)-1,l=u>>1,d=-7,m=r?i-1:0,b=r?-1:1,I=t[e+m];for(m+=b,o=I&(1<<-d)-1,I>>=-d,d+=c;d>0;o=o*256+t[e+m],m+=b,d-=8);for(s=o&(1<<-d)-1,o>>=-d,d+=n;d>0;s=s*256+t[e+m],m+=b,d-=8);if(o===0)o=1-l;else{if(o===u)return s?NaN:(I?-1:1)*(1/0);s=s+Math.pow(2,n),o=o-l}return(I?-1:1)*s*Math.pow(2,o-n)}function ue(t,e,r,n,i,o){var s,c,u,l=o*8-i-1,d=(1<<l)-1,m=d>>1,b=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,I=n?0:o-1,w=n?1:-1,ge=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(c=isNaN(e)?1:0,s=d):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),s+m>=1?e+=b/u:e+=b*Math.pow(2,1-m),e*u>=2&&(s++,u/=2),s+m>=d?(c=0,s=d):s+m>=1?(c=(e*u-1)*Math.pow(2,i),s=s+m):(c=e*Math.pow(2,m-1)*Math.pow(2,i),s=0));i>=8;t[r+I]=c&255,I+=w,c/=256,i-=8);for(s=s<<i|c,l+=i;l>0;t[r+I]=s&255,I+=w,s/=256,l-=8);t[r+I-w]|=ge*128}var Y=(r=>(r.User="User",r.Api="API",r))(Y||{});var de=(i=>(i.GLOBAL_PAIR_DELISTING="GLOBAL_PAIR_DELISTING",i.GLOBAL_NEW_PAIR_LISTING="GLOBAL_NEW_PAIR_LISTING",i.GLOBAL_SYSTEM_MAINTENANCE="GLOBAL_SYSTEM_MAINTENANCE",i.GLOBAL_SMART_CONTRACT_UPDATE="GLOBAL_SMART_CONTRACT_UPDATE",i))(de||{}),me=(n=>(n.ACCOUNT_POINTS_UNLOCK_ACHIEVEMENT="ACCOUNT_POINTS_UNLOCK_ACHIEVEMENT",n.ACCOUNT_KYC_STATUS_CHANGED="ACCOUNT_KYC_STATUS_CHANGED",n.ACCOUNT_AFFILIATE_DASHBOARD_UNLOCKED="ACCOUNT_AFFILIATE_DASHBOARD_UNLOCKED",n))(me||{}),Bt={...de,...me};var le=(n=>(n.SOLANA="SOLANA",n.ALGORAND="ALGORAND",n.EVM="EVM",n))(le||{});var br=(d=>(d.PERA="PERA",d.METAMASK="METAMASK",d.TRUST_WALLET="TRUST_WALLET",d.PHANTOM="PHANTOM",d.WALLET_CONNECT="WALLET_CONNECT",d.SOLANA_MOBILE="SOLANA_MOBILE",d.SOLFLARE="SOLFLARE",d.COINBASE="COINBASE",d.BACKPACK="BACKPACK",d.MOBILE="MOBILE",d))(br||{});var fe=class{};export{fe as ISetting,br as PROVIDERS,Y as TradingKeyType,le as WithdrawalWalletType};
1
+ function H(){throw new Error("setTimeout has not been defined")}function V(){throw new Error("clearTimeout has not been defined")}var _=H,E=V;typeof globalThis.setTimeout=="function"&&(_=setTimeout);typeof globalThis.clearTimeout=="function"&&(E=clearTimeout);function q(t){if(_===setTimeout)return setTimeout(t,0);if((_===H||!_)&&setTimeout)return _=setTimeout,setTimeout(t,0);try{return _(t,0)}catch{try{return _.call(null,t,0)}catch{return _.call(this,t,0)}}}function Ie(t){if(E===clearTimeout)return clearTimeout(t);if((E===V||!E)&&clearTimeout)return E=clearTimeout,clearTimeout(t);try{return E(t)}catch{try{return E.call(null,t)}catch{return E.call(this,t)}}}var y=[],O=!1,C,N=-1;function he(){!O||!C||(O=!1,C.length?y=C.concat(y):N=-1,y.length&&z())}function z(){if(!O){var t=q(he);O=!0;for(var e=y.length;e;){for(C=y,y=[];++N<e;)C&&C[N].run();N=-1,e=y.length}C=null,O=!1,Ie(t)}}function be(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];y.push(new J(t,e)),y.length===1&&!O&&q(z)}function J(t,e){this.fun=t,this.array=e}J.prototype.run=function(){this.fun.apply(null,this.array)};var xe="browser",Ae="browser",ye=!0,Te={},_e=[],Ee="",Ce={},De={},Se={};function D(){}var we=D,Re=D,Oe=D,Ne=D,ve=D,ke=D,Pe=D;function Le(t){throw new Error("process.binding is not supported")}function Me(){return"/"}function Ue(t){throw new Error("process.chdir is not supported")}function Be(){return 0}var R=globalThis.performance||{},We=R.now||R.mozNow||R.msNow||R.oNow||R.webkitNow||function(){return new Date().getTime()};function Fe(t){var e=We.call(R)*.001,r=Math.floor(e),n=Math.floor(e%1*1e9);return t&&(r=r-t[0],n=n-t[1],n<0&&(r--,n+=1e9)),[r,n]}var Ge=new Date;function Ye(){var t=new Date,e=t-Ge;return e/1e3}var p={nextTick:be,title:xe,browser:ye,env:Te,argv:_e,version:Ee,versions:Ce,on:we,addListener:Re,once:Oe,off:Ne,removeListener:ve,removeAllListeners:ke,emit:Pe,binding:Le,cwd:Me,chdir:Ue,umask:Be,hrtime:Fe,platform:Ae,release:De,config:Se,uptime:Ye},K={};Object.keys(K).forEach(t=>{let e=t.split("."),r=p;for(let n=0;n<e.length;n++){let i=e[n];n===e.length-1?r[i]=K[t]:r=r[i]||(r[i]={})}});var x=[],h=[],Ke=typeof Uint8Array<"u"?Uint8Array:Array,W=!1;function Z(){W=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0,r=t.length;e<r;++e)x[e]=t[e],h[t.charCodeAt(e)]=e;h[45]=62,h[95]=63}function He(t){W||Z();var e,r,n,i,o,s,c=t.length;if(c%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o=t[c-2]==="="?2:t[c-1]==="="?1:0,s=new Ke(c*3/4-o),n=o>0?c-4:c;var u=0;for(e=0,r=0;e<n;e+=4,r+=3)i=h[t.charCodeAt(e)]<<18|h[t.charCodeAt(e+1)]<<12|h[t.charCodeAt(e+2)]<<6|h[t.charCodeAt(e+3)],s[u++]=i>>16&255,s[u++]=i>>8&255,s[u++]=i&255;return o===2?(i=h[t.charCodeAt(e)]<<2|h[t.charCodeAt(e+1)]>>4,s[u++]=i&255):o===1&&(i=h[t.charCodeAt(e)]<<10|h[t.charCodeAt(e+1)]<<4|h[t.charCodeAt(e+2)]>>2,s[u++]=i>>8&255,s[u++]=i&255),s}function Ve(t){return x[t>>18&63]+x[t>>12&63]+x[t>>6&63]+x[t&63]}function qe(t,e,r){for(var n,i=[],o=e;o<r;o+=3)n=(t[o]<<16)+(t[o+1]<<8)+t[o+2],i.push(Ve(n));return i.join("")}function X(t){W||Z();for(var e,r=t.length,n=r%3,i="",o=[],s=16383,c=0,u=r-n;c<u;c+=s)o.push(qe(t,c,c+s>u?u:c+s));return n===1?(e=t[r-1],i+=x[e>>2],i+=x[e<<4&63],i+="=="):n===2&&(e=(t[r-2]<<8)+t[r-1],i+=x[e>>10],i+=x[e>>4&63],i+=x[e<<2&63],i+="="),o.push(i),o.join("")}a.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;function v(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function T(t,e){if(v()<e)throw new RangeError("Invalid typed array length");return a.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e),t.__proto__=a.prototype):(t===null&&(t=new a(e)),t.length=e),t}function a(t,e,r){if(!a.TYPED_ARRAY_SUPPORT&&!(this instanceof a))return new a(t,e,r);if(typeof t=="number"){if(typeof e=="string")throw new Error("If encoding is specified then the first argument must be a string");return F(this,t)}return $(this,t,e,r)}a.poolSize=8192;a._augment=function(t){return t.__proto__=a.prototype,t};function $(t,e,r,n){if(typeof e=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer?Xe(t,e,r,n):typeof e=="string"?Je(t,e,r):Qe(t,e)}a.from=function(t,e,r){return $(null,t,e,r)};a.kMaxLength=v();a.TYPED_ARRAY_SUPPORT&&(a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&a[Symbol.species]);function ee(t){if(typeof t!="number")throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function ze(t,e,r,n){return ee(e),e<=0?T(t,e):r!==void 0?typeof n=="string"?T(t,e).fill(r,n):T(t,e).fill(r):T(t,e)}a.alloc=function(t,e,r){return ze(null,t,e,r)};function F(t,e){if(ee(e),t=T(t,e<0?0:G(e)|0),!a.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}a.allocUnsafe=function(t){return F(null,t)};a.allocUnsafeSlow=function(t){return F(null,t)};function Je(t,e,r){if((typeof r!="string"||r==="")&&(r="utf8"),!a.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=re(e,r)|0;t=T(t,n);var i=t.write(e,r);return i!==n&&(t=t.slice(0,i)),t}function B(t,e){var r=e.length<0?0:G(e.length)|0;t=T(t,r);for(var n=0;n<r;n+=1)t[n]=e[n]&255;return t}function Xe(t,e,r,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");return r===void 0&&n===void 0?e=new Uint8Array(e):n===void 0?e=new Uint8Array(e,r):e=new Uint8Array(e,r,n),a.TYPED_ARRAY_SUPPORT?(t=e,t.__proto__=a.prototype):t=B(t,e),t}function Qe(t,e){if(A(e)){var r=G(e.length)|0;return t=T(t,r),t.length===0||e.copy(t,0,0,r),t}if(e){if(typeof ArrayBuffer<"u"&&e.buffer instanceof ArrayBuffer||"length"in e)return typeof e.length!="number"||gr(e.length)?T(t,0):B(t,e);if(e.type==="Buffer"&&Array.isArray(e.data))return B(t,e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function G(t){if(t>=v())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+v().toString(16)+" bytes");return t|0}a.isBuffer=Ir;function A(t){return!!(t!=null&&t._isBuffer)}a.compare=function(e,r){if(!A(e)||!A(r))throw new TypeError("Arguments must be Buffers");if(e===r)return 0;for(var n=e.length,i=r.length,o=0,s=Math.min(n,i);o<s;++o)if(e[o]!==r[o]){n=e[o],i=r[o];break}return n<i?-1:i<n?1:0};a.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};a.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return a.alloc(0);var n;if(r===void 0)for(r=0,n=0;n<e.length;++n)r+=e[n].length;var i=a.allocUnsafe(r),o=0;for(n=0;n<e.length;++n){var s=e[n];if(!A(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(i,o),o+=s.length}return i};function re(t,e){if(A(t))return t.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;typeof t!="string"&&(t=""+t);var r=t.length;if(r===0)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return k(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return pe(t).length;default:if(n)return k(t).length;e=(""+e).toLowerCase(),n=!0}}a.byteLength=re;function je(t,e,r){var n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return sr(this,e,r);case"utf8":case"utf-8":return ie(this,e,r);case"ascii":return ar(this,e,r);case"latin1":case"binary":return or(this,e,r);case"base64":return nr(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return pr(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}a.prototype._isBuffer=!0;function S(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}a.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<e;r+=2)S(this,r,r+1);return this};a.prototype.swap32=function(){var e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<e;r+=4)S(this,r,r+3),S(this,r+1,r+2);return this};a.prototype.swap64=function(){var e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<e;r+=8)S(this,r,r+7),S(this,r+1,r+6),S(this,r+2,r+5),S(this,r+3,r+4);return this};a.prototype.toString=function(){var e=this.length|0;return e===0?"":arguments.length===0?ie(this,0,e):je.apply(this,arguments)};a.prototype.equals=function(e){if(!A(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:a.compare(this,e)===0};a.prototype.compare=function(e,r,n,i,o){if(!A(e))throw new TypeError("Argument must be a Buffer");if(r===void 0&&(r=0),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),o===void 0&&(o=this.length),r<0||n>e.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&r>=n)return 0;if(i>=o)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,o>>>=0,this===e)return 0;for(var s=o-i,c=n-r,u=Math.min(s,c),l=this.slice(i,o),d=e.slice(r,n),m=0;m<u;++m)if(l[m]!==d[m]){s=l[m],c=d[m];break}return s<c?-1:c<s?1:0};function te(t,e,r,n,i){if(t.length===0)return-1;if(typeof r=="string"?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof e=="string"&&(e=a.from(e,n)),A(e))return e.length===0?-1:Q(t,e,r,n,i);if(typeof e=="number")return e=e&255,a.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):Q(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function Q(t,e,r,n,i){var o=1,s=t.length,c=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;o=2,s/=2,c/=2,r/=2}function u(I,w){return o===1?I[w]:I.readUInt16BE(w*o)}var l;if(i){var d=-1;for(l=r;l<s;l++)if(u(t,l)===u(e,d===-1?0:l-d)){if(d===-1&&(d=l),l-d+1===c)return d*o}else d!==-1&&(l-=l-d),d=-1}else for(r+c>s&&(r=s-c),l=r;l>=0;l--){for(var m=!0,b=0;b<c;b++)if(u(t,l+b)!==u(e,b)){m=!1;break}if(m)return l}return-1}a.prototype.includes=function(e,r,n){return this.indexOf(e,r,n)!==-1};a.prototype.indexOf=function(e,r,n){return te(this,e,r,n,!0)};a.prototype.lastIndexOf=function(e,r,n){return te(this,e,r,n,!1)};function Ze(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n),n>i&&(n=i)):n=i;var o=e.length;if(o%2!==0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var s=0;s<n;++s){var c=parseInt(e.substr(s*2,2),16);if(isNaN(c))return s;t[r+s]=c}return s}function $e(t,e,r,n){return M(k(e,t.length-r),t,r,n)}function ne(t,e,r,n){return M(lr(e),t,r,n)}function er(t,e,r,n){return ne(t,e,r,n)}function rr(t,e,r,n){return M(pe(e),t,r,n)}function tr(t,e,r,n){return M(fr(e,t.length-r),t,r,n)}a.prototype.write=function(e,r,n,i){if(r===void 0)i="utf8",n=this.length,r=0;else if(n===void 0&&typeof r=="string")i=r,n=this.length,r=0;else if(isFinite(r))r=r|0,isFinite(n)?(n=n|0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var o=this.length-r;if((n===void 0||n>o)&&(n=o),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var s=!1;;)switch(i){case"hex":return Ze(this,e,r,n);case"utf8":case"utf-8":return $e(this,e,r,n);case"ascii":return ne(this,e,r,n);case"latin1":case"binary":return er(this,e,r,n);case"base64":return rr(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return tr(this,e,r,n);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}};a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function nr(t,e,r){return e===0&&r===t.length?X(t):X(t.slice(e,r))}function ie(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o=t[i],s=null,c=o>239?4:o>223?3:o>191?2:1;if(i+c<=r){var u,l,d,m;switch(c){case 1:o<128&&(s=o);break;case 2:u=t[i+1],(u&192)===128&&(m=(o&31)<<6|u&63,m>127&&(s=m));break;case 3:u=t[i+1],l=t[i+2],(u&192)===128&&(l&192)===128&&(m=(o&15)<<12|(u&63)<<6|l&63,m>2047&&(m<55296||m>57343)&&(s=m));break;case 4:u=t[i+1],l=t[i+2],d=t[i+3],(u&192)===128&&(l&192)===128&&(d&192)===128&&(m=(o&15)<<18|(u&63)<<12|(l&63)<<6|d&63,m>65535&&m<1114112&&(s=m))}}s===null?(s=65533,c=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|s&1023),n.push(s),i+=c}return ir(n)}var j=4096;function ir(t){var e=t.length;if(e<=j)return String.fromCharCode.apply(String,t);for(var r="",n=0;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=j));return r}function ar(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]&127);return n}function or(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function sr(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=e;o<r;++o)i+=mr(t[o]);return i}function pr(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+n[o+1]*256);return i}a.prototype.slice=function(e,r){var n=this.length;e=~~e,r=r===void 0?n:~~r,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),r<e&&(r=e);var i;if(a.TYPED_ARRAY_SUPPORT)i=this.subarray(e,r),i.__proto__=a.prototype;else{var o=r-e;i=new a(o,void 0);for(var s=0;s<o;++s)i[s]=this[s+e]}return i};function f(t,e,r){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUIntLE=function(e,r,n){e=e|0,r=r|0,n||f(e,r,this.length);for(var i=this[e],o=1,s=0;++s<r&&(o*=256);)i+=this[e+s]*o;return i};a.prototype.readUIntBE=function(e,r,n){e=e|0,r=r|0,n||f(e,r,this.length);for(var i=this[e+--r],o=1;r>0&&(o*=256);)i+=this[e+--r]*o;return i};a.prototype.readUInt8=function(e,r){return r||f(e,1,this.length),this[e]};a.prototype.readUInt16LE=function(e,r){return r||f(e,2,this.length),this[e]|this[e+1]<<8};a.prototype.readUInt16BE=function(e,r){return r||f(e,2,this.length),this[e]<<8|this[e+1]};a.prototype.readUInt32LE=function(e,r){return r||f(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};a.prototype.readUInt32BE=function(e,r){return r||f(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};a.prototype.readIntLE=function(e,r,n){e=e|0,r=r|0,n||f(e,r,this.length);for(var i=this[e],o=1,s=0;++s<r&&(o*=256);)i+=this[e+s]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*r)),i};a.prototype.readIntBE=function(e,r,n){e=e|0,r=r|0,n||f(e,r,this.length);for(var i=r,o=1,s=this[e+--i];i>0&&(o*=256);)s+=this[e+--i]*o;return o*=128,s>=o&&(s-=Math.pow(2,8*r)),s};a.prototype.readInt8=function(e,r){return r||f(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};a.prototype.readInt16LE=function(e,r){r||f(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};a.prototype.readInt16BE=function(e,r){r||f(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};a.prototype.readInt32LE=function(e,r){return r||f(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};a.prototype.readInt32BE=function(e,r){return r||f(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};a.prototype.readFloatLE=function(e,r){return r||f(e,4,this.length),U(this,e,!0,23,4)};a.prototype.readFloatBE=function(e,r){return r||f(e,4,this.length),U(this,e,!1,23,4)};a.prototype.readDoubleLE=function(e,r){return r||f(e,8,this.length),U(this,e,!0,52,8)};a.prototype.readDoubleBE=function(e,r){return r||f(e,8,this.length),U(this,e,!1,52,8)};function g(t,e,r,n,i,o){if(!A(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}a.prototype.writeUIntLE=function(e,r,n,i){if(e=+e,r=r|0,n=n|0,!i){var o=Math.pow(2,8*n)-1;g(this,e,r,n,o,0)}var s=1,c=0;for(this[r]=e&255;++c<n&&(s*=256);)this[r+c]=e/s&255;return r+n};a.prototype.writeUIntBE=function(e,r,n,i){if(e=+e,r=r|0,n=n|0,!i){var o=Math.pow(2,8*n)-1;g(this,e,r,n,o,0)}var s=n-1,c=1;for(this[r+s]=e&255;--s>=0&&(c*=256);)this[r+s]=e/c&255;return r+n};a.prototype.writeUInt8=function(e,r,n){return e=+e,r=r|0,n||g(this,e,r,1,255,0),a.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[r]=e&255,r+1};function P(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i<o;++i)t[r+i]=(e&255<<8*(n?i:1-i))>>>(n?i:1-i)*8}a.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r|0,n||g(this,e,r,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[r]=e&255,this[r+1]=e>>>8):P(this,e,r,!0),r+2};a.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r|0,n||g(this,e,r,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[r]=e>>>8,this[r+1]=e&255):P(this,e,r,!1),r+2};function L(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i<o;++i)t[r+i]=e>>>(n?i:3-i)*8&255}a.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r|0,n||g(this,e,r,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255):L(this,e,r,!0),r+4};a.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r|0,n||g(this,e,r,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255):L(this,e,r,!1),r+4};a.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r|0,!i){var o=Math.pow(2,8*n-1);g(this,e,r,n,o-1,-o)}var s=0,c=1,u=0;for(this[r]=e&255;++s<n&&(c*=256);)e<0&&u===0&&this[r+s-1]!==0&&(u=1),this[r+s]=(e/c>>0)-u&255;return r+n};a.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r|0,!i){var o=Math.pow(2,8*n-1);g(this,e,r,n,o-1,-o)}var s=n-1,c=1,u=0;for(this[r+s]=e&255;--s>=0&&(c*=256);)e<0&&u===0&&this[r+s+1]!==0&&(u=1),this[r+s]=(e/c>>0)-u&255;return r+n};a.prototype.writeInt8=function(e,r,n){return e=+e,r=r|0,n||g(this,e,r,1,127,-128),a.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[r]=e&255,r+1};a.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r|0,n||g(this,e,r,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[r]=e&255,this[r+1]=e>>>8):P(this,e,r,!0),r+2};a.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r|0,n||g(this,e,r,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[r]=e>>>8,this[r+1]=e&255):P(this,e,r,!1),r+2};a.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r|0,n||g(this,e,r,4,2147483647,-2147483648),a.TYPED_ARRAY_SUPPORT?(this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24):L(this,e,r,!0),r+4};a.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r|0,n||g(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),a.TYPED_ARRAY_SUPPORT?(this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255):L(this,e,r,!1),r+4};function ae(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function oe(t,e,r,n,i){return i||ae(t,e,r,4,34028234663852886e22,-34028234663852886e22),ue(t,e,r,n,23,4),r+4}a.prototype.writeFloatLE=function(e,r,n){return oe(this,e,r,!0,n)};a.prototype.writeFloatBE=function(e,r,n){return oe(this,e,r,!1,n)};function se(t,e,r,n,i){return i||ae(t,e,r,8,17976931348623157e292,-17976931348623157e292),ue(t,e,r,n,52,8),r+8}a.prototype.writeDoubleLE=function(e,r,n){return se(this,e,r,!0,n)};a.prototype.writeDoubleBE=function(e,r,n){return se(this,e,r,!1,n)};a.prototype.copy=function(e,r,n,i){if(n||(n=0),!i&&i!==0&&(i=this.length),r>=e.length&&(r=e.length),r||(r=0),i>0&&i<n&&(i=n),i===n||e.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-r<i-n&&(i=e.length-r+n);var o=i-n,s;if(this===e&&n<r&&r<i)for(s=o-1;s>=0;--s)e[s+r]=this[s+n];else if(o<1e3||!a.TYPED_ARRAY_SUPPORT)for(s=0;s<o;++s)e[s+r]=this[s+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+o),r);return o};a.prototype.fill=function(e,r,n,i){if(typeof e=="string"){if(typeof r=="string"?(i=r,r=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),e.length===1){var o=e.charCodeAt(0);o<256&&(e=o)}if(i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!a.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else typeof e=="number"&&(e=e&255);if(r<0||this.length<r||this.length<n)throw new RangeError("Out of range index");if(n<=r)return this;r=r>>>0,n=n===void 0?this.length:n>>>0,e||(e=0);var s;if(typeof e=="number")for(s=r;s<n;++s)this[s]=e;else{var c=A(e)?e:k(new a(e,i).toString()),u=c.length;for(s=0;s<n-r;++s)this[s+r]=c[s%u]}return this};var cr=/[^+\/0-9A-Za-z-_]/g;function ur(t){if(t=dr(t).replace(cr,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function dr(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function mr(t){return t<16?"0"+t.toString(16):t.toString(16)}function k(t,e){e=e||1/0;for(var r,n=t.length,i=null,o=[],s=0;s<n;++s){if(r=t.charCodeAt(s),r>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}else if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return o}function lr(t){for(var e=[],r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function fr(t,e){for(var r,n,i,o=[],s=0;s<t.length&&!((e-=2)<0);++s)r=t.charCodeAt(s),n=r>>8,i=r%256,o.push(i),o.push(n);return o}function pe(t){return He(ur(t))}function M(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function gr(t){return t!==t}function Ir(t){return t!=null&&(!!t._isBuffer||ce(t)||hr(t))}function ce(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function hr(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&ce(t.slice(0,0))}function U(t,e,r,n,i){var o,s,c=i*8-n-1,u=(1<<c)-1,l=u>>1,d=-7,m=r?i-1:0,b=r?-1:1,I=t[e+m];for(m+=b,o=I&(1<<-d)-1,I>>=-d,d+=c;d>0;o=o*256+t[e+m],m+=b,d-=8);for(s=o&(1<<-d)-1,o>>=-d,d+=n;d>0;s=s*256+t[e+m],m+=b,d-=8);if(o===0)o=1-l;else{if(o===u)return s?NaN:(I?-1:1)*(1/0);s=s+Math.pow(2,n),o=o-l}return(I?-1:1)*s*Math.pow(2,o-n)}function ue(t,e,r,n,i,o){var s,c,u,l=o*8-i-1,d=(1<<l)-1,m=d>>1,b=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,I=n?0:o-1,w=n?1:-1,ge=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(c=isNaN(e)?1:0,s=d):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),s+m>=1?e+=b/u:e+=b*Math.pow(2,1-m),e*u>=2&&(s++,u/=2),s+m>=d?(c=0,s=d):s+m>=1?(c=(e*u-1)*Math.pow(2,i),s=s+m):(c=e*Math.pow(2,m-1)*Math.pow(2,i),s=0));i>=8;t[r+I]=c&255,I+=w,c/=256,i-=8);for(s=s<<i|c,l+=i;l>0;t[r+I]=s&255,I+=w,s/=256,l-=8);t[r+I-w]|=ge*128}var Y=(r=>(r.User="User",r.Api="API",r))(Y||{});var de=(i=>(i.GLOBAL_PAIR_DELISTING="GLOBAL_PAIR_DELISTING",i.GLOBAL_NEW_PAIR_LISTING="GLOBAL_NEW_PAIR_LISTING",i.GLOBAL_SYSTEM_MAINTENANCE="GLOBAL_SYSTEM_MAINTENANCE",i.GLOBAL_SMART_CONTRACT_UPDATE="GLOBAL_SMART_CONTRACT_UPDATE",i))(de||{}),me=(n=>(n.ACCOUNT_POINTS_UNLOCK_ACHIEVEMENT="ACCOUNT_POINTS_UNLOCK_ACHIEVEMENT",n.ACCOUNT_KYC_STATUS_CHANGED="ACCOUNT_KYC_STATUS_CHANGED",n.ACCOUNT_AFFILIATE_DASHBOARD_UNLOCKED="ACCOUNT_AFFILIATE_DASHBOARD_UNLOCKED",n))(me||{}),Bt={...de,...me};var le=(n=>(n.SOLANA="SOLANA",n.ALGORAND="ALGORAND",n.EVM="EVM",n))(le||{});var br=(d=>(d.PERA="PERA",d.METAMASK="METAMASK",d.TRUST_WALLET="TRUST_WALLET",d.PHANTOM="PHANTOM",d.WALLET_CONNECT="WALLET_CONNECT",d.SOLANA_MOBILE="SOLANA_MOBILE",d.SOLFLARE="SOLFLARE",d.COINBASE="COINBASE",d.BACKPACK="BACKPACK",d.MOBILE="MOBILE",d))(br||{});var fe=class{};export{fe as ISetting,br as PROVIDERS,Y as TradingKeyType,le as WithdrawalWalletType};
2
2
  /*! Bundled license information:
3
3
 
4
4
  @esbuild-plugins/node-globals-polyfill/Buffer.js:
@@ -1,2 +1,2 @@
1
1
  import{PublicKey as b}from"@solana/web3.js";var m={"0x4343545055534443000000000000000000000000000000000000000000000000":65537};import io from"algosdk";import*as z from"bs58";import se from"algosdk";import Re,{decodeAddress as ke,encodeAddress as Pe}from"algosdk";import{Buffer as T}from"buffer";import{encodeAddress as te,decodeAddress as Ue}from"algosdk";function p(e){return e.reduce((r,t)=>Uint8Array.from([...r,...t]))}function h(e){return new Uint8Array(T.from(e))}function P(e){return T.from(e).toString("utf-8")}function L(e){return T.from(e).toString("base64")}function I(e){return T.from(e,"base64")}import ne from"bignumber.js";ne.config({DECIMAL_PLACES:40,EXPONENTIAL_AT:45});var $e=`{"theme1":{"value":"${process.env.FRONTEND_URL}/Theme%3DDark.svg","active":true},"theme2":{"value":"${process.env.FRONTEND_URL}/Theme%3DLight.svg","active":true},"theme3":{"value":"${process.env.FRONTEND_URL}/Theme%3DLight.svg","active":true}}`;var w={V1_1:"v1_1",V2:"v2"},Xe={[w.V1_1]:{testnet:62368684,mainnet:552635992},[w.V2]:{testnet:148607e3,mainnet:1002541853}};var M=e=>se.decodeAddress(e.toUpperCase()).publicKey;import*as a from"ethereumjs-util";function _(e){let r=a.fromSigned(Buffer.from(e));return BigInt(r.toString())}function ce(e){return a.toUnsigned(new a.BN(String(e)))}function l(e){let r=ce(e);if(r.length>32)throw new Error("Invalid value. The buffer length of the value is more than 32");return new Uint8Array(a.setLengthLeft(r,32))}var U=e=>{if(e.length!==32)throw new Error("Invalid address bytes. The address buffer length is not equel 32");let r=Buffer.from(e).toString("hex");if(r.slice(0,24)!=="000000000000000000000000")throw console.log("normalizedAddress",r),new Error("Invalid normalized address");let t="0x"+r.slice(-40);if(!de(t))throw new Error("Invalid hex address");return t},v=e=>new Uint8Array(a.setLengthLeft(E(e),32)),E=e=>Buffer.from(pe(e),"hex"),pe=e=>e.startsWith("0x")?e.slice(2):e,de=e=>a.isValidAddress(e);var N=e=>new Uint8Array(a.keccak256(Buffer.from(e)));import d from"algosdk";import*as C from"bs58";import _r from"algosdk";import Rr from"algosdk";import Qr from"algosdk";var Ur={SMALLESTUNIT:process.env.SMALLEST_UNIT},vr={SMALLEST_UNITS:process.env.SMALLEST_UNIT};var Gr=["point-system.discordEnabled","point-system.telegramBotName","point-system.telegramBotId","point-system.telegramEnabled","point-system.telegramGroupId","point-system.telegramGroupName","point-system.twitterAccountId","point-system.twitterAccountName","point-system.twitterEnabled","point-system.twitterJobEnabled","point-system.guideLink"];var G=e=>`By signing this message, you confirm that the wallet is a trusted one ${e}; Data: `;import cn from"algosdk";var K=(o=>(o.GLOBAL_PAIR_DELISTING="GLOBAL_PAIR_DELISTING",o.GLOBAL_NEW_PAIR_LISTING="GLOBAL_NEW_PAIR_LISTING",o.GLOBAL_SYSTEM_MAINTENANCE="GLOBAL_SYSTEM_MAINTENANCE",o.GLOBAL_SMART_CONTRACT_UPDATE="GLOBAL_SMART_CONTRACT_UPDATE",o))(K||{}),H=(n=>(n.ACCOUNT_POINTS_UNLOCK_ACHIEVEMENT="ACCOUNT_POINTS_UNLOCK_ACHIEVEMENT",n.ACCOUNT_KYC_STATUS_CHANGED="ACCOUNT_KYC_STATUS_CHANGED",n.ACCOUNT_AFFILIATE_DASHBOARD_UNLOCKED="ACCOUNT_AFFILIATE_DASHBOARD_UNLOCKED",n))(H||{}),ht={...K,...H};import En from"algosdk";var s=(e,r,t)=>{switch(r){case"8B":return d.encodeUint64(Number(e));case"32B":return l(e);case"str":return h(String(e));case"address":return u(String(e),t);case"token":return $(String(e),t);case"float":{var n=Buffer.alloc(8);return n.writeDoubleBE(Number(e),0),new Uint8Array(n)}case"bool":return new Uint8Array(Buffer.from(d.encodeUint64(Number(e))).subarray(-1));case"2B":return new Uint8Array(Buffer.from(d.encodeUint64(Number(e))).subarray(-2));case"4B":return new Uint8Array(Buffer.from(d.encodeUint64(Number(e))).subarray(-4));default:return Buffer.from(e.toString())}},c=(e,r,t)=>{switch(r){case"8B":return d.decodeUint64(e,"safe");case"32B":return _(e);case"str":return P(e);case"address":return V(e,t);case"token":return Te(e,t);case"float":return Buffer.from(e).readDoubleBE(0);case"bool":case"2B":return c(e,"8B");default:return Buffer.from(e).toString()}};var V=(e,r)=>r===8?d.encodeAddress(e):r===1?C.encode(e):U(e),Te=(e,r)=>{let t=Buffer.from(e).toString("hex");return t.startsWith("0x")||(t="0x"+t),m[t]?t:r===8?String(_(e)):r===1?C.encode(e):V(e,r)};var $=(e,r)=>r===8?l(+e):m[e]?new Uint8Array(E(String(e))):u(String(e),r);var O=(e,r,t,n)=>{let o=u(e,r),i=d.encodeUint64(r),x=d.encodeUint64(n),A=$(t,n);return p([o,i,A,x])};var B=(e,r)=>p([Ee(e),Y(r)]),Ee=e=>new Uint8Array(Buffer.from(e+`
2
- `,"utf-8")),Y=e=>new Uint8Array(Buffer.from(L(e)));var y=e=>Buffer.from(N(e)).toString("hex");var g=(e,r,t)=>{let n=Buffer.from(e,r),o=n.subarray(n.length-t),i=Buffer.from(o).toString();return I(i)};var u=(e,r)=>r===8?M(e):r===1?z.decode(e):v(e);var he=new b("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),Ie=new b("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");function _e(e,r,t=!1,n=he,o=Ie){if(!t&&!b.isOnCurve(r.toBuffer()))throw new Error("TokenOwnerOffCurveError");let[i]=b.findProgramAddressSync([r.toBuffer(),n.toBuffer(),e.toBuffer()],o);return i}var Aa=(e,r,t)=>{let n=e==="MainNet"?"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v":"4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU";if(j(r,t))return n},Ta=process.env.ALGO_NETWORK==="MainNet"?"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v":"4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU",j=(e,r)=>m[e]&&r===1,Ne=(e,r="hex")=>g(e,r,248),Ea=e=>y(Ne(e,"hex")),ya=(e,r="hex")=>{let t=g(e,r,248),n=Number(c(t.subarray(32,40),"8B")),o=Number(c(t.subarray(104,112),"8B"));return{loginAddress:String(c(t.subarray(0,32),"address",n)),loginChainId:n,tokenIndex:String(c(t.subarray(40,72),"token",o)),tokenChainId:o,recipient:String(c(t.subarray(72,104),"address",o)),recipientChainId:o,tokenAmount:String(c(t.subarray(112,144),"32B")),isNative:!!c(t.subarray(144,145),"bool"),fee:Number(c(t.subarray(145,177),"32B")),random:Number(c(t.subarray(177,185),"8B"))}},ha=(e,r)=>{let{loginAddress:t,loginChainId:n,recipient:o,recipientChainId:i,tokenAmount:x,tokenIndex:A,isNative:D,fee:q,random:J,solanaUsdc:Q}=e,R=u(o,i);if(j(String(A),i)){let re=new b(Q),k=_e(re,new b(o));console.log("associatedTokenAddress",k.toBase58()),R=u(k.toBase58(),i)}let Z=O(t,n,A,i),ee=p([Z.slice(0,72),R,s(i,"8B"),l(x),s(+D,"bool"),l(q),s(J,"8B")]);return B(r||JSON.stringify(e),ee)},Se={EVM:5,ALGORAND:8,SOLANA:1},Ia=e=>{let r=[s(e.address,"address",Se[e.type]),s(e.name,"str"),s(e.type,"str"),s(e.description||"","str")],t=Buffer.concat(r),n=G(e.address);return B(n,t)};export{Ie as ASSOCIATED_TOKEN_PROGRAM_ID,Ta as SOLANA_USDC,he as TOKEN_PROGRAM_ID,Ea as calcWithdrawHash,Ia as createWithdrawalWalletMsg,ya as decodeWithdrawMsg,_e as getAssociatedTokenAddressSync,Aa as getSolanaUsdc,Ne as getWithdrawBytesFromMsg,j as isSolanaCctp,ha as makeWithdrawMsg};
2
+ `,"utf-8")),Y=e=>new Uint8Array(Buffer.from(L(e)));var y=e=>Buffer.from(N(e)).toString("hex");var g=(e,r,t)=>{let n=Buffer.from(e,r),o=n.subarray(n.length-t),i=Buffer.from(o).toString();return I(i)};var u=(e,r)=>r===8?M(e):r===1?z.decode(e):v(e);var he=new b("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),Ie=new b("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");function _e(e,r,t=!1,n=he,o=Ie){if(!t&&!b.isOnCurve(r.toBuffer()))throw new Error("TokenOwnerOffCurveError");let[i]=b.findProgramAddressSync([r.toBuffer(),n.toBuffer(),e.toBuffer()],o);return i}var Ta=(e,r,t)=>{let n=e==="MainNet"?"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v":"4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU";if(j(r,t))return n},Ea=process.env.ALGO_NETWORK==="MainNet"?"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v":"4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU",j=(e,r)=>m[e]&&r===1,Ne=(e,r="hex")=>g(e,r,248),ya=e=>y(Ne(e,"hex")),ha=(e,r="hex")=>{let t=g(e,r,248),n=Number(c(t.subarray(32,40),"8B")),o=Number(c(t.subarray(104,112),"8B"));return{loginAddress:String(c(t.subarray(0,32),"address",n)),loginChainId:n,tokenIndex:String(c(t.subarray(40,72),"token",o)),tokenChainId:o,recipient:String(c(t.subarray(72,104),"address",o)),recipientChainId:o,tokenAmount:String(c(t.subarray(112,144),"32B")),isNative:!!c(t.subarray(144,145),"bool"),fee:Number(c(t.subarray(145,177),"32B")),random:Number(c(t.subarray(177,185),"8B"))}},Ia=(e,r)=>{let{loginAddress:t,loginChainId:n,recipient:o,recipientChainId:i,tokenAmount:x,tokenIndex:A,isNative:D,fee:q,random:J,solanaUsdc:Q}=e,R=u(o,i);if(j(String(A),i)){let re=new b(Q),k=_e(re,new b(o));console.log("associatedTokenAddress",k.toBase58()),R=u(k.toBase58(),i)}let Z=O(t,n,A,i),ee=p([Z.slice(0,72),R,s(i,"8B"),l(x),s(+D,"bool"),l(q),s(J,"8B")]);return B(r||JSON.stringify(e),ee)},Se={EVM:5,ALGORAND:8,SOLANA:1},_a=e=>{let r=[s(e.address,"address",Se[e.type]),s(e.name,"str"),s(e.type,"str"),s(e.description||"","str")],t=Buffer.concat(r),n=G(e.address);return B(n,t)};export{Ie as ASSOCIATED_TOKEN_PROGRAM_ID,Ea as SOLANA_USDC,he as TOKEN_PROGRAM_ID,ya as calcWithdrawHash,_a as createWithdrawalWalletMsg,ha as decodeWithdrawMsg,_e as getAssociatedTokenAddressSync,Ta as getSolanaUsdc,Ne as getWithdrawBytesFromMsg,j as isSolanaCctp,Ia as makeWithdrawMsg};
@@ -13,7 +13,7 @@ export declare const getBoxKeyFromHash: (hash: string, prefix: string) => Uint8A
13
13
  export declare const getAppArgs: (methodSignature: string, args: Array<Uint8Array | Buffer | number>) => Uint8Array[];
14
14
  export declare const getDataBytesFromMsg: (message: string, encoding: BufferEncoding, dataBytesLength: number) => Uint8Array<ArrayBufferLike>;
15
15
  export declare const getMsgArgs: (message: string, signature: string, signerAddress: string, signerChainId: number, encoding?: BufferEncoding) => Array<Buffer | Uint8Array>;
16
- export declare const decodeSignature: (signature: string, chain: number) => Buffer<ArrayBufferLike> | Uint8Array<ArrayBufferLike>;
16
+ export declare const decodeSignature: (signature: string, chain: number) => Uint8Array<ArrayBufferLike> | Buffer<ArrayBufferLike>;
17
17
  export declare const getPublicKey: (address: string, chain: number, message: string, signature: string, encoding?: BufferEncoding) => Uint8Array | Buffer;
18
18
  export declare const getPrefixedMessage: (message: string, encoding: BufferEncoding | undefined, chain: number) => Buffer;
19
19
  export declare const getProviderChainId: (technology: TechnologyType) => Chains;
@@ -18,3 +18,4 @@ export * from "./api";
18
18
  export * from "./emailService.interface";
19
19
  export * from "./kmsService.interface";
20
20
  export * from "./services";
21
+ export * from "./pagination.interface";
@@ -0,0 +1,57 @@
1
+ export interface ObjectLiteral {
2
+ [s: string]: any;
3
+ }
4
+ export interface IPaginationLinks {
5
+ /**
6
+ * a link to the "first" page
7
+ */
8
+ first?: string;
9
+ /**
10
+ * a link to the "previous" page
11
+ */
12
+ previous?: string;
13
+ /**
14
+ * a link to the "next" page
15
+ */
16
+ next?: string;
17
+ /**
18
+ * a link to the "last" page
19
+ */
20
+ last?: string;
21
+ }
22
+ export interface IPaginationMeta extends ObjectLiteral {
23
+ /**
24
+ * the amount of items on this specific page
25
+ */
26
+ itemCount: number;
27
+ /**
28
+ * the total amount of items
29
+ */
30
+ totalItems?: number;
31
+ /**
32
+ * the amount of items that were requested per page
33
+ */
34
+ itemsPerPage: number;
35
+ /**
36
+ * the total amount of pages in this paginator
37
+ */
38
+ totalPages?: number;
39
+ /**
40
+ * the current page this paginator "points" to
41
+ */
42
+ currentPage: number;
43
+ }
44
+ export interface PaginatedResult<PaginationObject, T extends ObjectLiteral = IPaginationMeta> {
45
+ /**
46
+ * a list of items to be returned
47
+ */
48
+ items: PaginationObject[];
49
+ /**
50
+ * associated meta information (e.g., counts)
51
+ */
52
+ meta: T;
53
+ /**
54
+ * associated links
55
+ */
56
+ links?: IPaginationLinks;
57
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ultrade/shared",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "description": "This package contains shared code for the projects.",
5
5
  "exports": {
6
6
  "./browser/common/*": {