@ultrade/shared 1.0.27 → 1.0.29

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 (210) hide show
  1. package/dist/browser/common/index.js +1 -7
  2. package/dist/browser/{common/utils/social.js → constants/env.js} +1 -1
  3. package/dist/browser/constants/index.js +1 -1
  4. package/dist/browser/enums/index.js +1 -1
  5. package/dist/browser/helpers/algo.helper.js +1 -1
  6. package/dist/browser/helpers/assert.helper.js +1 -1
  7. package/dist/browser/helpers/atomic.helper.js +1 -1
  8. package/dist/browser/helpers/balance.helper.js +1 -1
  9. package/dist/browser/helpers/codex/common.helper.js +2 -2
  10. package/dist/browser/helpers/codex/index.js +2 -2
  11. package/dist/browser/helpers/codex/mbr.helper.js +1 -1
  12. package/dist/browser/helpers/codex/mna.helper.js +1 -1
  13. package/dist/browser/helpers/codex/order.helper.js +1 -1
  14. package/dist/browser/helpers/codex/setGlobal.helper.js +1 -1
  15. package/dist/browser/{common/mappers/codexBalance.mapper.js → helpers/codex/tokens.js} +1 -1
  16. package/dist/browser/helpers/codex/transfer.helper.js +2 -2
  17. package/dist/browser/helpers/codex/txn.helper.js +1 -1
  18. package/dist/browser/helpers/codex.helper.js +6 -6
  19. package/dist/browser/helpers/eth.helper.js +2 -2
  20. package/dist/browser/helpers/order.helper.js +1 -1
  21. package/dist/browser/helpers/pair.helper.js +1 -1
  22. package/dist/browser/helpers/pointSystem.helper.js +1 -1
  23. package/dist/browser/helpers/withdraw.helper.js +2 -2
  24. package/dist/browser/interfaces/index.js +1 -1
  25. package/dist/browser/services/index.js +11 -0
  26. package/dist/browser/types/index.js +1 -1
  27. package/dist/{src/common → common}/index.d.ts +0 -1
  28. package/dist/{src/common → common}/utils/index.d.ts +3 -0
  29. package/dist/constants/env.d.ts +6 -0
  30. package/dist/{src/constants → constants}/index.d.ts +1 -0
  31. package/dist/constants/social.d.ts +4 -0
  32. package/dist/{src/enums → enums}/db/index.d.ts +1 -0
  33. package/dist/enums/db/pending-actions.enum.d.ts +6 -0
  34. package/dist/{src/enums → enums}/index.d.ts +2 -0
  35. package/dist/enums/points.enum.d.ts +4 -0
  36. package/dist/enums/socket.enum.d.ts +18 -0
  37. package/dist/{src/helpers → helpers}/codex/common.helper.d.ts +2 -5
  38. package/dist/{src/helpers → helpers}/codex/index.d.ts +2 -0
  39. package/dist/helpers/codex/tokens.d.ts +5 -0
  40. package/dist/{src/common/utils → helpers}/decode.d.ts +1 -1
  41. package/dist/interfaces/algostreamer/index.d.ts +49 -0
  42. package/dist/{src/interfaces → interfaces}/index.d.ts +2 -0
  43. package/dist/{src/interfaces → interfaces}/order.interface.d.ts +1 -0
  44. package/dist/interfaces/socket.interface.d.ts +16 -0
  45. package/dist/node/common/index.js +1 -1
  46. package/dist/node/constants/env.js +1 -0
  47. package/dist/node/constants/index.js +1 -1
  48. package/dist/node/enums/index.js +1 -1
  49. package/dist/node/helpers/algo.helper.js +1 -1
  50. package/dist/node/helpers/assert.helper.js +1 -1
  51. package/dist/node/helpers/atomic.helper.js +1 -1
  52. package/dist/node/helpers/balance.helper.js +1 -1
  53. package/dist/node/helpers/codex/common.helper.js +2 -2
  54. package/dist/node/helpers/codex/index.js +2 -2
  55. package/dist/node/helpers/codex/mbr.helper.js +1 -1
  56. package/dist/node/helpers/codex/mna.helper.js +1 -1
  57. package/dist/node/helpers/codex/order.helper.js +1 -1
  58. package/dist/node/helpers/codex/setGlobal.helper.js +1 -1
  59. package/dist/node/helpers/codex/tokens.js +1 -0
  60. package/dist/node/helpers/codex/transfer.helper.js +2 -2
  61. package/dist/node/helpers/codex/txn.helper.js +1 -1
  62. package/dist/node/helpers/codex.helper.js +6 -6
  63. package/dist/node/helpers/eth.helper.js +2 -2
  64. package/dist/node/helpers/order.helper.js +1 -1
  65. package/dist/node/helpers/pair.helper.js +1 -1
  66. package/dist/node/helpers/pointSystem.helper.js +1 -1
  67. package/dist/node/helpers/withdraw.helper.js +2 -2
  68. package/dist/node/interfaces/index.js +1 -1
  69. package/dist/node/services/index.js +1 -0
  70. package/dist/node/types/index.js +1 -1
  71. package/dist/services/index.d.ts +2 -0
  72. package/dist/services/pairParam.service.d.ts +14 -0
  73. package/dist/services/tmc.service.d.ts +33 -0
  74. package/dist/{src/types → types}/api/request.types.d.ts +10 -10
  75. package/dist/{src/types → types}/settings.type.d.ts +3 -3
  76. package/package.json +39 -5
  77. package/dist/browser/common/big-number.helper.js +0 -11
  78. package/dist/browser/common/mappers/codexAsset.mapper.js +0 -11
  79. package/dist/browser/common/mappers/index.js +0 -11
  80. package/dist/browser/common/mappers/trade.mapper.js +0 -11
  81. package/dist/browser/common/utils/assert.js +0 -11
  82. package/dist/browser/common/utils/index.js +0 -11
  83. package/dist/browser/common/utils/stat.js +0 -11
  84. package/dist/browser/helpers/vaa.helper.js +0 -11
  85. package/dist/node/common/big-number.helper.js +0 -1
  86. package/dist/node/common/mappers/codexAsset.mapper.js +0 -1
  87. package/dist/node/common/mappers/codexBalance.mapper.js +0 -1
  88. package/dist/node/common/mappers/index.js +0 -1
  89. package/dist/node/common/mappers/trade.mapper.js +0 -1
  90. package/dist/node/common/utils/assert.js +0 -1
  91. package/dist/node/common/utils/index.js +0 -1
  92. package/dist/node/common/utils/social.js +0 -1
  93. package/dist/node/common/utils/stat.js +0 -1
  94. package/dist/node/helpers/vaa.helper.js +0 -0
  95. package/dist/src/helpers/vaa.helper.d.ts +0 -0
  96. /package/dist/browser/{common → helpers}/auth.helper.js +0 -0
  97. /package/dist/browser/{common/utils → helpers}/decode.js +0 -0
  98. /package/dist/{src/common → common}/big-number.helper.d.ts +0 -0
  99. /package/dist/{src/common → common}/mappers/codexAsset.mapper.d.ts +0 -0
  100. /package/dist/{src/common → common}/mappers/codexBalance.mapper.d.ts +0 -0
  101. /package/dist/{src/common → common}/mappers/index.d.ts +0 -0
  102. /package/dist/{src/common → common}/mappers/trade.mapper.d.ts +0 -0
  103. /package/dist/{src/common → common}/utils/assert.d.ts +0 -0
  104. /package/dist/{src/common → common}/utils/social.d.ts +0 -0
  105. /package/dist/{src/common → common}/utils/stat.d.ts +0 -0
  106. /package/dist/{src/constants → constants}/auth.d.ts +0 -0
  107. /package/dist/{src/constants → constants}/cctp.d.ts +0 -0
  108. /package/dist/{src/constants → constants}/codex.d.ts +0 -0
  109. /package/dist/{src/constants → constants}/frontend.d.ts +0 -0
  110. /package/dist/{src/constants → constants}/response.d.ts +0 -0
  111. /package/dist/{src/constants → constants}/settings.d.ts +0 -0
  112. /package/dist/{src/constants → constants}/withdrawalWalletsMessage.d.ts +0 -0
  113. /package/dist/{src/enums → enums}/chains.enum.d.ts +0 -0
  114. /package/dist/{src/enums → enums}/db/account/index.d.ts +0 -0
  115. /package/dist/{src/enums → enums}/db/affiliate.enum.d.ts +0 -0
  116. /package/dist/{src/enums → enums}/db/available-pair-settings.enum.d.ts +0 -0
  117. /package/dist/{src/enums → enums}/db/common.enum.d.ts +0 -0
  118. /package/dist/{src/enums → enums}/db/component/index.d.ts +0 -0
  119. /package/dist/{src/enums → enums}/db/market-maker.enum.d.ts +0 -0
  120. /package/dist/{src/enums → enums}/db/notification-center/userNotification.enum.d.ts +0 -0
  121. /package/dist/{src/enums → enums}/db/order-side.enum.d.ts +0 -0
  122. /package/dist/{src/enums → enums}/db/order-status.enum.d.ts +0 -0
  123. /package/dist/{src/enums → enums}/db/order-type.enum.d.ts +0 -0
  124. /package/dist/{src/enums → enums}/db/relayer.enum.d.ts +0 -0
  125. /package/dist/{src/enums → enums}/db/setting-type.enum.d.ts +0 -0
  126. /package/dist/{src/enums → enums}/db/social-action.enum.d.ts +0 -0
  127. /package/dist/{src/enums → enums}/db/social-prompt.enum.d.ts +0 -0
  128. /package/dist/{src/enums → enums}/db/social.enum.d.ts +0 -0
  129. /package/dist/{src/enums → enums}/db/state-type.enum.d.ts +0 -0
  130. /package/dist/{src/enums → enums}/db/trade.enums.d.ts +0 -0
  131. /package/dist/{src/enums → enums}/db/tradingKeyType.enum.d.ts +0 -0
  132. /package/dist/{src/enums → enums}/db/upgrade.enum.d.ts +0 -0
  133. /package/dist/{src/enums → enums}/db/withdrawal-wallet.enum.d.ts +0 -0
  134. /package/dist/{src/enums → enums}/maintenanceMode.enum.d.ts +0 -0
  135. /package/dist/{src/enums → enums}/notification.enum.d.ts +0 -0
  136. /package/dist/{src/enums → enums}/rabbitMq.d.ts +0 -0
  137. /package/dist/{src/enums → enums}/settings.enum.d.ts +0 -0
  138. /package/dist/{src/enums → enums}/social.enum.d.ts +0 -0
  139. /package/dist/{src/helpers → helpers}/Encoding.d.ts +0 -0
  140. /package/dist/{src/helpers → helpers}/algo.helper.d.ts +0 -0
  141. /package/dist/{src/helpers → helpers}/assert.helper.d.ts +0 -0
  142. /package/dist/{src/helpers → helpers}/atomic.helper.d.ts +0 -0
  143. /package/dist/{src/common → helpers}/auth.helper.d.ts +0 -0
  144. /package/dist/{src/helpers → helpers}/balance.helper.d.ts +0 -0
  145. /package/dist/{src/helpers → helpers}/codex/mbr.helper.d.ts +0 -0
  146. /package/dist/{src/helpers → helpers}/codex/mna.helper.d.ts +0 -0
  147. /package/dist/{src/helpers → helpers}/codex/order.helper.d.ts +0 -0
  148. /package/dist/{src/helpers → helpers}/codex/setGlobal.helper.d.ts +0 -0
  149. /package/dist/{src/helpers → helpers}/codex/transfer.helper.d.ts +0 -0
  150. /package/dist/{src/helpers → helpers}/codex/txn.helper.d.ts +0 -0
  151. /package/dist/{src/helpers → helpers}/codex.helper.d.ts +0 -0
  152. /package/dist/{src/helpers → helpers}/eth.helper.d.ts +0 -0
  153. /package/dist/{src/helpers → helpers}/index.d.ts +0 -0
  154. /package/dist/{src/helpers → helpers}/interval.helpers.d.ts +0 -0
  155. /package/dist/{src/helpers → helpers}/liquidity.helper.d.ts +0 -0
  156. /package/dist/{src/helpers → helpers}/order.helper.d.ts +0 -0
  157. /package/dist/{src/helpers → helpers}/pair.helper.d.ts +0 -0
  158. /package/dist/{src/helpers → helpers}/pointSystem.helper.d.ts +0 -0
  159. /package/dist/{src/helpers → helpers}/ticker.helpers.d.ts +0 -0
  160. /package/dist/{src/helpers → helpers}/withdraw.helper.d.ts +0 -0
  161. /package/dist/{src/interfaces → interfaces}/accountInfo.interface.d.ts +0 -0
  162. /package/dist/{src/interfaces → interfaces}/api/affiliate.interface.d.ts +0 -0
  163. /package/dist/{src/interfaces → interfaces}/api/index.d.ts +0 -0
  164. /package/dist/{src/interfaces → interfaces}/cache.interface.d.ts +0 -0
  165. /package/dist/{src/interfaces → interfaces}/db/baseModel.interface.d.ts +0 -0
  166. /package/dist/{src/interfaces → interfaces}/db/hummingbot/index.d.ts +0 -0
  167. /package/dist/{src/interfaces → interfaces}/db/index.d.ts +0 -0
  168. /package/dist/{src/interfaces → interfaces}/db/market/index.d.ts +0 -0
  169. /package/dist/{src/interfaces → interfaces}/db/marketing/index.d.ts +0 -0
  170. /package/dist/{src/interfaces → interfaces}/db/notification_center/index.d.ts +0 -0
  171. /package/dist/{src/interfaces → interfaces}/db/relayer/index.d.ts +0 -0
  172. /package/dist/{src/interfaces → interfaces}/db/social/index.d.ts +0 -0
  173. /package/dist/{src/interfaces → interfaces}/db/softDeleteModel.interface.d.ts +0 -0
  174. /package/dist/{src/interfaces → interfaces}/db/white_label/index.d.ts +0 -0
  175. /package/dist/{src/interfaces → interfaces}/db/withdrawal_wallets/index.d.ts +0 -0
  176. /package/dist/{src/interfaces → interfaces}/dto/index.d.ts +0 -0
  177. /package/dist/{src/interfaces → interfaces}/emailService.interface.d.ts +0 -0
  178. /package/dist/{src/interfaces → interfaces}/kmsService.interface.d.ts +0 -0
  179. /package/dist/{src/interfaces → interfaces}/last-look-trade.interface.d.ts +0 -0
  180. /package/dist/{src/interfaces → interfaces}/market.interface.d.ts +0 -0
  181. /package/dist/{src/interfaces → interfaces}/pagination.interface.d.ts +0 -0
  182. /package/dist/{src/interfaces → interfaces}/pair.interface.d.ts +0 -0
  183. /package/dist/{src/interfaces → interfaces}/query.interface.d.ts +0 -0
  184. /package/dist/{src/interfaces → interfaces}/services/accountCache.interface.d.ts +0 -0
  185. /package/dist/{src/interfaces → interfaces}/services/algod.interface.d.ts +0 -0
  186. /package/dist/{src/interfaces → interfaces}/services/balances.interface.d.ts +0 -0
  187. /package/dist/{src/interfaces → interfaces}/services/coin-market-cap.interface.d.ts +0 -0
  188. /package/dist/{src/interfaces → interfaces}/services/index.d.ts +0 -0
  189. /package/dist/{src/interfaces → interfaces}/services/price-model.interface.d.ts +0 -0
  190. /package/dist/{src/interfaces → interfaces}/services/price-service.interface.d.ts +0 -0
  191. /package/dist/{src/interfaces → interfaces}/services/socialActivity.interface.d.ts +0 -0
  192. /package/dist/{src/interfaces → interfaces}/services/tmc.interface.d.ts +0 -0
  193. /package/dist/{src/interfaces → interfaces}/settings.interface.d.ts +0 -0
  194. /package/dist/{src/interfaces → interfaces}/streaming.interface.d.ts +0 -0
  195. /package/dist/{src/interfaces → interfaces}/timestream.interface.d.ts +0 -0
  196. /package/dist/{src/interfaces → interfaces}/trading.interface.d.ts +0 -0
  197. /package/dist/{src/interfaces → interfaces}/tradingKey.interface.d.ts +0 -0
  198. /package/dist/{src/interfaces → interfaces}/transfer.interface.d.ts +0 -0
  199. /package/dist/{src/interfaces → interfaces}/wallet.interface.d.ts +0 -0
  200. /package/dist/{src/interfaces → interfaces}/withdrawalWallets.interface.d.ts +0 -0
  201. /package/dist/node/{common → helpers}/auth.helper.js +0 -0
  202. /package/dist/node/{common/utils → helpers}/decode.js +0 -0
  203. /package/dist/{src/types → types}/algo-order.type.d.ts +0 -0
  204. /package/dist/{src/types → types}/amm/amm.d.ts +0 -0
  205. /package/dist/{src/types → types}/balance-result.types.d.ts +0 -0
  206. /package/dist/{src/types → types}/codex.types.d.ts +0 -0
  207. /package/dist/{src/types → types}/hummingbots.types.d.ts +0 -0
  208. /package/dist/{src/types → types}/index.d.ts +0 -0
  209. /package/dist/{src/types → types}/notification.type.d.ts +0 -0
  210. /package/dist/{src/types → types}/state.type.d.ts +0 -0
