@ultrade/shared 1.0.19 → 1.0.21

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.
Files changed (161) hide show
  1. package/dist/browser/constants/index.js +1 -1
  2. package/dist/browser/helpers/assert.helper.js +1 -1
  3. package/dist/browser/helpers/atomic.helper.js +1 -1
  4. package/dist/browser/helpers/balance.helper.js +1 -1
  5. package/dist/browser/helpers/codex/common.helper.js +2 -2
  6. package/dist/browser/helpers/codex/index.js +2 -2
  7. package/dist/browser/helpers/codex/mbr.helper.js +1 -1
  8. package/dist/browser/helpers/codex/mna.helper.js +1 -1
  9. package/dist/browser/helpers/codex/order.helper.js +1 -1
  10. package/dist/browser/helpers/codex/setGlobal.helper.js +1 -1
  11. package/dist/browser/helpers/codex/transfer.helper.js +2 -2
  12. package/dist/browser/helpers/codex/txn.helper.js +1 -1
  13. package/dist/browser/helpers/codex.helper.js +6 -6
  14. package/dist/browser/helpers/eth.helper.js +2 -2
  15. package/dist/browser/helpers/index.js +1 -1
  16. package/dist/browser/helpers/pointSystem.helper.js +1 -1
  17. package/dist/browser/helpers/withdraw.helper.js +2 -2
  18. package/dist/browser/types/index.js +1 -1
  19. package/dist/node/constants/index.js +1 -1
  20. package/dist/node/helpers/algo.helper.js +1 -1
  21. package/dist/node/helpers/assert.helper.js +1 -1
  22. package/dist/node/helpers/atomic.helper.js +1 -1
  23. package/dist/node/helpers/balance.helper.js +1 -1
  24. package/dist/node/helpers/codex/common.helper.js +2 -2
  25. package/dist/node/helpers/codex/index.js +2 -2
  26. package/dist/node/helpers/codex/mbr.helper.js +1 -1
  27. package/dist/node/helpers/codex/mna.helper.js +1 -1
  28. package/dist/node/helpers/codex/order.helper.js +1 -1
  29. package/dist/node/helpers/codex/setGlobal.helper.js +1 -1
  30. package/dist/node/helpers/codex/transfer.helper.js +2 -2
  31. package/dist/node/helpers/codex/txn.helper.js +1 -1
  32. package/dist/node/helpers/codex.helper.js +6 -6
  33. package/dist/node/helpers/eth.helper.js +2 -2
  34. package/dist/node/helpers/index.js +1 -1
  35. package/dist/node/helpers/pointSystem.helper.js +1 -1
  36. package/dist/node/helpers/withdraw.helper.js +2 -2
  37. package/dist/node/types/index.js +1 -1
  38. package/dist/src/constants/frontend.d.ts +33 -0
  39. package/dist/{constants → src/constants}/index.d.ts +1 -0
  40. package/dist/{types → src/types}/settings.type.d.ts +39 -3
  41. package/package.json +1 -1
  42. /package/dist/{common → src/common}/auth.helper.d.ts +0 -0
  43. /package/dist/{common → src/common}/big-number.helper.d.ts +0 -0
  44. /package/dist/{common → src/common}/index.d.ts +0 -0
  45. /package/dist/{common → src/common}/mappers/codexAsset.mapper.d.ts +0 -0
  46. /package/dist/{common → src/common}/mappers/codexBalance.mapper.d.ts +0 -0
  47. /package/dist/{common → src/common}/mappers/index.d.ts +0 -0
  48. /package/dist/{common → src/common}/mappers/trade.mapper.d.ts +0 -0
  49. /package/dist/{common → src/common}/utils/assert.d.ts +0 -0
  50. /package/dist/{common → src/common}/utils/decode.d.ts +0 -0
  51. /package/dist/{common → src/common}/utils/index.d.ts +0 -0
  52. /package/dist/{common → src/common}/utils/social.d.ts +0 -0
  53. /package/dist/{common → src/common}/utils/stat.d.ts +0 -0
  54. /package/dist/{constants → src/constants}/auth.d.ts +0 -0
  55. /package/dist/{constants → src/constants}/cctp.d.ts +0 -0
  56. /package/dist/{constants → src/constants}/codex.d.ts +0 -0
  57. /package/dist/{constants → src/constants}/response.d.ts +0 -0
  58. /package/dist/{constants → src/constants}/settings.d.ts +0 -0
  59. /package/dist/{constants → src/constants}/withdrawalWalletsMessage.d.ts +0 -0
  60. /package/dist/{enums → src/enums}/chains.enum.d.ts +0 -0
  61. /package/dist/{enums → src/enums}/db/account/index.d.ts +0 -0
  62. /package/dist/{enums → src/enums}/db/affiliate.enum.d.ts +0 -0
  63. /package/dist/{enums → src/enums}/db/available-pair-settings.enum.d.ts +0 -0
  64. /package/dist/{enums → src/enums}/db/common.enum.d.ts +0 -0
  65. /package/dist/{enums → src/enums}/db/component/index.d.ts +0 -0
  66. /package/dist/{enums → src/enums}/db/index.d.ts +0 -0
  67. /package/dist/{enums → src/enums}/db/market-maker.enum.d.ts +0 -0
  68. /package/dist/{enums → src/enums}/db/notification-center/userNotification.enum.d.ts +0 -0
  69. /package/dist/{enums → src/enums}/db/order-side.enum.d.ts +0 -0
  70. /package/dist/{enums → src/enums}/db/order-status.enum.d.ts +0 -0
  71. /package/dist/{enums → src/enums}/db/order-type.enum.d.ts +0 -0
  72. /package/dist/{enums → src/enums}/db/relayer.enum.d.ts +0 -0
  73. /package/dist/{enums → src/enums}/db/setting-type.enum.d.ts +0 -0
  74. /package/dist/{enums → src/enums}/db/social-action.enum.d.ts +0 -0
  75. /package/dist/{enums → src/enums}/db/social-prompt.enum.d.ts +0 -0
  76. /package/dist/{enums → src/enums}/db/social.enum.d.ts +0 -0
  77. /package/dist/{enums → src/enums}/db/state-type.enum.d.ts +0 -0
  78. /package/dist/{enums → src/enums}/db/trade.enums.d.ts +0 -0
  79. /package/dist/{enums → src/enums}/db/tradingKeyType.enum.d.ts +0 -0
  80. /package/dist/{enums → src/enums}/db/upgrade.enum.d.ts +0 -0
  81. /package/dist/{enums → src/enums}/db/withdrawal-wallet.enum.d.ts +0 -0
  82. /package/dist/{enums → src/enums}/index.d.ts +0 -0
  83. /package/dist/{enums → src/enums}/maintenanceMode.enum.d.ts +0 -0
  84. /package/dist/{enums → src/enums}/notification.enum.d.ts +0 -0
  85. /package/dist/{enums → src/enums}/rabbitMq.d.ts +0 -0
  86. /package/dist/{enums → src/enums}/settings.enum.d.ts +0 -0
  87. /package/dist/{enums → src/enums}/social.enum.d.ts +0 -0
  88. /package/dist/{helpers → src/helpers}/Encoding.d.ts +0 -0
  89. /package/dist/{helpers → src/helpers}/algo.helper.d.ts +0 -0
  90. /package/dist/{helpers → src/helpers}/assert.helper.d.ts +0 -0
  91. /package/dist/{helpers → src/helpers}/atomic.helper.d.ts +0 -0
  92. /package/dist/{helpers → src/helpers}/balance.helper.d.ts +0 -0
  93. /package/dist/{helpers → src/helpers}/codex/common.helper.d.ts +0 -0
  94. /package/dist/{helpers → src/helpers}/codex/index.d.ts +0 -0
  95. /package/dist/{helpers → src/helpers}/codex/mbr.helper.d.ts +0 -0
  96. /package/dist/{helpers → src/helpers}/codex/mna.helper.d.ts +0 -0
  97. /package/dist/{helpers → src/helpers}/codex/order.helper.d.ts +0 -0
  98. /package/dist/{helpers → src/helpers}/codex/setGlobal.helper.d.ts +0 -0
  99. /package/dist/{helpers → src/helpers}/codex/transfer.helper.d.ts +0 -0
  100. /package/dist/{helpers → src/helpers}/codex/txn.helper.d.ts +0 -0
  101. /package/dist/{helpers → src/helpers}/codex.helper.d.ts +0 -0
  102. /package/dist/{helpers → src/helpers}/eth.helper.d.ts +0 -0
  103. /package/dist/{helpers → src/helpers}/index.d.ts +0 -0
  104. /package/dist/{helpers → src/helpers}/interval.helpers.d.ts +0 -0
  105. /package/dist/{helpers → src/helpers}/liquidity.helper.d.ts +0 -0
  106. /package/dist/{helpers → src/helpers}/order.helper.d.ts +0 -0
  107. /package/dist/{helpers → src/helpers}/pair.helper.d.ts +0 -0
  108. /package/dist/{helpers → src/helpers}/pointSystem.helper.d.ts +0 -0
  109. /package/dist/{helpers → src/helpers}/ticker.helpers.d.ts +0 -0
  110. /package/dist/{helpers → src/helpers}/vaa.helper.d.ts +0 -0
  111. /package/dist/{helpers → src/helpers}/withdraw.helper.d.ts +0 -0
  112. /package/dist/{interfaces → src/interfaces}/accountInfo.interface.d.ts +0 -0
  113. /package/dist/{interfaces → src/interfaces}/api/affiliate.interface.d.ts +0 -0
  114. /package/dist/{interfaces → src/interfaces}/api/index.d.ts +0 -0
  115. /package/dist/{interfaces → src/interfaces}/cache.interface.d.ts +0 -0
  116. /package/dist/{interfaces → src/interfaces}/db/baseModel.interface.d.ts +0 -0
  117. /package/dist/{interfaces → src/interfaces}/db/hummingbot/index.d.ts +0 -0
  118. /package/dist/{interfaces → src/interfaces}/db/index.d.ts +0 -0
  119. /package/dist/{interfaces → src/interfaces}/db/market/index.d.ts +0 -0
  120. /package/dist/{interfaces → src/interfaces}/db/marketing/index.d.ts +0 -0
  121. /package/dist/{interfaces → src/interfaces}/db/notification_center/index.d.ts +0 -0
  122. /package/dist/{interfaces → src/interfaces}/db/relayer/index.d.ts +0 -0
  123. /package/dist/{interfaces → src/interfaces}/db/social/index.d.ts +0 -0
  124. /package/dist/{interfaces → src/interfaces}/db/softDeleteModel.interface.d.ts +0 -0
  125. /package/dist/{interfaces → src/interfaces}/db/white_label/index.d.ts +0 -0
  126. /package/dist/{interfaces → src/interfaces}/db/withdrawal_wallets/index.d.ts +0 -0
  127. /package/dist/{interfaces → src/interfaces}/dto/index.d.ts +0 -0
  128. /package/dist/{interfaces → src/interfaces}/emailService.interface.d.ts +0 -0
  129. /package/dist/{interfaces → src/interfaces}/index.d.ts +0 -0
  130. /package/dist/{interfaces → src/interfaces}/kmsService.interface.d.ts +0 -0
  131. /package/dist/{interfaces → src/interfaces}/last-look-trade.interface.d.ts +0 -0
  132. /package/dist/{interfaces → src/interfaces}/market.interface.d.ts +0 -0
  133. /package/dist/{interfaces → src/interfaces}/order.interface.d.ts +0 -0
  134. /package/dist/{interfaces → src/interfaces}/pagination.interface.d.ts +0 -0
  135. /package/dist/{interfaces → src/interfaces}/pair.interface.d.ts +0 -0
  136. /package/dist/{interfaces → src/interfaces}/query.interface.d.ts +0 -0
  137. /package/dist/{interfaces → src/interfaces}/services/accountCache.interface.d.ts +0 -0
  138. /package/dist/{interfaces → src/interfaces}/services/algod.interface.d.ts +0 -0
  139. /package/dist/{interfaces → src/interfaces}/services/balances.interface.d.ts +0 -0
  140. /package/dist/{interfaces → src/interfaces}/services/coin-market-cap.interface.d.ts +0 -0
  141. /package/dist/{interfaces → src/interfaces}/services/index.d.ts +0 -0
  142. /package/dist/{interfaces → src/interfaces}/services/price-model.interface.d.ts +0 -0
  143. /package/dist/{interfaces → src/interfaces}/services/price-service.interface.d.ts +0 -0
  144. /package/dist/{interfaces → src/interfaces}/services/socialActivity.interface.d.ts +0 -0
  145. /package/dist/{interfaces → src/interfaces}/services/tmc.interface.d.ts +0 -0
  146. /package/dist/{interfaces → src/interfaces}/settings.interface.d.ts +0 -0
  147. /package/dist/{interfaces → src/interfaces}/streaming.interface.d.ts +0 -0
  148. /package/dist/{interfaces → src/interfaces}/timestream.interface.d.ts +0 -0
  149. /package/dist/{interfaces → src/interfaces}/trading.interface.d.ts +0 -0
  150. /package/dist/{interfaces → src/interfaces}/tradingKey.interface.d.ts +0 -0
  151. /package/dist/{interfaces → src/interfaces}/transfer.interface.d.ts +0 -0
  152. /package/dist/{interfaces → src/interfaces}/wallet.interface.d.ts +0 -0
  153. /package/dist/{interfaces → src/interfaces}/withdrawalWallets.interface.d.ts +0 -0
  154. /package/dist/{types → src/types}/algo-order.type.d.ts +0 -0
  155. /package/dist/{types → src/types}/amm/amm.d.ts +0 -0
  156. /package/dist/{types → src/types}/api/request.types.d.ts +0 -0
  157. /package/dist/{types → src/types}/codex.types.d.ts +0 -0
  158. /package/dist/{types → src/types}/hummingbots.types.d.ts +0 -0
  159. /package/dist/{types → src/types}/index.d.ts +0 -0
  160. /package/dist/{types → src/types}/notification.type.d.ts +0 -0
  161. /package/dist/{types → src/types}/state.type.d.ts +0 -0
