@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,5 +1,5 @@
1
- function Hr(){throw new Error("setTimeout has not been defined")}function Vr(){throw new Error("clearTimeout has not been defined")}var F=Hr,Y=Vr;typeof globalThis.setTimeout=="function"&&(F=setTimeout);typeof globalThis.clearTimeout=="function"&&(Y=clearTimeout);function $r(t){if(F===setTimeout)return setTimeout(t,0);if((F===Hr||!F)&&setTimeout)return F=setTimeout,setTimeout(t,0);try{return F(t,0)}catch{try{return F.call(null,t,0)}catch{return F.call(this,t,0)}}}function rt(t){if(Y===clearTimeout)return clearTimeout(t);if((Y===Vr||!Y)&&clearTimeout)return Y=clearTimeout,clearTimeout(t);try{return Y(t)}catch{try{return Y.call(null,t)}catch{return Y.call(this,t)}}}var L=[],q=!1,W,ir=-1;function et(){!q||!W||(q=!1,W.length?L=W.concat(L):ir=-1,L.length&&Xr())}function Xr(){if(!q){var t=$r(et);q=!0;for(var r=L.length;r;){for(W=L,L=[];++ir<r;)W&&W[ir].run();ir=-1,r=L.length}W=null,q=!1,rt(t)}}function tt(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];L.push(new zr(t,r)),L.length===1&&!q&&$r(Xr)}function zr(t,r){this.fun=t,this.array=r}zr.prototype.run=function(){this.fun.apply(null,this.array)};var nt="browser",ot="browser",it=!0,at={},st=[],ct="",ut={},pt={},lt={};function H(){}var mt=H,dt=H,ft=H,gt=H,ht=H,xt=H,Et=H;function bt(t){throw new Error("process.binding is not supported")}function At(){return"/"}function Tt(t){throw new Error("process.chdir is not supported")}function _t(){return 0}var z=globalThis.performance||{},yt=z.now||z.mozNow||z.msNow||z.oNow||z.webkitNow||function(){return new Date().getTime()};function It(t){var r=yt.call(z)*.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 Rt=new Date;function wt(){var t=new Date,r=t-Rt;return r/1e3}var l={nextTick:tt,title:nt,browser:it,env:at,argv:st,version:ct,versions:ut,on:mt,addListener:dt,once:ft,off:gt,removeListener:ht,removeAllListeners:xt,emit:Et,binding:bt,cwd:At,chdir:Tt,umask:_t,hrtime:It,platform:ot,release:pt,config:lt,uptime:wt},Wr={};Object.keys(Wr).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]=Wr[t]:e=e[o]||(e[o]={})}});var O=[],R=[],Nt=typeof Uint8Array<"u"?Uint8Array:Array,yr=!1;function Qr(){yr=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,e=t.length;r<e;++r)O[r]=t[r],R[t.charCodeAt(r)]=r;R[45]=62,R[95]=63}function St(t){yr||Qr();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 Nt(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 O[t>>18&63]+O[t>>12&63]+O[t>>6&63]+O[t&63]}function Ot(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 qr(t){yr||Qr();for(var r,e=t.length,n=e%3,o="",i=[],a=16383,c=0,u=e-n;c<u;c+=a)i.push(Ot(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("")}s.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;function ar(){return s.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function M(t,r){if(ar()<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 Ir(this,t)}return Zr(this,t,r,e)}s.poolSize=8192;s._augment=function(t){return t.__proto__=s.prototype,t};function Zr(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?Pt(t,r,e,n):typeof r=="string"?Dt(t,r,e):kt(t,r)}s.from=function(t,r,e){return Zr(null,t,r,e)};s.kMaxLength=ar();s.TYPED_ARRAY_SUPPORT&&(s.prototype.__proto__=Uint8Array.prototype,s.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&s[Symbol.species]);function re(t){if(typeof t!="number")throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function Ct(t,r,e,n){return re(r),r<=0?M(t,r):e!==void 0?typeof n=="string"?M(t,r).fill(e,n):M(t,r).fill(e):M(t,r)}s.alloc=function(t,r,e){return Ct(null,t,r,e)};function Ir(t,r){if(re(r),t=M(t,r<0?0:Rr(r)|0),!s.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}s.allocUnsafe=function(t){return Ir(null,t)};s.allocUnsafeSlow=function(t){return Ir(null,t)};function Dt(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=ee(r,e)|0;t=M(t,n);var o=t.write(r,e);return o!==n&&(t=t.slice(0,o)),t}function _r(t,r){var e=r.length<0?0:Rr(r.length)|0;t=M(t,e);for(var n=0;n<e;n+=1)t[n]=r[n]&255;return t}function Pt(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=_r(t,r),t}function kt(t,r){if(C(r)){var e=Rr(r.length)|0;return t=M(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"||Zt(r.length)?M(t,0):_r(t,r);if(r.type==="Buffer"&&Array.isArray(r.data))return _r(t,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function Rr(t){if(t>=ar())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+ar().toString(16)+" bytes");return t|0}s.isBuffer=rn;function C(t){return!!(t!=null&&t._isBuffer)}s.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};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(!C(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(o,i),i+=a.length}return o};function ee(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 sr(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return ce(t).length;default:if(n)return sr(t).length;r=(""+r).toLowerCase(),n=!0}}s.byteLength=ee;function Ut(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 Vt(this,r,e);case"utf8":case"utf-8":return oe(this,r,e);case"ascii":return Wt(this,r,e);case"latin1":case"binary":return Ht(this,r,e);case"base64":return Gt(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return $t(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}s.prototype._isBuffer=!0;function V(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)V(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)V(this,e,e+3),V(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)V(this,e,e+7),V(this,e+1,e+6),V(this,e+2,e+5),V(this,e+3,e+4);return this};s.prototype.toString=function(){var r=this.length|0;return r===0?"":arguments.length===0?oe(this,0,r):Ut.apply(this,arguments)};s.prototype.equals=function(r){if(!C(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(!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 te(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)),C(r))return r.length===0?-1:Jr(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):Jr(t,[r],e,n,o);throw new TypeError("val must be string, number or Buffer")}function Jr(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,T){return i===1?g[T]:g.readUInt16BE(T*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 te(this,r,e,n,!0)};s.prototype.lastIndexOf=function(r,e,n){return te(this,r,e,n,!1)};function Lt(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 Mt(t,r,e,n){return pr(sr(r,t.length-e),t,e,n)}function ne(t,r,e,n){return pr(jt(r),t,e,n)}function vt(t,r,e,n){return ne(t,r,e,n)}function Ft(t,r,e,n){return pr(ce(r),t,e,n)}function Yt(t,r,e,n){return pr(Qt(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 Lt(this,r,e,n);case"utf8":case"utf-8":return Mt(this,r,e,n);case"ascii":return ne(this,r,e,n);case"latin1":case"binary":return vt(this,r,e,n);case"base64":return Ft(this,r,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Yt(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 Gt(t,r,e){return r===0&&e===t.length?qr(t):qr(t.slice(r,e))}function oe(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 Kt(n)}var jr=4096;function Kt(t){var r=t.length;if(r<=jr)return String.fromCharCode.apply(String,t);for(var e="",n=0;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=jr));return e}function Wt(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 Ht(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 Vt(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+=Jt(t[i]);return o}function $t(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),lr(this,r,!0,23,4)};s.prototype.readFloatBE=function(r,e){return e||b(r,4,this.length),lr(this,r,!1,23,4)};s.prototype.readDoubleLE=function(r,e){return e||b(r,8,this.length),lr(this,r,!0,52,8)};s.prototype.readDoubleBE=function(r,e){return e||b(r,8,this.length),lr(this,r,!1,52,8)};function y(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")}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 cr(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):cr(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):cr(this,r,e,!1),e+2};function ur(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):ur(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):ur(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):cr(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):cr(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):ur(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):ur(this,r,e,!1),e+4};function ie(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||ie(t,r,e,4,34028234663852886e22,-34028234663852886e22),pe(t,r,e,n,23,4),e+4}s.prototype.writeFloatLE=function(r,e,n){return ae(this,r,e,!0,n)};s.prototype.writeFloatBE=function(r,e,n){return ae(this,r,e,!1,n)};function se(t,r,e,n,o){return o||ie(t,r,e,8,17976931348623157e292,-17976931348623157e292),pe(t,r,e,n,52,8),e+8}s.prototype.writeDoubleLE=function(r,e,n){return se(this,r,e,!0,n)};s.prototype.writeDoubleBE=function(r,e,n){return se(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=C(r)?r:sr(new s(r,o).toString()),u=c.length;for(a=0;a<n-e;++a)this[a+e]=c[a%u]}return this};var Xt=/[^+\/0-9A-Za-z-_]/g;function zt(t){if(t=qt(t).replace(Xt,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function qt(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function Jt(t){return t<16?"0"+t.toString(16):t.toString(16)}function sr(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 jt(t){for(var r=[],e=0;e<t.length;++e)r.push(t.charCodeAt(e)&255);return r}function Qt(t,r){for(var e,n,o,i=[],a=0;a<t.length&&!((r-=2)<0);++a)e=t.charCodeAt(a),n=e>>8,o=e%256,i.push(o),i.push(n);return i}function ce(t){return St(zt(t))}function pr(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 Zt(t){return t!==t}function rn(t){return t!=null&&(!!t._isBuffer||ue(t)||en(t))}function ue(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function en(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&ue(t.slice(0,0))}function lr(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 pe(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,T=n?1:-1,k=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+=T,c/=256,o-=8);for(a=a<<o|c,d+=o;d>0;t[e+g]=a&255,g+=T,a/=256,d-=8);t[e+g-T]|=k*128}import Jn from"algosdk";import*as Yr from"bs58";import De from"algosdk";import bo,{decodeAddress as Ao,encodeAddress as To}from"algosdk";var D=[],w=[],tn=typeof Uint8Array<"u"?Uint8Array:Array,Nr=!1;function fe(){Nr=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,e=t.length;r<e;++r)D[r]=t[r],w[t.charCodeAt(r)]=r;w[45]=62,w[95]=63}function nn(t){Nr||fe();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 tn(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 on(t){return D[t>>18&63]+D[t>>12&63]+D[t>>6&63]+D[t&63]}function an(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(on(n));return o.join("")}function le(t){Nr||fe();for(var r,e=t.length,n=e%3,o="",i=[],a=16383,c=0,u=e-n;c<u;c+=a)i.push(an(t,c,c+a>u?u:c+a));return n===1?(r=t[e-1],o+=D[r>>2],o+=D[r<<4&63],o+="=="):n===2&&(r=(t[e-2]<<8)+t[e-1],o+=D[r>>10],o+=D[r>>4&63],o+=D[r<<2&63],o+="="),i.push(o),i.join("")}function fr(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 ge(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,T=n?1:-1,k=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+=T,c/=256,o-=8);for(a=a<<o|c,d+=o;d>0;t[e+g]=a&255,g+=T,a/=256,d-=8);t[e+g-T]|=k*128}var sn={}.toString,he=Array.isArray||function(t){return sn.call(t)=="[object Array]"};var cn=50;p.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;var fo=mr();function mr(){return p.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function v(t,r){if(mr()<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 Sr(this,t)}return xe(this,t,r,e)}p.poolSize=8192;p._augment=function(t){return t.__proto__=p.prototype,t};function xe(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?ln(t,r,e,n):typeof r=="string"?pn(t,r,e):mn(t,r)}p.from=function(t,r,e){return xe(null,t,r,e)};p.TYPED_ARRAY_SUPPORT&&(p.prototype.__proto__=Uint8Array.prototype,p.__proto__=Uint8Array);function Ee(t){if(typeof t!="number")throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function un(t,r,e,n){return Ee(r),r<=0?v(t,r):e!==void 0?typeof n=="string"?v(t,r).fill(e,n):v(t,r).fill(e):v(t,r)}p.alloc=function(t,r,e){return un(null,t,r,e)};function Sr(t,r){if(Ee(r),t=v(t,r<0?0:Br(r)|0),!p.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}p.allocUnsafe=function(t){return Sr(null,t)};p.allocUnsafeSlow=function(t){return Sr(null,t)};function pn(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=be(r,e)|0;t=v(t,n);var o=t.write(r,e);return o!==n&&(t=t.slice(0,o)),t}function wr(t,r){var e=r.length<0?0:Br(r.length)|0;t=v(t,e);for(var n=0;n<e;n+=1)t[n]=r[n]&255;return t}function ln(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=wr(t,r),t}function mn(t,r){if(P(r)){var e=Br(r.length)|0;return t=v(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"||Cn(r.length)?v(t,0):wr(t,r);if(r.type==="Buffer"&&he(r.data))return wr(t,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function Br(t){if(t>=mr())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+mr().toString(16)+" bytes");return t|0}p.isBuffer=Dn;function P(t){return!!(t!=null&&t._isBuffer)}p.compare=function(r,e){if(!P(r)||!P(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(!he(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(!P(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(o,i),i+=a.length}return o};function be(t,r){if(P(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 dr(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return we(t).length;default:if(n)return dr(t).length;r=(""+r).toLowerCase(),n=!0}}p.byteLength=be;function dn(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 yn(this,r,e);case"utf8":case"utf-8":return _e(this,r,e);case"ascii":return Tn(this,r,e);case"latin1":case"binary":return _n(this,r,e);case"base64":return bn(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return In(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}p.prototype._isBuffer=!0;function $(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)$(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)$(this,e,e+3),$(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)$(this,e,e+7),$(this,e+1,e+6),$(this,e+2,e+5),$(this,e+3,e+4);return this};p.prototype.toString=function(){var r=this.length|0;return r===0?"":arguments.length===0?_e(this,0,r):dn.apply(this,arguments)};p.prototype.equals=function(r){if(!P(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=cn;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(!P(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 Ae(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)),P(r))return r.length===0?-1:me(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):me(t,[r],e,n,o);throw new TypeError("val must be string, number or Buffer")}function me(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,T){return i===1?g[T]:g.readUInt16BE(T*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 Ae(this,r,e,n,!0)};p.prototype.lastIndexOf=function(r,e,n){return Ae(this,r,e,n,!1)};function fn(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 gn(t,r,e,n){return xr(dr(r,t.length-e),t,e,n)}function Te(t,r,e,n){return xr(Bn(r),t,e,n)}function hn(t,r,e,n){return Te(t,r,e,n)}function xn(t,r,e,n){return xr(we(r),t,e,n)}function En(t,r,e,n){return xr(On(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 fn(this,r,e,n);case"utf8":case"utf-8":return gn(this,r,e,n);case"ascii":return Te(this,r,e,n);case"latin1":case"binary":return hn(this,r,e,n);case"base64":return xn(this,r,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return En(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 bn(t,r,e){return r===0&&e===t.length?le(t):le(t.slice(r,e))}function _e(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 An(n)}var de=4096;function An(t){var r=t.length;if(r<=de)return String.fromCharCode.apply(String,t);for(var e="",n=0;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=de));return e}function Tn(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 _n(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 yn(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+=Sn(t[i]);return o}function In(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),fr(this,r,!0,23,4)};p.prototype.readFloatBE=function(r,e){return e||A(r,4,this.length),fr(this,r,!1,23,4)};p.prototype.readDoubleLE=function(r,e){return e||A(r,8,this.length),fr(this,r,!0,52,8)};p.prototype.readDoubleBE=function(r,e){return e||A(r,8,this.length),fr(this,r,!1,52,8)};function I(t,r,e,n,o,i){if(!P(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 gr(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):gr(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):gr(this,r,e,!1),e+2};function hr(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):hr(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):hr(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):gr(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):gr(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):hr(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):hr(this,r,e,!1),e+4};function ye(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 Ie(t,r,e,n,o){return o||ye(t,r,e,4),ge(t,r,e,n,23,4),e+4}p.prototype.writeFloatLE=function(r,e,n){return Ie(this,r,e,!0,n)};p.prototype.writeFloatBE=function(r,e,n){return Ie(this,r,e,!1,n)};function Re(t,r,e,n,o){return o||ye(t,r,e,8),ge(t,r,e,n,52,8),e+8}p.prototype.writeDoubleLE=function(r,e,n){return Re(this,r,e,!0,n)};p.prototype.writeDoubleBE=function(r,e,n){return Re(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=P(r)?r:dr(new p(r,o).toString()),u=c.length;for(a=0;a<n-e;++a)this[a+e]=c[a%u]}return this};var Rn=/[^+\/0-9A-Za-z-_]/g;function wn(t){if(t=Nn(t).replace(Rn,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function Nn(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function Sn(t){return t<16?"0"+t.toString(16):t.toString(16)}function dr(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 Bn(t){for(var r=[],e=0;e<t.length;++e)r.push(t.charCodeAt(e)&255);return r}function On(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 we(t){return nn(wn(t))}function xr(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 Cn(t){return t!==t}function Dn(t){return t!=null&&(!!t._isBuffer||Ne(t)||Pn(t))}function Ne(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function Pn(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&Ne(t.slice(0,0))}import{encodeAddress as kn,decodeAddress as No}from"algosdk";function N(t){return t.reduce((r,e)=>Uint8Array.from([...r,...e]))}function Z(t){return new Uint8Array(p.from(t))}function Se(t){return p.from(t).toString("utf-8")}function Be(t){let r=BigInt(0);for(let e=0;e<8&&t?.length;e++)r=r<<BigInt(8)|BigInt(t[e]);return r}function Oe(t){return p.from(t).toString("base64")}function Er(t){return p.from(t,"base64")}import Un from"bignumber.js";Un.config({DECIMAL_PLACES:40,EXPONENTIAL_AT:45});var zo=`{"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 Ce={V1_1:"v1_1",V2:"v2"},Qo={[Ce.V1_1]:{testnet:62368684,mainnet:552635992},[Ce.V2]:{testnet:148607e3,mainnet:1002541853}};var Or=async(t,r,e)=>{try{let{value:n}=await t.getApplicationBoxByName(r,e).do();return n}catch(n){if(n.message.includes("box not found"))return console.log(`Box not found '${s.from(e).toString("hex")}'`),null;throw n}},rr=async(t,r=1)=>{let e=await t.getTransactionParams().do();return r>1&&(e.fee=De.ALGORAND_MIN_TX_FEE*r,e.flatFee=!0),{...e}};var Pe=t=>De.decodeAddress(t.toUpperCase()).publicKey;import*as E from"ethereumjs-util";function Cr(t){let r=E.fromSigned(s.from(t));return BigInt(r.toString())}function Fn(t){return E.toUnsigned(new E.BN(String(t)))}function Dr(t){let r=Fn(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 ke=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(!Gn(e))throw new Error("Invalid hex address");return e},Ue=t=>new Uint8Array(E.setLengthLeft(er(t),32)),er=t=>s.from(Yn(t),"hex"),Yn=t=>t.startsWith("0x")?t.slice(2):t,Gn=t=>E.isValidAddress(t),Le=(t,r)=>{let e=E.keccak256(t),{r:n,s:o,v:i}=E.fromRpcSig(r);return E.ecrecover(e,i,n,o)};var tr=t=>new Uint8Array(E.keccak256(s.from(t)));import G from"algosdk";import*as Lr from"bs58";var ve=(t,r)=>String(t).toLowerCase()===String(r).toLowerCase();import kr from"algosdk";var Ur=(t,r,e,n,o,i)=>{let a=S("dummy(uint64)void",[1]);return kr.makeApplicationNoOpTxnFromObject({from:r,suggestedParams:{...e,fee:kr.ALGORAND_MIN_TX_FEE,flatFee:!0},appArgs:a,appIndex:t,boxes:n,foreignApps:i,note:new Uint8Array(s.from(o))})},Wn=(t,r)=>{let{accounts:n,foreignAssets:o,foreignApps:i,boxes:a,appIndex:c,from:u,suggestedParams:d}=r;console.log("Total resources",[n,i,o,a]);let f=[n,i,o,a].reduce((B,Q)=>B+(Q?.length||0),0),m=a?.slice(0,8-f)||[],h=a?.slice(8-f)||[],g=8-(i?.length||0),T=kr.makeApplicationNoOpTxnFromObject({...r,boxes:m}),k=1,U=[],K=[];for(let B=0;B<h.length;B++){let Q=h[B];U.push(Q),(U.length===g||B===h.length-1)&&(K.push(Ur(c,u,d,U,`${t}_${k}`,i)),U=[],k++)}return K.push(Ur(c,u,d,[],`${t}_${++k}`,i)),console.log("dummy count",K.length),[T,...K]};var Fe=(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))(Fe||{}),Ye=(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))(Ye||{}),es={...Fe,...Ye};var nr={"0x4343545055534443000000000000000000000000000000000000000000000000":65537};var Ec={SMALLESTUNIT:l.env.SMALLEST_UNIT},bc={SMALLEST_UNITS:l.env.SMALLEST_UNIT};var Ic=["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 Cc=l.env.REACT_APP_API_URL,Dc=l.env.REACT_APP_SOCKET_URL,Pc=l.env.REACT_APP_ALGO_SERVER,kc=l.env.REACT_APP_ALGO_SERVER_PORT||"",Uc=l.env.REACT_APP_ALGOD_TOKEN||"",Lc=l.env.REACT_APP_DISPENSER_LINK,Mc=l.env.REACT_APP_FRONTEND_LINK||"",vc=l.env.REACT_APP_ALGO_EXPLORER_LINK,Fc=l.env.REACT_APP_ALGO_EXPLORER_ASSETS_URL,Yc=(l.env.REACT_APP_REQUIRE_ACCESS_CODE||"").toLowerCase()==="true",Gc=l.env.REACT_APP_USERBACK_ACCESS_TOKEN,Kc=(l.env.REACT_APP_EXT_ORDER_TYPES||"").toLowerCase()==="true";var Wc=.001*10**6,Hc=.002*10**6;var Vc=l.env.REACT_APP_MASTER_APP_ID||"406",$c=l.env.REACT_APP_AGG_APP_ID||"408",$n=Number(l.env.REACT_APP_CODEX_APP_ID||"467960617");console.log("CODEX_APP_ID",$n);var Xn=l.env.REACT_APP_ALGO_NETWORK||"";var Xc=Xn.toLowerCase()==="mainnet"?"mainnet":"testnet";var x=(t,r,e)=>{switch(r){case"8B":return G.encodeUint64(Number(t));case"32B":return Dr(t);case"str":return Z(String(t));case"address":return j(String(t),e);case"token":return He(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(G.encodeUint64(Number(t))).subarray(-1));case"2B":return new Uint8Array(s.from(G.encodeUint64(Number(t))).subarray(-2));case"4B":return new Uint8Array(s.from(G.encodeUint64(Number(t))).subarray(-4));default:return s.from(t.toString())}},_=(t,r,e)=>{switch(r){case"8B":return G.decodeUint64(t,"safe");case"32B":return Cr(t);case"str":return Se(t);case"address":return We(t,e);case"token":return zn(t,e);case"float":return s.from(t).readDoubleBE(0);case"bool":case"2B":return _(t,"8B");default:return s.from(t).toString()}};var We=(t,r)=>r===8?G.encodeAddress(t):r===1?Lr.encode(t):ke(t),zn=(t,r)=>{let e=s.from(t).toString("hex");return e.startsWith("0x")||(e="0x"+e),nr[e]?e:r===8?String(Cr(t)):r===1?Lr.encode(t):We(t,r)};var He=(t,r)=>r===8?Dr(+t):nr[t]?new Uint8Array(er(String(t))):j(String(t),r);var J=(t,r,e,n)=>{let o=j(t,r),i=G.encodeUint64(r),a=G.encodeUint64(n),c=He(e,n);return N([o,i,c,a])};var Ve=(t,r)=>{let e=j(t,r),n=Z("TK_");return N([n,e])};var Mr=(t,r,e=tr)=>r.map(o=>({appIndex:t,name:e(o)}));var vr=t=>new Uint8Array(s.from(Oe(t)));var br=t=>s.from(tr(t)).toString("hex"),Ar=(t,r)=>N([x(r,"str"),tr(t)]),Tr=(t,r)=>N([x(r,"str"),s.from(t,"hex")]),S=(t,r)=>{let e=Jn.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]},X=(t,r,e)=>{let n=s.from(t,r),o=n.subarray(n.length-e),i=s.from(o).toString();return Er(i)},or=(t,r,e,n,o="hex")=>[Pr(t,o,n),jn(r,n),Qn(e,n,t,r,o)],jn=(t,r)=>r===8?Er(t):r===1?Yr.decode(t):er(t),Qn=(t,r,e,n,o)=>r===8||r===1?j(t,r):Le(Pr(e,o,r),n),Zn=(t,r)=>r===8?"MX":r===1?"":`Ethereum Signed Message:
2
- ${t.length}`,Pr=(t,r,e)=>{let n=s.from(t,r);return s.concat([Z(Zn(n,e)),n])},Kn=t=>{switch(t){case"ALGORAND":return 8;case"SOLANA":return 1;case"EVM":return 5;default:return 5}},j=(t,r)=>r===8?Pe(t):r===1?Yr.decode(t):Ue(t),ro="CCTPUSDC",eo=65537;function to(){let t=s.alloc(32,0);return s.from(ro,"utf-8").copy(t),t}function Lu(){return{address:"0x"+to().toString("hex"),chainId:eo}}import Gr from"algosdk";var Xe=()=>x("MBR","str"),Vu=async(t,r)=>{let e=Xe();try{let n=await Or(t,r,e);if(!n)return;let o=Be(n);return console.log("Box MBR",o),o}catch(n){console.log("err",n)}},$u=async(t,r,e,n,{amount:o,type:i})=>{let a=S("updateMBR(byte[],uint64)uint64",[x(i,"str"),o]),c=i==="withdraw"?[n]:[],d=await rr(t,i==="withdraw"?2:1),f=Gr.makeApplicationNoOpTxnFromObject({appIndex:e,from:r,suggestedParams:d,appArgs:a,boxes:[{appIndex:e,name:Xe()}],foreignApps:c});if(console.log("updateMbr txn",f,r),i==="deposit"){let m={suggestedParams:d,from:r,to:Gr.getApplicationAddress(e),amount:o};return[Gr.makePaymentTxnWithSuggestedParamsFromObject(m),f]}return[f]};import ze from"algosdk";var rp=async(t,r,e,n)=>{let i=await rr(t,1);return i.flatFee=!0,i.fee=4e3,console.log("new MNA key:",n),console.log("sender:",e),console.log("superAppId:",r),ze.makeApplicationNoOpTxnFromObject({appIndex:r,from:e,suggestedParams:i,appArgs:S("set_global(byte[],byte[],byte[])void",[x("MNA","str"),ze.decodeAddress(n).publicKey,x("S","str")])})};import no from"algosdk";var Fr=(t,r="hex")=>X(t,r,328),qn=(t,r)=>Ar(Fr(t,r),"O_"),$e=t=>Tr(t,"O_"),up=t=>br(Fr(t,"hex")),pp=(t,r,e,n,o=[])=>{let i=n.map(d=>$e(d));console.log("makeRemoveExpiredOrderTxn => boxKeys",JSON.stringify(i.map(d=>s.from(d).toString("hex"))));let a=i.map(d=>({appIndex:r,name:d})),c=S("removeExpiredData(byte[],byte[])uint64",[x("O_","str"),N(i)]);return no.makeApplicationNoOpTxnFromObject({appIndex:r,from:t,suggestedParams:e,appArgs:c,boxes:a,foreignApps:o})};import oo from"algosdk";var qe=160,Kr=224,io=(t,r)=>Ar(Je(t,r),"T_"),_p=t=>Tr(t,"T_"),yp=t=>br(Je(t)),Je=(t,r="hex")=>X(t,r,Kr),Ip=(t,r="hex")=>{let e=X(t,r,qe),n=Number(_(e.subarray(32,40),"8B")),o=Number(_(e.subarray(72,80),"8B"));return{loginAddress:String(_(e.subarray(0,32),"address",n)),loginChainId:n,recipient:String(_(e.subarray(40,72),"address",o)),recipientChainId:o,tkAddress:String(_(e.subarray(80,112),"address",8)),expiredDate:Number(_(e.subarray(112,120),"8B"))}},Rp=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=vr(c);return console.log(`Dtw data should be ${qe} bytes`,u.length,u),u},wp=(t,r="hex")=>{let e=X(t,r,Kr),n=Number(_(e.subarray(32,40),"8B")),o=Number(_(e.subarray(72,80),"8B")),i=Number(_(e.subarray(112,120),"8B"));return{loginAddress:String(_(e.subarray(0,32),"address",n)),loginChainId:n,recipient:String(_(e.subarray(40,72),"address",o)),recipientChainId:o,tokenIndex:String(_(e.subarray(80,112),"token",i)),tokenChainId:i,tokenAmount:String(_(e.subarray(120,152),"32B")),expiredDate:Number(_(e.subarray(152,160),"8B")),random:Number(_(e.subarray(160,168),"8B"))}},Np=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=vr(f);return console.log(`Transfer data should be ${Kr} bytes`,m.length,m),m},Sp=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,T=n?[...or(r,e,n.data.tkAddress,8),...or(n.message,n.signature,i,a)]:[...or(r,e,i,a),s.alloc(0),s.alloc(0),s.alloc(0)],k=S("directTransfer(byte[],byte[],byte[],byte[],byte[],byte[],uint64)uint64",[...T,o.transferId]),U="0x4343545055534443000000000000000000000000000000000000000000000000",K=nr[U],B=[J(i,a,d,f),J(c,u,d,f),J(g.address,g.chainId,d,f)];ve(d,U)||B.push(J(i,a,U,K),J(g.address,g.chainId,U,K)),n&&B.push(Ve(i,a));let Q=[...Mr(m,B),...Mr(m,[io(r,"hex")],Ze=>Ze)],je=[o.superAppId],Qe=n?9:6;return oo.makeApplicationNoOpTxnFromObject({appIndex:m,from:h,suggestedParams:await o.getTxnParams(Qe),appArgs:k,foreignApps:je,boxes:Q})};export{qe as DTW_DATA_BYTES_LENGTH,Kr as TRANSFER_DATA_BYTES_LENGTH,up as calcOrderHash,yp as calcTransferHash,Ip as decodeDtwMsg,jn as decodeSignature,wp as decodeTransferMsg,j as encodeAddress,br as generateHash,S as getAppArgs,Ar as getBoxKey,Tr as getBoxKeyFromHash,X as getDataBytesFromMsg,Vu as getMbrBoxValue,or as getMsgArgs,qn as getOrderBoxKey,$e as getOrderBoxKeyFromHash,Fr as getOrderBytesFromMsg,Pr as getPrefixedMessage,Kn as getProviderChainId,Qn as getPublicKey,io as getTransferBoxKey,_p as getTransferBoxKeyFromHash,Je as getTransferBytesFromMsg,to as getUnifiedUSDC,Lu as getUnifiedUSDCToken,Rp as makeDtwMsg,Ur as makeDummyTxn,Wn as makeGroupTxnsWithDummy,pp as makeRemoveExpiredOrderTxn,rp as makeSetManagerKeyTxn,Np as makeTransferMsg,Sp as makeTransferTxn,$u as makeUpdateMbrTxn,eo as unified_CCTP_ChainID,ro as unified_CCTP_token};
1
+ function Hr(){throw new Error("setTimeout has not been defined")}function Vr(){throw new Error("clearTimeout has not been defined")}var F=Hr,Y=Vr;typeof globalThis.setTimeout=="function"&&(F=setTimeout);typeof globalThis.clearTimeout=="function"&&(Y=clearTimeout);function $r(t){if(F===setTimeout)return setTimeout(t,0);if((F===Hr||!F)&&setTimeout)return F=setTimeout,setTimeout(t,0);try{return F(t,0)}catch{try{return F.call(null,t,0)}catch{return F.call(this,t,0)}}}function nt(t){if(Y===clearTimeout)return clearTimeout(t);if((Y===Vr||!Y)&&clearTimeout)return Y=clearTimeout,clearTimeout(t);try{return Y(t)}catch{try{return Y.call(null,t)}catch{return Y.call(this,t)}}}var L=[],J=!1,K,ir=-1;function ot(){!J||!K||(J=!1,K.length?L=K.concat(L):ir=-1,L.length&&Xr())}function Xr(){if(!J){var t=$r(ot);J=!0;for(var r=L.length;r;){for(K=L,L=[];++ir<r;)K&&K[ir].run();ir=-1,r=L.length}K=null,J=!1,nt(t)}}function it(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];L.push(new zr(t,r)),L.length===1&&!J&&$r(Xr)}function zr(t,r){this.fun=t,this.array=r}zr.prototype.run=function(){this.fun.apply(null,this.array)};var at="browser",st="browser",ct=!0,ut={},pt=[],lt="",mt={},dt={},ft={};function H(){}var gt=H,ht=H,xt=H,Et=H,bt=H,At=H,Tt=H;function _t(t){throw new Error("process.binding is not supported")}function yt(){return"/"}function It(t){throw new Error("process.chdir is not supported")}function Rt(){return 0}var q=globalThis.performance||{},wt=q.now||q.mozNow||q.msNow||q.oNow||q.webkitNow||function(){return new Date().getTime()};function Nt(t){var r=wt.call(q)*.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 St=new Date;function Ot(){var t=new Date,r=t-St;return r/1e3}var l={nextTick:it,title:at,browser:ct,env:ut,argv:pt,version:lt,versions:mt,on:gt,addListener:ht,once:xt,off:Et,removeListener:bt,removeAllListeners:At,emit:Tt,binding:_t,cwd:yt,chdir:It,umask:Rt,hrtime:Nt,platform:st,release:dt,config:ft,uptime:Ot},Kr={};Object.keys(Kr).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]=Kr[t]:e=e[o]||(e[o]={})}});var C=[],w=[],Ct=typeof Uint8Array<"u"?Uint8Array:Array,yr=!1;function Qr(){yr=!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 Dt(t){yr||Qr();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 Ct(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 Bt(t){return C[t>>18&63]+C[t>>12&63]+C[t>>6&63]+C[t&63]}function Pt(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 qr(t){yr||Qr();for(var r,e=t.length,n=e%3,o="",i=[],a=16383,c=0,u=e-n;c<u;c+=a)i.push(Pt(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("")}s.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;function ar(){return s.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function M(t,r){if(ar()<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 Ir(this,t)}return Zr(this,t,r,e)}s.poolSize=8192;s._augment=function(t){return t.__proto__=s.prototype,t};function Zr(t,r,e,n){if(typeof r=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&r instanceof ArrayBuffer?Lt(t,r,e,n):typeof r=="string"?Ut(t,r,e):Mt(t,r)}s.from=function(t,r,e){return Zr(null,t,r,e)};s.kMaxLength=ar();s.TYPED_ARRAY_SUPPORT&&(s.prototype.__proto__=Uint8Array.prototype,s.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&s[Symbol.species]);function re(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 kt(t,r,e,n){return re(r),r<=0?M(t,r):e!==void 0?typeof n=="string"?M(t,r).fill(e,n):M(t,r).fill(e):M(t,r)}s.alloc=function(t,r,e){return kt(null,t,r,e)};function Ir(t,r){if(re(r),t=M(t,r<0?0:Rr(r)|0),!s.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}s.allocUnsafe=function(t){return Ir(null,t)};s.allocUnsafeSlow=function(t){return Ir(null,t)};function Ut(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=ee(r,e)|0;t=M(t,n);var o=t.write(r,e);return o!==n&&(t=t.slice(0,o)),t}function _r(t,r){var e=r.length<0?0:Rr(r.length)|0;t=M(t,e);for(var n=0;n<e;n+=1)t[n]=r[n]&255;return t}function Lt(t,r,e,n){if(r.byteLength,e<0||r.byteLength<e)throw new RangeError("'offset' is out of bounds");if(r.byteLength<e+(n||0))throw new RangeError("'length' is out of bounds");return e===void 0&&n===void 0?r=new Uint8Array(r):n===void 0?r=new Uint8Array(r,e):r=new Uint8Array(r,e,n),s.TYPED_ARRAY_SUPPORT?(t=r,t.__proto__=s.prototype):t=_r(t,r),t}function Mt(t,r){if(D(r)){var e=Rr(r.length)|0;return t=M(t,e),t.length===0||r.copy(t,0,0,e),t}if(r){if(typeof ArrayBuffer<"u"&&r.buffer instanceof ArrayBuffer||"length"in r)return typeof r.length!="number"||tn(r.length)?M(t,0):_r(t,r);if(r.type==="Buffer"&&Array.isArray(r.data))return _r(t,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function Rr(t){if(t>=ar())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+ar().toString(16)+" bytes");return t|0}s.isBuffer=nn;function D(t){return!!(t!=null&&t._isBuffer)}s.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};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(!D(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(o,i),i+=a.length}return o};function ee(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 sr(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return ce(t).length;default:if(n)return sr(t).length;r=(""+r).toLowerCase(),n=!0}}s.byteLength=ee;function vt(t,r,e){var n=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((e===void 0||e>this.length)&&(e=this.length),e<=0)||(e>>>=0,r>>>=0,e<=r))return"";for(t||(t="utf8");;)switch(t){case"hex":return zt(this,r,e);case"utf8":case"utf-8":return oe(this,r,e);case"ascii":return $t(this,r,e);case"latin1":case"binary":return Xt(this,r,e);case"base64":return Ht(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return qt(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}s.prototype._isBuffer=!0;function V(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)V(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)V(this,e,e+3),V(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)V(this,e,e+7),V(this,e+1,e+6),V(this,e+2,e+5),V(this,e+3,e+4);return this};s.prototype.toString=function(){var r=this.length|0;return r===0?"":arguments.length===0?oe(this,0,r):vt.apply(this,arguments)};s.prototype.equals=function(r){if(!D(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(!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),m=this.slice(o,i),f=r.slice(e,n),d=0;d<u;++d)if(m[d]!==f[d]){a=m[d],c=f[d];break}return a<c?-1:c<a?1:0};function te(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)),D(r))return r.length===0?-1:Jr(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):Jr(t,[r],e,n,o);throw new TypeError("val must be string, number or Buffer")}function Jr(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,h){return i===1?g[h]:g.readUInt16BE(h*i)}var m;if(o){var f=-1;for(m=e;m<a;m++)if(u(t,m)===u(r,f===-1?0:m-f)){if(f===-1&&(f=m),m-f+1===c)return f*i}else f!==-1&&(m-=m-f),f=-1}else for(e+c>a&&(e=a-c),m=e;m>=0;m--){for(var d=!0,E=0;E<c;E++)if(u(t,m+E)!==u(r,E)){d=!1;break}if(d)return m}return-1}s.prototype.includes=function(r,e,n){return this.indexOf(r,e,n)!==-1};s.prototype.indexOf=function(r,e,n){return te(this,r,e,n,!0)};s.prototype.lastIndexOf=function(r,e,n){return te(this,r,e,n,!1)};function Ft(t,r,e,n){e=Number(e)||0;var o=t.length-e;n?(n=Number(n),n>o&&(n=o)):n=o;var 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 Yt(t,r,e,n){return pr(sr(r,t.length-e),t,e,n)}function ne(t,r,e,n){return pr(rn(r),t,e,n)}function Gt(t,r,e,n){return ne(t,r,e,n)}function Wt(t,r,e,n){return pr(ce(r),t,e,n)}function Kt(t,r,e,n){return pr(en(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 Ft(this,r,e,n);case"utf8":case"utf-8":return Yt(this,r,e,n);case"ascii":return ne(this,r,e,n);case"latin1":case"binary":return Gt(this,r,e,n);case"base64":return Wt(this,r,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Kt(this,r,e,n);default:if(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 Ht(t,r,e){return r===0&&e===t.length?qr(t):qr(t.slice(r,e))}function oe(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,m,f,d;switch(c){case 1:i<128&&(a=i);break;case 2:u=t[o+1],(u&192)===128&&(d=(i&31)<<6|u&63,d>127&&(a=d));break;case 3:u=t[o+1],m=t[o+2],(u&192)===128&&(m&192)===128&&(d=(i&15)<<12|(u&63)<<6|m&63,d>2047&&(d<55296||d>57343)&&(a=d));break;case 4:u=t[o+1],m=t[o+2],f=t[o+3],(u&192)===128&&(m&192)===128&&(f&192)===128&&(d=(i&15)<<18|(u&63)<<12|(m&63)<<6|f&63,d>65535&&d<1114112&&(a=d))}}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 Vt(n)}var jr=4096;function Vt(t){var r=t.length;if(r<=jr)return String.fromCharCode.apply(String,t);for(var e="",n=0;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=jr));return e}function $t(t,r,e){var n="";e=Math.min(t.length,e);for(var o=r;o<e;++o)n+=String.fromCharCode(t[o]&127);return n}function Xt(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 zt(t,r,e){var n=t.length;(!r||r<0)&&(r=0),(!e||e<0||e>n)&&(e=n);for(var o="",i=r;i<e;++i)o+=Zt(t[i]);return o}function qt(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 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")}s.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};s.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};s.prototype.readUInt8=function(r,e){return e||A(r,1,this.length),this[r]};s.prototype.readUInt16LE=function(r,e){return e||A(r,2,this.length),this[r]|this[r+1]<<8};s.prototype.readUInt16BE=function(r,e){return e||A(r,2,this.length),this[r]<<8|this[r+1]};s.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};s.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])};s.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};s.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};s.prototype.readInt8=function(r,e){return e||A(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};s.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};s.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};s.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};s.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]};s.prototype.readFloatLE=function(r,e){return e||A(r,4,this.length),lr(this,r,!0,23,4)};s.prototype.readFloatBE=function(r,e){return e||A(r,4,this.length),lr(this,r,!1,23,4)};s.prototype.readDoubleLE=function(r,e){return e||A(r,8,this.length),lr(this,r,!0,52,8)};s.prototype.readDoubleBE=function(r,e){return e||A(r,8,this.length),lr(this,r,!1,52,8)};function y(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")}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 cr(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):cr(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):cr(this,r,e,!1),e+2};function ur(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):ur(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):ur(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):cr(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):cr(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):ur(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):ur(this,r,e,!1),e+4};function ie(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||ie(t,r,e,4,34028234663852886e22,-34028234663852886e22),pe(t,r,e,n,23,4),e+4}s.prototype.writeFloatLE=function(r,e,n){return ae(this,r,e,!0,n)};s.prototype.writeFloatBE=function(r,e,n){return ae(this,r,e,!1,n)};function se(t,r,e,n,o){return o||ie(t,r,e,8,17976931348623157e292,-17976931348623157e292),pe(t,r,e,n,52,8),e+8}s.prototype.writeDoubleLE=function(r,e,n){return se(this,r,e,!0,n)};s.prototype.writeDoubleBE=function(r,e,n){return se(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=D(r)?r:sr(new s(r,o).toString()),u=c.length;for(a=0;a<n-e;++a)this[a+e]=c[a%u]}return this};var Jt=/[^+\/0-9A-Za-z-_]/g;function jt(t){if(t=Qt(t).replace(Jt,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function Qt(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function Zt(t){return t<16?"0"+t.toString(16):t.toString(16)}function sr(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 rn(t){for(var r=[],e=0;e<t.length;++e)r.push(t.charCodeAt(e)&255);return r}function en(t,r){for(var e,n,o,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 ce(t){return Dt(jt(t))}function pr(t,r,e,n){for(var o=0;o<n&&!(o+e>=r.length||o>=t.length);++o)r[o+e]=t[o];return o}function tn(t){return t!==t}function nn(t){return t!=null&&(!!t._isBuffer||ue(t)||on(t))}function ue(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function on(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&ue(t.slice(0,0))}function lr(t,r,e,n,o){var i,a,c=o*8-n-1,u=(1<<c)-1,m=u>>1,f=-7,d=e?o-1:0,E=e?-1:1,g=t[r+d];for(d+=E,i=g&(1<<-f)-1,g>>=-f,f+=c;f>0;i=i*256+t[r+d],d+=E,f-=8);for(a=i&(1<<-f)-1,i>>=-f,f+=n;f>0;a=a*256+t[r+d],d+=E,f-=8);if(i===0)i=1-m;else{if(i===u)return a?NaN:(g?-1:1)*(1/0);a=a+Math.pow(2,n),i=i-m}return(g?-1:1)*a*Math.pow(2,i-n)}function pe(t,r,e,n,o,i){var a,c,u,m=i*8-o-1,f=(1<<m)-1,d=f>>1,E=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,g=n?0:i-1,h=n?1:-1,k=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+d>=1?r+=E/u:r+=E*Math.pow(2,1-d),r*u>=2&&(a++,u/=2),a+d>=f?(c=0,a=f):a+d>=1?(c=(r*u-1)*Math.pow(2,o),a=a+d):(c=r*Math.pow(2,d-1)*Math.pow(2,o),a=0));o>=8;t[e+g]=c&255,g+=h,c/=256,o-=8);for(a=a<<o|c,m+=o;m>0;t[e+g]=a&255,g+=h,a/=256,m-=8);t[e+g-h]|=k*128}import ze from"algosdk";import*as Yr from"bs58";import Pe from"algosdk";import yo,{decodeAddress as Io,encodeAddress as Ro}from"algosdk";var B=[],N=[],an=typeof Uint8Array<"u"?Uint8Array:Array,Nr=!1;function fe(){Nr=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,e=t.length;r<e;++r)B[r]=t[r],N[t.charCodeAt(r)]=r;N[45]=62,N[95]=63}function sn(t){Nr||fe();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 an(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=N[t.charCodeAt(r)]<<18|N[t.charCodeAt(r+1)]<<12|N[t.charCodeAt(r+2)]<<6|N[t.charCodeAt(r+3)],a[u++]=o>>16&255,a[u++]=o>>8&255,a[u++]=o&255;return i===2?(o=N[t.charCodeAt(r)]<<2|N[t.charCodeAt(r+1)]>>4,a[u++]=o&255):i===1&&(o=N[t.charCodeAt(r)]<<10|N[t.charCodeAt(r+1)]<<4|N[t.charCodeAt(r+2)]>>2,a[u++]=o>>8&255,a[u++]=o&255),a}function cn(t){return B[t>>18&63]+B[t>>12&63]+B[t>>6&63]+B[t&63]}function un(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(cn(n));return o.join("")}function le(t){Nr||fe();for(var r,e=t.length,n=e%3,o="",i=[],a=16383,c=0,u=e-n;c<u;c+=a)i.push(un(t,c,c+a>u?u:c+a));return n===1?(r=t[e-1],o+=B[r>>2],o+=B[r<<4&63],o+="=="):n===2&&(r=(t[e-2]<<8)+t[e-1],o+=B[r>>10],o+=B[r>>4&63],o+=B[r<<2&63],o+="="),i.push(o),i.join("")}function fr(t,r,e,n,o){var i,a,c=o*8-n-1,u=(1<<c)-1,m=u>>1,f=-7,d=e?o-1:0,E=e?-1:1,g=t[r+d];for(d+=E,i=g&(1<<-f)-1,g>>=-f,f+=c;f>0;i=i*256+t[r+d],d+=E,f-=8);for(a=i&(1<<-f)-1,i>>=-f,f+=n;f>0;a=a*256+t[r+d],d+=E,f-=8);if(i===0)i=1-m;else{if(i===u)return a?NaN:(g?-1:1)*(1/0);a=a+Math.pow(2,n),i=i-m}return(g?-1:1)*a*Math.pow(2,i-n)}function ge(t,r,e,n,o,i){var a,c,u,m=i*8-o-1,f=(1<<m)-1,d=f>>1,E=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,g=n?0:i-1,h=n?1:-1,k=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+d>=1?r+=E/u:r+=E*Math.pow(2,1-d),r*u>=2&&(a++,u/=2),a+d>=f?(c=0,a=f):a+d>=1?(c=(r*u-1)*Math.pow(2,o),a=a+d):(c=r*Math.pow(2,d-1)*Math.pow(2,o),a=0));o>=8;t[e+g]=c&255,g+=h,c/=256,o-=8);for(a=a<<o|c,m+=o;m>0;t[e+g]=a&255,g+=h,a/=256,m-=8);t[e+g-h]|=k*128}var pn={}.toString,he=Array.isArray||function(t){return pn.call(t)=="[object Array]"};var ln=50;p.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;var Eo=mr();function mr(){return p.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function v(t,r){if(mr()<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 Sr(this,t)}return xe(this,t,r,e)}p.poolSize=8192;p._augment=function(t){return t.__proto__=p.prototype,t};function xe(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?fn(t,r,e,n):typeof r=="string"?dn(t,r,e):gn(t,r)}p.from=function(t,r,e){return xe(null,t,r,e)};p.TYPED_ARRAY_SUPPORT&&(p.prototype.__proto__=Uint8Array.prototype,p.__proto__=Uint8Array);function Ee(t){if(typeof t!="number")throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function mn(t,r,e,n){return Ee(r),r<=0?v(t,r):e!==void 0?typeof n=="string"?v(t,r).fill(e,n):v(t,r).fill(e):v(t,r)}p.alloc=function(t,r,e){return mn(null,t,r,e)};function Sr(t,r){if(Ee(r),t=v(t,r<0?0:Or(r)|0),!p.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}p.allocUnsafe=function(t){return Sr(null,t)};p.allocUnsafeSlow=function(t){return Sr(null,t)};function dn(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=be(r,e)|0;t=v(t,n);var o=t.write(r,e);return o!==n&&(t=t.slice(0,o)),t}function wr(t,r){var e=r.length<0?0:Or(r.length)|0;t=v(t,e);for(var n=0;n<e;n+=1)t[n]=r[n]&255;return t}function fn(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=wr(t,r),t}function gn(t,r){if(P(r)){var e=Or(r.length)|0;return t=v(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"||kn(r.length)?v(t,0):wr(t,r);if(r.type==="Buffer"&&he(r.data))return wr(t,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function Or(t){if(t>=mr())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+mr().toString(16)+" bytes");return t|0}p.isBuffer=Un;function P(t){return!!(t!=null&&t._isBuffer)}p.compare=function(r,e){if(!P(r)||!P(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(!he(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(!P(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(o,i),i+=a.length}return o};function be(t,r){if(P(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 dr(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return we(t).length;default:if(n)return dr(t).length;r=(""+r).toLowerCase(),n=!0}}p.byteLength=be;function hn(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 wn(this,r,e);case"utf8":case"utf-8":return _e(this,r,e);case"ascii":return In(this,r,e);case"latin1":case"binary":return Rn(this,r,e);case"base64":return _n(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Nn(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}p.prototype._isBuffer=!0;function $(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)$(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)$(this,e,e+3),$(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)$(this,e,e+7),$(this,e+1,e+6),$(this,e+2,e+5),$(this,e+3,e+4);return this};p.prototype.toString=function(){var r=this.length|0;return r===0?"":arguments.length===0?_e(this,0,r):hn.apply(this,arguments)};p.prototype.equals=function(r){if(!P(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=ln;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(!P(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),m=this.slice(o,i),f=r.slice(e,n),d=0;d<u;++d)if(m[d]!==f[d]){a=m[d],c=f[d];break}return a<c?-1:c<a?1:0};function Ae(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)),P(r))return r.length===0?-1:me(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):me(t,[r],e,n,o);throw new TypeError("val must be string, number or Buffer")}function me(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,h){return i===1?g[h]:g.readUInt16BE(h*i)}var m;if(o){var f=-1;for(m=e;m<a;m++)if(u(t,m)===u(r,f===-1?0:m-f)){if(f===-1&&(f=m),m-f+1===c)return f*i}else f!==-1&&(m-=m-f),f=-1}else for(e+c>a&&(e=a-c),m=e;m>=0;m--){for(var d=!0,E=0;E<c;E++)if(u(t,m+E)!==u(r,E)){d=!1;break}if(d)return m}return-1}p.prototype.includes=function(r,e,n){return this.indexOf(r,e,n)!==-1};p.prototype.indexOf=function(r,e,n){return Ae(this,r,e,n,!0)};p.prototype.lastIndexOf=function(r,e,n){return Ae(this,r,e,n,!1)};function xn(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 En(t,r,e,n){return xr(dr(r,t.length-e),t,e,n)}function Te(t,r,e,n){return xr(Bn(r),t,e,n)}function bn(t,r,e,n){return Te(t,r,e,n)}function An(t,r,e,n){return xr(we(r),t,e,n)}function Tn(t,r,e,n){return xr(Pn(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 xn(this,r,e,n);case"utf8":case"utf-8":return En(this,r,e,n);case"ascii":return Te(this,r,e,n);case"latin1":case"binary":return bn(this,r,e,n);case"base64":return An(this,r,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Tn(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 _n(t,r,e){return r===0&&e===t.length?le(t):le(t.slice(r,e))}function _e(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,m,f,d;switch(c){case 1:i<128&&(a=i);break;case 2:u=t[o+1],(u&192)===128&&(d=(i&31)<<6|u&63,d>127&&(a=d));break;case 3:u=t[o+1],m=t[o+2],(u&192)===128&&(m&192)===128&&(d=(i&15)<<12|(u&63)<<6|m&63,d>2047&&(d<55296||d>57343)&&(a=d));break;case 4:u=t[o+1],m=t[o+2],f=t[o+3],(u&192)===128&&(m&192)===128&&(f&192)===128&&(d=(i&15)<<18|(u&63)<<12|(m&63)<<6|f&63,d>65535&&d<1114112&&(a=d))}}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 yn(n)}var de=4096;function yn(t){var r=t.length;if(r<=de)return String.fromCharCode.apply(String,t);for(var e="",n=0;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=de));return e}function In(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 Rn(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 wn(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+=Dn(t[i]);return o}function Nn(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 T(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||T(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||T(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||T(r,1,this.length),this[r]};p.prototype.readUInt16LE=function(r,e){return e||T(r,2,this.length),this[r]|this[r+1]<<8};p.prototype.readUInt16BE=function(r,e){return e||T(r,2,this.length),this[r]<<8|this[r+1]};p.prototype.readUInt32LE=function(r,e){return e||T(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||T(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||T(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||T(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||T(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};p.prototype.readInt16LE=function(r,e){e||T(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||T(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||T(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||T(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||T(r,4,this.length),fr(this,r,!0,23,4)};p.prototype.readFloatBE=function(r,e){return e||T(r,4,this.length),fr(this,r,!1,23,4)};p.prototype.readDoubleLE=function(r,e){return e||T(r,8,this.length),fr(this,r,!0,52,8)};p.prototype.readDoubleBE=function(r,e){return e||T(r,8,this.length),fr(this,r,!1,52,8)};function I(t,r,e,n,o,i){if(!P(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 gr(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):gr(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):gr(this,r,e,!1),e+2};function hr(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):hr(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):hr(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):gr(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):gr(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):hr(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):hr(this,r,e,!1),e+4};function ye(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 Ie(t,r,e,n,o){return o||ye(t,r,e,4),ge(t,r,e,n,23,4),e+4}p.prototype.writeFloatLE=function(r,e,n){return Ie(this,r,e,!0,n)};p.prototype.writeFloatBE=function(r,e,n){return Ie(this,r,e,!1,n)};function Re(t,r,e,n,o){return o||ye(t,r,e,8),ge(t,r,e,n,52,8),e+8}p.prototype.writeDoubleLE=function(r,e,n){return Re(this,r,e,!0,n)};p.prototype.writeDoubleBE=function(r,e,n){return Re(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=P(r)?r:dr(new p(r,o).toString()),u=c.length;for(a=0;a<n-e;++a)this[a+e]=c[a%u]}return this};var Sn=/[^+\/0-9A-Za-z-_]/g;function On(t){if(t=Cn(t).replace(Sn,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function Cn(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function Dn(t){return t<16?"0"+t.toString(16):t.toString(16)}function dr(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 Bn(t){for(var r=[],e=0;e<t.length;++e)r.push(t.charCodeAt(e)&255);return r}function Pn(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 we(t){return sn(On(t))}function xr(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 kn(t){return t!==t}function Un(t){return t!=null&&(!!t._isBuffer||Ne(t)||Ln(t))}function Ne(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function Ln(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&Ne(t.slice(0,0))}import{encodeAddress as Mn,decodeAddress as Do}from"algosdk";function S(t){return t.reduce((r,e)=>Uint8Array.from([...r,...e]))}function rr(t){return new Uint8Array(p.from(t))}function Se(t){return p.from(t).toString("utf-8")}function Oe(t){let r=BigInt(0);for(let e=0;e<8&&t?.length;e++)r=r<<BigInt(8)|BigInt(t[e]);return r}function Ce(t){return p.from(t).toString("base64")}function Er(t){return p.from(t,"base64")}import vn from"bignumber.js";vn.config({DECIMAL_PLACES:40,EXPONENTIAL_AT:45});var jo=`{"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 Be={V1_1:"v1_1",V2:"v2"},ei={[Be.V1_1]:{testnet:62368684,mainnet:552635992},[Be.V2]:{testnet:148607e3,mainnet:1002541853}};var Cr=async(t,r,e)=>{try{let{value:n}=await t.getApplicationBoxByName(r,e).do();return n}catch(n){if(n.message.includes("box not found"))return console.log(`Box not found '${s.from(e).toString("hex")}'`),null;throw n}},X=async(t,r=1)=>{let e=await t.getTransactionParams().do();return r>1&&(e.fee=Pe.ALGORAND_MIN_TX_FEE*r,e.flatFee=!0),{...e}};var ke=t=>Pe.decodeAddress(t.toUpperCase()).publicKey;import*as b from"ethereumjs-util";function Dr(t){let r=b.fromSigned(s.from(t));return BigInt(r.toString())}function Wn(t){return b.toUnsigned(new b.BN(String(t)))}function Br(t){let r=Wn(t);if(r.length>32)throw new Error("Invalid value. The buffer length of the value is more than 32");return new Uint8Array(b.setLengthLeft(r,32))}var Ue=t=>{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(!Hn(e))throw new Error("Invalid hex address");return e},Le=t=>new Uint8Array(b.setLengthLeft(er(t),32)),er=t=>s.from(Kn(t),"hex"),Kn=t=>t.startsWith("0x")?t.slice(2):t,Hn=t=>b.isValidAddress(t),Me=(t,r)=>{let e=b.keccak256(t),{r:n,s:o,v:i}=b.fromRpcSig(r);return b.ecrecover(e,i,n,o)};var tr=t=>new Uint8Array(b.keccak256(s.from(t)));import G from"algosdk";import*as Lr from"bs58";var Fe=(t,r)=>String(t).toLowerCase()===String(r).toLowerCase();import kr from"algosdk";var Ur=(t,r,e,n,o,i)=>{let a=R("dummy(uint64)void",[1]);return kr.makeApplicationNoOpTxnFromObject({from:r,suggestedParams:{...e,fee:kr.ALGORAND_MIN_TX_FEE,flatFee:!0},appArgs:a,appIndex:t,boxes:n,foreignApps:i,note:new Uint8Array(s.from(o))})},$n=(t,r)=>{let{accounts:n,foreignAssets:o,foreignApps:i,boxes:a,appIndex:c,from:u,suggestedParams:m}=r;console.log("Total resources",[n,i,o,a]);let f=[n,i,o,a].reduce((O,Z)=>O+(Z?.length||0),0),d=a?.slice(0,8-f)||[],E=a?.slice(8-f)||[],g=8-(i?.length||0),h=kr.makeApplicationNoOpTxnFromObject({...r,boxes:d}),k=1,U=[],W=[];for(let O=0;O<E.length;O++){let Z=E[O];U.push(Z),(U.length===g||O===E.length-1)&&(W.push(Ur(c,u,m,U,`${t}_${k}`,i)),U=[],k++)}return W.push(Ur(c,u,m,[],`${t}_${++k}`,i)),console.log("dummy count",W.length),[h,...W]};var Ye=(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))(Ye||{}),Ge=(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))(Ge||{}),bs={...Ye,...Ge};var nr={"0x4343545055534443000000000000000000000000000000000000000000000000":65537};var zc={SMALLESTUNIT:l.env.SMALLEST_UNIT},qc={SMALLEST_UNITS:l.env.SMALLEST_UNIT};var ru=["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 su=l.env.REACT_APP_API_URL,cu=l.env.REACT_APP_SOCKET_URL,uu=l.env.REACT_APP_ALGO_SERVER,pu=l.env.REACT_APP_ALGO_SERVER_PORT||"",lu=l.env.REACT_APP_ALGOD_TOKEN||"",mu=l.env.REACT_APP_DISPENSER_LINK,du=l.env.REACT_APP_FRONTEND_LINK||"",fu=l.env.REACT_APP_ALGO_EXPLORER_LINK,gu=l.env.REACT_APP_ALGO_EXPLORER_ASSETS_URL,hu=(l.env.REACT_APP_REQUIRE_ACCESS_CODE||"").toLowerCase()==="true",xu=l.env.REACT_APP_USERBACK_ACCESS_TOKEN,Eu=(l.env.REACT_APP_EXT_ORDER_TYPES||"").toLowerCase()==="true";var bu=.001*10**6,Au=.002*10**6;var Tu=l.env.REACT_APP_MASTER_APP_ID||"406",_u=l.env.REACT_APP_AGG_APP_ID||"408",yu=Number(l.env.REACT_APP_CODEX_APP_ID||"467960617");var qn=l.env.REACT_APP_ALGO_NETWORK||"";var Iu=qn.toLowerCase()==="mainnet"?"mainnet":"testnet";var Du={1:"canFollowAccounts",4:"canLikeTweets",2:"canCreateTweets",3:"canCreateTweets"};var x=(t,r,e)=>{switch(r){case"8B":return G.encodeUint64(Number(t));case"32B":return Br(t);case"str":return rr(String(t));case"address":return Q(String(t),e);case"token":return Ve(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(G.encodeUint64(Number(t))).subarray(-1));case"2B":return new Uint8Array(s.from(G.encodeUint64(Number(t))).subarray(-2));case"4B":return new Uint8Array(s.from(G.encodeUint64(Number(t))).subarray(-4));default:return s.from(t.toString())}},_=(t,r,e)=>{switch(r){case"8B":return G.decodeUint64(t,"safe");case"32B":return Dr(t);case"str":return Se(t);case"address":return He(t,e);case"token":return Jn(t,e);case"float":return s.from(t).readDoubleBE(0);case"bool":case"2B":return _(t,"8B");default:return s.from(t).toString()}};var He=(t,r)=>r===8?G.encodeAddress(t):r===1?Lr.encode(t):Ue(t),Jn=(t,r)=>{let e=s.from(t).toString("hex");return e.startsWith("0x")||(e="0x"+e),nr[e]?e:r===8?String(Dr(t)):r===1?Lr.encode(t):He(t,r)};var Ve=(t,r)=>r===8?Br(+t):nr[t]?new Uint8Array(er(String(t))):Q(String(t),r);var j=(t,r,e,n)=>{let o=Q(t,r),i=G.encodeUint64(r),a=G.encodeUint64(n),c=Ve(e,n);return S([o,i,c,a])};var $e=(t,r)=>{let e=Q(t,r),n=rr("TK_");return S([n,e])};var Mr=(t,r,e=tr)=>r.map(o=>({appIndex:t,name:e(o)}));var vr=t=>new Uint8Array(s.from(Ce(t)));var br=t=>s.from(tr(t)).toString("hex"),Ar=(t,r)=>S([x(r,"str"),tr(t)]),Tr=(t,r)=>S([x(r,"str"),s.from(t,"hex")]),R=(t,r)=>{let e=ze.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]},z=(t,r,e)=>{let n=s.from(t,r),o=n.subarray(n.length-e),i=s.from(o).toString();return Er(i)},or=(t,r,e,n,o="hex")=>[Pr(t,o,n),Qn(r,n),Zn(e,n,t,r,o)],Qn=(t,r)=>r===8?Er(t):r===1?Yr.decode(t):er(t),Zn=(t,r,e,n,o)=>r===8||r===1?Q(t,r):Me(Pr(e,o,r),n),ro=(t,r)=>r===8?"MX":r===1?"":`Ethereum Signed Message:
2
+ ${t.length}`,Pr=(t,r,e)=>{let n=s.from(t,r);return s.concat([rr(ro(n,e)),n])},Vn=t=>{switch(t){case"ALGORAND":return 8;case"SOLANA":return 1;case"EVM":return 5;default:return 5}},Q=(t,r)=>r===8?ke(t):r===1?Yr.decode(t):Le(t),Tp=t=>ze.isValidAddress(t)?8:t.startsWith("0x")?5:1,_p=t=>{let r=t.trim();return r.startsWith("0x")&&r.length===42?5:r.length===58&&/^[A-Z2-7]+$/.test(r)?8:r.length>=32&&r.length<=44&&/^[1-9A-HJ-NP-Za-km-z]+$/.test(r)?1:0};import Gr from"algosdk";var qe=()=>x("MBR","str"),Dp=async(t,r)=>{let e=qe();try{let n=await Cr(t,r,e);if(!n)return;let o=Oe(n);return console.log("Box MBR",o),o}catch(n){console.log("err",n)}},Bp=async(t,r,e,n,{amount:o,type:i})=>{let a=R("updateMBR(byte[],uint64)uint64",[x(i,"str"),o]),c=i==="withdraw"?[n]:[],m=await X(t,i==="withdraw"?2:1),f=Gr.makeApplicationNoOpTxnFromObject({appIndex:e,from:r,suggestedParams:m,appArgs:a,boxes:[{appIndex:e,name:qe()}],foreignApps:c});if(console.log("updateMbr txn",f,r),i==="deposit"){let d={suggestedParams:m,from:r,to:Gr.getApplicationAddress(e),amount:o};return[Gr.makePaymentTxnWithSuggestedParamsFromObject(d),f]}return[f]};import Je from"algosdk";var Yp=async(t,r,e,n)=>{let i=await X(t,1);return i.flatFee=!0,i.fee=4e3,console.log("new MNA key:",n),console.log("sender:",e),console.log("superAppId:",r),Je.makeApplicationNoOpTxnFromObject({appIndex:r,from:e,suggestedParams:i,appArgs:R("set_global(byte[],byte[],byte[])void",[x("MNA","str"),Je.decodeAddress(n).publicKey,x("S","str")])})};import eo from"algosdk";var Fr=(t,r="hex")=>z(t,r,328),jn=(t,r)=>Ar(Fr(t,r),"O_"),Xe=t=>Tr(t,"O_"),qp=t=>br(Fr(t,"hex")),Jp=(t,r,e,n,o=[])=>{let i=n.map(m=>Xe(m));console.log("makeRemoveExpiredOrderTxn => boxKeys",JSON.stringify(i.map(m=>s.from(m).toString("hex"))));let a=i.map(m=>({appIndex:r,name:m})),c=R("removeExpiredData(byte[],byte[])uint64",[x("O_","str"),S(i)]);return eo.makeApplicationNoOpTxnFromObject({appIndex:r,from:t,suggestedParams:e,appArgs:c,boxes:a,foreignApps:o})};import je from"algosdk";var to=(e=>(e.MAINTENANCE="MTN",e.STOP_CREATE="STOP_CREATE",e))(to||{}),no=(h=>(h.MNA="MNA",h.MIN_PRICE_INCREMENT="MIN_PRICE_INC",h.MIN_SIZE_INCREMENT="MIN_SIZE_INC",h.MIN_ORDER_SIZE="MIN_ORDER_SIZE",h.ROYALTY="ROYALTY",h.OWNER_APP="OWNER_APP",h.UL_SUPERADMIN_APP="UL_SUPERADMIN_APP",h.UL_SUPERADMIN_WALLET="UL_SUPERADMIN_WALLET",h.UL_FEE_BALANCE_BASE="UL_FEE_BALANCE_BASE",h.UL_FEE_BALANCE_PRICE="UL_FEE_BALANCE_PRICE",h.UL_MIN_FEE="UL_MIN_FEE",h.UL_MAX_FEE="UL_MAX_FEE",h.UL_TFEE="UL_TFEE",h.UL_MFEE="UL_MFEE",h))(no||{}),oo=(n=>(n.NUMBER="N",n.STRING="S",n.ADDRESS="A",n))(oo||{}),ol=async(t,r,e,n,o,i)=>{let c=await X(t,1);c.flatFee=!0,c.fee=1e3;let u=i==="N"?x(o,"8B"):i==="A"?je.decodeAddress(o).publicKey:x(o,"str");return je.makeApplicationNoOpTxnFromObject({appIndex:r,from:e,suggestedParams:c,appArgs:R("set_global(byte[],byte[],byte[])void",[x(n,"str"),u,x(i,"str")])})};var io="CCTPUSDC",ao=65537;function so(){let t=s.alloc(32,0);return s.from(io,"utf-8").copy(t),t}function cl(){return{address:"0x"+so().toString("hex"),chainId:ao}}import co from"algosdk";var Qe=160,Wr=224,uo=(t,r)=>Ar(Ze(t,r),"T_"),Al=t=>Tr(t,"T_"),Tl=t=>br(Ze(t)),Ze=(t,r="hex")=>z(t,r,Wr),_l=(t,r="hex")=>{let e=z(t,r,Qe),n=Number(_(e.subarray(32,40),"8B")),o=Number(_(e.subarray(72,80),"8B"));return{loginAddress:String(_(e.subarray(0,32),"address",n)),loginChainId:n,recipient:String(_(e.subarray(40,72),"address",o)),recipientChainId:o,tkAddress:String(_(e.subarray(80,112),"address",8)),expiredDate:Number(_(e.subarray(112,120),"8B"))}},yl=t=>{let{loginAddress:r,loginChainId:e,recipient:n,recipientChainId:o,tkAddress:i,expiredDate:a}=t,c=S([x(r,"address",e),x(e,"8B"),x(n,"address",o),x(o,"8B"),x(i,"address",8),x(a,"8B")]),u=vr(c);return console.log(`Dtw data should be ${Qe} bytes`,u.length,u),u},Il=(t,r="hex")=>{let e=z(t,r,Wr),n=Number(_(e.subarray(32,40),"8B")),o=Number(_(e.subarray(72,80),"8B")),i=Number(_(e.subarray(112,120),"8B"));return{loginAddress:String(_(e.subarray(0,32),"address",n)),loginChainId:n,recipient:String(_(e.subarray(40,72),"address",o)),recipientChainId:o,tokenIndex:String(_(e.subarray(80,112),"token",i)),tokenChainId:i,tokenAmount:String(_(e.subarray(120,152),"32B")),expiredDate:Number(_(e.subarray(152,160),"8B")),random:Number(_(e.subarray(160,168),"8B"))}},Rl=t=>{let{loginAddress:r,loginChainId:e,recipient:n,recipientChainId:o,tokenAmount:i,tokenIndex:a,tokenChainId:c,expiredDate:u,random:m}=t,f=S([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(m,"8B")]),d=vr(f);return console.log(`Transfer data should be ${Wr} bytes`,d.length,d),d},wl=async({data:t,message:r,signature:e},n,o)=>{let{loginAddress:i,loginChainId:a,recipient:c,recipientChainId:u,tokenIndex:m,tokenChainId:f}=t,{appId:d,sender:E,superWallet:g}=o,h=n?[...or(r,e,n.data.tkAddress,8),...or(n.message,n.signature,i,a)]:[...or(r,e,i,a),s.alloc(0),s.alloc(0),s.alloc(0)],k=R("directTransfer(byte[],byte[],byte[],byte[],byte[],byte[],uint64)uint64",[...h,o.transferId]),U="0x4343545055534443000000000000000000000000000000000000000000000000",W=nr[U],O=[j(i,a,m,f),j(c,u,m,f),j(g.address,g.chainId,m,f)];Fe(m,U)||O.push(j(i,a,U,W),j(g.address,g.chainId,U,W)),n&&O.push($e(i,a));let Z=[...Mr(d,O),...Mr(d,[uo(r,"hex")],tt=>tt)],rt=[o.superAppId],et=n?9:6;return co.makeApplicationNoOpTxnFromObject({appIndex:d,from:E,suggestedParams:await o.getTxnParams(et),appArgs:k,foreignApps:rt,boxes:Z})};export{no as AppGlobalParamName,oo as AppGlobalParamType,Qe as DTW_DATA_BYTES_LENGTH,to as SuperAppGlobalParamName,Wr as TRANSFER_DATA_BYTES_LENGTH,qp as calcOrderHash,Tl as calcTransferHash,_l as decodeDtwMsg,Qn as decodeSignature,Il as decodeTransferMsg,_p as detectChainByAddress,Q as encodeAddress,br as generateHash,R as getAppArgs,Ar as getBoxKey,Tr as getBoxKeyFromHash,Tp as getChainId,z as getDataBytesFromMsg,Dp as getMbrBoxValue,or as getMsgArgs,jn as getOrderBoxKey,Xe as getOrderBoxKeyFromHash,Fr as getOrderBytesFromMsg,Pr as getPrefixedMessage,Vn as getProviderChainId,Zn as getPublicKey,uo as getTransferBoxKey,Al as getTransferBoxKeyFromHash,Ze as getTransferBytesFromMsg,so as getUnifiedUSDC,cl as getUnifiedUSDCToken,yl as makeDtwMsg,Ur as makeDummyTxn,$n as makeGroupTxnsWithDummy,Jp as makeRemoveExpiredOrderTxn,ol as makeSetGlobalTxn,Yp as makeSetManagerKeyTxn,Rl as makeTransferMsg,wl as makeTransferTxn,Bp as makeUpdateMbrTxn,ao as unified_CCTP_ChainID,io as unified_CCTP_token};
3
3
  /*!
4
4
  * The buffer module from node.js, for the browser.
5
5
  *