@@ -1,4 +1,4 @@
1
- function G(){throw new Error("setTimeout has not been defined")}function J(){throw new Error("clearTimeout has not been defined")}var R=G,I=J;typeof globalThis.setTimeout=="function"&&(R=setTimeout);typeof globalThis.clearTimeout=="function"&&(I=clearTimeout);function O(i){if(R===setTimeout)return setTimeout(i,0);if((R===G||!R)&&setTimeout)return R=setTimeout,setTimeout(i,0);try{return R(i,0)}catch{try{return R.call(null,i,0)}catch{return R.call(this,i,0)}}}function lr(i){if(I===clearTimeout)return clearTimeout(i);if((I===J||!I)&&clearTimeout)return I=clearTimeout,clearTimeout(i);try{return I(i)}catch{try{return I.call(null,i)}catch{return I.call(this,i)}}}var y=[],Y=!1,_,S=-1;function pr(){!Y||!_||(Y=!1,_.length?y=_.concat(y):S=-1,y.length&&Q())}function Q(){if(!Y){var i=O(pr);Y=!0;for(var r=y.length;r;){for(_=y,y=[];++S<r;)_&&_[S].run();S=-1,r=y.length}_=null,Y=!1,lr(i)}}function sr(i){var r=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)r[n-1]=arguments[n];y.push(new X(i,r)),y.length===1&&!Y&&O(Q)}function X(i,r){this.fun=i,this.array=r}X.prototype.run=function(){this.fun.apply(null,this.array)};var wr="browser",xr="browser",Er=!0,mr={},Ar=[],gr="",yr={},Tr={},Rr={};function d(){}var Ir=d,_r=d,dr=d,vr=d,Ur=d,Br=d,Yr=d;function Sr(i){throw new Error("process.binding is not supported")}function Pr(){return"/"}function Cr(i){throw new Error("process.chdir is not supported")}function kr(){return 0}var B=globalThis.performance||{},Dr=B.now||B.mozNow||B.msNow||B.oNow||B.webkitNow||function(){return new Date().getTime()};function Mr(i){var r=Dr.call(B)*.001,n=Math.floor(r),e=Math.floor(r%1*1e9);return i&&(n=n-i[0],e=e-i[1],e<0&&(n--,e+=1e9)),[n,e]}var Nr=new Date;function Lr(){var i=new Date,r=i-Nr;return r/1e3}var L={nextTick:sr,title:wr,browser:Er,env:mr,argv:Ar,version:gr,versions:yr,on:Ir,addListener:_r,once:dr,off:vr,removeListener:Ur,removeAllListeners:Br,emit:Yr,binding:Sr,cwd:Pr,chdir:Cr,umask:kr,hrtime:Mr,platform:xr,release:Tr,config:Rr,uptime:Lr},z={};Object.keys(z).forEach(i=>{let r=i.split("."),n=L;for(let e=0;e<r.length;e++){let t=r[e];e===r.length-1?n[t]=z[i]:n=n[t]||(n[t]={})}});var A=[],E=[],Fr=typeof Uint8Array<"u"?Uint8Array:Array,W=!1;function $(){W=!0;for(var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,n=i.length;r<n;++r)A[r]=i[r],E[i.charCodeAt(r)]=r;E[45]=62,E[95]=63}function Wr(i){W||$();var r,n,e,t,f,u,a=i.length;if(a%4>0)throw new Error("Invalid string. Length must be a multiple of 4");f=i[a-2]==="="?2:i[a-1]==="="?1:0,u=new Fr(a*3/4-f),e=f>0?a-4:a;var h=0;for(r=0,n=0;r<e;r+=4,n+=3)t=E[i.charCodeAt(r)]<<18|E[i.charCodeAt(r+1)]<<12|E[i.charCodeAt(r+2)]<<6|E[i.charCodeAt(r+3)],u[h++]=t>>16&255,u[h++]=t>>8&255,u[h++]=t&255;return f===2?(t=E[i.charCodeAt(r)]<<2|E[i.charCodeAt(r+1)]>>4,u[h++]=t&255):f===1&&(t=E[i.charCodeAt(r)]<<10|E[i.charCodeAt(r+1)]<<4|E[i.charCodeAt(r+2)]>>2,u[h++]=t>>8&255,u[h++]=t&255),u}function Hr(i){return A[i>>18&63]+A[i>>12&63]+A[i>>6&63]+A[i&63]}function Vr(i,r,n){for(var e,t=[],f=r;f<n;f+=3)e=(i[f]<<16)+(i[f+1]<<8)+i[f+2],t.push(Hr(e));return t.join("")}function q(i){W||$();for(var r,n=i.length,e=n%3,t="",f=[],u=16383,a=0,h=n-e;a<h;a+=u)f.push(Vr(i,a,a+u>h?h:a+u));return e===1?(r=i[n-1],t+=A[r>>2],t+=A[r<<4&63],t+="=="):e===2&&(r=(i[n-2]<<8)+i[n-1],t+=A[r>>10],t+=A[r>>4&63],t+=A[r<<2&63],t+="="),f.push(t),f.join("")}o.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;function P(){return o.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function T(i,r){if(P()<r)throw new RangeError("Invalid typed array length");return o.TYPED_ARRAY_SUPPORT?(i=new Uint8Array(r),i.__proto__=o.prototype):(i===null&&(i=new o(r)),i.length=r),i}function o(i,r,n){if(!o.TYPED_ARRAY_SUPPORT&&!(this instanceof o))return new o(i,r,n);if(typeof i=="number"){if(typeof r=="string")throw new Error("If encoding is specified then the first argument must be a string");return H(this,i)}return b(this,i,r,n)}o.poolSize=8192;o._augment=function(i){return i.__proto__=o.prototype,i};function b(i,r,n,e){if(typeof r=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&r instanceof ArrayBuffer?Jr(i,r,n,e):typeof r=="string"?Gr(i,r,n):Or(i,r)}o.from=function(i,r,n){return b(null,i,r,n)};o.kMaxLength=P();o.TYPED_ARRAY_SUPPORT&&(o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&o[Symbol.species]);function j(i){if(typeof i!="number")throw new TypeError('"size" argument must be a number');if(i<0)throw new RangeError('"size" argument must not be negative')}function zr(i,r,n,e){return j(r),r<=0?T(i,r):n!==void 0?typeof e=="string"?T(i,r).fill(n,e):T(i,r).fill(n):T(i,r)}o.alloc=function(i,r,n){return zr(null,i,r,n)};function H(i,r){if(j(r),i=T(i,r<0?0:V(r)|0),!o.TYPED_ARRAY_SUPPORT)for(var n=0;n<r;++n)i[n]=0;return i}o.allocUnsafe=function(i){return H(null,i)};o.allocUnsafeSlow=function(i){return H(null,i)};function Gr(i,r,n){if((typeof n!="string"||n==="")&&(n="utf8"),!o.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var e=rr(r,n)|0;i=T(i,e);var t=i.write(r,n);return t!==e&&(i=i.slice(0,t)),i}function F(i,r){var n=r.length<0?0:V(r.length)|0;i=T(i,n);for(var e=0;e<n;e+=1)i[e]=r[e]&255;return i}function Jr(i,r,n,e){if(r.byteLength,n<0||r.byteLength<n)throw new RangeError("'offset' is out of bounds");if(r.byteLength<n+(e||0))throw new RangeError("'length' is out of bounds");return n===void 0&&e===void 0?r=new Uint8Array(r):e===void 0?r=new Uint8Array(r,n):r=new Uint8Array(r,n,e),o.TYPED_ARRAY_SUPPORT?(i=r,i.__proto__=o.prototype):i=F(i,r),i}function Or(i,r){if(g(r)){var n=V(r.length)|0;return i=T(i,n),i.length===0||r.copy(i,0,0,n),i}if(r){if(typeof ArrayBuffer<"u"&&r.buffer instanceof ArrayBuffer||"length"in r)return typeof r.length!="number"||ln(r.length)?T(i,0):F(i,r);if(r.type==="Buffer"&&Array.isArray(r.data))return F(i,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function V(i){if(i>=P())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+P().toString(16)+" bytes");return i|0}o.isBuffer=pn;function g(i){return!!(i!=null&&i._isBuffer)}o.compare=function(r,n){if(!g(r)||!g(n))throw new TypeError("Arguments must be Buffers");if(r===n)return 0;for(var e=r.length,t=n.length,f=0,u=Math.min(e,t);f<u;++f)if(r[f]!==n[f]){e=r[f],t=n[f];break}return e<t?-1:t<e?1:0};o.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}};o.concat=function(r,n){if(!Array.isArray(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return o.alloc(0);var e;if(n===void 0)for(n=0,e=0;e<r.length;++e)n+=r[e].length;var t=o.allocUnsafe(n),f=0;for(e=0;e<r.length;++e){var u=r[e];if(!g(u))throw new TypeError('"list" argument must be an Array of Buffers');u.copy(t,f),f+=u.length}return t};function rr(i,r){if(g(i))return i.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(i)||i instanceof ArrayBuffer))return i.byteLength;typeof i!="string"&&(i=""+i);var n=i.length;if(n===0)return 0;for(var e=!1;;)switch(r){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return C(i).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return n*2;case"hex":return n>>>1;case"base64":return or(i).length;default:if(e)return C(i).length;r=(""+r).toLowerCase(),e=!0}}o.byteLength=rr;function Qr(i,r,n){var e=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,r>>>=0,n<=r))return"";for(i||(i="utf8");;)switch(i){case"hex":return en(this,r,n);case"utf8":case"utf-8":return er(this,r,n);case"ascii":return rn(this,r,n);case"latin1":case"binary":return nn(this,r,n);case"base64":return br(this,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return tn(this,r,n);default:if(e)throw new TypeError("Unknown encoding: "+i);i=(i+"").toLowerCase(),e=!0}}o.prototype._isBuffer=!0;function v(i,r,n){var e=i[r];i[r]=i[n],i[n]=e}o.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 n=0;n<r;n+=2)v(this,n,n+1);return this};o.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 n=0;n<r;n+=4)v(this,n,n+3),v(this,n+1,n+2);return this};o.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 n=0;n<r;n+=8)v(this,n,n+7),v(this,n+1,n+6),v(this,n+2,n+5),v(this,n+3,n+4);return this};o.prototype.toString=function(){var r=this.length|0;return r===0?"":arguments.length===0?er(this,0,r):Qr.apply(this,arguments)};o.prototype.equals=function(r){if(!g(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:o.compare(this,r)===0};o.prototype.compare=function(r,n,e,t,f){if(!g(r))throw new TypeError("Argument must be a Buffer");if(n===void 0&&(n=0),e===void 0&&(e=r?r.length:0),t===void 0&&(t=0),f===void 0&&(f=this.length),n<0||e>r.length||t<0||f>this.length)throw new RangeError("out of range index");if(t>=f&&n>=e)return 0;if(t>=f)return-1;if(n>=e)return 1;if(n>>>=0,e>>>=0,t>>>=0,f>>>=0,this===r)return 0;for(var u=f-t,a=e-n,h=Math.min(u,a),l=this.slice(t,f),p=r.slice(n,e),c=0;c<h;++c)if(l[c]!==p[c]){u=l[c],a=p[c];break}return u<a?-1:a<u?1:0};function nr(i,r,n,e,t){if(i.length===0)return-1;if(typeof n=="string"?(e=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=t?0:i.length-1),n<0&&(n=i.length+n),n>=i.length){if(t)return-1;n=i.length-1}else if(n<0)if(t)n=0;else return-1;if(typeof r=="string"&&(r=o.from(r,e)),g(r))return r.length===0?-1:Z(i,r,n,e,t);if(typeof r=="number")return r=r&255,o.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?t?Uint8Array.prototype.indexOf.call(i,r,n):Uint8Array.prototype.lastIndexOf.call(i,r,n):Z(i,[r],n,e,t);throw new TypeError("val must be string, number or Buffer")}function Z(i,r,n,e,t){var f=1,u=i.length,a=r.length;if(e!==void 0&&(e=String(e).toLowerCase(),e==="ucs2"||e==="ucs-2"||e==="utf16le"||e==="utf-16le")){if(i.length<2||r.length<2)return-1;f=2,u/=2,a/=2,n/=2}function h(x,U){return f===1?x[U]:x.readUInt16BE(U*f)}var l;if(t){var p=-1;for(l=n;l<u;l++)if(h(i,l)===h(r,p===-1?0:l-p)){if(p===-1&&(p=l),l-p+1===a)return p*f}else p!==-1&&(l-=l-p),p=-1}else for(n+a>u&&(n=u-a),l=n;l>=0;l--){for(var c=!0,m=0;m<a;m++)if(h(i,l+m)!==h(r,m)){c=!1;break}if(c)return l}return-1}o.prototype.includes=function(r,n,e){return this.indexOf(r,n,e)!==-1};o.prototype.indexOf=function(r,n,e){return nr(this,r,n,e,!0)};o.prototype.lastIndexOf=function(r,n,e){return nr(this,r,n,e,!1)};function Xr(i,r,n,e){n=Number(n)||0;var t=i.length-n;e?(e=Number(e),e>t&&(e=t)):e=t;var f=r.length;if(f%2!==0)throw new TypeError("Invalid hex string");e>f/2&&(e=f/2);for(var u=0;u<e;++u){var a=parseInt(r.substr(u*2,2),16);if(isNaN(a))return u;i[n+u]=a}return u}function qr(i,r,n,e){return M(C(r,i.length-n),i,n,e)}function ir(i,r,n,e){return M(hn(r),i,n,e)}function Zr(i,r,n,e){return ir(i,r,n,e)}function Kr(i,r,n,e){return M(or(r),i,n,e)}function $r(i,r,n,e){return M(cn(r,i.length-n),i,n,e)}o.prototype.write=function(r,n,e,t){if(n===void 0)t="utf8",e=this.length,n=0;else if(e===void 0&&typeof n=="string")t=n,e=this.length,n=0;else if(isFinite(n))n=n|0,isFinite(e)?(e=e|0,t===void 0&&(t="utf8")):(t=e,e=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var f=this.length-n;if((e===void 0||e>f)&&(e=f),r.length>0&&(e<0||n<0)||n>this.length)throw new RangeError("Attempt to write outside buffer bounds");t||(t="utf8");for(var u=!1;;)switch(t){case"hex":return Xr(this,r,n,e);case"utf8":case"utf-8":return qr(this,r,n,e);case"ascii":return ir(this,r,n,e);case"latin1":case"binary":return Zr(this,r,n,e);case"base64":return Kr(this,r,n,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return $r(this,r,n,e);default:if(u)throw new TypeError("Unknown encoding: "+t);t=(""+t).toLowerCase(),u=!0}};o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function br(i,r,n){return r===0&&n===i.length?q(i):q(i.slice(r,n))}function er(i,r,n){n=Math.min(i.length,n);for(var e=[],t=r;t<n;){var f=i[t],u=null,a=f>239?4:f>223?3:f>191?2:1;if(t+a<=n){var h,l,p,c;switch(a){case 1:f<128&&(u=f);break;case 2:h=i[t+1],(h&192)===128&&(c=(f&31)<<6|h&63,c>127&&(u=c));break;case 3:h=i[t+1],l=i[t+2],(h&192)===128&&(l&192)===128&&(c=(f&15)<<12|(h&63)<<6|l&63,c>2047&&(c<55296||c>57343)&&(u=c));break;case 4:h=i[t+1],l=i[t+2],p=i[t+3],(h&192)===128&&(l&192)===128&&(p&192)===128&&(c=(f&15)<<18|(h&63)<<12|(l&63)<<6|p&63,c>65535&&c<1114112&&(u=c))}}u===null?(u=65533,a=1):u>65535&&(u-=65536,e.push(u>>>10&1023|55296),u=56320|u&1023),e.push(u),t+=a}return jr(e)}var K=4096;function jr(i){var r=i.length;if(r<=K)return String.fromCharCode.apply(String,i);for(var n="",e=0;e<r;)n+=String.fromCharCode.apply(String,i.slice(e,e+=K));return n}function rn(i,r,n){var e="";n=Math.min(i.length,n);for(var t=r;t<n;++t)e+=String.fromCharCode(i[t]&127);return e}function nn(i,r,n){var e="";n=Math.min(i.length,n);for(var t=r;t<n;++t)e+=String.fromCharCode(i[t]);return e}function en(i,r,n){var e=i.length;(!r||r<0)&&(r=0),(!n||n<0||n>e)&&(n=e);for(var t="",f=r;f<n;++f)t+=an(i[f]);return t}function tn(i,r,n){for(var e=i.slice(r,n),t="",f=0;f<e.length;f+=2)t+=String.fromCharCode(e[f]+e[f+1]*256);return t}o.prototype.slice=function(r,n){var e=this.length;r=~~r,n=n===void 0?e:~~n,r<0?(r+=e,r<0&&(r=0)):r>e&&(r=e),n<0?(n+=e,n<0&&(n=0)):n>e&&(n=e),n<r&&(n=r);var t;if(o.TYPED_ARRAY_SUPPORT)t=this.subarray(r,n),t.__proto__=o.prototype;else{var f=n-r;t=new o(f,void 0);for(var u=0;u<f;++u)t[u]=this[u+r]}return t};function s(i,r,n){if(i%1!==0||i<0)throw new RangeError("offset is not uint");if(i+r>n)throw new RangeError("Trying to access beyond buffer length")}o.prototype.readUIntLE=function(r,n,e){r=r|0,n=n|0,e||s(r,n,this.length);for(var t=this[r],f=1,u=0;++u<n&&(f*=256);)t+=this[r+u]*f;return t};o.prototype.readUIntBE=function(r,n,e){r=r|0,n=n|0,e||s(r,n,this.length);for(var t=this[r+--n],f=1;n>0&&(f*=256);)t+=this[r+--n]*f;return t};o.prototype.readUInt8=function(r,n){return n||s(r,1,this.length),this[r]};o.prototype.readUInt16LE=function(r,n){return n||s(r,2,this.length),this[r]|this[r+1]<<8};o.prototype.readUInt16BE=function(r,n){return n||s(r,2,this.length),this[r]<<8|this[r+1]};o.prototype.readUInt32LE=function(r,n){return n||s(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216};o.prototype.readUInt32BE=function(r,n){return n||s(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])};o.prototype.readIntLE=function(r,n,e){r=r|0,n=n|0,e||s(r,n,this.length);for(var t=this[r],f=1,u=0;++u<n&&(f*=256);)t+=this[r+u]*f;return f*=128,t>=f&&(t-=Math.pow(2,8*n)),t};o.prototype.readIntBE=function(r,n,e){r=r|0,n=n|0,e||s(r,n,this.length);for(var t=n,f=1,u=this[r+--t];t>0&&(f*=256);)u+=this[r+--t]*f;return f*=128,u>=f&&(u-=Math.pow(2,8*n)),u};o.prototype.readInt8=function(r,n){return n||s(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};o.prototype.readInt16LE=function(r,n){n||s(r,2,this.length);var e=this[r]|this[r+1]<<8;return e&32768?e|4294901760:e};o.prototype.readInt16BE=function(r,n){n||s(r,2,this.length);var e=this[r+1]|this[r]<<8;return e&32768?e|4294901760:e};o.prototype.readInt32LE=function(r,n){return n||s(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24};o.prototype.readInt32BE=function(r,n){return n||s(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]};o.prototype.readFloatLE=function(r,n){return n||s(r,4,this.length),N(this,r,!0,23,4)};o.prototype.readFloatBE=function(r,n){return n||s(r,4,this.length),N(this,r,!1,23,4)};o.prototype.readDoubleLE=function(r,n){return n||s(r,8,this.length),N(this,r,!0,52,8)};o.prototype.readDoubleBE=function(r,n){return n||s(r,8,this.length),N(this,r,!1,52,8)};function w(i,r,n,e,t,f){if(!g(i))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>t||r<f)throw new RangeError('"value" argument is out of bounds');if(n+e>i.length)throw new RangeError("Index out of range")}o.prototype.writeUIntLE=function(r,n,e,t){if(r=+r,n=n|0,e=e|0,!t){var f=Math.pow(2,8*e)-1;w(this,r,n,e,f,0)}var u=1,a=0;for(this[n]=r&255;++a<e&&(u*=256);)this[n+a]=r/u&255;return n+e};o.prototype.writeUIntBE=function(r,n,e,t){if(r=+r,n=n|0,e=e|0,!t){var f=Math.pow(2,8*e)-1;w(this,r,n,e,f,0)}var u=e-1,a=1;for(this[n+u]=r&255;--u>=0&&(a*=256);)this[n+u]=r/a&255;return n+e};o.prototype.writeUInt8=function(r,n,e){return r=+r,n=n|0,e||w(this,r,n,1,255,0),o.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),this[n]=r&255,n+1};function k(i,r,n,e){r<0&&(r=65535+r+1);for(var t=0,f=Math.min(i.length-n,2);t<f;++t)i[n+t]=(r&255<<8*(e?t:1-t))>>>(e?t:1-t)*8}o.prototype.writeUInt16LE=function(r,n,e){return r=+r,n=n|0,e||w(this,r,n,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[n]=r&255,this[n+1]=r>>>8):k(this,r,n,!0),n+2};o.prototype.writeUInt16BE=function(r,n,e){return r=+r,n=n|0,e||w(this,r,n,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[n]=r>>>8,this[n+1]=r&255):k(this,r,n,!1),n+2};function D(i,r,n,e){r<0&&(r=4294967295+r+1);for(var t=0,f=Math.min(i.length-n,4);t<f;++t)i[n+t]=r>>>(e?t:3-t)*8&255}o.prototype.writeUInt32LE=function(r,n,e){return r=+r,n=n|0,e||w(this,r,n,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[n+3]=r>>>24,this[n+2]=r>>>16,this[n+1]=r>>>8,this[n]=r&255):D(this,r,n,!0),n+4};o.prototype.writeUInt32BE=function(r,n,e){return r=+r,n=n|0,e||w(this,r,n,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[n]=r>>>24,this[n+1]=r>>>16,this[n+2]=r>>>8,this[n+3]=r&255):D(this,r,n,!1),n+4};o.prototype.writeIntLE=function(r,n,e,t){if(r=+r,n=n|0,!t){var f=Math.pow(2,8*e-1);w(this,r,n,e,f-1,-f)}var u=0,a=1,h=0;for(this[n]=r&255;++u<e&&(a*=256);)r<0&&h===0&&this[n+u-1]!==0&&(h=1),this[n+u]=(r/a>>0)-h&255;return n+e};o.prototype.writeIntBE=function(r,n,e,t){if(r=+r,n=n|0,!t){var f=Math.pow(2,8*e-1);w(this,r,n,e,f-1,-f)}var u=e-1,a=1,h=0;for(this[n+u]=r&255;--u>=0&&(a*=256);)r<0&&h===0&&this[n+u+1]!==0&&(h=1),this[n+u]=(r/a>>0)-h&255;return n+e};o.prototype.writeInt8=function(r,n,e){return r=+r,n=n|0,e||w(this,r,n,1,127,-128),o.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),r<0&&(r=255+r+1),this[n]=r&255,n+1};o.prototype.writeInt16LE=function(r,n,e){return r=+r,n=n|0,e||w(this,r,n,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[n]=r&255,this[n+1]=r>>>8):k(this,r,n,!0),n+2};o.prototype.writeInt16BE=function(r,n,e){return r=+r,n=n|0,e||w(this,r,n,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[n]=r>>>8,this[n+1]=r&255):k(this,r,n,!1),n+2};o.prototype.writeInt32LE=function(r,n,e){return r=+r,n=n|0,e||w(this,r,n,4,2147483647,-2147483648),o.TYPED_ARRAY_SUPPORT?(this[n]=r&255,this[n+1]=r>>>8,this[n+2]=r>>>16,this[n+3]=r>>>24):D(this,r,n,!0),n+4};o.prototype.writeInt32BE=function(r,n,e){return r=+r,n=n|0,e||w(this,r,n,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),o.TYPED_ARRAY_SUPPORT?(this[n]=r>>>24,this[n+1]=r>>>16,this[n+2]=r>>>8,this[n+3]=r&255):D(this,r,n,!1),n+4};function tr(i,r,n,e,t,f){if(n+e>i.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function fr(i,r,n,e,t){return t||tr(i,r,n,4,34028234663852886e22,-34028234663852886e22),hr(i,r,n,e,23,4),n+4}o.prototype.writeFloatLE=function(r,n,e){return fr(this,r,n,!0,e)};o.prototype.writeFloatBE=function(r,n,e){return fr(this,r,n,!1,e)};function ur(i,r,n,e,t){return t||tr(i,r,n,8,17976931348623157e292,-17976931348623157e292),hr(i,r,n,e,52,8),n+8}o.prototype.writeDoubleLE=function(r,n,e){return ur(this,r,n,!0,e)};o.prototype.writeDoubleBE=function(r,n,e){return ur(this,r,n,!1,e)};o.prototype.copy=function(r,n,e,t){if(e||(e=0),!t&&t!==0&&(t=this.length),n>=r.length&&(n=r.length),n||(n=0),t>0&&t<e&&(t=e),t===e||r.length===0||this.length===0)return 0;if(n<0)throw new RangeError("targetStart out of bounds");if(e<0||e>=this.length)throw new RangeError("sourceStart out of bounds");if(t<0)throw new RangeError("sourceEnd out of bounds");t>this.length&&(t=this.length),r.length-n<t-e&&(t=r.length-n+e);var f=t-e,u;if(this===r&&e<n&&n<t)for(u=f-1;u>=0;--u)r[u+n]=this[u+e];else if(f<1e3||!o.TYPED_ARRAY_SUPPORT)for(u=0;u<f;++u)r[u+n]=this[u+e];else Uint8Array.prototype.set.call(r,this.subarray(e,e+f),n);return f};o.prototype.fill=function(r,n,e,t){if(typeof r=="string"){if(typeof n=="string"?(t=n,n=0,e=this.length):typeof e=="string"&&(t=e,e=this.length),r.length===1){var f=r.charCodeAt(0);f<256&&(r=f)}if(t!==void 0&&typeof t!="string")throw new TypeError("encoding must be a string");if(typeof t=="string"&&!o.isEncoding(t))throw new TypeError("Unknown encoding: "+t)}else typeof r=="number"&&(r=r&255);if(n<0||this.length<n||this.length<e)throw new RangeError("Out of range index");if(e<=n)return this;n=n>>>0,e=e===void 0?this.length:e>>>0,r||(r=0);var u;if(typeof r=="number")for(u=n;u<e;++u)this[u]=r;else{var a=g(r)?r:C(new o(r,t).toString()),h=a.length;for(u=0;u<e-n;++u)this[u+n]=a[u%h]}return this};var fn=/[^+\/0-9A-Za-z-_]/g;function un(i){if(i=on(i).replace(fn,""),i.length<2)return"";for(;i.length%4!==0;)i=i+"=";return i}function on(i){return i.trim?i.trim():i.replace(/^\s+|\s+$/g,"")}function an(i){return i<16?"0"+i.toString(16):i.toString(16)}function C(i,r){r=r||1/0;for(var n,e=i.length,t=null,f=[],u=0;u<e;++u){if(n=i.charCodeAt(u),n>55295&&n<57344){if(!t){if(n>56319){(r-=3)>-1&&f.push(239,191,189);continue}else if(u+1===e){(r-=3)>-1&&f.push(239,191,189);continue}t=n;continue}if(n<56320){(r-=3)>-1&&f.push(239,191,189),t=n;continue}n=(t-55296<<10|n-56320)+65536}else t&&(r-=3)>-1&&f.push(239,191,189);if(t=null,n<128){if((r-=1)<0)break;f.push(n)}else if(n<2048){if((r-=2)<0)break;f.push(n>>6|192,n&63|128)}else if(n<65536){if((r-=3)<0)break;f.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((r-=4)<0)break;f.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw new Error("Invalid code point")}return f}function hn(i){for(var r=[],n=0;n<i.length;++n)r.push(i.charCodeAt(n)&255);return r}function cn(i,r){for(var n,e,t,f=[],u=0;u<i.length&&!((r-=2)<0);++u)n=i.charCodeAt(u),e=n>>8,t=n%256,f.push(t),f.push(e);return f}function or(i){return Wr(un(i))}function M(i,r,n,e){for(var t=0;t<e&&!(t+n>=r.length||t>=i.length);++t)r[t+n]=i[t];return t}function ln(i){return i!==i}function pn(i){return i!=null&&(!!i._isBuffer||ar(i)||sn(i))}function ar(i){return!!i.constructor&&typeof i.constructor.isBuffer=="function"&&i.constructor.isBuffer(i)}function sn(i){return typeof i.readFloatLE=="function"&&typeof i.slice=="function"&&ar(i.slice(0,0))}function N(i,r,n,e,t){var f,u,a=t*8-e-1,h=(1<<a)-1,l=h>>1,p=-7,c=n?t-1:0,m=n?-1:1,x=i[r+c];for(c+=m,f=x&(1<<-p)-1,x>>=-p,p+=a;p>0;f=f*256+i[r+c],c+=m,p-=8);for(u=f&(1<<-p)-1,f>>=-p,p+=e;p>0;u=u*256+i[r+c],c+=m,p-=8);if(f===0)f=1-l;else{if(f===h)return u?NaN:(x?-1:1)*(1/0);u=u+Math.pow(2,e),f=f-l}return(x?-1:1)*u*Math.pow(2,f-e)}function hr(i,r,n,e,t,f){var u,a,h,l=f*8-t-1,p=(1<<l)-1,c=p>>1,m=t===23?Math.pow(2,-24)-Math.pow(2,-77):0,x=e?0:f-1,U=e?1:-1,cr=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(a=isNaN(r)?1:0,u=p):(u=Math.floor(Math.log(r)/Math.LN2),r*(h=Math.pow(2,-u))<1&&(u--,h*=2),u+c>=1?r+=m/h:r+=m*Math.pow(2,1-c),r*h>=2&&(u++,h/=2),u+c>=p?(a=0,u=p):u+c>=1?(a=(r*h-1)*Math.pow(2,t),u=u+c):(a=r*Math.pow(2,c-1)*Math.pow(2,t),u=0));t>=8;i[n+x]=a&255,x+=U,a/=256,t-=8);for(u=u<<t|a,l+=t;l>0;i[n+x]=u&255,x+=U,u/=256,l-=8);i[n+x-U]|=cr*128}function yn(i){return{hash:i.hash,loginAddress:i.loginAddress,loginChainId:i.loginChainId,tokenId:i.token?.id,tokenAddress:i.tokenId,tokenChainId:i.tokenChainId,amount:i.amount,lockedAmount:i.lockedAmount}}export{yn as mapToCodexBalanceDto};
1
+ function G(){throw new Error("setTimeout has not been defined")}function J(){throw new Error("clearTimeout has not been defined")}var R=G,_=J;typeof globalThis.setTimeout=="function"&&(R=setTimeout);typeof globalThis.clearTimeout=="function"&&(_=clearTimeout);function O(i){if(R===setTimeout)return setTimeout(i,0);if((R===G||!R)&&setTimeout)return R=setTimeout,setTimeout(i,0);try{return R(i,0)}catch{try{return R.call(null,i,0)}catch{return R.call(this,i,0)}}}function lr(i){if(_===clearTimeout)return clearTimeout(i);if((_===J||!_)&&clearTimeout)return _=clearTimeout,clearTimeout(i);try{return _(i)}catch{try{return _.call(null,i)}catch{return _.call(this,i)}}}var y=[],S=!1,U,P=-1;function pr(){!S||!U||(S=!1,U.length?y=U.concat(y):P=-1,y.length&&Q())}function Q(){if(!S){var i=O(pr);S=!0;for(var r=y.length;r;){for(U=y,y=[];++P<r;)U&&U[P].run();P=-1,r=y.length}U=null,S=!1,lr(i)}}function sr(i){var r=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)r[n-1]=arguments[n];y.push(new X(i,r)),y.length===1&&!S&&O(Q)}function X(i,r){this.fun=i,this.array=r}X.prototype.run=function(){this.fun.apply(null,this.array)};var wr="browser",xr="browser",Er=!0,mr={},Ar=[],gr="",yr={},Tr={},Rr={};function I(){}var _r=I,Ur=I,Ir=I,vr=I,dr=I,Br=I,Sr=I;function Pr(i){throw new Error("process.binding is not supported")}function Yr(){return"/"}function Cr(i){throw new Error("process.chdir is not supported")}function Dr(){return 0}var B=globalThis.performance||{},Mr=B.now||B.mozNow||B.msNow||B.oNow||B.webkitNow||function(){return new Date().getTime()};function kr(i){var r=Mr.call(B)*.001,n=Math.floor(r),e=Math.floor(r%1*1e9);return i&&(n=n-i[0],e=e-i[1],e<0&&(n--,e+=1e9)),[n,e]}var Nr=new Date;function Lr(){var i=new Date,r=i-Nr;return r/1e3}var L={nextTick:sr,title:wr,browser:Er,env:mr,argv:Ar,version:gr,versions:yr,on:_r,addListener:Ur,once:Ir,off:vr,removeListener:dr,removeAllListeners:Br,emit:Sr,binding:Pr,cwd:Yr,chdir:Cr,umask:Dr,hrtime:kr,platform:xr,release:Tr,config:Rr,uptime:Lr},z={};Object.keys(z).forEach(i=>{let r=i.split("."),n=L;for(let e=0;e<r.length;e++){let t=r[e];e===r.length-1?n[t]=z[i]:n=n[t]||(n[t]={})}});var A=[],E=[],Fr=typeof Uint8Array<"u"?Uint8Array:Array,W=!1;function $(){W=!0;for(var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,n=i.length;r<n;++r)A[r]=i[r],E[i.charCodeAt(r)]=r;E[45]=62,E[95]=63}function Wr(i){W||$();var r,n,e,t,f,u,a=i.length;if(a%4>0)throw new Error("Invalid string. Length must be a multiple of 4");f=i[a-2]==="="?2:i[a-1]==="="?1:0,u=new Fr(a*3/4-f),e=f>0?a-4:a;var h=0;for(r=0,n=0;r<e;r+=4,n+=3)t=E[i.charCodeAt(r)]<<18|E[i.charCodeAt(r+1)]<<12|E[i.charCodeAt(r+2)]<<6|E[i.charCodeAt(r+3)],u[h++]=t>>16&255,u[h++]=t>>8&255,u[h++]=t&255;return f===2?(t=E[i.charCodeAt(r)]<<2|E[i.charCodeAt(r+1)]>>4,u[h++]=t&255):f===1&&(t=E[i.charCodeAt(r)]<<10|E[i.charCodeAt(r+1)]<<4|E[i.charCodeAt(r+2)]>>2,u[h++]=t>>8&255,u[h++]=t&255),u}function Hr(i){return A[i>>18&63]+A[i>>12&63]+A[i>>6&63]+A[i&63]}function Vr(i,r,n){for(var e,t=[],f=r;f<n;f+=3)e=(i[f]<<16)+(i[f+1]<<8)+i[f+2],t.push(Hr(e));return t.join("")}function q(i){W||$();for(var r,n=i.length,e=n%3,t="",f=[],u=16383,a=0,h=n-e;a<h;a+=u)f.push(Vr(i,a,a+u>h?h:a+u));return e===1?(r=i[n-1],t+=A[r>>2],t+=A[r<<4&63],t+="=="):e===2&&(r=(i[n-2]<<8)+i[n-1],t+=A[r>>10],t+=A[r>>4&63],t+=A[r<<2&63],t+="="),f.push(t),f.join("")}o.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;function Y(){return o.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function T(i,r){if(Y()<r)throw new RangeError("Invalid typed array length");return o.TYPED_ARRAY_SUPPORT?(i=new Uint8Array(r),i.__proto__=o.prototype):(i===null&&(i=new o(r)),i.length=r),i}function o(i,r,n){if(!o.TYPED_ARRAY_SUPPORT&&!(this instanceof o))return new o(i,r,n);if(typeof i=="number"){if(typeof r=="string")throw new Error("If encoding is specified then the first argument must be a string");return H(this,i)}return b(this,i,r,n)}o.poolSize=8192;o._augment=function(i){return i.__proto__=o.prototype,i};function b(i,r,n,e){if(typeof r=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&r instanceof ArrayBuffer?Jr(i,r,n,e):typeof r=="string"?Gr(i,r,n):Or(i,r)}o.from=function(i,r,n){return b(null,i,r,n)};o.kMaxLength=Y();o.TYPED_ARRAY_SUPPORT&&(o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&o[Symbol.species]);function j(i){if(typeof i!="number")throw new TypeError('"size" argument must be a number');if(i<0)throw new RangeError('"size" argument must not be negative')}function zr(i,r,n,e){return j(r),r<=0?T(i,r):n!==void 0?typeof e=="string"?T(i,r).fill(n,e):T(i,r).fill(n):T(i,r)}o.alloc=function(i,r,n){return zr(null,i,r,n)};function H(i,r){if(j(r),i=T(i,r<0?0:V(r)|0),!o.TYPED_ARRAY_SUPPORT)for(var n=0;n<r;++n)i[n]=0;return i}o.allocUnsafe=function(i){return H(null,i)};o.allocUnsafeSlow=function(i){return H(null,i)};function Gr(i,r,n){if((typeof n!="string"||n==="")&&(n="utf8"),!o.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var e=rr(r,n)|0;i=T(i,e);var t=i.write(r,n);return t!==e&&(i=i.slice(0,t)),i}function F(i,r){var n=r.length<0?0:V(r.length)|0;i=T(i,n);for(var e=0;e<n;e+=1)i[e]=r[e]&255;return i}function Jr(i,r,n,e){if(r.byteLength,n<0||r.byteLength<n)throw new RangeError("'offset' is out of bounds");if(r.byteLength<n+(e||0))throw new RangeError("'length' is out of bounds");return n===void 0&&e===void 0?r=new Uint8Array(r):e===void 0?r=new Uint8Array(r,n):r=new Uint8Array(r,n,e),o.TYPED_ARRAY_SUPPORT?(i=r,i.__proto__=o.prototype):i=F(i,r),i}function Or(i,r){if(g(r)){var n=V(r.length)|0;return i=T(i,n),i.length===0||r.copy(i,0,0,n),i}if(r){if(typeof ArrayBuffer<"u"&&r.buffer instanceof ArrayBuffer||"length"in r)return typeof r.length!="number"||ln(r.length)?T(i,0):F(i,r);if(r.type==="Buffer"&&Array.isArray(r.data))return F(i,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function V(i){if(i>=Y())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Y().toString(16)+" bytes");return i|0}o.isBuffer=pn;function g(i){return!!(i!=null&&i._isBuffer)}o.compare=function(r,n){if(!g(r)||!g(n))throw new TypeError("Arguments must be Buffers");if(r===n)return 0;for(var e=r.length,t=n.length,f=0,u=Math.min(e,t);f<u;++f)if(r[f]!==n[f]){e=r[f],t=n[f];break}return e<t?-1:t<e?1:0};o.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}};o.concat=function(r,n){if(!Array.isArray(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return o.alloc(0);var e;if(n===void 0)for(n=0,e=0;e<r.length;++e)n+=r[e].length;var t=o.allocUnsafe(n),f=0;for(e=0;e<r.length;++e){var u=r[e];if(!g(u))throw new TypeError('"list" argument must be an Array of Buffers');u.copy(t,f),f+=u.length}return t};function rr(i,r){if(g(i))return i.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(i)||i instanceof ArrayBuffer))return i.byteLength;typeof i!="string"&&(i=""+i);var n=i.length;if(n===0)return 0;for(var e=!1;;)switch(r){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return C(i).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return n*2;case"hex":return n>>>1;case"base64":return or(i).length;default:if(e)return C(i).length;r=(""+r).toLowerCase(),e=!0}}o.byteLength=rr;function Qr(i,r,n){var e=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,r>>>=0,n<=r))return"";for(i||(i="utf8");;)switch(i){case"hex":return en(this,r,n);case"utf8":case"utf-8":return er(this,r,n);case"ascii":return rn(this,r,n);case"latin1":case"binary":return nn(this,r,n);case"base64":return br(this,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return tn(this,r,n);default:if(e)throw new TypeError("Unknown encoding: "+i);i=(i+"").toLowerCase(),e=!0}}o.prototype._isBuffer=!0;function v(i,r,n){var e=i[r];i[r]=i[n],i[n]=e}o.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 n=0;n<r;n+=2)v(this,n,n+1);return this};o.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 n=0;n<r;n+=4)v(this,n,n+3),v(this,n+1,n+2);return this};o.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 n=0;n<r;n+=8)v(this,n,n+7),v(this,n+1,n+6),v(this,n+2,n+5),v(this,n+3,n+4);return this};o.prototype.toString=function(){var r=this.length|0;return r===0?"":arguments.length===0?er(this,0,r):Qr.apply(this,arguments)};o.prototype.equals=function(r){if(!g(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:o.compare(this,r)===0};o.prototype.compare=function(r,n,e,t,f){if(!g(r))throw new TypeError("Argument must be a Buffer");if(n===void 0&&(n=0),e===void 0&&(e=r?r.length:0),t===void 0&&(t=0),f===void 0&&(f=this.length),n<0||e>r.length||t<0||f>this.length)throw new RangeError("out of range index");if(t>=f&&n>=e)return 0;if(t>=f)return-1;if(n>=e)return 1;if(n>>>=0,e>>>=0,t>>>=0,f>>>=0,this===r)return 0;for(var u=f-t,a=e-n,h=Math.min(u,a),l=this.slice(t,f),p=r.slice(n,e),c=0;c<h;++c)if(l[c]!==p[c]){u=l[c],a=p[c];break}return u<a?-1:a<u?1:0};function nr(i,r,n,e,t){if(i.length===0)return-1;if(typeof n=="string"?(e=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=t?0:i.length-1),n<0&&(n=i.length+n),n>=i.length){if(t)return-1;n=i.length-1}else if(n<0)if(t)n=0;else return-1;if(typeof r=="string"&&(r=o.from(r,e)),g(r))return r.length===0?-1:Z(i,r,n,e,t);if(typeof r=="number")return r=r&255,o.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?t?Uint8Array.prototype.indexOf.call(i,r,n):Uint8Array.prototype.lastIndexOf.call(i,r,n):Z(i,[r],n,e,t);throw new TypeError("val must be string, number or Buffer")}function Z(i,r,n,e,t){var f=1,u=i.length,a=r.length;if(e!==void 0&&(e=String(e).toLowerCase(),e==="ucs2"||e==="ucs-2"||e==="utf16le"||e==="utf-16le")){if(i.length<2||r.length<2)return-1;f=2,u/=2,a/=2,n/=2}function h(x,d){return f===1?x[d]:x.readUInt16BE(d*f)}var l;if(t){var p=-1;for(l=n;l<u;l++)if(h(i,l)===h(r,p===-1?0:l-p)){if(p===-1&&(p=l),l-p+1===a)return p*f}else p!==-1&&(l-=l-p),p=-1}else for(n+a>u&&(n=u-a),l=n;l>=0;l--){for(var c=!0,m=0;m<a;m++)if(h(i,l+m)!==h(r,m)){c=!1;break}if(c)return l}return-1}o.prototype.includes=function(r,n,e){return this.indexOf(r,n,e)!==-1};o.prototype.indexOf=function(r,n,e){return nr(this,r,n,e,!0)};o.prototype.lastIndexOf=function(r,n,e){return nr(this,r,n,e,!1)};function Xr(i,r,n,e){n=Number(n)||0;var t=i.length-n;e?(e=Number(e),e>t&&(e=t)):e=t;var f=r.length;if(f%2!==0)throw new TypeError("Invalid hex string");e>f/2&&(e=f/2);for(var u=0;u<e;++u){var a=parseInt(r.substr(u*2,2),16);if(isNaN(a))return u;i[n+u]=a}return u}function qr(i,r,n,e){return k(C(r,i.length-n),i,n,e)}function ir(i,r,n,e){return k(hn(r),i,n,e)}function Zr(i,r,n,e){return ir(i,r,n,e)}function Kr(i,r,n,e){return k(or(r),i,n,e)}function $r(i,r,n,e){return k(cn(r,i.length-n),i,n,e)}o.prototype.write=function(r,n,e,t){if(n===void 0)t="utf8",e=this.length,n=0;else if(e===void 0&&typeof n=="string")t=n,e=this.length,n=0;else if(isFinite(n))n=n|0,isFinite(e)?(e=e|0,t===void 0&&(t="utf8")):(t=e,e=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var f=this.length-n;if((e===void 0||e>f)&&(e=f),r.length>0&&(e<0||n<0)||n>this.length)throw new RangeError("Attempt to write outside buffer bounds");t||(t="utf8");for(var u=!1;;)switch(t){case"hex":return Xr(this,r,n,e);case"utf8":case"utf-8":return qr(this,r,n,e);case"ascii":return ir(this,r,n,e);case"latin1":case"binary":return Zr(this,r,n,e);case"base64":return Kr(this,r,n,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return $r(this,r,n,e);default:if(u)throw new TypeError("Unknown encoding: "+t);t=(""+t).toLowerCase(),u=!0}};o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function br(i,r,n){return r===0&&n===i.length?q(i):q(i.slice(r,n))}function er(i,r,n){n=Math.min(i.length,n);for(var e=[],t=r;t<n;){var f=i[t],u=null,a=f>239?4:f>223?3:f>191?2:1;if(t+a<=n){var h,l,p,c;switch(a){case 1:f<128&&(u=f);break;case 2:h=i[t+1],(h&192)===128&&(c=(f&31)<<6|h&63,c>127&&(u=c));break;case 3:h=i[t+1],l=i[t+2],(h&192)===128&&(l&192)===128&&(c=(f&15)<<12|(h&63)<<6|l&63,c>2047&&(c<55296||c>57343)&&(u=c));break;case 4:h=i[t+1],l=i[t+2],p=i[t+3],(h&192)===128&&(l&192)===128&&(p&192)===128&&(c=(f&15)<<18|(h&63)<<12|(l&63)<<6|p&63,c>65535&&c<1114112&&(u=c))}}u===null?(u=65533,a=1):u>65535&&(u-=65536,e.push(u>>>10&1023|55296),u=56320|u&1023),e.push(u),t+=a}return jr(e)}var K=4096;function jr(i){var r=i.length;if(r<=K)return String.fromCharCode.apply(String,i);for(var n="",e=0;e<r;)n+=String.fromCharCode.apply(String,i.slice(e,e+=K));return n}function rn(i,r,n){var e="";n=Math.min(i.length,n);for(var t=r;t<n;++t)e+=String.fromCharCode(i[t]&127);return e}function nn(i,r,n){var e="";n=Math.min(i.length,n);for(var t=r;t<n;++t)e+=String.fromCharCode(i[t]);return e}function en(i,r,n){var e=i.length;(!r||r<0)&&(r=0),(!n||n<0||n>e)&&(n=e);for(var t="",f=r;f<n;++f)t+=an(i[f]);return t}function tn(i,r,n){for(var e=i.slice(r,n),t="",f=0;f<e.length;f+=2)t+=String.fromCharCode(e[f]+e[f+1]*256);return t}o.prototype.slice=function(r,n){var e=this.length;r=~~r,n=n===void 0?e:~~n,r<0?(r+=e,r<0&&(r=0)):r>e&&(r=e),n<0?(n+=e,n<0&&(n=0)):n>e&&(n=e),n<r&&(n=r);var t;if(o.TYPED_ARRAY_SUPPORT)t=this.subarray(r,n),t.__proto__=o.prototype;else{var f=n-r;t=new o(f,void 0);for(var u=0;u<f;++u)t[u]=this[u+r]}return t};function s(i,r,n){if(i%1!==0||i<0)throw new RangeError("offset is not uint");if(i+r>n)throw new RangeError("Trying to access beyond buffer length")}o.prototype.readUIntLE=function(r,n,e){r=r|0,n=n|0,e||s(r,n,this.length);for(var t=this[r],f=1,u=0;++u<n&&(f*=256);)t+=this[r+u]*f;return t};o.prototype.readUIntBE=function(r,n,e){r=r|0,n=n|0,e||s(r,n,this.length);for(var t=this[r+--n],f=1;n>0&&(f*=256);)t+=this[r+--n]*f;return t};o.prototype.readUInt8=function(r,n){return n||s(r,1,this.length),this[r]};o.prototype.readUInt16LE=function(r,n){return n||s(r,2,this.length),this[r]|this[r+1]<<8};o.prototype.readUInt16BE=function(r,n){return n||s(r,2,this.length),this[r]<<8|this[r+1]};o.prototype.readUInt32LE=function(r,n){return n||s(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216};o.prototype.readUInt32BE=function(r,n){return n||s(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])};o.prototype.readIntLE=function(r,n,e){r=r|0,n=n|0,e||s(r,n,this.length);for(var t=this[r],f=1,u=0;++u<n&&(f*=256);)t+=this[r+u]*f;return f*=128,t>=f&&(t-=Math.pow(2,8*n)),t};o.prototype.readIntBE=function(r,n,e){r=r|0,n=n|0,e||s(r,n,this.length);for(var t=n,f=1,u=this[r+--t];t>0&&(f*=256);)u+=this[r+--t]*f;return f*=128,u>=f&&(u-=Math.pow(2,8*n)),u};o.prototype.readInt8=function(r,n){return n||s(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};o.prototype.readInt16LE=function(r,n){n||s(r,2,this.length);var e=this[r]|this[r+1]<<8;return e&32768?e|4294901760:e};o.prototype.readInt16BE=function(r,n){n||s(r,2,this.length);var e=this[r+1]|this[r]<<8;return e&32768?e|4294901760:e};o.prototype.readInt32LE=function(r,n){return n||s(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24};o.prototype.readInt32BE=function(r,n){return n||s(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]};o.prototype.readFloatLE=function(r,n){return n||s(r,4,this.length),N(this,r,!0,23,4)};o.prototype.readFloatBE=function(r,n){return n||s(r,4,this.length),N(this,r,!1,23,4)};o.prototype.readDoubleLE=function(r,n){return n||s(r,8,this.length),N(this,r,!0,52,8)};o.prototype.readDoubleBE=function(r,n){return n||s(r,8,this.length),N(this,r,!1,52,8)};function w(i,r,n,e,t,f){if(!g(i))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>t||r<f)throw new RangeError('"value" argument is out of bounds');if(n+e>i.length)throw new RangeError("Index out of range")}o.prototype.writeUIntLE=function(r,n,e,t){if(r=+r,n=n|0,e=e|0,!t){var f=Math.pow(2,8*e)-1;w(this,r,n,e,f,0)}var u=1,a=0;for(this[n]=r&255;++a<e&&(u*=256);)this[n+a]=r/u&255;return n+e};o.prototype.writeUIntBE=function(r,n,e,t){if(r=+r,n=n|0,e=e|0,!t){var f=Math.pow(2,8*e)-1;w(this,r,n,e,f,0)}var u=e-1,a=1;for(this[n+u]=r&255;--u>=0&&(a*=256);)this[n+u]=r/a&255;return n+e};o.prototype.writeUInt8=function(r,n,e){return r=+r,n=n|0,e||w(this,r,n,1,255,0),o.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),this[n]=r&255,n+1};function D(i,r,n,e){r<0&&(r=65535+r+1);for(var t=0,f=Math.min(i.length-n,2);t<f;++t)i[n+t]=(r&255<<8*(e?t:1-t))>>>(e?t:1-t)*8}o.prototype.writeUInt16LE=function(r,n,e){return r=+r,n=n|0,e||w(this,r,n,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[n]=r&255,this[n+1]=r>>>8):D(this,r,n,!0),n+2};o.prototype.writeUInt16BE=function(r,n,e){return r=+r,n=n|0,e||w(this,r,n,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[n]=r>>>8,this[n+1]=r&255):D(this,r,n,!1),n+2};function M(i,r,n,e){r<0&&(r=4294967295+r+1);for(var t=0,f=Math.min(i.length-n,4);t<f;++t)i[n+t]=r>>>(e?t:3-t)*8&255}o.prototype.writeUInt32LE=function(r,n,e){return r=+r,n=n|0,e||w(this,r,n,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[n+3]=r>>>24,this[n+2]=r>>>16,this[n+1]=r>>>8,this[n]=r&255):M(this,r,n,!0),n+4};o.prototype.writeUInt32BE=function(r,n,e){return r=+r,n=n|0,e||w(this,r,n,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[n]=r>>>24,this[n+1]=r>>>16,this[n+2]=r>>>8,this[n+3]=r&255):M(this,r,n,!1),n+4};o.prototype.writeIntLE=function(r,n,e,t){if(r=+r,n=n|0,!t){var f=Math.pow(2,8*e-1);w(this,r,n,e,f-1,-f)}var u=0,a=1,h=0;for(this[n]=r&255;++u<e&&(a*=256);)r<0&&h===0&&this[n+u-1]!==0&&(h=1),this[n+u]=(r/a>>0)-h&255;return n+e};o.prototype.writeIntBE=function(r,n,e,t){if(r=+r,n=n|0,!t){var f=Math.pow(2,8*e-1);w(this,r,n,e,f-1,-f)}var u=e-1,a=1,h=0;for(this[n+u]=r&255;--u>=0&&(a*=256);)r<0&&h===0&&this[n+u+1]!==0&&(h=1),this[n+u]=(r/a>>0)-h&255;return n+e};o.prototype.writeInt8=function(r,n,e){return r=+r,n=n|0,e||w(this,r,n,1,127,-128),o.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),r<0&&(r=255+r+1),this[n]=r&255,n+1};o.prototype.writeInt16LE=function(r,n,e){return r=+r,n=n|0,e||w(this,r,n,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[n]=r&255,this[n+1]=r>>>8):D(this,r,n,!0),n+2};o.prototype.writeInt16BE=function(r,n,e){return r=+r,n=n|0,e||w(this,r,n,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[n]=r>>>8,this[n+1]=r&255):D(this,r,n,!1),n+2};o.prototype.writeInt32LE=function(r,n,e){return r=+r,n=n|0,e||w(this,r,n,4,2147483647,-2147483648),o.TYPED_ARRAY_SUPPORT?(this[n]=r&255,this[n+1]=r>>>8,this[n+2]=r>>>16,this[n+3]=r>>>24):M(this,r,n,!0),n+4};o.prototype.writeInt32BE=function(r,n,e){return r=+r,n=n|0,e||w(this,r,n,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),o.TYPED_ARRAY_SUPPORT?(this[n]=r>>>24,this[n+1]=r>>>16,this[n+2]=r>>>8,this[n+3]=r&255):M(this,r,n,!1),n+4};function tr(i,r,n,e,t,f){if(n+e>i.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function fr(i,r,n,e,t){return t||tr(i,r,n,4,34028234663852886e22,-34028234663852886e22),hr(i,r,n,e,23,4),n+4}o.prototype.writeFloatLE=function(r,n,e){return fr(this,r,n,!0,e)};o.prototype.writeFloatBE=function(r,n,e){return fr(this,r,n,!1,e)};function ur(i,r,n,e,t){return t||tr(i,r,n,8,17976931348623157e292,-17976931348623157e292),hr(i,r,n,e,52,8),n+8}o.prototype.writeDoubleLE=function(r,n,e){return ur(this,r,n,!0,e)};o.prototype.writeDoubleBE=function(r,n,e){return ur(this,r,n,!1,e)};o.prototype.copy=function(r,n,e,t){if(e||(e=0),!t&&t!==0&&(t=this.length),n>=r.length&&(n=r.length),n||(n=0),t>0&&t<e&&(t=e),t===e||r.length===0||this.length===0)return 0;if(n<0)throw new RangeError("targetStart out of bounds");if(e<0||e>=this.length)throw new RangeError("sourceStart out of bounds");if(t<0)throw new RangeError("sourceEnd out of bounds");t>this.length&&(t=this.length),r.length-n<t-e&&(t=r.length-n+e);var f=t-e,u;if(this===r&&e<n&&n<t)for(u=f-1;u>=0;--u)r[u+n]=this[u+e];else if(f<1e3||!o.TYPED_ARRAY_SUPPORT)for(u=0;u<f;++u)r[u+n]=this[u+e];else Uint8Array.prototype.set.call(r,this.subarray(e,e+f),n);return f};o.prototype.fill=function(r,n,e,t){if(typeof r=="string"){if(typeof n=="string"?(t=n,n=0,e=this.length):typeof e=="string"&&(t=e,e=this.length),r.length===1){var f=r.charCodeAt(0);f<256&&(r=f)}if(t!==void 0&&typeof t!="string")throw new TypeError("encoding must be a string");if(typeof t=="string"&&!o.isEncoding(t))throw new TypeError("Unknown encoding: "+t)}else typeof r=="number"&&(r=r&255);if(n<0||this.length<n||this.length<e)throw new RangeError("Out of range index");if(e<=n)return this;n=n>>>0,e=e===void 0?this.length:e>>>0,r||(r=0);var u;if(typeof r=="number")for(u=n;u<e;++u)this[u]=r;else{var a=g(r)?r:C(new o(r,t).toString()),h=a.length;for(u=0;u<e-n;++u)this[u+n]=a[u%h]}return this};var fn=/[^+\/0-9A-Za-z-_]/g;function un(i){if(i=on(i).replace(fn,""),i.length<2)return"";for(;i.length%4!==0;)i=i+"=";return i}function on(i){return i.trim?i.trim():i.replace(/^\s+|\s+$/g,"")}function an(i){return i<16?"0"+i.toString(16):i.toString(16)}function C(i,r){r=r||1/0;for(var n,e=i.length,t=null,f=[],u=0;u<e;++u){if(n=i.charCodeAt(u),n>55295&&n<57344){if(!t){if(n>56319){(r-=3)>-1&&f.push(239,191,189);continue}else if(u+1===e){(r-=3)>-1&&f.push(239,191,189);continue}t=n;continue}if(n<56320){(r-=3)>-1&&f.push(239,191,189),t=n;continue}n=(t-55296<<10|n-56320)+65536}else t&&(r-=3)>-1&&f.push(239,191,189);if(t=null,n<128){if((r-=1)<0)break;f.push(n)}else if(n<2048){if((r-=2)<0)break;f.push(n>>6|192,n&63|128)}else if(n<65536){if((r-=3)<0)break;f.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((r-=4)<0)break;f.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw new Error("Invalid code point")}return f}function hn(i){for(var r=[],n=0;n<i.length;++n)r.push(i.charCodeAt(n)&255);return r}function cn(i,r){for(var n,e,t,f=[],u=0;u<i.length&&!((r-=2)<0);++u)n=i.charCodeAt(u),e=n>>8,t=n%256,f.push(t),f.push(e);return f}function or(i){return Wr(un(i))}function k(i,r,n,e){for(var t=0;t<e&&!(t+n>=r.length||t>=i.length);++t)r[t+n]=i[t];return t}function ln(i){return i!==i}function pn(i){return i!=null&&(!!i._isBuffer||ar(i)||sn(i))}function ar(i){return!!i.constructor&&typeof i.constructor.isBuffer=="function"&&i.constructor.isBuffer(i)}function sn(i){return typeof i.readFloatLE=="function"&&typeof i.slice=="function"&&ar(i.slice(0,0))}function N(i,r,n,e,t){var f,u,a=t*8-e-1,h=(1<<a)-1,l=h>>1,p=-7,c=n?t-1:0,m=n?-1:1,x=i[r+c];for(c+=m,f=x&(1<<-p)-1,x>>=-p,p+=a;p>0;f=f*256+i[r+c],c+=m,p-=8);for(u=f&(1<<-p)-1,f>>=-p,p+=e;p>0;u=u*256+i[r+c],c+=m,p-=8);if(f===0)f=1-l;else{if(f===h)return u?NaN:(x?-1:1)*(1/0);u=u+Math.pow(2,e),f=f-l}return(x?-1:1)*u*Math.pow(2,f-e)}function hr(i,r,n,e,t,f){var u,a,h,l=f*8-t-1,p=(1<<l)-1,c=p>>1,m=t===23?Math.pow(2,-24)-Math.pow(2,-77):0,x=e?0:f-1,d=e?1:-1,cr=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(a=isNaN(r)?1:0,u=p):(u=Math.floor(Math.log(r)/Math.LN2),r*(h=Math.pow(2,-u))<1&&(u--,h*=2),u+c>=1?r+=m/h:r+=m*Math.pow(2,1-c),r*h>=2&&(u++,h/=2),u+c>=p?(a=0,u=p):u+c>=1?(a=(r*h-1)*Math.pow(2,t),u=u+c):(a=r*Math.pow(2,c-1)*Math.pow(2,t),u=0));t>=8;i[n+x]=a&255,x+=d,a/=256,t-=8);for(u=u<<t|a,l+=t;l>0;i[n+x]=u&255,x+=d,u/=256,l-=8);i[n+x-d]|=cr*128}var wn="CCTPUSDC",xn=65537;function En(){let i=o.alloc(32,0);return o.from(wn,"utf-8").copy(i),i}function _n(){return{address:"0x"+En().toString("hex"),chainId:xn}}export{En as getUnifiedUSDC,_n as getUnifiedUSDCToken,xn as unified_CCTP_ChainID,wn as unified_CCTP_token};
2
2
  /*! Bundled license information:
3
3
 
4
4
  @esbuild-plugins/node-globals-polyfill/Buffer.js:
@@ -1,5 +1,5 @@
1
- function Mr(){throw new Error("setTimeout has not been defined")}function vr(){throw new Error("clearTimeout has not been defined")}var U=Mr,L=vr;typeof globalThis.setTimeout=="function"&&(U=setTimeout);typeof globalThis.clearTimeout=="function"&&(L=clearTimeout);function Fr(t){if(U===setTimeout)return setTimeout(t,0);if((U===Mr||!U)&&setTimeout)return U=setTimeout,setTimeout(t,0);try{return U(t,0)}catch{try{return U.call(null,t,0)}catch{return U.call(this,t,0)}}}function We(t){if(L===clearTimeout)return clearTimeout(t);if((L===vr||!L)&&clearTimeout)return L=clearTimeout,clearTimeout(t);try{return L(t)}catch{try{return L.call(null,t)}catch{return L.call(this,t)}}}var D=[],H=!1,v,er=-1;function He(){!H||!v||(H=!1,v.length?D=v.concat(D):er=-1,D.length&&Yr())}function Yr(){if(!H){var t=Fr(He);H=!0;for(var r=D.length;r;){for(v=D,D=[];++er<r;)v&&v[er].run();er=-1,r=D.length}v=null,H=!1,We(t)}}function Ve(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];D.push(new Gr(t,r)),D.length===1&&!H&&Fr(Yr)}function Gr(t,r){this.fun=t,this.array=r}Gr.prototype.run=function(){this.fun.apply(null,this.array)};var $e="browser",Xe="browser",ze=!0,qe={},Je=[],je="",Qe={},Ze={},rt={};function F(){}var et=F,tt=F,nt=F,ot=F,it=F,at=F,st=F;function ct(t){throw new Error("process.binding is not supported")}function ut(){return"/"}function pt(t){throw new Error("process.chdir is not supported")}function lt(){return 0}var W=globalThis.performance||{},mt=W.now||W.mozNow||W.msNow||W.oNow||W.webkitNow||function(){return new Date().getTime()};function dt(t){var r=mt.call(W)*.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 ft=new Date;function gt(){var t=new Date,r=t-ft;return r/1e3}var l={nextTick:Ve,title:$e,browser:ze,env:qe,argv:Je,version:je,versions:Qe,on:et,addListener:tt,once:nt,off:ot,removeListener:it,removeAllListeners:at,emit:st,binding:ct,cwd:ut,chdir:pt,umask:lt,hrtime:dt,platform:Xe,release:Ze,config:rt,uptime:gt},Lr={};Object.keys(Lr).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]=Lr[t]:e=e[o]||(e[o]={})}});var S=[],R=[],ht=typeof Uint8Array<"u"?Uint8Array:Array,xr=!1;function Vr(){xr=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,e=t.length;r<e;++r)S[r]=t[r],R[t.charCodeAt(r)]=r;R[45]=62,R[95]=63}function xt(t){xr||Vr();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 ht(c*3/4-i),n=i>0?c-4:c;var u=0;for(r=0,e=0;r<n;r+=4,e+=3)o=R[t.charCodeAt(r)]<<18|R[t.charCodeAt(r+1)]<<12|R[t.charCodeAt(r+2)]<<6|R[t.charCodeAt(r+3)],a[u++]=o>>16&255,a[u++]=o>>8&255,a[u++]=o&255;return i===2?(o=R[t.charCodeAt(r)]<<2|R[t.charCodeAt(r+1)]>>4,a[u++]=o&255):i===1&&(o=R[t.charCodeAt(r)]<<10|R[t.charCodeAt(r+1)]<<4|R[t.charCodeAt(r+2)]>>2,a[u++]=o>>8&255,a[u++]=o&255),a}function Et(t){return S[t>>18&63]+S[t>>12&63]+S[t>>6&63]+S[t&63]}function bt(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(Et(n));return o.join("")}function Kr(t){xr||Vr();for(var r,e=t.length,n=e%3,o="",i=[],a=16383,c=0,u=e-n;c<u;c+=a)i.push(bt(t,c,c+a>u?u:c+a));return n===1?(r=t[e-1],o+=S[r>>2],o+=S[r<<4&63],o+="=="):n===2&&(r=(t[e-2]<<8)+t[e-1],o+=S[r>>10],o+=S[r>>4&63],o+=S[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 tr(){return s.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function P(t,r){if(tr()<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 Er(this,t)}return $r(this,t,r,e)}s.poolSize=8192;s._augment=function(t){return t.__proto__=s.prototype,t};function $r(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?_t(t,r,e,n):typeof r=="string"?Tt(t,r,e):yt(t,r)}s.from=function(t,r,e){return $r(null,t,r,e)};s.kMaxLength=tr();s.TYPED_ARRAY_SUPPORT&&(s.prototype.__proto__=Uint8Array.prototype,s.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&s[Symbol.species]);function Xr(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 At(t,r,e,n){return Xr(r),r<=0?P(t,r):e!==void 0?typeof n=="string"?P(t,r).fill(e,n):P(t,r).fill(e):P(t,r)}s.alloc=function(t,r,e){return At(null,t,r,e)};function Er(t,r){if(Xr(r),t=P(t,r<0?0:br(r)|0),!s.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}s.allocUnsafe=function(t){return Er(null,t)};s.allocUnsafeSlow=function(t){return Er(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=zr(r,e)|0;t=P(t,n);var o=t.write(r,e);return o!==n&&(t=t.slice(0,o)),t}function hr(t,r){var e=r.length<0?0:br(r.length)|0;t=P(t,e);for(var n=0;n<e;n+=1)t[n]=r[n]&255;return t}function _t(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=hr(t,r),t}function yt(t,r){if(B(r)){var e=br(r.length)|0;return t=P(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"||Kt(r.length)?P(t,0):hr(t,r);if(r.type==="Buffer"&&Array.isArray(r.data))return hr(t,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function br(t){if(t>=tr())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+tr().toString(16)+" bytes");return t|0}s.isBuffer=Wt;function B(t){return!!(t!=null&&t._isBuffer)}s.compare=function(r,e){if(!B(r)||!B(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(!B(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(o,i),i+=a.length}return o};function zr(t,r){if(B(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 nr(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return ee(t).length;default:if(n)return nr(t).length;r=(""+r).toLowerCase(),n=!0}}s.byteLength=zr;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 kt(this,r,e);case"utf8":case"utf-8":return jr(this,r,e);case"ascii":return Dt(this,r,e);case"latin1":case"binary":return Pt(this,r,e);case"base64":return Ot(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ut(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}s.prototype._isBuffer=!0;function Y(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)Y(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)Y(this,e,e+3),Y(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)Y(this,e,e+7),Y(this,e+1,e+6),Y(this,e+2,e+5),Y(this,e+3,e+4);return this};s.prototype.toString=function(){var r=this.length|0;return r===0?"":arguments.length===0?jr(this,0,r):It.apply(this,arguments)};s.prototype.equals=function(r){if(!B(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(!B(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,u=Math.min(a,c),d=this.slice(o,i),f=r.slice(e,n),m=0;m<u;++m)if(d[m]!==f[m]){a=d[m],c=f[m];break}return a<c?-1:c<a?1:0};function qr(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)),B(r))return r.length===0?-1:Wr(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):Wr(t,[r],e,n,o);throw new TypeError("val must be string, number or Buffer")}function Wr(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 u(g,_){return i===1?g[_]:g.readUInt16BE(_*i)}var d;if(o){var f=-1;for(d=e;d<a;d++)if(u(t,d)===u(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(u(t,d+h)!==u(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 qr(this,r,e,n,!0)};s.prototype.lastIndexOf=function(r,e,n){return qr(this,r,e,n,!1)};function Rt(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 wt(t,r,e,n){return ar(nr(r,t.length-e),t,e,n)}function Jr(t,r,e,n){return ar(Yt(r),t,e,n)}function Nt(t,r,e,n){return Jr(t,r,e,n)}function St(t,r,e,n){return ar(ee(r),t,e,n)}function Bt(t,r,e,n){return ar(Gt(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 Rt(this,r,e,n);case"utf8":case"utf-8":return wt(this,r,e,n);case"ascii":return Jr(this,r,e,n);case"latin1":case"binary":return Nt(this,r,e,n);case"base64":return St(this,r,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Bt(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 Ot(t,r,e){return r===0&&e===t.length?Kr(t):Kr(t.slice(r,e))}function jr(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 u,d,f,m;switch(c){case 1:i<128&&(a=i);break;case 2:u=t[o+1],(u&192)===128&&(m=(i&31)<<6|u&63,m>127&&(a=m));break;case 3:u=t[o+1],d=t[o+2],(u&192)===128&&(d&192)===128&&(m=(i&15)<<12|(u&63)<<6|d&63,m>2047&&(m<55296||m>57343)&&(a=m));break;case 4:u=t[o+1],d=t[o+2],f=t[o+3],(u&192)===128&&(d&192)===128&&(f&192)===128&&(m=(i&15)<<18|(u&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 Hr=4096;function Ct(t){var r=t.length;if(r<=Hr)return String.fromCharCode.apply(String,t);for(var e="",n=0;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=Hr));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 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 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+=Ft(t[i]);return o}function Ut(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 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")}s.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};s.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};s.prototype.readUInt8=function(r,e){return e||b(r,1,this.length),this[r]};s.prototype.readUInt16LE=function(r,e){return e||b(r,2,this.length),this[r]|this[r+1]<<8};s.prototype.readUInt16BE=function(r,e){return e||b(r,2,this.length),this[r]<<8|this[r+1]};s.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};s.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])};s.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};s.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};s.prototype.readInt8=function(r,e){return e||b(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};s.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};s.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};s.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};s.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]};s.prototype.readFloatLE=function(r,e){return e||b(r,4,this.length),sr(this,r,!0,23,4)};s.prototype.readFloatBE=function(r,e){return e||b(r,4,this.length),sr(this,r,!1,23,4)};s.prototype.readDoubleLE=function(r,e){return e||b(r,8,this.length),sr(this,r,!0,52,8)};s.prototype.readDoubleBE=function(r,e){return e||b(r,8,this.length),sr(this,r,!1,52,8)};function y(t,r,e,n,o,i){if(!B(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;y(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;y(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||y(this,r,e,1,255,0),s.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),this[e]=r&255,e+1};function or(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||y(this,r,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):or(this,r,e,!0),e+2};s.prototype.writeUInt16BE=function(r,e,n){return r=+r,e=e|0,n||y(this,r,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):or(this,r,e,!1),e+2};function ir(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||y(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):ir(this,r,e,!0),e+4};s.prototype.writeUInt32BE=function(r,e,n){return r=+r,e=e|0,n||y(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):ir(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);y(this,r,e,n,i-1,-i)}var a=0,c=1,u=0;for(this[e]=r&255;++a<n&&(c*=256);)r<0&&u===0&&this[e+a-1]!==0&&(u=1),this[e+a]=(r/c>>0)-u&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);y(this,r,e,n,i-1,-i)}var a=n-1,c=1,u=0;for(this[e+a]=r&255;--a>=0&&(c*=256);)r<0&&u===0&&this[e+a+1]!==0&&(u=1),this[e+a]=(r/c>>0)-u&255;return e+n};s.prototype.writeInt8=function(r,e,n){return r=+r,e=e|0,n||y(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||y(this,r,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):or(this,r,e,!0),e+2};s.prototype.writeInt16BE=function(r,e,n){return r=+r,e=e|0,n||y(this,r,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):or(this,r,e,!1),e+2};s.prototype.writeInt32LE=function(r,e,n){return r=+r,e=e|0,n||y(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):ir(this,r,e,!0),e+4};s.prototype.writeInt32BE=function(r,e,n){return r=+r,e=e|0,n||y(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):ir(this,r,e,!1),e+4};function Qr(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 Zr(t,r,e,n,o){return o||Qr(t,r,e,4,34028234663852886e22,-34028234663852886e22),ne(t,r,e,n,23,4),e+4}s.prototype.writeFloatLE=function(r,e,n){return Zr(this,r,e,!0,n)};s.prototype.writeFloatBE=function(r,e,n){return Zr(this,r,e,!1,n)};function re(t,r,e,n,o){return o||Qr(t,r,e,8,17976931348623157e292,-17976931348623157e292),ne(t,r,e,n,52,8),e+8}s.prototype.writeDoubleLE=function(r,e,n){return re(this,r,e,!0,n)};s.prototype.writeDoubleBE=function(r,e,n){return re(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=B(r)?r:nr(new s(r,o).toString()),u=c.length;for(a=0;a<n-e;++a)this[a+e]=c[a%u]}return this};var Lt=/[^+\/0-9A-Za-z-_]/g;function Mt(t){if(t=vt(t).replace(Lt,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function vt(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function Ft(t){return t<16?"0"+t.toString(16):t.toString(16)}function nr(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 Yt(t){for(var r=[],e=0;e<t.length;++e)r.push(t.charCodeAt(e)&255);return r}function Gt(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 ee(t){return xt(Mt(t))}function ar(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 Kt(t){return t!==t}function Wt(t){return t!=null&&(!!t._isBuffer||te(t)||Ht(t))}function te(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function Ht(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&te(t.slice(0,0))}function sr(t,r,e,n,o){var i,a,c=o*8-n-1,u=(1<<c)-1,d=u>>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===u)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 ne(t,r,e,n,o,i){var a,c,u,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,z=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*(u=Math.pow(2,-a))<1&&(a--,u*=2),a+m>=1?r+=h/u:r+=h*Math.pow(2,1-m),r*u>=2&&(a++,u/=2),a+m>=f?(c=0,a=f):a+m>=1?(c=(r*u-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-_]|=z*128}import Wn from"algosdk";var oe=(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))(oe||{}),ie=(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))(ie||{}),ti={...oe,...ie};import M from"algosdk";import*as Cr from"bs58";import Xt from"bignumber.js";Xt.config({DECIMAL_PLACES:40,EXPONENTIAL_AT:45});var ae=(t,r)=>String(t).toLowerCase()===String(r).toLowerCase();import kn from"algosdk";import*as Nr from"bs58";import Bn from"algosdk";import Ea,{decodeAddress as ba,encodeAddress as Aa}from"algosdk";var O=[],w=[],zt=typeof Uint8Array<"u"?Uint8Array:Array,Tr=!1;function pe(){Tr=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,e=t.length;r<e;++r)O[r]=t[r],w[t.charCodeAt(r)]=r;w[45]=62,w[95]=63}function qt(t){Tr||pe();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 zt(c*3/4-i),n=i>0?c-4:c;var u=0;for(r=0,e=0;r<n;r+=4,e+=3)o=w[t.charCodeAt(r)]<<18|w[t.charCodeAt(r+1)]<<12|w[t.charCodeAt(r+2)]<<6|w[t.charCodeAt(r+3)],a[u++]=o>>16&255,a[u++]=o>>8&255,a[u++]=o&255;return i===2?(o=w[t.charCodeAt(r)]<<2|w[t.charCodeAt(r+1)]>>4,a[u++]=o&255):i===1&&(o=w[t.charCodeAt(r)]<<10|w[t.charCodeAt(r+1)]<<4|w[t.charCodeAt(r+2)]>>2,a[u++]=o>>8&255,a[u++]=o&255),a}function Jt(t){return O[t>>18&63]+O[t>>12&63]+O[t>>6&63]+O[t&63]}function jt(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(Jt(n));return o.join("")}function se(t){Tr||pe();for(var r,e=t.length,n=e%3,o="",i=[],a=16383,c=0,u=e-n;c<u;c+=a)i.push(jt(t,c,c+a>u?u:c+a));return n===1?(r=t[e-1],o+=O[r>>2],o+=O[r<<4&63],o+="=="):n===2&&(r=(t[e-2]<<8)+t[e-1],o+=O[r>>10],o+=O[r>>4&63],o+=O[r<<2&63],o+="="),i.push(o),i.join("")}function pr(t,r,e,n,o){var i,a,c=o*8-n-1,u=(1<<c)-1,d=u>>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===u)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 le(t,r,e,n,o,i){var a,c,u,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,z=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*(u=Math.pow(2,-a))<1&&(a--,u*=2),a+m>=1?r+=h/u:r+=h*Math.pow(2,1-m),r*u>=2&&(a++,u/=2),a+m>=f?(c=0,a=f):a+m>=1?(c=(r*u-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-_]|=z*128}var Qt={}.toString,me=Array.isArray||function(t){return Qt.call(t)=="[object Array]"};var Zt=50;p.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;var da=cr();function cr(){return p.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function k(t,r){if(cr()<r)throw new RangeError("Invalid typed array length");return p.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(r),t.__proto__=p.prototype):(t===null&&(t=new p(r)),t.length=r),t}function p(t,r,e){if(!p.TYPED_ARRAY_SUPPORT&&!(this instanceof p))return new p(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 _r(this,t)}return de(this,t,r,e)}p.poolSize=8192;p._augment=function(t){return t.__proto__=p.prototype,t};function de(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?tn(t,r,e,n):typeof r=="string"?en(t,r,e):nn(t,r)}p.from=function(t,r,e){return de(null,t,r,e)};p.TYPED_ARRAY_SUPPORT&&(p.prototype.__proto__=Uint8Array.prototype,p.__proto__=Uint8Array);function fe(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 rn(t,r,e,n){return fe(r),r<=0?k(t,r):e!==void 0?typeof n=="string"?k(t,r).fill(e,n):k(t,r).fill(e):k(t,r)}p.alloc=function(t,r,e){return rn(null,t,r,e)};function _r(t,r){if(fe(r),t=k(t,r<0?0:yr(r)|0),!p.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}p.allocUnsafe=function(t){return _r(null,t)};p.allocUnsafeSlow=function(t){return _r(null,t)};function en(t,r,e){if((typeof e!="string"||e==="")&&(e="utf8"),!p.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var n=ge(r,e)|0;t=k(t,n);var o=t.write(r,e);return o!==n&&(t=t.slice(0,o)),t}function Ar(t,r){var e=r.length<0?0:yr(r.length)|0;t=k(t,e);for(var n=0;n<e;n+=1)t[n]=r[n]&255;return t}function tn(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),p.TYPED_ARRAY_SUPPORT?(t=r,t.__proto__=p.prototype):t=Ar(t,r),t}function nn(t,r){if(C(r)){var e=yr(r.length)|0;return t=k(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"||yn(r.length)?k(t,0):Ar(t,r);if(r.type==="Buffer"&&me(r.data))return Ar(t,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function yr(t){if(t>=cr())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+cr().toString(16)+" bytes");return t|0}p.isBuffer=In;function C(t){return!!(t!=null&&t._isBuffer)}p.compare=function(r,e){if(!C(r)||!C(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};p.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}};p.concat=function(r,e){if(!me(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return p.alloc(0);var n;if(e===void 0)for(e=0,n=0;n<r.length;++n)e+=r[n].length;var o=p.allocUnsafe(e),i=0;for(n=0;n<r.length;++n){var a=r[n];if(!C(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(o,i),i+=a.length}return o};function ge(t,r){if(C(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 ur(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return _e(t).length;default:if(n)return ur(t).length;r=(""+r).toLowerCase(),n=!0}}p.byteLength=ge;function on(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 gn(this,r,e);case"utf8":case"utf-8":return Ee(this,r,e);case"ascii":return dn(this,r,e);case"latin1":case"binary":return fn(this,r,e);case"base64":return ln(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return hn(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}p.prototype._isBuffer=!0;function G(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}p.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)G(this,e,e+1);return this};p.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)G(this,e,e+3),G(this,e+1,e+2);return this};p.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)G(this,e,e+7),G(this,e+1,e+6),G(this,e+2,e+5),G(this,e+3,e+4);return this};p.prototype.toString=function(){var r=this.length|0;return r===0?"":arguments.length===0?Ee(this,0,r):on.apply(this,arguments)};p.prototype.equals=function(r){if(!C(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:p.compare(this,r)===0};p.prototype.inspect=function(){var r="",e=Zt;return this.length>0&&(r=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(r+=" ... ")),"<Buffer "+r+">"};p.prototype.compare=function(r,e,n,o,i){if(!C(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,u=Math.min(a,c),d=this.slice(o,i),f=r.slice(e,n),m=0;m<u;++m)if(d[m]!==f[m]){a=d[m],c=f[m];break}return a<c?-1:c<a?1:0};function he(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=p.from(r,n)),C(r))return r.length===0?-1:ce(t,r,e,n,o);if(typeof r=="number")return r=r&255,p.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?o?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):ce(t,[r],e,n,o);throw new TypeError("val must be string, number or Buffer")}function ce(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 u(g,_){return i===1?g[_]:g.readUInt16BE(_*i)}var d;if(o){var f=-1;for(d=e;d<a;d++)if(u(t,d)===u(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(u(t,d+h)!==u(r,h)){m=!1;break}if(m)return d}return-1}p.prototype.includes=function(r,e,n){return this.indexOf(r,e,n)!==-1};p.prototype.indexOf=function(r,e,n){return he(this,r,e,n,!0)};p.prototype.lastIndexOf=function(r,e,n){return he(this,r,e,n,!1)};function an(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 sn(t,r,e,n){return dr(ur(r,t.length-e),t,e,n)}function xe(t,r,e,n){return dr(Tn(r),t,e,n)}function cn(t,r,e,n){return xe(t,r,e,n)}function un(t,r,e,n){return dr(_e(r),t,e,n)}function pn(t,r,e,n){return dr(_n(r,t.length-e),t,e,n)}p.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 an(this,r,e,n);case"utf8":case"utf-8":return sn(this,r,e,n);case"ascii":return xe(this,r,e,n);case"latin1":case"binary":return cn(this,r,e,n);case"base64":return un(this,r,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return pn(this,r,e,n);default:if(a)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),a=!0}};p.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ln(t,r,e){return r===0&&e===t.length?se(t):se(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 u,d,f,m;switch(c){case 1:i<128&&(a=i);break;case 2:u=t[o+1],(u&192)===128&&(m=(i&31)<<6|u&63,m>127&&(a=m));break;case 3:u=t[o+1],d=t[o+2],(u&192)===128&&(d&192)===128&&(m=(i&15)<<12|(u&63)<<6|d&63,m>2047&&(m<55296||m>57343)&&(a=m));break;case 4:u=t[o+1],d=t[o+2],f=t[o+3],(u&192)===128&&(d&192)===128&&(f&192)===128&&(m=(i&15)<<18|(u&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 mn(n)}var ue=4096;function mn(t){var r=t.length;if(r<=ue)return String.fromCharCode.apply(String,t);for(var e="",n=0;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=ue));return e}function dn(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 fn(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 gn(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+=An(t[i]);return o}function hn(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}p.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(p.TYPED_ARRAY_SUPPORT)o=this.subarray(r,e),o.__proto__=p.prototype;else{var i=e-r;o=new p(i,void 0);for(var a=0;a<i;++a)o[a]=this[a+r]}return o};function A(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")}p.prototype.readUIntLE=function(r,e,n){r=r|0,e=e|0,n||A(r,e,this.length);for(var o=this[r],i=1,a=0;++a<e&&(i*=256);)o+=this[r+a]*i;return o};p.prototype.readUIntBE=function(r,e,n){r=r|0,e=e|0,n||A(r,e,this.length);for(var o=this[r+--e],i=1;e>0&&(i*=256);)o+=this[r+--e]*i;return o};p.prototype.readUInt8=function(r,e){return e||A(r,1,this.length),this[r]};p.prototype.readUInt16LE=function(r,e){return e||A(r,2,this.length),this[r]|this[r+1]<<8};p.prototype.readUInt16BE=function(r,e){return e||A(r,2,this.length),this[r]<<8|this[r+1]};p.prototype.readUInt32LE=function(r,e){return e||A(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216};p.prototype.readUInt32BE=function(r,e){return e||A(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])};p.prototype.readIntLE=function(r,e,n){r=r|0,e=e|0,n||A(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};p.prototype.readIntBE=function(r,e,n){r=r|0,e=e|0,n||A(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};p.prototype.readInt8=function(r,e){return e||A(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};p.prototype.readInt16LE=function(r,e){e||A(r,2,this.length);var n=this[r]|this[r+1]<<8;return n&32768?n|4294901760:n};p.prototype.readInt16BE=function(r,e){e||A(r,2,this.length);var n=this[r+1]|this[r]<<8;return n&32768?n|4294901760:n};p.prototype.readInt32LE=function(r,e){return e||A(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24};p.prototype.readInt32BE=function(r,e){return e||A(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]};p.prototype.readFloatLE=function(r,e){return e||A(r,4,this.length),pr(this,r,!0,23,4)};p.prototype.readFloatBE=function(r,e){return e||A(r,4,this.length),pr(this,r,!1,23,4)};p.prototype.readDoubleLE=function(r,e){return e||A(r,8,this.length),pr(this,r,!0,52,8)};p.prototype.readDoubleBE=function(r,e){return e||A(r,8,this.length),pr(this,r,!1,52,8)};function I(t,r,e,n,o,i){if(!C(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")}p.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;I(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};p.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;I(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};p.prototype.writeUInt8=function(r,e,n){return r=+r,e=e|0,n||I(this,r,e,1,255,0),p.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),this[e]=r&255,e+1};function lr(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}p.prototype.writeUInt16LE=function(r,e,n){return r=+r,e=e|0,n||I(this,r,e,2,65535,0),p.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):lr(this,r,e,!0),e+2};p.prototype.writeUInt16BE=function(r,e,n){return r=+r,e=e|0,n||I(this,r,e,2,65535,0),p.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):lr(this,r,e,!1),e+2};function mr(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}p.prototype.writeUInt32LE=function(r,e,n){return r=+r,e=e|0,n||I(this,r,e,4,4294967295,0),p.TYPED_ARRAY_SUPPORT?(this[e+3]=r>>>24,this[e+2]=r>>>16,this[e+1]=r>>>8,this[e]=r&255):mr(this,r,e,!0),e+4};p.prototype.writeUInt32BE=function(r,e,n){return r=+r,e=e|0,n||I(this,r,e,4,4294967295,0),p.TYPED_ARRAY_SUPPORT?(this[e]=r>>>24,this[e+1]=r>>>16,this[e+2]=r>>>8,this[e+3]=r&255):mr(this,r,e,!1),e+4};p.prototype.writeIntLE=function(r,e,n,o){if(r=+r,e=e|0,!o){var i=Math.pow(2,8*n-1);I(this,r,e,n,i-1,-i)}var a=0,c=1,u=0;for(this[e]=r&255;++a<n&&(c*=256);)r<0&&u===0&&this[e+a-1]!==0&&(u=1),this[e+a]=(r/c>>0)-u&255;return e+n};p.prototype.writeIntBE=function(r,e,n,o){if(r=+r,e=e|0,!o){var i=Math.pow(2,8*n-1);I(this,r,e,n,i-1,-i)}var a=n-1,c=1,u=0;for(this[e+a]=r&255;--a>=0&&(c*=256);)r<0&&u===0&&this[e+a+1]!==0&&(u=1),this[e+a]=(r/c>>0)-u&255;return e+n};p.prototype.writeInt8=function(r,e,n){return r=+r,e=e|0,n||I(this,r,e,1,127,-128),p.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),r<0&&(r=255+r+1),this[e]=r&255,e+1};p.prototype.writeInt16LE=function(r,e,n){return r=+r,e=e|0,n||I(this,r,e,2,32767,-32768),p.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):lr(this,r,e,!0),e+2};p.prototype.writeInt16BE=function(r,e,n){return r=+r,e=e|0,n||I(this,r,e,2,32767,-32768),p.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):lr(this,r,e,!1),e+2};p.prototype.writeInt32LE=function(r,e,n){return r=+r,e=e|0,n||I(this,r,e,4,2147483647,-2147483648),p.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8,this[e+2]=r>>>16,this[e+3]=r>>>24):mr(this,r,e,!0),e+4};p.prototype.writeInt32BE=function(r,e,n){return r=+r,e=e|0,n||I(this,r,e,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),p.TYPED_ARRAY_SUPPORT?(this[e]=r>>>24,this[e+1]=r>>>16,this[e+2]=r>>>8,this[e+3]=r&255):mr(this,r,e,!1),e+4};function be(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 Ae(t,r,e,n,o){return o||be(t,r,e,4),le(t,r,e,n,23,4),e+4}p.prototype.writeFloatLE=function(r,e,n){return Ae(this,r,e,!0,n)};p.prototype.writeFloatBE=function(r,e,n){return Ae(this,r,e,!1,n)};function Te(t,r,e,n,o){return o||be(t,r,e,8),le(t,r,e,n,52,8),e+8}p.prototype.writeDoubleLE=function(r,e,n){return Te(this,r,e,!0,n)};p.prototype.writeDoubleBE=function(r,e,n){return Te(this,r,e,!1,n)};p.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||!p.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};p.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"&&!p.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=C(r)?r:ur(new p(r,o).toString()),u=c.length;for(a=0;a<n-e;++a)this[a+e]=c[a%u]}return this};var xn=/[^+\/0-9A-Za-z-_]/g;function En(t){if(t=bn(t).replace(xn,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function bn(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function An(t){return t<16?"0"+t.toString(16):t.toString(16)}function ur(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 Tn(t){for(var r=[],e=0;e<t.length;++e)r.push(t.charCodeAt(e)&255);return r}function _n(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 _e(t){return qt(En(t))}function dr(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 yn(t){return t!==t}function In(t){return t!=null&&(!!t._isBuffer||ye(t)||Rn(t))}function ye(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function Rn(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&ye(t.slice(0,0))}import{encodeAddress as wn,decodeAddress as wa}from"algosdk";function N(t){return t.reduce((r,e)=>Uint8Array.from([...r,...e]))}function q(t){return new Uint8Array(p.from(t))}function Ie(t){return p.from(t).toString("utf-8")}function Re(t){return p.from(t).toString("base64")}function fr(t){return p.from(t,"base64")}var Wa=`{"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 we={V1_1:"v1_1",V2:"v2"},Xa={[we.V1_1]:{testnet:62368684,mainnet:552635992},[we.V2]:{testnet:148607e3,mainnet:1002541853}};var Ne=t=>Bn.decodeAddress(t.toUpperCase()).publicKey;import*as E from"ethereumjs-util";function Ir(t){let r=E.fromSigned(s.from(t));return BigInt(r.toString())}function Cn(t){return E.toUnsigned(new E.BN(String(t)))}function Rr(t){let r=Cn(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 Se=t=>{if(t.length!==32)throw new Error("Invalid address bytes. The address buffer length is not equel 32");let r=s.from(t).toString("hex");if(r.slice(0,24)!=="000000000000000000000000")throw console.log("normalizedAddress",r),new Error("Invalid normalized address");let e="0x"+r.slice(-40);if(!Pn(e))throw new Error("Invalid hex address");return e},Be=t=>new Uint8Array(E.setLengthLeft(J(t),32)),J=t=>s.from(Dn(t),"hex"),Dn=t=>t.startsWith("0x")?t.slice(2):t,Pn=t=>E.isValidAddress(t),Oe=(t,r)=>{let e=E.keccak256(t),{r:n,s:o,v:i}=E.fromRpcSig(r);return E.ecrecover(e,i,n,o)};var j=t=>new Uint8Array(E.keccak256(s.from(t)));var Sr=t=>s.from(j(t)).toString("hex"),Br=(t,r)=>N([x(r,"str"),j(t)]),Or=(t,r)=>N([x(r,"str"),s.from(t,"hex")]),K=(t,r)=>{let e=kn.ABIMethod.fromSignature(t),n=e.getSelector(),o={},i=r.map((a,c)=>{let u=e.args[c].type.encode(a);return o[`txnArgs${c}`]=Array.apply([],Array.from(u)).join(", "),u});return[n,...i]},V=(t,r,e)=>{let n=s.from(t,r),o=n.subarray(n.length-e),i=s.from(o).toString();return fr(i)},Q=(t,r,e,n,o="hex")=>[wr(t,o,n),Un(r,n),Ln(e,n,t,r,o)],Un=(t,r)=>r===8?fr(t):r===1?Nr.decode(t):J(t),Ln=(t,r,e,n,o)=>r===8||r===1?$(t,r):Oe(wr(e,o,r),n),Mn=(t,r)=>r===8?"MX":r===1?"":`Ethereum Signed Message:
2
- ${t.length}`,wr=(t,r,e)=>{let n=s.from(t,r);return s.concat([q(Mn(n,e)),n])};var $=(t,r)=>r===8?Ne(t):r===1?Nr.decode(t):Be(t);import Js from"algosdk";import ic from"algosdk";import lu from"algosdk";var Z={"0x4343545055534443000000000000000000000000000000000000000000000000":65537};var Tc={SMALLESTUNIT:l.env.SMALLEST_UNIT},_c={SMALLEST_UNITS:l.env.SMALLEST_UNIT};var Nc=["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 kc=l.env.REACT_APP_API_URL,Uc=l.env.REACT_APP_SOCKET_URL,Lc=l.env.REACT_APP_ALGO_SERVER,Mc=l.env.REACT_APP_ALGO_SERVER_PORT||"",vc=l.env.REACT_APP_ALGOD_TOKEN||"",Fc=l.env.REACT_APP_DISPENSER_LINK,Yc=l.env.REACT_APP_FRONTEND_LINK||"",Gc=l.env.REACT_APP_ALGO_EXPLORER_LINK,Kc=l.env.REACT_APP_ALGO_EXPLORER_ASSETS_URL,Wc=(l.env.REACT_APP_REQUIRE_ACCESS_CODE||"").toLowerCase()==="true",Hc=l.env.REACT_APP_USERBACK_ACCESS_TOKEN,Vc=(l.env.REACT_APP_EXT_ORDER_TYPES||"").toLowerCase()==="true";var $c=.001*10**6,Xc=.002*10**6;var zc=l.env.REACT_APP_MASTER_APP_ID||"406",qc=l.env.REACT_APP_AGG_APP_ID||"408",Fn=Number(l.env.REACT_APP_CODEX_APP_ID||"467960617");console.log("CODEX_APP_ID",Fn);var Yn=l.env.REACT_APP_ALGO_NETWORK||"";var Jc=Yn.toLowerCase()==="mainnet"?"mainnet":"testnet";import Au from"algosdk";var x=(t,r,e)=>{switch(r){case"8B":return M.encodeUint64(Number(t));case"32B":return Rr(t);case"str":return q(String(t));case"address":return $(String(t),e);case"token":return Ue(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(M.encodeUint64(Number(t))).subarray(-1));case"2B":return new Uint8Array(s.from(M.encodeUint64(Number(t))).subarray(-2));case"4B":return new Uint8Array(s.from(M.encodeUint64(Number(t))).subarray(-4));default:return s.from(t.toString())}},T=(t,r,e)=>{switch(r){case"8B":return M.decodeUint64(t,"safe");case"32B":return Ir(t);case"str":return Ie(t);case"address":return ke(t,e);case"token":return Kn(t,e);case"float":return s.from(t).readDoubleBE(0);case"bool":case"2B":return T(t,"8B");default:return s.from(t).toString()}};var ke=(t,r)=>r===8?M.encodeAddress(t):r===1?Cr.encode(t):Se(t),Kn=(t,r)=>{let e=s.from(t).toString("hex");return e.startsWith("0x")||(e="0x"+e),Z[e]?e:r===8?String(Ir(t)):r===1?Cr.encode(t):ke(t,r)};var Ue=(t,r)=>r===8?Rr(+t):Z[t]?new Uint8Array(J(String(t))):$(String(t),r);var X=(t,r,e,n)=>{let o=$(t,r),i=M.encodeUint64(r),a=M.encodeUint64(n),c=Ue(e,n);return N([o,i,c,a])};var Le=(t,r)=>{let e=$(t,r),n=q("TK_");return N([n,e])};var Dr=(t,r,e=j)=>r.map(o=>({appIndex:t,name:e(o)}));var Pr=t=>new Uint8Array(s.from(Re(t)));var Me=160,kr=224,Hn=(t,r)=>Br(ve(t,r),"T_"),Tp=t=>Or(t,"T_"),_p=t=>Sr(ve(t)),ve=(t,r="hex")=>V(t,r,kr),yp=(t,r="hex")=>{let e=V(t,r,Me),n=Number(T(e.subarray(32,40),"8B")),o=Number(T(e.subarray(72,80),"8B"));return{loginAddress:String(T(e.subarray(0,32),"address",n)),loginChainId:n,recipient:String(T(e.subarray(40,72),"address",o)),recipientChainId:o,tkAddress:String(T(e.subarray(80,112),"address",8)),expiredDate:Number(T(e.subarray(112,120),"8B"))}},Ip=t=>{let{loginAddress:r,loginChainId:e,recipient:n,recipientChainId:o,tkAddress:i,expiredDate:a}=t,c=N([x(r,"address",e),x(e,"8B"),x(n,"address",o),x(o,"8B"),x(i,"address",8),x(a,"8B")]),u=Pr(c);return console.log(`Dtw data should be ${Me} bytes`,u.length,u),u},Rp=(t,r="hex")=>{let e=V(t,r,kr),n=Number(T(e.subarray(32,40),"8B")),o=Number(T(e.subarray(72,80),"8B")),i=Number(T(e.subarray(112,120),"8B"));return{loginAddress:String(T(e.subarray(0,32),"address",n)),loginChainId:n,recipient:String(T(e.subarray(40,72),"address",o)),recipientChainId:o,tokenIndex:String(T(e.subarray(80,112),"token",i)),tokenChainId:i,tokenAmount:String(T(e.subarray(120,152),"32B")),expiredDate:Number(T(e.subarray(152,160),"8B")),random:Number(T(e.subarray(160,168),"8B"))}},wp=t=>{let{loginAddress:r,loginChainId:e,recipient:n,recipientChainId:o,tokenAmount:i,tokenIndex:a,tokenChainId:c,expiredDate:u,random:d}=t,f=N([x(r,"address",e),x(e,"8B"),x(n,"address",o),x(o,"8B"),x(a,"token",c),x(c,"8B"),x(i,"32B"),x(u,"8B"),x(d,"8B")]),m=Pr(f);return console.log(`Transfer data should be ${kr} bytes`,m.length,m),m},Np=async({data:t,message:r,signature:e},n,o)=>{let{loginAddress:i,loginChainId:a,recipient:c,recipientChainId:u,tokenIndex:d,tokenChainId:f}=t,{appId:m,sender:h,superWallet:g}=o,_=n?[...Q(r,e,n.data.tkAddress,8),...Q(n.message,n.signature,i,a)]:[...Q(r,e,i,a),s.alloc(0),s.alloc(0),s.alloc(0)],z=K("directTransfer(byte[],byte[],byte[],byte[],byte[],byte[],uint64)uint64",[..._,o.transferId]),rr="0x4343545055534443000000000000000000000000000000000000000000000000",Ur=Z[rr],gr=[X(i,a,d,f),X(c,u,d,f),X(g.address,g.chainId,d,f)];ae(d,rr)||gr.push(X(i,a,rr,Ur),X(g.address,g.chainId,rr,Ur)),n&&gr.push(Le(i,a));let Fe=[...Dr(m,gr),...Dr(m,[Hn(r,"hex")],Ke=>Ke)],Ye=[o.superAppId],Ge=n?9:6;return Wn.makeApplicationNoOpTxnFromObject({appIndex:m,from:h,suggestedParams:await o.getTxnParams(Ge),appArgs:z,foreignApps:Ye,boxes:Fe})};export{Me as DTW_DATA_BYTES_LENGTH,kr as TRANSFER_DATA_BYTES_LENGTH,_p as calcTransferHash,yp as decodeDtwMsg,Rp as decodeTransferMsg,Hn as getTransferBoxKey,Tp as getTransferBoxKeyFromHash,ve as getTransferBytesFromMsg,Ip as makeDtwMsg,wp as makeTransferMsg,Np as makeTransferTxn};
1
+ function vr(){throw new Error("setTimeout has not been defined")}function Fr(){throw new Error("clearTimeout has not been defined")}var U=vr,L=Fr;typeof globalThis.setTimeout=="function"&&(U=setTimeout);typeof globalThis.clearTimeout=="function"&&(L=clearTimeout);function Yr(t){if(U===setTimeout)return setTimeout(t,0);if((U===vr||!U)&&setTimeout)return U=setTimeout,setTimeout(t,0);try{return U(t,0)}catch{try{return U.call(null,t,0)}catch{return U.call(this,t,0)}}}function He(t){if(L===clearTimeout)return clearTimeout(t);if((L===Fr||!L)&&clearTimeout)return L=clearTimeout,clearTimeout(t);try{return L(t)}catch{try{return L.call(null,t)}catch{return L.call(this,t)}}}var B=[],H=!1,F,er=-1;function Ve(){!H||!F||(H=!1,F.length?B=F.concat(B):er=-1,B.length&&Gr())}function Gr(){if(!H){var t=Yr(Ve);H=!0;for(var r=B.length;r;){for(F=B,B=[];++er<r;)F&&F[er].run();er=-1,r=B.length}F=null,H=!1,He(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];B.push(new Wr(t,r)),B.length===1&&!H&&Yr(Gr)}function Wr(t,r){this.fun=t,this.array=r}Wr.prototype.run=function(){this.fun.apply(null,this.array)};var Xe="browser",ze="browser",qe=!0,Je={},je=[],Qe="",Ze={},rt={},et={};function Y(){}var tt=Y,nt=Y,ot=Y,it=Y,at=Y,st=Y,ct=Y;function ut(t){throw new Error("process.binding is not supported")}function pt(){return"/"}function lt(t){throw new Error("process.chdir is not supported")}function mt(){return 0}var K=globalThis.performance||{},dt=K.now||K.mozNow||K.msNow||K.oNow||K.webkitNow||function(){return new Date().getTime()};function ft(t){var r=dt.call(K)*.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 gt=new Date;function ht(){var t=new Date,r=t-gt;return r/1e3}var l={nextTick:$e,title:Xe,browser:qe,env:Je,argv:je,version:Qe,versions:Ze,on:tt,addListener:nt,once:ot,off:it,removeListener:at,removeAllListeners:st,emit:ct,binding:ut,cwd:pt,chdir:lt,umask:mt,hrtime:ft,platform:ze,release:rt,config:et,uptime:ht},Mr={};Object.keys(Mr).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]=Mr[t]:e=e[o]||(e[o]={})}});var S=[],R=[],xt=typeof Uint8Array<"u"?Uint8Array:Array,xr=!1;function $r(){xr=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,e=t.length;r<e;++r)S[r]=t[r],R[t.charCodeAt(r)]=r;R[45]=62,R[95]=63}function Et(t){xr||$r();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 xt(c*3/4-i),n=i>0?c-4:c;var u=0;for(r=0,e=0;r<n;r+=4,e+=3)o=R[t.charCodeAt(r)]<<18|R[t.charCodeAt(r+1)]<<12|R[t.charCodeAt(r+2)]<<6|R[t.charCodeAt(r+3)],a[u++]=o>>16&255,a[u++]=o>>8&255,a[u++]=o&255;return i===2?(o=R[t.charCodeAt(r)]<<2|R[t.charCodeAt(r+1)]>>4,a[u++]=o&255):i===1&&(o=R[t.charCodeAt(r)]<<10|R[t.charCodeAt(r+1)]<<4|R[t.charCodeAt(r+2)]>>2,a[u++]=o>>8&255,a[u++]=o&255),a}function bt(t){return S[t>>18&63]+S[t>>12&63]+S[t>>6&63]+S[t&63]}function At(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(bt(n));return o.join("")}function Kr(t){xr||$r();for(var r,e=t.length,n=e%3,o="",i=[],a=16383,c=0,u=e-n;c<u;c+=a)i.push(At(t,c,c+a>u?u:c+a));return n===1?(r=t[e-1],o+=S[r>>2],o+=S[r<<4&63],o+="=="):n===2&&(r=(t[e-2]<<8)+t[e-1],o+=S[r>>10],o+=S[r>>4&63],o+=S[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 tr(){return s.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function P(t,r){if(tr()<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 Er(this,t)}return Xr(this,t,r,e)}s.poolSize=8192;s._augment=function(t){return t.__proto__=s.prototype,t};function Xr(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?yt(t,r,e,n):typeof r=="string"?_t(t,r,e):It(t,r)}s.from=function(t,r,e){return Xr(null,t,r,e)};s.kMaxLength=tr();s.TYPED_ARRAY_SUPPORT&&(s.prototype.__proto__=Uint8Array.prototype,s.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&s[Symbol.species]);function zr(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 Tt(t,r,e,n){return zr(r),r<=0?P(t,r):e!==void 0?typeof n=="string"?P(t,r).fill(e,n):P(t,r).fill(e):P(t,r)}s.alloc=function(t,r,e){return Tt(null,t,r,e)};function Er(t,r){if(zr(r),t=P(t,r<0?0:br(r)|0),!s.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}s.allocUnsafe=function(t){return Er(null,t)};s.allocUnsafeSlow=function(t){return Er(null,t)};function _t(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=qr(r,e)|0;t=P(t,n);var o=t.write(r,e);return o!==n&&(t=t.slice(0,o)),t}function hr(t,r){var e=r.length<0?0:br(r.length)|0;t=P(t,e);for(var n=0;n<e;n+=1)t[n]=r[n]&255;return t}function yt(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=hr(t,r),t}function It(t,r){if(O(r)){var e=br(r.length)|0;return t=P(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"||Kt(r.length)?P(t,0):hr(t,r);if(r.type==="Buffer"&&Array.isArray(r.data))return hr(t,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function br(t){if(t>=tr())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+tr().toString(16)+" bytes");return t|0}s.isBuffer=Ht;function O(t){return!!(t!=null&&t._isBuffer)}s.compare=function(r,e){if(!O(r)||!O(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(!O(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(O(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 nr(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return te(t).length;default:if(n)return nr(t).length;r=(""+r).toLowerCase(),n=!0}}s.byteLength=qr;function Rt(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 Ut(this,r,e);case"utf8":case"utf-8":return Qr(this,r,e);case"ascii":return Pt(this,r,e);case"latin1":case"binary":return kt(this,r,e);case"base64":return Dt(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Lt(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}s.prototype._isBuffer=!0;function G(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)G(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)G(this,e,e+3),G(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)G(this,e,e+7),G(this,e+1,e+6),G(this,e+2,e+5),G(this,e+3,e+4);return this};s.prototype.toString=function(){var r=this.length|0;return r===0?"":arguments.length===0?Qr(this,0,r):Rt.apply(this,arguments)};s.prototype.equals=function(r){if(!O(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(!O(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,u=Math.min(a,c),d=this.slice(o,i),f=r.slice(e,n),m=0;m<u;++m)if(d[m]!==f[m]){a=d[m],c=f[m];break}return a<c?-1:c<a?1:0};function Jr(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)),O(r))return r.length===0?-1:Hr(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):Hr(t,[r],e,n,o);throw new TypeError("val must be string, number or Buffer")}function Hr(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 u(g,_){return i===1?g[_]:g.readUInt16BE(_*i)}var d;if(o){var f=-1;for(d=e;d<a;d++)if(u(t,d)===u(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(u(t,d+h)!==u(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 Jr(this,r,e,n,!0)};s.prototype.lastIndexOf=function(r,e,n){return Jr(this,r,e,n,!1)};function wt(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 ar(nr(r,t.length-e),t,e,n)}function jr(t,r,e,n){return ar(Gt(r),t,e,n)}function St(t,r,e,n){return jr(t,r,e,n)}function Ot(t,r,e,n){return ar(te(r),t,e,n)}function Ct(t,r,e,n){return ar(Wt(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 wt(this,r,e,n);case"utf8":case"utf-8":return Nt(this,r,e,n);case"ascii":return jr(this,r,e,n);case"latin1":case"binary":return St(this,r,e,n);case"base64":return Ot(this,r,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ct(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 Dt(t,r,e){return r===0&&e===t.length?Kr(t):Kr(t.slice(r,e))}function Qr(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 u,d,f,m;switch(c){case 1:i<128&&(a=i);break;case 2:u=t[o+1],(u&192)===128&&(m=(i&31)<<6|u&63,m>127&&(a=m));break;case 3:u=t[o+1],d=t[o+2],(u&192)===128&&(d&192)===128&&(m=(i&15)<<12|(u&63)<<6|d&63,m>2047&&(m<55296||m>57343)&&(a=m));break;case 4:u=t[o+1],d=t[o+2],f=t[o+3],(u&192)===128&&(d&192)===128&&(f&192)===128&&(m=(i&15)<<18|(u&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 Bt(n)}var Vr=4096;function Bt(t){var r=t.length;if(r<=Vr)return String.fromCharCode.apply(String,t);for(var e="",n=0;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=Vr));return e}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]&127);return n}function kt(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 Ut(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+=Yt(t[i]);return o}function Lt(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 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")}s.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};s.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};s.prototype.readUInt8=function(r,e){return e||b(r,1,this.length),this[r]};s.prototype.readUInt16LE=function(r,e){return e||b(r,2,this.length),this[r]|this[r+1]<<8};s.prototype.readUInt16BE=function(r,e){return e||b(r,2,this.length),this[r]<<8|this[r+1]};s.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};s.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])};s.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};s.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};s.prototype.readInt8=function(r,e){return e||b(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};s.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};s.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};s.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};s.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]};s.prototype.readFloatLE=function(r,e){return e||b(r,4,this.length),sr(this,r,!0,23,4)};s.prototype.readFloatBE=function(r,e){return e||b(r,4,this.length),sr(this,r,!1,23,4)};s.prototype.readDoubleLE=function(r,e){return e||b(r,8,this.length),sr(this,r,!0,52,8)};s.prototype.readDoubleBE=function(r,e){return e||b(r,8,this.length),sr(this,r,!1,52,8)};function y(t,r,e,n,o,i){if(!O(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;y(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;y(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||y(this,r,e,1,255,0),s.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),this[e]=r&255,e+1};function or(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||y(this,r,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):or(this,r,e,!0),e+2};s.prototype.writeUInt16BE=function(r,e,n){return r=+r,e=e|0,n||y(this,r,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):or(this,r,e,!1),e+2};function ir(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||y(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):ir(this,r,e,!0),e+4};s.prototype.writeUInt32BE=function(r,e,n){return r=+r,e=e|0,n||y(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):ir(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);y(this,r,e,n,i-1,-i)}var a=0,c=1,u=0;for(this[e]=r&255;++a<n&&(c*=256);)r<0&&u===0&&this[e+a-1]!==0&&(u=1),this[e+a]=(r/c>>0)-u&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);y(this,r,e,n,i-1,-i)}var a=n-1,c=1,u=0;for(this[e+a]=r&255;--a>=0&&(c*=256);)r<0&&u===0&&this[e+a+1]!==0&&(u=1),this[e+a]=(r/c>>0)-u&255;return e+n};s.prototype.writeInt8=function(r,e,n){return r=+r,e=e|0,n||y(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||y(this,r,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):or(this,r,e,!0),e+2};s.prototype.writeInt16BE=function(r,e,n){return r=+r,e=e|0,n||y(this,r,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):or(this,r,e,!1),e+2};s.prototype.writeInt32LE=function(r,e,n){return r=+r,e=e|0,n||y(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):ir(this,r,e,!0),e+4};s.prototype.writeInt32BE=function(r,e,n){return r=+r,e=e|0,n||y(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):ir(this,r,e,!1),e+4};function Zr(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 re(t,r,e,n,o){return o||Zr(t,r,e,4,34028234663852886e22,-34028234663852886e22),oe(t,r,e,n,23,4),e+4}s.prototype.writeFloatLE=function(r,e,n){return re(this,r,e,!0,n)};s.prototype.writeFloatBE=function(r,e,n){return re(this,r,e,!1,n)};function ee(t,r,e,n,o){return o||Zr(t,r,e,8,17976931348623157e292,-17976931348623157e292),oe(t,r,e,n,52,8),e+8}s.prototype.writeDoubleLE=function(r,e,n){return ee(this,r,e,!0,n)};s.prototype.writeDoubleBE=function(r,e,n){return ee(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=O(r)?r:nr(new s(r,o).toString()),u=c.length;for(a=0;a<n-e;++a)this[a+e]=c[a%u]}return this};var Mt=/[^+\/0-9A-Za-z-_]/g;function vt(t){if(t=Ft(t).replace(Mt,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function Ft(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function Yt(t){return t<16?"0"+t.toString(16):t.toString(16)}function nr(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 Gt(t){for(var r=[],e=0;e<t.length;++e)r.push(t.charCodeAt(e)&255);return r}function Wt(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 te(t){return Et(vt(t))}function ar(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 Kt(t){return t!==t}function Ht(t){return t!=null&&(!!t._isBuffer||ne(t)||Vt(t))}function ne(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function Vt(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&ne(t.slice(0,0))}function sr(t,r,e,n,o){var i,a,c=o*8-n-1,u=(1<<c)-1,d=u>>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===u)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 oe(t,r,e,n,o,i){var a,c,u,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,z=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*(u=Math.pow(2,-a))<1&&(a--,u*=2),a+m>=1?r+=h/u:r+=h*Math.pow(2,1-m),r*u>=2&&(a++,u/=2),a+m>=f?(c=0,a=f):a+m>=1?(c=(r*u-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-_]|=z*128}import Kn from"algosdk";var ie=(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))(ie||{}),ae=(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))(ae||{}),ti={...ie,...ae};import v from"algosdk";import*as Br from"bs58";import zt from"bignumber.js";zt.config({DECIMAL_PLACES:40,EXPONENTIAL_AT:45});var ce=(t,r)=>String(t).toLowerCase()===String(r).toLowerCase();import Un from"algosdk";import*as Nr from"bs58";import Cn from"algosdk";import Va,{decodeAddress as $a,encodeAddress as Xa}from"algosdk";var C=[],w=[],Jt=typeof Uint8Array<"u"?Uint8Array:Array,Tr=!1;function me(){Tr=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,e=t.length;r<e;++r)C[r]=t[r],w[t.charCodeAt(r)]=r;w[45]=62,w[95]=63}function jt(t){Tr||me();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 Jt(c*3/4-i),n=i>0?c-4:c;var u=0;for(r=0,e=0;r<n;r+=4,e+=3)o=w[t.charCodeAt(r)]<<18|w[t.charCodeAt(r+1)]<<12|w[t.charCodeAt(r+2)]<<6|w[t.charCodeAt(r+3)],a[u++]=o>>16&255,a[u++]=o>>8&255,a[u++]=o&255;return i===2?(o=w[t.charCodeAt(r)]<<2|w[t.charCodeAt(r+1)]>>4,a[u++]=o&255):i===1&&(o=w[t.charCodeAt(r)]<<10|w[t.charCodeAt(r+1)]<<4|w[t.charCodeAt(r+2)]>>2,a[u++]=o>>8&255,a[u++]=o&255),a}function Qt(t){return C[t>>18&63]+C[t>>12&63]+C[t>>6&63]+C[t&63]}function Zt(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(Qt(n));return o.join("")}function ue(t){Tr||me();for(var r,e=t.length,n=e%3,o="",i=[],a=16383,c=0,u=e-n;c<u;c+=a)i.push(Zt(t,c,c+a>u?u:c+a));return n===1?(r=t[e-1],o+=C[r>>2],o+=C[r<<4&63],o+="=="):n===2&&(r=(t[e-2]<<8)+t[e-1],o+=C[r>>10],o+=C[r>>4&63],o+=C[r<<2&63],o+="="),i.push(o),i.join("")}function pr(t,r,e,n,o){var i,a,c=o*8-n-1,u=(1<<c)-1,d=u>>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===u)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 de(t,r,e,n,o,i){var a,c,u,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,z=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*(u=Math.pow(2,-a))<1&&(a--,u*=2),a+m>=1?r+=h/u:r+=h*Math.pow(2,1-m),r*u>=2&&(a++,u/=2),a+m>=f?(c=0,a=f):a+m>=1?(c=(r*u-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-_]|=z*128}var rn={}.toString,fe=Array.isArray||function(t){return rn.call(t)=="[object Array]"};var en=50;p.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;var Ya=cr();function cr(){return p.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function k(t,r){if(cr()<r)throw new RangeError("Invalid typed array length");return p.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(r),t.__proto__=p.prototype):(t===null&&(t=new p(r)),t.length=r),t}function p(t,r,e){if(!p.TYPED_ARRAY_SUPPORT&&!(this instanceof p))return new p(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 _r(this,t)}return ge(this,t,r,e)}p.poolSize=8192;p._augment=function(t){return t.__proto__=p.prototype,t};function ge(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?on(t,r,e,n):typeof r=="string"?nn(t,r,e):an(t,r)}p.from=function(t,r,e){return ge(null,t,r,e)};p.TYPED_ARRAY_SUPPORT&&(p.prototype.__proto__=Uint8Array.prototype,p.__proto__=Uint8Array);function he(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 tn(t,r,e,n){return he(r),r<=0?k(t,r):e!==void 0?typeof n=="string"?k(t,r).fill(e,n):k(t,r).fill(e):k(t,r)}p.alloc=function(t,r,e){return tn(null,t,r,e)};function _r(t,r){if(he(r),t=k(t,r<0?0:yr(r)|0),!p.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}p.allocUnsafe=function(t){return _r(null,t)};p.allocUnsafeSlow=function(t){return _r(null,t)};function nn(t,r,e){if((typeof e!="string"||e==="")&&(e="utf8"),!p.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var n=xe(r,e)|0;t=k(t,n);var o=t.write(r,e);return o!==n&&(t=t.slice(0,o)),t}function Ar(t,r){var e=r.length<0?0:yr(r.length)|0;t=k(t,e);for(var n=0;n<e;n+=1)t[n]=r[n]&255;return t}function on(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),p.TYPED_ARRAY_SUPPORT?(t=r,t.__proto__=p.prototype):t=Ar(t,r),t}function an(t,r){if(D(r)){var e=yr(r.length)|0;return t=k(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"||Rn(r.length)?k(t,0):Ar(t,r);if(r.type==="Buffer"&&fe(r.data))return Ar(t,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function yr(t){if(t>=cr())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+cr().toString(16)+" bytes");return t|0}p.isBuffer=wn;function D(t){return!!(t!=null&&t._isBuffer)}p.compare=function(r,e){if(!D(r)||!D(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};p.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}};p.concat=function(r,e){if(!fe(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return p.alloc(0);var n;if(e===void 0)for(e=0,n=0;n<r.length;++n)e+=r[n].length;var o=p.allocUnsafe(e),i=0;for(n=0;n<r.length;++n){var a=r[n];if(!D(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(o,i),i+=a.length}return o};function xe(t,r){if(D(t))return t.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;typeof t!="string"&&(t=""+t);var 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 ur(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 ur(t).length;r=(""+r).toLowerCase(),n=!0}}p.byteLength=xe;function sn(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 xn(this,r,e);case"utf8":case"utf-8":return Ae(this,r,e);case"ascii":return gn(this,r,e);case"latin1":case"binary":return hn(this,r,e);case"base64":return dn(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return En(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}p.prototype._isBuffer=!0;function W(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}p.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)W(this,e,e+1);return this};p.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)W(this,e,e+3),W(this,e+1,e+2);return this};p.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)W(this,e,e+7),W(this,e+1,e+6),W(this,e+2,e+5),W(this,e+3,e+4);return this};p.prototype.toString=function(){var r=this.length|0;return r===0?"":arguments.length===0?Ae(this,0,r):sn.apply(this,arguments)};p.prototype.equals=function(r){if(!D(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:p.compare(this,r)===0};p.prototype.inspect=function(){var r="",e=en;return this.length>0&&(r=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(r+=" ... ")),"<Buffer "+r+">"};p.prototype.compare=function(r,e,n,o,i){if(!D(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,u=Math.min(a,c),d=this.slice(o,i),f=r.slice(e,n),m=0;m<u;++m)if(d[m]!==f[m]){a=d[m],c=f[m];break}return a<c?-1:c<a?1:0};function Ee(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=p.from(r,n)),D(r))return r.length===0?-1:pe(t,r,e,n,o);if(typeof r=="number")return r=r&255,p.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?o?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):pe(t,[r],e,n,o);throw new TypeError("val must be string, number or Buffer")}function pe(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 u(g,_){return i===1?g[_]:g.readUInt16BE(_*i)}var d;if(o){var f=-1;for(d=e;d<a;d++)if(u(t,d)===u(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(u(t,d+h)!==u(r,h)){m=!1;break}if(m)return d}return-1}p.prototype.includes=function(r,e,n){return this.indexOf(r,e,n)!==-1};p.prototype.indexOf=function(r,e,n){return Ee(this,r,e,n,!0)};p.prototype.lastIndexOf=function(r,e,n){return Ee(this,r,e,n,!1)};function cn(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 un(t,r,e,n){return dr(ur(r,t.length-e),t,e,n)}function be(t,r,e,n){return dr(yn(r),t,e,n)}function pn(t,r,e,n){return be(t,r,e,n)}function ln(t,r,e,n){return dr(Ie(r),t,e,n)}function mn(t,r,e,n){return dr(In(r,t.length-e),t,e,n)}p.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 cn(this,r,e,n);case"utf8":case"utf-8":return un(this,r,e,n);case"ascii":return be(this,r,e,n);case"latin1":case"binary":return pn(this,r,e,n);case"base64":return ln(this,r,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return mn(this,r,e,n);default:if(a)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),a=!0}};p.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function dn(t,r,e){return r===0&&e===t.length?ue(t):ue(t.slice(r,e))}function Ae(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 u,d,f,m;switch(c){case 1:i<128&&(a=i);break;case 2:u=t[o+1],(u&192)===128&&(m=(i&31)<<6|u&63,m>127&&(a=m));break;case 3:u=t[o+1],d=t[o+2],(u&192)===128&&(d&192)===128&&(m=(i&15)<<12|(u&63)<<6|d&63,m>2047&&(m<55296||m>57343)&&(a=m));break;case 4:u=t[o+1],d=t[o+2],f=t[o+3],(u&192)===128&&(d&192)===128&&(f&192)===128&&(m=(i&15)<<18|(u&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 fn(n)}var le=4096;function fn(t){var r=t.length;if(r<=le)return String.fromCharCode.apply(String,t);for(var e="",n=0;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=le));return e}function gn(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 hn(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 xn(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+=_n(t[i]);return o}function En(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}p.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(p.TYPED_ARRAY_SUPPORT)o=this.subarray(r,e),o.__proto__=p.prototype;else{var i=e-r;o=new p(i,void 0);for(var a=0;a<i;++a)o[a]=this[a+r]}return o};function A(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")}p.prototype.readUIntLE=function(r,e,n){r=r|0,e=e|0,n||A(r,e,this.length);for(var o=this[r],i=1,a=0;++a<e&&(i*=256);)o+=this[r+a]*i;return o};p.prototype.readUIntBE=function(r,e,n){r=r|0,e=e|0,n||A(r,e,this.length);for(var o=this[r+--e],i=1;e>0&&(i*=256);)o+=this[r+--e]*i;return o};p.prototype.readUInt8=function(r,e){return e||A(r,1,this.length),this[r]};p.prototype.readUInt16LE=function(r,e){return e||A(r,2,this.length),this[r]|this[r+1]<<8};p.prototype.readUInt16BE=function(r,e){return e||A(r,2,this.length),this[r]<<8|this[r+1]};p.prototype.readUInt32LE=function(r,e){return e||A(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216};p.prototype.readUInt32BE=function(r,e){return e||A(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])};p.prototype.readIntLE=function(r,e,n){r=r|0,e=e|0,n||A(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};p.prototype.readIntBE=function(r,e,n){r=r|0,e=e|0,n||A(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};p.prototype.readInt8=function(r,e){return e||A(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};p.prototype.readInt16LE=function(r,e){e||A(r,2,this.length);var n=this[r]|this[r+1]<<8;return n&32768?n|4294901760:n};p.prototype.readInt16BE=function(r,e){e||A(r,2,this.length);var n=this[r+1]|this[r]<<8;return n&32768?n|4294901760:n};p.prototype.readInt32LE=function(r,e){return e||A(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24};p.prototype.readInt32BE=function(r,e){return e||A(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]};p.prototype.readFloatLE=function(r,e){return e||A(r,4,this.length),pr(this,r,!0,23,4)};p.prototype.readFloatBE=function(r,e){return e||A(r,4,this.length),pr(this,r,!1,23,4)};p.prototype.readDoubleLE=function(r,e){return e||A(r,8,this.length),pr(this,r,!0,52,8)};p.prototype.readDoubleBE=function(r,e){return e||A(r,8,this.length),pr(this,r,!1,52,8)};function I(t,r,e,n,o,i){if(!D(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")}p.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;I(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};p.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;I(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};p.prototype.writeUInt8=function(r,e,n){return r=+r,e=e|0,n||I(this,r,e,1,255,0),p.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),this[e]=r&255,e+1};function lr(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}p.prototype.writeUInt16LE=function(r,e,n){return r=+r,e=e|0,n||I(this,r,e,2,65535,0),p.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):lr(this,r,e,!0),e+2};p.prototype.writeUInt16BE=function(r,e,n){return r=+r,e=e|0,n||I(this,r,e,2,65535,0),p.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):lr(this,r,e,!1),e+2};function mr(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}p.prototype.writeUInt32LE=function(r,e,n){return r=+r,e=e|0,n||I(this,r,e,4,4294967295,0),p.TYPED_ARRAY_SUPPORT?(this[e+3]=r>>>24,this[e+2]=r>>>16,this[e+1]=r>>>8,this[e]=r&255):mr(this,r,e,!0),e+4};p.prototype.writeUInt32BE=function(r,e,n){return r=+r,e=e|0,n||I(this,r,e,4,4294967295,0),p.TYPED_ARRAY_SUPPORT?(this[e]=r>>>24,this[e+1]=r>>>16,this[e+2]=r>>>8,this[e+3]=r&255):mr(this,r,e,!1),e+4};p.prototype.writeIntLE=function(r,e,n,o){if(r=+r,e=e|0,!o){var i=Math.pow(2,8*n-1);I(this,r,e,n,i-1,-i)}var a=0,c=1,u=0;for(this[e]=r&255;++a<n&&(c*=256);)r<0&&u===0&&this[e+a-1]!==0&&(u=1),this[e+a]=(r/c>>0)-u&255;return e+n};p.prototype.writeIntBE=function(r,e,n,o){if(r=+r,e=e|0,!o){var i=Math.pow(2,8*n-1);I(this,r,e,n,i-1,-i)}var a=n-1,c=1,u=0;for(this[e+a]=r&255;--a>=0&&(c*=256);)r<0&&u===0&&this[e+a+1]!==0&&(u=1),this[e+a]=(r/c>>0)-u&255;return e+n};p.prototype.writeInt8=function(r,e,n){return r=+r,e=e|0,n||I(this,r,e,1,127,-128),p.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),r<0&&(r=255+r+1),this[e]=r&255,e+1};p.prototype.writeInt16LE=function(r,e,n){return r=+r,e=e|0,n||I(this,r,e,2,32767,-32768),p.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8):lr(this,r,e,!0),e+2};p.prototype.writeInt16BE=function(r,e,n){return r=+r,e=e|0,n||I(this,r,e,2,32767,-32768),p.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=r&255):lr(this,r,e,!1),e+2};p.prototype.writeInt32LE=function(r,e,n){return r=+r,e=e|0,n||I(this,r,e,4,2147483647,-2147483648),p.TYPED_ARRAY_SUPPORT?(this[e]=r&255,this[e+1]=r>>>8,this[e+2]=r>>>16,this[e+3]=r>>>24):mr(this,r,e,!0),e+4};p.prototype.writeInt32BE=function(r,e,n){return r=+r,e=e|0,n||I(this,r,e,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),p.TYPED_ARRAY_SUPPORT?(this[e]=r>>>24,this[e+1]=r>>>16,this[e+2]=r>>>8,this[e+3]=r&255):mr(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 _e(t,r,e,n,o){return o||Te(t,r,e,4),de(t,r,e,n,23,4),e+4}p.prototype.writeFloatLE=function(r,e,n){return _e(this,r,e,!0,n)};p.prototype.writeFloatBE=function(r,e,n){return _e(this,r,e,!1,n)};function ye(t,r,e,n,o){return o||Te(t,r,e,8),de(t,r,e,n,52,8),e+8}p.prototype.writeDoubleLE=function(r,e,n){return ye(this,r,e,!0,n)};p.prototype.writeDoubleBE=function(r,e,n){return ye(this,r,e,!1,n)};p.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||!p.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};p.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"&&!p.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=D(r)?r:ur(new p(r,o).toString()),u=c.length;for(a=0;a<n-e;++a)this[a+e]=c[a%u]}return this};var bn=/[^+\/0-9A-Za-z-_]/g;function An(t){if(t=Tn(t).replace(bn,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function Tn(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function _n(t){return t<16?"0"+t.toString(16):t.toString(16)}function ur(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 yn(t){for(var r=[],e=0;e<t.length;++e)r.push(t.charCodeAt(e)&255);return r}function In(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 jt(An(t))}function dr(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 Rn(t){return t!==t}function wn(t){return t!=null&&(!!t._isBuffer||Re(t)||Nn(t))}function Re(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function Nn(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&Re(t.slice(0,0))}import{encodeAddress as Sn,decodeAddress as Za}from"algosdk";function N(t){return t.reduce((r,e)=>Uint8Array.from([...r,...e]))}function q(t){return new Uint8Array(p.from(t))}function we(t){return p.from(t).toString("utf-8")}function Ne(t){return p.from(t).toString("base64")}function fr(t){return p.from(t,"base64")}var gs=`{"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"},bs={[Se.V1_1]:{testnet:62368684,mainnet:552635992},[Se.V2]:{testnet:148607e3,mainnet:1002541853}};var Oe=t=>Cn.decodeAddress(t.toUpperCase()).publicKey;import*as E from"ethereumjs-util";function Ir(t){let r=E.fromSigned(s.from(t));return BigInt(r.toString())}function Bn(t){return E.toUnsigned(new E.BN(String(t)))}function Rr(t){let r=Bn(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 Ce=t=>{if(t.length!==32)throw new Error("Invalid address bytes. The address buffer length is not equel 32");let r=s.from(t).toString("hex");if(r.slice(0,24)!=="000000000000000000000000")throw console.log("normalizedAddress",r),new Error("Invalid normalized address");let e="0x"+r.slice(-40);if(!kn(e))throw new Error("Invalid hex address");return e},De=t=>new Uint8Array(E.setLengthLeft(J(t),32)),J=t=>s.from(Pn(t),"hex"),Pn=t=>t.startsWith("0x")?t.slice(2):t,kn=t=>E.isValidAddress(t),Be=(t,r)=>{let e=E.keccak256(t),{r:n,s:o,v:i}=E.fromRpcSig(r);return E.ecrecover(e,i,n,o)};var j=t=>new Uint8Array(E.keccak256(s.from(t)));var Sr=t=>s.from(j(t)).toString("hex"),Or=(t,r)=>N([x(r,"str"),j(t)]),Cr=(t,r)=>N([x(r,"str"),s.from(t,"hex")]),M=(t,r)=>{let e=Un.ABIMethod.fromSignature(t),n=e.getSelector(),o={},i=r.map((a,c)=>{let u=e.args[c].type.encode(a);return o[`txnArgs${c}`]=Array.apply([],Array.from(u)).join(", "),u});return[n,...i]},V=(t,r,e)=>{let n=s.from(t,r),o=n.subarray(n.length-e),i=s.from(o).toString();return fr(i)},Q=(t,r,e,n,o="hex")=>[wr(t,o,n),Ln(r,n),Mn(e,n,t,r,o)],Ln=(t,r)=>r===8?fr(t):r===1?Nr.decode(t):J(t),Mn=(t,r,e,n,o)=>r===8||r===1?$(t,r):Be(wr(e,o,r),n),vn=(t,r)=>r===8?"MX":r===1?"":`Ethereum Signed Message:
2
+ ${t.length}`,wr=(t,r,e)=>{let n=s.from(t,r);return s.concat([q(vn(n,e)),n])};var $=(t,r)=>r===8?Oe(t):r===1?Nr.decode(t):De(t);import _c from"algosdk";import Dc from"algosdk";import $u from"algosdk";var Z={"0x4343545055534443000000000000000000000000000000000000000000000000":65537};var Xc={SMALLESTUNIT:l.env.SMALLEST_UNIT},zc={SMALLEST_UNITS:l.env.SMALLEST_UNIT};var Zc=["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 au=l.env.REACT_APP_API_URL,su=l.env.REACT_APP_SOCKET_URL,cu=l.env.REACT_APP_ALGO_SERVER,uu=l.env.REACT_APP_ALGO_SERVER_PORT||"",pu=l.env.REACT_APP_ALGOD_TOKEN||"",lu=l.env.REACT_APP_DISPENSER_LINK,mu=l.env.REACT_APP_FRONTEND_LINK||"",du=l.env.REACT_APP_ALGO_EXPLORER_LINK,fu=l.env.REACT_APP_ALGO_EXPLORER_ASSETS_URL,gu=(l.env.REACT_APP_REQUIRE_ACCESS_CODE||"").toLowerCase()==="true",hu=l.env.REACT_APP_USERBACK_ACCESS_TOKEN,xu=(l.env.REACT_APP_EXT_ORDER_TYPES||"").toLowerCase()==="true";var Eu=.001*10**6,bu=.002*10**6;var Au=l.env.REACT_APP_MASTER_APP_ID||"406",Tu=l.env.REACT_APP_AGG_APP_ID||"408",_u=Number(l.env.REACT_APP_CODEX_APP_ID||"467960617");var Yn=l.env.REACT_APP_ALGO_NETWORK||"";var yu=Yn.toLowerCase()==="mainnet"?"mainnet":"testnet";var Cu={1:"canFollowAccounts",4:"canLikeTweets",2:"canCreateTweets",3:"canCreateTweets"};import ep from"algosdk";import mp from"algosdk";var x=(t,r,e)=>{switch(r){case"8B":return v.encodeUint64(Number(t));case"32B":return Rr(t);case"str":return q(String(t));case"address":return $(String(t),e);case"token":return Le(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(v.encodeUint64(Number(t))).subarray(-1));case"2B":return new Uint8Array(s.from(v.encodeUint64(Number(t))).subarray(-2));case"4B":return new Uint8Array(s.from(v.encodeUint64(Number(t))).subarray(-4));default:return s.from(t.toString())}},T=(t,r,e)=>{switch(r){case"8B":return v.decodeUint64(t,"safe");case"32B":return Ir(t);case"str":return we(t);case"address":return Ue(t,e);case"token":return Wn(t,e);case"float":return s.from(t).readDoubleBE(0);case"bool":case"2B":return T(t,"8B");default:return s.from(t).toString()}};var Ue=(t,r)=>r===8?v.encodeAddress(t):r===1?Br.encode(t):Ce(t),Wn=(t,r)=>{let e=s.from(t).toString("hex");return e.startsWith("0x")||(e="0x"+e),Z[e]?e:r===8?String(Ir(t)):r===1?Br.encode(t):Ue(t,r)};var Le=(t,r)=>r===8?Rr(+t):Z[t]?new Uint8Array(J(String(t))):$(String(t),r);var X=(t,r,e,n)=>{let o=$(t,r),i=v.encodeUint64(r),a=v.encodeUint64(n),c=Le(e,n);return N([o,i,c,a])};var Me=(t,r)=>{let e=$(t,r),n=q("TK_");return N([n,e])};var Pr=(t,r,e=j)=>r.map(o=>({appIndex:t,name:e(o)}));var kr=t=>new Uint8Array(s.from(Ne(t)));var ve=160,Ur=224,Hn=(t,r)=>Or(Fe(t,r),"T_"),gl=t=>Cr(t,"T_"),hl=t=>Sr(Fe(t)),Fe=(t,r="hex")=>V(t,r,Ur),xl=(t,r="hex")=>{let e=V(t,r,ve),n=Number(T(e.subarray(32,40),"8B")),o=Number(T(e.subarray(72,80),"8B"));return{loginAddress:String(T(e.subarray(0,32),"address",n)),loginChainId:n,recipient:String(T(e.subarray(40,72),"address",o)),recipientChainId:o,tkAddress:String(T(e.subarray(80,112),"address",8)),expiredDate:Number(T(e.subarray(112,120),"8B"))}},El=t=>{let{loginAddress:r,loginChainId:e,recipient:n,recipientChainId:o,tkAddress:i,expiredDate:a}=t,c=N([x(r,"address",e),x(e,"8B"),x(n,"address",o),x(o,"8B"),x(i,"address",8),x(a,"8B")]),u=kr(c);return console.log(`Dtw data should be ${ve} bytes`,u.length,u),u},bl=(t,r="hex")=>{let e=V(t,r,Ur),n=Number(T(e.subarray(32,40),"8B")),o=Number(T(e.subarray(72,80),"8B")),i=Number(T(e.subarray(112,120),"8B"));return{loginAddress:String(T(e.subarray(0,32),"address",n)),loginChainId:n,recipient:String(T(e.subarray(40,72),"address",o)),recipientChainId:o,tokenIndex:String(T(e.subarray(80,112),"token",i)),tokenChainId:i,tokenAmount:String(T(e.subarray(120,152),"32B")),expiredDate:Number(T(e.subarray(152,160),"8B")),random:Number(T(e.subarray(160,168),"8B"))}},Al=t=>{let{loginAddress:r,loginChainId:e,recipient:n,recipientChainId:o,tokenAmount:i,tokenIndex:a,tokenChainId:c,expiredDate:u,random:d}=t,f=N([x(r,"address",e),x(e,"8B"),x(n,"address",o),x(o,"8B"),x(a,"token",c),x(c,"8B"),x(i,"32B"),x(u,"8B"),x(d,"8B")]),m=kr(f);return console.log(`Transfer data should be ${Ur} bytes`,m.length,m),m},Tl=async({data:t,message:r,signature:e},n,o)=>{let{loginAddress:i,loginChainId:a,recipient:c,recipientChainId:u,tokenIndex:d,tokenChainId:f}=t,{appId:m,sender:h,superWallet:g}=o,_=n?[...Q(r,e,n.data.tkAddress,8),...Q(n.message,n.signature,i,a)]:[...Q(r,e,i,a),s.alloc(0),s.alloc(0),s.alloc(0)],z=M("directTransfer(byte[],byte[],byte[],byte[],byte[],byte[],uint64)uint64",[..._,o.transferId]),rr="0x4343545055534443000000000000000000000000000000000000000000000000",Lr=Z[rr],gr=[X(i,a,d,f),X(c,u,d,f),X(g.address,g.chainId,d,f)];ce(d,rr)||gr.push(X(i,a,rr,Lr),X(g.address,g.chainId,rr,Lr)),n&&gr.push(Me(i,a));let Ye=[...Pr(m,gr),...Pr(m,[Hn(r,"hex")],Ke=>Ke)],Ge=[o.superAppId],We=n?9:6;return Kn.makeApplicationNoOpTxnFromObject({appIndex:m,from:h,suggestedParams:await o.getTxnParams(We),appArgs:z,foreignApps:Ge,boxes:Ye})};export{ve as DTW_DATA_BYTES_LENGTH,Ur as TRANSFER_DATA_BYTES_LENGTH,hl as calcTransferHash,xl as decodeDtwMsg,bl as decodeTransferMsg,Hn as getTransferBoxKey,gl as getTransferBoxKeyFromHash,Fe as getTransferBytesFromMsg,El as makeDtwMsg,Al as makeTransferMsg,Tl as makeTransferTxn};
3
3
  /*!
4
4
  * The buffer module from node.js, for the browser.
5
5
  *