@@ -1,4 +1,4 @@
1
- function yr(){throw new Error("setTimeout has not been defined")}function _r(){throw new Error("clearTimeout has not been defined")}var O=yr,k=_r;typeof globalThis.setTimeout=="function"&&(O=setTimeout);typeof globalThis.clearTimeout=="function"&&(k=clearTimeout);function Ir(t){if(O===setTimeout)return setTimeout(t,0);if((O===yr||!O)&&setTimeout)return O=setTimeout,setTimeout(t,0);try{return O(t,0)}catch{try{return O.call(null,t,0)}catch{return O.call(this,t,0)}}}function Ie(t){if(k===clearTimeout)return clearTimeout(t);if((k===_r||!k)&&clearTimeout)return k=clearTimeout,clearTimeout(t);try{return k(t)}catch{try{return k.call(null,t)}catch{return k.call(this,t)}}}var B=[],F=!1,P,H=-1;function we(){!F||!P||(F=!1,P.length?B=P.concat(B):H=-1,B.length&&wr())}function wr(){if(!F){var t=Ir(we);F=!0;for(var r=B.length;r;){for(P=B,B=[];++H<r;)P&&P[H].run();H=-1,r=B.length}P=null,F=!1,Ie(t)}}function Ne(t){var r=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)r[e-1]=arguments[e];B.push(new Nr(t,r)),B.length===1&&!F&&Ir(wr)}function Nr(t,r){this.fun=t,this.array=r}Nr.prototype.run=function(){this.fun.apply(null,this.array)};var Re="browser",Se="browser",Be=!0,De={},Ce=[],Oe="",ke={},Pe={},Ue={};function U(){}var Le=U,Me=U,ve=U,Fe=U,Ye=U,Ge=U,We=U;function Ke(t){throw new Error("process.binding is not supported")}function He(){return"/"}function Ve(t){throw new Error("process.chdir is not supported")}function $e(){return 0}var v=globalThis.performance||{},ze=v.now||v.mozNow||v.msNow||v.oNow||v.webkitNow||function(){return new Date().getTime()};function Xe(t){var r=ze.call(v)*.001,e=Math.floor(r),n=Math.floor(r%1*1e9);return t&&(e=e-t[0],n=n-t[1],n<0&&(e--,n+=1e9)),[e,n]}var qe=new Date;function Je(){var t=new Date,r=t-qe;return r/1e3}var m={nextTick:Ne,title:Re,browser:Be,env:De,argv:Ce,version:Oe,versions:ke,on:Le,addListener:Me,once:ve,off:Fe,removeListener:Ye,removeAllListeners:Ge,emit:We,binding:Ke,cwd:He,chdir:Ve,umask:$e,hrtime:Xe,platform:Se,release:Pe,config:Ue,uptime:Je},Tr={};Object.keys(Tr).forEach(t=>{let r=t.split("."),e=m;for(let n=0;n<r.length;n++){let o=r[n];n===r.length-1?e[o]=Tr[t]:e=e[o]||(e[o]={})}});var w=[],_=[],je=typeof Uint8Array<"u"?Uint8Array:Array,cr=!1;function Dr(){cr=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,e=t.length;r<e;++r)w[r]=t[r],_[t.charCodeAt(r)]=r;_[45]=62,_[95]=63}function Qe(t){cr||Dr();var r,e,n,o,a,i,c=t.length;if(c%4>0)throw new Error("Invalid string. Length must be a multiple of 4");a=t[c-2]==="="?2:t[c-1]==="="?1:0,i=new je(c*3/4-a),n=a>0?c-4:c;var p=0;for(r=0,e=0;r<n;r+=4,e+=3)o=_[t.charCodeAt(r)]<<18|_[t.charCodeAt(r+1)]<<12|_[t.charCodeAt(r+2)]<<6|_[t.charCodeAt(r+3)],i[p++]=o>>16&255,i[p++]=o>>8&255,i[p++]=o&255;return a===2?(o=_[t.charCodeAt(r)]<<2|_[t.charCodeAt(r+1)]>>4,i[p++]=o&255):a===1&&(o=_[t.charCodeAt(r)]<<10|_[t.charCodeAt(r+1)]<<4|_[t.charCodeAt(r+2)]>>2,i[p++]=o>>8&255,i[p++]=o&255),i}function Ze(t){return w[t>>18&63]+w[t>>12&63]+w[t>>6&63]+w[t&63]}function rt(t,r,e){for(var n,o=[],a=r;a<e;a+=3)n=(t[a]<<16)+(t[a+1]<<8)+t[a+2],o.push(Ze(n));return o.join("")}function Rr(t){cr||Dr();for(var r,e=t.length,n=e%3,o="",a=[],i=16383,c=0,p=e-n;c<p;c+=i)a.push(rt(t,c,c+i>p?p:c+i));return n===1?(r=t[e-1],o+=w[r>>2],o+=w[r<<4&63],o+="=="):n===2&&(r=(t[e-2]<<8)+t[e-1],o+=w[r>>10],o+=w[r>>4&63],o+=w[r<<2&63],o+="="),a.push(o),a.join("")}s.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;function V(){return s.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function D(t,r){if(V()<r)throw new RangeError("Invalid typed array length");return s.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(r),t.__proto__=s.prototype):(t===null&&(t=new s(r)),t.length=r),t}function s(t,r,e){if(!s.TYPED_ARRAY_SUPPORT&&!(this instanceof s))return new s(t,r,e);if(typeof t=="number"){if(typeof r=="string")throw new Error("If encoding is specified then the first argument must be a string");return ur(this,t)}return Cr(this,t,r,e)}s.poolSize=8192;s._augment=function(t){return t.__proto__=s.prototype,t};function Cr(t,r,e,n){if(typeof r=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&r instanceof ArrayBuffer?nt(t,r,e,n):typeof r=="string"?tt(t,r,e):ot(t,r)}s.from=function(t,r,e){return Cr(null,t,r,e)};s.kMaxLength=V();s.TYPED_ARRAY_SUPPORT&&(s.prototype.__proto__=Uint8Array.prototype,s.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&s[Symbol.species]);function Or(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 et(t,r,e,n){return Or(r),r<=0?D(t,r):e!==void 0?typeof n=="string"?D(t,r).fill(e,n):D(t,r).fill(e):D(t,r)}s.alloc=function(t,r,e){return et(null,t,r,e)};function ur(t,r){if(Or(r),t=D(t,r<0?0:pr(r)|0),!s.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}s.allocUnsafe=function(t){return ur(null,t)};s.allocUnsafeSlow=function(t){return ur(null,t)};function tt(t,r,e){if((typeof e!="string"||e==="")&&(e="utf8"),!s.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var n=kr(r,e)|0;t=D(t,n);var o=t.write(r,e);return o!==n&&(t=t.slice(0,o)),t}function sr(t,r){var e=r.length<0?0:pr(r.length)|0;t=D(t,e);for(var n=0;n<e;n+=1)t[n]=r[n]&255;return t}function nt(t,r,e,n){if(r.byteLength,e<0||r.byteLength<e)throw new RangeError("'offset' is out of bounds");if(r.byteLength<e+(n||0))throw new RangeError("'length' is out of bounds");return e===void 0&&n===void 0?r=new Uint8Array(r):n===void 0?r=new Uint8Array(r,e):r=new Uint8Array(r,e,n),s.TYPED_ARRAY_SUPPORT?(t=r,t.__proto__=s.prototype):t=sr(t,r),t}function ot(t,r){if(N(r)){var e=pr(r.length)|0;return t=D(t,e),t.length===0||r.copy(t,0,0,e),t}if(r){if(typeof ArrayBuffer<"u"&&r.buffer instanceof ArrayBuffer||"length"in r)return typeof r.length!="number"||_t(r.length)?D(t,0):sr(t,r);if(r.type==="Buffer"&&Array.isArray(r.data))return sr(t,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function pr(t){if(t>=V())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+V().toString(16)+" bytes");return t|0}s.isBuffer=It;function N(t){return!!(t!=null&&t._isBuffer)}s.compare=function(r,e){if(!N(r)||!N(e))throw new TypeError("Arguments must be Buffers");if(r===e)return 0;for(var n=r.length,o=e.length,a=0,i=Math.min(n,o);a<i;++a)if(r[a]!==e[a]){n=r[a],o=e[a];break}return n<o?-1:o<n?1:0};s.isEncoding=function(r){switch(String(r).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(r,e){if(!Array.isArray(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return s.alloc(0);var n;if(e===void 0)for(e=0,n=0;n<r.length;++n)e+=r[n].length;var o=s.allocUnsafe(e),a=0;for(n=0;n<r.length;++n){var i=r[n];if(!N(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(o,a),a+=i.length}return o};function kr(t,r){if(N(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 e=t.length;if(e===0)return 0;for(var n=!1;;)switch(r){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return $(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return Yr(t).length;default:if(n)return $(t).length;r=(""+r).toLowerCase(),n=!0}}s.byteLength=kr;function it(t,r,e){var n=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((e===void 0||e>this.length)&&(e=this.length),e<=0)||(e>>>=0,r>>>=0,e<=r))return"";for(t||(t="utf8");;)switch(t){case"hex":return gt(this,r,e);case"utf8":case"utf-8":return Lr(this,r,e);case"ascii":return dt(this,r,e);case"latin1":case"binary":return ft(this,r,e);case"base64":return lt(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ht(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}s.prototype._isBuffer=!0;function L(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}s.prototype.swap16=function(){var r=this.length;if(r%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<r;e+=2)L(this,e,e+1);return this};s.prototype.swap32=function(){var r=this.length;if(r%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<r;e+=4)L(this,e,e+3),L(this,e+1,e+2);return this};s.prototype.swap64=function(){var r=this.length;if(r%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<r;e+=8)L(this,e,e+7),L(this,e+1,e+6),L(this,e+2,e+5),L(this,e+3,e+4);return this};s.prototype.toString=function(){var r=this.length|0;return r===0?"":arguments.length===0?Lr(this,0,r):it.apply(this,arguments)};s.prototype.equals=function(r){if(!N(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:s.compare(this,r)===0};s.prototype.compare=function(r,e,n,o,a){if(!N(r))throw new TypeError("Argument must be a Buffer");if(e===void 0&&(e=0),n===void 0&&(n=r?r.length:0),o===void 0&&(o=0),a===void 0&&(a=this.length),e<0||n>r.length||o<0||a>this.length)throw new RangeError("out of range index");if(o>=a&&e>=n)return 0;if(o>=a)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,o>>>=0,a>>>=0,this===r)return 0;for(var i=a-o,c=n-e,p=Math.min(i,c),f=this.slice(o,a),d=r.slice(e,n),l=0;l<p;++l)if(f[l]!==d[l]){i=f[l],c=d[l];break}return i<c?-1:c<i?1:0};function Pr(t,r,e,n,o){if(t.length===0)return-1;if(typeof e=="string"?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=o?0:t.length-1),e<0&&(e=t.length+e),e>=t.length){if(o)return-1;e=t.length-1}else if(e<0)if(o)e=0;else return-1;if(typeof r=="string"&&(r=s.from(r,n)),N(r))return r.length===0?-1:Sr(t,r,e,n,o);if(typeof r=="number")return r=r&255,s.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?o?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):Sr(t,[r],e,n,o);throw new TypeError("val must be string, number or Buffer")}function Sr(t,r,e,n,o){var a=1,i=t.length,c=r.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||r.length<2)return-1;a=2,i/=2,c/=2,e/=2}function p(g,y){return a===1?g[y]:g.readUInt16BE(y*a)}var f;if(o){var d=-1;for(f=e;f<i;f++)if(p(t,f)===p(r,d===-1?0:f-d)){if(d===-1&&(d=f),f-d+1===c)return d*a}else d!==-1&&(f-=f-d),d=-1}else for(e+c>i&&(e=i-c),f=e;f>=0;f--){for(var l=!0,h=0;h<c;h++)if(p(t,f+h)!==p(r,h)){l=!1;break}if(l)return f}return-1}s.prototype.includes=function(r,e,n){return this.indexOf(r,e,n)!==-1};s.prototype.indexOf=function(r,e,n){return Pr(this,r,e,n,!0)};s.prototype.lastIndexOf=function(r,e,n){return Pr(this,r,e,n,!1)};function at(t,r,e,n){e=Number(e)||0;var o=t.length-e;n?(n=Number(n),n>o&&(n=o)):n=o;var a=r.length;if(a%2!==0)throw new TypeError("Invalid hex string");n>a/2&&(n=a/2);for(var i=0;i<n;++i){var c=parseInt(r.substr(i*2,2),16);if(isNaN(c))return i;t[e+i]=c}return i}function st(t,r,e,n){return q($(r,t.length-e),t,e,n)}function Ur(t,r,e,n){return q(Tt(r),t,e,n)}function ct(t,r,e,n){return Ur(t,r,e,n)}function ut(t,r,e,n){return q(Yr(r),t,e,n)}function pt(t,r,e,n){return q(yt(r,t.length-e),t,e,n)}s.prototype.write=function(r,e,n,o){if(e===void 0)o="utf8",n=this.length,e=0;else if(n===void 0&&typeof e=="string")o=e,n=this.length,e=0;else if(isFinite(e))e=e|0,isFinite(n)?(n=n|0,o===void 0&&(o="utf8")):(o=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var a=this.length-e;if((n===void 0||n>a)&&(n=a),r.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");o||(o="utf8");for(var i=!1;;)switch(o){case"hex":return at(this,r,e,n);case"utf8":case"utf-8":return st(this,r,e,n);case"ascii":return Ur(this,r,e,n);case"latin1":case"binary":return ct(this,r,e,n);case"base64":return ut(this,r,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return pt(this,r,e,n);default:if(i)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),i=!0}};s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function lt(t,r,e){return r===0&&e===t.length?Rr(t):Rr(t.slice(r,e))}function Lr(t,r,e){e=Math.min(t.length,e);for(var n=[],o=r;o<e;){var a=t[o],i=null,c=a>239?4:a>223?3:a>191?2:1;if(o+c<=e){var p,f,d,l;switch(c){case 1:a<128&&(i=a);break;case 2:p=t[o+1],(p&192)===128&&(l=(a&31)<<6|p&63,l>127&&(i=l));break;case 3:p=t[o+1],f=t[o+2],(p&192)===128&&(f&192)===128&&(l=(a&15)<<12|(p&63)<<6|f&63,l>2047&&(l<55296||l>57343)&&(i=l));break;case 4:p=t[o+1],f=t[o+2],d=t[o+3],(p&192)===128&&(f&192)===128&&(d&192)===128&&(l=(a&15)<<18|(p&63)<<12|(f&63)<<6|d&63,l>65535&&l<1114112&&(i=l))}}i===null?(i=65533,c=1):i>65535&&(i-=65536,n.push(i>>>10&1023|55296),i=56320|i&1023),n.push(i),o+=c}return mt(n)}var Br=4096;function mt(t){var r=t.length;if(r<=Br)return String.fromCharCode.apply(String,t);for(var e="",n=0;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=Br));return e}function dt(t,r,e){var n="";e=Math.min(t.length,e);for(var o=r;o<e;++o)n+=String.fromCharCode(t[o]&127);return n}function ft(t,r,e){var n="";e=Math.min(t.length,e);for(var o=r;o<e;++o)n+=String.fromCharCode(t[o]);return n}function gt(t,r,e){var n=t.length;(!r||r<0)&&(r=0),(!e||e<0||e>n)&&(e=n);for(var o="",a=r;a<e;++a)o+=At(t[a]);return o}function ht(t,r,e){for(var n=t.slice(r,e),o="",a=0;a<n.length;a+=2)o+=String.fromCharCode(n[a]+n[a+1]*256);return o}s.prototype.slice=function(r,e){var n=this.length;r=~~r,e=e===void 0?n:~~e,r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),e<r&&(e=r);var o;if(s.TYPED_ARRAY_SUPPORT)o=this.subarray(r,e),o.__proto__=s.prototype;else{var a=e-r;o=new s(a,void 0);for(var i=0;i<a;++i)o[i]=this[i+r]}return o};function x(t,r,e){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+r>e)throw new RangeError("Trying to access beyond buffer length")}s.prototype.readUIntLE=function(r,e,n){r=r|0,e=e|0,n||x(r,e,this.length);for(var o=this[r],a=1,i=0;++i<e&&(a*=256);)o+=this[r+i]*a;return o};s.prototype.readUIntBE=function(r,e,n){r=r|0,e=e|0,n||x(r,e,this.length);for(var o=this[r+--e],a=1;e>0&&(a*=256);)o+=this[r+--e]*a;return o};s.prototype.readUInt8=function(r,e){return e||x(r,1,this.length),this[r]};s.prototype.readUInt16LE=function(r,e){return e||x(r,2,this.length),this[r]|this[r+1]<<8};s.prototype.readUInt16BE=function(r,e){return e||x(r,2,this.length),this[r]<<8|this[r+1]};s.prototype.readUInt32LE=function(r,e){return e||x(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216};s.prototype.readUInt32BE=function(r,e){return e||x(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])};s.prototype.readIntLE=function(r,e,n){r=r|0,e=e|0,n||x(r,e,this.length);for(var o=this[r],a=1,i=0;++i<e&&(a*=256);)o+=this[r+i]*a;return a*=128,o>=a&&(o-=Math.pow(2,8*e)),o};s.prototype.readIntBE=function(r,e,n){r=r|0,e=e|0,n||x(r,e,this.length);for(var o=e,a=1,i=this[r+--o];o>0&&(a*=256);)i+=this[r+--o]*a;return a*=128,i>=a&&(i-=Math.pow(2,8*e)),i};s.prototype.readInt8=function(r,e){return e||x(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};s.prototype.readInt16LE=function(r,e){e||x(r,2,this.length);var n=this[r]|this[r+1]<<8;return n&32768?n|4294901760:n};s.prototype.readInt16BE=function(r,e){e||x(r,2,this.length);var n=this[r+1]|this[r]<<8;return n&32768?n|4294901760:n};s.prototype.readInt32LE=function(r,e){return e||x(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24};s.prototype.readInt32BE=function(r,e){return e||x(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]};s.prototype.readFloatLE=function(r,e){return e||x(r,4,this.length),J(this,r,!0,23,4)};s.prototype.readFloatBE=function(r,e){return e||x(r,4,this.length),J(this,r,!1,23,4)};s.prototype.readDoubleLE=function(r,e){return e||x(r,8,this.length),J(this,r,!0,52,8)};s.prototype.readDoubleBE=function(r,e){return e||x(r,8,this.length),J(this,r,!1,52,8)};function A(t,r,e,n,o,a){if(!N(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>o||r<a)throw new RangeError('"value" argument is out of bounds');if(e+n>t.length)throw new RangeError("Index out of range")}s.prototype.writeUIntLE=function(r,e,n,o){if(r=+r,e=e|0,n=n|0,!o){var a=Math.pow(2,8*n)-1;A(this,r,e,n,a,0)}var i=1,c=0;for(this[e]=r&255;++c<n&&(i*=256);)this[e+c]=r/i&255;return e+n};s.prototype.writeUIntBE=function(r,e,n,o){if(r=+r,e=e|0,n=n|0,!o){var a=Math.pow(2,8*n)-1;A(this,r,e,n,a,0)}var i=n-1,c=1;for(this[e+i]=r&255;--i>=0&&(c*=256);)this[e+i]=r/c&255;return e+n};s.prototype.writeUInt8=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,1,255,0),s.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),this[e]=r&255,e+1};function z(t,r,e,n){r<0&&(r=65535+r+1);for(var o=0,a=Math.min(t.length-e,2);o<a;++o)t[e+o]=(r&255<<8*(n?o:1-o))>>>(n?o:1-o)*8}s.prototype.writeUInt16LE=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):z(this,r,e,!0),e+2};s.prototype.writeUInt16BE=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):z(this,r,e,!1),e+2};function X(t,r,e,n){r<0&&(r=4294967295+r+1);for(var o=0,a=Math.min(t.length-e,4);o<a;++o)t[e+o]=r>>>(n?o:3-o)*8&255}s.prototype.writeUInt32LE=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[e+3]=r>>>24,this[e+2]=r>>>16,this[e+1]=r>>>8,this[e]=r&255):X(this,r,e,!0),e+4};s.prototype.writeUInt32BE=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[e]=r>>>24,this[e+1]=r>>>16,this[e+2]=r>>>8,this[e+3]=r&255):X(this,r,e,!1),e+4};s.prototype.writeIntLE=function(r,e,n,o){if(r=+r,e=e|0,!o){var a=Math.pow(2,8*n-1);A(this,r,e,n,a-1,-a)}var i=0,c=1,p=0;for(this[e]=r&255;++i<n&&(c*=256);)r<0&&p===0&&this[e+i-1]!==0&&(p=1),this[e+i]=(r/c>>0)-p&255;return e+n};s.prototype.writeIntBE=function(r,e,n,o){if(r=+r,e=e|0,!o){var a=Math.pow(2,8*n-1);A(this,r,e,n,a-1,-a)}var i=n-1,c=1,p=0;for(this[e+i]=r&255;--i>=0&&(c*=256);)r<0&&p===0&&this[e+i+1]!==0&&(p=1),this[e+i]=(r/c>>0)-p&255;return e+n};s.prototype.writeInt8=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,1,127,-128),s.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),r<0&&(r=255+r+1),this[e]=r&255,e+1};s.prototype.writeInt16LE=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):z(this,r,e,!0),e+2};s.prototype.writeInt16BE=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):z(this,r,e,!1),e+2};s.prototype.writeInt32LE=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,4,2147483647,-2147483648),s.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8,this[e+2]=r>>>16,this[e+3]=r>>>24):X(this,r,e,!0),e+4};s.prototype.writeInt32BE=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),s.TYPED_ARRAY_SUPPORT?(this[e]=r>>>24,this[e+1]=r>>>16,this[e+2]=r>>>8,this[e+3]=r&255):X(this,r,e,!1),e+4};function Mr(t,r,e,n,o,a){if(e+n>t.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function vr(t,r,e,n,o){return o||Mr(t,r,e,4,34028234663852886e22,-34028234663852886e22),Wr(t,r,e,n,23,4),e+4}s.prototype.writeFloatLE=function(r,e,n){return vr(this,r,e,!0,n)};s.prototype.writeFloatBE=function(r,e,n){return vr(this,r,e,!1,n)};function Fr(t,r,e,n,o){return o||Mr(t,r,e,8,17976931348623157e292,-17976931348623157e292),Wr(t,r,e,n,52,8),e+8}s.prototype.writeDoubleLE=function(r,e,n){return Fr(this,r,e,!0,n)};s.prototype.writeDoubleBE=function(r,e,n){return Fr(this,r,e,!1,n)};s.prototype.copy=function(r,e,n,o){if(n||(n=0),!o&&o!==0&&(o=this.length),e>=r.length&&(e=r.length),e||(e=0),o>0&&o<n&&(o=n),o===n||r.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),r.length-e<o-n&&(o=r.length-e+n);var a=o-n,i;if(this===r&&n<e&&e<o)for(i=a-1;i>=0;--i)r[i+e]=this[i+n];else if(a<1e3||!s.TYPED_ARRAY_SUPPORT)for(i=0;i<a;++i)r[i+e]=this[i+n];else Uint8Array.prototype.set.call(r,this.subarray(n,n+a),e);return a};s.prototype.fill=function(r,e,n,o){if(typeof r=="string"){if(typeof e=="string"?(o=e,e=0,n=this.length):typeof n=="string"&&(o=n,n=this.length),r.length===1){var a=r.charCodeAt(0);a<256&&(r=a)}if(o!==void 0&&typeof o!="string")throw new TypeError("encoding must be a string");if(typeof o=="string"&&!s.isEncoding(o))throw new TypeError("Unknown encoding: "+o)}else typeof r=="number"&&(r=r&255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;e=e>>>0,n=n===void 0?this.length:n>>>0,r||(r=0);var i;if(typeof r=="number")for(i=e;i<n;++i)this[i]=r;else{var c=N(r)?r:$(new s(r,o).toString()),p=c.length;for(i=0;i<n-e;++i)this[i+e]=c[i%p]}return this};var xt=/[^+\/0-9A-Za-z-_]/g;function bt(t){if(t=Et(t).replace(xt,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function Et(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function At(t){return t<16?"0"+t.toString(16):t.toString(16)}function $(t,r){r=r||1/0;for(var e,n=t.length,o=null,a=[],i=0;i<n;++i){if(e=t.charCodeAt(i),e>55295&&e<57344){if(!o){if(e>56319){(r-=3)>-1&&a.push(239,191,189);continue}else if(i+1===n){(r-=3)>-1&&a.push(239,191,189);continue}o=e;continue}if(e<56320){(r-=3)>-1&&a.push(239,191,189),o=e;continue}e=(o-55296<<10|e-56320)+65536}else o&&(r-=3)>-1&&a.push(239,191,189);if(o=null,e<128){if((r-=1)<0)break;a.push(e)}else if(e<2048){if((r-=2)<0)break;a.push(e>>6|192,e&63|128)}else if(e<65536){if((r-=3)<0)break;a.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((r-=4)<0)break;a.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return a}function Tt(t){for(var r=[],e=0;e<t.length;++e)r.push(t.charCodeAt(e)&255);return r}function yt(t,r){for(var e,n,o,a=[],i=0;i<t.length&&!((r-=2)<0);++i)e=t.charCodeAt(i),n=e>>8,o=e%256,a.push(o),a.push(n);return a}function Yr(t){return Qe(bt(t))}function q(t,r,e,n){for(var o=0;o<n&&!(o+e>=r.length||o>=t.length);++o)r[o+e]=t[o];return o}function _t(t){return t!==t}function It(t){return t!=null&&(!!t._isBuffer||Gr(t)||wt(t))}function Gr(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function wt(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&Gr(t.slice(0,0))}function J(t,r,e,n,o){var a,i,c=o*8-n-1,p=(1<<c)-1,f=p>>1,d=-7,l=e?o-1:0,h=e?-1:1,g=t[r+l];for(l+=h,a=g&(1<<-d)-1,g>>=-d,d+=c;d>0;a=a*256+t[r+l],l+=h,d-=8);for(i=a&(1<<-d)-1,a>>=-d,d+=n;d>0;i=i*256+t[r+l],l+=h,d-=8);if(a===0)a=1-f;else{if(a===p)return i?NaN:(g?-1:1)*(1/0);i=i+Math.pow(2,n),a=a-f}return(g?-1:1)*i*Math.pow(2,a-n)}function Wr(t,r,e,n,o,a){var i,c,p,f=a*8-o-1,d=(1<<f)-1,l=d>>1,h=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,g=n?0:a-1,y=n?1:-1,ar=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(c=isNaN(r)?1:0,i=d):(i=Math.floor(Math.log(r)/Math.LN2),r*(p=Math.pow(2,-i))<1&&(i--,p*=2),i+l>=1?r+=h/p:r+=h*Math.pow(2,1-l),r*p>=2&&(i++,p/=2),i+l>=d?(c=0,i=d):i+l>=1?(c=(r*p-1)*Math.pow(2,o),i=i+l):(c=r*Math.pow(2,l-1)*Math.pow(2,o),i=0));o>=8;t[e+g]=c&255,g+=y,c/=256,o-=8);for(i=i<<o|c,f+=o;f>0;t[e+g]=i&255,g+=y,i/=256,f-=8);t[e+g-y]|=ar*128}import lr from"bignumber.js";lr.config({DECIMAL_PLACES:40,EXPONENTIAL_AT:45});function mr(t,r){return Kr(t,r,"*")}function G(t,r){return Kr(t,r,"/")}function Kr(t,r,e){switch(t=new lr(String(t)),r=new lr(String(r)),e.toLowerCase()){case"-":return t.minus(r).toString();case"+":return t.plus(r).toString();case"*":case"x":return t.multipliedBy(r).toString();case"\xF7":case"/":return t.dividedBy(r).toString();case">=":return t.isGreaterThanOrEqualTo(r);case">":return t.isGreaterThan(r);case"<=":return t.isLessThanOrEqualTo(r);case"<":return t.isLessThan(r);case"==":return t.isEqualTo(r);case"mod":return t.modulo(r);default:break}}var Hr=(e=>(e[e.Buy=0]="Buy",e[e.Sell=1]="Sell",e))(Hr||{}),W=Hr;var Vr=(o=>(o[o.Limit=0]="Limit",o[o.IOC=1]="IOC",o[o.POST=2]="POST",o[o.Market=3]="Market",o))(Vr||{}),j=Vr;var $r=(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))($r||{}),zr=(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))(zr||{}),Uo={...$r,...zr};var dr={"0x4343545055534443000000000000000000000000000000000000000000000000":65537};var Xi={SMALLESTUNIT:m.env.SMALLEST_UNIT},qi={SMALLEST_UNITS:m.env.SMALLEST_UNIT};var Zi=`{"theme1":{"value":"${m.env.FRONTEND_URL}/Theme%3DDark.svg","active":true},"theme2":{"value":"${m.env.FRONTEND_URL}/Theme%3DLight.svg","active":true},"theme3":{"value":"${m.env.FRONTEND_URL}/Theme%3DLight.svg","active":true}}`;var oa=["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 fr=(t,r)=>G(t,10**(18-r)),Xr=(t,r)=>G(t,10**r);import ye from"algosdk";import*as En from"bs58";import js from"algosdk";import*as be from"bs58";import cn from"algosdk";import ka,{decodeAddress as Pa,encodeAddress as Ua}from"algosdk";var R=[],I=[],St=typeof Uint8Array<"u"?Uint8Array:Array,hr=!1;function Qr(){hr=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,e=t.length;r<e;++r)R[r]=t[r],I[t.charCodeAt(r)]=r;I[45]=62,I[95]=63}function Bt(t){hr||Qr();var r,e,n,o,a,i,c=t.length;if(c%4>0)throw new Error("Invalid string. Length must be a multiple of 4");a=t[c-2]==="="?2:t[c-1]==="="?1:0,i=new St(c*3/4-a),n=a>0?c-4:c;var p=0;for(r=0,e=0;r<n;r+=4,e+=3)o=I[t.charCodeAt(r)]<<18|I[t.charCodeAt(r+1)]<<12|I[t.charCodeAt(r+2)]<<6|I[t.charCodeAt(r+3)],i[p++]=o>>16&255,i[p++]=o>>8&255,i[p++]=o&255;return a===2?(o=I[t.charCodeAt(r)]<<2|I[t.charCodeAt(r+1)]>>4,i[p++]=o&255):a===1&&(o=I[t.charCodeAt(r)]<<10|I[t.charCodeAt(r+1)]<<4|I[t.charCodeAt(r+2)]>>2,i[p++]=o>>8&255,i[p++]=o&255),i}function Dt(t){return R[t>>18&63]+R[t>>12&63]+R[t>>6&63]+R[t&63]}function Ct(t,r,e){for(var n,o=[],a=r;a<e;a+=3)n=(t[a]<<16)+(t[a+1]<<8)+t[a+2],o.push(Dt(n));return o.join("")}function qr(t){hr||Qr();for(var r,e=t.length,n=e%3,o="",a=[],i=16383,c=0,p=e-n;c<p;c+=i)a.push(Ct(t,c,c+i>p?p:c+i));return n===1?(r=t[e-1],o+=R[r>>2],o+=R[r<<4&63],o+="=="):n===2&&(r=(t[e-2]<<8)+t[e-1],o+=R[r>>10],o+=R[r>>4&63],o+=R[r<<2&63],o+="="),a.push(o),a.join("")}function rr(t,r,e,n,o){var a,i,c=o*8-n-1,p=(1<<c)-1,f=p>>1,d=-7,l=e?o-1:0,h=e?-1:1,g=t[r+l];for(l+=h,a=g&(1<<-d)-1,g>>=-d,d+=c;d>0;a=a*256+t[r+l],l+=h,d-=8);for(i=a&(1<<-d)-1,a>>=-d,d+=n;d>0;i=i*256+t[r+l],l+=h,d-=8);if(a===0)a=1-f;else{if(a===p)return i?NaN:(g?-1:1)*(1/0);i=i+Math.pow(2,n),a=a-f}return(g?-1:1)*i*Math.pow(2,a-n)}function Zr(t,r,e,n,o,a){var i,c,p,f=a*8-o-1,d=(1<<f)-1,l=d>>1,h=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,g=n?0:a-1,y=n?1:-1,ar=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(c=isNaN(r)?1:0,i=d):(i=Math.floor(Math.log(r)/Math.LN2),r*(p=Math.pow(2,-i))<1&&(i--,p*=2),i+l>=1?r+=h/p:r+=h*Math.pow(2,1-l),r*p>=2&&(i++,p/=2),i+l>=d?(c=0,i=d):i+l>=1?(c=(r*p-1)*Math.pow(2,o),i=i+l):(c=r*Math.pow(2,l-1)*Math.pow(2,o),i=0));o>=8;t[e+g]=c&255,g+=y,c/=256,o-=8);for(i=i<<o|c,f+=o;f>0;t[e+g]=i&255,g+=y,i/=256,f-=8);t[e+g-y]|=ar*128}var Ot={}.toString,re=Array.isArray||function(t){return Ot.call(t)=="[object Array]"};var kt=50;u.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;var Sa=Q();function Q(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function C(t,r){if(Q()<r)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(r),t.__proto__=u.prototype):(t===null&&(t=new u(r)),t.length=r),t}function u(t,r,e){if(!u.TYPED_ARRAY_SUPPORT&&!(this instanceof u))return new u(t,r,e);if(typeof t=="number"){if(typeof r=="string")throw new Error("If encoding is specified then the first argument must be a string");return xr(this,t)}return ee(this,t,r,e)}u.poolSize=8192;u._augment=function(t){return t.__proto__=u.prototype,t};function ee(t,r,e,n){if(typeof r=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&r instanceof ArrayBuffer?Lt(t,r,e,n):typeof r=="string"?Ut(t,r,e):Mt(t,r)}u.from=function(t,r,e){return ee(null,t,r,e)};u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array);function te(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 Pt(t,r,e,n){return te(r),r<=0?C(t,r):e!==void 0?typeof n=="string"?C(t,r).fill(e,n):C(t,r).fill(e):C(t,r)}u.alloc=function(t,r,e){return Pt(null,t,r,e)};function xr(t,r){if(te(r),t=C(t,r<0?0:br(r)|0),!u.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}u.allocUnsafe=function(t){return xr(null,t)};u.allocUnsafeSlow=function(t){return xr(null,t)};function Ut(t,r,e){if((typeof e!="string"||e==="")&&(e="utf8"),!u.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var n=ne(r,e)|0;t=C(t,n);var o=t.write(r,e);return o!==n&&(t=t.slice(0,o)),t}function gr(t,r){var e=r.length<0?0:br(r.length)|0;t=C(t,e);for(var n=0;n<e;n+=1)t[n]=r[n]&255;return t}function Lt(t,r,e,n){if(r.byteLength,e<0||r.byteLength<e)throw new RangeError("'offset' is out of bounds");if(r.byteLength<e+(n||0))throw new RangeError("'length' is out of bounds");return e===void 0&&n===void 0?r=new Uint8Array(r):n===void 0?r=new Uint8Array(r,e):r=new Uint8Array(r,e,n),u.TYPED_ARRAY_SUPPORT?(t=r,t.__proto__=u.prototype):t=gr(t,r),t}function Mt(t,r){if(S(r)){var e=br(r.length)|0;return t=C(t,e),t.length===0||r.copy(t,0,0,e),t}if(r){if(typeof ArrayBuffer<"u"&&r.buffer instanceof ArrayBuffer||"length"in r)return typeof r.length!="number"||tn(r.length)?C(t,0):gr(t,r);if(r.type==="Buffer"&&re(r.data))return gr(t,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function br(t){if(t>=Q())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Q().toString(16)+" bytes");return t|0}u.isBuffer=nn;function S(t){return!!(t!=null&&t._isBuffer)}u.compare=function(r,e){if(!S(r)||!S(e))throw new TypeError("Arguments must be Buffers");if(r===e)return 0;for(var n=r.length,o=e.length,a=0,i=Math.min(n,o);a<i;++a)if(r[a]!==e[a]){n=r[a],o=e[a];break}return n<o?-1:o<n?1:0};u.isEncoding=function(r){switch(String(r).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}};u.concat=function(r,e){if(!re(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return u.alloc(0);var n;if(e===void 0)for(e=0,n=0;n<r.length;++n)e+=r[n].length;var o=u.allocUnsafe(e),a=0;for(n=0;n<r.length;++n){var i=r[n];if(!S(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(o,a),a+=i.length}return o};function ne(t,r){if(S(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 e=t.length;if(e===0)return 0;for(var n=!1;;)switch(r){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return Z(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return pe(t).length;default:if(n)return Z(t).length;r=(""+r).toLowerCase(),n=!0}}u.byteLength=ne;function vt(t,r,e){var n=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((e===void 0||e>this.length)&&(e=this.length),e<=0)||(e>>>=0,r>>>=0,e<=r))return"";for(t||(t="utf8");;)switch(t){case"hex":return Xt(this,r,e);case"utf8":case"utf-8":return ae(this,r,e);case"ascii":return $t(this,r,e);case"latin1":case"binary":return zt(this,r,e);case"base64":return Ht(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return qt(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}u.prototype._isBuffer=!0;function M(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}u.prototype.swap16=function(){var r=this.length;if(r%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<r;e+=2)M(this,e,e+1);return this};u.prototype.swap32=function(){var r=this.length;if(r%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<r;e+=4)M(this,e,e+3),M(this,e+1,e+2);return this};u.prototype.swap64=function(){var r=this.length;if(r%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<r;e+=8)M(this,e,e+7),M(this,e+1,e+6),M(this,e+2,e+5),M(this,e+3,e+4);return this};u.prototype.toString=function(){var r=this.length|0;return r===0?"":arguments.length===0?ae(this,0,r):vt.apply(this,arguments)};u.prototype.equals=function(r){if(!S(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:u.compare(this,r)===0};u.prototype.inspect=function(){var r="",e=kt;return this.length>0&&(r=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(r+=" ... ")),"<Buffer "+r+">"};u.prototype.compare=function(r,e,n,o,a){if(!S(r))throw new TypeError("Argument must be a Buffer");if(e===void 0&&(e=0),n===void 0&&(n=r?r.length:0),o===void 0&&(o=0),a===void 0&&(a=this.length),e<0||n>r.length||o<0||a>this.length)throw new RangeError("out of range index");if(o>=a&&e>=n)return 0;if(o>=a)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,o>>>=0,a>>>=0,this===r)return 0;for(var i=a-o,c=n-e,p=Math.min(i,c),f=this.slice(o,a),d=r.slice(e,n),l=0;l<p;++l)if(f[l]!==d[l]){i=f[l],c=d[l];break}return i<c?-1:c<i?1:0};function oe(t,r,e,n,o){if(t.length===0)return-1;if(typeof e=="string"?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=o?0:t.length-1),e<0&&(e=t.length+e),e>=t.length){if(o)return-1;e=t.length-1}else if(e<0)if(o)e=0;else return-1;if(typeof r=="string"&&(r=u.from(r,n)),S(r))return r.length===0?-1:Jr(t,r,e,n,o);if(typeof r=="number")return r=r&255,u.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?o?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):Jr(t,[r],e,n,o);throw new TypeError("val must be string, number or Buffer")}function Jr(t,r,e,n,o){var a=1,i=t.length,c=r.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||r.length<2)return-1;a=2,i/=2,c/=2,e/=2}function p(g,y){return a===1?g[y]:g.readUInt16BE(y*a)}var f;if(o){var d=-1;for(f=e;f<i;f++)if(p(t,f)===p(r,d===-1?0:f-d)){if(d===-1&&(d=f),f-d+1===c)return d*a}else d!==-1&&(f-=f-d),d=-1}else for(e+c>i&&(e=i-c),f=e;f>=0;f--){for(var l=!0,h=0;h<c;h++)if(p(t,f+h)!==p(r,h)){l=!1;break}if(l)return f}return-1}u.prototype.includes=function(r,e,n){return this.indexOf(r,e,n)!==-1};u.prototype.indexOf=function(r,e,n){return oe(this,r,e,n,!0)};u.prototype.lastIndexOf=function(r,e,n){return oe(this,r,e,n,!1)};function Ft(t,r,e,n){e=Number(e)||0;var o=t.length-e;n?(n=Number(n),n>o&&(n=o)):n=o;var a=r.length;if(a%2!==0)throw new TypeError("Invalid hex string");n>a/2&&(n=a/2);for(var i=0;i<n;++i){var c=parseInt(r.substr(i*2,2),16);if(isNaN(c))return i;t[e+i]=c}return i}function Yt(t,r,e,n){return nr(Z(r,t.length-e),t,e,n)}function ie(t,r,e,n){return nr(rn(r),t,e,n)}function Gt(t,r,e,n){return ie(t,r,e,n)}function Wt(t,r,e,n){return nr(pe(r),t,e,n)}function Kt(t,r,e,n){return nr(en(r,t.length-e),t,e,n)}u.prototype.write=function(r,e,n,o){if(e===void 0)o="utf8",n=this.length,e=0;else if(n===void 0&&typeof e=="string")o=e,n=this.length,e=0;else if(isFinite(e))e=e|0,isFinite(n)?(n=n|0,o===void 0&&(o="utf8")):(o=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var a=this.length-e;if((n===void 0||n>a)&&(n=a),r.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");o||(o="utf8");for(var i=!1;;)switch(o){case"hex":return Ft(this,r,e,n);case"utf8":case"utf-8":return Yt(this,r,e,n);case"ascii":return ie(this,r,e,n);case"latin1":case"binary":return Gt(this,r,e,n);case"base64":return Wt(this,r,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Kt(this,r,e,n);default:if(i)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),i=!0}};u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Ht(t,r,e){return r===0&&e===t.length?qr(t):qr(t.slice(r,e))}function ae(t,r,e){e=Math.min(t.length,e);for(var n=[],o=r;o<e;){var a=t[o],i=null,c=a>239?4:a>223?3:a>191?2:1;if(o+c<=e){var p,f,d,l;switch(c){case 1:a<128&&(i=a);break;case 2:p=t[o+1],(p&192)===128&&(l=(a&31)<<6|p&63,l>127&&(i=l));break;case 3:p=t[o+1],f=t[o+2],(p&192)===128&&(f&192)===128&&(l=(a&15)<<12|(p&63)<<6|f&63,l>2047&&(l<55296||l>57343)&&(i=l));break;case 4:p=t[o+1],f=t[o+2],d=t[o+3],(p&192)===128&&(f&192)===128&&(d&192)===128&&(l=(a&15)<<18|(p&63)<<12|(f&63)<<6|d&63,l>65535&&l<1114112&&(i=l))}}i===null?(i=65533,c=1):i>65535&&(i-=65536,n.push(i>>>10&1023|55296),i=56320|i&1023),n.push(i),o+=c}return Vt(n)}var jr=4096;function Vt(t){var r=t.length;if(r<=jr)return String.fromCharCode.apply(String,t);for(var e="",n=0;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=jr));return e}function $t(t,r,e){var n="";e=Math.min(t.length,e);for(var o=r;o<e;++o)n+=String.fromCharCode(t[o]&127);return n}function zt(t,r,e){var n="";e=Math.min(t.length,e);for(var o=r;o<e;++o)n+=String.fromCharCode(t[o]);return n}function Xt(t,r,e){var n=t.length;(!r||r<0)&&(r=0),(!e||e<0||e>n)&&(e=n);for(var o="",a=r;a<e;++a)o+=Zt(t[a]);return o}function qt(t,r,e){for(var n=t.slice(r,e),o="",a=0;a<n.length;a+=2)o+=String.fromCharCode(n[a]+n[a+1]*256);return o}u.prototype.slice=function(r,e){var n=this.length;r=~~r,e=e===void 0?n:~~e,r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),e<r&&(e=r);var o;if(u.TYPED_ARRAY_SUPPORT)o=this.subarray(r,e),o.__proto__=u.prototype;else{var a=e-r;o=new u(a,void 0);for(var i=0;i<a;++i)o[i]=this[i+r]}return o};function b(t,r,e){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+r>e)throw new RangeError("Trying to access beyond buffer length")}u.prototype.readUIntLE=function(r,e,n){r=r|0,e=e|0,n||b(r,e,this.length);for(var o=this[r],a=1,i=0;++i<e&&(a*=256);)o+=this[r+i]*a;return o};u.prototype.readUIntBE=function(r,e,n){r=r|0,e=e|0,n||b(r,e,this.length);for(var o=this[r+--e],a=1;e>0&&(a*=256);)o+=this[r+--e]*a;return o};u.prototype.readUInt8=function(r,e){return e||b(r,1,this.length),this[r]};u.prototype.readUInt16LE=function(r,e){return e||b(r,2,this.length),this[r]|this[r+1]<<8};u.prototype.readUInt16BE=function(r,e){return e||b(r,2,this.length),this[r]<<8|this[r+1]};u.prototype.readUInt32LE=function(r,e){return e||b(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216};u.prototype.readUInt32BE=function(r,e){return e||b(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])};u.prototype.readIntLE=function(r,e,n){r=r|0,e=e|0,n||b(r,e,this.length);for(var o=this[r],a=1,i=0;++i<e&&(a*=256);)o+=this[r+i]*a;return a*=128,o>=a&&(o-=Math.pow(2,8*e)),o};u.prototype.readIntBE=function(r,e,n){r=r|0,e=e|0,n||b(r,e,this.length);for(var o=e,a=1,i=this[r+--o];o>0&&(a*=256);)i+=this[r+--o]*a;return a*=128,i>=a&&(i-=Math.pow(2,8*e)),i};u.prototype.readInt8=function(r,e){return e||b(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};u.prototype.readInt16LE=function(r,e){e||b(r,2,this.length);var n=this[r]|this[r+1]<<8;return n&32768?n|4294901760:n};u.prototype.readInt16BE=function(r,e){e||b(r,2,this.length);var n=this[r+1]|this[r]<<8;return n&32768?n|4294901760:n};u.prototype.readInt32LE=function(r,e){return e||b(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24};u.prototype.readInt32BE=function(r,e){return e||b(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]};u.prototype.readFloatLE=function(r,e){return e||b(r,4,this.length),rr(this,r,!0,23,4)};u.prototype.readFloatBE=function(r,e){return e||b(r,4,this.length),rr(this,r,!1,23,4)};u.prototype.readDoubleLE=function(r,e){return e||b(r,8,this.length),rr(this,r,!0,52,8)};u.prototype.readDoubleBE=function(r,e){return e||b(r,8,this.length),rr(this,r,!1,52,8)};function T(t,r,e,n,o,a){if(!S(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>o||r<a)throw new RangeError('"value" argument is out of bounds');if(e+n>t.length)throw new RangeError("Index out of range")}u.prototype.writeUIntLE=function(r,e,n,o){if(r=+r,e=e|0,n=n|0,!o){var a=Math.pow(2,8*n)-1;T(this,r,e,n,a,0)}var i=1,c=0;for(this[e]=r&255;++c<n&&(i*=256);)this[e+c]=r/i&255;return e+n};u.prototype.writeUIntBE=function(r,e,n,o){if(r=+r,e=e|0,n=n|0,!o){var a=Math.pow(2,8*n)-1;T(this,r,e,n,a,0)}var i=n-1,c=1;for(this[e+i]=r&255;--i>=0&&(c*=256);)this[e+i]=r/c&255;return e+n};u.prototype.writeUInt8=function(r,e,n){return r=+r,e=e|0,n||T(this,r,e,1,255,0),u.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),this[e]=r&255,e+1};function er(t,r,e,n){r<0&&(r=65535+r+1);for(var o=0,a=Math.min(t.length-e,2);o<a;++o)t[e+o]=(r&255<<8*(n?o:1-o))>>>(n?o:1-o)*8}u.prototype.writeUInt16LE=function(r,e,n){return r=+r,e=e|0,n||T(this,r,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):er(this,r,e,!0),e+2};u.prototype.writeUInt16BE=function(r,e,n){return r=+r,e=e|0,n||T(this,r,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):er(this,r,e,!1),e+2};function tr(t,r,e,n){r<0&&(r=4294967295+r+1);for(var o=0,a=Math.min(t.length-e,4);o<a;++o)t[e+o]=r>>>(n?o:3-o)*8&255}u.prototype.writeUInt32LE=function(r,e,n){return r=+r,e=e|0,n||T(this,r,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e+3]=r>>>24,this[e+2]=r>>>16,this[e+1]=r>>>8,this[e]=r&255):tr(this,r,e,!0),e+4};u.prototype.writeUInt32BE=function(r,e,n){return r=+r,e=e|0,n||T(this,r,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e]=r>>>24,this[e+1]=r>>>16,this[e+2]=r>>>8,this[e+3]=r&255):tr(this,r,e,!1),e+4};u.prototype.writeIntLE=function(r,e,n,o){if(r=+r,e=e|0,!o){var a=Math.pow(2,8*n-1);T(this,r,e,n,a-1,-a)}var i=0,c=1,p=0;for(this[e]=r&255;++i<n&&(c*=256);)r<0&&p===0&&this[e+i-1]!==0&&(p=1),this[e+i]=(r/c>>0)-p&255;return e+n};u.prototype.writeIntBE=function(r,e,n,o){if(r=+r,e=e|0,!o){var a=Math.pow(2,8*n-1);T(this,r,e,n,a-1,-a)}var i=n-1,c=1,p=0;for(this[e+i]=r&255;--i>=0&&(c*=256);)r<0&&p===0&&this[e+i+1]!==0&&(p=1),this[e+i]=(r/c>>0)-p&255;return e+n};u.prototype.writeInt8=function(r,e,n){return r=+r,e=e|0,n||T(this,r,e,1,127,-128),u.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),r<0&&(r=255+r+1),this[e]=r&255,e+1};u.prototype.writeInt16LE=function(r,e,n){return r=+r,e=e|0,n||T(this,r,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):er(this,r,e,!0),e+2};u.prototype.writeInt16BE=function(r,e,n){return r=+r,e=e|0,n||T(this,r,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):er(this,r,e,!1),e+2};u.prototype.writeInt32LE=function(r,e,n){return r=+r,e=e|0,n||T(this,r,e,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8,this[e+2]=r>>>16,this[e+3]=r>>>24):tr(this,r,e,!0),e+4};u.prototype.writeInt32BE=function(r,e,n){return r=+r,e=e|0,n||T(this,r,e,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),u.TYPED_ARRAY_SUPPORT?(this[e]=r>>>24,this[e+1]=r>>>16,this[e+2]=r>>>8,this[e+3]=r&255):tr(this,r,e,!1),e+4};function se(t,r,e,n,o,a){if(e+n>t.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function ce(t,r,e,n,o){return o||se(t,r,e,4),Zr(t,r,e,n,23,4),e+4}u.prototype.writeFloatLE=function(r,e,n){return ce(this,r,e,!0,n)};u.prototype.writeFloatBE=function(r,e,n){return ce(this,r,e,!1,n)};function ue(t,r,e,n,o){return o||se(t,r,e,8),Zr(t,r,e,n,52,8),e+8}u.prototype.writeDoubleLE=function(r,e,n){return ue(this,r,e,!0,n)};u.prototype.writeDoubleBE=function(r,e,n){return ue(this,r,e,!1,n)};u.prototype.copy=function(r,e,n,o){if(n||(n=0),!o&&o!==0&&(o=this.length),e>=r.length&&(e=r.length),e||(e=0),o>0&&o<n&&(o=n),o===n||r.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),r.length-e<o-n&&(o=r.length-e+n);var a=o-n,i;if(this===r&&n<e&&e<o)for(i=a-1;i>=0;--i)r[i+e]=this[i+n];else if(a<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i<a;++i)r[i+e]=this[i+n];else Uint8Array.prototype.set.call(r,this.subarray(n,n+a),e);return a};u.prototype.fill=function(r,e,n,o){if(typeof r=="string"){if(typeof e=="string"?(o=e,e=0,n=this.length):typeof n=="string"&&(o=n,n=this.length),r.length===1){var a=r.charCodeAt(0);a<256&&(r=a)}if(o!==void 0&&typeof o!="string")throw new TypeError("encoding must be a string");if(typeof o=="string"&&!u.isEncoding(o))throw new TypeError("Unknown encoding: "+o)}else typeof r=="number"&&(r=r&255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;e=e>>>0,n=n===void 0?this.length:n>>>0,r||(r=0);var i;if(typeof r=="number")for(i=e;i<n;++i)this[i]=r;else{var c=S(r)?r:Z(new u(r,o).toString()),p=c.length;for(i=0;i<n-e;++i)this[i+e]=c[i%p]}return this};var Jt=/[^+\/0-9A-Za-z-_]/g;function jt(t){if(t=Qt(t).replace(Jt,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function Qt(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function Zt(t){return t<16?"0"+t.toString(16):t.toString(16)}function Z(t,r){r=r||1/0;for(var e,n=t.length,o=null,a=[],i=0;i<n;++i){if(e=t.charCodeAt(i),e>55295&&e<57344){if(!o){if(e>56319){(r-=3)>-1&&a.push(239,191,189);continue}else if(i+1===n){(r-=3)>-1&&a.push(239,191,189);continue}o=e;continue}if(e<56320){(r-=3)>-1&&a.push(239,191,189),o=e;continue}e=(o-55296<<10|e-56320)+65536}else o&&(r-=3)>-1&&a.push(239,191,189);if(o=null,e<128){if((r-=1)<0)break;a.push(e)}else if(e<2048){if((r-=2)<0)break;a.push(e>>6|192,e&63|128)}else if(e<65536){if((r-=3)<0)break;a.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((r-=4)<0)break;a.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return a}function rn(t){for(var r=[],e=0;e<t.length;++e)r.push(t.charCodeAt(e)&255);return r}function en(t,r){for(var e,n,o,a=[],i=0;i<t.length&&!((r-=2)<0);++i)e=t.charCodeAt(i),n=e>>8,o=e%256,a.push(o),a.push(n);return a}function pe(t){return Bt(jt(t))}function nr(t,r,e,n){for(var o=0;o<n&&!(o+e>=r.length||o>=t.length);++o)r[o+e]=t[o];return o}function tn(t){return t!==t}function nn(t){return t!=null&&(!!t._isBuffer||le(t)||on(t))}function le(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function on(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&le(t.slice(0,0))}import{encodeAddress as an,decodeAddress as Ga}from"algosdk";function Y(t){return t.reduce((r,e)=>Uint8Array.from([...r,...e]))}var me={V1_1:"v1_1",V2:"v2"},ts={[me.V1_1]:{testnet:62368684,mainnet:552635992},[me.V2]:{testnet:148607e3,mainnet:1002541853}};var de=t=>cn.decodeAddress(t.toUpperCase()).publicKey;import*as E from"ethereumjs-util";function pn(t){return E.toUnsigned(new E.BN(String(t)))}function fe(t){let r=pn(t);if(r.length>32)throw new Error("Invalid value. The buffer length of the value is more than 32");return new Uint8Array(E.setLengthLeft(r,32))}var ge=t=>new Uint8Array(E.setLengthLeft(or(t),32)),or=t=>s.from(ln(t),"hex"),ln=t=>t.startsWith("0x")?t.slice(2):t;var Er=t=>new Uint8Array(E.keccak256(s.from(t)));var Ar=(t,r)=>r===8?de(t):r===1?be.decode(t):ge(t);import sc from"algosdk";import hc from"algosdk";import Ic from"algosdk";import Pc from"algosdk";import Jc from"algosdk";var An=(t,r)=>r===8?fe(+t):dr[t]?new Uint8Array(or(String(t))):Ar(String(t),r);var _e=(t,r)=>{let e=Te(t.address,t.chainId,r.address,r.chainId);return s.from(Er(e)).toString("hex")},Te=(t,r,e,n)=>{let o=Ar(t,r),a=ye.encodeUint64(r),i=ye.encodeUint64(n),c=An(e,n);return Y([o,a,c,i])};var ju=(t,{userId:r,chainId:e,price:n,side:o,type:a,amount:i,total:c,id:p})=>{let{baseAsset:f,priceAsset:d}=t,l={address:r,chainId:e},h=o===W.Buy?d:f;return{action:"order",actionId:p,account:l,token:h,amount:o===W.Buy?a===j.Market?fr(c,d.decimal):mr(Xr(i,f.decimal),fr(n,d.decimal)):i,ts:Date.now()}},Qu=(t,r,e,n="0")=>({hash:_e(t,r),loginAddress:t.address,loginChainId:t.chainId,tokenId:r.address,tokenChainId:r.chainId,amount:e,lockedAmount:n});export{ju as mapToBalanceInfo,Qu as mapToCodexBalance};
1
+ function _r(){throw new Error("setTimeout has not been defined")}function yr(){throw new Error("clearTimeout has not been defined")}var D=_r,P=yr;typeof globalThis.setTimeout=="function"&&(D=setTimeout);typeof globalThis.clearTimeout=="function"&&(P=clearTimeout);function Ir(t){if(D===setTimeout)return setTimeout(t,0);if((D===_r||!D)&&setTimeout)return D=setTimeout,setTimeout(t,0);try{return D(t,0)}catch{try{return D.call(null,t,0)}catch{return D.call(this,t,0)}}}function Ie(t){if(P===clearTimeout)return clearTimeout(t);if((P===yr||!P)&&clearTimeout)return P=clearTimeout,clearTimeout(t);try{return P(t)}catch{try{return P.call(null,t)}catch{return P.call(this,t)}}}var C=[],F=!1,k,H=-1;function Re(){!F||!k||(F=!1,k.length?C=k.concat(C):H=-1,C.length&&Rr())}function Rr(){if(!F){var t=Ir(Re);F=!0;for(var r=C.length;r;){for(k=C,C=[];++H<r;)k&&k[H].run();H=-1,r=C.length}k=null,F=!1,Ie(t)}}function we(t){var r=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)r[e-1]=arguments[e];C.push(new wr(t,r)),C.length===1&&!F&&Ir(Rr)}function wr(t,r){this.fun=t,this.array=r}wr.prototype.run=function(){this.fun.apply(null,this.array)};var Ne="browser",Se="browser",Ce=!0,Oe={},Be=[],De="",Pe={},ke={},Ue={};function U(){}var Le=U,Me=U,ve=U,Fe=U,Ye=U,Ge=U,Ke=U;function We(t){throw new Error("process.binding is not supported")}function He(){return"/"}function Ve(t){throw new Error("process.chdir is not supported")}function $e(){return 0}var v=globalThis.performance||{},Xe=v.now||v.mozNow||v.msNow||v.oNow||v.webkitNow||function(){return new Date().getTime()};function ze(t){var r=Xe.call(v)*.001,e=Math.floor(r),n=Math.floor(r%1*1e9);return t&&(e=e-t[0],n=n-t[1],n<0&&(e--,n+=1e9)),[e,n]}var qe=new Date;function Je(){var t=new Date,r=t-qe;return r/1e3}var l={nextTick:we,title:Ne,browser:Ce,env:Oe,argv:Be,version:De,versions:Pe,on:Le,addListener:Me,once:ve,off:Fe,removeListener:Ye,removeAllListeners:Ge,emit:Ke,binding:We,cwd:He,chdir:Ve,umask:$e,hrtime:ze,platform:Se,release:ke,config:Ue,uptime:Je},Tr={};Object.keys(Tr).forEach(t=>{let r=t.split("."),e=l;for(let n=0;n<r.length;n++){let o=r[n];n===r.length-1?e[o]=Tr[t]:e=e[o]||(e[o]={})}});var R=[],y=[],je=typeof Uint8Array<"u"?Uint8Array:Array,cr=!1;function Or(){cr=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,e=t.length;r<e;++r)R[r]=t[r],y[t.charCodeAt(r)]=r;y[45]=62,y[95]=63}function Qe(t){cr||Or();var r,e,n,o,a,i,c=t.length;if(c%4>0)throw new Error("Invalid string. Length must be a multiple of 4");a=t[c-2]==="="?2:t[c-1]==="="?1:0,i=new je(c*3/4-a),n=a>0?c-4:c;var p=0;for(r=0,e=0;r<n;r+=4,e+=3)o=y[t.charCodeAt(r)]<<18|y[t.charCodeAt(r+1)]<<12|y[t.charCodeAt(r+2)]<<6|y[t.charCodeAt(r+3)],i[p++]=o>>16&255,i[p++]=o>>8&255,i[p++]=o&255;return a===2?(o=y[t.charCodeAt(r)]<<2|y[t.charCodeAt(r+1)]>>4,i[p++]=o&255):a===1&&(o=y[t.charCodeAt(r)]<<10|y[t.charCodeAt(r+1)]<<4|y[t.charCodeAt(r+2)]>>2,i[p++]=o>>8&255,i[p++]=o&255),i}function Ze(t){return R[t>>18&63]+R[t>>12&63]+R[t>>6&63]+R[t&63]}function rt(t,r,e){for(var n,o=[],a=r;a<e;a+=3)n=(t[a]<<16)+(t[a+1]<<8)+t[a+2],o.push(Ze(n));return o.join("")}function Nr(t){cr||Or();for(var r,e=t.length,n=e%3,o="",a=[],i=16383,c=0,p=e-n;c<p;c+=i)a.push(rt(t,c,c+i>p?p:c+i));return n===1?(r=t[e-1],o+=R[r>>2],o+=R[r<<4&63],o+="=="):n===2&&(r=(t[e-2]<<8)+t[e-1],o+=R[r>>10],o+=R[r>>4&63],o+=R[r<<2&63],o+="="),a.push(o),a.join("")}s.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;function V(){return s.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function O(t,r){if(V()<r)throw new RangeError("Invalid typed array length");return s.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(r),t.__proto__=s.prototype):(t===null&&(t=new s(r)),t.length=r),t}function s(t,r,e){if(!s.TYPED_ARRAY_SUPPORT&&!(this instanceof s))return new s(t,r,e);if(typeof t=="number"){if(typeof r=="string")throw new Error("If encoding is specified then the first argument must be a string");return ur(this,t)}return Br(this,t,r,e)}s.poolSize=8192;s._augment=function(t){return t.__proto__=s.prototype,t};function Br(t,r,e,n){if(typeof r=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&r instanceof ArrayBuffer?nt(t,r,e,n):typeof r=="string"?tt(t,r,e):ot(t,r)}s.from=function(t,r,e){return Br(null,t,r,e)};s.kMaxLength=V();s.TYPED_ARRAY_SUPPORT&&(s.prototype.__proto__=Uint8Array.prototype,s.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&s[Symbol.species]);function Dr(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 et(t,r,e,n){return Dr(r),r<=0?O(t,r):e!==void 0?typeof n=="string"?O(t,r).fill(e,n):O(t,r).fill(e):O(t,r)}s.alloc=function(t,r,e){return et(null,t,r,e)};function ur(t,r){if(Dr(r),t=O(t,r<0?0:pr(r)|0),!s.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}s.allocUnsafe=function(t){return ur(null,t)};s.allocUnsafeSlow=function(t){return ur(null,t)};function tt(t,r,e){if((typeof e!="string"||e==="")&&(e="utf8"),!s.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var n=Pr(r,e)|0;t=O(t,n);var o=t.write(r,e);return o!==n&&(t=t.slice(0,o)),t}function sr(t,r){var e=r.length<0?0:pr(r.length)|0;t=O(t,e);for(var n=0;n<e;n+=1)t[n]=r[n]&255;return t}function nt(t,r,e,n){if(r.byteLength,e<0||r.byteLength<e)throw new RangeError("'offset' is out of bounds");if(r.byteLength<e+(n||0))throw new RangeError("'length' is out of bounds");return e===void 0&&n===void 0?r=new Uint8Array(r):n===void 0?r=new Uint8Array(r,e):r=new Uint8Array(r,e,n),s.TYPED_ARRAY_SUPPORT?(t=r,t.__proto__=s.prototype):t=sr(t,r),t}function ot(t,r){if(w(r)){var e=pr(r.length)|0;return t=O(t,e),t.length===0||r.copy(t,0,0,e),t}if(r){if(typeof ArrayBuffer<"u"&&r.buffer instanceof ArrayBuffer||"length"in r)return typeof r.length!="number"||yt(r.length)?O(t,0):sr(t,r);if(r.type==="Buffer"&&Array.isArray(r.data))return sr(t,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function pr(t){if(t>=V())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+V().toString(16)+" bytes");return t|0}s.isBuffer=It;function w(t){return!!(t!=null&&t._isBuffer)}s.compare=function(r,e){if(!w(r)||!w(e))throw new TypeError("Arguments must be Buffers");if(r===e)return 0;for(var n=r.length,o=e.length,a=0,i=Math.min(n,o);a<i;++a)if(r[a]!==e[a]){n=r[a],o=e[a];break}return n<o?-1:o<n?1:0};s.isEncoding=function(r){switch(String(r).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(r,e){if(!Array.isArray(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return s.alloc(0);var n;if(e===void 0)for(e=0,n=0;n<r.length;++n)e+=r[n].length;var o=s.allocUnsafe(e),a=0;for(n=0;n<r.length;++n){var i=r[n];if(!w(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(o,a),a+=i.length}return o};function Pr(t,r){if(w(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 e=t.length;if(e===0)return 0;for(var n=!1;;)switch(r){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return $(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return Yr(t).length;default:if(n)return $(t).length;r=(""+r).toLowerCase(),n=!0}}s.byteLength=Pr;function it(t,r,e){var n=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((e===void 0||e>this.length)&&(e=this.length),e<=0)||(e>>>=0,r>>>=0,e<=r))return"";for(t||(t="utf8");;)switch(t){case"hex":return gt(this,r,e);case"utf8":case"utf-8":return Lr(this,r,e);case"ascii":return dt(this,r,e);case"latin1":case"binary":return ft(this,r,e);case"base64":return lt(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ht(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}s.prototype._isBuffer=!0;function L(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}s.prototype.swap16=function(){var r=this.length;if(r%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<r;e+=2)L(this,e,e+1);return this};s.prototype.swap32=function(){var r=this.length;if(r%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<r;e+=4)L(this,e,e+3),L(this,e+1,e+2);return this};s.prototype.swap64=function(){var r=this.length;if(r%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<r;e+=8)L(this,e,e+7),L(this,e+1,e+6),L(this,e+2,e+5),L(this,e+3,e+4);return this};s.prototype.toString=function(){var r=this.length|0;return r===0?"":arguments.length===0?Lr(this,0,r):it.apply(this,arguments)};s.prototype.equals=function(r){if(!w(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:s.compare(this,r)===0};s.prototype.compare=function(r,e,n,o,a){if(!w(r))throw new TypeError("Argument must be a Buffer");if(e===void 0&&(e=0),n===void 0&&(n=r?r.length:0),o===void 0&&(o=0),a===void 0&&(a=this.length),e<0||n>r.length||o<0||a>this.length)throw new RangeError("out of range index");if(o>=a&&e>=n)return 0;if(o>=a)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,o>>>=0,a>>>=0,this===r)return 0;for(var i=a-o,c=n-e,p=Math.min(i,c),f=this.slice(o,a),d=r.slice(e,n),m=0;m<p;++m)if(f[m]!==d[m]){i=f[m],c=d[m];break}return i<c?-1:c<i?1:0};function kr(t,r,e,n,o){if(t.length===0)return-1;if(typeof e=="string"?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=o?0:t.length-1),e<0&&(e=t.length+e),e>=t.length){if(o)return-1;e=t.length-1}else if(e<0)if(o)e=0;else return-1;if(typeof r=="string"&&(r=s.from(r,n)),w(r))return r.length===0?-1:Sr(t,r,e,n,o);if(typeof r=="number")return r=r&255,s.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?o?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):Sr(t,[r],e,n,o);throw new TypeError("val must be string, number or Buffer")}function Sr(t,r,e,n,o){var a=1,i=t.length,c=r.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||r.length<2)return-1;a=2,i/=2,c/=2,e/=2}function p(g,_){return a===1?g[_]:g.readUInt16BE(_*a)}var f;if(o){var d=-1;for(f=e;f<i;f++)if(p(t,f)===p(r,d===-1?0:f-d)){if(d===-1&&(d=f),f-d+1===c)return d*a}else d!==-1&&(f-=f-d),d=-1}else for(e+c>i&&(e=i-c),f=e;f>=0;f--){for(var m=!0,h=0;h<c;h++)if(p(t,f+h)!==p(r,h)){m=!1;break}if(m)return f}return-1}s.prototype.includes=function(r,e,n){return this.indexOf(r,e,n)!==-1};s.prototype.indexOf=function(r,e,n){return kr(this,r,e,n,!0)};s.prototype.lastIndexOf=function(r,e,n){return kr(this,r,e,n,!1)};function at(t,r,e,n){e=Number(e)||0;var o=t.length-e;n?(n=Number(n),n>o&&(n=o)):n=o;var a=r.length;if(a%2!==0)throw new TypeError("Invalid hex string");n>a/2&&(n=a/2);for(var i=0;i<n;++i){var c=parseInt(r.substr(i*2,2),16);if(isNaN(c))return i;t[e+i]=c}return i}function st(t,r,e,n){return q($(r,t.length-e),t,e,n)}function Ur(t,r,e,n){return q(Tt(r),t,e,n)}function ct(t,r,e,n){return Ur(t,r,e,n)}function ut(t,r,e,n){return q(Yr(r),t,e,n)}function pt(t,r,e,n){return q(_t(r,t.length-e),t,e,n)}s.prototype.write=function(r,e,n,o){if(e===void 0)o="utf8",n=this.length,e=0;else if(n===void 0&&typeof e=="string")o=e,n=this.length,e=0;else if(isFinite(e))e=e|0,isFinite(n)?(n=n|0,o===void 0&&(o="utf8")):(o=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var a=this.length-e;if((n===void 0||n>a)&&(n=a),r.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");o||(o="utf8");for(var i=!1;;)switch(o){case"hex":return at(this,r,e,n);case"utf8":case"utf-8":return st(this,r,e,n);case"ascii":return Ur(this,r,e,n);case"latin1":case"binary":return ct(this,r,e,n);case"base64":return ut(this,r,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return pt(this,r,e,n);default:if(i)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),i=!0}};s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function lt(t,r,e){return r===0&&e===t.length?Nr(t):Nr(t.slice(r,e))}function Lr(t,r,e){e=Math.min(t.length,e);for(var n=[],o=r;o<e;){var a=t[o],i=null,c=a>239?4:a>223?3:a>191?2:1;if(o+c<=e){var p,f,d,m;switch(c){case 1:a<128&&(i=a);break;case 2:p=t[o+1],(p&192)===128&&(m=(a&31)<<6|p&63,m>127&&(i=m));break;case 3:p=t[o+1],f=t[o+2],(p&192)===128&&(f&192)===128&&(m=(a&15)<<12|(p&63)<<6|f&63,m>2047&&(m<55296||m>57343)&&(i=m));break;case 4:p=t[o+1],f=t[o+2],d=t[o+3],(p&192)===128&&(f&192)===128&&(d&192)===128&&(m=(a&15)<<18|(p&63)<<12|(f&63)<<6|d&63,m>65535&&m<1114112&&(i=m))}}i===null?(i=65533,c=1):i>65535&&(i-=65536,n.push(i>>>10&1023|55296),i=56320|i&1023),n.push(i),o+=c}return mt(n)}var Cr=4096;function mt(t){var r=t.length;if(r<=Cr)return String.fromCharCode.apply(String,t);for(var e="",n=0;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=Cr));return e}function dt(t,r,e){var n="";e=Math.min(t.length,e);for(var o=r;o<e;++o)n+=String.fromCharCode(t[o]&127);return n}function ft(t,r,e){var n="";e=Math.min(t.length,e);for(var o=r;o<e;++o)n+=String.fromCharCode(t[o]);return n}function gt(t,r,e){var n=t.length;(!r||r<0)&&(r=0),(!e||e<0||e>n)&&(e=n);for(var o="",a=r;a<e;++a)o+=At(t[a]);return o}function ht(t,r,e){for(var n=t.slice(r,e),o="",a=0;a<n.length;a+=2)o+=String.fromCharCode(n[a]+n[a+1]*256);return o}s.prototype.slice=function(r,e){var n=this.length;r=~~r,e=e===void 0?n:~~e,r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),e<r&&(e=r);var o;if(s.TYPED_ARRAY_SUPPORT)o=this.subarray(r,e),o.__proto__=s.prototype;else{var a=e-r;o=new s(a,void 0);for(var i=0;i<a;++i)o[i]=this[i+r]}return o};function x(t,r,e){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+r>e)throw new RangeError("Trying to access beyond buffer length")}s.prototype.readUIntLE=function(r,e,n){r=r|0,e=e|0,n||x(r,e,this.length);for(var o=this[r],a=1,i=0;++i<e&&(a*=256);)o+=this[r+i]*a;return o};s.prototype.readUIntBE=function(r,e,n){r=r|0,e=e|0,n||x(r,e,this.length);for(var o=this[r+--e],a=1;e>0&&(a*=256);)o+=this[r+--e]*a;return o};s.prototype.readUInt8=function(r,e){return e||x(r,1,this.length),this[r]};s.prototype.readUInt16LE=function(r,e){return e||x(r,2,this.length),this[r]|this[r+1]<<8};s.prototype.readUInt16BE=function(r,e){return e||x(r,2,this.length),this[r]<<8|this[r+1]};s.prototype.readUInt32LE=function(r,e){return e||x(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216};s.prototype.readUInt32BE=function(r,e){return e||x(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])};s.prototype.readIntLE=function(r,e,n){r=r|0,e=e|0,n||x(r,e,this.length);for(var o=this[r],a=1,i=0;++i<e&&(a*=256);)o+=this[r+i]*a;return a*=128,o>=a&&(o-=Math.pow(2,8*e)),o};s.prototype.readIntBE=function(r,e,n){r=r|0,e=e|0,n||x(r,e,this.length);for(var o=e,a=1,i=this[r+--o];o>0&&(a*=256);)i+=this[r+--o]*a;return a*=128,i>=a&&(i-=Math.pow(2,8*e)),i};s.prototype.readInt8=function(r,e){return e||x(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};s.prototype.readInt16LE=function(r,e){e||x(r,2,this.length);var n=this[r]|this[r+1]<<8;return n&32768?n|4294901760:n};s.prototype.readInt16BE=function(r,e){e||x(r,2,this.length);var n=this[r+1]|this[r]<<8;return n&32768?n|4294901760:n};s.prototype.readInt32LE=function(r,e){return e||x(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24};s.prototype.readInt32BE=function(r,e){return e||x(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]};s.prototype.readFloatLE=function(r,e){return e||x(r,4,this.length),J(this,r,!0,23,4)};s.prototype.readFloatBE=function(r,e){return e||x(r,4,this.length),J(this,r,!1,23,4)};s.prototype.readDoubleLE=function(r,e){return e||x(r,8,this.length),J(this,r,!0,52,8)};s.prototype.readDoubleBE=function(r,e){return e||x(r,8,this.length),J(this,r,!1,52,8)};function A(t,r,e,n,o,a){if(!w(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>o||r<a)throw new RangeError('"value" argument is out of bounds');if(e+n>t.length)throw new RangeError("Index out of range")}s.prototype.writeUIntLE=function(r,e,n,o){if(r=+r,e=e|0,n=n|0,!o){var a=Math.pow(2,8*n)-1;A(this,r,e,n,a,0)}var i=1,c=0;for(this[e]=r&255;++c<n&&(i*=256);)this[e+c]=r/i&255;return e+n};s.prototype.writeUIntBE=function(r,e,n,o){if(r=+r,e=e|0,n=n|0,!o){var a=Math.pow(2,8*n)-1;A(this,r,e,n,a,0)}var i=n-1,c=1;for(this[e+i]=r&255;--i>=0&&(c*=256);)this[e+i]=r/c&255;return e+n};s.prototype.writeUInt8=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,1,255,0),s.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),this[e]=r&255,e+1};function X(t,r,e,n){r<0&&(r=65535+r+1);for(var o=0,a=Math.min(t.length-e,2);o<a;++o)t[e+o]=(r&255<<8*(n?o:1-o))>>>(n?o:1-o)*8}s.prototype.writeUInt16LE=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):X(this,r,e,!0),e+2};s.prototype.writeUInt16BE=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):X(this,r,e,!1),e+2};function z(t,r,e,n){r<0&&(r=4294967295+r+1);for(var o=0,a=Math.min(t.length-e,4);o<a;++o)t[e+o]=r>>>(n?o:3-o)*8&255}s.prototype.writeUInt32LE=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[e+3]=r>>>24,this[e+2]=r>>>16,this[e+1]=r>>>8,this[e]=r&255):z(this,r,e,!0),e+4};s.prototype.writeUInt32BE=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[e]=r>>>24,this[e+1]=r>>>16,this[e+2]=r>>>8,this[e+3]=r&255):z(this,r,e,!1),e+4};s.prototype.writeIntLE=function(r,e,n,o){if(r=+r,e=e|0,!o){var a=Math.pow(2,8*n-1);A(this,r,e,n,a-1,-a)}var i=0,c=1,p=0;for(this[e]=r&255;++i<n&&(c*=256);)r<0&&p===0&&this[e+i-1]!==0&&(p=1),this[e+i]=(r/c>>0)-p&255;return e+n};s.prototype.writeIntBE=function(r,e,n,o){if(r=+r,e=e|0,!o){var a=Math.pow(2,8*n-1);A(this,r,e,n,a-1,-a)}var i=n-1,c=1,p=0;for(this[e+i]=r&255;--i>=0&&(c*=256);)r<0&&p===0&&this[e+i+1]!==0&&(p=1),this[e+i]=(r/c>>0)-p&255;return e+n};s.prototype.writeInt8=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,1,127,-128),s.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),r<0&&(r=255+r+1),this[e]=r&255,e+1};s.prototype.writeInt16LE=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):X(this,r,e,!0),e+2};s.prototype.writeInt16BE=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):X(this,r,e,!1),e+2};s.prototype.writeInt32LE=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,4,2147483647,-2147483648),s.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8,this[e+2]=r>>>16,this[e+3]=r>>>24):z(this,r,e,!0),e+4};s.prototype.writeInt32BE=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),s.TYPED_ARRAY_SUPPORT?(this[e]=r>>>24,this[e+1]=r>>>16,this[e+2]=r>>>8,this[e+3]=r&255):z(this,r,e,!1),e+4};function Mr(t,r,e,n,o,a){if(e+n>t.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function vr(t,r,e,n,o){return o||Mr(t,r,e,4,34028234663852886e22,-34028234663852886e22),Kr(t,r,e,n,23,4),e+4}s.prototype.writeFloatLE=function(r,e,n){return vr(this,r,e,!0,n)};s.prototype.writeFloatBE=function(r,e,n){return vr(this,r,e,!1,n)};function Fr(t,r,e,n,o){return o||Mr(t,r,e,8,17976931348623157e292,-17976931348623157e292),Kr(t,r,e,n,52,8),e+8}s.prototype.writeDoubleLE=function(r,e,n){return Fr(this,r,e,!0,n)};s.prototype.writeDoubleBE=function(r,e,n){return Fr(this,r,e,!1,n)};s.prototype.copy=function(r,e,n,o){if(n||(n=0),!o&&o!==0&&(o=this.length),e>=r.length&&(e=r.length),e||(e=0),o>0&&o<n&&(o=n),o===n||r.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),r.length-e<o-n&&(o=r.length-e+n);var a=o-n,i;if(this===r&&n<e&&e<o)for(i=a-1;i>=0;--i)r[i+e]=this[i+n];else if(a<1e3||!s.TYPED_ARRAY_SUPPORT)for(i=0;i<a;++i)r[i+e]=this[i+n];else Uint8Array.prototype.set.call(r,this.subarray(n,n+a),e);return a};s.prototype.fill=function(r,e,n,o){if(typeof r=="string"){if(typeof e=="string"?(o=e,e=0,n=this.length):typeof n=="string"&&(o=n,n=this.length),r.length===1){var a=r.charCodeAt(0);a<256&&(r=a)}if(o!==void 0&&typeof o!="string")throw new TypeError("encoding must be a string");if(typeof o=="string"&&!s.isEncoding(o))throw new TypeError("Unknown encoding: "+o)}else typeof r=="number"&&(r=r&255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;e=e>>>0,n=n===void 0?this.length:n>>>0,r||(r=0);var i;if(typeof r=="number")for(i=e;i<n;++i)this[i]=r;else{var c=w(r)?r:$(new s(r,o).toString()),p=c.length;for(i=0;i<n-e;++i)this[i+e]=c[i%p]}return this};var xt=/[^+\/0-9A-Za-z-_]/g;function bt(t){if(t=Et(t).replace(xt,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function Et(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function At(t){return t<16?"0"+t.toString(16):t.toString(16)}function $(t,r){r=r||1/0;for(var e,n=t.length,o=null,a=[],i=0;i<n;++i){if(e=t.charCodeAt(i),e>55295&&e<57344){if(!o){if(e>56319){(r-=3)>-1&&a.push(239,191,189);continue}else if(i+1===n){(r-=3)>-1&&a.push(239,191,189);continue}o=e;continue}if(e<56320){(r-=3)>-1&&a.push(239,191,189),o=e;continue}e=(o-55296<<10|e-56320)+65536}else o&&(r-=3)>-1&&a.push(239,191,189);if(o=null,e<128){if((r-=1)<0)break;a.push(e)}else if(e<2048){if((r-=2)<0)break;a.push(e>>6|192,e&63|128)}else if(e<65536){if((r-=3)<0)break;a.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((r-=4)<0)break;a.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return a}function Tt(t){for(var r=[],e=0;e<t.length;++e)r.push(t.charCodeAt(e)&255);return r}function _t(t,r){for(var e,n,o,a=[],i=0;i<t.length&&!((r-=2)<0);++i)e=t.charCodeAt(i),n=e>>8,o=e%256,a.push(o),a.push(n);return a}function Yr(t){return Qe(bt(t))}function q(t,r,e,n){for(var o=0;o<n&&!(o+e>=r.length||o>=t.length);++o)r[o+e]=t[o];return o}function yt(t){return t!==t}function It(t){return t!=null&&(!!t._isBuffer||Gr(t)||Rt(t))}function Gr(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function Rt(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&Gr(t.slice(0,0))}function J(t,r,e,n,o){var a,i,c=o*8-n-1,p=(1<<c)-1,f=p>>1,d=-7,m=e?o-1:0,h=e?-1:1,g=t[r+m];for(m+=h,a=g&(1<<-d)-1,g>>=-d,d+=c;d>0;a=a*256+t[r+m],m+=h,d-=8);for(i=a&(1<<-d)-1,a>>=-d,d+=n;d>0;i=i*256+t[r+m],m+=h,d-=8);if(a===0)a=1-f;else{if(a===p)return i?NaN:(g?-1:1)*(1/0);i=i+Math.pow(2,n),a=a-f}return(g?-1:1)*i*Math.pow(2,a-n)}function Kr(t,r,e,n,o,a){var i,c,p,f=a*8-o-1,d=(1<<f)-1,m=d>>1,h=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,g=n?0:a-1,_=n?1:-1,ar=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(c=isNaN(r)?1:0,i=d):(i=Math.floor(Math.log(r)/Math.LN2),r*(p=Math.pow(2,-i))<1&&(i--,p*=2),i+m>=1?r+=h/p:r+=h*Math.pow(2,1-m),r*p>=2&&(i++,p/=2),i+m>=d?(c=0,i=d):i+m>=1?(c=(r*p-1)*Math.pow(2,o),i=i+m):(c=r*Math.pow(2,m-1)*Math.pow(2,o),i=0));o>=8;t[e+g]=c&255,g+=_,c/=256,o-=8);for(i=i<<o|c,f+=o;f>0;t[e+g]=i&255,g+=_,i/=256,f-=8);t[e+g-_]|=ar*128}import lr from"bignumber.js";lr.config({DECIMAL_PLACES:40,EXPONENTIAL_AT:45});function mr(t,r){return Wr(t,r,"*")}function G(t,r){return Wr(t,r,"/")}function Wr(t,r,e){switch(t=new lr(String(t)),r=new lr(String(r)),e.toLowerCase()){case"-":return t.minus(r).toString();case"+":return t.plus(r).toString();case"*":case"x":return t.multipliedBy(r).toString();case"\xF7":case"/":return t.dividedBy(r).toString();case">=":return t.isGreaterThanOrEqualTo(r);case">":return t.isGreaterThan(r);case"<=":return t.isLessThanOrEqualTo(r);case"<":return t.isLessThan(r);case"==":return t.isEqualTo(r);case"mod":return t.modulo(r);default:break}}var Hr=(e=>(e[e.Buy=0]="Buy",e[e.Sell=1]="Sell",e))(Hr||{}),K=Hr;var Vr=(o=>(o[o.Limit=0]="Limit",o[o.IOC=1]="IOC",o[o.POST=2]="POST",o[o.Market=3]="Market",o))(Vr||{}),j=Vr;var $r=(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))($r||{}),Xr=(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))(Xr||{}),Mo={...$r,...Xr};var dr={"0x4343545055534443000000000000000000000000000000000000000000000000":65537};var Ji={SMALLESTUNIT:l.env.SMALLEST_UNIT},ji={SMALLEST_UNITS:l.env.SMALLEST_UNIT};var ea=`{"theme1":{"value":"${l.env.FRONTEND_URL}/Theme%3DDark.svg","active":true},"theme2":{"value":"${l.env.FRONTEND_URL}/Theme%3DLight.svg","active":true},"theme3":{"value":"${l.env.FRONTEND_URL}/Theme%3DLight.svg","active":true}}`;var aa=["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 da=l.env.REACT_APP_API_URL,fa=l.env.REACT_APP_SOCKET_URL,ga=l.env.REACT_APP_ALGO_SERVER,ha=l.env.REACT_APP_ALGO_SERVER_PORT||"",xa=l.env.REACT_APP_ALGOD_TOKEN||"",ba=l.env.REACT_APP_DISPENSER_LINK,Ea=l.env.REACT_APP_FRONTEND_LINK||"",Aa=l.env.REACT_APP_ALGO_EXPLORER_LINK,Ta=l.env.REACT_APP_ALGO_EXPLORER_ASSETS_URL,_a=(l.env.REACT_APP_REQUIRE_ACCESS_CODE||"").toLowerCase()==="true",ya=l.env.REACT_APP_USERBACK_ACCESS_TOKEN,Ia=(l.env.REACT_APP_EXT_ORDER_TYPES||"").toLowerCase()==="true";var Ra=.001*10**6,wa=.002*10**6;var Na=l.env.REACT_APP_MASTER_APP_ID||"406",Sa=l.env.REACT_APP_AGG_APP_ID||"408",Nt=Number(l.env.REACT_APP_CODEX_APP_ID||"467960617");console.log("CODEX_APP_ID",Nt);var St=l.env.REACT_APP_ALGO_NETWORK||"";var Ca=St.toLowerCase()==="mainnet"?"mainnet":"testnet";var fr=(t,r)=>G(t,10**(18-r)),zr=(t,r)=>G(t,10**r);import _e from"algosdk";import*as Tn from"bs58";import Ac from"algosdk";import*as be from"bs58";import pn from"algosdk";import ts,{decodeAddress as ns,encodeAddress as os}from"algosdk";var N=[],I=[],Ot=typeof Uint8Array<"u"?Uint8Array:Array,hr=!1;function Qr(){hr=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,e=t.length;r<e;++r)N[r]=t[r],I[t.charCodeAt(r)]=r;I[45]=62,I[95]=63}function Bt(t){hr||Qr();var r,e,n,o,a,i,c=t.length;if(c%4>0)throw new Error("Invalid string. Length must be a multiple of 4");a=t[c-2]==="="?2:t[c-1]==="="?1:0,i=new Ot(c*3/4-a),n=a>0?c-4:c;var p=0;for(r=0,e=0;r<n;r+=4,e+=3)o=I[t.charCodeAt(r)]<<18|I[t.charCodeAt(r+1)]<<12|I[t.charCodeAt(r+2)]<<6|I[t.charCodeAt(r+3)],i[p++]=o>>16&255,i[p++]=o>>8&255,i[p++]=o&255;return a===2?(o=I[t.charCodeAt(r)]<<2|I[t.charCodeAt(r+1)]>>4,i[p++]=o&255):a===1&&(o=I[t.charCodeAt(r)]<<10|I[t.charCodeAt(r+1)]<<4|I[t.charCodeAt(r+2)]>>2,i[p++]=o>>8&255,i[p++]=o&255),i}function Dt(t){return N[t>>18&63]+N[t>>12&63]+N[t>>6&63]+N[t&63]}function Pt(t,r,e){for(var n,o=[],a=r;a<e;a+=3)n=(t[a]<<16)+(t[a+1]<<8)+t[a+2],o.push(Dt(n));return o.join("")}function qr(t){hr||Qr();for(var r,e=t.length,n=e%3,o="",a=[],i=16383,c=0,p=e-n;c<p;c+=i)a.push(Pt(t,c,c+i>p?p:c+i));return n===1?(r=t[e-1],o+=N[r>>2],o+=N[r<<4&63],o+="=="):n===2&&(r=(t[e-2]<<8)+t[e-1],o+=N[r>>10],o+=N[r>>4&63],o+=N[r<<2&63],o+="="),a.push(o),a.join("")}function rr(t,r,e,n,o){var a,i,c=o*8-n-1,p=(1<<c)-1,f=p>>1,d=-7,m=e?o-1:0,h=e?-1:1,g=t[r+m];for(m+=h,a=g&(1<<-d)-1,g>>=-d,d+=c;d>0;a=a*256+t[r+m],m+=h,d-=8);for(i=a&(1<<-d)-1,a>>=-d,d+=n;d>0;i=i*256+t[r+m],m+=h,d-=8);if(a===0)a=1-f;else{if(a===p)return i?NaN:(g?-1:1)*(1/0);i=i+Math.pow(2,n),a=a-f}return(g?-1:1)*i*Math.pow(2,a-n)}function Zr(t,r,e,n,o,a){var i,c,p,f=a*8-o-1,d=(1<<f)-1,m=d>>1,h=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,g=n?0:a-1,_=n?1:-1,ar=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(c=isNaN(r)?1:0,i=d):(i=Math.floor(Math.log(r)/Math.LN2),r*(p=Math.pow(2,-i))<1&&(i--,p*=2),i+m>=1?r+=h/p:r+=h*Math.pow(2,1-m),r*p>=2&&(i++,p/=2),i+m>=d?(c=0,i=d):i+m>=1?(c=(r*p-1)*Math.pow(2,o),i=i+m):(c=r*Math.pow(2,m-1)*Math.pow(2,o),i=0));o>=8;t[e+g]=c&255,g+=_,c/=256,o-=8);for(i=i<<o|c,f+=o;f>0;t[e+g]=i&255,g+=_,i/=256,f-=8);t[e+g-_]|=ar*128}var kt={}.toString,re=Array.isArray||function(t){return kt.call(t)=="[object Array]"};var Ut=50;u.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;var ja=Q();function Q(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function B(t,r){if(Q()<r)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(r),t.__proto__=u.prototype):(t===null&&(t=new u(r)),t.length=r),t}function u(t,r,e){if(!u.TYPED_ARRAY_SUPPORT&&!(this instanceof u))return new u(t,r,e);if(typeof t=="number"){if(typeof r=="string")throw new Error("If encoding is specified then the first argument must be a string");return xr(this,t)}return ee(this,t,r,e)}u.poolSize=8192;u._augment=function(t){return t.__proto__=u.prototype,t};function ee(t,r,e,n){if(typeof r=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&r instanceof ArrayBuffer?vt(t,r,e,n):typeof r=="string"?Mt(t,r,e):Ft(t,r)}u.from=function(t,r,e){return ee(null,t,r,e)};u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array);function te(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 Lt(t,r,e,n){return te(r),r<=0?B(t,r):e!==void 0?typeof n=="string"?B(t,r).fill(e,n):B(t,r).fill(e):B(t,r)}u.alloc=function(t,r,e){return Lt(null,t,r,e)};function xr(t,r){if(te(r),t=B(t,r<0?0:br(r)|0),!u.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}u.allocUnsafe=function(t){return xr(null,t)};u.allocUnsafeSlow=function(t){return xr(null,t)};function Mt(t,r,e){if((typeof e!="string"||e==="")&&(e="utf8"),!u.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var n=ne(r,e)|0;t=B(t,n);var o=t.write(r,e);return o!==n&&(t=t.slice(0,o)),t}function gr(t,r){var e=r.length<0?0:br(r.length)|0;t=B(t,e);for(var n=0;n<e;n+=1)t[n]=r[n]&255;return t}function vt(t,r,e,n){if(r.byteLength,e<0||r.byteLength<e)throw new RangeError("'offset' is out of bounds");if(r.byteLength<e+(n||0))throw new RangeError("'length' is out of bounds");return e===void 0&&n===void 0?r=new Uint8Array(r):n===void 0?r=new Uint8Array(r,e):r=new Uint8Array(r,e,n),u.TYPED_ARRAY_SUPPORT?(t=r,t.__proto__=u.prototype):t=gr(t,r),t}function Ft(t,r){if(S(r)){var e=br(r.length)|0;return t=B(t,e),t.length===0||r.copy(t,0,0,e),t}if(r){if(typeof ArrayBuffer<"u"&&r.buffer instanceof ArrayBuffer||"length"in r)return typeof r.length!="number"||on(r.length)?B(t,0):gr(t,r);if(r.type==="Buffer"&&re(r.data))return gr(t,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function br(t){if(t>=Q())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Q().toString(16)+" bytes");return t|0}u.isBuffer=an;function S(t){return!!(t!=null&&t._isBuffer)}u.compare=function(r,e){if(!S(r)||!S(e))throw new TypeError("Arguments must be Buffers");if(r===e)return 0;for(var n=r.length,o=e.length,a=0,i=Math.min(n,o);a<i;++a)if(r[a]!==e[a]){n=r[a],o=e[a];break}return n<o?-1:o<n?1:0};u.isEncoding=function(r){switch(String(r).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}};u.concat=function(r,e){if(!re(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return u.alloc(0);var n;if(e===void 0)for(e=0,n=0;n<r.length;++n)e+=r[n].length;var o=u.allocUnsafe(e),a=0;for(n=0;n<r.length;++n){var i=r[n];if(!S(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(o,a),a+=i.length}return o};function ne(t,r){if(S(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 e=t.length;if(e===0)return 0;for(var n=!1;;)switch(r){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return Z(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return pe(t).length;default:if(n)return Z(t).length;r=(""+r).toLowerCase(),n=!0}}u.byteLength=ne;function Yt(t,r,e){var n=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((e===void 0||e>this.length)&&(e=this.length),e<=0)||(e>>>=0,r>>>=0,e<=r))return"";for(t||(t="utf8");;)switch(t){case"hex":return Jt(this,r,e);case"utf8":case"utf-8":return ae(this,r,e);case"ascii":return zt(this,r,e);case"latin1":case"binary":return qt(this,r,e);case"base64":return $t(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return jt(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}u.prototype._isBuffer=!0;function M(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}u.prototype.swap16=function(){var r=this.length;if(r%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<r;e+=2)M(this,e,e+1);return this};u.prototype.swap32=function(){var r=this.length;if(r%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<r;e+=4)M(this,e,e+3),M(this,e+1,e+2);return this};u.prototype.swap64=function(){var r=this.length;if(r%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<r;e+=8)M(this,e,e+7),M(this,e+1,e+6),M(this,e+2,e+5),M(this,e+3,e+4);return this};u.prototype.toString=function(){var r=this.length|0;return r===0?"":arguments.length===0?ae(this,0,r):Yt.apply(this,arguments)};u.prototype.equals=function(r){if(!S(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:u.compare(this,r)===0};u.prototype.inspect=function(){var r="",e=Ut;return this.length>0&&(r=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(r+=" ... ")),"<Buffer "+r+">"};u.prototype.compare=function(r,e,n,o,a){if(!S(r))throw new TypeError("Argument must be a Buffer");if(e===void 0&&(e=0),n===void 0&&(n=r?r.length:0),o===void 0&&(o=0),a===void 0&&(a=this.length),e<0||n>r.length||o<0||a>this.length)throw new RangeError("out of range index");if(o>=a&&e>=n)return 0;if(o>=a)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,o>>>=0,a>>>=0,this===r)return 0;for(var i=a-o,c=n-e,p=Math.min(i,c),f=this.slice(o,a),d=r.slice(e,n),m=0;m<p;++m)if(f[m]!==d[m]){i=f[m],c=d[m];break}return i<c?-1:c<i?1:0};function oe(t,r,e,n,o){if(t.length===0)return-1;if(typeof e=="string"?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=o?0:t.length-1),e<0&&(e=t.length+e),e>=t.length){if(o)return-1;e=t.length-1}else if(e<0)if(o)e=0;else return-1;if(typeof r=="string"&&(r=u.from(r,n)),S(r))return r.length===0?-1:Jr(t,r,e,n,o);if(typeof r=="number")return r=r&255,u.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?o?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):Jr(t,[r],e,n,o);throw new TypeError("val must be string, number or Buffer")}function Jr(t,r,e,n,o){var a=1,i=t.length,c=r.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||r.length<2)return-1;a=2,i/=2,c/=2,e/=2}function p(g,_){return a===1?g[_]:g.readUInt16BE(_*a)}var f;if(o){var d=-1;for(f=e;f<i;f++)if(p(t,f)===p(r,d===-1?0:f-d)){if(d===-1&&(d=f),f-d+1===c)return d*a}else d!==-1&&(f-=f-d),d=-1}else for(e+c>i&&(e=i-c),f=e;f>=0;f--){for(var m=!0,h=0;h<c;h++)if(p(t,f+h)!==p(r,h)){m=!1;break}if(m)return f}return-1}u.prototype.includes=function(r,e,n){return this.indexOf(r,e,n)!==-1};u.prototype.indexOf=function(r,e,n){return oe(this,r,e,n,!0)};u.prototype.lastIndexOf=function(r,e,n){return oe(this,r,e,n,!1)};function Gt(t,r,e,n){e=Number(e)||0;var o=t.length-e;n?(n=Number(n),n>o&&(n=o)):n=o;var a=r.length;if(a%2!==0)throw new TypeError("Invalid hex string");n>a/2&&(n=a/2);for(var i=0;i<n;++i){var c=parseInt(r.substr(i*2,2),16);if(isNaN(c))return i;t[e+i]=c}return i}function Kt(t,r,e,n){return nr(Z(r,t.length-e),t,e,n)}function ie(t,r,e,n){return nr(tn(r),t,e,n)}function Wt(t,r,e,n){return ie(t,r,e,n)}function Ht(t,r,e,n){return nr(pe(r),t,e,n)}function Vt(t,r,e,n){return nr(nn(r,t.length-e),t,e,n)}u.prototype.write=function(r,e,n,o){if(e===void 0)o="utf8",n=this.length,e=0;else if(n===void 0&&typeof e=="string")o=e,n=this.length,e=0;else if(isFinite(e))e=e|0,isFinite(n)?(n=n|0,o===void 0&&(o="utf8")):(o=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var a=this.length-e;if((n===void 0||n>a)&&(n=a),r.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");o||(o="utf8");for(var i=!1;;)switch(o){case"hex":return Gt(this,r,e,n);case"utf8":case"utf-8":return Kt(this,r,e,n);case"ascii":return ie(this,r,e,n);case"latin1":case"binary":return Wt(this,r,e,n);case"base64":return Ht(this,r,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Vt(this,r,e,n);default:if(i)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),i=!0}};u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function $t(t,r,e){return r===0&&e===t.length?qr(t):qr(t.slice(r,e))}function ae(t,r,e){e=Math.min(t.length,e);for(var n=[],o=r;o<e;){var a=t[o],i=null,c=a>239?4:a>223?3:a>191?2:1;if(o+c<=e){var p,f,d,m;switch(c){case 1:a<128&&(i=a);break;case 2:p=t[o+1],(p&192)===128&&(m=(a&31)<<6|p&63,m>127&&(i=m));break;case 3:p=t[o+1],f=t[o+2],(p&192)===128&&(f&192)===128&&(m=(a&15)<<12|(p&63)<<6|f&63,m>2047&&(m<55296||m>57343)&&(i=m));break;case 4:p=t[o+1],f=t[o+2],d=t[o+3],(p&192)===128&&(f&192)===128&&(d&192)===128&&(m=(a&15)<<18|(p&63)<<12|(f&63)<<6|d&63,m>65535&&m<1114112&&(i=m))}}i===null?(i=65533,c=1):i>65535&&(i-=65536,n.push(i>>>10&1023|55296),i=56320|i&1023),n.push(i),o+=c}return Xt(n)}var jr=4096;function Xt(t){var r=t.length;if(r<=jr)return String.fromCharCode.apply(String,t);for(var e="",n=0;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=jr));return e}function zt(t,r,e){var n="";e=Math.min(t.length,e);for(var o=r;o<e;++o)n+=String.fromCharCode(t[o]&127);return n}function qt(t,r,e){var n="";e=Math.min(t.length,e);for(var o=r;o<e;++o)n+=String.fromCharCode(t[o]);return n}function Jt(t,r,e){var n=t.length;(!r||r<0)&&(r=0),(!e||e<0||e>n)&&(e=n);for(var o="",a=r;a<e;++a)o+=en(t[a]);return o}function jt(t,r,e){for(var n=t.slice(r,e),o="",a=0;a<n.length;a+=2)o+=String.fromCharCode(n[a]+n[a+1]*256);return o}u.prototype.slice=function(r,e){var n=this.length;r=~~r,e=e===void 0?n:~~e,r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),e<r&&(e=r);var o;if(u.TYPED_ARRAY_SUPPORT)o=this.subarray(r,e),o.__proto__=u.prototype;else{var a=e-r;o=new u(a,void 0);for(var i=0;i<a;++i)o[i]=this[i+r]}return o};function b(t,r,e){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+r>e)throw new RangeError("Trying to access beyond buffer length")}u.prototype.readUIntLE=function(r,e,n){r=r|0,e=e|0,n||b(r,e,this.length);for(var o=this[r],a=1,i=0;++i<e&&(a*=256);)o+=this[r+i]*a;return o};u.prototype.readUIntBE=function(r,e,n){r=r|0,e=e|0,n||b(r,e,this.length);for(var o=this[r+--e],a=1;e>0&&(a*=256);)o+=this[r+--e]*a;return o};u.prototype.readUInt8=function(r,e){return e||b(r,1,this.length),this[r]};u.prototype.readUInt16LE=function(r,e){return e||b(r,2,this.length),this[r]|this[r+1]<<8};u.prototype.readUInt16BE=function(r,e){return e||b(r,2,this.length),this[r]<<8|this[r+1]};u.prototype.readUInt32LE=function(r,e){return e||b(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216};u.prototype.readUInt32BE=function(r,e){return e||b(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])};u.prototype.readIntLE=function(r,e,n){r=r|0,e=e|0,n||b(r,e,this.length);for(var o=this[r],a=1,i=0;++i<e&&(a*=256);)o+=this[r+i]*a;return a*=128,o>=a&&(o-=Math.pow(2,8*e)),o};u.prototype.readIntBE=function(r,e,n){r=r|0,e=e|0,n||b(r,e,this.length);for(var o=e,a=1,i=this[r+--o];o>0&&(a*=256);)i+=this[r+--o]*a;return a*=128,i>=a&&(i-=Math.pow(2,8*e)),i};u.prototype.readInt8=function(r,e){return e||b(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};u.prototype.readInt16LE=function(r,e){e||b(r,2,this.length);var n=this[r]|this[r+1]<<8;return n&32768?n|4294901760:n};u.prototype.readInt16BE=function(r,e){e||b(r,2,this.length);var n=this[r+1]|this[r]<<8;return n&32768?n|4294901760:n};u.prototype.readInt32LE=function(r,e){return e||b(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24};u.prototype.readInt32BE=function(r,e){return e||b(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]};u.prototype.readFloatLE=function(r,e){return e||b(r,4,this.length),rr(this,r,!0,23,4)};u.prototype.readFloatBE=function(r,e){return e||b(r,4,this.length),rr(this,r,!1,23,4)};u.prototype.readDoubleLE=function(r,e){return e||b(r,8,this.length),rr(this,r,!0,52,8)};u.prototype.readDoubleBE=function(r,e){return e||b(r,8,this.length),rr(this,r,!1,52,8)};function T(t,r,e,n,o,a){if(!S(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>o||r<a)throw new RangeError('"value" argument is out of bounds');if(e+n>t.length)throw new RangeError("Index out of range")}u.prototype.writeUIntLE=function(r,e,n,o){if(r=+r,e=e|0,n=n|0,!o){var a=Math.pow(2,8*n)-1;T(this,r,e,n,a,0)}var i=1,c=0;for(this[e]=r&255;++c<n&&(i*=256);)this[e+c]=r/i&255;return e+n};u.prototype.writeUIntBE=function(r,e,n,o){if(r=+r,e=e|0,n=n|0,!o){var a=Math.pow(2,8*n)-1;T(this,r,e,n,a,0)}var i=n-1,c=1;for(this[e+i]=r&255;--i>=0&&(c*=256);)this[e+i]=r/c&255;return e+n};u.prototype.writeUInt8=function(r,e,n){return r=+r,e=e|0,n||T(this,r,e,1,255,0),u.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),this[e]=r&255,e+1};function er(t,r,e,n){r<0&&(r=65535+r+1);for(var o=0,a=Math.min(t.length-e,2);o<a;++o)t[e+o]=(r&255<<8*(n?o:1-o))>>>(n?o:1-o)*8}u.prototype.writeUInt16LE=function(r,e,n){return r=+r,e=e|0,n||T(this,r,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):er(this,r,e,!0),e+2};u.prototype.writeUInt16BE=function(r,e,n){return r=+r,e=e|0,n||T(this,r,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):er(this,r,e,!1),e+2};function tr(t,r,e,n){r<0&&(r=4294967295+r+1);for(var o=0,a=Math.min(t.length-e,4);o<a;++o)t[e+o]=r>>>(n?o:3-o)*8&255}u.prototype.writeUInt32LE=function(r,e,n){return r=+r,e=e|0,n||T(this,r,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e+3]=r>>>24,this[e+2]=r>>>16,this[e+1]=r>>>8,this[e]=r&255):tr(this,r,e,!0),e+4};u.prototype.writeUInt32BE=function(r,e,n){return r=+r,e=e|0,n||T(this,r,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e]=r>>>24,this[e+1]=r>>>16,this[e+2]=r>>>8,this[e+3]=r&255):tr(this,r,e,!1),e+4};u.prototype.writeIntLE=function(r,e,n,o){if(r=+r,e=e|0,!o){var a=Math.pow(2,8*n-1);T(this,r,e,n,a-1,-a)}var i=0,c=1,p=0;for(this[e]=r&255;++i<n&&(c*=256);)r<0&&p===0&&this[e+i-1]!==0&&(p=1),this[e+i]=(r/c>>0)-p&255;return e+n};u.prototype.writeIntBE=function(r,e,n,o){if(r=+r,e=e|0,!o){var a=Math.pow(2,8*n-1);T(this,r,e,n,a-1,-a)}var i=n-1,c=1,p=0;for(this[e+i]=r&255;--i>=0&&(c*=256);)r<0&&p===0&&this[e+i+1]!==0&&(p=1),this[e+i]=(r/c>>0)-p&255;return e+n};u.prototype.writeInt8=function(r,e,n){return r=+r,e=e|0,n||T(this,r,e,1,127,-128),u.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),r<0&&(r=255+r+1),this[e]=r&255,e+1};u.prototype.writeInt16LE=function(r,e,n){return r=+r,e=e|0,n||T(this,r,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):er(this,r,e,!0),e+2};u.prototype.writeInt16BE=function(r,e,n){return r=+r,e=e|0,n||T(this,r,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):er(this,r,e,!1),e+2};u.prototype.writeInt32LE=function(r,e,n){return r=+r,e=e|0,n||T(this,r,e,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8,this[e+2]=r>>>16,this[e+3]=r>>>24):tr(this,r,e,!0),e+4};u.prototype.writeInt32BE=function(r,e,n){return r=+r,e=e|0,n||T(this,r,e,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),u.TYPED_ARRAY_SUPPORT?(this[e]=r>>>24,this[e+1]=r>>>16,this[e+2]=r>>>8,this[e+3]=r&255):tr(this,r,e,!1),e+4};function se(t,r,e,n,o,a){if(e+n>t.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function ce(t,r,e,n,o){return o||se(t,r,e,4),Zr(t,r,e,n,23,4),e+4}u.prototype.writeFloatLE=function(r,e,n){return ce(this,r,e,!0,n)};u.prototype.writeFloatBE=function(r,e,n){return ce(this,r,e,!1,n)};function ue(t,r,e,n,o){return o||se(t,r,e,8),Zr(t,r,e,n,52,8),e+8}u.prototype.writeDoubleLE=function(r,e,n){return ue(this,r,e,!0,n)};u.prototype.writeDoubleBE=function(r,e,n){return ue(this,r,e,!1,n)};u.prototype.copy=function(r,e,n,o){if(n||(n=0),!o&&o!==0&&(o=this.length),e>=r.length&&(e=r.length),e||(e=0),o>0&&o<n&&(o=n),o===n||r.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),r.length-e<o-n&&(o=r.length-e+n);var a=o-n,i;if(this===r&&n<e&&e<o)for(i=a-1;i>=0;--i)r[i+e]=this[i+n];else if(a<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i<a;++i)r[i+e]=this[i+n];else Uint8Array.prototype.set.call(r,this.subarray(n,n+a),e);return a};u.prototype.fill=function(r,e,n,o){if(typeof r=="string"){if(typeof e=="string"?(o=e,e=0,n=this.length):typeof n=="string"&&(o=n,n=this.length),r.length===1){var a=r.charCodeAt(0);a<256&&(r=a)}if(o!==void 0&&typeof o!="string")throw new TypeError("encoding must be a string");if(typeof o=="string"&&!u.isEncoding(o))throw new TypeError("Unknown encoding: "+o)}else typeof r=="number"&&(r=r&255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;e=e>>>0,n=n===void 0?this.length:n>>>0,r||(r=0);var i;if(typeof r=="number")for(i=e;i<n;++i)this[i]=r;else{var c=S(r)?r:Z(new u(r,o).toString()),p=c.length;for(i=0;i<n-e;++i)this[i+e]=c[i%p]}return this};var Qt=/[^+\/0-9A-Za-z-_]/g;function Zt(t){if(t=rn(t).replace(Qt,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function rn(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function en(t){return t<16?"0"+t.toString(16):t.toString(16)}function Z(t,r){r=r||1/0;for(var e,n=t.length,o=null,a=[],i=0;i<n;++i){if(e=t.charCodeAt(i),e>55295&&e<57344){if(!o){if(e>56319){(r-=3)>-1&&a.push(239,191,189);continue}else if(i+1===n){(r-=3)>-1&&a.push(239,191,189);continue}o=e;continue}if(e<56320){(r-=3)>-1&&a.push(239,191,189),o=e;continue}e=(o-55296<<10|e-56320)+65536}else o&&(r-=3)>-1&&a.push(239,191,189);if(o=null,e<128){if((r-=1)<0)break;a.push(e)}else if(e<2048){if((r-=2)<0)break;a.push(e>>6|192,e&63|128)}else if(e<65536){if((r-=3)<0)break;a.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((r-=4)<0)break;a.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return a}function tn(t){for(var r=[],e=0;e<t.length;++e)r.push(t.charCodeAt(e)&255);return r}function nn(t,r){for(var e,n,o,a=[],i=0;i<t.length&&!((r-=2)<0);++i)e=t.charCodeAt(i),n=e>>8,o=e%256,a.push(o),a.push(n);return a}function pe(t){return Bt(Zt(t))}function nr(t,r,e,n){for(var o=0;o<n&&!(o+e>=r.length||o>=t.length);++o)r[o+e]=t[o];return o}function on(t){return t!==t}function an(t){return t!=null&&(!!t._isBuffer||le(t)||sn(t))}function le(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function sn(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&le(t.slice(0,0))}import{encodeAddress as cn,decodeAddress as ps}from"algosdk";function Y(t){return t.reduce((r,e)=>Uint8Array.from([...r,...e]))}var me={V1_1:"v1_1",V2:"v2"},Rs={[me.V1_1]:{testnet:62368684,mainnet:552635992},[me.V2]:{testnet:148607e3,mainnet:1002541853}};var de=t=>pn.decodeAddress(t.toUpperCase()).publicKey;import*as E from"ethereumjs-util";function mn(t){return E.toUnsigned(new E.BN(String(t)))}function fe(t){let r=mn(t);if(r.length>32)throw new Error("Invalid value. The buffer length of the value is more than 32");return new Uint8Array(E.setLengthLeft(r,32))}var ge=t=>new Uint8Array(E.setLengthLeft(or(t),32)),or=t=>s.from(dn(t),"hex"),dn=t=>t.startsWith("0x")?t.slice(2):t;var Er=t=>new Uint8Array(E.keccak256(s.from(t)));var Ar=(t,r)=>r===8?de(t):r===1?be.decode(t):ge(t);import Oc from"algosdk";import Fc from"algosdk";import Xc from"algosdk";import nu from"algosdk";import Eu from"algosdk";var _n=(t,r)=>r===8?fe(+t):dr[t]?new Uint8Array(or(String(t))):Ar(String(t),r);var ye=(t,r)=>{let e=Te(t.address,t.chainId,r.address,r.chainId);return s.from(Er(e)).toString("hex")},Te=(t,r,e,n)=>{let o=Ar(t,r),a=_e.encodeUint64(r),i=_e.encodeUint64(n),c=_n(e,n);return Y([o,a,c,i])};var Ap=(t,{userId:r,chainId:e,price:n,side:o,type:a,amount:i,total:c,id:p})=>{let{baseAsset:f,priceAsset:d}=t,m={address:r,chainId:e},h=o===K.Buy?d:f;return{action:"order",actionId:p,account:m,token:h,amount:o===K.Buy?a===j.Market?fr(c,d.decimal):mr(zr(i,f.decimal),fr(n,d.decimal)):i,ts:Date.now()}},Tp=(t,r,e,n="0")=>({hash:ye(t,r),loginAddress:t.address,loginChainId:t.chainId,tokenId:r.address,tokenChainId:r.chainId,amount:e,lockedAmount:n});export{Ap as mapToBalanceInfo,Tp as mapToCodexBalance};
2
2
  /*!
3
3
  * The buffer module from node.js, for the browser.
4
4
  *
@@ -1,5 +1,5 @@
1
- function _r(){throw new Error("setTimeout has not been defined")}function Ir(){throw new Error("clearTimeout has not been defined")}var O=_r,k=Ir;typeof globalThis.setTimeout=="function"&&(O=setTimeout);typeof globalThis.clearTimeout=="function"&&(k=clearTimeout);function wr(t){if(O===setTimeout)return setTimeout(t,0);if((O===_r||!O)&&setTimeout)return O=setTimeout,setTimeout(t,0);try{return O(t,0)}catch{try{return O.call(null,t,0)}catch{return O.call(this,t,0)}}}function Ae(t){if(k===clearTimeout)return clearTimeout(t);if((k===Ir||!k)&&clearTimeout)return k=clearTimeout,clearTimeout(t);try{return k(t)}catch{try{return k.call(null,t)}catch{return k.call(this,t)}}}var B=[],G=!1,P,H=-1;function Te(){!G||!P||(G=!1,P.length?B=P.concat(B):H=-1,B.length&&Nr())}function Nr(){if(!G){var t=wr(Te);G=!0;for(var r=B.length;r;){for(P=B,B=[];++H<r;)P&&P[H].run();H=-1,r=B.length}P=null,G=!1,Ae(t)}}function ye(t){var r=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)r[e-1]=arguments[e];B.push(new Rr(t,r)),B.length===1&&!G&&wr(Nr)}function Rr(t,r){this.fun=t,this.array=r}Rr.prototype.run=function(){this.fun.apply(null,this.array)};var _e="browser",Ie="browser",we=!0,Ne={},Re=[],Se="",Be={},De={},Ce={};function U(){}var Oe=U,ke=U,Pe=U,Ue=U,Le=U,Me=U,ve=U;function Fe(t){throw new Error("process.binding is not supported")}function Ye(){return"/"}function Ge(t){throw new Error("process.chdir is not supported")}function We(){return 0}var Y=globalThis.performance||{},Ke=Y.now||Y.mozNow||Y.msNow||Y.oNow||Y.webkitNow||function(){return new Date().getTime()};function He(t){var r=Ke.call(Y)*.001,e=Math.floor(r),n=Math.floor(r%1*1e9);return t&&(e=e-t[0],n=n-t[1],n<0&&(e--,n+=1e9)),[e,n]}var Ve=new Date;function $e(){var t=new Date,r=t-Ve;return r/1e3}var m={nextTick:ye,title:_e,browser:we,env:Ne,argv:Re,version:Se,versions:Be,on:Oe,addListener:ke,once:Pe,off:Ue,removeListener:Le,removeAllListeners:Me,emit:ve,binding:Fe,cwd:Ye,chdir:Ge,umask:We,hrtime:He,platform:Ie,release:De,config:Ce,uptime:$e},yr={};Object.keys(yr).forEach(t=>{let r=t.split("."),e=m;for(let n=0;n<r.length;n++){let o=r[n];n===r.length-1?e[o]=yr[t]:e=e[o]||(e[o]={})}});var w=[],_=[],ze=typeof Uint8Array<"u"?Uint8Array:Array,pr=!1;function Cr(){pr=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,e=t.length;r<e;++r)w[r]=t[r],_[t.charCodeAt(r)]=r;_[45]=62,_[95]=63}function Xe(t){pr||Cr();var r,e,n,o,i,a,c=t.length;if(c%4>0)throw new Error("Invalid string. Length must be a multiple of 4");i=t[c-2]==="="?2:t[c-1]==="="?1:0,a=new ze(c*3/4-i),n=i>0?c-4:c;var p=0;for(r=0,e=0;r<n;r+=4,e+=3)o=_[t.charCodeAt(r)]<<18|_[t.charCodeAt(r+1)]<<12|_[t.charCodeAt(r+2)]<<6|_[t.charCodeAt(r+3)],a[p++]=o>>16&255,a[p++]=o>>8&255,a[p++]=o&255;return i===2?(o=_[t.charCodeAt(r)]<<2|_[t.charCodeAt(r+1)]>>4,a[p++]=o&255):i===1&&(o=_[t.charCodeAt(r)]<<10|_[t.charCodeAt(r+1)]<<4|_[t.charCodeAt(r+2)]>>2,a[p++]=o>>8&255,a[p++]=o&255),a}function qe(t){return w[t>>18&63]+w[t>>12&63]+w[t>>6&63]+w[t&63]}function Je(t,r,e){for(var n,o=[],i=r;i<e;i+=3)n=(t[i]<<16)+(t[i+1]<<8)+t[i+2],o.push(qe(n));return o.join("")}function Sr(t){pr||Cr();for(var r,e=t.length,n=e%3,o="",i=[],a=16383,c=0,p=e-n;c<p;c+=a)i.push(Je(t,c,c+a>p?p:c+a));return n===1?(r=t[e-1],o+=w[r>>2],o+=w[r<<4&63],o+="=="):n===2&&(r=(t[e-2]<<8)+t[e-1],o+=w[r>>10],o+=w[r>>4&63],o+=w[r<<2&63],o+="="),i.push(o),i.join("")}s.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;function V(){return s.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function D(t,r){if(V()<r)throw new RangeError("Invalid typed array length");return s.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(r),t.__proto__=s.prototype):(t===null&&(t=new s(r)),t.length=r),t}function s(t,r,e){if(!s.TYPED_ARRAY_SUPPORT&&!(this instanceof s))return new s(t,r,e);if(typeof t=="number"){if(typeof r=="string")throw new Error("If encoding is specified then the first argument must be a string");return lr(this,t)}return Or(this,t,r,e)}s.poolSize=8192;s._augment=function(t){return t.__proto__=s.prototype,t};function Or(t,r,e,n){if(typeof r=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&r instanceof ArrayBuffer?Ze(t,r,e,n):typeof r=="string"?Qe(t,r,e):rt(t,r)}s.from=function(t,r,e){return Or(null,t,r,e)};s.kMaxLength=V();s.TYPED_ARRAY_SUPPORT&&(s.prototype.__proto__=Uint8Array.prototype,s.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&s[Symbol.species]);function kr(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 je(t,r,e,n){return kr(r),r<=0?D(t,r):e!==void 0?typeof n=="string"?D(t,r).fill(e,n):D(t,r).fill(e):D(t,r)}s.alloc=function(t,r,e){return je(null,t,r,e)};function lr(t,r){if(kr(r),t=D(t,r<0?0:mr(r)|0),!s.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}s.allocUnsafe=function(t){return lr(null,t)};s.allocUnsafeSlow=function(t){return lr(null,t)};function Qe(t,r,e){if((typeof e!="string"||e==="")&&(e="utf8"),!s.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var n=Pr(r,e)|0;t=D(t,n);var o=t.write(r,e);return o!==n&&(t=t.slice(0,o)),t}function ur(t,r){var e=r.length<0?0:mr(r.length)|0;t=D(t,e);for(var n=0;n<e;n+=1)t[n]=r[n]&255;return t}function Ze(t,r,e,n){if(r.byteLength,e<0||r.byteLength<e)throw new RangeError("'offset' is out of bounds");if(r.byteLength<e+(n||0))throw new RangeError("'length' is out of bounds");return e===void 0&&n===void 0?r=new Uint8Array(r):n===void 0?r=new Uint8Array(r,e):r=new Uint8Array(r,e,n),s.TYPED_ARRAY_SUPPORT?(t=r,t.__proto__=s.prototype):t=ur(t,r),t}function rt(t,r){if(N(r)){var e=mr(r.length)|0;return t=D(t,e),t.length===0||r.copy(t,0,0,e),t}if(r){if(typeof ArrayBuffer<"u"&&r.buffer instanceof ArrayBuffer||"length"in r)return typeof r.length!="number"||Et(r.length)?D(t,0):ur(t,r);if(r.type==="Buffer"&&Array.isArray(r.data))return ur(t,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function mr(t){if(t>=V())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+V().toString(16)+" bytes");return t|0}s.isBuffer=At;function N(t){return!!(t!=null&&t._isBuffer)}s.compare=function(r,e){if(!N(r)||!N(e))throw new TypeError("Arguments must be Buffers");if(r===e)return 0;for(var n=r.length,o=e.length,i=0,a=Math.min(n,o);i<a;++i)if(r[i]!==e[i]){n=r[i],o=e[i];break}return n<o?-1:o<n?1:0};s.isEncoding=function(r){switch(String(r).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(r,e){if(!Array.isArray(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return s.alloc(0);var n;if(e===void 0)for(e=0,n=0;n<r.length;++n)e+=r[n].length;var o=s.allocUnsafe(e),i=0;for(n=0;n<r.length;++n){var a=r[n];if(!N(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(o,i),i+=a.length}return o};function Pr(t,r){if(N(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 e=t.length;if(e===0)return 0;for(var n=!1;;)switch(r){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return $(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return Gr(t).length;default:if(n)return $(t).length;r=(""+r).toLowerCase(),n=!0}}s.byteLength=Pr;function et(t,r,e){var n=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((e===void 0||e>this.length)&&(e=this.length),e<=0)||(e>>>=0,r>>>=0,e<=r))return"";for(t||(t="utf8");;)switch(t){case"hex":return lt(this,r,e);case"utf8":case"utf-8":return Mr(this,r,e);case"ascii":return ut(this,r,e);case"latin1":case"binary":return pt(this,r,e);case"base64":return st(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return mt(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}s.prototype._isBuffer=!0;function L(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}s.prototype.swap16=function(){var r=this.length;if(r%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<r;e+=2)L(this,e,e+1);return this};s.prototype.swap32=function(){var r=this.length;if(r%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<r;e+=4)L(this,e,e+3),L(this,e+1,e+2);return this};s.prototype.swap64=function(){var r=this.length;if(r%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<r;e+=8)L(this,e,e+7),L(this,e+1,e+6),L(this,e+2,e+5),L(this,e+3,e+4);return this};s.prototype.toString=function(){var r=this.length|0;return r===0?"":arguments.length===0?Mr(this,0,r):et.apply(this,arguments)};s.prototype.equals=function(r){if(!N(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:s.compare(this,r)===0};s.prototype.compare=function(r,e,n,o,i){if(!N(r))throw new TypeError("Argument must be a Buffer");if(e===void 0&&(e=0),n===void 0&&(n=r?r.length:0),o===void 0&&(o=0),i===void 0&&(i=this.length),e<0||n>r.length||o<0||i>this.length)throw new RangeError("out of range index");if(o>=i&&e>=n)return 0;if(o>=i)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,o>>>=0,i>>>=0,this===r)return 0;for(var a=i-o,c=n-e,p=Math.min(a,c),d=this.slice(o,i),f=r.slice(e,n),l=0;l<p;++l)if(d[l]!==f[l]){a=d[l],c=f[l];break}return a<c?-1:c<a?1:0};function Ur(t,r,e,n,o){if(t.length===0)return-1;if(typeof e=="string"?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=o?0:t.length-1),e<0&&(e=t.length+e),e>=t.length){if(o)return-1;e=t.length-1}else if(e<0)if(o)e=0;else return-1;if(typeof r=="string"&&(r=s.from(r,n)),N(r))return r.length===0?-1:Br(t,r,e,n,o);if(typeof r=="number")return r=r&255,s.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?o?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):Br(t,[r],e,n,o);throw new TypeError("val must be string, number or Buffer")}function Br(t,r,e,n,o){var i=1,a=t.length,c=r.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||r.length<2)return-1;i=2,a/=2,c/=2,e/=2}function p(g,y){return i===1?g[y]:g.readUInt16BE(y*i)}var d;if(o){var f=-1;for(d=e;d<a;d++)if(p(t,d)===p(r,f===-1?0:d-f)){if(f===-1&&(f=d),d-f+1===c)return f*i}else f!==-1&&(d-=d-f),f=-1}else for(e+c>a&&(e=a-c),d=e;d>=0;d--){for(var l=!0,h=0;h<c;h++)if(p(t,d+h)!==p(r,h)){l=!1;break}if(l)return d}return-1}s.prototype.includes=function(r,e,n){return this.indexOf(r,e,n)!==-1};s.prototype.indexOf=function(r,e,n){return Ur(this,r,e,n,!0)};s.prototype.lastIndexOf=function(r,e,n){return Ur(this,r,e,n,!1)};function tt(t,r,e,n){e=Number(e)||0;var o=t.length-e;n?(n=Number(n),n>o&&(n=o)):n=o;var i=r.length;if(i%2!==0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var a=0;a<n;++a){var c=parseInt(r.substr(a*2,2),16);if(isNaN(c))return a;t[e+a]=c}return a}function nt(t,r,e,n){return q($(r,t.length-e),t,e,n)}function Lr(t,r,e,n){return q(xt(r),t,e,n)}function ot(t,r,e,n){return Lr(t,r,e,n)}function it(t,r,e,n){return q(Gr(r),t,e,n)}function at(t,r,e,n){return q(bt(r,t.length-e),t,e,n)}s.prototype.write=function(r,e,n,o){if(e===void 0)o="utf8",n=this.length,e=0;else if(n===void 0&&typeof e=="string")o=e,n=this.length,e=0;else if(isFinite(e))e=e|0,isFinite(n)?(n=n|0,o===void 0&&(o="utf8")):(o=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var i=this.length-e;if((n===void 0||n>i)&&(n=i),r.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");o||(o="utf8");for(var a=!1;;)switch(o){case"hex":return tt(this,r,e,n);case"utf8":case"utf-8":return nt(this,r,e,n);case"ascii":return Lr(this,r,e,n);case"latin1":case"binary":return ot(this,r,e,n);case"base64":return it(this,r,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return at(this,r,e,n);default:if(a)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),a=!0}};s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function st(t,r,e){return r===0&&e===t.length?Sr(t):Sr(t.slice(r,e))}function Mr(t,r,e){e=Math.min(t.length,e);for(var n=[],o=r;o<e;){var i=t[o],a=null,c=i>239?4:i>223?3:i>191?2:1;if(o+c<=e){var p,d,f,l;switch(c){case 1:i<128&&(a=i);break;case 2:p=t[o+1],(p&192)===128&&(l=(i&31)<<6|p&63,l>127&&(a=l));break;case 3:p=t[o+1],d=t[o+2],(p&192)===128&&(d&192)===128&&(l=(i&15)<<12|(p&63)<<6|d&63,l>2047&&(l<55296||l>57343)&&(a=l));break;case 4:p=t[o+1],d=t[o+2],f=t[o+3],(p&192)===128&&(d&192)===128&&(f&192)===128&&(l=(i&15)<<18|(p&63)<<12|(d&63)<<6|f&63,l>65535&&l<1114112&&(a=l))}}a===null?(a=65533,c=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|a&1023),n.push(a),o+=c}return ct(n)}var Dr=4096;function ct(t){var r=t.length;if(r<=Dr)return String.fromCharCode.apply(String,t);for(var e="",n=0;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=Dr));return e}function ut(t,r,e){var n="";e=Math.min(t.length,e);for(var o=r;o<e;++o)n+=String.fromCharCode(t[o]&127);return n}function pt(t,r,e){var n="";e=Math.min(t.length,e);for(var o=r;o<e;++o)n+=String.fromCharCode(t[o]);return n}function lt(t,r,e){var n=t.length;(!r||r<0)&&(r=0),(!e||e<0||e>n)&&(e=n);for(var o="",i=r;i<e;++i)o+=ht(t[i]);return o}function mt(t,r,e){for(var n=t.slice(r,e),o="",i=0;i<n.length;i+=2)o+=String.fromCharCode(n[i]+n[i+1]*256);return o}s.prototype.slice=function(r,e){var n=this.length;r=~~r,e=e===void 0?n:~~e,r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),e<r&&(e=r);var o;if(s.TYPED_ARRAY_SUPPORT)o=this.subarray(r,e),o.__proto__=s.prototype;else{var i=e-r;o=new s(i,void 0);for(var a=0;a<i;++a)o[a]=this[a+r]}return o};function x(t,r,e){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+r>e)throw new RangeError("Trying to access beyond buffer length")}s.prototype.readUIntLE=function(r,e,n){r=r|0,e=e|0,n||x(r,e,this.length);for(var o=this[r],i=1,a=0;++a<e&&(i*=256);)o+=this[r+a]*i;return o};s.prototype.readUIntBE=function(r,e,n){r=r|0,e=e|0,n||x(r,e,this.length);for(var o=this[r+--e],i=1;e>0&&(i*=256);)o+=this[r+--e]*i;return o};s.prototype.readUInt8=function(r,e){return e||x(r,1,this.length),this[r]};s.prototype.readUInt16LE=function(r,e){return e||x(r,2,this.length),this[r]|this[r+1]<<8};s.prototype.readUInt16BE=function(r,e){return e||x(r,2,this.length),this[r]<<8|this[r+1]};s.prototype.readUInt32LE=function(r,e){return e||x(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216};s.prototype.readUInt32BE=function(r,e){return e||x(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])};s.prototype.readIntLE=function(r,e,n){r=r|0,e=e|0,n||x(r,e,this.length);for(var o=this[r],i=1,a=0;++a<e&&(i*=256);)o+=this[r+a]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o};s.prototype.readIntBE=function(r,e,n){r=r|0,e=e|0,n||x(r,e,this.length);for(var o=e,i=1,a=this[r+--o];o>0&&(i*=256);)a+=this[r+--o]*i;return i*=128,a>=i&&(a-=Math.pow(2,8*e)),a};s.prototype.readInt8=function(r,e){return e||x(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};s.prototype.readInt16LE=function(r,e){e||x(r,2,this.length);var n=this[r]|this[r+1]<<8;return n&32768?n|4294901760:n};s.prototype.readInt16BE=function(r,e){e||x(r,2,this.length);var n=this[r+1]|this[r]<<8;return n&32768?n|4294901760:n};s.prototype.readInt32LE=function(r,e){return e||x(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24};s.prototype.readInt32BE=function(r,e){return e||x(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]};s.prototype.readFloatLE=function(r,e){return e||x(r,4,this.length),J(this,r,!0,23,4)};s.prototype.readFloatBE=function(r,e){return e||x(r,4,this.length),J(this,r,!1,23,4)};s.prototype.readDoubleLE=function(r,e){return e||x(r,8,this.length),J(this,r,!0,52,8)};s.prototype.readDoubleBE=function(r,e){return e||x(r,8,this.length),J(this,r,!1,52,8)};function A(t,r,e,n,o,i){if(!N(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>o||r<i)throw new RangeError('"value" argument is out of bounds');if(e+n>t.length)throw new RangeError("Index out of range")}s.prototype.writeUIntLE=function(r,e,n,o){if(r=+r,e=e|0,n=n|0,!o){var i=Math.pow(2,8*n)-1;A(this,r,e,n,i,0)}var a=1,c=0;for(this[e]=r&255;++c<n&&(a*=256);)this[e+c]=r/a&255;return e+n};s.prototype.writeUIntBE=function(r,e,n,o){if(r=+r,e=e|0,n=n|0,!o){var i=Math.pow(2,8*n)-1;A(this,r,e,n,i,0)}var a=n-1,c=1;for(this[e+a]=r&255;--a>=0&&(c*=256);)this[e+a]=r/c&255;return e+n};s.prototype.writeUInt8=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,1,255,0),s.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),this[e]=r&255,e+1};function z(t,r,e,n){r<0&&(r=65535+r+1);for(var o=0,i=Math.min(t.length-e,2);o<i;++o)t[e+o]=(r&255<<8*(n?o:1-o))>>>(n?o:1-o)*8}s.prototype.writeUInt16LE=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):z(this,r,e,!0),e+2};s.prototype.writeUInt16BE=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):z(this,r,e,!1),e+2};function X(t,r,e,n){r<0&&(r=4294967295+r+1);for(var o=0,i=Math.min(t.length-e,4);o<i;++o)t[e+o]=r>>>(n?o:3-o)*8&255}s.prototype.writeUInt32LE=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[e+3]=r>>>24,this[e+2]=r>>>16,this[e+1]=r>>>8,this[e]=r&255):X(this,r,e,!0),e+4};s.prototype.writeUInt32BE=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[e]=r>>>24,this[e+1]=r>>>16,this[e+2]=r>>>8,this[e+3]=r&255):X(this,r,e,!1),e+4};s.prototype.writeIntLE=function(r,e,n,o){if(r=+r,e=e|0,!o){var i=Math.pow(2,8*n-1);A(this,r,e,n,i-1,-i)}var a=0,c=1,p=0;for(this[e]=r&255;++a<n&&(c*=256);)r<0&&p===0&&this[e+a-1]!==0&&(p=1),this[e+a]=(r/c>>0)-p&255;return e+n};s.prototype.writeIntBE=function(r,e,n,o){if(r=+r,e=e|0,!o){var i=Math.pow(2,8*n-1);A(this,r,e,n,i-1,-i)}var a=n-1,c=1,p=0;for(this[e+a]=r&255;--a>=0&&(c*=256);)r<0&&p===0&&this[e+a+1]!==0&&(p=1),this[e+a]=(r/c>>0)-p&255;return e+n};s.prototype.writeInt8=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,1,127,-128),s.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),r<0&&(r=255+r+1),this[e]=r&255,e+1};s.prototype.writeInt16LE=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):z(this,r,e,!0),e+2};s.prototype.writeInt16BE=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):z(this,r,e,!1),e+2};s.prototype.writeInt32LE=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,4,2147483647,-2147483648),s.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8,this[e+2]=r>>>16,this[e+3]=r>>>24):X(this,r,e,!0),e+4};s.prototype.writeInt32BE=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),s.TYPED_ARRAY_SUPPORT?(this[e]=r>>>24,this[e+1]=r>>>16,this[e+2]=r>>>8,this[e+3]=r&255):X(this,r,e,!1),e+4};function vr(t,r,e,n,o,i){if(e+n>t.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function Fr(t,r,e,n,o){return o||vr(t,r,e,4,34028234663852886e22,-34028234663852886e22),Kr(t,r,e,n,23,4),e+4}s.prototype.writeFloatLE=function(r,e,n){return Fr(this,r,e,!0,n)};s.prototype.writeFloatBE=function(r,e,n){return Fr(this,r,e,!1,n)};function Yr(t,r,e,n,o){return o||vr(t,r,e,8,17976931348623157e292,-17976931348623157e292),Kr(t,r,e,n,52,8),e+8}s.prototype.writeDoubleLE=function(r,e,n){return Yr(this,r,e,!0,n)};s.prototype.writeDoubleBE=function(r,e,n){return Yr(this,r,e,!1,n)};s.prototype.copy=function(r,e,n,o){if(n||(n=0),!o&&o!==0&&(o=this.length),e>=r.length&&(e=r.length),e||(e=0),o>0&&o<n&&(o=n),o===n||r.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),r.length-e<o-n&&(o=r.length-e+n);var i=o-n,a;if(this===r&&n<e&&e<o)for(a=i-1;a>=0;--a)r[a+e]=this[a+n];else if(i<1e3||!s.TYPED_ARRAY_SUPPORT)for(a=0;a<i;++a)r[a+e]=this[a+n];else Uint8Array.prototype.set.call(r,this.subarray(n,n+i),e);return i};s.prototype.fill=function(r,e,n,o){if(typeof r=="string"){if(typeof e=="string"?(o=e,e=0,n=this.length):typeof n=="string"&&(o=n,n=this.length),r.length===1){var i=r.charCodeAt(0);i<256&&(r=i)}if(o!==void 0&&typeof o!="string")throw new TypeError("encoding must be a string");if(typeof o=="string"&&!s.isEncoding(o))throw new TypeError("Unknown encoding: "+o)}else typeof r=="number"&&(r=r&255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;e=e>>>0,n=n===void 0?this.length:n>>>0,r||(r=0);var a;if(typeof r=="number")for(a=e;a<n;++a)this[a]=r;else{var c=N(r)?r:$(new s(r,o).toString()),p=c.length;for(a=0;a<n-e;++a)this[a+e]=c[a%p]}return this};var dt=/[^+\/0-9A-Za-z-_]/g;function ft(t){if(t=gt(t).replace(dt,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function gt(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function ht(t){return t<16?"0"+t.toString(16):t.toString(16)}function $(t,r){r=r||1/0;for(var e,n=t.length,o=null,i=[],a=0;a<n;++a){if(e=t.charCodeAt(a),e>55295&&e<57344){if(!o){if(e>56319){(r-=3)>-1&&i.push(239,191,189);continue}else if(a+1===n){(r-=3)>-1&&i.push(239,191,189);continue}o=e;continue}if(e<56320){(r-=3)>-1&&i.push(239,191,189),o=e;continue}e=(o-55296<<10|e-56320)+65536}else o&&(r-=3)>-1&&i.push(239,191,189);if(o=null,e<128){if((r-=1)<0)break;i.push(e)}else if(e<2048){if((r-=2)<0)break;i.push(e>>6|192,e&63|128)}else if(e<65536){if((r-=3)<0)break;i.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((r-=4)<0)break;i.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return i}function xt(t){for(var r=[],e=0;e<t.length;++e)r.push(t.charCodeAt(e)&255);return r}function bt(t,r){for(var e,n,o,i=[],a=0;a<t.length&&!((r-=2)<0);++a)e=t.charCodeAt(a),n=e>>8,o=e%256,i.push(o),i.push(n);return i}function Gr(t){return Xe(ft(t))}function q(t,r,e,n){for(var o=0;o<n&&!(o+e>=r.length||o>=t.length);++o)r[o+e]=t[o];return o}function Et(t){return t!==t}function At(t){return t!=null&&(!!t._isBuffer||Wr(t)||Tt(t))}function Wr(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function Tt(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&Wr(t.slice(0,0))}function J(t,r,e,n,o){var i,a,c=o*8-n-1,p=(1<<c)-1,d=p>>1,f=-7,l=e?o-1:0,h=e?-1:1,g=t[r+l];for(l+=h,i=g&(1<<-f)-1,g>>=-f,f+=c;f>0;i=i*256+t[r+l],l+=h,f-=8);for(a=i&(1<<-f)-1,i>>=-f,f+=n;f>0;a=a*256+t[r+l],l+=h,f-=8);if(i===0)i=1-d;else{if(i===p)return a?NaN:(g?-1:1)*(1/0);a=a+Math.pow(2,n),i=i-d}return(g?-1:1)*a*Math.pow(2,i-n)}function Kr(t,r,e,n,o,i){var a,c,p,d=i*8-o-1,f=(1<<d)-1,l=f>>1,h=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,g=n?0:i-1,y=n?1:-1,cr=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(c=isNaN(r)?1:0,a=f):(a=Math.floor(Math.log(r)/Math.LN2),r*(p=Math.pow(2,-a))<1&&(a--,p*=2),a+l>=1?r+=h/p:r+=h*Math.pow(2,1-l),r*p>=2&&(a++,p/=2),a+l>=f?(c=0,a=f):a+l>=1?(c=(r*p-1)*Math.pow(2,o),a=a+l):(c=r*Math.pow(2,l-1)*Math.pow(2,o),a=0));o>=8;t[e+g]=c&255,g+=y,c/=256,o-=8);for(a=a<<o|c,d+=o;d>0;t[e+g]=a&255,g+=y,a/=256,d-=8);t[e+g-y]|=cr*128}import gn from"algosdk";import*as Tr from"bs58";import nn from"algosdk";import kn,{decodeAddress as Pn,encodeAddress as Un}from"algosdk";var R=[],I=[],yt=typeof Uint8Array<"u"?Uint8Array:Array,fr=!1;function zr(){fr=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,e=t.length;r<e;++r)R[r]=t[r],I[t.charCodeAt(r)]=r;I[45]=62,I[95]=63}function _t(t){fr||zr();var r,e,n,o,i,a,c=t.length;if(c%4>0)throw new Error("Invalid string. Length must be a multiple of 4");i=t[c-2]==="="?2:t[c-1]==="="?1:0,a=new yt(c*3/4-i),n=i>0?c-4:c;var p=0;for(r=0,e=0;r<n;r+=4,e+=3)o=I[t.charCodeAt(r)]<<18|I[t.charCodeAt(r+1)]<<12|I[t.charCodeAt(r+2)]<<6|I[t.charCodeAt(r+3)],a[p++]=o>>16&255,a[p++]=o>>8&255,a[p++]=o&255;return i===2?(o=I[t.charCodeAt(r)]<<2|I[t.charCodeAt(r+1)]>>4,a[p++]=o&255):i===1&&(o=I[t.charCodeAt(r)]<<10|I[t.charCodeAt(r+1)]<<4|I[t.charCodeAt(r+2)]>>2,a[p++]=o>>8&255,a[p++]=o&255),a}function It(t){return R[t>>18&63]+R[t>>12&63]+R[t>>6&63]+R[t&63]}function wt(t,r,e){for(var n,o=[],i=r;i<e;i+=3)n=(t[i]<<16)+(t[i+1]<<8)+t[i+2],o.push(It(n));return o.join("")}function Hr(t){fr||zr();for(var r,e=t.length,n=e%3,o="",i=[],a=16383,c=0,p=e-n;c<p;c+=a)i.push(wt(t,c,c+a>p?p:c+a));return n===1?(r=t[e-1],o+=R[r>>2],o+=R[r<<4&63],o+="=="):n===2&&(r=(t[e-2]<<8)+t[e-1],o+=R[r>>10],o+=R[r>>4&63],o+=R[r<<2&63],o+="="),i.push(o),i.join("")}function Z(t,r,e,n,o){var i,a,c=o*8-n-1,p=(1<<c)-1,d=p>>1,f=-7,l=e?o-1:0,h=e?-1:1,g=t[r+l];for(l+=h,i=g&(1<<-f)-1,g>>=-f,f+=c;f>0;i=i*256+t[r+l],l+=h,f-=8);for(a=i&(1<<-f)-1,i>>=-f,f+=n;f>0;a=a*256+t[r+l],l+=h,f-=8);if(i===0)i=1-d;else{if(i===p)return a?NaN:(g?-1:1)*(1/0);a=a+Math.pow(2,n),i=i-d}return(g?-1:1)*a*Math.pow(2,i-n)}function Xr(t,r,e,n,o,i){var a,c,p,d=i*8-o-1,f=(1<<d)-1,l=f>>1,h=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,g=n?0:i-1,y=n?1:-1,cr=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(c=isNaN(r)?1:0,a=f):(a=Math.floor(Math.log(r)/Math.LN2),r*(p=Math.pow(2,-a))<1&&(a--,p*=2),a+l>=1?r+=h/p:r+=h*Math.pow(2,1-l),r*p>=2&&(a++,p/=2),a+l>=f?(c=0,a=f):a+l>=1?(c=(r*p-1)*Math.pow(2,o),a=a+l):(c=r*Math.pow(2,l-1)*Math.pow(2,o),a=0));o>=8;t[e+g]=c&255,g+=y,c/=256,o-=8);for(a=a<<o|c,d+=o;d>0;t[e+g]=a&255,g+=y,a/=256,d-=8);t[e+g-y]|=cr*128}var Nt={}.toString,qr=Array.isArray||function(t){return Nt.call(t)=="[object Array]"};var Rt=50;u.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;var Sn=j();function j(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function C(t,r){if(j()<r)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(r),t.__proto__=u.prototype):(t===null&&(t=new u(r)),t.length=r),t}function u(t,r,e){if(!u.TYPED_ARRAY_SUPPORT&&!(this instanceof u))return new u(t,r,e);if(typeof t=="number"){if(typeof r=="string")throw new Error("If encoding is specified then the first argument must be a string");return gr(this,t)}return Jr(this,t,r,e)}u.poolSize=8192;u._augment=function(t){return t.__proto__=u.prototype,t};function Jr(t,r,e,n){if(typeof r=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&r instanceof ArrayBuffer?Dt(t,r,e,n):typeof r=="string"?Bt(t,r,e):Ct(t,r)}u.from=function(t,r,e){return Jr(null,t,r,e)};u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array);function jr(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 St(t,r,e,n){return jr(r),r<=0?C(t,r):e!==void 0?typeof n=="string"?C(t,r).fill(e,n):C(t,r).fill(e):C(t,r)}u.alloc=function(t,r,e){return St(null,t,r,e)};function gr(t,r){if(jr(r),t=C(t,r<0?0:hr(r)|0),!u.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}u.allocUnsafe=function(t){return gr(null,t)};u.allocUnsafeSlow=function(t){return gr(null,t)};function Bt(t,r,e){if((typeof e!="string"||e==="")&&(e="utf8"),!u.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var n=Qr(r,e)|0;t=C(t,n);var o=t.write(r,e);return o!==n&&(t=t.slice(0,o)),t}function dr(t,r){var e=r.length<0?0:hr(r.length)|0;t=C(t,e);for(var n=0;n<e;n+=1)t[n]=r[n]&255;return t}function Dt(t,r,e,n){if(r.byteLength,e<0||r.byteLength<e)throw new RangeError("'offset' is out of bounds");if(r.byteLength<e+(n||0))throw new RangeError("'length' is out of bounds");return e===void 0&&n===void 0?r=new Uint8Array(r):n===void 0?r=new Uint8Array(r,e):r=new Uint8Array(r,e,n),u.TYPED_ARRAY_SUPPORT?(t=r,t.__proto__=u.prototype):t=dr(t,r),t}function Ct(t,r){if(S(r)){var e=hr(r.length)|0;return t=C(t,e),t.length===0||r.copy(t,0,0,e),t}if(r){if(typeof ArrayBuffer<"u"&&r.buffer instanceof ArrayBuffer||"length"in r)return typeof r.length!="number"||Jt(r.length)?C(t,0):dr(t,r);if(r.type==="Buffer"&&qr(r.data))return dr(t,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function hr(t){if(t>=j())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+j().toString(16)+" bytes");return t|0}u.isBuffer=jt;function S(t){return!!(t!=null&&t._isBuffer)}u.compare=function(r,e){if(!S(r)||!S(e))throw new TypeError("Arguments must be Buffers");if(r===e)return 0;for(var n=r.length,o=e.length,i=0,a=Math.min(n,o);i<a;++i)if(r[i]!==e[i]){n=r[i],o=e[i];break}return n<o?-1:o<n?1:0};u.isEncoding=function(r){switch(String(r).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}};u.concat=function(r,e){if(!qr(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return u.alloc(0);var n;if(e===void 0)for(e=0,n=0;n<r.length;++n)e+=r[n].length;var o=u.allocUnsafe(e),i=0;for(n=0;n<r.length;++n){var a=r[n];if(!S(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(o,i),i+=a.length}return o};function Qr(t,r){if(S(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 e=t.length;if(e===0)return 0;for(var n=!1;;)switch(r){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return Q(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return ie(t).length;default:if(n)return Q(t).length;r=(""+r).toLowerCase(),n=!0}}u.byteLength=Qr;function Ot(t,r,e){var n=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((e===void 0||e>this.length)&&(e=this.length),e<=0)||(e>>>=0,r>>>=0,e<=r))return"";for(t||(t="utf8");;)switch(t){case"hex":return Wt(this,r,e);case"utf8":case"utf-8":return ee(this,r,e);case"ascii":return Yt(this,r,e);case"latin1":case"binary":return Gt(this,r,e);case"base64":return vt(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Kt(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}u.prototype._isBuffer=!0;function M(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}u.prototype.swap16=function(){var r=this.length;if(r%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<r;e+=2)M(this,e,e+1);return this};u.prototype.swap32=function(){var r=this.length;if(r%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<r;e+=4)M(this,e,e+3),M(this,e+1,e+2);return this};u.prototype.swap64=function(){var r=this.length;if(r%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<r;e+=8)M(this,e,e+7),M(this,e+1,e+6),M(this,e+2,e+5),M(this,e+3,e+4);return this};u.prototype.toString=function(){var r=this.length|0;return r===0?"":arguments.length===0?ee(this,0,r):Ot.apply(this,arguments)};u.prototype.equals=function(r){if(!S(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:u.compare(this,r)===0};u.prototype.inspect=function(){var r="",e=Rt;return this.length>0&&(r=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(r+=" ... ")),"<Buffer "+r+">"};u.prototype.compare=function(r,e,n,o,i){if(!S(r))throw new TypeError("Argument must be a Buffer");if(e===void 0&&(e=0),n===void 0&&(n=r?r.length:0),o===void 0&&(o=0),i===void 0&&(i=this.length),e<0||n>r.length||o<0||i>this.length)throw new RangeError("out of range index");if(o>=i&&e>=n)return 0;if(o>=i)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,o>>>=0,i>>>=0,this===r)return 0;for(var a=i-o,c=n-e,p=Math.min(a,c),d=this.slice(o,i),f=r.slice(e,n),l=0;l<p;++l)if(d[l]!==f[l]){a=d[l],c=f[l];break}return a<c?-1:c<a?1:0};function Zr(t,r,e,n,o){if(t.length===0)return-1;if(typeof e=="string"?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=o?0:t.length-1),e<0&&(e=t.length+e),e>=t.length){if(o)return-1;e=t.length-1}else if(e<0)if(o)e=0;else return-1;if(typeof r=="string"&&(r=u.from(r,n)),S(r))return r.length===0?-1:Vr(t,r,e,n,o);if(typeof r=="number")return r=r&255,u.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?o?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):Vr(t,[r],e,n,o);throw new TypeError("val must be string, number or Buffer")}function Vr(t,r,e,n,o){var i=1,a=t.length,c=r.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||r.length<2)return-1;i=2,a/=2,c/=2,e/=2}function p(g,y){return i===1?g[y]:g.readUInt16BE(y*i)}var d;if(o){var f=-1;for(d=e;d<a;d++)if(p(t,d)===p(r,f===-1?0:d-f)){if(f===-1&&(f=d),d-f+1===c)return f*i}else f!==-1&&(d-=d-f),f=-1}else for(e+c>a&&(e=a-c),d=e;d>=0;d--){for(var l=!0,h=0;h<c;h++)if(p(t,d+h)!==p(r,h)){l=!1;break}if(l)return d}return-1}u.prototype.includes=function(r,e,n){return this.indexOf(r,e,n)!==-1};u.prototype.indexOf=function(r,e,n){return Zr(this,r,e,n,!0)};u.prototype.lastIndexOf=function(r,e,n){return Zr(this,r,e,n,!1)};function kt(t,r,e,n){e=Number(e)||0;var o=t.length-e;n?(n=Number(n),n>o&&(n=o)):n=o;var i=r.length;if(i%2!==0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var a=0;a<n;++a){var c=parseInt(r.substr(a*2,2),16);if(isNaN(c))return a;t[e+a]=c}return a}function Pt(t,r,e,n){return tr(Q(r,t.length-e),t,e,n)}function re(t,r,e,n){return tr(Xt(r),t,e,n)}function Ut(t,r,e,n){return re(t,r,e,n)}function Lt(t,r,e,n){return tr(ie(r),t,e,n)}function Mt(t,r,e,n){return tr(qt(r,t.length-e),t,e,n)}u.prototype.write=function(r,e,n,o){if(e===void 0)o="utf8",n=this.length,e=0;else if(n===void 0&&typeof e=="string")o=e,n=this.length,e=0;else if(isFinite(e))e=e|0,isFinite(n)?(n=n|0,o===void 0&&(o="utf8")):(o=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var i=this.length-e;if((n===void 0||n>i)&&(n=i),r.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");o||(o="utf8");for(var a=!1;;)switch(o){case"hex":return kt(this,r,e,n);case"utf8":case"utf-8":return Pt(this,r,e,n);case"ascii":return re(this,r,e,n);case"latin1":case"binary":return Ut(this,r,e,n);case"base64":return Lt(this,r,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Mt(this,r,e,n);default:if(a)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),a=!0}};u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function vt(t,r,e){return r===0&&e===t.length?Hr(t):Hr(t.slice(r,e))}function ee(t,r,e){e=Math.min(t.length,e);for(var n=[],o=r;o<e;){var i=t[o],a=null,c=i>239?4:i>223?3:i>191?2:1;if(o+c<=e){var p,d,f,l;switch(c){case 1:i<128&&(a=i);break;case 2:p=t[o+1],(p&192)===128&&(l=(i&31)<<6|p&63,l>127&&(a=l));break;case 3:p=t[o+1],d=t[o+2],(p&192)===128&&(d&192)===128&&(l=(i&15)<<12|(p&63)<<6|d&63,l>2047&&(l<55296||l>57343)&&(a=l));break;case 4:p=t[o+1],d=t[o+2],f=t[o+3],(p&192)===128&&(d&192)===128&&(f&192)===128&&(l=(i&15)<<18|(p&63)<<12|(d&63)<<6|f&63,l>65535&&l<1114112&&(a=l))}}a===null?(a=65533,c=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|a&1023),n.push(a),o+=c}return Ft(n)}var $r=4096;function Ft(t){var r=t.length;if(r<=$r)return String.fromCharCode.apply(String,t);for(var e="",n=0;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=$r));return e}function Yt(t,r,e){var n="";e=Math.min(t.length,e);for(var o=r;o<e;++o)n+=String.fromCharCode(t[o]&127);return n}function Gt(t,r,e){var n="";e=Math.min(t.length,e);for(var o=r;o<e;++o)n+=String.fromCharCode(t[o]);return n}function Wt(t,r,e){var n=t.length;(!r||r<0)&&(r=0),(!e||e<0||e>n)&&(e=n);for(var o="",i=r;i<e;++i)o+=zt(t[i]);return o}function Kt(t,r,e){for(var n=t.slice(r,e),o="",i=0;i<n.length;i+=2)o+=String.fromCharCode(n[i]+n[i+1]*256);return o}u.prototype.slice=function(r,e){var n=this.length;r=~~r,e=e===void 0?n:~~e,r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),e<r&&(e=r);var o;if(u.TYPED_ARRAY_SUPPORT)o=this.subarray(r,e),o.__proto__=u.prototype;else{var i=e-r;o=new u(i,void 0);for(var a=0;a<i;++a)o[a]=this[a+r]}return o};function b(t,r,e){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+r>e)throw new RangeError("Trying to access beyond buffer length")}u.prototype.readUIntLE=function(r,e,n){r=r|0,e=e|0,n||b(r,e,this.length);for(var o=this[r],i=1,a=0;++a<e&&(i*=256);)o+=this[r+a]*i;return o};u.prototype.readUIntBE=function(r,e,n){r=r|0,e=e|0,n||b(r,e,this.length);for(var o=this[r+--e],i=1;e>0&&(i*=256);)o+=this[r+--e]*i;return o};u.prototype.readUInt8=function(r,e){return e||b(r,1,this.length),this[r]};u.prototype.readUInt16LE=function(r,e){return e||b(r,2,this.length),this[r]|this[r+1]<<8};u.prototype.readUInt16BE=function(r,e){return e||b(r,2,this.length),this[r]<<8|this[r+1]};u.prototype.readUInt32LE=function(r,e){return e||b(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216};u.prototype.readUInt32BE=function(r,e){return e||b(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])};u.prototype.readIntLE=function(r,e,n){r=r|0,e=e|0,n||b(r,e,this.length);for(var o=this[r],i=1,a=0;++a<e&&(i*=256);)o+=this[r+a]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o};u.prototype.readIntBE=function(r,e,n){r=r|0,e=e|0,n||b(r,e,this.length);for(var o=e,i=1,a=this[r+--o];o>0&&(i*=256);)a+=this[r+--o]*i;return i*=128,a>=i&&(a-=Math.pow(2,8*e)),a};u.prototype.readInt8=function(r,e){return e||b(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};u.prototype.readInt16LE=function(r,e){e||b(r,2,this.length);var n=this[r]|this[r+1]<<8;return n&32768?n|4294901760:n};u.prototype.readInt16BE=function(r,e){e||b(r,2,this.length);var n=this[r+1]|this[r]<<8;return n&32768?n|4294901760:n};u.prototype.readInt32LE=function(r,e){return e||b(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24};u.prototype.readInt32BE=function(r,e){return e||b(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]};u.prototype.readFloatLE=function(r,e){return e||b(r,4,this.length),Z(this,r,!0,23,4)};u.prototype.readFloatBE=function(r,e){return e||b(r,4,this.length),Z(this,r,!1,23,4)};u.prototype.readDoubleLE=function(r,e){return e||b(r,8,this.length),Z(this,r,!0,52,8)};u.prototype.readDoubleBE=function(r,e){return e||b(r,8,this.length),Z(this,r,!1,52,8)};function T(t,r,e,n,o,i){if(!S(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>o||r<i)throw new RangeError('"value" argument is out of bounds');if(e+n>t.length)throw new RangeError("Index out of range")}u.prototype.writeUIntLE=function(r,e,n,o){if(r=+r,e=e|0,n=n|0,!o){var i=Math.pow(2,8*n)-1;T(this,r,e,n,i,0)}var a=1,c=0;for(this[e]=r&255;++c<n&&(a*=256);)this[e+c]=r/a&255;return e+n};u.prototype.writeUIntBE=function(r,e,n,o){if(r=+r,e=e|0,n=n|0,!o){var i=Math.pow(2,8*n)-1;T(this,r,e,n,i,0)}var a=n-1,c=1;for(this[e+a]=r&255;--a>=0&&(c*=256);)this[e+a]=r/c&255;return e+n};u.prototype.writeUInt8=function(r,e,n){return r=+r,e=e|0,n||T(this,r,e,1,255,0),u.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),this[e]=r&255,e+1};function rr(t,r,e,n){r<0&&(r=65535+r+1);for(var o=0,i=Math.min(t.length-e,2);o<i;++o)t[e+o]=(r&255<<8*(n?o:1-o))>>>(n?o:1-o)*8}u.prototype.writeUInt16LE=function(r,e,n){return r=+r,e=e|0,n||T(this,r,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):rr(this,r,e,!0),e+2};u.prototype.writeUInt16BE=function(r,e,n){return r=+r,e=e|0,n||T(this,r,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):rr(this,r,e,!1),e+2};function er(t,r,e,n){r<0&&(r=4294967295+r+1);for(var o=0,i=Math.min(t.length-e,4);o<i;++o)t[e+o]=r>>>(n?o:3-o)*8&255}u.prototype.writeUInt32LE=function(r,e,n){return r=+r,e=e|0,n||T(this,r,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e+3]=r>>>24,this[e+2]=r>>>16,this[e+1]=r>>>8,this[e]=r&255):er(this,r,e,!0),e+4};u.prototype.writeUInt32BE=function(r,e,n){return r=+r,e=e|0,n||T(this,r,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e]=r>>>24,this[e+1]=r>>>16,this[e+2]=r>>>8,this[e+3]=r&255):er(this,r,e,!1),e+4};u.prototype.writeIntLE=function(r,e,n,o){if(r=+r,e=e|0,!o){var i=Math.pow(2,8*n-1);T(this,r,e,n,i-1,-i)}var a=0,c=1,p=0;for(this[e]=r&255;++a<n&&(c*=256);)r<0&&p===0&&this[e+a-1]!==0&&(p=1),this[e+a]=(r/c>>0)-p&255;return e+n};u.prototype.writeIntBE=function(r,e,n,o){if(r=+r,e=e|0,!o){var i=Math.pow(2,8*n-1);T(this,r,e,n,i-1,-i)}var a=n-1,c=1,p=0;for(this[e+a]=r&255;--a>=0&&(c*=256);)r<0&&p===0&&this[e+a+1]!==0&&(p=1),this[e+a]=(r/c>>0)-p&255;return e+n};u.prototype.writeInt8=function(r,e,n){return r=+r,e=e|0,n||T(this,r,e,1,127,-128),u.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),r<0&&(r=255+r+1),this[e]=r&255,e+1};u.prototype.writeInt16LE=function(r,e,n){return r=+r,e=e|0,n||T(this,r,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):rr(this,r,e,!0),e+2};u.prototype.writeInt16BE=function(r,e,n){return r=+r,e=e|0,n||T(this,r,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):rr(this,r,e,!1),e+2};u.prototype.writeInt32LE=function(r,e,n){return r=+r,e=e|0,n||T(this,r,e,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8,this[e+2]=r>>>16,this[e+3]=r>>>24):er(this,r,e,!0),e+4};u.prototype.writeInt32BE=function(r,e,n){return r=+r,e=e|0,n||T(this,r,e,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),u.TYPED_ARRAY_SUPPORT?(this[e]=r>>>24,this[e+1]=r>>>16,this[e+2]=r>>>8,this[e+3]=r&255):er(this,r,e,!1),e+4};function te(t,r,e,n,o,i){if(e+n>t.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function ne(t,r,e,n,o){return o||te(t,r,e,4),Xr(t,r,e,n,23,4),e+4}u.prototype.writeFloatLE=function(r,e,n){return ne(this,r,e,!0,n)};u.prototype.writeFloatBE=function(r,e,n){return ne(this,r,e,!1,n)};function oe(t,r,e,n,o){return o||te(t,r,e,8),Xr(t,r,e,n,52,8),e+8}u.prototype.writeDoubleLE=function(r,e,n){return oe(this,r,e,!0,n)};u.prototype.writeDoubleBE=function(r,e,n){return oe(this,r,e,!1,n)};u.prototype.copy=function(r,e,n,o){if(n||(n=0),!o&&o!==0&&(o=this.length),e>=r.length&&(e=r.length),e||(e=0),o>0&&o<n&&(o=n),o===n||r.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),r.length-e<o-n&&(o=r.length-e+n);var i=o-n,a;if(this===r&&n<e&&e<o)for(a=i-1;a>=0;--a)r[a+e]=this[a+n];else if(i<1e3||!u.TYPED_ARRAY_SUPPORT)for(a=0;a<i;++a)r[a+e]=this[a+n];else Uint8Array.prototype.set.call(r,this.subarray(n,n+i),e);return i};u.prototype.fill=function(r,e,n,o){if(typeof r=="string"){if(typeof e=="string"?(o=e,e=0,n=this.length):typeof n=="string"&&(o=n,n=this.length),r.length===1){var i=r.charCodeAt(0);i<256&&(r=i)}if(o!==void 0&&typeof o!="string")throw new TypeError("encoding must be a string");if(typeof o=="string"&&!u.isEncoding(o))throw new TypeError("Unknown encoding: "+o)}else typeof r=="number"&&(r=r&255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;e=e>>>0,n=n===void 0?this.length:n>>>0,r||(r=0);var a;if(typeof r=="number")for(a=e;a<n;++a)this[a]=r;else{var c=S(r)?r:Q(new u(r,o).toString()),p=c.length;for(a=0;a<n-e;++a)this[a+e]=c[a%p]}return this};var Ht=/[^+\/0-9A-Za-z-_]/g;function Vt(t){if(t=$t(t).replace(Ht,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function $t(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function zt(t){return t<16?"0"+t.toString(16):t.toString(16)}function Q(t,r){r=r||1/0;for(var e,n=t.length,o=null,i=[],a=0;a<n;++a){if(e=t.charCodeAt(a),e>55295&&e<57344){if(!o){if(e>56319){(r-=3)>-1&&i.push(239,191,189);continue}else if(a+1===n){(r-=3)>-1&&i.push(239,191,189);continue}o=e;continue}if(e<56320){(r-=3)>-1&&i.push(239,191,189),o=e;continue}e=(o-55296<<10|e-56320)+65536}else o&&(r-=3)>-1&&i.push(239,191,189);if(o=null,e<128){if((r-=1)<0)break;i.push(e)}else if(e<2048){if((r-=2)<0)break;i.push(e>>6|192,e&63|128)}else if(e<65536){if((r-=3)<0)break;i.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((r-=4)<0)break;i.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return i}function Xt(t){for(var r=[],e=0;e<t.length;++e)r.push(t.charCodeAt(e)&255);return r}function qt(t,r){for(var e,n,o,i=[],a=0;a<t.length&&!((r-=2)<0);++a)e=t.charCodeAt(a),n=e>>8,o=e%256,i.push(o),i.push(n);return i}function ie(t){return _t(Vt(t))}function tr(t,r,e,n){for(var o=0;o<n&&!(o+e>=r.length||o>=t.length);++o)r[o+e]=t[o];return o}function Jt(t){return t!==t}function jt(t){return t!=null&&(!!t._isBuffer||ae(t)||Qt(t))}function ae(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function Qt(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&ae(t.slice(0,0))}import{encodeAddress as Zt,decodeAddress as Gn}from"algosdk";function v(t){return t.reduce((r,e)=>Uint8Array.from([...r,...e]))}function nr(t){return new Uint8Array(u.from(t))}function or(t){return u.from(t,"base64")}import rn from"bignumber.js";rn.config({DECIMAL_PLACES:40,EXPONENTIAL_AT:45});var ao=`{"theme1":{"value":"${m.env.FRONTEND_URL}/Theme%3DDark.svg","active":true},"theme2":{"value":"${m.env.FRONTEND_URL}/Theme%3DLight.svg","active":true},"theme3":{"value":"${m.env.FRONTEND_URL}/Theme%3DLight.svg","active":true}}`;var se={V1_1:"v1_1",V2:"v2"},po={[se.V1_1]:{testnet:62368684,mainnet:552635992},[se.V2]:{testnet:148607e3,mainnet:1002541853}};var ce=t=>nn.decodeAddress(t.toUpperCase()).publicKey;import*as E from"ethereumjs-util";function an(t){return E.toUnsigned(new E.BN(String(t)))}function xr(t){let r=an(t);if(r.length>32)throw new Error("Invalid value. The buffer length of the value is more than 32");return new Uint8Array(E.setLengthLeft(r,32))}var ue=t=>new Uint8Array(E.setLengthLeft(K(t),32)),K=t=>s.from(sn(t),"hex"),sn=t=>t.startsWith("0x")?t.slice(2):t;var pe=(t,r)=>{let e=E.keccak256(t),{r:n,s:o,v:i}=E.fromRpcSig(r);return E.ecrecover(e,i,n,o)};var ir=t=>new Uint8Array(E.keccak256(s.from(t)));import ar from"algosdk";import*as dn from"bs58";import si from"algosdk";import hi from"algosdk";import ea from"algosdk";var Er={"0x4343545055534443000000000000000000000000000000000000000000000000":65537};var Oi={SMALLESTUNIT:m.env.SMALLEST_UNIT},ki={SMALLEST_UNITS:m.env.SMALLEST_UNIT};var vi=["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"];import bc from"algosdk";var he=(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))(he||{}),xe=(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))(xe||{}),ms={...he,...xe};import Uc from"algosdk";var F=(t,r,e)=>{switch(r){case"8B":return ar.encodeUint64(Number(t));case"32B":return xr(t);case"str":return nr(String(t));case"address":return sr(String(t),e);case"token":return fn(String(t),e);case"float":{var n=s.alloc(8);return n.writeDoubleBE(Number(t),0),new Uint8Array(n)}case"bool":return new Uint8Array(s.from(ar.encodeUint64(Number(t))).subarray(-1));case"2B":return new Uint8Array(s.from(ar.encodeUint64(Number(t))).subarray(-2));case"4B":return new Uint8Array(s.from(ar.encodeUint64(Number(t))).subarray(-4));default:return s.from(t.toString())}};var fn=(t,r)=>r===8?xr(+t):Er[t]?new Uint8Array(K(String(t))):sr(String(t),r);var de=t=>s.from(ir(t)).toString("hex"),fe=(t,r)=>v([F(r,"str"),ir(t)]),ge=(t,r)=>v([F(r,"str"),s.from(t,"hex")]),W=(t,r)=>{let e=gn.ABIMethod.fromSignature(t),n=e.getSelector(),o={},i=r.map((a,c)=>{let p=e.args[c].type.encode(a);return o[`txnArgs${c}`]=Array.apply([],Array.from(p)).join(", "),p});return[n,...i]},Ar=(t,r,e)=>{let n=s.from(t,r),o=n.subarray(n.length-e),i=s.from(o).toString();return or(i)},Ee=(t,r,e,n,o="hex")=>[br(t,o,n),hn(r,n),xn(e,n,t,r,o)],hn=(t,r)=>r===8?or(t):r===1?Tr.decode(t):K(t),xn=(t,r,e,n,o)=>r===8||r===1?sr(t,r):pe(br(e,o,r),n),bn=(t,r)=>r===8?"MX":r===1?"":`Ethereum Signed Message:
2
- ${t.length}`,br=(t,r,e)=>{let n=s.from(t,r);return s.concat([nr(bn(n,e)),n])},cn=t=>{switch(t){case"ALGORAND":return 8;case"SOLANA":return 1;case"EVM":return 5;default:return 5}},sr=(t,r)=>r===8?ce(t):r===1?Tr.decode(t):ue(t),En="CCTPUSDC",An=65537;function Tn(){let t=s.alloc(32,0);return s.from(En,"utf-8").copy(t),t}function Mu(){return{address:"0x"+Tn().toString("hex"),chainId:An}}export{hn as decodeSignature,sr as encodeAddress,de as generateHash,W as getAppArgs,fe as getBoxKey,ge as getBoxKeyFromHash,Ar as getDataBytesFromMsg,Ee as getMsgArgs,br as getPrefixedMessage,cn as getProviderChainId,xn as getPublicKey,Tn as getUnifiedUSDC,Mu as getUnifiedUSDCToken,An as unified_CCTP_ChainID,En as unified_CCTP_token};
1
+ function yr(){throw new Error("setTimeout has not been defined")}function Ir(){throw new Error("clearTimeout has not been defined")}var D=yr,P=Ir;typeof globalThis.setTimeout=="function"&&(D=setTimeout);typeof globalThis.clearTimeout=="function"&&(P=clearTimeout);function Rr(t){if(D===setTimeout)return setTimeout(t,0);if((D===yr||!D)&&setTimeout)return D=setTimeout,setTimeout(t,0);try{return D(t,0)}catch{try{return D.call(null,t,0)}catch{return D.call(this,t,0)}}}function Ae(t){if(P===clearTimeout)return clearTimeout(t);if((P===Ir||!P)&&clearTimeout)return P=clearTimeout,clearTimeout(t);try{return P(t)}catch{try{return P.call(null,t)}catch{return P.call(this,t)}}}var O=[],G=!1,k,H=-1;function Te(){!G||!k||(G=!1,k.length?O=k.concat(O):H=-1,O.length&&wr())}function wr(){if(!G){var t=Rr(Te);G=!0;for(var r=O.length;r;){for(k=O,O=[];++H<r;)k&&k[H].run();H=-1,r=O.length}k=null,G=!1,Ae(t)}}function _e(t){var r=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)r[e-1]=arguments[e];O.push(new Nr(t,r)),O.length===1&&!G&&Rr(wr)}function Nr(t,r){this.fun=t,this.array=r}Nr.prototype.run=function(){this.fun.apply(null,this.array)};var ye="browser",Ie="browser",Re=!0,we={},Ne=[],Se="",Oe={},Be={},Ce={};function U(){}var De=U,Pe=U,ke=U,Ue=U,Le=U,Me=U,ve=U;function Fe(t){throw new Error("process.binding is not supported")}function Ye(){return"/"}function Ge(t){throw new Error("process.chdir is not supported")}function Ke(){return 0}var Y=globalThis.performance||{},We=Y.now||Y.mozNow||Y.msNow||Y.oNow||Y.webkitNow||function(){return new Date().getTime()};function He(t){var r=We.call(Y)*.001,e=Math.floor(r),n=Math.floor(r%1*1e9);return t&&(e=e-t[0],n=n-t[1],n<0&&(e--,n+=1e9)),[e,n]}var Ve=new Date;function $e(){var t=new Date,r=t-Ve;return r/1e3}var l={nextTick:_e,title:ye,browser:Re,env:we,argv:Ne,version:Se,versions:Oe,on:De,addListener:Pe,once:ke,off:Ue,removeListener:Le,removeAllListeners:Me,emit:ve,binding:Fe,cwd:Ye,chdir:Ge,umask:Ke,hrtime:He,platform:Ie,release:Be,config:Ce,uptime:$e},_r={};Object.keys(_r).forEach(t=>{let r=t.split("."),e=l;for(let n=0;n<r.length;n++){let o=r[n];n===r.length-1?e[o]=_r[t]:e=e[o]||(e[o]={})}});var R=[],y=[],Xe=typeof Uint8Array<"u"?Uint8Array:Array,pr=!1;function Cr(){pr=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,e=t.length;r<e;++r)R[r]=t[r],y[t.charCodeAt(r)]=r;y[45]=62,y[95]=63}function ze(t){pr||Cr();var r,e,n,o,i,a,c=t.length;if(c%4>0)throw new Error("Invalid string. Length must be a multiple of 4");i=t[c-2]==="="?2:t[c-1]==="="?1:0,a=new Xe(c*3/4-i),n=i>0?c-4:c;var p=0;for(r=0,e=0;r<n;r+=4,e+=3)o=y[t.charCodeAt(r)]<<18|y[t.charCodeAt(r+1)]<<12|y[t.charCodeAt(r+2)]<<6|y[t.charCodeAt(r+3)],a[p++]=o>>16&255,a[p++]=o>>8&255,a[p++]=o&255;return i===2?(o=y[t.charCodeAt(r)]<<2|y[t.charCodeAt(r+1)]>>4,a[p++]=o&255):i===1&&(o=y[t.charCodeAt(r)]<<10|y[t.charCodeAt(r+1)]<<4|y[t.charCodeAt(r+2)]>>2,a[p++]=o>>8&255,a[p++]=o&255),a}function qe(t){return R[t>>18&63]+R[t>>12&63]+R[t>>6&63]+R[t&63]}function Je(t,r,e){for(var n,o=[],i=r;i<e;i+=3)n=(t[i]<<16)+(t[i+1]<<8)+t[i+2],o.push(qe(n));return o.join("")}function Sr(t){pr||Cr();for(var r,e=t.length,n=e%3,o="",i=[],a=16383,c=0,p=e-n;c<p;c+=a)i.push(Je(t,c,c+a>p?p:c+a));return n===1?(r=t[e-1],o+=R[r>>2],o+=R[r<<4&63],o+="=="):n===2&&(r=(t[e-2]<<8)+t[e-1],o+=R[r>>10],o+=R[r>>4&63],o+=R[r<<2&63],o+="="),i.push(o),i.join("")}s.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;function V(){return s.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function B(t,r){if(V()<r)throw new RangeError("Invalid typed array length");return s.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(r),t.__proto__=s.prototype):(t===null&&(t=new s(r)),t.length=r),t}function s(t,r,e){if(!s.TYPED_ARRAY_SUPPORT&&!(this instanceof s))return new s(t,r,e);if(typeof t=="number"){if(typeof r=="string")throw new Error("If encoding is specified then the first argument must be a string");return lr(this,t)}return Dr(this,t,r,e)}s.poolSize=8192;s._augment=function(t){return t.__proto__=s.prototype,t};function Dr(t,r,e,n){if(typeof r=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&r instanceof ArrayBuffer?Ze(t,r,e,n):typeof r=="string"?Qe(t,r,e):rt(t,r)}s.from=function(t,r,e){return Dr(null,t,r,e)};s.kMaxLength=V();s.TYPED_ARRAY_SUPPORT&&(s.prototype.__proto__=Uint8Array.prototype,s.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&s[Symbol.species]);function Pr(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 je(t,r,e,n){return Pr(r),r<=0?B(t,r):e!==void 0?typeof n=="string"?B(t,r).fill(e,n):B(t,r).fill(e):B(t,r)}s.alloc=function(t,r,e){return je(null,t,r,e)};function lr(t,r){if(Pr(r),t=B(t,r<0?0:mr(r)|0),!s.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}s.allocUnsafe=function(t){return lr(null,t)};s.allocUnsafeSlow=function(t){return lr(null,t)};function Qe(t,r,e){if((typeof e!="string"||e==="")&&(e="utf8"),!s.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var n=kr(r,e)|0;t=B(t,n);var o=t.write(r,e);return o!==n&&(t=t.slice(0,o)),t}function ur(t,r){var e=r.length<0?0:mr(r.length)|0;t=B(t,e);for(var n=0;n<e;n+=1)t[n]=r[n]&255;return t}function Ze(t,r,e,n){if(r.byteLength,e<0||r.byteLength<e)throw new RangeError("'offset' is out of bounds");if(r.byteLength<e+(n||0))throw new RangeError("'length' is out of bounds");return e===void 0&&n===void 0?r=new Uint8Array(r):n===void 0?r=new Uint8Array(r,e):r=new Uint8Array(r,e,n),s.TYPED_ARRAY_SUPPORT?(t=r,t.__proto__=s.prototype):t=ur(t,r),t}function rt(t,r){if(w(r)){var e=mr(r.length)|0;return t=B(t,e),t.length===0||r.copy(t,0,0,e),t}if(r){if(typeof ArrayBuffer<"u"&&r.buffer instanceof ArrayBuffer||"length"in r)return typeof r.length!="number"||bt(r.length)?B(t,0):ur(t,r);if(r.type==="Buffer"&&Array.isArray(r.data))return ur(t,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function mr(t){if(t>=V())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+V().toString(16)+" bytes");return t|0}s.isBuffer=At;function w(t){return!!(t!=null&&t._isBuffer)}s.compare=function(r,e){if(!w(r)||!w(e))throw new TypeError("Arguments must be Buffers");if(r===e)return 0;for(var n=r.length,o=e.length,i=0,a=Math.min(n,o);i<a;++i)if(r[i]!==e[i]){n=r[i],o=e[i];break}return n<o?-1:o<n?1:0};s.isEncoding=function(r){switch(String(r).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(r,e){if(!Array.isArray(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return s.alloc(0);var n;if(e===void 0)for(e=0,n=0;n<r.length;++n)e+=r[n].length;var o=s.allocUnsafe(e),i=0;for(n=0;n<r.length;++n){var a=r[n];if(!w(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(o,i),i+=a.length}return o};function kr(t,r){if(w(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 e=t.length;if(e===0)return 0;for(var n=!1;;)switch(r){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return $(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return Gr(t).length;default:if(n)return $(t).length;r=(""+r).toLowerCase(),n=!0}}s.byteLength=kr;function et(t,r,e){var n=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((e===void 0||e>this.length)&&(e=this.length),e<=0)||(e>>>=0,r>>>=0,e<=r))return"";for(t||(t="utf8");;)switch(t){case"hex":return lt(this,r,e);case"utf8":case"utf-8":return Mr(this,r,e);case"ascii":return ut(this,r,e);case"latin1":case"binary":return pt(this,r,e);case"base64":return st(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return mt(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}s.prototype._isBuffer=!0;function L(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}s.prototype.swap16=function(){var r=this.length;if(r%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<r;e+=2)L(this,e,e+1);return this};s.prototype.swap32=function(){var r=this.length;if(r%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<r;e+=4)L(this,e,e+3),L(this,e+1,e+2);return this};s.prototype.swap64=function(){var r=this.length;if(r%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<r;e+=8)L(this,e,e+7),L(this,e+1,e+6),L(this,e+2,e+5),L(this,e+3,e+4);return this};s.prototype.toString=function(){var r=this.length|0;return r===0?"":arguments.length===0?Mr(this,0,r):et.apply(this,arguments)};s.prototype.equals=function(r){if(!w(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:s.compare(this,r)===0};s.prototype.compare=function(r,e,n,o,i){if(!w(r))throw new TypeError("Argument must be a Buffer");if(e===void 0&&(e=0),n===void 0&&(n=r?r.length:0),o===void 0&&(o=0),i===void 0&&(i=this.length),e<0||n>r.length||o<0||i>this.length)throw new RangeError("out of range index");if(o>=i&&e>=n)return 0;if(o>=i)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,o>>>=0,i>>>=0,this===r)return 0;for(var a=i-o,c=n-e,p=Math.min(a,c),d=this.slice(o,i),f=r.slice(e,n),m=0;m<p;++m)if(d[m]!==f[m]){a=d[m],c=f[m];break}return a<c?-1:c<a?1:0};function Ur(t,r,e,n,o){if(t.length===0)return-1;if(typeof e=="string"?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=o?0:t.length-1),e<0&&(e=t.length+e),e>=t.length){if(o)return-1;e=t.length-1}else if(e<0)if(o)e=0;else return-1;if(typeof r=="string"&&(r=s.from(r,n)),w(r))return r.length===0?-1:Or(t,r,e,n,o);if(typeof r=="number")return r=r&255,s.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?o?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):Or(t,[r],e,n,o);throw new TypeError("val must be string, number or Buffer")}function Or(t,r,e,n,o){var i=1,a=t.length,c=r.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||r.length<2)return-1;i=2,a/=2,c/=2,e/=2}function p(g,_){return i===1?g[_]:g.readUInt16BE(_*i)}var d;if(o){var f=-1;for(d=e;d<a;d++)if(p(t,d)===p(r,f===-1?0:d-f)){if(f===-1&&(f=d),d-f+1===c)return f*i}else f!==-1&&(d-=d-f),f=-1}else for(e+c>a&&(e=a-c),d=e;d>=0;d--){for(var m=!0,h=0;h<c;h++)if(p(t,d+h)!==p(r,h)){m=!1;break}if(m)return d}return-1}s.prototype.includes=function(r,e,n){return this.indexOf(r,e,n)!==-1};s.prototype.indexOf=function(r,e,n){return Ur(this,r,e,n,!0)};s.prototype.lastIndexOf=function(r,e,n){return Ur(this,r,e,n,!1)};function tt(t,r,e,n){e=Number(e)||0;var o=t.length-e;n?(n=Number(n),n>o&&(n=o)):n=o;var i=r.length;if(i%2!==0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var a=0;a<n;++a){var c=parseInt(r.substr(a*2,2),16);if(isNaN(c))return a;t[e+a]=c}return a}function nt(t,r,e,n){return q($(r,t.length-e),t,e,n)}function Lr(t,r,e,n){return q(xt(r),t,e,n)}function ot(t,r,e,n){return Lr(t,r,e,n)}function it(t,r,e,n){return q(Gr(r),t,e,n)}function at(t,r,e,n){return q(Et(r,t.length-e),t,e,n)}s.prototype.write=function(r,e,n,o){if(e===void 0)o="utf8",n=this.length,e=0;else if(n===void 0&&typeof e=="string")o=e,n=this.length,e=0;else if(isFinite(e))e=e|0,isFinite(n)?(n=n|0,o===void 0&&(o="utf8")):(o=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var i=this.length-e;if((n===void 0||n>i)&&(n=i),r.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");o||(o="utf8");for(var a=!1;;)switch(o){case"hex":return tt(this,r,e,n);case"utf8":case"utf-8":return nt(this,r,e,n);case"ascii":return Lr(this,r,e,n);case"latin1":case"binary":return ot(this,r,e,n);case"base64":return it(this,r,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return at(this,r,e,n);default:if(a)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),a=!0}};s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function st(t,r,e){return r===0&&e===t.length?Sr(t):Sr(t.slice(r,e))}function Mr(t,r,e){e=Math.min(t.length,e);for(var n=[],o=r;o<e;){var i=t[o],a=null,c=i>239?4:i>223?3:i>191?2:1;if(o+c<=e){var p,d,f,m;switch(c){case 1:i<128&&(a=i);break;case 2:p=t[o+1],(p&192)===128&&(m=(i&31)<<6|p&63,m>127&&(a=m));break;case 3:p=t[o+1],d=t[o+2],(p&192)===128&&(d&192)===128&&(m=(i&15)<<12|(p&63)<<6|d&63,m>2047&&(m<55296||m>57343)&&(a=m));break;case 4:p=t[o+1],d=t[o+2],f=t[o+3],(p&192)===128&&(d&192)===128&&(f&192)===128&&(m=(i&15)<<18|(p&63)<<12|(d&63)<<6|f&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),o+=c}return ct(n)}var Br=4096;function ct(t){var r=t.length;if(r<=Br)return String.fromCharCode.apply(String,t);for(var e="",n=0;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=Br));return e}function ut(t,r,e){var n="";e=Math.min(t.length,e);for(var o=r;o<e;++o)n+=String.fromCharCode(t[o]&127);return n}function pt(t,r,e){var n="";e=Math.min(t.length,e);for(var o=r;o<e;++o)n+=String.fromCharCode(t[o]);return n}function lt(t,r,e){var n=t.length;(!r||r<0)&&(r=0),(!e||e<0||e>n)&&(e=n);for(var o="",i=r;i<e;++i)o+=ht(t[i]);return o}function mt(t,r,e){for(var n=t.slice(r,e),o="",i=0;i<n.length;i+=2)o+=String.fromCharCode(n[i]+n[i+1]*256);return o}s.prototype.slice=function(r,e){var n=this.length;r=~~r,e=e===void 0?n:~~e,r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),e<r&&(e=r);var o;if(s.TYPED_ARRAY_SUPPORT)o=this.subarray(r,e),o.__proto__=s.prototype;else{var i=e-r;o=new s(i,void 0);for(var a=0;a<i;++a)o[a]=this[a+r]}return o};function x(t,r,e){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+r>e)throw new RangeError("Trying to access beyond buffer length")}s.prototype.readUIntLE=function(r,e,n){r=r|0,e=e|0,n||x(r,e,this.length);for(var o=this[r],i=1,a=0;++a<e&&(i*=256);)o+=this[r+a]*i;return o};s.prototype.readUIntBE=function(r,e,n){r=r|0,e=e|0,n||x(r,e,this.length);for(var o=this[r+--e],i=1;e>0&&(i*=256);)o+=this[r+--e]*i;return o};s.prototype.readUInt8=function(r,e){return e||x(r,1,this.length),this[r]};s.prototype.readUInt16LE=function(r,e){return e||x(r,2,this.length),this[r]|this[r+1]<<8};s.prototype.readUInt16BE=function(r,e){return e||x(r,2,this.length),this[r]<<8|this[r+1]};s.prototype.readUInt32LE=function(r,e){return e||x(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216};s.prototype.readUInt32BE=function(r,e){return e||x(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])};s.prototype.readIntLE=function(r,e,n){r=r|0,e=e|0,n||x(r,e,this.length);for(var o=this[r],i=1,a=0;++a<e&&(i*=256);)o+=this[r+a]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o};s.prototype.readIntBE=function(r,e,n){r=r|0,e=e|0,n||x(r,e,this.length);for(var o=e,i=1,a=this[r+--o];o>0&&(i*=256);)a+=this[r+--o]*i;return i*=128,a>=i&&(a-=Math.pow(2,8*e)),a};s.prototype.readInt8=function(r,e){return e||x(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};s.prototype.readInt16LE=function(r,e){e||x(r,2,this.length);var n=this[r]|this[r+1]<<8;return n&32768?n|4294901760:n};s.prototype.readInt16BE=function(r,e){e||x(r,2,this.length);var n=this[r+1]|this[r]<<8;return n&32768?n|4294901760:n};s.prototype.readInt32LE=function(r,e){return e||x(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24};s.prototype.readInt32BE=function(r,e){return e||x(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]};s.prototype.readFloatLE=function(r,e){return e||x(r,4,this.length),J(this,r,!0,23,4)};s.prototype.readFloatBE=function(r,e){return e||x(r,4,this.length),J(this,r,!1,23,4)};s.prototype.readDoubleLE=function(r,e){return e||x(r,8,this.length),J(this,r,!0,52,8)};s.prototype.readDoubleBE=function(r,e){return e||x(r,8,this.length),J(this,r,!1,52,8)};function A(t,r,e,n,o,i){if(!w(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>o||r<i)throw new RangeError('"value" argument is out of bounds');if(e+n>t.length)throw new RangeError("Index out of range")}s.prototype.writeUIntLE=function(r,e,n,o){if(r=+r,e=e|0,n=n|0,!o){var i=Math.pow(2,8*n)-1;A(this,r,e,n,i,0)}var a=1,c=0;for(this[e]=r&255;++c<n&&(a*=256);)this[e+c]=r/a&255;return e+n};s.prototype.writeUIntBE=function(r,e,n,o){if(r=+r,e=e|0,n=n|0,!o){var i=Math.pow(2,8*n)-1;A(this,r,e,n,i,0)}var a=n-1,c=1;for(this[e+a]=r&255;--a>=0&&(c*=256);)this[e+a]=r/c&255;return e+n};s.prototype.writeUInt8=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,1,255,0),s.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),this[e]=r&255,e+1};function X(t,r,e,n){r<0&&(r=65535+r+1);for(var o=0,i=Math.min(t.length-e,2);o<i;++o)t[e+o]=(r&255<<8*(n?o:1-o))>>>(n?o:1-o)*8}s.prototype.writeUInt16LE=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):X(this,r,e,!0),e+2};s.prototype.writeUInt16BE=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):X(this,r,e,!1),e+2};function z(t,r,e,n){r<0&&(r=4294967295+r+1);for(var o=0,i=Math.min(t.length-e,4);o<i;++o)t[e+o]=r>>>(n?o:3-o)*8&255}s.prototype.writeUInt32LE=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[e+3]=r>>>24,this[e+2]=r>>>16,this[e+1]=r>>>8,this[e]=r&255):z(this,r,e,!0),e+4};s.prototype.writeUInt32BE=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[e]=r>>>24,this[e+1]=r>>>16,this[e+2]=r>>>8,this[e+3]=r&255):z(this,r,e,!1),e+4};s.prototype.writeIntLE=function(r,e,n,o){if(r=+r,e=e|0,!o){var i=Math.pow(2,8*n-1);A(this,r,e,n,i-1,-i)}var a=0,c=1,p=0;for(this[e]=r&255;++a<n&&(c*=256);)r<0&&p===0&&this[e+a-1]!==0&&(p=1),this[e+a]=(r/c>>0)-p&255;return e+n};s.prototype.writeIntBE=function(r,e,n,o){if(r=+r,e=e|0,!o){var i=Math.pow(2,8*n-1);A(this,r,e,n,i-1,-i)}var a=n-1,c=1,p=0;for(this[e+a]=r&255;--a>=0&&(c*=256);)r<0&&p===0&&this[e+a+1]!==0&&(p=1),this[e+a]=(r/c>>0)-p&255;return e+n};s.prototype.writeInt8=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,1,127,-128),s.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),r<0&&(r=255+r+1),this[e]=r&255,e+1};s.prototype.writeInt16LE=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):X(this,r,e,!0),e+2};s.prototype.writeInt16BE=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):X(this,r,e,!1),e+2};s.prototype.writeInt32LE=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,4,2147483647,-2147483648),s.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8,this[e+2]=r>>>16,this[e+3]=r>>>24):z(this,r,e,!0),e+4};s.prototype.writeInt32BE=function(r,e,n){return r=+r,e=e|0,n||A(this,r,e,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),s.TYPED_ARRAY_SUPPORT?(this[e]=r>>>24,this[e+1]=r>>>16,this[e+2]=r>>>8,this[e+3]=r&255):z(this,r,e,!1),e+4};function vr(t,r,e,n,o,i){if(e+n>t.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function Fr(t,r,e,n,o){return o||vr(t,r,e,4,34028234663852886e22,-34028234663852886e22),Wr(t,r,e,n,23,4),e+4}s.prototype.writeFloatLE=function(r,e,n){return Fr(this,r,e,!0,n)};s.prototype.writeFloatBE=function(r,e,n){return Fr(this,r,e,!1,n)};function Yr(t,r,e,n,o){return o||vr(t,r,e,8,17976931348623157e292,-17976931348623157e292),Wr(t,r,e,n,52,8),e+8}s.prototype.writeDoubleLE=function(r,e,n){return Yr(this,r,e,!0,n)};s.prototype.writeDoubleBE=function(r,e,n){return Yr(this,r,e,!1,n)};s.prototype.copy=function(r,e,n,o){if(n||(n=0),!o&&o!==0&&(o=this.length),e>=r.length&&(e=r.length),e||(e=0),o>0&&o<n&&(o=n),o===n||r.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),r.length-e<o-n&&(o=r.length-e+n);var i=o-n,a;if(this===r&&n<e&&e<o)for(a=i-1;a>=0;--a)r[a+e]=this[a+n];else if(i<1e3||!s.TYPED_ARRAY_SUPPORT)for(a=0;a<i;++a)r[a+e]=this[a+n];else Uint8Array.prototype.set.call(r,this.subarray(n,n+i),e);return i};s.prototype.fill=function(r,e,n,o){if(typeof r=="string"){if(typeof e=="string"?(o=e,e=0,n=this.length):typeof n=="string"&&(o=n,n=this.length),r.length===1){var i=r.charCodeAt(0);i<256&&(r=i)}if(o!==void 0&&typeof o!="string")throw new TypeError("encoding must be a string");if(typeof o=="string"&&!s.isEncoding(o))throw new TypeError("Unknown encoding: "+o)}else typeof r=="number"&&(r=r&255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;e=e>>>0,n=n===void 0?this.length:n>>>0,r||(r=0);var a;if(typeof r=="number")for(a=e;a<n;++a)this[a]=r;else{var c=w(r)?r:$(new s(r,o).toString()),p=c.length;for(a=0;a<n-e;++a)this[a+e]=c[a%p]}return this};var dt=/[^+\/0-9A-Za-z-_]/g;function ft(t){if(t=gt(t).replace(dt,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function gt(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function ht(t){return t<16?"0"+t.toString(16):t.toString(16)}function $(t,r){r=r||1/0;for(var e,n=t.length,o=null,i=[],a=0;a<n;++a){if(e=t.charCodeAt(a),e>55295&&e<57344){if(!o){if(e>56319){(r-=3)>-1&&i.push(239,191,189);continue}else if(a+1===n){(r-=3)>-1&&i.push(239,191,189);continue}o=e;continue}if(e<56320){(r-=3)>-1&&i.push(239,191,189),o=e;continue}e=(o-55296<<10|e-56320)+65536}else o&&(r-=3)>-1&&i.push(239,191,189);if(o=null,e<128){if((r-=1)<0)break;i.push(e)}else if(e<2048){if((r-=2)<0)break;i.push(e>>6|192,e&63|128)}else if(e<65536){if((r-=3)<0)break;i.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((r-=4)<0)break;i.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return i}function xt(t){for(var r=[],e=0;e<t.length;++e)r.push(t.charCodeAt(e)&255);return r}function Et(t,r){for(var e,n,o,i=[],a=0;a<t.length&&!((r-=2)<0);++a)e=t.charCodeAt(a),n=e>>8,o=e%256,i.push(o),i.push(n);return i}function Gr(t){return ze(ft(t))}function q(t,r,e,n){for(var o=0;o<n&&!(o+e>=r.length||o>=t.length);++o)r[o+e]=t[o];return o}function bt(t){return t!==t}function At(t){return t!=null&&(!!t._isBuffer||Kr(t)||Tt(t))}function Kr(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function Tt(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&Kr(t.slice(0,0))}function J(t,r,e,n,o){var i,a,c=o*8-n-1,p=(1<<c)-1,d=p>>1,f=-7,m=e?o-1:0,h=e?-1:1,g=t[r+m];for(m+=h,i=g&(1<<-f)-1,g>>=-f,f+=c;f>0;i=i*256+t[r+m],m+=h,f-=8);for(a=i&(1<<-f)-1,i>>=-f,f+=n;f>0;a=a*256+t[r+m],m+=h,f-=8);if(i===0)i=1-d;else{if(i===p)return a?NaN:(g?-1:1)*(1/0);a=a+Math.pow(2,n),i=i-d}return(g?-1:1)*a*Math.pow(2,i-n)}function Wr(t,r,e,n,o,i){var a,c,p,d=i*8-o-1,f=(1<<d)-1,m=f>>1,h=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,g=n?0:i-1,_=n?1:-1,cr=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(c=isNaN(r)?1:0,a=f):(a=Math.floor(Math.log(r)/Math.LN2),r*(p=Math.pow(2,-a))<1&&(a--,p*=2),a+m>=1?r+=h/p:r+=h*Math.pow(2,1-m),r*p>=2&&(a++,p/=2),a+m>=f?(c=0,a=f):a+m>=1?(c=(r*p-1)*Math.pow(2,o),a=a+m):(c=r*Math.pow(2,m-1)*Math.pow(2,o),a=0));o>=8;t[e+g]=c&255,g+=_,c/=256,o-=8);for(a=a<<o|c,d+=o;d>0;t[e+g]=a&255,g+=_,a/=256,d-=8);t[e+g-_]|=cr*128}import xn from"algosdk";import*as Tr from"bs58";import nn from"algosdk";import Un,{decodeAddress as Ln,encodeAddress as Mn}from"algosdk";var N=[],I=[],_t=typeof Uint8Array<"u"?Uint8Array:Array,fr=!1;function Xr(){fr=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,e=t.length;r<e;++r)N[r]=t[r],I[t.charCodeAt(r)]=r;I[45]=62,I[95]=63}function yt(t){fr||Xr();var r,e,n,o,i,a,c=t.length;if(c%4>0)throw new Error("Invalid string. Length must be a multiple of 4");i=t[c-2]==="="?2:t[c-1]==="="?1:0,a=new _t(c*3/4-i),n=i>0?c-4:c;var p=0;for(r=0,e=0;r<n;r+=4,e+=3)o=I[t.charCodeAt(r)]<<18|I[t.charCodeAt(r+1)]<<12|I[t.charCodeAt(r+2)]<<6|I[t.charCodeAt(r+3)],a[p++]=o>>16&255,a[p++]=o>>8&255,a[p++]=o&255;return i===2?(o=I[t.charCodeAt(r)]<<2|I[t.charCodeAt(r+1)]>>4,a[p++]=o&255):i===1&&(o=I[t.charCodeAt(r)]<<10|I[t.charCodeAt(r+1)]<<4|I[t.charCodeAt(r+2)]>>2,a[p++]=o>>8&255,a[p++]=o&255),a}function It(t){return N[t>>18&63]+N[t>>12&63]+N[t>>6&63]+N[t&63]}function Rt(t,r,e){for(var n,o=[],i=r;i<e;i+=3)n=(t[i]<<16)+(t[i+1]<<8)+t[i+2],o.push(It(n));return o.join("")}function Hr(t){fr||Xr();for(var r,e=t.length,n=e%3,o="",i=[],a=16383,c=0,p=e-n;c<p;c+=a)i.push(Rt(t,c,c+a>p?p:c+a));return n===1?(r=t[e-1],o+=N[r>>2],o+=N[r<<4&63],o+="=="):n===2&&(r=(t[e-2]<<8)+t[e-1],o+=N[r>>10],o+=N[r>>4&63],o+=N[r<<2&63],o+="="),i.push(o),i.join("")}function Z(t,r,e,n,o){var i,a,c=o*8-n-1,p=(1<<c)-1,d=p>>1,f=-7,m=e?o-1:0,h=e?-1:1,g=t[r+m];for(m+=h,i=g&(1<<-f)-1,g>>=-f,f+=c;f>0;i=i*256+t[r+m],m+=h,f-=8);for(a=i&(1<<-f)-1,i>>=-f,f+=n;f>0;a=a*256+t[r+m],m+=h,f-=8);if(i===0)i=1-d;else{if(i===p)return a?NaN:(g?-1:1)*(1/0);a=a+Math.pow(2,n),i=i-d}return(g?-1:1)*a*Math.pow(2,i-n)}function zr(t,r,e,n,o,i){var a,c,p,d=i*8-o-1,f=(1<<d)-1,m=f>>1,h=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,g=n?0:i-1,_=n?1:-1,cr=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(c=isNaN(r)?1:0,a=f):(a=Math.floor(Math.log(r)/Math.LN2),r*(p=Math.pow(2,-a))<1&&(a--,p*=2),a+m>=1?r+=h/p:r+=h*Math.pow(2,1-m),r*p>=2&&(a++,p/=2),a+m>=f?(c=0,a=f):a+m>=1?(c=(r*p-1)*Math.pow(2,o),a=a+m):(c=r*Math.pow(2,m-1)*Math.pow(2,o),a=0));o>=8;t[e+g]=c&255,g+=_,c/=256,o-=8);for(a=a<<o|c,d+=o;d>0;t[e+g]=a&255,g+=_,a/=256,d-=8);t[e+g-_]|=cr*128}var wt={}.toString,qr=Array.isArray||function(t){return wt.call(t)=="[object Array]"};var Nt=50;u.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;var Bn=j();function j(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function C(t,r){if(j()<r)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(r),t.__proto__=u.prototype):(t===null&&(t=new u(r)),t.length=r),t}function u(t,r,e){if(!u.TYPED_ARRAY_SUPPORT&&!(this instanceof u))return new u(t,r,e);if(typeof t=="number"){if(typeof r=="string")throw new Error("If encoding is specified then the first argument must be a string");return gr(this,t)}return Jr(this,t,r,e)}u.poolSize=8192;u._augment=function(t){return t.__proto__=u.prototype,t};function Jr(t,r,e,n){if(typeof r=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&r instanceof ArrayBuffer?Bt(t,r,e,n):typeof r=="string"?Ot(t,r,e):Ct(t,r)}u.from=function(t,r,e){return Jr(null,t,r,e)};u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array);function jr(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 St(t,r,e,n){return jr(r),r<=0?C(t,r):e!==void 0?typeof n=="string"?C(t,r).fill(e,n):C(t,r).fill(e):C(t,r)}u.alloc=function(t,r,e){return St(null,t,r,e)};function gr(t,r){if(jr(r),t=C(t,r<0?0:hr(r)|0),!u.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}u.allocUnsafe=function(t){return gr(null,t)};u.allocUnsafeSlow=function(t){return gr(null,t)};function Ot(t,r,e){if((typeof e!="string"||e==="")&&(e="utf8"),!u.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var n=Qr(r,e)|0;t=C(t,n);var o=t.write(r,e);return o!==n&&(t=t.slice(0,o)),t}function dr(t,r){var e=r.length<0?0:hr(r.length)|0;t=C(t,e);for(var n=0;n<e;n+=1)t[n]=r[n]&255;return t}function Bt(t,r,e,n){if(r.byteLength,e<0||r.byteLength<e)throw new RangeError("'offset' is out of bounds");if(r.byteLength<e+(n||0))throw new RangeError("'length' is out of bounds");return e===void 0&&n===void 0?r=new Uint8Array(r):n===void 0?r=new Uint8Array(r,e):r=new Uint8Array(r,e,n),u.TYPED_ARRAY_SUPPORT?(t=r,t.__proto__=u.prototype):t=dr(t,r),t}function Ct(t,r){if(S(r)){var e=hr(r.length)|0;return t=C(t,e),t.length===0||r.copy(t,0,0,e),t}if(r){if(typeof ArrayBuffer<"u"&&r.buffer instanceof ArrayBuffer||"length"in r)return typeof r.length!="number"||Jt(r.length)?C(t,0):dr(t,r);if(r.type==="Buffer"&&qr(r.data))return dr(t,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function hr(t){if(t>=j())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+j().toString(16)+" bytes");return t|0}u.isBuffer=jt;function S(t){return!!(t!=null&&t._isBuffer)}u.compare=function(r,e){if(!S(r)||!S(e))throw new TypeError("Arguments must be Buffers");if(r===e)return 0;for(var n=r.length,o=e.length,i=0,a=Math.min(n,o);i<a;++i)if(r[i]!==e[i]){n=r[i],o=e[i];break}return n<o?-1:o<n?1:0};u.isEncoding=function(r){switch(String(r).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}};u.concat=function(r,e){if(!qr(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return u.alloc(0);var n;if(e===void 0)for(e=0,n=0;n<r.length;++n)e+=r[n].length;var o=u.allocUnsafe(e),i=0;for(n=0;n<r.length;++n){var a=r[n];if(!S(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(o,i),i+=a.length}return o};function Qr(t,r){if(S(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 e=t.length;if(e===0)return 0;for(var n=!1;;)switch(r){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return Q(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return ie(t).length;default:if(n)return Q(t).length;r=(""+r).toLowerCase(),n=!0}}u.byteLength=Qr;function Dt(t,r,e){var n=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((e===void 0||e>this.length)&&(e=this.length),e<=0)||(e>>>=0,r>>>=0,e<=r))return"";for(t||(t="utf8");;)switch(t){case"hex":return Kt(this,r,e);case"utf8":case"utf-8":return ee(this,r,e);case"ascii":return Yt(this,r,e);case"latin1":case"binary":return Gt(this,r,e);case"base64":return vt(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Wt(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}u.prototype._isBuffer=!0;function M(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}u.prototype.swap16=function(){var r=this.length;if(r%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<r;e+=2)M(this,e,e+1);return this};u.prototype.swap32=function(){var r=this.length;if(r%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<r;e+=4)M(this,e,e+3),M(this,e+1,e+2);return this};u.prototype.swap64=function(){var r=this.length;if(r%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<r;e+=8)M(this,e,e+7),M(this,e+1,e+6),M(this,e+2,e+5),M(this,e+3,e+4);return this};u.prototype.toString=function(){var r=this.length|0;return r===0?"":arguments.length===0?ee(this,0,r):Dt.apply(this,arguments)};u.prototype.equals=function(r){if(!S(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:u.compare(this,r)===0};u.prototype.inspect=function(){var r="",e=Nt;return this.length>0&&(r=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(r+=" ... ")),"<Buffer "+r+">"};u.prototype.compare=function(r,e,n,o,i){if(!S(r))throw new TypeError("Argument must be a Buffer");if(e===void 0&&(e=0),n===void 0&&(n=r?r.length:0),o===void 0&&(o=0),i===void 0&&(i=this.length),e<0||n>r.length||o<0||i>this.length)throw new RangeError("out of range index");if(o>=i&&e>=n)return 0;if(o>=i)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,o>>>=0,i>>>=0,this===r)return 0;for(var a=i-o,c=n-e,p=Math.min(a,c),d=this.slice(o,i),f=r.slice(e,n),m=0;m<p;++m)if(d[m]!==f[m]){a=d[m],c=f[m];break}return a<c?-1:c<a?1:0};function Zr(t,r,e,n,o){if(t.length===0)return-1;if(typeof e=="string"?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=o?0:t.length-1),e<0&&(e=t.length+e),e>=t.length){if(o)return-1;e=t.length-1}else if(e<0)if(o)e=0;else return-1;if(typeof r=="string"&&(r=u.from(r,n)),S(r))return r.length===0?-1:Vr(t,r,e,n,o);if(typeof r=="number")return r=r&255,u.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?o?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):Vr(t,[r],e,n,o);throw new TypeError("val must be string, number or Buffer")}function Vr(t,r,e,n,o){var i=1,a=t.length,c=r.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||r.length<2)return-1;i=2,a/=2,c/=2,e/=2}function p(g,_){return i===1?g[_]:g.readUInt16BE(_*i)}var d;if(o){var f=-1;for(d=e;d<a;d++)if(p(t,d)===p(r,f===-1?0:d-f)){if(f===-1&&(f=d),d-f+1===c)return f*i}else f!==-1&&(d-=d-f),f=-1}else for(e+c>a&&(e=a-c),d=e;d>=0;d--){for(var m=!0,h=0;h<c;h++)if(p(t,d+h)!==p(r,h)){m=!1;break}if(m)return d}return-1}u.prototype.includes=function(r,e,n){return this.indexOf(r,e,n)!==-1};u.prototype.indexOf=function(r,e,n){return Zr(this,r,e,n,!0)};u.prototype.lastIndexOf=function(r,e,n){return Zr(this,r,e,n,!1)};function Pt(t,r,e,n){e=Number(e)||0;var o=t.length-e;n?(n=Number(n),n>o&&(n=o)):n=o;var i=r.length;if(i%2!==0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var a=0;a<n;++a){var c=parseInt(r.substr(a*2,2),16);if(isNaN(c))return a;t[e+a]=c}return a}function kt(t,r,e,n){return tr(Q(r,t.length-e),t,e,n)}function re(t,r,e,n){return tr(zt(r),t,e,n)}function Ut(t,r,e,n){return re(t,r,e,n)}function Lt(t,r,e,n){return tr(ie(r),t,e,n)}function Mt(t,r,e,n){return tr(qt(r,t.length-e),t,e,n)}u.prototype.write=function(r,e,n,o){if(e===void 0)o="utf8",n=this.length,e=0;else if(n===void 0&&typeof e=="string")o=e,n=this.length,e=0;else if(isFinite(e))e=e|0,isFinite(n)?(n=n|0,o===void 0&&(o="utf8")):(o=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var i=this.length-e;if((n===void 0||n>i)&&(n=i),r.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");o||(o="utf8");for(var a=!1;;)switch(o){case"hex":return Pt(this,r,e,n);case"utf8":case"utf-8":return kt(this,r,e,n);case"ascii":return re(this,r,e,n);case"latin1":case"binary":return Ut(this,r,e,n);case"base64":return Lt(this,r,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Mt(this,r,e,n);default:if(a)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),a=!0}};u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function vt(t,r,e){return r===0&&e===t.length?Hr(t):Hr(t.slice(r,e))}function ee(t,r,e){e=Math.min(t.length,e);for(var n=[],o=r;o<e;){var i=t[o],a=null,c=i>239?4:i>223?3:i>191?2:1;if(o+c<=e){var p,d,f,m;switch(c){case 1:i<128&&(a=i);break;case 2:p=t[o+1],(p&192)===128&&(m=(i&31)<<6|p&63,m>127&&(a=m));break;case 3:p=t[o+1],d=t[o+2],(p&192)===128&&(d&192)===128&&(m=(i&15)<<12|(p&63)<<6|d&63,m>2047&&(m<55296||m>57343)&&(a=m));break;case 4:p=t[o+1],d=t[o+2],f=t[o+3],(p&192)===128&&(d&192)===128&&(f&192)===128&&(m=(i&15)<<18|(p&63)<<12|(d&63)<<6|f&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),o+=c}return Ft(n)}var $r=4096;function Ft(t){var r=t.length;if(r<=$r)return String.fromCharCode.apply(String,t);for(var e="",n=0;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=$r));return e}function Yt(t,r,e){var n="";e=Math.min(t.length,e);for(var o=r;o<e;++o)n+=String.fromCharCode(t[o]&127);return n}function Gt(t,r,e){var n="";e=Math.min(t.length,e);for(var o=r;o<e;++o)n+=String.fromCharCode(t[o]);return n}function Kt(t,r,e){var n=t.length;(!r||r<0)&&(r=0),(!e||e<0||e>n)&&(e=n);for(var o="",i=r;i<e;++i)o+=Xt(t[i]);return o}function Wt(t,r,e){for(var n=t.slice(r,e),o="",i=0;i<n.length;i+=2)o+=String.fromCharCode(n[i]+n[i+1]*256);return o}u.prototype.slice=function(r,e){var n=this.length;r=~~r,e=e===void 0?n:~~e,r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),e<r&&(e=r);var o;if(u.TYPED_ARRAY_SUPPORT)o=this.subarray(r,e),o.__proto__=u.prototype;else{var i=e-r;o=new u(i,void 0);for(var a=0;a<i;++a)o[a]=this[a+r]}return o};function E(t,r,e){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+r>e)throw new RangeError("Trying to access beyond buffer length")}u.prototype.readUIntLE=function(r,e,n){r=r|0,e=e|0,n||E(r,e,this.length);for(var o=this[r],i=1,a=0;++a<e&&(i*=256);)o+=this[r+a]*i;return o};u.prototype.readUIntBE=function(r,e,n){r=r|0,e=e|0,n||E(r,e,this.length);for(var o=this[r+--e],i=1;e>0&&(i*=256);)o+=this[r+--e]*i;return o};u.prototype.readUInt8=function(r,e){return e||E(r,1,this.length),this[r]};u.prototype.readUInt16LE=function(r,e){return e||E(r,2,this.length),this[r]|this[r+1]<<8};u.prototype.readUInt16BE=function(r,e){return e||E(r,2,this.length),this[r]<<8|this[r+1]};u.prototype.readUInt32LE=function(r,e){return e||E(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216};u.prototype.readUInt32BE=function(r,e){return e||E(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])};u.prototype.readIntLE=function(r,e,n){r=r|0,e=e|0,n||E(r,e,this.length);for(var o=this[r],i=1,a=0;++a<e&&(i*=256);)o+=this[r+a]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o};u.prototype.readIntBE=function(r,e,n){r=r|0,e=e|0,n||E(r,e,this.length);for(var o=e,i=1,a=this[r+--o];o>0&&(i*=256);)a+=this[r+--o]*i;return i*=128,a>=i&&(a-=Math.pow(2,8*e)),a};u.prototype.readInt8=function(r,e){return e||E(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};u.prototype.readInt16LE=function(r,e){e||E(r,2,this.length);var n=this[r]|this[r+1]<<8;return n&32768?n|4294901760:n};u.prototype.readInt16BE=function(r,e){e||E(r,2,this.length);var n=this[r+1]|this[r]<<8;return n&32768?n|4294901760:n};u.prototype.readInt32LE=function(r,e){return e||E(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24};u.prototype.readInt32BE=function(r,e){return e||E(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]};u.prototype.readFloatLE=function(r,e){return e||E(r,4,this.length),Z(this,r,!0,23,4)};u.prototype.readFloatBE=function(r,e){return e||E(r,4,this.length),Z(this,r,!1,23,4)};u.prototype.readDoubleLE=function(r,e){return e||E(r,8,this.length),Z(this,r,!0,52,8)};u.prototype.readDoubleBE=function(r,e){return e||E(r,8,this.length),Z(this,r,!1,52,8)};function T(t,r,e,n,o,i){if(!S(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>o||r<i)throw new RangeError('"value" argument is out of bounds');if(e+n>t.length)throw new RangeError("Index out of range")}u.prototype.writeUIntLE=function(r,e,n,o){if(r=+r,e=e|0,n=n|0,!o){var i=Math.pow(2,8*n)-1;T(this,r,e,n,i,0)}var a=1,c=0;for(this[e]=r&255;++c<n&&(a*=256);)this[e+c]=r/a&255;return e+n};u.prototype.writeUIntBE=function(r,e,n,o){if(r=+r,e=e|0,n=n|0,!o){var i=Math.pow(2,8*n)-1;T(this,r,e,n,i,0)}var a=n-1,c=1;for(this[e+a]=r&255;--a>=0&&(c*=256);)this[e+a]=r/c&255;return e+n};u.prototype.writeUInt8=function(r,e,n){return r=+r,e=e|0,n||T(this,r,e,1,255,0),u.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),this[e]=r&255,e+1};function rr(t,r,e,n){r<0&&(r=65535+r+1);for(var o=0,i=Math.min(t.length-e,2);o<i;++o)t[e+o]=(r&255<<8*(n?o:1-o))>>>(n?o:1-o)*8}u.prototype.writeUInt16LE=function(r,e,n){return r=+r,e=e|0,n||T(this,r,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):rr(this,r,e,!0),e+2};u.prototype.writeUInt16BE=function(r,e,n){return r=+r,e=e|0,n||T(this,r,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):rr(this,r,e,!1),e+2};function er(t,r,e,n){r<0&&(r=4294967295+r+1);for(var o=0,i=Math.min(t.length-e,4);o<i;++o)t[e+o]=r>>>(n?o:3-o)*8&255}u.prototype.writeUInt32LE=function(r,e,n){return r=+r,e=e|0,n||T(this,r,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e+3]=r>>>24,this[e+2]=r>>>16,this[e+1]=r>>>8,this[e]=r&255):er(this,r,e,!0),e+4};u.prototype.writeUInt32BE=function(r,e,n){return r=+r,e=e|0,n||T(this,r,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e]=r>>>24,this[e+1]=r>>>16,this[e+2]=r>>>8,this[e+3]=r&255):er(this,r,e,!1),e+4};u.prototype.writeIntLE=function(r,e,n,o){if(r=+r,e=e|0,!o){var i=Math.pow(2,8*n-1);T(this,r,e,n,i-1,-i)}var a=0,c=1,p=0;for(this[e]=r&255;++a<n&&(c*=256);)r<0&&p===0&&this[e+a-1]!==0&&(p=1),this[e+a]=(r/c>>0)-p&255;return e+n};u.prototype.writeIntBE=function(r,e,n,o){if(r=+r,e=e|0,!o){var i=Math.pow(2,8*n-1);T(this,r,e,n,i-1,-i)}var a=n-1,c=1,p=0;for(this[e+a]=r&255;--a>=0&&(c*=256);)r<0&&p===0&&this[e+a+1]!==0&&(p=1),this[e+a]=(r/c>>0)-p&255;return e+n};u.prototype.writeInt8=function(r,e,n){return r=+r,e=e|0,n||T(this,r,e,1,127,-128),u.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),r<0&&(r=255+r+1),this[e]=r&255,e+1};u.prototype.writeInt16LE=function(r,e,n){return r=+r,e=e|0,n||T(this,r,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):rr(this,r,e,!0),e+2};u.prototype.writeInt16BE=function(r,e,n){return r=+r,e=e|0,n||T(this,r,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):rr(this,r,e,!1),e+2};u.prototype.writeInt32LE=function(r,e,n){return r=+r,e=e|0,n||T(this,r,e,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8,this[e+2]=r>>>16,this[e+3]=r>>>24):er(this,r,e,!0),e+4};u.prototype.writeInt32BE=function(r,e,n){return r=+r,e=e|0,n||T(this,r,e,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),u.TYPED_ARRAY_SUPPORT?(this[e]=r>>>24,this[e+1]=r>>>16,this[e+2]=r>>>8,this[e+3]=r&255):er(this,r,e,!1),e+4};function te(t,r,e,n,o,i){if(e+n>t.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function ne(t,r,e,n,o){return o||te(t,r,e,4),zr(t,r,e,n,23,4),e+4}u.prototype.writeFloatLE=function(r,e,n){return ne(this,r,e,!0,n)};u.prototype.writeFloatBE=function(r,e,n){return ne(this,r,e,!1,n)};function oe(t,r,e,n,o){return o||te(t,r,e,8),zr(t,r,e,n,52,8),e+8}u.prototype.writeDoubleLE=function(r,e,n){return oe(this,r,e,!0,n)};u.prototype.writeDoubleBE=function(r,e,n){return oe(this,r,e,!1,n)};u.prototype.copy=function(r,e,n,o){if(n||(n=0),!o&&o!==0&&(o=this.length),e>=r.length&&(e=r.length),e||(e=0),o>0&&o<n&&(o=n),o===n||r.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),r.length-e<o-n&&(o=r.length-e+n);var i=o-n,a;if(this===r&&n<e&&e<o)for(a=i-1;a>=0;--a)r[a+e]=this[a+n];else if(i<1e3||!u.TYPED_ARRAY_SUPPORT)for(a=0;a<i;++a)r[a+e]=this[a+n];else Uint8Array.prototype.set.call(r,this.subarray(n,n+i),e);return i};u.prototype.fill=function(r,e,n,o){if(typeof r=="string"){if(typeof e=="string"?(o=e,e=0,n=this.length):typeof n=="string"&&(o=n,n=this.length),r.length===1){var i=r.charCodeAt(0);i<256&&(r=i)}if(o!==void 0&&typeof o!="string")throw new TypeError("encoding must be a string");if(typeof o=="string"&&!u.isEncoding(o))throw new TypeError("Unknown encoding: "+o)}else typeof r=="number"&&(r=r&255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;e=e>>>0,n=n===void 0?this.length:n>>>0,r||(r=0);var a;if(typeof r=="number")for(a=e;a<n;++a)this[a]=r;else{var c=S(r)?r:Q(new u(r,o).toString()),p=c.length;for(a=0;a<n-e;++a)this[a+e]=c[a%p]}return this};var Ht=/[^+\/0-9A-Za-z-_]/g;function Vt(t){if(t=$t(t).replace(Ht,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function $t(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function Xt(t){return t<16?"0"+t.toString(16):t.toString(16)}function Q(t,r){r=r||1/0;for(var e,n=t.length,o=null,i=[],a=0;a<n;++a){if(e=t.charCodeAt(a),e>55295&&e<57344){if(!o){if(e>56319){(r-=3)>-1&&i.push(239,191,189);continue}else if(a+1===n){(r-=3)>-1&&i.push(239,191,189);continue}o=e;continue}if(e<56320){(r-=3)>-1&&i.push(239,191,189),o=e;continue}e=(o-55296<<10|e-56320)+65536}else o&&(r-=3)>-1&&i.push(239,191,189);if(o=null,e<128){if((r-=1)<0)break;i.push(e)}else if(e<2048){if((r-=2)<0)break;i.push(e>>6|192,e&63|128)}else if(e<65536){if((r-=3)<0)break;i.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((r-=4)<0)break;i.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return i}function zt(t){for(var r=[],e=0;e<t.length;++e)r.push(t.charCodeAt(e)&255);return r}function qt(t,r){for(var e,n,o,i=[],a=0;a<t.length&&!((r-=2)<0);++a)e=t.charCodeAt(a),n=e>>8,o=e%256,i.push(o),i.push(n);return i}function ie(t){return yt(Vt(t))}function tr(t,r,e,n){for(var o=0;o<n&&!(o+e>=r.length||o>=t.length);++o)r[o+e]=t[o];return o}function Jt(t){return t!==t}function jt(t){return t!=null&&(!!t._isBuffer||ae(t)||Qt(t))}function ae(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function Qt(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&ae(t.slice(0,0))}import{encodeAddress as Zt,decodeAddress as Wn}from"algosdk";function v(t){return t.reduce((r,e)=>Uint8Array.from([...r,...e]))}function nr(t){return new Uint8Array(u.from(t))}function or(t){return u.from(t,"base64")}import rn from"bignumber.js";rn.config({DECIMAL_PLACES:40,EXPONENTIAL_AT:45});var co=`{"theme1":{"value":"${l.env.FRONTEND_URL}/Theme%3DDark.svg","active":true},"theme2":{"value":"${l.env.FRONTEND_URL}/Theme%3DLight.svg","active":true},"theme3":{"value":"${l.env.FRONTEND_URL}/Theme%3DLight.svg","active":true}}`;var se={V1_1:"v1_1",V2:"v2"},mo={[se.V1_1]:{testnet:62368684,mainnet:552635992},[se.V2]:{testnet:148607e3,mainnet:1002541853}};var ce=t=>nn.decodeAddress(t.toUpperCase()).publicKey;import*as b from"ethereumjs-util";function an(t){return b.toUnsigned(new b.BN(String(t)))}function xr(t){let r=an(t);if(r.length>32)throw new Error("Invalid value. The buffer length of the value is more than 32");return new Uint8Array(b.setLengthLeft(r,32))}var ue=t=>new Uint8Array(b.setLengthLeft(W(t),32)),W=t=>s.from(sn(t),"hex"),sn=t=>t.startsWith("0x")?t.slice(2):t;var pe=(t,r)=>{let e=b.keccak256(t),{r:n,s:o,v:i}=b.fromRpcSig(r);return b.ecrecover(e,i,n,o)};var ir=t=>new Uint8Array(b.keccak256(s.from(t)));import ar from"algosdk";import*as gn from"bs58";import ui from"algosdk";import Ei from"algosdk";import Ia from"algosdk";var br={"0x4343545055534443000000000000000000000000000000000000000000000000":65537};var ki={SMALLESTUNIT:l.env.SMALLEST_UNIT},Ui={SMALLEST_UNITS:l.env.SMALLEST_UNIT};var Yi=["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 Xi=l.env.REACT_APP_API_URL,zi=l.env.REACT_APP_SOCKET_URL,qi=l.env.REACT_APP_ALGO_SERVER,Ji=l.env.REACT_APP_ALGO_SERVER_PORT||"",ji=l.env.REACT_APP_ALGOD_TOKEN||"",Qi=l.env.REACT_APP_DISPENSER_LINK,Zi=l.env.REACT_APP_FRONTEND_LINK||"",ra=l.env.REACT_APP_ALGO_EXPLORER_LINK,ea=l.env.REACT_APP_ALGO_EXPLORER_ASSETS_URL,ta=(l.env.REACT_APP_REQUIRE_ACCESS_CODE||"").toLowerCase()==="true",na=l.env.REACT_APP_USERBACK_ACCESS_TOKEN,oa=(l.env.REACT_APP_EXT_ORDER_TYPES||"").toLowerCase()==="true";var ia=.001*10**6,aa=.002*10**6;var sa=l.env.REACT_APP_MASTER_APP_ID||"406",ca=l.env.REACT_APP_AGG_APP_ID||"408",pn=Number(l.env.REACT_APP_CODEX_APP_ID||"467960617");console.log("CODEX_APP_ID",pn);var ln=l.env.REACT_APP_ALGO_NETWORK||"";var ua=ln.toLowerCase()==="mainnet"?"mainnet":"testnet";import Gc from"algosdk";var he=(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))(he||{}),xe=(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))(xe||{}),Us={...he,...xe};import ou from"algosdk";var F=(t,r,e)=>{switch(r){case"8B":return ar.encodeUint64(Number(t));case"32B":return xr(t);case"str":return nr(String(t));case"address":return sr(String(t),e);case"token":return hn(String(t),e);case"float":{var n=s.alloc(8);return n.writeDoubleBE(Number(t),0),new Uint8Array(n)}case"bool":return new Uint8Array(s.from(ar.encodeUint64(Number(t))).subarray(-1));case"2B":return new Uint8Array(s.from(ar.encodeUint64(Number(t))).subarray(-2));case"4B":return new Uint8Array(s.from(ar.encodeUint64(Number(t))).subarray(-4));default:return s.from(t.toString())}};var hn=(t,r)=>r===8?xr(+t):br[t]?new Uint8Array(W(String(t))):sr(String(t),r);var de=t=>s.from(ir(t)).toString("hex"),fe=(t,r)=>v([F(r,"str"),ir(t)]),ge=(t,r)=>v([F(r,"str"),s.from(t,"hex")]),K=(t,r)=>{let e=xn.ABIMethod.fromSignature(t),n=e.getSelector(),o={},i=r.map((a,c)=>{let p=e.args[c].type.encode(a);return o[`txnArgs${c}`]=Array.apply([],Array.from(p)).join(", "),p});return[n,...i]},Ar=(t,r,e)=>{let n=s.from(t,r),o=n.subarray(n.length-e),i=s.from(o).toString();return or(i)},be=(t,r,e,n,o="hex")=>[Er(t,o,n),En(r,n),bn(e,n,t,r,o)],En=(t,r)=>r===8?or(t):r===1?Tr.decode(t):W(t),bn=(t,r,e,n,o)=>r===8||r===1?sr(t,r):pe(Er(e,o,r),n),An=(t,r)=>r===8?"MX":r===1?"":`Ethereum Signed Message:
2
+ ${t.length}`,Er=(t,r,e)=>{let n=s.from(t,r);return s.concat([nr(An(n,e)),n])},cn=t=>{switch(t){case"ALGORAND":return 8;case"SOLANA":return 1;case"EVM":return 5;default:return 5}},sr=(t,r)=>r===8?ce(t):r===1?Tr.decode(t):ue(t),Tn="CCTPUSDC",_n=65537;function yn(){let t=s.alloc(32,0);return s.from(Tn,"utf-8").copy(t),t}function ap(){return{address:"0x"+yn().toString("hex"),chainId:_n}}export{En as decodeSignature,sr as encodeAddress,de as generateHash,K as getAppArgs,fe as getBoxKey,ge as getBoxKeyFromHash,Ar as getDataBytesFromMsg,be as getMsgArgs,Er as getPrefixedMessage,cn as getProviderChainId,bn as getPublicKey,yn as getUnifiedUSDC,ap as getUnifiedUSDCToken,_n as unified_CCTP_ChainID,Tn as unified_CCTP_token};
3
3
  /*!
4
4
  * The buffer module from node.js, for the browser.
5
5
  *